diff options
author | Marc Laukien <marc@zeroc.com> | 2002-01-27 03:43:27 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-01-27 03:43:27 +0000 |
commit | 017edd9bee79343b0a711fe5a2253e5b43fe701e (patch) | |
tree | 7b1233f1e8399f8605040b9568f456882ace0056 /cpp | |
parent | started with glacier test (diff) | |
download | ice-017edd9bee79343b0a711fe5a2253e5b43fe701e.tar.bz2 ice-017edd9bee79343b0a711fe5a2253e5b43fe701e.tar.xz ice-017edd9bee79343b0a711fe5a2253e5b43fe701e.zip |
more router starter stuff
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/slice/Glacier/Glacier.ice | 12 | ||||
-rw-r--r-- | cpp/src/Glacier/GlacierRouter.cpp | 2 | ||||
-rw-r--r-- | cpp/test/Glacier/starter/Client.cpp | 49 |
3 files changed, 51 insertions, 12 deletions
diff --git a/cpp/slice/Glacier/Glacier.ice b/cpp/slice/Glacier/Glacier.ice index 800db8b0eae..d9f0f4cae4e 100644 --- a/cpp/slice/Glacier/Glacier.ice +++ b/cpp/slice/Glacier/Glacier.ice @@ -32,6 +32,16 @@ exception InvalidPasswordException /** * + * This exception is raised if the router cannot be started. + * + **/ +exception CannotStartRouterException +{ + string reason; +}; + +/** + * * The &Glacier; router starter. * **/ @@ -54,7 +64,7 @@ interface Starter * **/ Ice::Router* startRouter(string userId, string password) - throws InvalidPasswordException; + throws InvalidPasswordException, CannotStartRouterException; }; }; diff --git a/cpp/src/Glacier/GlacierRouter.cpp b/cpp/src/Glacier/GlacierRouter.cpp index 1012a91c6f8..887fc2c3b2d 100644 --- a/cpp/src/Glacier/GlacierRouter.cpp +++ b/cpp/src/Glacier/GlacierRouter.cpp @@ -200,6 +200,7 @@ Glacier::Router::run(int argc, char* argv[]) int fd = atoi(outputFd.c_str()); string ref = communicator()->proxyToString(routerAdapter->createProxy(stringToIdentity(routerIdentity))); ref += "\n"; + cout << "abc"<< endl; string::size_type sz = static_cast<string::size_type>(write(fd, ref.c_str(), ref.length())); if (sz != ref.length()) { @@ -208,6 +209,7 @@ Glacier::Router::run(int argc, char* argv[]) return EXIT_FAILURE; } close(fd); + cout << "def"<< endl; } #endif diff --git a/cpp/test/Glacier/starter/Client.cpp b/cpp/test/Glacier/starter/Client.cpp index c653d31134d..f840a72c4b2 100644 --- a/cpp/test/Glacier/starter/Client.cpp +++ b/cpp/test/Glacier/starter/Client.cpp @@ -35,6 +35,17 @@ CallbackClient::run(int argc, char* argv[]) { string ref; + cout << "creating and activating callback receiver adapter... " << flush; + ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("CallbackReceiverAdapter", "default"); + adapter->activate(); + cout << "ok" << endl; + + cout << "creating and adding callback receiver object... " << flush; + CallbackReceiverI* callbackReceiverImpl = new CallbackReceiverI; + ObjectPtr callbackReceiver = callbackReceiverImpl; + adapter->add(callbackReceiver, stringToIdentity("callbackReceiver")); + cout << "ok" << endl; + cout << "testing stringToProxy for router starter... " << flush; ref = "Glacier#starter:default -p 12346 -t 2000"; ObjectPrx starterBase = communicator()->stringToProxy(ref); @@ -45,12 +56,34 @@ CallbackClient::run(int argc, char* argv[]) test(starter); cout << "ok" << endl; - cout << "testing router startup... " << flush; - RouterPrx router = starter->startRouter("", ""); + cout << "starting up router... " << flush; + RouterPrx router; + try + { + router = starter->startRouter("", ""); + } + catch (const Glacier::CannotStartRouterException& ex) + { + cerr << appName() << ": " << ex << ":\n" << ex.reason << endl; + return EXIT_FAILURE; + } + catch (const Glacier::InvalidPasswordException& ex) + { + cerr << appName() << ": " << ex << endl; + return EXIT_FAILURE; + } test(router); + cout << "ok" << endl; + + cout << "pinging router... " << flush; router->ice_ping(); cout << "ok" << endl; + cout << "installing router... " << flush; + communicator()->setDefaultRouter(router); + adapter->addRouter(router); + cout << "ok" << endl; + cout << "testing stringToProxy... " << flush; ref = "callback:default -p 12345 -t 2000"; ObjectPrx base = communicator()->stringToProxy(ref); @@ -61,16 +94,9 @@ CallbackClient::run(int argc, char* argv[]) test(twoway); cout << "ok" << endl; - CallbackReceiverI* callbackReceiverImpl = new CallbackReceiverI; - ObjectPtr callbackReceiver = callbackReceiverImpl; - - ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("CallbackReceiverAdapter", "default"); - adapter->add(callbackReceiver, stringToIdentity("callbackReceiver")); - adapter->activate(); - CallbackReceiverPrx twowayR = CallbackReceiverPrx::uncheckedCast( adapter->createProxy(stringToIdentity("callbackReceiver"))); - + { cout << "testing callback... " << flush; Context context; @@ -87,7 +113,8 @@ CallbackClient::run(int argc, char* argv[]) twoway->ice_ping(); test(false); } - catch(const ConnectFailedException&) + //catch(const ConnectFailedException&) // If we use the router, the exact exception reason gets lost. + catch(const UnknownLocalException&) { cout << "ok" << endl; } |