summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/dispatcher/Collocated.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2018-06-01 17:41:03 +0200
committerJose <jose@zeroc.com>2018-06-01 17:41:03 +0200
commitcbe92e540a7f02f0bdf93192424bd119189365b7 (patch)
tree411c50dc0ae9c669d31a940b1b4903b5deac4f12 /cpp/test/Ice/dispatcher/Collocated.cpp
parentFixed Util.py check for binary installation directory on Windows (diff)
downloadice-cbe92e540a7f02f0bdf93192424bd119189365b7.tar.bz2
ice-cbe92e540a7f02f0bdf93192424bd119189365b7.tar.xz
ice-cbe92e540a7f02f0bdf93192424bd119189365b7.zip
Do not use Ice::Application for Ice testsuite
Diffstat (limited to 'cpp/test/Ice/dispatcher/Collocated.cpp')
-rw-r--r--cpp/test/Ice/dispatcher/Collocated.cpp69
1 files changed, 29 insertions, 40 deletions
diff --git a/cpp/test/Ice/dispatcher/Collocated.cpp b/cpp/test/Ice/dispatcher/Collocated.cpp
index ddac767ebec..db7d8bdb32b 100644
--- a/cpp/test/Ice/dispatcher/Collocated.cpp
+++ b/cpp/test/Ice/dispatcher/Collocated.cpp
@@ -8,19 +8,37 @@
// **********************************************************************
#include <Ice/Ice.h>
-#include <TestCommon.h>
+#include <TestHelper.h>
#include <TestI.h>
#include <Dispatcher.h>
-DEFINE_TEST("collocated")
-
using namespace std;
-int
-run(int, char**, const Ice::CommunicatorPtr& communicator)
+class Collocated : public Test::TestHelper
+{
+public:
+
+ void run(int, char**);
+};
+
+void
+Collocated::run(int argc, char** argv)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
- communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1, "tcp"));
+ Ice::InitializationData initData;
+ initData.properties = createTestProperties(argc, argv);
+#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);
+ };
+#else
+ initData.dispatcher = new Dispatcher();
+#endif
+ Ice::CommunicatorHolder communicator = initialize(argc, argv, initData);
+
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
+ communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp"));
communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
@@ -34,39 +52,10 @@ run(int, char**, const Ice::CommunicatorPtr& communicator)
adapter2->add(testController, Ice::stringToIdentity("testController"));
//adapter2->activate(); // Don't activate OA to ensure collocation is used.
- void allTests(const Ice::CommunicatorPtr&);
- allTests(communicator);
- return EXIT_SUCCESS;
-}
+ void allTests(Test::TestHelper*);
+ allTests(this);
-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);
-#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);
- };
-#else
- 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;
}
+
+DEFINE_TEST(Collocated)