TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); _traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security"); string key; try { key = "IceSSL.TrustOnly"; _all = parse(properties->getProperty(key)); key = "IceSSL.TrustOnly.Client"; _client = parse(properties->getProperty(key)); key = "IceSSL.TrustOnly.Server"; _allServer = parse(properties->getProperty(key)); Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server."); for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p) { string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size()); key = p->first; _server[name] = parse(p->second); } } catch(const ParseException& e) { Ice::PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason; throw ex; } }
NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, NodeSessionManager& sessions, const ActivatorPtr& activator, const IceUtil::TimerPtr& timer, const TraceLevelsPtr& traceLevels, const NodePrx& proxy, const string& name, const UserAccountMapperPrx& mapper, const string& instanceName) : _communicator(adapter->getCommunicator()), _adapter(adapter), _sessions(sessions), _activator(activator), _timer(timer), _traceLevels(traceLevels), _name(name), _proxy(proxy), _redirectErrToOut(false), _allowEndpointsOverride(false), _waitTime(0), _instanceName(instanceName), _userAccountMapper(mapper), _platform("IceGrid.Node", _communicator, _traceLevels), _fileCache(new FileCache(_communicator)), _serial(1), _consistencyCheckDone(false) { Ice::PropertiesPtr props = _communicator->getProperties(); const_cast<string&>(_dataDir) = _platform.getDataDir(); const_cast<string&>(_serversDir) = _dataDir + "/servers"; const_cast<string&>(_tmpDir) = _dataDir + "/tmp"; const_cast<Ice::Int&>(_waitTime) = props->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60); const_cast<string&>(_outputDir) = props->getProperty("IceGrid.Node.Output"); const_cast<bool&>(_redirectErrToOut) = props->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0; const_cast<bool&>(_allowEndpointsOverride) = props->getPropertyAsInt("IceGrid.Node.AllowEndpointsOverride") > 0; // // Parse the properties override property. // vector<string> overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride"); if(!overrides.empty()) { for(vector<string>::iterator p = overrides.begin(); p != overrides.end(); ++p) { if(p->find("--") != 0) { *p = "--" + *p; } } Ice::PropertiesPtr p = Ice::createProperties(); p->parseCommandLineOptions("", overrides); Ice::PropertyDict propDict = p->getPropertiesForPrefix(""); for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q) { _propertiesOverride.push_back(createProperty(q->first, q->second)); } } }
static PyObject* propertiesStr(PropertiesObject* self) { assert(self->properties); Ice::PropertyDict dict; try { dict = (*self->properties)->getPropertiesForPrefix(""); } catch(const Ice::Exception& ex) { setPythonException(ex); return 0; } string str; for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p) { if(p != dict.begin()) { str.append("\n"); } str.append(p->first + "=" + p->second); } return createString(str); }
ZEND_METHOD(Ice_Properties, __toString) { if(ZEND_NUM_ARGS() > 0) { WRONG_PARAM_COUNT; } Ice::PropertiesPtr _this = Wrapper<Ice::PropertiesPtr>::value(getThis() TSRMLS_CC); assert(_this); try { Ice::PropertyDict val = _this->getPropertiesForPrefix(""); string str; for(Ice::PropertyDict::const_iterator p = val.begin(); p != val.end(); ++p) { if(p != val.begin()) { str.append("\n"); } str.append(p->first + "=" + p->second); } RETURN_STRINGL(STRCAST(str.c_str()), static_cast<int>(str.length()), 1); } catch(const IceUtil::Exception& ex) { throwException(ex TSRMLS_CC); RETURN_NULL(); } }
void IcePy::UpdateCallbackWrapper::updated(const Ice::PropertyDict& dict) { AdoptThread adoptThread; // Ensure the current thread is able to call into Python. PyObjectHandle result = PyDict_New(); if(result.get()) { for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p) { PyObjectHandle key = createString(p->first); PyObjectHandle val = createString(p->second); if(!val.get() || PyDict_SetItem(result.get(), key.get(), val.get()) < 0) { return; } } } PyObjectHandle obj = PyObject_CallMethod(_callback, STRCAST("updated"), STRCAST("O"), result.get()); if(!obj.get()) { assert(PyErr_Occurred()); throw AbortMarshaling(); } }
int Controller::load_camera_config(Ice::PropertyDict pd, int cam) { for(Ice::PropertyDict::const_iterator it = pd.begin(); it != pd.end(); it++) { std::istringstream sTemp; if((*it).first.compare("rgbdManualCalibrator.Config.Position.X")==0) { this->cameras[cam].position.X=(float)atof((*it).second.c_str()); this->lastx = this->cameras[cam].position.X; } else if((*it).first.compare("rgbdManualCalibrator.Config.Position.Y")==0) { this->cameras[cam].position.Y=(float)atof((*it).second.c_str()); this->lasty = this->cameras[cam].position.Y; } else if((*it).first.compare("rgbdManualCalibrator.Config.Position.Z")==0) { this->cameras[cam].position.Z=(float)atof((*it).second.c_str()); this->lastz = this->cameras[cam].position.Z; } else if((*it).first.compare("rgbdManualCalibrator.Config.Position.H")==0) { this->cameras[cam].position.H=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.X")==0) { this->cameras[cam].foa.X=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.Y")==0) { this->cameras[cam].foa.Y=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.Z")==0) { this->cameras[cam].foa.Z=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.H")==0) { this->cameras[cam].foa.H=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.Roll")==0) { this->cameras[cam].roll=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.Fx")==0) { this->cameras[cam].fdistx=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.Fy")==0) { this->cameras[cam].fdisty=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.Skew")==0) { this->cameras[cam].skew=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.U0")==0) { this->cameras[cam].u0=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.V0")==0) { this->cameras[cam].v0=(float)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.Columns")==0) { this->cameras[cam].columns=(int)atof((*it).second.c_str()); } else if((*it).first.compare("rgbdManualCalibrator.Config.Rows")==0) { this->cameras[cam].rows=(int)atof((*it).second.c_str()); } } }
void PropsClient::show(const Ice::PropertiesAdminPrx& admin) { Ice::PropertyDict props = admin->getPropertiesForPrefix("Demo"); cout << "Server's current settings:" << endl; for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p) { cout << " " << p->first << "=" << p->second << endl; } }
static PyObject* communicatorProxyToProperty(CommunicatorObject* self, PyObject* args) { // // We don't want to accept None here, so we can specify ProxyType and force // the caller to supply a proxy object. // PyObject* proxyObj; PyObject* strObj; if(!PyArg_ParseTuple(args, STRCAST("O!O"), &ProxyType, &proxyObj, &strObj)) { return 0; } Ice::ObjectPrx proxy = getProxy(proxyObj); string str; if(!getStringArg(strObj, "property", str)) { return 0; } assert(self->communicator); Ice::PropertyDict dict; try { dict = (*self->communicator)->proxyToProperty(proxy, str); } catch(const Ice::Exception& ex) { setPythonException(ex); return 0; } PyObjectHandle result = PyDict_New(); if(result.get()) { for(Ice::PropertyDict::iterator p = dict.begin(); p != dict.end(); ++p) { PyObjectHandle key = createString(p->first); PyObjectHandle val = createString(p->second); if(!val.get() || PyDict_SetItem(result.get(), key.get(), val.get()) < 0) { return 0; } } } return result.release(); }
MurmurIce::MurmurIce() { count = 0; if (meta->mp.qsIceEndpoint.isEmpty()) return; Ice::PropertiesPtr ipp = Ice::createProperties(); ::Meta::mp.qsSettings->beginGroup("Ice"); foreach(const QString &v, ::Meta::mp.qsSettings->childKeys()) { ipp->setProperty(u8(v), u8(::Meta::mp.qsSettings->value(v).toString())); } ::Meta::mp.qsSettings->endGroup(); Ice::PropertyDict props = ippProperties->getPropertiesForPrefix(""); Ice::PropertyDict::iterator i; for (i=props.begin(); i != props.end(); ++i) { ipp->setProperty((*i).first, (*i).second); } ipp->setProperty("Ice.ImplicitContext", "Shared"); Ice::InitializationData idd; idd.properties = ipp; try { communicator = Ice::initialize(idd); if (! meta->mp.qsIceSecretWrite.isEmpty()) { ::Ice::ImplicitContextPtr impl = communicator->getImplicitContext(); if (impl) impl->put("secret", u8(meta->mp.qsIceSecretWrite)); } adapter = communicator->createObjectAdapterWithEndpoints("Murmur", qPrintable(meta->mp.qsIceEndpoint)); MetaPtr m = new MetaI; MetaPrx mprx = MetaPrx::uncheckedCast(adapter->add(m, communicator->stringToIdentity("Meta"))); adapter->addServantLocator(new ServerLocator(), "s"); iopServer = new ServerI; adapter->activate(); foreach(const Ice::EndpointPtr ep, mprx->ice_getEndpoints()) { qWarning("MurmurIce: Endpoint \"%s\" running", qPrintable(u8(ep->toString()))); } meta->connectListener(this); } catch (Ice::Exception &e) { qCritical("MurmurIce: Initialization failed: %s", qPrintable(u8(e.ice_name()))); } }
static PyObject* propertiesGetPropertiesForPrefix(PropertiesObject* self, PyObject* args) { PyObject* prefixObj; if(!PyArg_ParseTuple(args, STRCAST("O"), &prefixObj)) { return 0; } string prefix; if(!getStringArg(prefixObj, "prefix", prefix)) { return 0; } assert(self->properties); Ice::PropertyDict dict; try { dict = (*self->properties)->getPropertiesForPrefix(prefix); } catch(const Ice::Exception& ex) { setPythonException(ex); return 0; } PyObjectHandle result = PyDict_New(); if(result.get()) { for(Ice::PropertyDict::iterator p = dict.begin(); p != dict.end(); ++p) { PyObjectHandle key = createString(p->first); PyObjectHandle val = createString(p->second); if(!val.get() || PyDict_SetItem(result.get(), key.get(), val.get()) < 0) { return 0; } } } return result.release(); }
std::map<string, string> client::getPropertyMap(const Ice::PropertiesPtr& properties) const { Ice::PropertiesPtr props; if (!properties) { props = getProperties(); } else { props = properties; } std::map<string, string> pm; Ice::PropertyDict omeroProperties = props->getPropertiesForPrefix("omero"); Ice::PropertyDict::const_iterator beg = omeroProperties.begin(); Ice::PropertyDict::const_iterator end = omeroProperties.end(); while (beg != end) { pm[(*beg).first] = (*beg).second; beg++; } Ice::PropertyDict iceProperties = props->getPropertiesForPrefix("Ice"); beg = iceProperties.begin(); end = iceProperties.end(); while (beg != end) { pm[(*beg).first] = (*beg).second; beg++; } return pm; }
TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); _traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security"); string key; try { key = "IceSSL.TrustOnly"; parse(properties->getProperty(key), _rejectAll, _acceptAll); key = "IceSSL.TrustOnly.Client"; parse(properties->getProperty(key), _rejectClient, _acceptClient); key = "IceSSL.TrustOnly.Server"; parse(properties->getProperty(key), _rejectAllServer, _acceptAllServer); Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server."); for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p) { string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size()); key = p->first; list<DistinguishedName> reject, accept; parse(p->second, reject, accept); if(!reject.empty()) { _rejectServer[name] = reject; } if(!accept.empty()) { _acceptServer[name] = accept; } } } catch(const ParseException& e) { Ice::PluginInitializationException ex(__FILE__, __LINE__); ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason; throw ex; } }
orca::ComponentData getComponentData( const Context& context ) { orca::ComponentData compData; compData.name = context.name(); Ice::PropertyDict providesProps = context.properties()->getPropertiesForPrefix(context.tag()+".Provides"); orca::ProvidedInterface provided; for ( Ice::PropertyDict::iterator i=providesProps.begin(); i!=providesProps.end(); ++i ) { provided.name = i->second; provided.id = "unknown"; compData.provides.push_back( provided ); } // special cases: add standard interfaces (depending on startup flags) // first, add the Home interface itself // std::string homeIdentity = "orca." + context.name().platform + "." + context.name().component + "/Home"; // provided.name = homeIdentity; // provided.id = "::orca::Home"; // compData.provides.push_back( provided ); // // if ( interfaceFlag_& TracerInterface ) { // provided.name = "tracer"; // provided.id = "::orca::Tracer"; // compData.provides.push_back( provided ); // } // // if ( interfaceFlag_& StatusInterface ) { // provided.name = "status"; // provided.id = "::orca::Status"; // compData.provides.push_back( provided ); // } // NOTE: this will not work if the config file uses long notation for req. interfaces Ice::PropertyDict requiresProps = context.properties()->getPropertiesForPrefix(context.tag()+".Requires"); orca::RequiredInterface required; for ( Ice::PropertyDict::iterator i=requiresProps.begin(); i!=requiresProps.end(); ++i ) { required.name = orcaice::toInterfaceName( i->second ); required.id = "unknown"; compData.requires.push_back( required ); } return compData; }
void ServiceI::start( const string& name, const CommunicatorPtr& communicator, const StringSeq& /*args*/) { PropertiesPtr properties = communicator->getProperties(); validateProperties(name, properties, communicator->getLogger()); int id = properties->getPropertyAsIntWithDefault(name + ".NodeId", -1); // If we are using a replicated deployment and if the topic // manager thread pool max size is not set then ensure it is set // to some suitably high number. This ensures no deadlocks in the // replicated case due to call forwarding from replicas to // coordinators. if(id != -1 && properties->getProperty(name + ".TopicManager.ThreadPool.SizeMax").empty()) { properties->setProperty(name + ".TopicManager.ThreadPool.SizeMax", "100"); } Ice::ObjectAdapterPtr topicAdapter = communicator->createObjectAdapter(name + ".TopicManager"); Ice::ObjectAdapterPtr publishAdapter = communicator->createObjectAdapter(name + ".Publish"); // // We use the name of the service for the name of the database environment. // string instanceName = properties->getPropertyWithDefault(name + ".InstanceName", "IceStorm"); Identity topicManagerId; topicManagerId.category = instanceName; topicManagerId.name = "TopicManager"; if(properties->getPropertyAsIntWithDefault(name+ ".Transient", 0) > 0) { _instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter, 0); try { TransientTopicManagerImplPtr manager = new TransientTopicManagerImpl(_instance); _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(manager, topicManagerId)); } catch(const Ice::Exception& ex) { _instance = 0; LoggerOutputBase s; s << "exception while starting IceStorm service " << name << ":\n"; s << ex; IceBox::FailureException e(__FILE__, __LINE__); e.reason = s.str(); throw e; } topicAdapter->activate(); publishAdapter->activate(); return; } if(id == -1) // No replication. { _instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter); try { _manager = new TopicManagerImpl(_instance); _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(_manager->getServant(), topicManagerId)); } catch(const Ice::Exception& ex) { _instance = 0; LoggerOutputBase s; s << "exception while starting IceStorm service " << name << ":\n"; s << ex; IceBox::FailureException e(__FILE__, __LINE__); e.reason = s.str(); throw e; } } else { // Here we want to create a map of id -> election node // proxies. map<int, NodePrx> nodes; string topicManagerAdapterId = properties->getProperty(name + ".TopicManager.AdapterId"); // We support two possible deployments. The first is a manual // deployment, the second is IceGrid. // // Here we check for the manual deployment const string prefix = name + ".Nodes."; Ice::PropertyDict props = properties->getPropertiesForPrefix(prefix); if(!props.empty()) { for(Ice::PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { int nodeid = atoi(p->first.substr(prefix.size()).c_str()); nodes[nodeid] = NodePrx::uncheckedCast(communicator->propertyToProxy(p->first)); } } else { // If adapter id's are defined for the topic manager or // node adapters then we consider this an IceGrid based // deployment. string nodeAdapterId = properties->getProperty(name + ".Node.AdapterId"); // Validate first that the adapter ids match for the node // and the topic manager otherwise some other deployment // is being used. const string suffix = ".TopicManager"; if(topicManagerAdapterId.empty() || nodeAdapterId.empty() || topicManagerAdapterId.replace( topicManagerAdapterId.find(suffix), suffix.size(), ".Node") != nodeAdapterId) { Ice::Error error(communicator->getLogger()); error << "deployment error: `" << topicManagerAdapterId << "' prefix does not match `" << nodeAdapterId << "'"; throw IceBox::FailureException(__FILE__, __LINE__, "IceGrid deployment is incorrect"); } // Determine the set of node id and node proxies. // // This is determined by locating all topic manager // replicas, and then working out the node for that // replica. // // We work out the node id by removing the instance // name. The node id must follow. // IceGrid::LocatorPrx locator = IceGrid::LocatorPrx::checkedCast(communicator->getDefaultLocator()); assert(locator); IceGrid::QueryPrx query = locator->getLocalQuery(); Ice::ObjectProxySeq replicas = query->findAllReplicas( communicator->stringToProxy(instanceName + "/TopicManager")); for(Ice::ObjectProxySeq::const_iterator p = replicas.begin(); p != replicas.end(); ++p) { string adapterid = (*p)->ice_getAdapterId(); // Replace TopicManager with the node endpoint. adapterid = adapterid.replace(adapterid.find(suffix), suffix.size(), ".Node"); // The adapter id must start with the instance name. if(adapterid.find(instanceName) != 0) { Ice::Error error(communicator->getLogger()); error << "deployment error: `" << adapterid << "' does not start with `" << instanceName << "'"; throw IceBox::FailureException(__FILE__, __LINE__, "IceGrid deployment is incorrect"); } // The node id follows. We find the first digit (the // start of the node id, and then the end of the // digits). string::size_type start = instanceName.size(); while(start < adapterid.size() && !IceUtilInternal::isDigit(adapterid[start])) { ++start; } string::size_type end = start; while(end < adapterid.size() && IceUtilInternal::isDigit(adapterid[end])) { ++end; } if(start == end) { // We must have at least one digit, otherwise there is // some sort of deployment error. Ice::Error error(communicator->getLogger()); error << "deployment error: node id does not follow instance name. instance name:" << instanceName << " adapter id: " << adapterid; throw IceBox::FailureException(__FILE__, __LINE__, "IceGrid deployment is incorrect"); } int nodeid = atoi(adapterid.substr(start, end-start).c_str()); ostringstream os; os << "node" << nodeid; Ice::Identity id; id.category = instanceName; id.name = os.str(); nodes[nodeid] = NodePrx::uncheckedCast((*p)->ice_adapterId(adapterid)->ice_identity(id)); } } if(nodes.size() < 3) { Ice::Error error(communicator->getLogger()); error << "Replication requires at least 3 Nodes"; throw IceBox::FailureException(__FILE__, __LINE__, "Replication requires at least 3 Nodes"); } try { // If the node thread pool size is not set then initialize // to the number of nodes + 1 and disable thread pool size // warnings. if(properties->getProperty(name + ".Node.ThreadPool.Size").empty()) { ostringstream os; os << nodes.size() + 1; properties->setProperty(name + ".Node.ThreadPool.Size", os.str()); properties->setProperty(name + ".Node.ThreadPool.SizeWarn", "0"); } if(properties->getProperty(name + ".Node.MessageSizeMax").empty()) { properties->setProperty(name + ".Node.MessageSizeMax", "0"); // No limit on data exchanged internally } Ice::ObjectAdapterPtr nodeAdapter = communicator->createObjectAdapter(name + ".Node"); _instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter, nodeAdapter, nodes[id]); _instance->observers()->setMajority(static_cast<unsigned int>(nodes.size())/2); // Trace replication information. TraceLevelsPtr traceLevels = _instance->traceLevels(); if(traceLevels->election > 0) { Ice::Trace out(traceLevels->logger, traceLevels->electionCat); out << "I am node " << id << "\n"; for(map<int, NodePrx>::const_iterator p = nodes.begin(); p != nodes.end(); ++p) { out << "\tnode: " << p->first << " proxy: " << p->second->ice_toString() << "\n"; } } if(topicManagerAdapterId.empty()) { // We're not using an IceGrid deployment. Here we need // a proxy which is used to create proxies to the // replicas later. _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->createProxy(topicManagerId)); } else { // If we're using IceGrid deployment we need to create // indirect proxies. _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->createIndirectProxy(topicManagerId)); } _manager = new TopicManagerImpl(_instance); topicAdapter->add(_manager->getServant(), topicManagerId); ostringstream os; // The node object identity. os << "node" << id; Ice::Identity nodeid; nodeid.category = instanceName; nodeid.name = os.str(); NodeIPtr node = new NodeI(_instance, _manager, _managerProxy, id, nodes); _instance->setNode(node); nodeAdapter->add(node, nodeid); nodeAdapter->activate(); node->start(); } catch(const Ice::Exception& ex) { _instance = 0; LoggerOutputBase s; s << "exception while starting IceStorm service " << name << ":\n"; s << ex; IceBox::FailureException e(__FILE__, __LINE__); e.reason = s.str(); throw e; } } topicAdapter->add(new FinderI(TopicManagerPrx::uncheckedCast(topicAdapter->createProxy(topicManagerId))), communicator->stringToIdentity("IceStorm/Finder")); topicAdapter->activate(); publishAdapter->activate(); }
Test::MyClassPrx allTests(const Ice::CommunicatorPtr& communicator) { cout << "testing stringToProxy... " << flush; string ref = "test:default -p 12010"; Ice::ObjectPrx base = communicator->stringToProxy(ref); test(base); Ice::ObjectPrx b1 = communicator->stringToProxy("test"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getAdapterId().empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy("test "); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy(" test "); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy(" test"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy("'test -f facet'"); test(b1->ice_getIdentity().name == "test -f facet" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); try { b1 = communicator->stringToProxy("\"test -f facet'"); test(false); } catch(const Ice::ProxyParseException&) { } b1 = communicator->stringToProxy("\"test -f facet\""); test(b1->ice_getIdentity().name == "test -f facet" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy("\"test -f facet@test\""); test(b1->ice_getIdentity().name == "test -f facet@test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy("\"test -f facet@test @test\""); test(b1->ice_getIdentity().name == "test -f facet@test @test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet().empty()); try { b1 = communicator->stringToProxy("test test"); test(false); } catch(const Ice::ProxyParseException&) { } b1 = communicator->stringToProxy("test\\040test"); test(b1->ice_getIdentity().name == "test test" && b1->ice_getIdentity().category.empty()); try { b1 = communicator->stringToProxy("test\\777"); test(false); } catch(const Ice::IdentityParseException&) { } b1 = communicator->stringToProxy("test\\40test"); test(b1->ice_getIdentity().name == "test test"); // Test some octal and hex corner cases. b1 = communicator->stringToProxy("test\\4test"); test(b1->ice_getIdentity().name == "test\4test"); b1 = communicator->stringToProxy("test\\04test"); test(b1->ice_getIdentity().name == "test\4test"); b1 = communicator->stringToProxy("test\\004test"); test(b1->ice_getIdentity().name == "test\4test"); b1 = communicator->stringToProxy("test\\1114test"); test(b1->ice_getIdentity().name == "test\1114test"); b1 = communicator->stringToProxy("test\\b\\f\\n\\r\\t\\'\\\"\\\\test"); test(b1->ice_getIdentity().name == "test\b\f\n\r\t\'\"\\test" && b1->ice_getIdentity().category.empty()); b1 = communicator->stringToProxy("category/test"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && b1->ice_getAdapterId().empty()); b1 = communicator->stringToProxy(""); test(!b1); b1 = communicator->stringToProxy("\"\""); test(!b1); try { b1 = communicator->stringToProxy("\"\" test"); // Invalid trailing characters. test(false); } catch(const Ice::ProxyParseException&) { } try { b1 = communicator->stringToProxy("test:"); // Missing endpoint. test(false); } catch(const Ice::EndpointParseException&) { } b1 = communicator->stringToProxy("test@adapter"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getAdapterId() == "adapter"); try { b1 = communicator->stringToProxy("id@adapter test"); test(false); } catch(const Ice::ProxyParseException&) { } b1 = communicator->stringToProxy("category/test@adapter"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && b1->ice_getAdapterId() == "adapter"); b1 = communicator->stringToProxy("category/test@adapter:tcp"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && b1->ice_getAdapterId() == "adapter:tcp"); b1 = communicator->stringToProxy("'category 1/test'@adapter"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category 1" && b1->ice_getAdapterId() == "adapter"); b1 = communicator->stringToProxy("'category/test 1'@adapter"); test(b1->ice_getIdentity().name == "test 1" && b1->ice_getIdentity().category == "category" && b1->ice_getAdapterId() == "adapter"); b1 = communicator->stringToProxy("'category/test'@'adapter 1'"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && b1->ice_getAdapterId() == "adapter 1"); b1 = communicator->stringToProxy("\"category \\/test@foo/test\"@adapter"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category /test@foo" && b1->ice_getAdapterId() == "adapter"); b1 = communicator->stringToProxy("\"category \\/test@foo/test\"@\"adapter:tcp\""); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category /test@foo" && b1->ice_getAdapterId() == "adapter:tcp"); b1 = communicator->stringToProxy("id -f facet"); test(b1->ice_getIdentity().name == "id" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet"); b1 = communicator->stringToProxy("id -f 'facet x'"); test(b1->ice_getIdentity().name == "id" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet x"); b1 = communicator->stringToProxy("id -f \"facet x\""); test(b1->ice_getIdentity().name == "id" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet x"); try { b1 = communicator->stringToProxy("id -f \"facet x"); test(false); } catch(const Ice::ProxyParseException&) { } try { b1 = communicator->stringToProxy("id -f \'facet x"); test(false); } catch(const Ice::ProxyParseException&) { } b1 = communicator->stringToProxy("test -f facet:tcp"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet" && b1->ice_getAdapterId().empty()); b1 = communicator->stringToProxy("test -f \"facet:tcp\""); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet:tcp" && b1->ice_getAdapterId().empty()); b1 = communicator->stringToProxy("test -f facet@test"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet" && b1->ice_getAdapterId() == "test"); b1 = communicator->stringToProxy("test -f 'facet@test'"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet@test" && b1->ice_getAdapterId().empty()); b1 = communicator->stringToProxy("test -f 'facet@test'@test"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getFacet() == "facet@test" && b1->ice_getAdapterId() == "test"); try { b1 = communicator->stringToProxy("test -f facet@test @test"); test(false); } catch(const Ice::ProxyParseException&) { } b1 = communicator->stringToProxy("test"); test(b1->ice_isTwoway()); b1 = communicator->stringToProxy("test -t"); test(b1->ice_isTwoway()); b1 = communicator->stringToProxy("test -o"); test(b1->ice_isOneway()); b1 = communicator->stringToProxy("test -O"); test(b1->ice_isBatchOneway()); b1 = communicator->stringToProxy("test -d"); test(b1->ice_isDatagram()); b1 = communicator->stringToProxy("test -D"); test(b1->ice_isBatchDatagram()); b1 = communicator->stringToProxy("test"); test(!b1->ice_isSecure()); b1 = communicator->stringToProxy("test -s"); test(b1->ice_isSecure()); test(b1->ice_getEncodingVersion() == Ice::currentEncoding); b1 = communicator->stringToProxy("test -e 1.0"); test(b1->ice_getEncodingVersion().major == 1 && b1->ice_getEncodingVersion().minor == 0); b1 = communicator->stringToProxy("test -e 6.5"); test(b1->ice_getEncodingVersion().major == 6 && b1->ice_getEncodingVersion().minor == 5); b1 = communicator->stringToProxy("test -p 1.0 -e 1.0"); test(b1->ice_toString() == "test -t -e 1.0"); b1 = communicator->stringToProxy("test -p 6.5 -e 1.0"); test(b1->ice_toString() == "test -t -p 6.5 -e 1.0"); try { b1 = communicator->stringToProxy("test:tcp@adapterId"); test(false); } catch(const Ice::EndpointParseException&) { } // This is an unknown endpoint warning, not a parse exception. // //try //{ // b1 = communicator->stringToProxy("test -f the:facet:tcp"); // test(false); //} //catch(const Ice::EndpointParseException&) //{ //} try { b1 = communicator->stringToProxy("test::tcp"); test(false); } catch(const Ice::EndpointParseException&) { } // // Test for bug ICE-5543: escaped escapes in stringToIdentity // Ice::Identity id = { "test", ",X2QNUAzSBcJ_e$AV;E\\" }; Ice::Identity id2 = communicator->stringToIdentity(communicator->identityToString(id)); test(id == id2); id.name = "test"; id.category = ",X2QNUAz\\SB\\/cJ_e$AV;E\\\\"; id2 = communicator->stringToIdentity(communicator->identityToString(id)); test(id == id2); cout << "ok" << endl; cout << "testing propertyToProxy... " << flush; Ice::PropertiesPtr prop = communicator->getProperties(); string propertyPrefix = "Foo.Proxy"; prop->setProperty(propertyPrefix, "test:default -p 12010"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getAdapterId().empty() && b1->ice_getFacet().empty()); string property; property = propertyPrefix + ".Locator"; test(!b1->ice_getLocator()); prop->setProperty(property, "locator:default -p 10000"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getLocator() && b1->ice_getLocator()->ice_getIdentity().name == "locator"); prop->setProperty(property, ""); property = propertyPrefix + ".LocatorCacheTimeout"; test(b1->ice_getLocatorCacheTimeout() == -1); prop->setProperty(property, "1"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getLocatorCacheTimeout() == 1); prop->setProperty(property, ""); // Now retest with an indirect proxy. prop->setProperty(propertyPrefix, "test"); property = propertyPrefix + ".Locator"; prop->setProperty(property, "locator:default -p 10000"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getLocator() && b1->ice_getLocator()->ice_getIdentity().name == "locator"); prop->setProperty(property, ""); property = propertyPrefix + ".LocatorCacheTimeout"; test(b1->ice_getLocatorCacheTimeout() == -1); prop->setProperty(property, "1"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getLocatorCacheTimeout() == 1); prop->setProperty(property, ""); // This cannot be tested so easily because the property is cached // on communicator initialization. // //prop->setProperty("Ice.Default.LocatorCacheTimeout", "60"); //b1 = communicator->propertyToProxy(propertyPrefix); //test(b1->ice_getLocatorCacheTimeout() == 60); //prop->setProperty("Ice.Default.LocatorCacheTimeout", ""); prop->setProperty(propertyPrefix, "test:default -p 12010"); property = propertyPrefix + ".Router"; test(!b1->ice_getRouter()); prop->setProperty(property, "router:default -p 10000"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getRouter() && b1->ice_getRouter()->ice_getIdentity().name == "router"); prop->setProperty(property, ""); property = propertyPrefix + ".PreferSecure"; test(!b1->ice_isPreferSecure()); prop->setProperty(property, "1"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_isPreferSecure()); prop->setProperty(property, ""); property = propertyPrefix + ".ConnectionCached"; test(b1->ice_isConnectionCached()); prop->setProperty(property, "0"); b1 = communicator->propertyToProxy(propertyPrefix); test(!b1->ice_isConnectionCached()); prop->setProperty(property, ""); property = propertyPrefix + ".InvocationTimeout"; test(b1->ice_getInvocationTimeout() == -1); prop->setProperty(property, "1000"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getInvocationTimeout() == 1000); prop->setProperty(property, ""); property = propertyPrefix + ".EndpointSelection"; test(b1->ice_getEndpointSelection() == Ice::Random); prop->setProperty(property, "Random"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getEndpointSelection() == Ice::Random); prop->setProperty(property, "Ordered"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getEndpointSelection() == Ice::Ordered); prop->setProperty(property, ""); property = propertyPrefix + ".CollocationOptimized"; test(b1->ice_isCollocationOptimized()); prop->setProperty(property, "0"); b1 = communicator->propertyToProxy(propertyPrefix); test(!b1->ice_isCollocationOptimized()); prop->setProperty(property, ""); property = propertyPrefix + ".Context.c1"; test(b1->ice_getContext()["c1"].empty()); prop->setProperty(property, "TEST"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getContext()["c1"] == "TEST"); property = propertyPrefix + ".Context.c2"; test(b1->ice_getContext()["c2"].empty()); prop->setProperty(property, "TEST"); b1 = communicator->propertyToProxy(propertyPrefix); test(b1->ice_getContext()["c2"] == "TEST"); prop->setProperty(propertyPrefix + ".Context.c1", ""); prop->setProperty(propertyPrefix + ".Context.c2", ""); cout << "ok" << endl; cout << "testing proxyToProperty... " << flush; b1 = communicator->stringToProxy("test"); b1 = b1->ice_collocationOptimized(true); b1 = b1->ice_connectionCached(true); b1 = b1->ice_preferSecure(false); b1 = b1->ice_endpointSelection(Ice::Ordered); b1 = b1->ice_locatorCacheTimeout(100); b1 = b1->ice_invocationTimeout(1234); Ice::EncodingVersion v = { 1, 0 }; b1 = b1->ice_encodingVersion(v); Ice::ObjectPrx router = communicator->stringToProxy("router"); router = router->ice_collocationOptimized(false); router = router->ice_connectionCached(true); router = router->ice_preferSecure(true); router = router->ice_endpointSelection(Ice::Random); router = router->ice_locatorCacheTimeout(200); router = router->ice_invocationTimeout(1500); Ice::ObjectPrx locator = communicator->stringToProxy("locator"); locator = locator->ice_collocationOptimized(true); locator = locator->ice_connectionCached(false); locator = locator->ice_preferSecure(true); locator = locator->ice_endpointSelection(Ice::Random); locator = locator->ice_locatorCacheTimeout(300); locator = locator->ice_invocationTimeout(1500); locator = locator->ice_router(Ice::RouterPrx::uncheckedCast(router)); b1 = b1->ice_locator(Ice::LocatorPrx::uncheckedCast(locator)); Ice::PropertyDict proxyProps = communicator->proxyToProperty(b1, "Test"); test(proxyProps.size() == 21); test(proxyProps["Test"] == "test -t -e 1.0"); test(proxyProps["Test.CollocationOptimized"] == "1"); test(proxyProps["Test.ConnectionCached"] == "1"); test(proxyProps["Test.PreferSecure"] == "0"); test(proxyProps["Test.EndpointSelection"] == "Ordered"); test(proxyProps["Test.LocatorCacheTimeout"] == "100"); test(proxyProps["Test.InvocationTimeout"] == "1234"); test(proxyProps["Test.Locator"] == "locator -t -e " + Ice::encodingVersionToString(Ice::currentEncoding)); // Locator collocation optimization is always disabled. //test(proxyProps["Test.Locator.CollocationOptimized"] == "1"); test(proxyProps["Test.Locator.ConnectionCached"] == "0"); test(proxyProps["Test.Locator.PreferSecure"] == "1"); test(proxyProps["Test.Locator.EndpointSelection"] == "Random"); test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300"); test(proxyProps["Test.Locator.InvocationTimeout"] == "1500"); test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice::encodingVersionToString(Ice::currentEncoding)); test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0"); test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1"); test(proxyProps["Test.Locator.Router.PreferSecure"] == "1"); test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random"); test(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200"); test(proxyProps["Test.Locator.Router.InvocationTimeout"] == "1500"); cout << "ok" << endl; cout << "testing ice_getCommunicator... " << flush; test(base->ice_getCommunicator() == communicator); cout << "ok" << endl; cout << "testing proxy methods... " << flush; test(communicator->identityToString(base->ice_identity(communicator->stringToIdentity("other"))->ice_getIdentity()) == "other"); test(base->ice_facet("facet")->ice_getFacet() == "facet"); test(base->ice_adapterId("id")->ice_getAdapterId() == "id"); test(base->ice_twoway()->ice_isTwoway()); test(base->ice_oneway()->ice_isOneway()); test(base->ice_batchOneway()->ice_isBatchOneway()); test(base->ice_datagram()->ice_isDatagram()); test(base->ice_batchDatagram()->ice_isBatchDatagram()); test(base->ice_secure(true)->ice_isSecure()); test(!base->ice_secure(false)->ice_isSecure()); test(base->ice_collocationOptimized(true)->ice_isCollocationOptimized()); test(!base->ice_collocationOptimized(false)->ice_isCollocationOptimized()); test(base->ice_preferSecure(true)->ice_isPreferSecure()); test(!base->ice_preferSecure(false)->ice_isPreferSecure()); test(base->ice_encodingVersion(Ice::Encoding_1_0)->ice_getEncodingVersion() == Ice::Encoding_1_0); test(base->ice_encodingVersion(Ice::Encoding_1_1)->ice_getEncodingVersion() == Ice::Encoding_1_1); test(base->ice_encodingVersion(Ice::Encoding_1_0)->ice_getEncodingVersion() != Ice::Encoding_1_1); try { base->ice_timeout(0); test(false); } catch(const IceUtil::IllegalArgumentException&) { } try { base->ice_timeout(-1); } catch(const IceUtil::IllegalArgumentException&) { test(false); } try { base->ice_timeout(-2); test(false); } catch(const IceUtil::IllegalArgumentException&) { } try { base->ice_invocationTimeout(0); test(false); } catch(const IceUtil::IllegalArgumentException&) { } try { base->ice_invocationTimeout(-1); base->ice_invocationTimeout(-2); } catch(const IceUtil::IllegalArgumentException&) { test(false); } try { base->ice_invocationTimeout(-3); test(false); } catch(const IceUtil::IllegalArgumentException&) { } try { base->ice_locatorCacheTimeout(0); } catch(const IceUtil::IllegalArgumentException&) { test(false); } try { base->ice_locatorCacheTimeout(-1); } catch(const IceUtil::IllegalArgumentException&) { test(false); } try { base->ice_locatorCacheTimeout(-2); test(false); } catch(const IceUtil::IllegalArgumentException&) { } cout << "ok" << endl; cout << "testing proxy comparison... " << flush; test(communicator->stringToProxy("foo") == communicator->stringToProxy("foo")); test(communicator->stringToProxy("foo") != communicator->stringToProxy("foo2")); test(communicator->stringToProxy("foo") < communicator->stringToProxy("foo2")); test(!(communicator->stringToProxy("foo2") < communicator->stringToProxy("foo"))); Ice::ObjectPrx compObj = communicator->stringToProxy("foo"); test(compObj->ice_facet("facet") == compObj->ice_facet("facet")); test(compObj->ice_facet("facet") != compObj->ice_facet("facet1")); test(compObj->ice_facet("facet") < compObj->ice_facet("facet1")); test(!(compObj->ice_facet("facet") < compObj->ice_facet("facet"))); test(compObj->ice_oneway() == compObj->ice_oneway()); test(compObj->ice_oneway() != compObj->ice_twoway()); test(compObj->ice_twoway() < compObj->ice_oneway()); test(!(compObj->ice_oneway() < compObj->ice_twoway())); test(compObj->ice_secure(true) == compObj->ice_secure(true)); test(compObj->ice_secure(false) != compObj->ice_secure(true)); test(compObj->ice_secure(false) < compObj->ice_secure(true)); test(!(compObj->ice_secure(true) < compObj->ice_secure(false))); test(compObj->ice_collocationOptimized(true) == compObj->ice_collocationOptimized(true)); test(compObj->ice_collocationOptimized(false) != compObj->ice_collocationOptimized(true)); test(compObj->ice_collocationOptimized(false) < compObj->ice_collocationOptimized(true)); test(!(compObj->ice_collocationOptimized(true) < compObj->ice_collocationOptimized(false))); test(compObj->ice_connectionCached(true) == compObj->ice_connectionCached(true)); test(compObj->ice_connectionCached(false) != compObj->ice_connectionCached(true)); test(compObj->ice_connectionCached(false) < compObj->ice_connectionCached(true)); test(!(compObj->ice_connectionCached(true) < compObj->ice_connectionCached(false))); test(compObj->ice_endpointSelection(Ice::Random) == compObj->ice_endpointSelection(Ice::Random)); test(compObj->ice_endpointSelection(Ice::Random) != compObj->ice_endpointSelection(Ice::Ordered)); test(compObj->ice_endpointSelection(Ice::Random) < compObj->ice_endpointSelection(Ice::Ordered)); test(!(compObj->ice_endpointSelection(Ice::Ordered) < compObj->ice_endpointSelection(Ice::Random))); test(compObj->ice_connectionId("id2") == compObj->ice_connectionId("id2")); test(compObj->ice_connectionId("id1") != compObj->ice_connectionId("id2")); test(compObj->ice_connectionId("id1") < compObj->ice_connectionId("id2")); test(!(compObj->ice_connectionId("id2") < compObj->ice_connectionId("id1"))); test(compObj->ice_connectionId("id1")->ice_getConnectionId() == "id1"); test(compObj->ice_connectionId("id2")->ice_getConnectionId() == "id2"); test(compObj->ice_compress(true) == compObj->ice_compress(true)); test(compObj->ice_compress(false) != compObj->ice_compress(true)); test(compObj->ice_compress(false) < compObj->ice_compress(true)); test(!(compObj->ice_compress(true) < compObj->ice_compress(false))); test(compObj->ice_timeout(20) == compObj->ice_timeout(20)); test(compObj->ice_timeout(10) != compObj->ice_timeout(20)); test(compObj->ice_timeout(10) < compObj->ice_timeout(20)); test(!(compObj->ice_timeout(20) < compObj->ice_timeout(10))); Ice::LocatorPrx loc1 = Ice::LocatorPrx::uncheckedCast(communicator->stringToProxy("loc1:default -p 10000")); Ice::LocatorPrx loc2 = Ice::LocatorPrx::uncheckedCast(communicator->stringToProxy("loc2:default -p 10000")); test(compObj->ice_locator(0) == compObj->ice_locator(0)); test(compObj->ice_locator(loc1) == compObj->ice_locator(loc1)); test(compObj->ice_locator(loc1) != compObj->ice_locator(0)); test(compObj->ice_locator(0) != compObj->ice_locator(loc2)); test(compObj->ice_locator(loc1) != compObj->ice_locator(loc2)); test(compObj->ice_locator(0) < compObj->ice_locator(loc1)); test(!(compObj->ice_locator(loc1) < compObj->ice_locator(0))); test(compObj->ice_locator(loc1) < compObj->ice_locator(loc2)); test(!(compObj->ice_locator(loc2) < compObj->ice_locator(loc1))); Ice::RouterPrx rtr1 = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("rtr1:default -p 10000")); Ice::RouterPrx rtr2 = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("rtr2:default -p 10000")); test(compObj->ice_router(0) == compObj->ice_router(0)); test(compObj->ice_router(rtr1) == compObj->ice_router(rtr1)); test(compObj->ice_router(rtr1) != compObj->ice_router(0)); test(compObj->ice_router(0) != compObj->ice_router(rtr2)); test(compObj->ice_router(rtr1) != compObj->ice_router(rtr2)); test(compObj->ice_router(0) < compObj->ice_router(rtr1)); test(!(compObj->ice_router(rtr1) < compObj->ice_router(0))); test(compObj->ice_router(rtr1) < compObj->ice_router(rtr2)); test(!(compObj->ice_router(rtr2) < compObj->ice_router(rtr1))); Ice::Context ctx1; ctx1["ctx1"] = "v1"; Ice::Context ctx2; ctx2["ctx2"] = "v2"; test(compObj->ice_context(Ice::Context()) == compObj->ice_context(Ice::Context())); test(compObj->ice_context(ctx1) == compObj->ice_context(ctx1)); test(compObj->ice_context(ctx1) != compObj->ice_context(Ice::Context())); test(compObj->ice_context(Ice::Context()) != compObj->ice_context(ctx2)); test(compObj->ice_context(ctx1) != compObj->ice_context(ctx2)); test(compObj->ice_context(ctx1) < compObj->ice_context(ctx2)); test(!(compObj->ice_context(ctx2) < compObj->ice_context(ctx1))); test(compObj->ice_preferSecure(true) == compObj->ice_preferSecure(true)); test(compObj->ice_preferSecure(true) != compObj->ice_preferSecure(false)); test(compObj->ice_preferSecure(false) < compObj->ice_preferSecure(true)); test(!(compObj->ice_preferSecure(true) < compObj->ice_preferSecure(false))); Ice::ObjectPrx compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); Ice::ObjectPrx compObj2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); test(compObj1 != compObj2); test(compObj1 < compObj2); test(!(compObj2 < compObj1)); compObj1 = communicator->stringToProxy("foo@MyAdapter1"); compObj2 = communicator->stringToProxy("foo@MyAdapter2"); test(compObj1 != compObj2); test(compObj1 < compObj2); test(!(compObj2 < compObj1)); test(compObj1->ice_locatorCacheTimeout(20) == compObj1->ice_locatorCacheTimeout(20)); test(compObj1->ice_locatorCacheTimeout(10) != compObj1->ice_locatorCacheTimeout(20)); test(compObj1->ice_locatorCacheTimeout(10) < compObj1->ice_locatorCacheTimeout(20)); test(!(compObj1->ice_locatorCacheTimeout(20) < compObj1->ice_locatorCacheTimeout(10))); test(compObj1->ice_invocationTimeout(20) == compObj1->ice_invocationTimeout(20)); test(compObj1->ice_invocationTimeout(10) != compObj1->ice_invocationTimeout(20)); test(compObj1->ice_invocationTimeout(10) < compObj1->ice_invocationTimeout(20)); test(!(compObj1->ice_invocationTimeout(20) < compObj1->ice_invocationTimeout(10))); compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); compObj2 = communicator->stringToProxy("foo@MyAdapter1"); test(compObj1 != compObj2); test(compObj1 < compObj2); test(!(compObj2 < compObj1)); Ice::EndpointSeq endpts1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000")->ice_getEndpoints(); Ice::EndpointSeq endpts2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001")->ice_getEndpoints(); test(endpts1 != endpts2); test(endpts1 < endpts2); test(!(endpts2 < endpts1)); test(endpts1 == communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000")->ice_getEndpoints()); test(compObj1->ice_encodingVersion(Ice::Encoding_1_0) == compObj1->ice_encodingVersion(Ice::Encoding_1_0)); test(compObj1->ice_encodingVersion(Ice::Encoding_1_0) != compObj1->ice_encodingVersion(Ice::Encoding_1_1)); test(compObj->ice_encodingVersion(Ice::Encoding_1_0) < compObj->ice_encodingVersion(Ice::Encoding_1_1)); test(!(compObj->ice_encodingVersion(Ice::Encoding_1_1) < compObj->ice_encodingVersion(Ice::Encoding_1_0))); // // TODO: Ideally we should also test comparison of fixed proxies. // cout << "ok" << endl; cout << "testing checked cast... " << flush; Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); test(cl); Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl); test(derived); test(cl == base); test(derived == base); test(cl == derived); Ice::LocatorPrx loc = Ice::LocatorPrx::checkedCast(base); test(loc == 0); // // Upcasting // Test::MyClassPrx cl2 = Test::MyClassPrx::checkedCast(derived); Ice::ObjectPrx obj = Ice::ObjectPrx::checkedCast(derived); test(cl2); test(obj); test(cl2 == obj); test(cl2 == derived); // // Now with alternate API // cl = checkedCast<Test::MyClassPrx>(base); test(cl); derived = checkedCast<Test::MyDerivedClassPrx>(cl); test(derived); test(cl == base); test(derived == base); test(cl == derived); loc = checkedCast<Ice::LocatorPrx>(base); test(loc == 0); cl2 = checkedCast<Test::MyClassPrx>(derived); obj = checkedCast<Ice::ObjectPrx>(derived); test(cl2); test(obj); test(cl2 == obj); test(cl2 == derived); cout << "ok" << endl; cout << "testing checked cast with context... " << flush; Ice::Context c = cl->getContext(); test(c.size() == 0); c["one"] = "hello"; c["two"] = "world"; cl = Test::MyClassPrx::checkedCast(base, c); Ice::Context c2 = cl->getContext(); test(c == c2); // // Now with alternate API // cl = checkedCast<Test::MyClassPrx>(base); c = cl->getContext(); test(c.size() == 0); cl = checkedCast<Test::MyClassPrx>(base, c); c2 = cl->getContext(); test(c == c2); cout << "ok" << endl; cout << "testing encoding versioning... " << flush; string ref20 = "test -e 2.0:default -p 12010"; Test::MyClassPrx cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); try { cl20->ice_ping(); test(false); } catch(const Ice::UnsupportedEncodingException&) { // Server 2.0 endpoint doesn't support 1.1 version. } string ref10 = "test -e 1.0:default -p 12010"; Test::MyClassPrx cl10 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref10)); cl10->ice_ping(); cl10->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); cl->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 encoding string ref13 = "test -e 1.3:default -p 12010"; Test::MyClassPrx cl13 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref13)); cl13->ice_ping(); cl13->end_ice_ping(cl13->begin_ice_ping()); try { // Send request with bogus 1.2 encoding. Ice::EncodingVersion version = { 1, 2 }; Ice::OutputStreamPtr out = Ice::createOutputStream(communicator); out->startEncapsulation(); out->endEncapsulation(); vector<Ice::Byte> inEncaps; out->finished(inEncaps); inEncaps[4] = version.major; inEncaps[5] = version.minor; vector<Ice::Byte> outEncaps; cl->ice_invoke("ice_ping", Ice::Normal, inEncaps, outEncaps); test(false); } catch(const Ice::UnknownLocalException& ex) { // The server thrown an UnsupportedEncodingException test(ex.unknown.find("UnsupportedEncodingException") != string::npos); } try { // Send request with bogus 2.0 encoding. Ice::EncodingVersion version = { 2, 0 }; Ice::OutputStreamPtr out = Ice::createOutputStream(communicator); out->startEncapsulation(); out->endEncapsulation(); vector<Ice::Byte> inEncaps; out->finished(inEncaps); inEncaps[4] = version.major; inEncaps[5] = version.minor; vector<Ice::Byte> outEncaps; cl->ice_invoke("ice_ping", Ice::Normal, inEncaps, outEncaps); test(false); } catch(const Ice::UnknownLocalException& ex) { // The server thrown an UnsupportedEncodingException test(ex.unknown.find("UnsupportedEncodingException") != string::npos); } cout << "ok" << endl; cout << "testing protocol versioning... " << flush; ref20 = "test -p 2.0:default -p 12010"; cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); try { cl20->ice_ping(); test(false); } catch(const Ice::UnsupportedProtocolException&) { // Server 2.0 proxy doesn't support 1.0 version. } ref10 = "test -p 1.0:default -p 12010"; cl10 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref10)); cl10->ice_ping(); // 1.3 isn't supported but since a 1.3 proxy supports 1.0, the // call will use the 1.0 encoding ref13 = "test -p 1.3:default -p 12010"; cl13 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref13)); cl13->ice_ping(); cl13->end_ice_ping(cl13->begin_ice_ping()); cout << "ok" <<endl; cout << "testing opaque endpoints... " << flush; try { // Invalid -x option Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 99 -v abc -x abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Missing -t and -v Ice::ObjectPrx p = communicator->stringToProxy("id:opaque"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Repeated -t Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -t 1 -v abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Repeated -v Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -v abc -v abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Missing -t Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -v abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Missing -v Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Missing arg for -t Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -v abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Missing arg for -v Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -v"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Not a number for -t Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t x -v abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // < 0 for -t Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -1 -v abc"); test(false); } catch(const Ice::EndpointParseException&) { } try { // Invalid char for -v Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 99 -v x?c"); test(false); } catch(const Ice::EndpointParseException&) { } // Legal TCP endpoint expressed as opaque endpoint Ice::ObjectPrx p1 = communicator->stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); string pstr = communicator->proxyToString(p1); test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); // Opaque endpoint encoded with 1.1 encoding. Ice::ObjectPrx p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); test(communicator->proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0) { // Working? #ifndef ICE_OS_WINRT const bool ssl = communicator->getProperties()->getProperty("Ice.Default.Protocol") == "ssl"; #else const bool ssl = true; #endif const bool tcp = communicator->getProperties()->getProperty("Ice.Default.Protocol") == "tcp"; if(tcp) { p1->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); } // Two legal TCP endpoints expressed as opaque endpoints p1 = communicator->stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); pstr = communicator->proxyToString(p1); test(pstr == "test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"); // // Test that an SSL endpoint and a nonsense endpoint get written // back out as an opaque endpoint. // p1 = communicator->stringToProxy( "test -e 1.0:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.0 -t 99 -v abch"); pstr = communicator->proxyToString(p1); if(ssl) { test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"); } else if(tcp) { test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); } // // Try to invoke on the endpoint to verify that we get a // NoEndpointException (or ConnectionRefusedException when // running with SSL). // if(ssl) { try { p1->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); test(false); } catch(const Ice::ConnectFailedException&) { } } // // Test that the proxy with an SSL endpoint and a nonsense // endpoint (which the server doesn't understand either) can be // sent over the wire and returned by the server without losing // the opaque endpoints. // Ice::ObjectPrx p2 = derived->echo(p1); pstr = communicator->proxyToString(p2); if(ssl) { test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"); } else if(tcp) { test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); } } cout << "ok" << endl; return cl; }
PlatformInfo::PlatformInfo(const string& prefix, const Ice::CommunicatorPtr& communicator, const TraceLevelsPtr& traceLevels) : _traceLevels(traceLevels) { // // Initialization of the necessary data structures to get the load average. // #if defined(_WIN32) _terminated = false; _usages1.insert(_usages1.end(), 1 * 60 / 5, 0); // 1 sample every 5 seconds during 1 minutes. _usages5.insert(_usages5.end(), 5 * 60 / 5, 0); // 1 sample every 5 seconds during 5 minutes. _usages15.insert(_usages15.end(), 15 * 60 / 5, 0); // 1 sample every 5 seconds during 15 minutes. _last1Total = 0; _last5Total = 0; _last15Total = 0; #elif defined(_AIX) struct nlist nl; nl.n_name = "avenrun"; nl.n_value = 0; if(knlist(&nl, 1, sizeof(nl)) == 0) { _kmem = open("/dev/kmem", O_RDONLY); // // Give up root permissions to minimize security risks, it's // only needed to access /dev/kmem. // setuid(getuid()); setgid(getgid()); } else { _kmem = -1; } #endif // // Get the number of cores/threads. E.g. a quad-core CPU with 2 threads per core will return 8. // #if defined(_WIN32) SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); _nProcessorThreads = sysInfo.dwNumberOfProcessors; #elif defined(__FreeBSD__) static int ncpu[2] = { CTL_HW, HW_NCPU }; size_t sz = sizeof(_nProcessorThreads); if(sysctl(ncpu, 2, &_nProcessorThreads, &sz, 0, 0) == -1) { Ice::SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } #else _nProcessorThreads = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); #endif // // Get the rest of the node information. // #ifdef _WIN32 _os = "Windows"; char hostname[MAX_COMPUTERNAME_LENGTH + 1]; unsigned long size = sizeof(hostname); if(GetComputerName(hostname, &size)) { _hostname = hostname; } OSVERSIONINFO osInfo; osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osInfo); ostringstream os; os << osInfo.dwMajorVersion << "." << osInfo.dwMinorVersion; _release = os.str(); _version = osInfo.szCSDVersion; switch(sysInfo.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_AMD64: _machine = "x64"; break; case PROCESSOR_ARCHITECTURE_IA64: _machine = "IA64"; break; case PROCESSOR_ARCHITECTURE_INTEL: _machine = "x86"; break; default: _machine = "unknown"; break; }; #else struct utsname utsinfo; uname(&utsinfo); _os = utsinfo.sysname; _hostname = utsinfo.nodename; _release = utsinfo.release; _version = utsinfo.version; _machine = utsinfo.machine; #endif Ice::PropertiesPtr properties = communicator->getProperties(); // // Try to obtain the number of processor sockets. // _nProcessorSockets = properties->getPropertyAsIntWithDefault("IceGrid.Node.ProcessorSocketCount", 0); if(_nProcessorSockets == 0) { #if defined(_WIN32) _nProcessorSockets = getSocketCount(_traceLevels->logger); #elif defined(__linux) IceUtilInternal::ifstream is(string("/proc/cpuinfo")); set<string> ids; int nprocessor = 0; while(is) { string line; getline(is, line); if(line.find("processor") == 0) { nprocessor++; } else if(line.find("physical id") == 0) { nprocessor--; ids.insert(line); } } _nProcessorSockets = nprocessor + ids.size(); #else // Not supported _nProcessorSockets = 1; #endif } string endpointsPrefix; if(prefix == "IceGrid.Registry") { _name = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master"); endpointsPrefix = prefix + ".Client"; } else { _name = properties->getProperty(prefix + ".Name"); endpointsPrefix = prefix; } Ice::PropertyDict props = properties->getPropertiesForPrefix(endpointsPrefix); Ice::PropertyDict::const_iterator p = props.find(endpointsPrefix + ".PublishedEndpoints"); if(p != props.end()) { _endpoints = p->second; } else { _endpoints = properties->getProperty(endpointsPrefix + ".Endpoints"); } string cwd; if(IceUtilInternal::getcwd(cwd) != 0) { throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString(); } _cwd = string(cwd); _dataDir = properties->getProperty(prefix + ".Data"); if(!IceUtilInternal::isAbsolutePath(_dataDir)) { _dataDir = _cwd + '/' + _dataDir; } if(_dataDir[_dataDir.length() - 1] == '/') { _dataDir = _dataDir.substr(0, _dataDir.length() - 1); } }
void allTests(const Ice::CommunicatorPtr& communicator) { string ref = "DemoIceBox/admin:default -p 9996 -t 10000"; Ice::ObjectPrx admin = communicator->stringToProxy(ref); TestFacetPrx facet; cout << "testing custom facet... " << flush; { // // Test: Verify that the custom facet is present. // facet = Test::TestFacetPrx::checkedCast(admin, "TestFacet"); facet->ice_ping(); } cout << "ok" << endl; cout << "testing properties facet... " << flush; { Ice::PropertiesAdminPrx pa = Ice::PropertiesAdminPrx::checkedCast(admin, "IceBox.Service.TestService.Properties"); // // Test: PropertiesAdmin::getProperty() // test(pa->getProperty("Prop1") == "1"); test(pa->getProperty("Bogus") == ""); // // Test: PropertiesAdmin::getProperties() // Ice::PropertyDict pd = pa->getPropertiesForPrefix(""); test(pd.size() == 5); test(pd["Prop1"] == "1"); test(pd["Prop2"] == "2"); test(pd["Prop3"] == "3"); test(pd["Ice.Config"] == "config.service"); test(pd["Ice.ProgramName"] == "IceBox-TestService"); Ice::PropertyDict changes; // // Test: PropertiesAdmin::setProperties() // Ice::PropertyDict setProps; setProps["Prop1"] = "10"; // Changed setProps["Prop2"] = "20"; // Changed setProps["Prop3"] = ""; // Removed setProps["Prop4"] = "4"; // Added setProps["Prop5"] = "5"; // Added pa->setProperties(setProps); test(pa->getProperty("Prop1") == "10"); test(pa->getProperty("Prop2") == "20"); test(pa->getProperty("Prop3") == ""); test(pa->getProperty("Prop4") == "4"); test(pa->getProperty("Prop5") == "5"); changes = facet->getChanges(); test(changes.size() == 5); test(changes["Prop1"] == "10"); test(changes["Prop2"] == "20"); test(changes["Prop3"] == ""); test(changes["Prop4"] == "4"); test(changes["Prop5"] == "5"); pa->setProperties(setProps); changes = facet->getChanges(); test(changes.empty()); } cout << "ok" << endl; cout << "testing metrics admin facet... " << flush; { IceMX::MetricsAdminPrx ma = IceMX::MetricsAdminPrx::checkedCast(admin, "IceBox.Service.TestService.Metrics"); Ice::PropertiesAdminPrx pa = Ice::PropertiesAdminPrx::checkedCast(admin, "IceBox.Service.TestService.Properties"); Ice::StringSeq views; Ice::StringSeq disabledViews; views = ma->getMetricsViewNames(disabledViews); test(views.empty()); Ice::PropertyDict setProps; setProps["IceMX.Metrics.Debug.GroupBy"] = "id"; setProps["IceMX.Metrics.All.GroupBy"] = "none"; setProps["IceMX.Metrics.Parent.GroupBy"] = "parent"; pa->setProperties(setProps); pa->setProperties(Ice::PropertyDict()); views = ma->getMetricsViewNames(disabledViews); test(views.size() == 3); // Make sure that the IceBox communicator metrics admin is a separate instance. test(IceMX::MetricsAdminPrx::checkedCast(admin, "Metrics")->getMetricsViewNames(disabledViews).empty()); } cout << "ok" << endl; }
int PropsClient::run(int argc, char* argv[]) { if(argc > 1) { cerr << appName() << ": too many arguments" << endl; return EXIT_FAILURE; } PropsPrx props = PropsPrx::checkedCast(communicator()->propertyToProxy("Props.Proxy")); if(!props) { cerr << argv[0] << ": invalid proxy" << endl; return EXIT_FAILURE; } Ice::PropertiesAdminPrx admin = Ice::PropertiesAdminPrx::checkedCast(communicator()->propertyToProxy("Admin.Proxy")); Ice::PropertyDict batch1; batch1["Demo.Prop1"] = "1"; batch1["Demo.Prop2"] = "2"; batch1["Demo.Prop3"] = "3"; Ice::PropertyDict batch2; batch2["Demo.Prop1"] = "10"; batch2["Demo.Prop2"] = ""; // An empty value removes this property batch2["Demo.Prop3"] = "30"; show(admin); menu(); char c = 'x'; do { try { cout << "==> "; cin >> c; if(c == '1' || c == '2') { Ice::PropertyDict dict = c == '1' ? batch1 : batch2; cout << "Sending:" << endl; for(Ice::PropertyDict::iterator p = dict.begin(); p != dict.end(); ++p) { if(p->first.find("Demo") == 0) { cout << " " << p->first << "=" << p->second << endl; } } cout << endl; admin->setProperties(dict); cout << "Changes:" << endl; Ice::PropertyDict changes = props->getChanges(); if(changes.empty()) { cout << " None." << endl; } else { for(Ice::PropertyDict::iterator p = changes.begin(); p != changes.end(); ++p) { cout << " " << p->first; if(p->second.empty()) { cout << " was removed" << endl; } else { cout << " is now " << p->second << endl; } } } } else if(c == 'c') { show(admin); } else if(c == 's') { props->shutdown(); } else if(c == 'x') { // Nothing to do } else if(c == '?') { menu(); } else { cout << "unknown command `" << c << "'" << endl; menu(); } } catch(const Ice::Exception& ex) { cerr << ex << endl; } } while(cin.good() && c != 'x'); return EXIT_SUCCESS; }