本文整理汇总了C++中TestIntfPrx::shutdown方法的典型用法代码示例。如果您正苦于以下问题:C++ TestIntfPrx::shutdown方法的具体用法?C++ TestIntfPrx::shutdown怎么用?C++ TestIntfPrx::shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestIntfPrx
的用法示例。
在下文中一共展示了TestIntfPrx::shutdown方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allTests
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
TestIntfPrx allTests(const Ice::CommunicatorPtr&);
TestIntfPrx t = allTests(communicator);
t->shutdown();
return EXIT_SUCCESS;
}
示例2: allTests
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
TestIntfPrx allTests(const Ice::CommunicatorPtr&);
TestIntfPrx Test = allTests(communicator);
Test->shutdown();
return EXIT_SUCCESS;
}
示例3: test
void
allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "testing stringToProxy... " << flush;
Ice::ObjectPrx base = communicator->stringToProxy("test @ TestAdapter");
test(base);
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
TestIntfPrx obj = TestIntfPrx::checkedCast(base);
test(obj);
test(obj == base);
cout << "ok" << endl;
cout << "pinging server... " << flush;
obj->ice_ping();
cout << "ok" << endl;
cout << "shutting down server... " << flush;
obj->shutdown();
cout << "ok" << endl;
}
示例4: test
void
allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
{
ServerManagerPrx manager = ServerManagerPrx::checkedCast(communicator->stringToProxy(ref));
TestLocatorPrx locator = TestLocatorPrx::uncheckedCast(communicator->getDefaultLocator());
test(manager);
TestLocatorRegistryPrx registry = TestLocatorRegistryPrx::checkedCast(locator->getRegistry());
test(registry);
cout << "testing stringToProxy... " << flush;
Ice::ObjectPrx base = communicator->stringToProxy("test @ TestAdapter");
Ice::ObjectPrx base2 = communicator->stringToProxy("test @ TestAdapter");
Ice::ObjectPrx base3 = communicator->stringToProxy("test");
Ice::ObjectPrx base4 = communicator->stringToProxy("ServerManager");
Ice::ObjectPrx base5 = communicator->stringToProxy("test2");
Ice::ObjectPrx base6 = communicator->stringToProxy("test @ ReplicatedAdapter");
cout << "ok" << endl;
cout << "testing ice_locator and ice_getLocator... " << flush;
test(Ice::proxyIdentityEqual(base->ice_getLocator(), communicator->getDefaultLocator()));
Ice::LocatorPrx anotherLocator = Ice::LocatorPrx::uncheckedCast(communicator->stringToProxy("anotherLocator"));
base = base->ice_locator(anotherLocator);
test(Ice::proxyIdentityEqual(base->ice_getLocator(), anotherLocator));
communicator->setDefaultLocator(0);
base = communicator->stringToProxy("test @ TestAdapter");
test(!base->ice_getLocator());
base = base->ice_locator(anotherLocator);
test(Ice::proxyIdentityEqual(base->ice_getLocator(), anotherLocator));
communicator->setDefaultLocator(locator);
base = communicator->stringToProxy("test @ TestAdapter");
test(Ice::proxyIdentityEqual(base->ice_getLocator(), communicator->getDefaultLocator()));
//
// We also test ice_router/ice_getRouter (perhaps we should add a
// test/Ice/router test?)
//
test(!base->ice_getRouter());
Ice::RouterPrx anotherRouter = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("anotherRouter"));
base = base->ice_router(anotherRouter);
test(Ice::proxyIdentityEqual(base->ice_getRouter(), anotherRouter));
Ice::RouterPrx router = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("dummyrouter"));
communicator->setDefaultRouter(router);
base = communicator->stringToProxy("test @ TestAdapter");
test(Ice::proxyIdentityEqual(base->ice_getRouter(), communicator->getDefaultRouter()));
communicator->setDefaultRouter(0);
base = communicator->stringToProxy("test @ TestAdapter");
test(!base->ice_getRouter());
cout << "ok" << endl;
cout << "starting server... " << flush;
manager->startServer();
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
TestIntfPrx obj = TestIntfPrx::checkedCast(base);
test(obj);
TestIntfPrx obj2 = TestIntfPrx::checkedCast(base2);
test(obj2);
TestIntfPrx obj3 = TestIntfPrx::checkedCast(base3);
test(obj3);
ServerManagerPrx obj4 = ServerManagerPrx::checkedCast(base4);
test(obj4);
TestIntfPrx obj5 = TestIntfPrx::checkedCast(base5);
test(obj5);
TestIntfPrx obj6 = TestIntfPrx::checkedCast(base6);
test(obj6);
cout << "ok" << endl;
cout << "testing [email protected] indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
try
{
obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing [email protected] indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
try
{
obj6->ice_ping();
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing identity indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
//.........这里部分代码省略.........
示例5: test
void
allTests(const Ice::CommunicatorPtr& communicator)
{
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
communicator->stringToProxy(communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"));
test(registry);
IceGrid::AdminSessionPrx session = registry->createAdminSession("foo", "bar");
session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways);
IceGrid::AdminPrx admin = session->getAdmin();
test(admin);
admin->startServer("node-1");
admin->startServer("node-2");
int nRetry = 0;
while(!admin->pingNode("node-1") && nRetry < 15)
{
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
++nRetry;
}
nRetry = 0;
while(!admin->pingNode("node-2") && nRetry < 15)
{
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
++nRetry;
}
cout << "testing on-demand activation... " << flush;
try
{
test(admin->getServerState("server") == IceGrid::Inactive);
TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server"));
waitForServerState(admin, "server", IceGrid::Active);
obj->shutdown();
waitForServerState(admin, "server", IceGrid::Inactive);
nRetry = 4;
while(--nRetry > 0)
{
obj->shutdown();
}
waitForServerState(admin, "server", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing manual activation... " << flush;
try
{
test(admin->getServerState("server-manual") == IceGrid::Inactive);
TestIntfPrx obj;
try
{
obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
test(false);
}
catch(const Ice::NoEndpointException&)
{
}
test(admin->getServerState("server-manual") == IceGrid::Inactive);
admin->startServer("server-manual");
test(admin->getServerState("server-manual") == IceGrid::Active);
obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
test(admin->getServerState("server-manual") == IceGrid::Active);
obj->shutdown();
waitForServerState(admin, "server-manual", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing always activation... " << flush;
try
{
waitForServerState(admin, "server-always", IceGrid::Active);
TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-always"));
admin->stopServer("server-always");
waitForServerState(admin, "server-always", IceGrid::Active);
obj->shutdown();
waitForServerState(admin, "server-always", IceGrid::Active);
nRetry = 4;
while(--nRetry > 0)
{
obj->shutdown();
}
waitForServerState(admin, "server-always", IceGrid::Active);
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
//.........这里部分代码省略.........
示例6: if
void
allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
{
cout << "testing stringToProxy... " << flush;
ostringstream ref;
ref << "test";
for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p)
{
ref << ":default -p " << *p;
}
Ice::ObjectPrx base = communicator->stringToProxy(ref.str());
test(base);
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
TestIntfPrx obj = TestIntfPrx::checkedCast(base);
test(obj);
test(obj == base);
cout << "ok" << endl;
int oldPid = 0;
bool ami = false;
for(unsigned int i = 1, j = 0; i <= ports.size(); ++i, ++j)
{
if(j > 3)
{
j = 0;
ami = !ami;
}
if(!ami)
{
cout << "testing server #" << i << "... " << flush;
int pid = obj->pid();
test(pid != oldPid);
cout << "ok" << endl;
oldPid = pid;
}
else
{
cout << "testing server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback();
obj->begin_pid(newCallback_TestIntf_pid(cb, &Callback::opPidI, &Callback::exception));
cb->check();
int pid = cb->pid();
test(pid != oldPid);
cout << "ok" << endl;
oldPid = pid;
}
if(j == 0)
{
if(!ami)
{
cout << "shutting down server #" << i << "... " << flush;
obj->shutdown();
cout << "ok" << endl;
}
else
{
cout << "shutting down server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback;
obj->begin_shutdown(newCallback_TestIntf_shutdown(cb, &Callback::opShutdownI, &Callback::exception));
cb->check();
cout << "ok" << endl;
}
}
else if(j == 1 || i + 1 > ports.size())
{
if(!ami)
{
cout << "aborting server #" << i << "... " << flush;
try
{
obj->abort();
test(false);
}
catch(const Ice::ConnectionLostException&)
{
cout << "ok" << endl;
}
catch(const Ice::ConnectFailedException&)
{
cout << "ok" << endl;
}
}
else
{
cout << "aborting server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback;
obj->begin_abort(newCallback_TestIntf_abort(cb, &Callback::response, &Callback::exceptAbortI));
cb->check();
cout << "ok" << endl;
}
}
else if(j == 2 || j == 3)
{
if(!ami)
{
cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent call... " << flush;
//.........这里部分代码省略.........
示例7: test
//.........这里部分代码省略.........
Ice::Identity finderId;
finderId.category = "Ice";
finderId.name = "LocatorFinder";
Ice::LocatorFinderPrx finder = Ice::LocatorFinderPrx::checkedCast(
communicator->getDefaultLocator()->ice_identity(finderId));
test(finder->getLocator());
cout << "ok" << endl;
cout << "testing discovery... " << flush;
{
// Add test well-known object
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
communicator->stringToProxy(communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"));
test(registry);
IceGrid::AdminSessionPrx session = registry->createAdminSession("foo", "bar");
session->getAdmin()->addObjectWithType(base, "::Test");
session->destroy();
//
// Ensure the IceGrid discovery locator can discover the
// registries and make sure locator requests are forwarded.
//
Ice::InitializationData initData;
initData.properties = communicator->getProperties()->clone();
initData.properties->setProperty("Ice.Default.Locator", "");
initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery");
#ifdef __APPLE__
if(initData.properties->getPropertyAsInt("Ice.PreferIPv6Address") > 0)
{
initData.properties->setProperty("IceLocatorDiscovery.Interface", "::1");
}
#endif
initData.properties->setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter");
initData.properties->setProperty("AdapterForDiscoveryTest.Endpoints", "default");
Ice::CommunicatorPtr com = Ice::initialize(initData);
test(com->getDefaultLocator());
com->stringToProxy("test @ TestAdapter")->ice_ping();
com->stringToProxy("test")->ice_ping();
test(com->getDefaultLocator()->getRegistry());
test(IceGrid::LocatorPrx::checkedCast(com->getDefaultLocator()));
test(IceGrid::LocatorPrx::uncheckedCast(com->getDefaultLocator())->getLocalRegistry());
test(IceGrid::LocatorPrx::uncheckedCast(com->getDefaultLocator())->getLocalQuery());
Ice::ObjectAdapterPtr adapter = com->createObjectAdapter("AdapterForDiscoveryTest");
adapter->activate();
adapter->deactivate();
com->destroy();
//
// Now, ensure that the IceGrid discovery locator correctly
// handles failure to find a locator. Also test
// Ice::registerIceLocatorDiscovery()
//
Ice::registerIceLocatorDiscovery();
initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery", "");
initData.properties->setProperty("IceLocatorDiscovery.InstanceName", "unknown");
initData.properties->setProperty("IceLocatorDiscovery.RetryCount", "1");
initData.properties->setProperty("IceLocatorDiscovery.Timeout", "100");
com = Ice::initialize(initData);
test(com->getDefaultLocator());
try
{
com->stringToProxy("test @ TestAdapter")->ice_ping();
}
catch(const Ice::NoEndpointException&)
{
}
try
{
com->stringToProxy("test")->ice_ping();
}
catch(const Ice::NoEndpointException&)
{
}
test(!com->getDefaultLocator()->getRegistry());
test(!IceGrid::LocatorPrx::checkedCast(com->getDefaultLocator()));
try
{
test(IceGrid::LocatorPrx::uncheckedCast(com->getDefaultLocator())->getLocalQuery());
}
catch(const Ice::OperationNotExistException&)
{
}
adapter = com->createObjectAdapter("AdapterForDiscoveryTest");
adapter->activate();
adapter->deactivate();
com->destroy();
}
cout << "ok" << endl;
cout << "shutting down server... " << flush;
obj->shutdown();
cout << "ok" << endl;
}
示例8: is
//.........这里部分代码省略.........
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h * -p 12020");
communicator->getProperties()->setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020");
adapter = communicator->createObjectAdapter("TestAdapter");
endpoints = adapter->getEndpoints();
test(endpoints.size() >= 1);
publishedEndpoints = adapter->getPublishedEndpoints();
test(publishedEndpoints.size() == 1);
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast((*p)->getInfo());
test(ipEndpoint->port == 12020);
}
ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(publishedEndpoints[0]->getInfo());
test(ipEndpoint->host == "127.0.0.1");
test(ipEndpoint->port == 12020);
adapter->destroy();
}
cout << "ok" << endl;
Ice::ObjectPrx base = communicator->stringToProxy("test:default -p 12010:udp -p 12010 -c");
TestIntfPrx testIntf = TestIntfPrx::checkedCast(base);
cout << "test connection endpoint information... " << flush;
{
Ice::EndpointInfoPtr info = base->ice_getConnection()->getEndpoint()->getInfo();
Ice::IPEndpointInfoPtr ipinfo = Ice::IPEndpointInfoPtr::dynamicCast(info);
test(ipinfo->port == 12010);
test(!ipinfo->compress);
test(ipinfo->host == defaultHost);
ostringstream os;
Ice::Context ctx = testIntf->getEndpointInfoAsContext();
test(ctx["host"] == ipinfo->host);
test(ctx["compress"] == "false");
istringstream is(ctx["port"]);
int port;
is >> port;
test(port > 0);
info = base->ice_datagram()->ice_getConnection()->getEndpoint()->getInfo();
Ice::UDPEndpointInfoPtr udp = Ice::UDPEndpointInfoPtr::dynamicCast(info);
test(udp);
test(udp->port == 12010);
test(udp->host == defaultHost);
}
cout << "ok" << endl;
cout << "testing connection information... " << flush;
{
Ice::IPConnectionInfoPtr info = Ice::IPConnectionInfoPtr::dynamicCast(base->ice_getConnection()->getInfo());
test(info);
test(!info->incoming);
test(info->adapterName.empty());
test(info->localPort > 0);
test(info->remotePort == 12010);
if(defaultHost == "127.0.0.1")
{
test(info->remoteAddress == defaultHost);
test(info->localAddress == defaultHost);
}
ostringstream os;
Ice::Context ctx = testIntf->getConnectionInfoAsContext();
test(ctx["incoming"] == "true");
test(ctx["adapterName"] == "TestAdapter");
test(ctx["remoteAddress"] == info->localAddress);
test(ctx["localAddress"] == info->remoteAddress);
os.str("");
os << info->localPort;
test(ctx["remotePort"] == os.str());
os.str("");
os << info->remotePort;
test(ctx["localPort"] == os.str());
info = Ice::IPConnectionInfoPtr::dynamicCast(base->ice_datagram()->ice_getConnection()->getInfo());
test(!info->incoming);
test(info->adapterName.empty());
test(info->localPort > 0);
test(info->remotePort == 12010);
if(defaultHost == "127.0.0.1")
{
test(info->remoteAddress == defaultHost);
test(info->localAddress == defaultHost);
}
}
cout << "ok" << endl;
testIntf->shutdown();
communicator->shutdown();
communicator->waitForShutdown();
}
示例9: test
void
allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
{
ServerManagerPrx manager = ServerManagerPrx::checkedCast(communicator->stringToProxy(ref));
TestLocatorPrx locator = TestLocatorPrx::uncheckedCast(communicator->getDefaultLocator());
test(manager);
cout << "testing stringToProxy... " << flush;
Ice::ObjectPrx base = communicator->stringToProxy("test @ TestAdapter");
Ice::ObjectPrx base2 = communicator->stringToProxy("test @ TestAdapter");
Ice::ObjectPrx base3 = communicator->stringToProxy("test");
Ice::ObjectPrx base4 = communicator->stringToProxy("ServerManager");
Ice::ObjectPrx base5 = communicator->stringToProxy("test2");
Ice::ObjectPrx base6 = communicator->stringToProxy("test @ ReplicatedAdapter");
cout << "ok" << endl;
cout << "testing ice_locator and ice_getLocator... " << flush;
test(Ice::proxyIdentityEqual(base->ice_getLocator(), communicator->getDefaultLocator()));
Ice::LocatorPrx anotherLocator = Ice::LocatorPrx::uncheckedCast(communicator->stringToProxy("anotherLocator"));
base = base->ice_locator(anotherLocator);
test(Ice::proxyIdentityEqual(base->ice_getLocator(), anotherLocator));
communicator->setDefaultLocator(0);
base = communicator->stringToProxy("test @ TestAdapter");
test(!base->ice_getLocator());
base = base->ice_locator(anotherLocator);
test(Ice::proxyIdentityEqual(base->ice_getLocator(), anotherLocator));
communicator->setDefaultLocator(locator);
base = communicator->stringToProxy("test @ TestAdapter");
test(Ice::proxyIdentityEqual(base->ice_getLocator(), communicator->getDefaultLocator()));
//
// We also test ice_router/ice_getRouter (perhaps we should add a
// test/Ice/router test?)
//
test(!base->ice_getRouter());
Ice::RouterPrx anotherRouter = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("anotherRouter"));
base = base->ice_router(anotherRouter);
test(Ice::proxyIdentityEqual(base->ice_getRouter(), anotherRouter));
Ice::RouterPrx router = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("dummyrouter"));
communicator->setDefaultRouter(router);
base = communicator->stringToProxy("test @ TestAdapter");
test(Ice::proxyIdentityEqual(base->ice_getRouter(), communicator->getDefaultRouter()));
communicator->setDefaultRouter(0);
base = communicator->stringToProxy("test @ TestAdapter");
test(!base->ice_getRouter());
cout << "ok" << endl;
cout << "starting server... " << flush;
manager->startServer();
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
TestIntfPrx obj = TestIntfPrx::checkedCast(base);
obj = TestIntfPrx::checkedCast(communicator->stringToProxy("[email protected]"));
obj = TestIntfPrx::checkedCast(communicator->stringToProxy("test @TestAdapter"));
obj = TestIntfPrx::checkedCast(communicator->stringToProxy("[email protected] TestAdapter"));
test(obj);
TestIntfPrx obj2 = TestIntfPrx::checkedCast(base2);
test(obj2);
TestIntfPrx obj3 = TestIntfPrx::checkedCast(base3);
test(obj3);
ServerManagerPrx obj4 = ServerManagerPrx::checkedCast(base4);
test(obj4);
TestIntfPrx obj5 = TestIntfPrx::checkedCast(base5);
test(obj5);
TestIntfPrx obj6 = TestIntfPrx::checkedCast(base6);
test(obj6);
cout << "ok" << endl;
cout << "testing [email protected] indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
try
{
obj2 = TestIntfPrx::checkedCast(base2);
obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing [email protected] indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
try
{
obj6 = TestIntfPrx::checkedCast(base6);
obj6->ice_ping();
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing identity indirect proxy... " << flush;
//.........这里部分代码省略.........