diff options
Diffstat (limited to 'cpp/test/Ice/operations/Collocated.cpp')
-rw-r--r-- | cpp/test/Ice/operations/Collocated.cpp | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp index 5ff3dd23485..58cec8483b4 100644 --- a/cpp/test/Ice/operations/Collocated.cpp +++ b/cpp/test/Ice/operations/Collocated.cpp @@ -16,18 +16,17 @@ DEFINE_TEST("collocated") using namespace std; int -run(int, char**, const Ice::CommunicatorPtr& communicator, - const Ice::InitializationData&) +run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); communicator->getProperties()->setProperty("TestAdapter.AdapterId", "test"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); - Ice::ObjectPrx prx = adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test")); + Ice::ObjectPrxPtr prx = adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), communicator->stringToIdentity("test")); //adapter->activate(); // Don't activate OA to ensure collocation is used. test(!prx->ice_getConnection()); - Test::MyClassPrx allTests(const Ice::CommunicatorPtr&); + Test::MyClassPrxPtr allTests(const Ice::CommunicatorPtr&); allTests(communicator); return EXIT_SUCCESS; @@ -40,37 +39,18 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #endif - int status; - Ice::CommunicatorPtr communicator; - try { Ice::InitializationData initData; initData.properties = Ice::createProperties(argc, argv); - initData.properties->setProperty("Ice.BatchAutoFlushSize", "100"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator, initData); + Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); + return run(argc, argv, ich.communicator()); } catch(const Ice::Exception& ex) { cerr << ex << endl; - status = EXIT_FAILURE; - } - - if(communicator) - { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } + return EXIT_FAILURE; } - - return status; } |