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.cpp643
1 files changed, 1 insertions, 642 deletions
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index 81a093f5c2c..5432ff35ee0 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -72,502 +72,6 @@ private:
bool _called;
};
-class AMI_Thrower_throwAasAI : public AMI_Thrower_throwAasA, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwAasAI> AMI_Thrower_throwAasAIPtr;
-
-class AMI_Thrower_throwAasAObjectNotExistI : public AMI_Thrower_throwAasA, public CallbackBase
-{
-public:
-
- AMI_Thrower_throwAasAObjectNotExistI(const Ice::CommunicatorPtr& communicator) :
- _communicator(communicator)
- {
- }
-
- virtual void ice_response()
- {
- 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(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-
-private:
-
- Ice::CommunicatorPtr _communicator;
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwAasAObjectNotExistI> AMI_Thrower_throwAasAObjectNotExistIPtr;
-
-class AMI_Thrower_throwAasAFacetNotExistI : public AMI_Thrower_throwAasA, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwAasAFacetNotExistI> AMI_Thrower_throwAasAFacetNotExistIPtr;
-
-class AMI_Thrower_throwAorDasAorDI : public AMI_Thrower_throwAorDasAorD, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwAorDasAorDI> AMI_Thrower_throwAorDasAorDIPtr;
-
-class AMI_Thrower_throwBasAI : public AMI_Thrower_throwBasA, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwBasAI> AMI_Thrower_throwBasAIPtr;
-
-class AMI_Thrower_throwCasAI : public AMI_Thrower_throwCasA, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwCasAI> AMI_Thrower_throwCasAIPtr;
-
-class AMI_Thrower_throwBasBI : public AMI_Thrower_throwBasB, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwBasBI> AMI_Thrower_throwBasBIPtr;
-
-class AMI_Thrower_throwCasBI : public AMI_Thrower_throwCasB, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwCasBI> AMI_Thrower_throwCasBIPtr;
-
-class AMI_Thrower_throwCasCI : public AMI_Thrower_throwCasC, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwCasCI> AMI_Thrower_throwCasCIPtr;
-
-
-class AMI_Thrower_throwModAI : public AMI_Thrower_throwModA, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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);
- }
- catch(const Ice::OperationNotExistException&)
- {
- //
- // This operation is not supported in Java.
- //
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwModAI> AMI_Thrower_throwModAIPtr;
-
-
-
-class AMI_Thrower_throwUndeclaredAI : public AMI_Thrower_throwUndeclaredA, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- test(false);
- }
-
- virtual void ice_exception(const Ice::Exception& exc)
- {
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwUndeclaredAI> AMI_Thrower_throwUndeclaredAIPtr;
-
-class AMI_Thrower_throwUndeclaredBI : public AMI_Thrower_throwUndeclaredB, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- test(false);
- }
-
- virtual void ice_exception(const Ice::Exception& exc)
- {
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwUndeclaredBI> AMI_Thrower_throwUndeclaredBIPtr;
-
-class AMI_Thrower_throwUndeclaredCI : public AMI_Thrower_throwUndeclaredC, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- test(false);
- }
-
- virtual void ice_exception(const Ice::Exception& exc)
- {
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwUndeclaredCI> AMI_Thrower_throwUndeclaredCIPtr;
-
-class AMI_Thrower_throwLocalExceptionI : public AMI_Thrower_throwLocalException, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- test(false);
- }
-
- virtual void ice_exception(const Ice::Exception& exc)
- {
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownLocalException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwLocalExceptionI> AMI_Thrower_throwLocalExceptionIPtr;
-
-class AMI_Thrower_throwNonIceExceptionI : public AMI_Thrower_throwNonIceException, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- test(false);
- }
-
- virtual void ice_exception(const Ice::Exception& exc)
- {
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
- }
-};
-
-typedef IceUtil::Handle<AMI_Thrower_throwNonIceExceptionI> AMI_Thrower_throwNonIceExceptionIPtr;
-
-class AMI_WrongOperation_noSuchOperationI : public AMI_WrongOperation_noSuchOperation, public CallbackBase
-{
-public:
-
- virtual void ice_response()
- {
- 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();
- }
-};
-
-typedef IceUtil::Handle<AMI_WrongOperation_noSuchOperationI> AMI_WrongOperation_noSuchOperationIPtr;
-
class Callback : public CallbackBase, public IceUtil::Shared
{
public:
@@ -1540,151 +1044,6 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
cout << "ok" << endl;
-
- cout << "catching exact types with AMI... " << flush;
-
- {
- AMI_Thrower_throwAasAIPtr cb = new AMI_Thrower_throwAasAI;
- thrower->throwAasA_async(cb, 1);
- cb->check();
- // Let's check if we can reuse the same callback object for another call.
- thrower->throwAasA_async(cb, 1);
- cb->check();
- }
-
- {
- AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
- thrower->throwAorDasAorD_async(cb, 1);
- cb->check();
- }
-
- {
- AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
- thrower->throwAorDasAorD_async(cb, -1);
- cb->check();
- }
-
- {
- AMI_Thrower_throwBasBIPtr cb = new AMI_Thrower_throwBasBI;
- thrower->throwBasB_async(cb, 1, 2);
- cb->check();
- }
-
- {
- AMI_Thrower_throwCasCIPtr cb = new AMI_Thrower_throwCasCI;
- thrower->throwCasC_async(cb, 1, 2, 3);
- cb->check();
- // Let's check if we can reuse the same callback object for another call.
- thrower->throwCasC_async(cb, 1, 2, 3);
- cb->check();
- }
-
- {
- AMI_Thrower_throwModAIPtr cb = new AMI_Thrower_throwModAI;
- thrower->throwModA_async(cb, 1, 2);
- cb->check();
- }
-
- cout << "ok" << endl;
-
- cout << "catching derived types... " << flush;
-
- {
- AMI_Thrower_throwBasAIPtr cb = new AMI_Thrower_throwBasAI;
- thrower->throwBasA_async(cb, 1, 2);
- cb->check();
- }
-
- {
- AMI_Thrower_throwCasAIPtr cb = new AMI_Thrower_throwCasAI;
- thrower->throwCasA_async(cb, 1, 2, 3);
- cb->check();
- }
-
- {
- AMI_Thrower_throwCasBIPtr cb = new AMI_Thrower_throwCasBI;
- thrower->throwCasB_async(cb, 1, 2, 3);
- 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);
- cb->check();
- }
-
- {
- AMI_Thrower_throwUndeclaredBIPtr cb = new AMI_Thrower_throwUndeclaredBI;
- thrower->throwUndeclaredB_async(cb, 1, 2);
- cb->check();
- }
-
- {
- AMI_Thrower_throwUndeclaredCIPtr cb = new AMI_Thrower_throwUndeclaredCI;
- thrower->throwUndeclaredC_async(cb, 1, 2, 3);
- 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);
- 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);
- 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);
- 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);
- 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);
- cb->check();
-
- cout << "ok" << endl;
cout << "catching exact types with new AMI mapping... " << flush;
@@ -1813,8 +1172,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "catching facet not exist exception with new AMI mapping... " << flush;
- thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
{
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
CallbackPtr cb = new Callback;
Callback_Thrower_throwAasAPtr callback =
newCallback_Thrower_throwAasA(cb, &Callback::response, &Callback::exception_AasAFacetNotExist);