void Server::run(int argc, char** argv) { #ifdef ICE_STATIC_LIBS Ice::registerPluginFactory("Test", createTestTransport, false); #endif Ice::PropertiesPtr properties = createTestProperties(argc, argv); // // This test kills connections, so we don't want warnings. // properties->setProperty("Ice.Warn.Connections", "0"); properties->setProperty("Ice.MessageSizeMax", "50000"); // // This test relies on filling the TCP send/recv buffer, so // we rely on a fixed value for these buffers. // properties->setProperty("Ice.TCP.RcvSize", "50000"); // // Setup the test transport plug-in. // properties->setProperty("Ice.Plugin.Test", "TestTransport:createTestTransport"); string defaultProtocol = properties->getPropertyWithDefault("Ice.Default.Protocol", "tcp"); properties->setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); Ice::CommunicatorHolder communicator = initialize(argc, argv, properties); communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp")); communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter"); #ifdef ICE_CPP11_MAPPING shared_ptr<PluginI> plugin = dynamic_pointer_cast<PluginI>(communicator->getPluginManager()->getPlugin("Test")); #else PluginI* plugin = dynamic_cast<PluginI*>(communicator->getPluginManager()->getPlugin("Test").get()); #endif assert(plugin); ConfigurationPtr configuration = plugin->getConfiguration(); BackgroundControllerIPtr backgroundController = ICE_MAKE_SHARED(BackgroundControllerI, adapter, configuration); adapter->add(ICE_MAKE_SHARED(BackgroundI, backgroundController), Ice::stringToIdentity("background")); adapter->add(ICE_MAKE_SHARED(LocatorI, backgroundController), Ice::stringToIdentity("locator")); adapter->add(ICE_MAKE_SHARED(RouterI, backgroundController), Ice::stringToIdentity("router")); adapter->activate(); adapter2->add(backgroundController, Ice::stringToIdentity("backgroundController")); adapter2->activate(); communicator->waitForShutdown(); }
int run(int, char**, const Ice::CommunicatorPtr& communicator) { communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1, "tcp")); communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter"); #ifdef ICE_CPP11_MAPPING shared_ptr<PluginI> plugin = dynamic_pointer_cast<PluginI>(communicator->getPluginManager()->getPlugin("Test")); #else PluginI* plugin = dynamic_cast<PluginI*>(communicator->getPluginManager()->getPlugin("Test").get()); #endif assert(plugin); ConfigurationPtr configuration = plugin->getConfiguration(); BackgroundControllerIPtr backgroundController = ICE_MAKE_SHARED(BackgroundControllerI, adapter, configuration); adapter->add(ICE_MAKE_SHARED(BackgroundI, backgroundController), communicator->stringToIdentity("background")); adapter->add(ICE_MAKE_SHARED(LocatorI, backgroundController), communicator->stringToIdentity("locator")); adapter->add(ICE_MAKE_SHARED(RouterI, backgroundController), communicator->stringToIdentity("router")); adapter->activate(); adapter2->add(backgroundController, communicator->stringToIdentity("backgroundController")); adapter2->activate(); communicator->waitForShutdown(); return EXIT_SUCCESS; }