diff options
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/Ice/background/Transceiver.cpp | 5 | ||||
-rw-r--r-- | cpp/test/Ice/background/Transceiver.h | 2 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/AllTests.cpp | 19 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/Client.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/Collocated.cpp | 1 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/Server.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/ServerAMD.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/operations/BatchOneways.cpp | 21 | ||||
-rw-r--r-- | cpp/test/Ice/operations/BatchOnewaysAMI.cpp | 30 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Client.cpp | 7 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Collocated.cpp | 7 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Test.ice | 2 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMD.ice | 1 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.cpp | 15 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.h | 6 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.cpp | 15 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.h | 8 |
17 files changed, 74 insertions, 74 deletions
diff --git a/cpp/test/Ice/background/Transceiver.cpp b/cpp/test/Ice/background/Transceiver.cpp index 3156b7343cd..4cfc8acd6ca 100644 --- a/cpp/test/Ice/background/Transceiver.cpp +++ b/cpp/test/Ice/background/Transceiver.cpp @@ -238,9 +238,9 @@ Transceiver::getInfo() const } void -Transceiver::checkSendSize(const IceInternal::Buffer& buf, size_t messageSizeMax) +Transceiver::checkSendSize(const IceInternal::Buffer& buf) { - _transceiver->checkSendSize(buf, messageSizeMax); + _transceiver->checkSendSize(buf); } // @@ -250,7 +250,6 @@ Transceiver::Transceiver(const IceInternal::TransceiverPtr& transceiver) : _transceiver(transceiver), _configuration(Configuration::getInstance()), _initialized(false), - _readBuffer(0), _buffered(_configuration->buffered()) { _readBuffer.b.resize(1024 * 8); // 8KB buffer diff --git a/cpp/test/Ice/background/Transceiver.h b/cpp/test/Ice/background/Transceiver.h index 68df63a0f65..8ff244000ea 100644 --- a/cpp/test/Ice/background/Transceiver.h +++ b/cpp/test/Ice/background/Transceiver.h @@ -34,7 +34,7 @@ public: virtual std::string toDetailedString() const; virtual Ice::ConnectionInfoPtr getInfo() const; virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&, bool&); - virtual void checkSendSize(const IceInternal::Buffer&, size_t); + virtual void checkSendSize(const IceInternal::Buffer&); IceInternal::TransceiverPtr delegate() const { return _transceiver; } diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 36a55f54c49..f03bdab60b5 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -908,6 +908,7 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "ok" << endl; } + if(thrower->ice_getConnection()) { cout << "testing memory limit marshal exception..." << flush; try @@ -915,7 +916,7 @@ allTests(const Ice::CommunicatorPtr& communicator) thrower->throwMemoryLimitException(Ice::ByteSeq()); test(false); } - catch(const Ice::UnknownLocalException&) + catch(const Ice::MemoryLimitException&) { } catch(...) @@ -928,21 +929,7 @@ allTests(const Ice::CommunicatorPtr& communicator) thrower->throwMemoryLimitException(Ice::ByteSeq(20 * 1024)); // 20KB test(false); } - catch(const Ice::MemoryLimitException&) - { - } - catch(...) - { - test(false); - } - - try - { - thrower->end_throwMemoryLimitException( - thrower->begin_throwMemoryLimitException(Ice::ByteSeq(20 * 1024))); // 20KB - test(false); - } - catch(const Ice::MemoryLimitException&) + catch(const Ice::ConnectionLostException&) { } catch(...) diff --git a/cpp/test/Ice/exceptions/Client.cpp b/cpp/test/Ice/exceptions/Client.cpp index 86d7a75e493..01cea364100 100644 --- a/cpp/test/Ice/exceptions/Client.cpp +++ b/cpp/test/Ice/exceptions/Client.cpp @@ -34,7 +34,8 @@ main(int argc, char* argv[]) try { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(argc, argv); + initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); diff --git a/cpp/test/Ice/exceptions/Collocated.cpp b/cpp/test/Ice/exceptions/Collocated.cpp index bcd9e1882bb..305bb58af85 100644 --- a/cpp/test/Ice/exceptions/Collocated.cpp +++ b/cpp/test/Ice/exceptions/Collocated.cpp @@ -41,6 +41,7 @@ main(int argc, char* argv[]) Ice::InitializationData initData; initData.properties = Ice::createProperties(); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max + initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp index ef20b9c428f..d50ffc78dd6 100644 --- a/cpp/test/Ice/exceptions/Server.cpp +++ b/cpp/test/Ice/exceptions/Server.cpp @@ -36,8 +36,9 @@ main(int argc, char* argv[]) try { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); + initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max communicator = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/exceptions/ServerAMD.cpp b/cpp/test/Ice/exceptions/ServerAMD.cpp index 79e3bc1b165..04f4d5805bc 100644 --- a/cpp/test/Ice/exceptions/ServerAMD.cpp +++ b/cpp/test/Ice/exceptions/ServerAMD.cpp @@ -36,8 +36,9 @@ main(int argc, char* argv[]) try { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); + initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max communicator = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/operations/BatchOneways.cpp b/cpp/test/Ice/operations/BatchOneways.cpp index 97dad6c84c7..62baee3653b 100644 --- a/cpp/test/Ice/operations/BatchOneways.cpp +++ b/cpp/test/Ice/operations/BatchOneways.cpp @@ -18,7 +18,6 @@ batchOneways(const Test::MyClassPrx& p) { const Test::ByteS bs1(10 * 1024); const Test::ByteS bs2(99 * 1024); - const Test::ByteS bs3(100 * 1024); try { p->opByteSOneway(bs1); @@ -37,32 +36,30 @@ batchOneways(const Test::MyClassPrx& p) test(false); } - try - { - p->opByteSOneway(bs3); - test(false); - } - catch(const Ice::MemoryLimitException&) - { - } - Test::MyClassPrx batch = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway()); batch->ice_flushBatchRequests(); int i; - + p->opByteSOnewayCallCount(); // Reset the call count for(i = 0 ; i < 30 ; ++i) { try { batch->opByteSOneway(bs1); } - catch(const Ice::MemoryLimitException&) + catch(const Ice::LocalException&) { test(false); } } + int count = 0; + while(count != 27) // 3 * 9 requests auto-flushed. + { + count += p->opByteSOnewayCallCount(); + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10)); + } + if(batch->ice_getConnection()) { batch->ice_getConnection()->flushBatchRequests(); diff --git a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp index a722b7868ee..a56d1f8d214 100644 --- a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp +++ b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp @@ -74,28 +74,6 @@ public: } }; -class Callback_ByteSOneway2 : public IceUtil::Shared -{ - CallbackPtr _cb; - -public: - - Callback_ByteSOneway2(const CallbackPtr& cb) : _cb(cb) - { - } - - void response() - { - test(false); - } - - void exception(const ::Ice::Exception& ex) - { - test(dynamic_cast<const ::Ice::MemoryLimitException*>(&ex)); - _cb->called(); - } -}; - class Callback_ByteSOneway3 : public IceUtil::Shared { public: @@ -149,10 +127,6 @@ batchOnewaysAMI(const Test::MyClassPrx& p) &Callback_ByteSOneway1::response, &Callback_ByteSOneway1::exception)); cb->check(); - p->begin_opByteSOneway(bs3, Test::newCallback_MyClass_opByteSOneway(new Callback_ByteSOneway2(cb), - &Callback_ByteSOneway2::response, &Callback_ByteSOneway2::exception)); - cb->check(); - Test::MyClassPrx batch = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway()); batch->end_ice_flushBatchRequests(batch->begin_ice_flushBatchRequests()); @@ -160,7 +134,9 @@ batchOnewaysAMI(const Test::MyClassPrx& p) for(i = 0 ; i < 30 ; ++i) { - p->begin_opByteSOneway(bs1, Test::newCallback_MyClass_opByteSOneway(new Callback_ByteSOneway3(), &Callback_ByteSOneway3::response, &Callback_ByteSOneway3::exception)); + p->begin_opByteSOneway(bs1, Test::newCallback_MyClass_opByteSOneway(new Callback_ByteSOneway3(), + &Callback_ByteSOneway3::response, + &Callback_ByteSOneway3::exception)); } if(batch->ice_getConnection()) diff --git a/cpp/test/Ice/operations/Client.cpp b/cpp/test/Ice/operations/Client.cpp index 69cf0d8f57a..5ac63b3ca0f 100644 --- a/cpp/test/Ice/operations/Client.cpp +++ b/cpp/test/Ice/operations/Client.cpp @@ -60,12 +60,7 @@ main(int argc, char* argv[]) initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - // - // We must set MessageSizeMax to an explicit values, because - // we run tests to check whether Ice.MemoryLimitException is - // raised as expected. - // - initData.properties->setProperty("Ice.MessageSizeMax", "100"); + initData.properties->setProperty("Ice.BatchAutoFlushSize", "100"); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator, initData); diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp index 1bae52850c1..8f9cf822279 100644 --- a/cpp/test/Ice/operations/Collocated.cpp +++ b/cpp/test/Ice/operations/Collocated.cpp @@ -44,12 +44,7 @@ main(int argc, char* argv[]) Ice::InitializationData initData; initData.properties = Ice::createProperties(argc, argv); - // - // We must set MessageSizeMax to an explicit values, because - // we run tests to check whether Ice.MemoryLimitException is - // raised as expected. - // - initData.properties->setProperty("Ice.MessageSizeMax", "100"); + initData.properties->setProperty("Ice.BatchAutoFlushSize", "100"); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator, initData); diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice index 004fe7eee02..6a7cbd17625 100644 --- a/cpp/test/Ice/operations/Test.ice +++ b/cpp/test/Ice/operations/Test.ice @@ -230,6 +230,8 @@ class MyClass void opByteSOneway(ByteS s); + int opByteSOnewayCallCount(); + Ice::Context opContext(); void opDoubleMarshaling(double p1, DoubleS p2); diff --git a/cpp/test/Ice/operations/TestAMD.ice b/cpp/test/Ice/operations/TestAMD.ice index 5f3828d96cf..57fce5ee6ae 100644 --- a/cpp/test/Ice/operations/TestAMD.ice +++ b/cpp/test/Ice/operations/TestAMD.ice @@ -227,6 +227,7 @@ dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD; IntS opIntS(IntS s); void opByteSOneway(ByteS s); + int opByteSOnewayCallCount(); Ice::Context opContext(); diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index ce242444937..e794f3c384d 100644 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp @@ -32,6 +32,10 @@ private: const Test::AMD_MyClass_opVoidPtr _cb; }; +MyDerivedClassI::MyDerivedClassI() : _opByteSOnewayCallCount(0) +{ +} + bool MyDerivedClassI::ice_isA(const std::string& id, const Ice::Current& current) const { @@ -637,10 +641,21 @@ void MyDerivedClassI::opByteSOneway_async(const Test::AMD_MyClass_opByteSOnewayPtr& cb, const Test::ByteS&, const Ice::Current&) { + IceUtil::Mutex::Lock sync(_mutex); + ++_opByteSOnewayCallCount; cb->ice_response(); } void +MyDerivedClassI::opByteSOnewayCallCount_async(const Test::AMD_MyClass_opByteSOnewayCallCountPtr& cb, + const Ice::Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + cb->ice_response(_opByteSOnewayCallCount); + _opByteSOnewayCallCount = 0; +} + +void MyDerivedClassI::opContext_async(const Test::AMD_MyClass_opContextPtr& cb, const Ice::Current& c) { Test::StringStringD r = c.ctx; diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h index 18cf15daa13..f7f83430a29 100644 --- a/cpp/test/Ice/operations/TestAMDI.h +++ b/cpp/test/Ice/operations/TestAMDI.h @@ -16,6 +16,8 @@ class MyDerivedClassI : public Test::MyDerivedClass { public: + + MyDerivedClassI(); // // Override the Object "pseudo" operations to verify the operation mode. @@ -206,6 +208,7 @@ public: virtual void opByteSOneway_async(const Test::AMD_MyClass_opByteSOnewayPtr&, const Test::ByteS&, const Ice::Current&); + virtual void opByteSOnewayCallCount_async(const Test::AMD_MyClass_opByteSOnewayCallCountPtr&, const Ice::Current&); virtual void opContext_async(const Test::AMD_MyClass_opContextPtr&, const Ice::Current&); @@ -225,6 +228,9 @@ private: IceUtil::ThreadPtr _opVoidThread; IceUtil::Mutex _opVoidMutex; + + IceUtil::Mutex _mutex; + int _opByteSOnewayCallCount; }; #endif diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index cc6423fcd03..6e5ec355950 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -14,6 +14,10 @@ #include <functional> #include <iterator> +MyDerivedClassI::MyDerivedClassI() : _opByteSOnewayCallCount(0) +{ +} + bool MyDerivedClassI::ice_isA(const std::string& id, const Ice::Current& current) const { @@ -610,6 +614,17 @@ MyDerivedClassI::opIntS(const Test::IntS& s, const Ice::Current&) void MyDerivedClassI::opByteSOneway(const Test::ByteS&, const Ice::Current&) { + IceUtil::Mutex::Lock sync(_mutex); + ++_opByteSOnewayCallCount; +} + +int +MyDerivedClassI::opByteSOnewayCallCount(const Ice::Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + int count = _opByteSOnewayCallCount; + _opByteSOnewayCallCount = 0; + return count; } Test::StringStringD diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index 78b14652c17..d40b9bd1f51 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -16,6 +16,8 @@ class MyDerivedClassI : public Test::MyDerivedClass { public: + MyDerivedClassI(); + // // Override the Object "pseudo" operations to verify the operation mode. // @@ -229,6 +231,7 @@ public: virtual Test::IntS opIntS(const Test::IntS&, const Ice::Current&); virtual void opByteSOneway(const Test::ByteS&, const Ice::Current&); + virtual int opByteSOnewayCallCount(const Ice::Current&); virtual Ice::Context opContext(const Ice::Current&); @@ -239,6 +242,11 @@ public: virtual void opNonmutating(const Ice::Current&); virtual void opDerived(const Ice::Current&); + +private: + + IceUtil::Mutex _mutex; + int _opByteSOnewayCallCount; }; #endif |