summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/test/Ice/Makefile3
-rw-r--r--cpp/test/Ice/services/AllTests.cpp35
-rw-r--r--cpp/test/Ice/services/Client.cpp24
3 files changed, 30 insertions, 32 deletions
diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile
index b592690078d..1bfa6ae51a5 100644
--- a/cpp/test/Ice/Makefile
+++ b/cpp/test/Ice/Makefile
@@ -35,7 +35,8 @@ SUBDIRS = proxy \
properties \
plugin \
logger \
- networkProxy
+ networkProxy \
+ services
else
SUBDIRS = proxy \
operations \
diff --git a/cpp/test/Ice/services/AllTests.cpp b/cpp/test/Ice/services/AllTests.cpp
index 3f7b0384557..8f0506c118a 100644
--- a/cpp/test/Ice/services/AllTests.cpp
+++ b/cpp/test/Ice/services/AllTests.cpp
@@ -24,11 +24,19 @@ class ClockI : public Clock
{
public:
+#ifdef ICE_CPP11_MAPPING
+ virtual void
+ tick(string time, const Ice::Current&)
+ {
+ cout << time << endl;
+ }
+#else
virtual void
tick(const string& time, const Ice::Current&)
{
cout << time << endl;
}
+#endif
};
class SessionCallbackI : public Glacier2::SessionCallback
@@ -63,7 +71,7 @@ public:
int run(int argc, char* argv[])
{
- _factory = new Glacier2::SessionFactoryHelper(new SessionCallbackI());
+ _factory = ICE_MAKE_SHARED(Glacier2::SessionFactoryHelper, ICE_MAKE_SHARED(SessionCallbackI));
return EXIT_SUCCESS;
}
@@ -90,11 +98,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "Testing IceStorm stub... " << flush;
- IceStorm::TopicManagerPrx manager =
- IceStorm::TopicManagerPrx::uncheckedCast(communicator->stringToProxy("test:default -p 12010"));
+ IceStorm::TopicManagerPrxPtr manager =
+ ICE_UNCHECKED_CAST(IceStorm::TopicManagerPrx, communicator->stringToProxy("test:default -p 12010"));
IceStorm::QoS qos;
- IceStorm::TopicPrx topic;
+ IceStorm::TopicPrxPtr topic;
string topicName = "time";
try
@@ -111,8 +119,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("subscriber" ,"tcp");
- Ice::ObjectPrx subscriber = adapter->addWithUUID(new ClockI);
+ Ice::ObjectPrxPtr subscriber = adapter->addWithUUID(ICE_MAKE_SHARED(ClockI));
adapter->activate();
+#ifdef ICE_CPP11_MAPPING
+ assert(!topic);
+#else
try
{
topic->subscribeAndGetPublisher(qos, subscriber);
@@ -125,16 +136,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
catch(const IceUtil::NullHandleException&)
{
}
+#endif
cout << "ok" << endl;
}
{
cout << "Testing IceGrid stub... " << flush;
- Ice::ObjectPrx base = communicator->stringToProxy("test:default -p 12010");
- IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::uncheckedCast(base);
- IceGrid::AdminSessionPrx session;
- IceGrid::AdminPrx admin;
+ Ice::ObjectPrxPtr base = communicator->stringToProxy("test:default -p 12010");
+ IceGrid::RegistryPrxPtr registry = ICE_UNCHECKED_CAST(IceGrid::RegistryPrx, base);
+ IceGrid::AdminSessionPrxPtr session;
+ IceGrid::AdminPrxPtr admin;
try
{
session = registry->createAdminSession("username", "password");
@@ -147,7 +159,9 @@ allTests(const Ice::CommunicatorPtr& communicator)
catch(const Ice::LocalException&)
{
}
-
+#ifdef ICE_CPP11_MAPPING
+ assert(!admin);
+#else
try
{
admin = session->getAdmin();
@@ -156,6 +170,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
catch(const IceUtil::NullHandleException&)
{
}
+#endif
cout << "ok" << endl;
}
}
diff --git a/cpp/test/Ice/services/Client.cpp b/cpp/test/Ice/services/Client.cpp
index 5b54a4a3f73..444ddede749 100644
--- a/cpp/test/Ice/services/Client.cpp
+++ b/cpp/test/Ice/services/Client.cpp
@@ -31,35 +31,17 @@ 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.NullHandleAbort", "0");
- 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(), initData);
}
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;
}