summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Glacier2/sessionControl/Client.cpp20
-rw-r--r--cpp/test/Glacier2/sessionControl/SessionI.cpp11
2 files changed, 30 insertions, 1 deletions
diff --git a/cpp/test/Glacier2/sessionControl/Client.cpp b/cpp/test/Glacier2/sessionControl/Client.cpp
index 73d9586bd95..29ed9bf9b36 100644
--- a/cpp/test/Glacier2/sessionControl/Client.cpp
+++ b/cpp/test/Glacier2/sessionControl/Client.cpp
@@ -54,6 +54,7 @@ SessionControlClient::run(int argc, char* argv[])
cout << "creating session... " << flush;
Glacier2::SessionPrx sessionBase = router->createSession("userid", "abc123");
Test::SessionPrx session = Test::SessionPrx::uncheckedCast(sessionBase);
+ test(session);
cout << "ok" << endl;
cout << "testing destroy... " << flush;
@@ -75,6 +76,25 @@ SessionControlClient::run(int argc, char* argv[])
}
cout << "ok" << endl;
+ cout << "testing create exceptions... " << flush;
+ try
+ {
+ router->createSession("rejectme", "abc123");
+ test(false);
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ }
+ try
+ {
+ router->createSession("localexception", "abc123");
+ test(false);
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ }
+ cout << "ok" << endl;
+
cout << "testing shutdown... " << flush;
session = Test::SessionPrx::uncheckedCast(router->createSession("userid", "abc123"));
session->shutdown();
diff --git a/cpp/test/Glacier2/sessionControl/SessionI.cpp b/cpp/test/Glacier2/sessionControl/SessionI.cpp
index 46726024255..de0bff8fdc9 100644
--- a/cpp/test/Glacier2/sessionControl/SessionI.cpp
+++ b/cpp/test/Glacier2/sessionControl/SessionI.cpp
@@ -40,8 +40,17 @@ private:
};
Glacier2::SessionPrx
-SessionManagerI::create(const string&, const Glacier2::SessionControlPrx& sessionControl, const Ice::Current& current)
+SessionManagerI::create(const string& userId, const Glacier2::SessionControlPrx& sessionControl,
+ const Ice::Current& current)
{
+ if(userId == "rejectme")
+ {
+ throw Glacier2::CannotCreateSessionException("");
+ }
+ if(userId == "localexception")
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(new SessionI(sessionControl)));
}