diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 6 | ||||
-rw-r--r-- | cpp/include/Ice/Proxy.h | 16 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 130 | ||||
-rw-r--r-- | cpp/src/Ice/ProxyFactory.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 119 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 13 | ||||
-rw-r--r-- | cpp/test/Ice/binding/AllTests.cpp | 6 | ||||
-rw-r--r-- | cpp/test/Ice/location/AllTests.cpp | 32 | ||||
-rw-r--r-- | cpp/test/Ice/operations/AllTests.cpp | 15 |
9 files changed, 237 insertions, 106 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index f90a5aa63dc..5bbcaa2e245 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,12 @@ Changes since version 3.0.1 --------------------------- +- The ice_timeout and ice_compress proxy methods now correctly + override the timeout and compress flag of indirect proxy endpoints. + +- Added ice_getSecure, ice_getLocator, ice_getRouter, + ice_getCollocationOptimization proxy methods. + - Deprecated ice_newIdentity, ice_newFacet, ice_newContext, ice_newAdapterId and ice_newEndpoints methods proxy. You should now use the ice_identity, ice_facet, ice_context, ice_adapterId and diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 36e43b04c8f..5b816776a9f 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -146,6 +146,18 @@ public: ::Ice::EndpointSelectionType ice_getEndpointSelection() const; ::Ice::ObjectPrx ice_endpointSelection(::Ice::EndpointSelectionType) const; + bool ice_getSecure() const; + ::Ice::ObjectPrx ice_secure(bool) const; + + ::Ice::RouterPrx ice_getRouter() const; + ::Ice::ObjectPrx ice_router(const ::Ice::RouterPrx&) const; + + ::Ice::LocatorPrx ice_getLocator() const; + ::Ice::ObjectPrx ice_locator(const ::Ice::LocatorPrx&) const; + + bool ice_getCollocationOptimization() const; + ::Ice::ObjectPrx ice_collocationOptimization(bool) const; + ::Ice::ObjectPrx ice_twoway() const; bool ice_isTwoway() const; ::Ice::ObjectPrx ice_oneway() const; @@ -157,12 +169,8 @@ public: ::Ice::ObjectPrx ice_batchDatagram() const; bool ice_isBatchDatagram() const; - ::Ice::ObjectPrx ice_secure(bool) const; ::Ice::ObjectPrx ice_compress(bool) const; ::Ice::ObjectPrx ice_timeout(int) const; - ::Ice::ObjectPrx ice_router(const ::Ice::RouterPrx&) const; - ::Ice::ObjectPrx ice_locator(const ::Ice::LocatorPrx&) const; - ::Ice::ObjectPrx ice_collocationOptimization(bool) const; ::Ice::ObjectPrx ice_connectionId(const ::std::string&) const; ::Ice::ConnectionPtr ice_connection(); diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 3bfdc14610a..f380d58efd7 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -9,6 +9,7 @@ #include <Ice/Proxy.h> #include <Ice/ProxyFactory.h> +#include <Ice/ReferenceFactory.h> #include <Ice/Object.h> #include <Ice/ObjectAdapterFactory.h> #include <Ice/Outgoing.h> @@ -582,32 +583,38 @@ IceProxy::Ice::Object::ice_endpointSelection(EndpointSelectionType newType) cons } } +bool +IceProxy::Ice::Object::ice_getSecure() const +{ + return _reference->getSecure(); +} + ObjectPrx -IceProxy::Ice::Object::ice_twoway() const +IceProxy::Ice::Object::ice_secure(bool b) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeTwoway); - if(ref == _reference) + if(b == _reference->getSecure()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeSecure(b)); return proxy; } } -bool -IceProxy::Ice::Object::ice_isTwoway() const +RouterPrx +IceProxy::Ice::Object::ice_getRouter() const { - return _reference->getMode() == Reference::ModeTwoway; + RouterInfoPtr ri = _reference->getRouterInfo(); + return ri ? ri->getRouter() : RouterPrx(); } ObjectPrx -IceProxy::Ice::Object::ice_oneway() const +IceProxy::Ice::Object::ice_router(const RouterPrx& router) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeOneway); + ReferencePtr ref = _reference->changeRouter(router); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -620,16 +627,17 @@ IceProxy::Ice::Object::ice_oneway() const } } -bool -IceProxy::Ice::Object::ice_isOneway() const +LocatorPrx +IceProxy::Ice::Object::ice_getLocator() const { - return _reference->getMode() == Reference::ModeOneway; + LocatorInfoPtr ri = _reference->getLocatorInfo(); + return ri ? ri->getLocator() : LocatorPrx(); } ObjectPrx -IceProxy::Ice::Object::ice_batchOneway() const +IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeBatchOneway); + ReferencePtr ref = _reference->changeLocator(locator); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -643,123 +651,135 @@ IceProxy::Ice::Object::ice_batchOneway() const } bool -IceProxy::Ice::Object::ice_isBatchOneway() const +IceProxy::Ice::Object::ice_getCollocationOptimization() const { - return _reference->getMode() == Reference::ModeBatchOneway; + return _reference->getCollocationOptimization(); } ObjectPrx -IceProxy::Ice::Object::ice_datagram() const +IceProxy::Ice::Object::ice_collocationOptimization(bool b) const { - ReferencePtr ref = _reference->changeMode(Reference::ModeDatagram); - if(ref == _reference) + if(b == _reference->getCollocationOptimization()) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeCollocationOptimization(b)); return proxy; } } -bool -IceProxy::Ice::Object::ice_isDatagram() const -{ - return _reference->getMode() == Reference::ModeDatagram; -} - ObjectPrx -IceProxy::Ice::Object::ice_batchDatagram() const +IceProxy::Ice::Object::ice_twoway() const { - ReferencePtr ref = _reference->changeMode(Reference::ModeBatchDatagram); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeTwoway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeTwoway)); return proxy; } } bool -IceProxy::Ice::Object::ice_isBatchDatagram() const +IceProxy::Ice::Object::ice_isTwoway() const { - return _reference->getMode() == Reference::ModeBatchDatagram; + return _reference->getMode() == Reference::ModeTwoway; } ObjectPrx -IceProxy::Ice::Object::ice_secure(bool b) const +IceProxy::Ice::Object::ice_oneway() const { - ReferencePtr ref = _reference->changeSecure(b); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeOneway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeOneway)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isOneway() const +{ + return _reference->getMode() == Reference::ModeOneway; +} + ObjectPrx -IceProxy::Ice::Object::ice_compress(bool b) const +IceProxy::Ice::Object::ice_batchOneway() const { - ReferencePtr ref = _reference->changeCompress(b); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeBatchOneway) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeBatchOneway)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isBatchOneway() const +{ + return _reference->getMode() == Reference::ModeBatchOneway; +} + ObjectPrx -IceProxy::Ice::Object::ice_timeout(int t) const +IceProxy::Ice::Object::ice_datagram() const { - ReferencePtr ref = _reference->changeTimeout(t); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeDatagram) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeDatagram)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isDatagram() const +{ + return _reference->getMode() == Reference::ModeDatagram; +} + ObjectPrx -IceProxy::Ice::Object::ice_router(const RouterPrx& router) const +IceProxy::Ice::Object::ice_batchDatagram() const { - ReferencePtr ref = _reference->changeRouter(router); - if(ref == _reference) + if(_reference->getMode() == Reference::ModeBatchDatagram) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); } else { ObjectPrx proxy(new ::IceProxy::Ice::Object()); - proxy->setup(ref); + proxy->setup(_reference->changeMode(Reference::ModeBatchDatagram)); return proxy; } } +bool +IceProxy::Ice::Object::ice_isBatchDatagram() const +{ + return _reference->getMode() == Reference::ModeBatchDatagram; +} + ObjectPrx -IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const +IceProxy::Ice::Object::ice_compress(bool b) const { - ReferencePtr ref = _reference->changeLocator(locator); + ReferencePtr ref = _reference->changeCompress(b); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -773,9 +793,9 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const } ObjectPrx -IceProxy::Ice::Object::ice_collocationOptimization(bool b) const +IceProxy::Ice::Object::ice_timeout(int t) const { - ReferencePtr ref = _reference->changeCollocationOptimization(b); + ReferencePtr ref = _reference->changeTimeout(t); if(ref == _reference) { return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); @@ -1007,10 +1027,10 @@ IceProxy::Ice::Object::__getDelegate() // using a router, then add this proxy to the router info // object. // - RoutableReferencePtr rr = RoutableReferencePtr::dynamicCast(_reference); - if(rr && rr->getRouterInfo()) + RouterInfoPtr ri = _reference->getRouterInfo(); + if(ri) { - rr->getRouterInfo()->addProxy(this); + ri->addProxy(this); } } diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index a2eaa1911c7..67f6c695ced 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -97,12 +97,12 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co // if(dynamic_cast<const ObjectNotExistException*>(&ex)) { - IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(ref); - if(!ir || !ir->getLocatorInfo()) + LocatorInfoPtr li = ref->getLocatorInfo(); + if(!li) { ex.ice_throw(); } - ir->getLocatorInfo()->clearObjectCache(ir); + li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref)); } else if(dynamic_cast<const RequestFailedException*>(&ex)) { diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 29280b2e5b3..d2aa754439d 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -1055,18 +1055,7 @@ IceInternal::DirectReference::getLocatorCacheTimeout() const ReferencePtr IceInternal::DirectReference::changeLocator(const LocatorPrx& newLocator) const { - if(newLocator) - { - LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator); - return getInstance()->referenceFactory()->create(getIdentity(), getContext(), getFacet(), getMode(), - getSecure(), "", 0, newLocatorInfo, - getCollocationOptimization(), - getLocatorCacheTimeout()); - } - else - { - return DirectReferencePtr(const_cast<DirectReference*>(this)); - } + return DirectReferencePtr(const_cast<DirectReference*>(this)); } ReferencePtr @@ -1275,6 +1264,10 @@ IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const int locatorCacheTimeout) : RoutableReference(inst, com, ident, ctx, fs, md, sec, rtrInfo, collocationOpt), _adapterId(adptid), + _overrideCompress(false), + _compress(false), + _overrideTimeout(false), + _timeout(0), _locatorInfo(locInfo), _locatorCacheTimeout(locatorCacheTimeout) { @@ -1301,49 +1294,39 @@ IceInternal::IndirectReference::getLocatorCacheTimeout() const ReferencePtr IceInternal::IndirectReference::changeLocator(const LocatorPrx& newLocator) const { - // - // Return a direct reference if a null locator is given. - // - if(!newLocator) + LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator); + if(newLocatorInfo == _locatorInfo) { - return getInstance()->referenceFactory()->create(getIdentity(), getContext(), getFacet(), getMode(), - getSecure(), vector<EndpointIPtr>(), getRouterInfo(), - getCollocationOptimization()); - } - else - { - LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator); - if(newLocatorInfo == _locatorInfo) - { - return IndirectReferencePtr(const_cast<IndirectReference*>(this)); - } - IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); - r->_locatorInfo = newLocatorInfo; - return r; + return IndirectReferencePtr(const_cast<IndirectReference*>(this)); } + IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); + r->_locatorInfo = newLocatorInfo; + return r; } ReferencePtr IceInternal::IndirectReference::changeCompress(bool newCompress) const { - IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); - if(_locatorInfo) + if(_overrideCompress && newCompress == _compress) { - LocatorPrx newLocator = LocatorPrx::uncheckedCast(_locatorInfo->getLocator()->ice_compress(newCompress)); - r->_locatorInfo = getInstance()->locatorManager()->get(newLocator); + return IndirectReferencePtr(const_cast<IndirectReference*>(this)); } + IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); + r->_compress = newCompress; + r->_overrideCompress = true; return r; } ReferencePtr IceInternal::IndirectReference::changeTimeout(int newTimeout) const { - IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); - if(_locatorInfo) + if(_overrideTimeout && newTimeout == _timeout) { - LocatorPrx newLocator = LocatorPrx::uncheckedCast(_locatorInfo->getLocator()->ice_timeout(newTimeout)); - r->_locatorInfo = getInstance()->locatorManager()->get(newLocator); + return IndirectReferencePtr(const_cast<IndirectReference*>(this)); } + IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this)); + r->_timeout = newTimeout; + r->_overrideTimeout = true; return r; } @@ -1453,11 +1436,19 @@ IceInternal::IndirectReference::getConnection(bool& comp) const } // - // Apply the cached connection id to each endpoint. + // Apply the endpoint overrides to each endpoint. // for(vector<EndpointIPtr>::iterator p = endpts.begin(); p != endpts.end(); ++p) { *p = (*p)->connectionId(_connectionId); + if(_overrideCompress) + { + *p = (*p)->compress(_compress); + } + if(_overrideTimeout) + { + *p = (*p)->timeout(_timeout); + } } try @@ -1543,7 +1534,11 @@ IceInternal::IndirectReference::operator==(const Reference& r) const return false; } - return _adapterId == rhs->_adapterId && _connectionId == rhs->_connectionId && _locatorInfo == rhs->_locatorInfo && + return _adapterId == rhs->_adapterId && + _connectionId == rhs->_connectionId && + _overrideCompress == rhs->_overrideCompress && (!_overrideCompress || _compress == rhs->_compress) && + _overrideTimeout == rhs->_overrideTimeout && (!_overrideTimeout || _timeout == rhs->_timeout) && + _locatorInfo == rhs->_locatorInfo && _locatorCacheTimeout == rhs->_locatorCacheTimeout; } @@ -1587,6 +1582,46 @@ IceInternal::IndirectReference::operator<(const Reference& r) const return false; } + if(!_overrideCompress && rhs->_overrideCompress) + { + return true; + } + else if(rhs->_overrideCompress < _overrideCompress) + { + return false; + } + else if(_overrideCompress) + { + if(!_compress && rhs->_compress) + { + return true; + } + else if(rhs->_compress < _compress) + { + return false; + } + } + + if(!_overrideTimeout && rhs->_overrideTimeout) + { + return true; + } + else if(rhs->_overrideTimeout < _overrideTimeout) + { + return false; + } + else if(_overrideTimeout) + { + if(_timeout < rhs->_timeout) + { + return true; + } + else if(rhs->_timeout < _timeout) + { + return false; + } + } + if(_locatorInfo < rhs->_locatorInfo) { return true; @@ -1612,6 +1647,10 @@ IceInternal::IndirectReference::IndirectReference(const IndirectReference& r) : RoutableReference(r), _adapterId(r._adapterId), _connectionId(r._connectionId), + _overrideCompress(r._overrideCompress), + _compress(r._compress), + _overrideTimeout(r._overrideTimeout), + _timeout(r._timeout), _locatorInfo(r._locatorInfo), _locatorCacheTimeout(r._locatorCacheTimeout) { diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index a014666fe10..4afdac3fe29 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -52,6 +52,9 @@ public: Ice::CommunicatorPtr getCommunicator() const; + virtual RouterInfoPtr getRouterInfo() const { return 0; } + virtual LocatorInfoPtr getLocatorInfo() const { return 0; } + virtual bool getSecure() const = 0; virtual std::string getAdapterId() const = 0; virtual std::vector<EndpointIPtr> getEndpoints() const = 0; @@ -139,10 +142,10 @@ public: const std::vector<Ice::ConnectionIPtr>& getFixedConnections() const; virtual bool getSecure() const; - virtual int getLocatorCacheTimeout() const; virtual std::string getAdapterId() const; virtual std::vector<EndpointIPtr> getEndpoints() const; virtual bool getCollocationOptimization() const; + virtual int getLocatorCacheTimeout() const; virtual bool getCacheConnection() const; virtual Ice::EndpointSelectionType getEndpointSelection() const; @@ -185,7 +188,7 @@ class RoutableReference : public Reference { public: - const RouterInfoPtr& getRouterInfo() const { return _routerInfo; } + virtual RouterInfoPtr getRouterInfo() const { return _routerInfo; } std::vector<EndpointIPtr> getRoutedEndpoints() const; virtual bool getSecure() const; @@ -272,7 +275,7 @@ public: const std::string&, Mode, bool, const std::string&, const RouterInfoPtr&, const LocatorInfoPtr&, bool, int); - const LocatorInfoPtr& getLocatorInfo() const { return _locatorInfo; } + virtual LocatorInfoPtr getLocatorInfo() const { return _locatorInfo; } virtual int getLocatorCacheTimeout() const; virtual std::string getAdapterId() const; @@ -306,6 +309,10 @@ private: std::string _adapterId; std::string _connectionId; + bool _overrideCompress; + bool _compress; // Only used if _overrideCompress == true + bool _overrideTimeout; + int _timeout; // Only used if _overrideTimeout == true LocatorInfoPtr _locatorInfo; int _locatorCacheTimeout; }; diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index d23e905d26b..9eee974b561 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -650,7 +650,11 @@ allTests(const Ice::CommunicatorPtr& communicator) } TestIntfPrx testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(true)); - //test(testSecure->ice_getSecure()); + test(testSecure->ice_getSecure()); + testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(false)); + test(!testSecure->ice_getSecure()); + testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(true)); + test(testSecure->ice_getSecure()); test(test->ice_connection() != testSecure->ice_connection()); com->deactivateObjectAdapter(adapters[1]); diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index eff543e1fc2..b134e4ee605 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -8,6 +8,7 @@ // ********************************************************************** #include <Ice/Ice.h> +#include <Ice/Router.h> #include <IceUtil/UUID.h> #include <TestCommon.h> #include <Test.h> @@ -42,6 +43,37 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref) 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; diff --git a/cpp/test/Ice/operations/AllTests.cpp b/cpp/test/Ice/operations/AllTests.cpp index 6435efccbd3..92258063614 100644 --- a/cpp/test/Ice/operations/AllTests.cpp +++ b/cpp/test/Ice/operations/AllTests.cpp @@ -27,6 +27,21 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(base->ice_communicator() == communicator); cout << "ok" << endl; + cout << "testing proxy methods... " << flush; + test(Ice::identityToString(base->ice_identity(Ice::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_getSecure()); + test(!base->ice_secure(false)->ice_getSecure()); + test(base->ice_collocationOptimization(true)->ice_getCollocationOptimization()); + test(!base->ice_collocationOptimization(false)->ice_getCollocationOptimization()); + cout << "ok" << endl; + cout << "testing checked cast... " << flush; Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); test(cl); |