本文整理汇总了C++中ice::EndpointSeq类的典型用法代码示例。如果您正苦于以下问题:C++ EndpointSeq类的具体用法?C++ EndpointSeq怎么用?C++ EndpointSeq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EndpointSeq类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
ZEND_METHOD(Ice_ObjectPrx, ice_getEndpoints)
{
if(ZEND_NUM_ARGS() != 0)
{
WRONG_PARAM_COUNT;
}
ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC);
assert(_this);
try
{
Ice::EndpointSeq endpoints = _this->proxy->ice_getEndpoints();
array_init(return_value);
uint idx = 0;
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p, ++idx)
{
zval* elem;
MAKE_STD_ZVAL(elem);
if(!createEndpoint(elem, *p TSRMLS_CC))
{
zval_ptr_dtor(&elem);
RETURN_NULL();
}
add_index_zval(return_value, idx, elem);
}
}
catch(const IceUtil::Exception& ex)
{
throwException(ex TSRMLS_CC);
RETURN_NULL();
}
}
示例2: assert
static PyObject*
adapterGetPublishedEndpoints(ObjectAdapterObject* self)
{
assert(self->adapter);
Ice::EndpointSeq endpoints;
try
{
endpoints = (*self->adapter)->getPublishedEndpoints();
}
catch(const Ice::Exception& ex)
{
setPythonException(ex);
return 0;
}
int count = static_cast<int>(endpoints.size());
PyObjectHandle result = PyTuple_New(count);
int i = 0;
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p, ++i)
{
PyObjectHandle endp = createEndpoint(*p);
if(!endp.get())
{
return 0;
}
PyTuple_SET_ITEM(result.get(), i, endp.release()); // PyTuple_SET_ITEM steals a reference.
}
return result.release();
}
示例3: if
void
AdapterRequest::finished(const Ice::ObjectPrx& proxy)
{
if(proxy || _proxies.empty())
{
RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(proxy);
return;
}
else if(_proxies.size() == 1)
{
RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(_proxies[0]);
return;
}
Ice::EndpointSeq endpoints;
Ice::ObjectPrx prx;
for(vector<Ice::ObjectPrx>::const_iterator p = _proxies.begin(); p != _proxies.end(); ++p)
{
if(!prx)
{
prx = *p;
}
Ice::EndpointSeq endpts = (*p)->ice_getEndpoints();
copy(endpts.begin(), endpts.end(), back_inserter(endpoints));
}
RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(prx->ice_endpoints(endpoints));
}
示例4: getEndpoints
Ice::ObjectPrx
WellKnownObjectsManager::getWellKnownObjectReplicatedProxy(const Ice::Identity& id, const string& endpt)
{
try
{
Ice::ObjectPrx proxy = _database->getObjectProxy(id);
Ice::EndpointSeq registryEndpoints = getEndpoints(endpt)->ice_getEndpoints();
//
// Re-order the endpoints to return first the endpoint for this
// registry replica.
//
Ice::EndpointSeq endpoints = proxy->ice_getEndpoints();
Ice::EndpointSeq newEndpoints = registryEndpoints;
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
if(find(registryEndpoints.begin(), registryEndpoints.end(), *p) == registryEndpoints.end())
{
newEndpoints.push_back(*p);
}
}
return proxy->ice_endpoints(newEndpoints);
}
catch(const ObjectNotRegisteredException&)
{
//
// If for some reasons the object isn't registered, we compute
// the endpoints with the replica cache. For slaves, this will
// however only return the slave endpoints.
//
return _database->getReplicaCache().getEndpoints(endpt, getEndpoints(endpt))->ice_identity(id);
}
}
示例5: run
int FleCSServer::run(int, char*[])
{
try
{
shutdownOnInterrupt();
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("FleCS");
FleCS::C2SPtr c2s = new C2SI;
adapter->add(c2s, communicator()->stringToIdentity("c2s"));
FleCS::SM2SPtr sm2s = new SM2SI;
adapter->add(sm2s, communicator()->stringToIdentity("sm2s"));
adapter->activate();
// Notify master that a server is on.
//
// No deadlock as long as the master do not notify the originating server.
// server --(join)--> master --(notify)--> all other servers.
//
// Master needs to make sure that join service is serialized.
FleCS::MasterPrx& m_prx = GetMasterProxy();
// Ask to join the system. Give my endpoint and get the existing
// servers.
Ice::EndpointSeq eps = adapter->getEndpoints();
// Assume that this server has one endpoint.
if (eps.size() != 1)
{
_LOG("Unexpected");
exit(EXIT_FAILURE);
}
vector<string> existingServers;
m_prx->Join((*eps.begin())->toString(), existingServers);
AddServers(existingServers);
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
catch (const exception& e)
{
_LOG(e.what());
}
return EXIT_FAILURE;
}
示例6: sync
void
NodeSessionManager::create(const NodeIPtr& node)
{
{
Lock sync(*this);
assert(!_node);
const_cast<NodeIPtr&>(_node) = node;
Ice::CommunicatorPtr communicator = _node->getCommunicator();
assert(communicator->getDefaultLocator());
Ice::Identity id = communicator->getDefaultLocator()->ice_getIdentity();
//
// Initialize the IceGrid::Query objects. The IceGrid::Query
// interface is used to lookup the registry proxy in case it
// becomes unavailable. Since replicas might not always have
// an up to date registry proxy, we need to query all the
// replicas.
//
Ice::EndpointSeq endpoints = communicator->getDefaultLocator()->ice_getEndpoints();
id.name = "Query";
QueryPrx query = QueryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
Ice::EndpointSeq singleEndpoint;
singleEndpoint.push_back(*p);
_queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
}
id.name = "InternalRegistry-Master";
_master = InternalRegistryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
_thread = new Thread(*this);
_thread->start();
}
//
// Try to create the session. It's important that we wait for the
// creation of the session as this will also try to create sessions
// with replicas (see createdSession below) and this must be done
// before the node is activated.
//
_thread->tryCreateSession(true, IceUtil::Time::seconds(3));
}
示例7: sync
Ice::ObjectPrxPtr
LocatorRegistryI::findAdapter(const string& adapterId, bool& isReplicaGroup) const
{
Lock sync(*this);
map<string, Ice::ObjectPrxPtr>::const_iterator p = _adapters.find(adapterId);
if(p != _adapters.end())
{
isReplicaGroup = false;
return p->second;
}
map<string, set<string> >::const_iterator q = _replicaGroups.find(adapterId);
if(q != _replicaGroups.end())
{
Ice::EndpointSeq endpoints;
Ice::ObjectPrxPtr prx;
for(set<string>::const_iterator r = q->second.begin(); r != q->second.end(); ++r)
{
map<string, Ice::ObjectPrxPtr>::const_iterator s = _adapters.find(*r);
if(s == _adapters.end())
{
continue; // TODO: Inconsistency
}
if(!prx)
{
prx = s->second;
}
Ice::EndpointSeq endpts = s->second->ice_getEndpoints();
copy(endpts.begin(), endpts.end(), back_inserter(endpoints));
}
if(prx)
{
isReplicaGroup = true;
return prx->ice_endpoints(endpoints);
}
}
isReplicaGroup = false;
return 0;
}
示例8:
string
IceStormInternal::describeEndpoints(const Ice::ObjectPrx& proxy)
{
ostringstream os;
if(proxy)
{
Ice::EndpointSeq endpoints = proxy->ice_getEndpoints();
for(Ice::EndpointSeq::const_iterator i = endpoints.begin(); i != endpoints.end(); ++i)
{
if(i != endpoints.begin())
{
os << ", ";
}
os << "\"" << (*i)->toString() << "\"";
}
}
else
{
os << "subscriber proxy is null";
}
return os.str();
}
示例9: ICE_UNCHECKED_CAST
TestIntfPrxPtr
createTestIntfPrx(vector<RemoteObjectAdapterPrxPtr>& adapters)
{
Ice::EndpointSeq endpoints;
TestIntfPrxPtr test;
for(vector<RemoteObjectAdapterPrxPtr>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
test = (*p)->getTestIntf();
Ice::EndpointSeq edpts = test->ice_getEndpoints();
endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
}
return ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpoints(endpoints));
}
示例10: is
void
allTests(Test::TestHelper* helper)
{
Ice::CommunicatorPtr communicator = helper->communicator();
cout << "testing proxy endpoint information... " << flush;
{
Ice::ObjectPrxPtr p1 =
communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:"
"udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:"
"opaque -e 1.8 -t 100 -v ABCD");
Ice::EndpointSeq endps = p1->ice_getEndpoints();
Ice::EndpointInfoPtr info = endps[0]->getInfo();
Ice::TCPEndpointInfoPtr ipEndpoint = getTCPEndpointInfo(info);
test(ipEndpoint);
test(ipEndpoint->host == "tcphost");
test(ipEndpoint->port == 10000);
test(ipEndpoint->timeout == 1200);
#if !defined(ICE_OS_UWP)
test(ipEndpoint->sourceAddress == "10.10.10.10");
#endif
test(ipEndpoint->compress);
test(!ipEndpoint->datagram());
test((ipEndpoint->type() == Ice::TCPEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::SSLEndpointType && ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSSEndpointType && ipEndpoint->secure()));
test((ipEndpoint->type() == Ice::TCPEndpointType && ICE_DYNAMIC_CAST(Ice::TCPEndpointInfo, info)) ||
(ipEndpoint->type() == Ice::SSLEndpointType && ICE_DYNAMIC_CAST(IceSSL::EndpointInfo, info)) ||
(ipEndpoint->type() == Ice::WSEndpointType && ICE_DYNAMIC_CAST(Ice::WSEndpointInfo, info)) ||
(ipEndpoint->type() == Ice::WSSEndpointType && ICE_DYNAMIC_CAST(Ice::WSEndpointInfo, info)));
Ice::UDPEndpointInfoPtr udpEndpoint = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, endps[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == "udphost");
test(udpEndpoint->port == 10001);
#if !defined(ICE_OS_UWP)
test(udpEndpoint->sourceAddress == "10.10.10.10");
#endif
test(udpEndpoint->mcastInterface == "eth0");
test(udpEndpoint->mcastTtl == 5);
test(udpEndpoint->timeout == -1);
test(!udpEndpoint->compress);
test(!udpEndpoint->secure());
test(udpEndpoint->datagram());
test(udpEndpoint->type() == Ice::UDPEndpointType);
Ice::OpaqueEndpointInfoPtr opaqueEndpoint = ICE_DYNAMIC_CAST(Ice::OpaqueEndpointInfo, endps[2]->getInfo());
test(opaqueEndpoint);
Ice::EncodingVersion rev;
rev.major = 1;
rev.minor = 8;
test(opaqueEndpoint->rawEncoding == rev);
}
cout << "ok" << endl;
string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host");
#ifdef ICE_OS_UWP
bool uwp = true;
#else
bool uwp = false;
#endif
if(!uwp || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" &&
communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss"))
{
cout << "test object adapter endpoint information... " << flush;
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints",
"default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::EndpointSeq endpoints = adapter->getEndpoints();
test(endpoints.size() == 2);
Ice::EndpointSeq publishedEndpoints = adapter->getPublishedEndpoints();
test(endpoints == publishedEndpoints);
Ice::TCPEndpointInfoPtr ipEndpoint = getTCPEndpointInfo(endpoints[0]->getInfo());
test(ipEndpoint);
test(ipEndpoint->type() == Ice::TCPEndpointType || ipEndpoint->type() == Ice::SSLEndpointType ||
ipEndpoint->type() == Ice::WSEndpointType || ipEndpoint->type() == Ice::WSSEndpointType);
test(ipEndpoint->host == "127.0.0.1");
test(ipEndpoint->port > 0);
test(ipEndpoint->timeout == 15000);
Ice::UDPEndpointInfoPtr udpEndpoint = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, endpoints[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == "127.0.0.1");
test(udpEndpoint->datagram());
test(udpEndpoint->port > 0);
endpoints.pop_back();
test(endpoints.size() == 1);
adapter->setPublishedEndpoints(endpoints);
publishedEndpoints = adapter->getPublishedEndpoints();
test(endpoints == publishedEndpoints);
adapter->destroy();
//.........这里部分代码省略.........
示例11: catch
int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
IceUtilInternal::Options opts;
opts.addOpt("", "cycle");
try
{
opts.parse(argc, (const char**)argv);
}
catch(const IceUtilInternal::BadOptException& e)
{
cerr << argv[0] << ": " << e.reason << endl;
return EXIT_FAILURE;
}
PropertiesPtr properties = communicator->getProperties();
const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
communicator->stringToProxy(managerProxy));
if(!manager)
{
cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
return EXIT_FAILURE;
}
TopicPrx topic;
while(true)
{
try
{
topic = manager->retrieve("single");
break;
}
// This can happen if the replica group loses the majority
// during retrieve. In this case we retry.
catch(const Ice::UnknownException&)
{
continue;
}
catch(const IceStorm::NoSuchTopic& e)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
}
}
assert(topic);
//
// Get a publisher object, create a twoway proxy and then cast to
// a Single object.
//
if(opts.isSet("cycle"))
{
Ice::ObjectPrx prx = topic->getPublisher()->ice_twoway();
vector<SinglePrx> single;
Ice::EndpointSeq endpoints = prx->ice_getEndpoints();
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
if((*p)->toString().substr(0, 3) != "udp")
{
Ice::EndpointSeq e;
e.push_back(*p);
single.push_back(SinglePrx::uncheckedCast(prx->ice_endpoints(e)));
}
}
if(single.size() <= 1)
{
cerr << argv[0] << ": Not enough endpoints in publisher proxy" << endl;
return EXIT_FAILURE;
}
int which = 0;
for(int i = 0; i < 1000; ++i)
{
single[which]->event(i);
which = (which + 1) % static_cast<int>(single.size());
}
}
else
{
SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
for(int i = 0; i < 1000; ++i)
{
single->event(i);
}
}
return EXIT_SUCCESS;
}
示例12: sync
Ice::ObjectPrx
ReplicaCache::getEndpoints(const string& name, const Ice::ObjectPrx& proxy) const
{
Ice::EndpointSeq endpoints;
if(proxy)
{
Ice::EndpointSeq endpts = proxy->ice_getEndpoints();
endpoints.insert(endpoints.end(), endpts.begin(), endpts.end());
}
Lock sync(*this);
for(map<string, ReplicaEntryPtr>::const_iterator p = _entries.begin(); p != _entries.end(); ++p)
{
Ice::ObjectPrx prx = p->second->getSession()->getEndpoint(name);
if(prx)
{
Ice::EndpointSeq endpts = prx->ice_getEndpoints();
endpoints.insert(endpoints.end(), endpts.begin(), endpts.end());
}
}
return _communicator->stringToProxy("dummy")->ice_endpoints(endpoints);
}
示例13: test
void
allTests(const Ice::CommunicatorPtr& comm)
{
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
comm->stringToProxy(comm->getDefaultLocator()->ice_getIdentity().category + "/Registry"));
AdminSessionPrx session = registry->createAdminSession("foo", "bar");
session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways);
AdminPrx admin = session->getAdmin();
test(admin);
map<string, string> params;
params.clear();
params["id"] = "Master";
params["replicaName"] = "";
params["port"] = "12050";
instantiateServer(admin, "IceGridRegistry", params);
params.clear();
params["id"] = "Slave1";
params["replicaName"] = "Slave1";
params["port"] = "12051";
instantiateServer(admin, "IceGridRegistry", params);
params.clear();
params["id"] = "Slave2";
params["replicaName"] = "Slave2";
params["port"] = "12052";
instantiateServer(admin, "IceGridRegistry", params);
Ice::LocatorPrx masterLocator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator-Master:default -p 12050"));
Ice::LocatorPrx slave1Locator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator-Slave1:default -p 12051"));
Ice::LocatorPrx slave2Locator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator-Slave2:default -p 12052"));
Ice::LocatorPrx replicatedLocator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator:default -p 12050:default -p 12051"));
AdminPrx masterAdmin, slave1Admin, slave2Admin;
admin->startServer("Master");
masterAdmin = createAdminSession(masterLocator, "");
admin->startServer("Slave1");
slave1Admin = createAdminSession(slave1Locator, "Slave1");
//
// Test replication and well-known objects:
//
// - Locator interface
// - Query interface
//
// - Registry object
// - RegistryUserAccountMapper
// - SessionManager/SSLSessionManager
// - AdminSessionManager/AdminSSLSessionManager
//
cout << "testing replicated locator and query interface... " << flush;
{
Ice::EndpointSeq endpoints;
ObjectInfo info;
info = masterAdmin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator"));
ObjectInfo info1 = slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator"));
test(slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator")) == info);
test(info.type == Ice::Locator::ice_staticId());
endpoints = info.proxy->ice_getEndpoints();
test(endpoints.size() == 2);
test(endpoints[0]->toString().find("-p 12050") != string::npos);
test(endpoints[1]->toString().find("-p 12051") != string::npos);
info = masterAdmin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Query"));
test(slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Query")) == info);
test(info.type == IceGrid::Query::ice_staticId());
endpoints = info.proxy->ice_getEndpoints();
test(endpoints.size() == 2);
test(endpoints[0]->toString().find("-p 12050") != string::npos);
test(endpoints[1]->toString().find("-p 12051") != string::npos);
admin->startServer("Slave2");
slave2Admin = createAdminSession(slave2Locator, "Slave2");
info = masterAdmin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator"));
// We eventually need to wait here for the update of the replicated objects to propagate to the replica.
int nRetry = 0;
while(slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator")) != info && nRetry < maxRetry)
{
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(sleepTime));
++nRetry;
}
test(slave2Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator")) == info);
test(info.type == Ice::Locator::ice_staticId());
endpoints = info.proxy->ice_getEndpoints();
test(endpoints.size() == 3);
test(endpoints[0]->toString().find("-p 12050") != string::npos);
//.........这里部分代码省略.........
示例14: is
void
allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "testing proxy endpoint information... " << flush;
{
Ice::ObjectPrx p1 =
communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:"
"udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:"
"opaque -e 1.8 -t 100 -v ABCD");
Ice::EndpointSeq endps = p1->ice_getEndpoints();
Ice::IPEndpointInfoPtr ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(endps[0]->getInfo());
test(ipEndpoint);
test(ipEndpoint->host == "tcphost");
test(ipEndpoint->port == 10000);
test(ipEndpoint->timeout == 1200);
#if !defined(ICE_OS_WINRT)
test(ipEndpoint->sourceAddress == "10.10.10.10");
#endif
test(ipEndpoint->compress);
test(!ipEndpoint->datagram());
test((ipEndpoint->type() == Ice::TCPEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == IceSSL::EndpointType && ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSSEndpointType && ipEndpoint->secure()));
test((ipEndpoint->type() == Ice::TCPEndpointType && Ice::TCPEndpointInfoPtr::dynamicCast(ipEndpoint)) ||
(ipEndpoint->type() == IceSSL::EndpointType && IceSSL::EndpointInfoPtr::dynamicCast(ipEndpoint)) ||
(ipEndpoint->type() == Ice::WSEndpointType && Ice::EndpointInfoPtr::dynamicCast(ipEndpoint)) ||
(ipEndpoint->type() == Ice::WSSEndpointType && Ice::EndpointInfoPtr::dynamicCast(ipEndpoint)));
Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endps[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == "udphost");
test(udpEndpoint->port == 10001);
#if !defined(ICE_OS_WINRT)
test(udpEndpoint->sourceAddress == "10.10.10.10");
#endif
test(udpEndpoint->mcastInterface == "eth0");
test(udpEndpoint->mcastTtl == 5);
test(udpEndpoint->timeout == -1);
test(!udpEndpoint->compress);
test(!udpEndpoint->secure());
test(udpEndpoint->datagram());
test(udpEndpoint->type() == Ice::UDPEndpointType);
Ice::OpaqueEndpointInfoPtr opaqueEndpoint = Ice::OpaqueEndpointInfoPtr::dynamicCast(endps[2]->getInfo());
test(opaqueEndpoint);
Ice::EncodingVersion rev;
rev.major = 1;
rev.minor = 8;
test(opaqueEndpoint->rawEncoding == rev);
}
cout << "ok" << endl;
string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host");
cout << "test object adapter endpoint information... " << flush;
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -t 15000:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::EndpointSeq endpoints = adapter->getEndpoints();
test(endpoints.size() == 2);
Ice::EndpointSeq publishedEndpoints = adapter->getPublishedEndpoints();
test(endpoints == publishedEndpoints);
Ice::IPEndpointInfoPtr ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(endpoints[0]->getInfo());
test(ipEndpoint);
test(ipEndpoint->type() == Ice::TCPEndpointType || ipEndpoint->type() == IceSSL::EndpointType ||
ipEndpoint->type() == Ice::WSEndpointType || ipEndpoint->type() == Ice::WSSEndpointType);
test(ipEndpoint->host == defaultHost);
test(ipEndpoint->port > 0);
test(ipEndpoint->timeout == 15000);
Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endpoints[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == defaultHost);
test(udpEndpoint->datagram());
test(udpEndpoint->port > 0);
adapter->destroy();
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);
//.........这里部分代码省略.........