本文整理汇总了C++中ice::CommunicatorHolder::getProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorHolder::getProperties方法的具体用法?C++ CommunicatorHolder::getProperties怎么用?C++ CommunicatorHolder::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::CommunicatorHolder
的用法示例。
在下文中一共展示了CommunicatorHolder::getProperties方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTestProperties
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();
}
示例2: initialize
void
Server::run(int argc, char** argv)
{
#ifdef ICE_STATIC_LIBS
Ice::registerIceDiscovery();
#endif
Ice::CommunicatorHolder communicator = initialize(argc, argv);
Ice::PropertiesPtr properties = communicator->getProperties();
int num = argc == 2 ? atoi(argv[1]) : 0;
properties->setProperty("ControlAdapter.Endpoints", getTestEndpoint(num));
{
ostringstream os;
os << "control" << num;
properties->setProperty("ControlAdapter.AdapterId", os.str());
}
properties->setProperty("ControlAdapter.ThreadPool.Size", "1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter");
{
ostringstream os;
os << "controller" << num;
adapter->add(ICE_MAKE_SHARED(ControllerI), Ice::stringToIdentity(os.str()));
}
adapter->activate();
serverReady();
communicator->waitForShutdown();
}
示例3: allTests
void
Collocated::run(int argc, char** argv)
{
Ice::CommunicatorHolder communicator = initialize(argc, argv);
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
//
// 2 threads are necessary to dispatch the collocated transient() call with AMI
//
communicator->getProperties()->setProperty("TestAdapter.ThreadPool.Size", "2");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
ServantLocatorPtr locator = ICE_MAKE_SHARED(ServantLocatorI);
adapter->addServantLocator(locator, "");
TestIntfPrxPtr allTests(TestHelper*);
allTests(this);
adapter->waitForDeactivate();
}
示例4: initialize
void
Server::run(int argc, char** argv)
{
Ice::CommunicatorHolder communicator = initialize(argc, argv);
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test"));
adapter->activate();
serverReady();
communicator->waitForShutdown();
}
示例5: createTestProperties
void
ServerAMD::run(int argc, char** argv)
{
Ice::PropertiesPtr properties = createTestProperties(argc, argv);
#ifndef ICE_CPP11_MAPPING
properties->setProperty("Ice.CollectObjects", "1");
#endif
Ice::CommunicatorHolder communicator = initialize(argc, argv, properties);
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(InitialI), Ice::stringToIdentity("initial"));
adapter->activate();
serverReady();
communicator->waitForShutdown();
}
示例6: setProcessStringConverter
void
Server::run(int argc, char** argv)
{
setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
Ice::CommunicatorHolder communicator = initialize(argc, argv);
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("TEST"));
adapter->add(ICE_MAKE_SHARED(Test1::WstringClassI), Ice::stringToIdentity("WSTRING1"));
adapter->add(ICE_MAKE_SHARED(Test2::WstringClassI), Ice::stringToIdentity("WSTRING2"));
adapter->activate();
serverReady();
communicator->waitForShutdown();
}
示例7: run
int
main(int argc, char* argv[])
{
#ifdef ICE_STATIC_LIBS
Ice::registerIceSSL();
#endif
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
assert(initData.properties != ich->getProperties());
return run(argc, argv, ich.communicator(), initData);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
return EXIT_FAILURE;
}
}
示例8: createTestProperties
void
CallbackClient::run(int argc, char** argv)
{
Ice::PropertiesPtr properties = createTestProperties(argc, argv);
properties->setProperty("Ice.Warn.Connections", "0");
properties->setProperty("Ice.ThreadPool.Client.Serialize", "1");
Ice::CommunicatorHolder communicator = initialize(argc, argv, properties);
ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:" + getTestEndpoint(50));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
communicator->setDefaultRouter(router);
ObjectPrx base = communicator->stringToProxy("c/callback:" + getTestEndpoint());
Glacier2::SessionPrx session = router->createSession("userid", "abc123");
base->ice_ping();
CallbackPrx twoway = CallbackPrx::checkedCast(base);
CallbackPrx oneway = twoway->ice_oneway();
CallbackPrx batchOneway = twoway->ice_batchOneway();
communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "0");
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
adapter->activate();
string category = router->getCategoryForClient();
CallbackReceiverI* callbackReceiverImpl = new CallbackReceiverI;
ObjectPtr callbackReceiver = callbackReceiverImpl;
Identity callbackReceiverIdent;
callbackReceiverIdent.name = "callbackReceiver";
callbackReceiverIdent.category = category;
CallbackReceiverPrx twowayR =
CallbackReceiverPrx::uncheckedCast(adapter->add(callbackReceiver, callbackReceiverIdent));
CallbackReceiverPrx onewayR = twowayR->ice_oneway();
{
cout << "testing client request override... " << flush;
{
for(int i = 0; i < 5; i++)
{
oneway->initiateCallback(twowayR, 0);
oneway->initiateCallback(twowayR, 0);
callbackReceiverImpl->callbackOK(2, 0);
}
}
{
Ice::Context ctx;
ctx["_ovrd"] = "test";
for(int i = 0; i < 5; i++)
{
oneway->initiateCallback(twowayR, i, ctx);
oneway->initiateCallback(twowayR, i, ctx);
oneway->initiateCallback(twowayR, i, ctx);
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100));
test(callbackReceiverImpl->callbackOK(1, i) < 3);
}
}
cout << "ok" << endl;
}
{
cout << "testing server request override... " << flush;
Ice::Context ctx;
ctx["serverOvrd"] = "test";
for(int i = 0; i < 5; i++)
{
oneway->initiateCallback(onewayR, i, ctx);
oneway->initiateCallback(onewayR, i, ctx);
oneway->initiateCallback(onewayR, i, ctx);
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100));
test(callbackReceiverImpl->callbackOK(1, i) < 3);
}
oneway->initiateCallback(twowayR, 0);
test(callbackReceiverImpl->callbackOK(1, 0) == 0);
int count = 0;
int nRetry = 0;
do
{
callbackReceiverImpl->hold();
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallbackWithPayload(onewayR, ctx);
oneway->initiateCallback(twowayR, 0);
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200 + nRetry * 200));
callbackReceiverImpl->activate();
test(callbackReceiverImpl->callbackOK(1, 0) == 0);
count = callbackReceiverImpl->callbackWithPayloadOK(0);
callbackReceiverImpl->callbackWithPayloadOK(count);
}
while(count == 10 && nRetry++ < 10);
//.........这里部分代码省略.........
示例9: initialize
void
Client::run(int argc, char** argv)
{
Ice::CommunicatorHolder communicator = initialize(argc, argv);
instance = this;
string protocol = getTestProtocol();
string host = getTestHost();
_initData.properties = Ice::createProperties(argc, argv, communicator->getProperties());
_initData.properties->setProperty("Ice.Default.Router", "Glacier2/router:" + getTestEndpoint(50));
DispatcherPtr dispatcher = new Dispatcher();
dispatcher->start();
#ifdef ICE_CPP11_MAPPING
_initData.dispatcher = [dispatcher](std::function<void()> call, const std::shared_ptr<Ice::Connection>& conn)
{
dispatcher->dispatch(call, conn);
};
#else
_initData.dispatcher = dispatcher;
#endif
_factory = ICE_MAKE_SHARED(Glacier2::SessionFactoryHelper, _initData, ICE_MAKE_SHARED(FailSessionCallback));
//
// Test to create a session with wrong userid/password
//
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
cout << "testing SessionHelper connect with wrong userid/password... " << flush;
_session = _factory->connect("userid", "xxx");
//
// Wait for connectFailed callback
//
_monitor.timedWait(IceUtil::Time::seconds(30));
test(!_session->isConnected());
}
_factory->destroy();
//
// Test to interrupt connection establishment
//
_initData.properties->setProperty("Ice.Default.Router", "");
_factory = ICE_MAKE_SHARED(Glacier2::SessionFactoryHelper, _initData, ICE_MAKE_SHARED(InterruptConnectCallback));
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
cout << "testing SessionHelper connect interrupt... " << flush;
_factory->setRouterHost(host);
_factory->setPort(getTestPort(_initData.properties, 1));
_factory->setProtocol(protocol);
_session = _factory->connect("userid", "abc123");
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100));
_session->destroy();
//
// Wait for connectFailed callback
//
_monitor.timedWait(IceUtil::Time::seconds(30));
test(!_session->isConnected());
}
_factory->destroy();
_factory = ICE_MAKE_SHARED(Glacier2::SessionFactoryHelper, _initData, ICE_MAKE_SHARED(SuccessSessionCallback));
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
cout << "testing SessionHelper connect... " << flush;
_factory->setRouterHost(host);
_factory->setPort(getTestPort(_initData.properties, 50));
_factory->setProtocol(protocol);
_session = _factory->connect("userid", "abc123");
//
// Wait for connect callback
//
_monitor.timedWait(IceUtil::Time::seconds(30));
cout << "testing SessionHelper isConnected after connect... " << flush;
test(_session->isConnected());
cout << "ok" << endl;
cout << "testing SessionHelper categoryForClient after connect... " << flush;
try
{
test(!_session->categoryForClient().empty());
}
catch(const Glacier2::SessionNotExistException&)
{
test(false);
}
cout << "ok" << endl;
test(!_session->session());
cout << "testing stringToProxy for server object... " << flush;
//.........这里部分代码省略.........