summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/operations/ServerAMD.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/operations/ServerAMD.cpp')
-rw-r--r--cpp/test/Ice/operations/ServerAMD.cpp34
1 files changed, 11 insertions, 23 deletions
diff --git a/cpp/test/Ice/operations/ServerAMD.cpp b/cpp/test/Ice/operations/ServerAMD.cpp
index a5dcf2f07d2..c52ea694234 100644
--- a/cpp/test/Ice/operations/ServerAMD.cpp
+++ b/cpp/test/Ice/operations/ServerAMD.cpp
@@ -18,9 +18,10 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ string endpt = getTestEndpoint(communicator, 0);
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpt + ":udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
- adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test"));
+ adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), communicator->stringToIdentity("test"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
@@ -34,36 +35,23 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- int status;
- Ice::CommunicatorPtr communicator;
-
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
+ //
+ // Its possible to have batch oneway requests dispatched after
+ // the adapter is deactivated due to thread scheduling so we
+ // supress this warning.
+ //
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
- 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;
}