diff options
author | Jose <jose@zeroc.com> | 2019-10-21 16:27:28 +0200 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2021-02-02 10:38:58 -0500 |
commit | 4b46039f47f87c3b80d1788159251473da196fb2 (patch) | |
tree | 09f65cd06277a59d2ac7fcbc335fa7951d92e0e1 /cpp/test/Glacier2/application/Client.cpp | |
parent | IceGrid and IceStorm (diff) | |
download | ice-4b46039f47f87c3b80d1788159251473da196fb2.tar.bz2 ice-4b46039f47f87c3b80d1788159251473da196fb2.tar.xz ice-4b46039f47f87c3b80d1788159251473da196fb2.zip |
Remove Ice::Application & Glacier2::Application deprecated classes
Diffstat (limited to 'cpp/test/Glacier2/application/Client.cpp')
-rw-r--r-- | cpp/test/Glacier2/application/Client.cpp | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/cpp/test/Glacier2/application/Client.cpp b/cpp/test/Glacier2/application/Client.cpp deleted file mode 100644 index beed2de0ec6..00000000000 --- a/cpp/test/Glacier2/application/Client.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include <IceUtil/IceUtil.h> -#include <Ice/Ice.h> -#include <Glacier2/Glacier2.h> - -#include <TestHelper.h> - -#include <iostream> -#include <iomanip> -#include <list> - -#include <Callback.h> - -using namespace std; -using namespace Test; - -namespace -{ - -class CallbackReceiverI : public Test::CallbackReceiver -{ -public: - - CallbackReceiverI() : _received(false) - { - } - - virtual void callback(const Ice::Current&) - { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - _received = true; - _monitor.notify(); - } - - void waitForCallback() - { - IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); - while(!_received) - { - _monitor.wait(); - } - _received = false; - } - - IceUtil::Monitor<IceUtil::Mutex> _monitor; - bool _received; -}; -ICE_DEFINE_PTR(CallbackReceiverIPtr, CallbackReceiverI); - -class Application : public Glacier2::Application -{ -public: - - Application() : _restart(0), _destroyed(false), _receiver(ICE_MAKE_SHARED(CallbackReceiverI)) - { - } - - virtual Glacier2::SessionPrxPtr - createSession() - { - return ICE_UNCHECKED_CAST(Glacier2::SessionPrx, router()->createSession("userid", "abc123")); - } - - virtual int - runWithSession(int, char*[]) - { - test(router()); - test(!categoryForClient().empty()); - test(objectAdapter()); - - if(_restart == 0) - { - cout << "testing Glacier2::Application restart... " << flush; - } - Ice::ObjectPrxPtr base = communicator()->stringToProxy( - "callback:" + TestHelper::getTestEndpoint(communicator()->getProperties())); - CallbackPrxPtr callback = ICE_UNCHECKED_CAST(CallbackPrx, base); - if(++_restart < 5) - { - CallbackReceiverPrxPtr receiver = ICE_UNCHECKED_CAST(CallbackReceiverPrx, addWithUUID(_receiver)); - callback->initiateCallback(receiver); - _receiver->waitForCallback(); - restart(); - } - cout << "ok" << endl; - - cout << "testing server shutdown... " << flush; - callback->shutdown(); - cout << "ok" << endl; - - return 0; - } - - virtual void sessionDestroyed() - { - _destroyed = true; - } - - int _restart; - bool _destroyed; - CallbackReceiverIPtr _receiver; -}; - -} // anonymous namespace end - -class Client : public Test::TestHelper -{ -public: - - void run(int, char**); -}; - -void -Client::run(int argc, char** argv) -{ - Application app; - Ice::InitializationData initData; - initData.properties = createTestProperties(argc, argv); - initData.properties->setProperty("Ice.Warn.Connections", "0"); - initData.properties->setProperty("Ice.Default.Router", - "Glacier2/router:" + TestHelper::getTestEndpoint(initData.properties, 50)); - int status = app.main(argc, argv, initData); - if(status != 0) - { - test(false); - } - - initData.properties->setProperty("Ice.Default.Router", ""); - - Ice::CommunicatorHolder communicator = initialize(argc, argv, initData); - - cout << "testing stringToProxy for process object... " << flush; - Ice::ObjectPrxPtr processBase = communicator->stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(51)); - cout << "ok" << endl; - - cout << "testing checked cast for admin object... " << flush; - Ice::ProcessPrxPtr process = ICE_CHECKED_CAST(Ice::ProcessPrx, processBase); - test(process != 0); - cout << "ok" << endl; - - cout << "testing Glacier2 shutdown... " << flush; - process->shutdown(); - - try - { - process->ice_ping(); - test(false); - } - catch(const Ice::LocalException&) - { - cout << "ok" << endl; - } - - test(app._restart == 5); - test(app._destroyed); -} - -DEFINE_TEST(Client) |