diff options
Diffstat (limited to 'cpp/test/Ice/ami/Server.cpp')
-rw-r--r-- | cpp/test/Ice/ami/Server.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/cpp/test/Ice/ami/Server.cpp b/cpp/test/Ice/ami/Server.cpp index 569cdae4e81..adf27fd04f2 100644 --- a/cpp/test/Ice/ami/Server.cpp +++ b/cpp/test/Ice/ami/Server.cpp @@ -18,16 +18,16 @@ using namespace std; int run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); + communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1)); communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter"); - TestIntfControllerIPtr testController = new TestIntfControllerI(adapter); + TestIntfControllerIPtr testController = ICE_MAKE_SHARED(TestIntfControllerI, adapter); - adapter->add(new TestIntfI(), communicator->stringToIdentity("test")); + adapter->add(ICE_MAKE_SHARED(TestIntfI), communicator->stringToIdentity("test")); adapter->activate(); adapter2->add(testController, communicator->stringToIdentity("testController")); @@ -45,8 +45,6 @@ main(int argc, char* argv[]) #ifdef ICE_STATIC_LIBS Ice::registerIceSSL(); #endif - int status; - Ice::CommunicatorPtr communicator; try { @@ -64,27 +62,12 @@ main(int argc, char* argv[]) // initData.properties->setProperty("Ice.TCP.RcvSize", "50000"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator); + 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; + return EXIT_FAILURE; } - - if(communicator) - { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } - } - - return status; } |