diff options
Diffstat (limited to 'cpp/test/Ice/dispatcher/Client.cpp')
-rw-r--r-- | cpp/test/Ice/dispatcher/Client.cpp | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/cpp/test/Ice/dispatcher/Client.cpp b/cpp/test/Ice/dispatcher/Client.cpp index 53fa9667baf..62798c5f374 100644 --- a/cpp/test/Ice/dispatcher/Client.cpp +++ b/cpp/test/Ice/dispatcher/Client.cpp @@ -8,57 +8,43 @@ // ********************************************************************** #include <Ice/Ice.h> -#include <TestCommon.h> +#include <TestHelper.h> #include <Test.h> #include <Dispatcher.h> -DEFINE_TEST("client") - using namespace std; -int -run(int, char**, const Ice::CommunicatorPtr& communicator) +class Client : public Test::TestHelper { - void allTests(const Ice::CommunicatorPtr&); - allTests(communicator); - return EXIT_SUCCESS; -} +public: -int -main(int argc, char* argv[]) -{ -#ifdef ICE_STATIC_LIBS - Ice::registerIceSSL(false); - Ice::registerIceWS(true); -#endif - int status; - try - { - Ice::InitializationData initData = getTestInitData(argc, argv); + void run(int, char**); +}; - // - // Limit the send buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties->setProperty("Ice.TCP.SndSize", "50000"); +void +Client::run(int argc, char** argv) +{ + Ice::InitializationData initData; + initData.properties = createTestProperties(argc, argv); + // + // Limit the send buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties->setProperty("Ice.TCP.SndSize", "50000"); #ifdef ICE_CPP11_MAPPING - IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher; - initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn) - { - dispatcher->dispatch(make_shared<DispatcherCall>(call), conn); - }; + IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher; + initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn) + { + dispatcher->dispatch(make_shared<DispatcherCall>(call), conn); + }; #else - initData.dispatcher = new Dispatcher(); + initData.dispatcher = new Dispatcher(); #endif - Ice::CommunicatorHolder ich(argc, argv, initData); - status = run(argc, argv, ich.communicator()); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } - Dispatcher::terminate(); - return status; + Ice::CommunicatorHolder communicator = initialize(argc, argv, initData); + + void allTests(Test::TestHelper*); + allTests(this); } + +DEFINE_TEST(Client) |