summaryrefslogtreecommitdiff
path: root/cppe/test/IceE/exceptions/AllTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/test/IceE/exceptions/AllTests.cpp')
-rw-r--r--cppe/test/IceE/exceptions/AllTests.cpp382
1 files changed, 191 insertions, 191 deletions
diff --git a/cppe/test/IceE/exceptions/AllTests.cpp b/cppe/test/IceE/exceptions/AllTests.cpp
index f9c3fbc7ebc..142ffc13218 100644
--- a/cppe/test/IceE/exceptions/AllTests.cpp
+++ b/cppe/test/IceE/exceptions/AllTests.cpp
@@ -23,7 +23,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -33,26 +33,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:
@@ -90,67 +90,67 @@ allTests(const Ice::CommunicatorPtr& communicator)
tprintf("testing object adapter registration exceptions... ");
{
- Ice::ObjectAdapterPtr first = communicator->createObjectAdapter("TestAdapter0");
- try
- {
- Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected
- }
-
- communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "");
- 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("TestAdapter0.Endpoints") == "");
- first->deactivate();
+ Ice::ObjectAdapterPtr first = communicator->createObjectAdapter("TestAdapter0");
+ try
+ {
+ Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected
+ }
+
+ communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "");
+ 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("TestAdapter0.Endpoints") == "");
+ first->deactivate();
}
tprintf("ok\n");
tprintf("testing servant registration exceptions...");
{
- 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();
+ 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();
}
tprintf("ok\n");
tprintf("testing stringToProxy...");
string ref = communicator->getProperties()->getPropertyWithDefault(
- "Exception.Proxy", "thrower:default -p 12010 -t 10000");
+ "Exception.Proxy", "thrower:default -p 12010 -t 10000");
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
tprintf("ok\n");
@@ -165,80 +165,80 @@ allTests(const Ice::CommunicatorPtr& communicator)
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)
{
- tprintf("%s\n", ex.toString().c_str());
- test(false);
+ tprintf("%s\n", ex.toString().c_str());
+ 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)
@@ -247,23 +247,23 @@ allTests(const Ice::CommunicatorPtr& communicator)
//
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
@@ -273,31 +273,31 @@ allTests(const Ice::CommunicatorPtr& communicator)
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)
@@ -306,122 +306,122 @@ allTests(const Ice::CommunicatorPtr& communicator)
//
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
tprintf("ok\n");
tprintf("catching derived types...");
-
+
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);
}
tprintf("ok\n");
if(thrower->supportsUndeclaredExceptions())
{
- tprintf("catching unknown user exception...");
-
- try
- {
- thrower->throwUndeclaredA(1);
- test(false);
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredB(1, 2);
- test(false);
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredC(1, 2, 3);
- test(false);
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- tprintf("ok\n");
+ tprintf("catching unknown user exception...");
+
+ try
+ {
+ thrower->throwUndeclaredA(1);
+ test(false);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredB(1, 2);
+ test(false);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredC(1, 2, 3);
+ test(false);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ tprintf("ok\n");
}
tprintf("catching object not exist exception...");
@@ -429,18 +429,18 @@ allTests(const Ice::CommunicatorPtr& communicator)
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);
}
tprintf("ok\n");
@@ -450,12 +450,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
try
{
- thrower2->ice_ping();
- test(false);
+ thrower2->ice_ping();
+ test(false);
}
catch(const Ice::FacetNotExistException& ex)
{
- test(ex.facet == "no such facet");
+ test(ex.facet == "no such facet");
}
tprintf("ok\n");
@@ -463,17 +463,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
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);
}
tprintf("ok\n");
@@ -482,15 +482,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- thrower->throwLocalException();
- test(false);
+ thrower->throwLocalException();
+ test(false);
}
catch(const Ice::UnknownLocalException&)
{
}
catch(...)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
@@ -499,15 +499,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- thrower->throwNonIceException();
- test(false);
+ thrower->throwNonIceException();
+ test(false);
}
catch(const Ice::UnknownException&)
{
}
catch(...)
{
- assert(false);
+ assert(false);
}
tprintf("ok\n");