summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Ice/Makefile1
-rw-r--r--cpp/test/Ice/Makefile.mak3
-rw-r--r--cpp/test/Ice/faultTolerance/AllTests.cpp61
-rw-r--r--cpp/test/Ice/faultTolerance/Server.cpp2
4 files changed, 63 insertions, 4 deletions
diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile
index 42aa0895039..e6ba3e60a44 100644
--- a/cpp/test/Ice/Makefile
+++ b/cpp/test/Ice/Makefile
@@ -20,6 +20,7 @@ SUBDIRS = proxy \
inheritance \
facets \
objects \
+ faultTolerance \
adapterDeactivation \
hash \
admin \
diff --git a/cpp/test/Ice/Makefile.mak b/cpp/test/Ice/Makefile.mak
index 556ce4069bd..8a81a6b4170 100644
--- a/cpp/test/Ice/Makefile.mak
+++ b/cpp/test/Ice/Makefile.mak
@@ -22,7 +22,8 @@ SUBDIRS = proxy \
objects \
properties \
admin \
- enums
+ enums \
+ faultTolerance
!else
SUBDIRS = proxy \
operations \
diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp
index b1f52bb1a67..f7af62128f3 100644
--- a/cpp/test/Ice/faultTolerance/AllTests.cpp
+++ b/cpp/test/Ice/faultTolerance/AllTests.cpp
@@ -118,14 +118,18 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
{
ref << ":default -p " << *p;
}
- Ice::ObjectPrx base = communicator->stringToProxy(ref.str());
+ Ice::ObjectPrxPtr base = communicator->stringToProxy(ref.str());
test(base);
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
- TestIntfPrx obj = TestIntfPrx::checkedCast(base);
+ TestIntfPrxPtr obj = ICE_CHECKED_CAST(TestIntfPrx, base);
test(obj);
+#ifdef ICE_CPP11_MAPPING
+ test(Ice::targetEquals(obj, base));
+#else
test(obj == base);
+#endif
cout << "ok" << endl;
int oldPid = 0;
@@ -149,6 +153,19 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
else
{
cout << "testing server #" << i << " with AMI... " << flush;
+#ifdef ICE_CPP11_MAPPING
+ try
+ {
+ int pid = obj->pid_async().get();
+ test(pid != oldPid);
+ cout << "ok" << endl;
+ oldPid = pid;
+ }
+ catch(const exception&)
+ {
+ test(false);
+ }
+#else
CallbackPtr cb = new Callback();
obj->begin_pid(newCallback_TestIntf_pid(cb, &Callback::opPidI, &Callback::exception));
cb->check();
@@ -156,6 +173,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
test(pid != oldPid);
cout << "ok" << endl;
oldPid = pid;
+#endif
}
if(j == 0)
@@ -168,11 +186,24 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
}
else
{
+#ifdef ICE_CPP11_MAPPING
+ cout << "shutting down server #" << i << " with AMI... " << flush;
+ try
+ {
+ obj->shutdown_async().get();
+ }
+ catch(const exception&)
+ {
+ test(false);
+ }
+ cout << "ok" << endl;
+#else
cout << "shutting down server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback;
obj->begin_shutdown(newCallback_TestIntf_shutdown(cb, &Callback::opShutdownI, &Callback::exception));
cb->check();
cout << "ok" << endl;
+#endif
}
}
else if(j == 1 || i + 1 > ports.size())
@@ -196,11 +227,24 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
}
else
{
+#ifdef ICE_CPP11_MAPPING
+ cout << "aborting server #" << i << " with AMI... " << flush;
+ try
+ {
+ obj->abort_async().get();
+ test(false);
+ }
+ catch(const exception&)
+ {
+ }
+ cout << "ok" << endl;
+#else
cout << "aborting server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback;
obj->begin_abort(newCallback_TestIntf_abort(cb, &Callback::response, &Callback::exceptAbortI));
cb->check();
cout << "ok" << endl;
+#endif
}
}
else if(j == 2 || j == 3)
@@ -224,12 +268,25 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
}
else
{
+#ifdef ICE_CPP11_MAPPING
+ cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent AMI call... " << flush;
+ try
+ {
+ obj->idempotentAbort_async().get();
+ test(false);
+ }
+ catch(const exception&)
+ {
+ }
+ cout << "ok" << endl;
+#else
cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent AMI call... " << flush;
CallbackPtr cb = new Callback;
obj->begin_idempotentAbort(newCallback_TestIntf_idempotentAbort(cb, &Callback::response,
&Callback::exceptAbortI));
cb->check();
cout << "ok" << endl;
+#endif
}
++i;
diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp
index 131788ba838..ffceefbe756 100644
--- a/cpp/test/Ice/faultTolerance/Server.cpp
+++ b/cpp/test/Ice/faultTolerance/Server.cpp
@@ -52,7 +52,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
endpts << "default -p " << port << ":udp";
communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpts.str());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
- Ice::ObjectPtr object = new TestI();
+ Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI);
adapter->add(object, communicator->stringToIdentity("test"));
adapter->activate();
communicator->waitForShutdown();