summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/exceptions/AllTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/exceptions/AllTests.cpp')
-rw-r--r--cpp/test/Ice/exceptions/AllTests.cpp1346
1 files changed, 673 insertions, 673 deletions
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index ef140647a36..95009807260 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -39,7 +39,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -49,26 +49,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -82,24 +82,24 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const A& ex)
- {
- test(ex.aMem == 1);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const A& ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -116,25 +116,25 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::ObjectNotExistException& ex)
- {
- Ice::Identity id = _communicator->stringToIdentity("does not exist");
- test(ex.id == id);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::ObjectNotExistException& ex)
+ {
+ Ice::Identity id = _communicator->stringToIdentity("does not exist");
+ test(ex.id == id);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
private:
@@ -150,24 +150,24 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::FacetNotExistException& ex)
- {
- test(ex.facet == "no such facet");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::FacetNotExistException& ex)
+ {
+ test(ex.facet == "no such facet");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -179,28 +179,28 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const A& ex)
- {
- test(ex.aMem == 1);
- }
- catch(const D& ex)
- {
- test(ex.dMem == -1);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const A& ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(const D& ex)
+ {
+ test(ex.dMem == -1);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -212,25 +212,25 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const B& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const B& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -242,26 +242,26 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const C& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const C& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -273,25 +273,25 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const B& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const B& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -303,26 +303,26 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const C& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const C& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -334,26 +334,26 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const C& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const C& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -366,31 +366,31 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Mod::A& ex)
- {
- test(ex.aMem == 1);
- test(ex.a2Mem == 2);
- }
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Mod::A& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.a2Mem == 2);
+ }
catch(const Ice::OperationNotExistException&)
{
//
// This operation is not supported in Java.
//
}
- catch(...)
- {
- test(false);
- }
- called();
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -404,23 +404,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -432,23 +432,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -460,23 +460,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -488,23 +488,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownLocalException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownLocalException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -516,23 +516,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -544,24 +544,24 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::OperationNotExistException& ex)
- {
- test(ex.operation == "noSuchOperation");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::OperationNotExistException& ex)
+ {
+ test(ex.operation == "noSuchOperation");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -572,107 +572,107 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
cout << "testing object adapter registration exceptions... " << flush;
{
- Ice::ObjectAdapterPtr first;
+ Ice::ObjectAdapterPtr first;
+ try
+ {
+ first = communicator->createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(const Ice::InitializationException&)
+ {
+ // Expected
+ }
+
+ communicator->getProperties()->setProperty("Ice.OA.TestAdapter0.Endpoints", "default");
+ first = communicator->createObjectAdapter("TestAdapter0");
+ try
+ {
+ Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected
+ }
+
try
- {
- first = communicator->createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(const Ice::InitializationException&)
- {
- // Expected
- }
-
- communicator->getProperties()->setProperty("Ice.OA.TestAdapter0.Endpoints", "default");
- first = communicator->createObjectAdapter("TestAdapter0");
- try
- {
- Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected
- }
-
- try
- {
- Ice::ObjectAdapterPtr second =
- communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected.
- }
- //
- // Properties must remain unaffected if an exception occurs.
- //
- test(communicator->getProperties()->getProperty("Ice.OA.TestAdapter0.Endpoints") == "default");
- first->deactivate();
+ {
+ Ice::ObjectAdapterPtr second =
+ communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected.
+ }
+ //
+ // Properties must remain unaffected if an exception occurs.
+ //
+ test(communicator->getProperties()->getProperty("Ice.OA.TestAdapter0.Endpoints") == "default");
+ first->deactivate();
}
cout << "ok" << endl;
cout << "testing servant registration exceptions... " << flush;
{
- communicator->getProperties()->setProperty("Ice.OA.TestAdapter1.Endpoints", "default");
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1");
- Ice::ObjectPtr obj = new EmptyI;
- adapter->add(obj, communicator->stringToIdentity("x"));
- try
- {
- adapter->add(obj, communicator->stringToIdentity("x"));
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
-
- adapter->remove(communicator->stringToIdentity("x"));
- try
- {
- adapter->remove(communicator->stringToIdentity("x"));
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
-
- adapter->deactivate();
+ communicator->getProperties()->setProperty("Ice.OA.TestAdapter1.Endpoints", "default");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1");
+ Ice::ObjectPtr obj = new EmptyI;
+ adapter->add(obj, communicator->stringToIdentity("x"));
+ try
+ {
+ adapter->add(obj, communicator->stringToIdentity("x"));
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
+
+ adapter->remove(communicator->stringToIdentity("x"));
+ try
+ {
+ adapter->remove(communicator->stringToIdentity("x"));
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+
+ adapter->deactivate();
}
cout << "ok" << endl;
cout << "testing servant locator registrations exceptions... " << flush;
{
- communicator->getProperties()->setProperty("Ice.OA.TestAdapter2.Endpoints", "default");
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2");
- Ice::ServantLocatorPtr loc = new ServantLocatorI;
- adapter->addServantLocator(loc, "x");
- try
- {
- adapter->addServantLocator(loc, "x");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
-
- adapter->deactivate();
+ communicator->getProperties()->setProperty("Ice.OA.TestAdapter2.Endpoints", "default");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2");
+ Ice::ServantLocatorPtr loc = new ServantLocatorI;
+ adapter->addServantLocator(loc, "x");
+ try
+ {
+ adapter->addServantLocator(loc, "x");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
+
+ adapter->deactivate();
}
cout << "ok" << endl;
cout << "testing object factory registration exception... " << flush;
{
- Ice::ObjectFactoryPtr of = new ObjectFactoryI;
- communicator->addObjectFactory(of, "x");
- try
- {
- communicator->addObjectFactory(of, "x");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
+ Ice::ObjectFactoryPtr of = new ObjectFactoryI;
+ communicator->addObjectFactory(of, "x");
+ try
+ {
+ communicator->addObjectFactory(of, "x");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
}
cout << "ok" << endl;
@@ -692,80 +692,80 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwAasA(1);
- test(false);
+ thrower->throwAasA(1);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(const Ice::Exception& ex)
{
- cout << ex << endl;
- test(false);
+ cout << ex << endl;
+ test(false);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwAorDasAorD(1);
- test(false);
+ thrower->throwAorDasAorD(1);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwAorDasAorD(-1);
- test(false);
+ thrower->throwAorDasAorD(-1);
+ test(false);
}
catch(const D& ex)
{
- test(ex.dMem == -1);
+ test(ex.dMem == -1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwBasB(1, 2);
- test(false);
+ thrower->throwBasB(1, 2);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasC(1, 2, 3);
- test(false);
+ thrower->throwCasC(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
@@ -774,23 +774,23 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
//
try
{
- thrower->throwModA(1, 2);
- test(false);
+ thrower->throwModA(1, 2);
+ test(false);
}
catch(const Mod::A& ex)
{
- test(ex.aMem == 1);
- test(ex.a2Mem == 2);
+ test(ex.aMem == 1);
+ test(ex.a2Mem == 2);
}
catch(const Ice::OperationNotExistException&)
{
- //
+ //
// This operation is not supported in Java.
//
}
catch(...)
{
- test(false);
+ test(false);
}
#endif
@@ -800,31 +800,31 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwBasB(1, 2);
- test(false);
+ thrower->throwBasB(1, 2);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasC(1, 2, 3);
- test(false);
+ thrower->throwCasC(1, 2, 3);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
@@ -833,167 +833,167 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
//
try
{
- thrower->throwModA(1, 2);
- test(false);
+ thrower->throwModA(1, 2);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(const Ice::OperationNotExistException&)
{
- //
+ //
// This operation is not supported in Java.
//
}
catch(...)
{
- test(false);
+ test(false);
}
#endif
cout << "ok" << endl;
cout << "catching derived types... " << flush;
-
+
try
{
- thrower->throwBasA(1, 2);
- test(false);
+ thrower->throwBasA(1, 2);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasA(1, 2, 3);
- test(false);
+ thrower->throwCasA(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasB(1, 2, 3);
- test(false);
+ thrower->throwCasB(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
if(thrower->supportsUndeclaredExceptions())
{
- cout << "catching unknown user exception... " << flush;
-
- try
- {
- thrower->throwUndeclaredA(1);
- test(false);
- }
- catch(const A& ex)
- {
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
- test(ex.aMem == 1);
- }
- catch(const Ice::UnknownUserException&)
- {
- //
- // We get an unknown user exception without collocation
- // optimization.
- //
- test(!collocated);
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredB(1, 2);
- test(false);
- }
- catch(const B& ex)
- {
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(const Ice::UnknownUserException&)
- {
- //
- // We get an unknown user exception without collocation
- // optimization.
- //
- test(!collocated);
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredC(1, 2, 3);
- test(false);
- }
- catch(const C& ex)
- {
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(const Ice::UnknownUserException&)
- {
- //
- // We get an unknown user exception without
- // collocation optimization.
- //
- test(!collocated);
- }
- catch(...)
- {
- test(false);
- }
-
- cout << "ok" << endl;
+ cout << "catching unknown user exception... " << flush;
+
+ try
+ {
+ thrower->throwUndeclaredA(1);
+ test(false);
+ }
+ catch(const A& ex)
+ {
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
+ test(ex.aMem == 1);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ //
+ // We get an unknown user exception without collocation
+ // optimization.
+ //
+ test(!collocated);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredB(1, 2);
+ test(false);
+ }
+ catch(const B& ex)
+ {
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ //
+ // We get an unknown user exception without collocation
+ // optimization.
+ //
+ test(!collocated);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredC(1, 2, 3);
+ test(false);
+ }
+ catch(const C& ex)
+ {
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ //
+ // We get an unknown user exception without
+ // collocation optimization.
+ //
+ test(!collocated);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ cout << "ok" << endl;
}
cout << "catching object not exist exception... " << flush;
@@ -1001,18 +1001,18 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Ice::Identity id = communicator->stringToIdentity("does not exist");
try
{
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
- thrower2->throwAasA(1);
-// thrower2->ice_ping();
- test(false);
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
+ thrower2->throwAasA(1);
+// thrower2->ice_ping();
+ test(false);
}
catch(const Ice::ObjectNotExistException& ex)
{
- test(ex.id == id);
+ test(ex.id == id);
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1021,20 +1021,20 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
- try
- {
- thrower2->ice_ping();
- test(false);
- }
- catch(const Ice::FacetNotExistException& ex)
- {
- test(ex.facet == "no such facet");
- }
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
+ try
+ {
+ thrower2->ice_ping();
+ test(false);
+ }
+ catch(const Ice::FacetNotExistException& ex)
+ {
+ test(ex.facet == "no such facet");
+ }
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1043,17 +1043,17 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower);
- thrower2->noSuchOperation();
- test(false);
+ WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower);
+ thrower2->noSuchOperation();
+ test(false);
}
catch(const Ice::OperationNotExistException& ex)
{
- test(ex.operation == "noSuchOperation");
+ test(ex.operation == "noSuchOperation");
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1062,28 +1062,28 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwLocalException();
- test(false);
+ thrower->throwLocalException();
+ test(false);
}
catch(const Ice::TimeoutException&)
{
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
}
catch(const Ice::UnknownLocalException&)
{
- //
- // We get an unknown local exception without collocation
- // optimization.
- //
- test(!collocated);
+ //
+ // We get an unknown local exception without collocation
+ // optimization.
+ //
+ test(!collocated);
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1092,180 +1092,180 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwNonIceException();
- test(false);
+ thrower->throwNonIceException();
+ test(false);
}
catch(const Ice::UnknownException&)
{
- //
- // We get an unknown exception without collocation
- // optimization.
- //
- assert(!collocated);
+ //
+ // We get an unknown exception without collocation
+ // optimization.
+ //
+ assert(!collocated);
}
catch(...)
{
- //
- // We get the original exception with collocation
- // optimization.
- //
- assert(collocated);
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ assert(collocated);
}
cout << "ok" << endl;
if(!collocated)
{
- cout << "catching exact types with AMI... " << flush;
-
- {
- AMI_Thrower_throwAasAIPtr cb = new AMI_Thrower_throwAasAI;
- thrower->throwAasA_async(cb, 1);
- test(cb->check());
- // Let's check if we can reuse the same callback object for another call.
- thrower->throwAasA_async(cb, 1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
- thrower->throwAorDasAorD_async(cb, 1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
- thrower->throwAorDasAorD_async(cb, -1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwBasBIPtr cb = new AMI_Thrower_throwBasBI;
- thrower->throwBasB_async(cb, 1, 2);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwCasCIPtr cb = new AMI_Thrower_throwCasCI;
- thrower->throwCasC_async(cb, 1, 2, 3);
- test(cb->check());
- // Let's check if we can reuse the same callback object for another call.
- thrower->throwCasC_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
+ cout << "catching exact types with AMI... " << flush;
+
+ {
+ AMI_Thrower_throwAasAIPtr cb = new AMI_Thrower_throwAasAI;
+ thrower->throwAasA_async(cb, 1);
+ test(cb->check());
+ // Let's check if we can reuse the same callback object for another call.
+ thrower->throwAasA_async(cb, 1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
+ thrower->throwAorDasAorD_async(cb, 1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
+ thrower->throwAorDasAorD_async(cb, -1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwBasBIPtr cb = new AMI_Thrower_throwBasBI;
+ thrower->throwBasB_async(cb, 1, 2);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwCasCIPtr cb = new AMI_Thrower_throwCasCI;
+ thrower->throwCasC_async(cb, 1, 2, 3);
+ test(cb->check());
+ // Let's check if we can reuse the same callback object for another call.
+ thrower->throwCasC_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
//
// With VC6 SP5, there is no way to call ::A::__write from ::Mod::A
//
- {
- AMI_Thrower_throwModAIPtr cb = new AMI_Thrower_throwModAI;
- thrower->throwModA_async(cb, 1, 2);
- test(cb->check());
- }
+ {
+ AMI_Thrower_throwModAIPtr cb = new AMI_Thrower_throwModAI;
+ thrower->throwModA_async(cb, 1, 2);
+ test(cb->check());
+ }
#endif
- cout << "ok" << endl;
-
- cout << "catching derived types... " << flush;
-
- {
- AMI_Thrower_throwBasAIPtr cb = new AMI_Thrower_throwBasAI;
- thrower->throwBasA_async(cb, 1, 2);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwCasAIPtr cb = new AMI_Thrower_throwCasAI;
- thrower->throwCasA_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwCasBIPtr cb = new AMI_Thrower_throwCasBI;
- thrower->throwCasB_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- if(thrower->supportsUndeclaredExceptions())
- {
- cout << "catching unknown user exception with AMI... " << flush;
-
- {
- AMI_Thrower_throwUndeclaredAIPtr cb = new AMI_Thrower_throwUndeclaredAI;
- thrower->throwUndeclaredA_async(cb, 1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwUndeclaredBIPtr cb = new AMI_Thrower_throwUndeclaredBI;
- thrower->throwUndeclaredB_async(cb, 1, 2);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwUndeclaredCIPtr cb = new AMI_Thrower_throwUndeclaredCI;
- thrower->throwUndeclaredC_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
- cout << "ok" << endl;
- }
-
- cout << "catching object not exist exception with AMI... " << flush;
-
- {
- id = communicator->stringToIdentity("does not exist");
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
- AMI_Thrower_throwAasAObjectNotExistIPtr cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
- thrower2->throwAasA_async(cb, 1);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- cout << "catching facet not exist exception with AMI... " << flush;
-
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
- {
- AMI_Thrower_throwAasAFacetNotExistIPtr cb = new AMI_Thrower_throwAasAFacetNotExistI;
- thrower2->throwAasA_async(cb, 1);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- cout << "catching operation not exist exception with AMI... " << flush;
-
- {
- AMI_WrongOperation_noSuchOperationIPtr cb = new AMI_WrongOperation_noSuchOperationI;
- WrongOperationPrx thrower4 = WrongOperationPrx::uncheckedCast(thrower);
- thrower4->noSuchOperation_async(cb);
- test(cb->check());
- }
-
- cout << "ok" << endl;
+ cout << "ok" << endl;
+
+ cout << "catching derived types... " << flush;
+
+ {
+ AMI_Thrower_throwBasAIPtr cb = new AMI_Thrower_throwBasAI;
+ thrower->throwBasA_async(cb, 1, 2);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwCasAIPtr cb = new AMI_Thrower_throwCasAI;
+ thrower->throwCasA_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwCasBIPtr cb = new AMI_Thrower_throwCasBI;
+ thrower->throwCasB_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ if(thrower->supportsUndeclaredExceptions())
+ {
+ cout << "catching unknown user exception with AMI... " << flush;
+
+ {
+ AMI_Thrower_throwUndeclaredAIPtr cb = new AMI_Thrower_throwUndeclaredAI;
+ thrower->throwUndeclaredA_async(cb, 1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwUndeclaredBIPtr cb = new AMI_Thrower_throwUndeclaredBI;
+ thrower->throwUndeclaredB_async(cb, 1, 2);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwUndeclaredCIPtr cb = new AMI_Thrower_throwUndeclaredCI;
+ thrower->throwUndeclaredC_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+ }
+
+ cout << "catching object not exist exception with AMI... " << flush;
+
+ {
+ id = communicator->stringToIdentity("does not exist");
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
+ AMI_Thrower_throwAasAObjectNotExistIPtr cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
+ thrower2->throwAasA_async(cb, 1);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ cout << "catching facet not exist exception with AMI... " << flush;
+
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
+ {
+ AMI_Thrower_throwAasAFacetNotExistIPtr cb = new AMI_Thrower_throwAasAFacetNotExistI;
+ thrower2->throwAasA_async(cb, 1);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ cout << "catching operation not exist exception with AMI... " << flush;
+
+ {
+ AMI_WrongOperation_noSuchOperationIPtr cb = new AMI_WrongOperation_noSuchOperationI;
+ WrongOperationPrx thrower4 = WrongOperationPrx::uncheckedCast(thrower);
+ thrower4->noSuchOperation_async(cb);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
- cout << "catching unknown local exception with AMI... " << flush;
-
- {
- AMI_Thrower_throwLocalExceptionIPtr cb = new AMI_Thrower_throwLocalExceptionI;
- thrower->throwLocalException_async(cb);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- cout << "catching unknown non-Ice exception with AMI... " << flush;
-
- AMI_Thrower_throwNonIceExceptionIPtr cb = new AMI_Thrower_throwNonIceExceptionI;
- thrower->throwNonIceException_async(cb);
- test(cb->check());
-
- cout << "ok" << endl;
-
+ cout << "catching unknown local exception with AMI... " << flush;
+
+ {
+ AMI_Thrower_throwLocalExceptionIPtr cb = new AMI_Thrower_throwLocalExceptionI;
+ thrower->throwLocalException_async(cb);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ cout << "catching unknown non-Ice exception with AMI... " << flush;
+
+ AMI_Thrower_throwNonIceExceptionIPtr cb = new AMI_Thrower_throwNonIceExceptionI;
+ thrower->throwNonIceException_async(cb);
+ test(cb->check());
+
+ cout << "ok" << endl;
+
}
return thrower;