// ********************************************************************** // // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #include #include #include DEFINE_TEST("collocated") using namespace std; int run(int, char**, const Ice::CommunicatorPtr& communicator) { communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); communicator->getProperties()->setProperty("TestAdapter.AdapterId", "test"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPrxPtr prx = adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), Ice::stringToIdentity("test")); //adapter->activate(); // Don't activate OA to ensure collocation is used. test(!prx->ice_getConnection()); Test::MyClassPrxPtr allTests(const Ice::CommunicatorPtr&); allTests(communicator); return EXIT_SUCCESS; } int main(int argc, char* argv[]) { #ifdef ICE_STATIC_LIBS Ice::registerIceSSL(false); Ice::registerIceWS(true); #endif try { Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.BatchAutoFlushSize", "100"); Ice::CommunicatorHolder ich(argc, argv, initData); return run(argc, argv, ich.communicator()); } catch(const Ice::Exception& ex) { cerr << ex << endl; return EXIT_FAILURE; } }