diff options
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/Ice/background/AllTests.cpp | 46 | ||||
-rw-r--r-- | cpp/test/Ice/binding/AllTests.cpp | 105 | ||||
-rwxr-xr-x | cpp/test/Ice/gc/run.py | 5 |
3 files changed, 149 insertions, 7 deletions
diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 5da5b39ee7b..1aa19dbefa8 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -701,6 +701,11 @@ validationTests(const ConfigurationPtr& configuration, { configuration->readException(0); } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } OpExAMICallbackPtr cbEx = new OpExAMICallback(); @@ -743,6 +748,11 @@ validationTests(const ConfigurationPtr& configuration, configuration->readException(0); configuration->readReady(true); } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } configuration->readReady(false); configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); @@ -781,6 +791,11 @@ validationTests(const ConfigurationPtr& configuration, { ctl->writeException(false); } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } try { @@ -809,7 +824,11 @@ validationTests(const ConfigurationPtr& configuration, ctl->writeException(false); ctl->writeReady(true); } - + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } Ice::ByteSeq seq; seq.resize(512 * 1024); @@ -833,7 +852,15 @@ validationTests(const ConfigurationPtr& configuration, backgroundBatchOneway->op(); backgroundBatchOneway->op(); ctl->resumeAdapter(); - backgroundBatchOneway->ice_flushBatchRequests(); + try + { + backgroundBatchOneway->ice_flushBatchRequests(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } // // Send bigger requests to test with auto-flushing. @@ -853,7 +880,15 @@ validationTests(const ConfigurationPtr& configuration, backgroundBatchOneway->opWithPayload(seq); backgroundBatchOneway->opWithPayload(seq); ctl->resumeAdapter(); - backgroundBatchOneway->ice_flushBatchRequests(); + try + { + backgroundBatchOneway->ice_flushBatchRequests(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } // // Then try the same thing with async flush. @@ -874,7 +909,8 @@ validationTests(const ConfigurationPtr& configuration, backgroundBatchOneway->op(); backgroundBatchOneway->op(); ctl->resumeAdapter(); - backgroundBatchOneway->ice_flushBatchRequests_async(new FlushBatchRequestsCallback()); + FlushBatchRequestsCallbackPtr fcb = new FlushBatchRequestsCallback(); + backgroundBatchOneway->ice_flushBatchRequests_async(fcb); backgroundBatchOneway->ice_getConnection()->close(false); backgroundBatchOneway->ice_getConnection()->close(false); @@ -892,7 +928,7 @@ validationTests(const ConfigurationPtr& configuration, backgroundBatchOneway->opWithPayload(seq); backgroundBatchOneway->opWithPayload(seq); ctl->resumeAdapter(); - FlushBatchRequestsCallbackPtr fcb = new FlushBatchRequestsCallback(); + fcb = new FlushBatchRequestsCallback(); backgroundBatchOneway->ice_flushBatchRequests_async(fcb); // // We can't close the connection before ensuring all the batches have been sent since diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index eec35751912..1f9b133d7c9 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -62,6 +62,21 @@ private: }; typedef IceUtil::Handle<GetAdapterNameCB> GetAdapterNameCBPtr; +class NoOpGetAdapterNameCB : public AMI_TestIntf_getAdapterName +{ +public: + + virtual void + ice_response(const string&) + { + } + + virtual void + ice_exception(const Ice::Exception&) + { + } +}; + string getAdapterNameWithAMI(const TestIntfPrx& test) { @@ -220,6 +235,95 @@ allTests(const Ice::CommunicatorPtr& communicator) } cout << "ok" << endl; + cout << "testing binding with multiple random endpoints... " << flush; + { + vector<RemoteObjectAdapterPrx> adapters; + adapters.push_back(com->createObjectAdapter("AdapterRandom11", "default")); + adapters.push_back(com->createObjectAdapter("AdapterRandom12", "default")); + adapters.push_back(com->createObjectAdapter("AdapterRandom13", "default")); + adapters.push_back(com->createObjectAdapter("AdapterRandom14", "default")); + adapters.push_back(com->createObjectAdapter("AdapterRandom15", "default")); + +#ifdef _WIN32 + int count = 60; +#else + int count = 20; +#endif + int adapterCount = adapters.size(); + while(--count > 0) + { +#ifdef _WIN32 + if(count == 10) + { + com->deactivateObjectAdapter(adapters[4]); + --adapterCount; + } + vector<TestIntfPrx> proxies; + proxies.resize(10); +#else + if(count < 60 && count % 10 == 0) + { + com->deactivateObjectAdapter(adapters[count / 10 - 1]); + --adapterCount; + } + vector<TestIntfPrx> proxies; + proxies.resize(40); +#endif + unsigned int i; + for(i = 0; i < proxies.size(); ++i) + { + vector<RemoteObjectAdapterPrx> adpts; + adpts.resize(IceUtilInternal::random(static_cast<int>(adapters.size()))); + if(adpts.empty()) + { + adpts.resize(1); + } + for(vector<RemoteObjectAdapterPrx>::iterator p = adpts.begin(); p != adpts.end(); ++p) + { + *p = adapters[IceUtilInternal::random(static_cast<int>(adapters.size()))]; + } + proxies[i] = createTestIntfPrx(adpts); + } + + for(i = 0; i < proxies.size(); i++) + { + proxies[i]->getAdapterName_async(new NoOpGetAdapterNameCB()); + } + for(i = 0; i < proxies.size(); i++) + { + try + { + proxies[i]->ice_ping(); + } + catch(const Ice::LocalException&) + { + } + } + set<Ice::ConnectionPtr> connections; + for(i = 0; i < proxies.size(); i++) + { + if(proxies[i]->ice_getCachedConnection()) + { + connections.insert(proxies[i]->ice_getCachedConnection()); + } + } + test(static_cast<int>(connections.size()) <= adapterCount); + + for(vector<RemoteObjectAdapterPrx>::const_iterator q = adapters.begin(); q != adapters.end(); ++q) + { + try + { + (*q)->getTestIntf()->ice_getConnection()->close(false); + } + catch(const Ice::LocalException&) + { + // Expected if adapter is down. + } + } + } + } + cout << "ok" << endl; + cout << "testing binding with multiple endpoints and AMI... " << flush; { vector<RemoteObjectAdapterPrx> adapters; @@ -468,7 +572,6 @@ allTests(const Ice::CommunicatorPtr& communicator) com->deactivateObjectAdapter(adapters[2]); - test(test->getAdapterName() == "Adapter52"); deactivate(com, adapters); diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py index 03a703b953c..ced3120bc64 100755 --- a/cpp/test/Ice/gc/run.py +++ b/cpp/test/Ice/gc/run.py @@ -25,5 +25,8 @@ client = os.path.join(os.getcwd(), "client") seedfile = os.path.join(os.getcwd(), "seed") TestUtil.simpleTest(client, seedfile) -TestUtil.startClient(client, seedfile) + +clientProc = TestUtil.startClient(client, seedfile) +clientProc.waitTestSuccess() + os.remove(seedfile) |