diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-02-01 13:11:54 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-02-01 13:11:54 +0100 |
commit | 1005c525cf00a6e4b2ec7db24a75e6a15582bd21 (patch) | |
tree | f3b67c1e15c846363797f79a9fa0107dc20e92e2 | |
parent | Fixed syntax error (diff) | |
download | ice-1005c525cf00a6e4b2ec7db24a75e6a15582bd21.tar.bz2 ice-1005c525cf00a6e4b2ec7db24a75e6a15582bd21.tar.xz ice-1005c525cf00a6e4b2ec7db24a75e6a15582bd21.zip |
Changed ice_fixed to inherit invocation timeout, context and compress override from original proxy
23 files changed, 354 insertions, 41 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 2f331a1dace..e3d5a1fa45d 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -603,11 +603,20 @@ IceInternal::FixedReference::FixedReference(const InstancePtr& instance, const string& facet, Mode mode, bool secure, + const ProtocolVersion& protocol, const EncodingVersion& encoding, - const ConnectionIPtr& fixedConnection) : - Reference(instance, communicator, id, facet, mode, secure, Ice::Protocol_1_0, encoding, -1, Ice::Context()), + const ConnectionIPtr& fixedConnection, + int invocationTimeout, + const Ice::Context& context, + const IceUtil::Optional<bool>& compress) : + Reference(instance, communicator, id, facet, mode, secure, protocol, encoding, invocationTimeout, context), _fixedConnection(fixedConnection) { + if(compress) + { + _overrideCompress = true; + _compress = *compress; + } } vector<EndpointIPtr> @@ -791,7 +800,7 @@ IceInternal::FixedReference::getRequestHandler(const Ice::ObjectPrxPtr& proxy) c { if(_fixedConnection->endpoint()->datagram()) { - throw NoEndpointException(__FILE__, __LINE__, ""); + throw NoEndpointException(__FILE__, __LINE__, toString()); } break; } @@ -801,7 +810,7 @@ IceInternal::FixedReference::getRequestHandler(const Ice::ObjectPrxPtr& proxy) c { if(!_fixedConnection->endpoint()->datagram()) { - throw NoEndpointException(__FILE__, __LINE__, ""); + throw NoEndpointException(__FILE__, __LINE__, toString()); } break; } @@ -823,7 +832,7 @@ IceInternal::FixedReference::getRequestHandler(const Ice::ObjectPrxPtr& proxy) c } if(secure && !_fixedConnection->endpoint()->secure()) { - throw NoEndpointException(__FILE__, __LINE__, ""); + throw NoEndpointException(__FILE__, __LINE__, toString()); } _fixedConnection->throwException(); // Throw in case our connection is already destroyed. @@ -1200,8 +1209,12 @@ IceInternal::RoutableReference::changeConnection(const Ice::ConnectionIPtr& conn getFacet(), getMode(), getSecure(), + getProtocol(), getEncoding(), - connection); + connection, + getInvocationTimeout(), + getContext()->getValue(), + getCompress()); } bool diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index c06786e0339..62aa8871668 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -191,7 +191,8 @@ class FixedReference : public Reference public: FixedReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const std::string&, Mode, - bool, const Ice::EncodingVersion&, const Ice::ConnectionIPtr&); + bool, const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const Ice::ConnectionIPtr&, + int, const Ice::Context&, const IceUtil::Optional<bool>&); virtual std::vector<EndpointIPtr> getEndpoints() const; virtual std::string getAdapterId() const; diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index 3014387b52c..c46bdca2332 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -91,8 +91,12 @@ IceInternal::ReferenceFactory::create(const Identity& ident, const Ice::Connecti "", // Facet connection->endpoint()->datagram() ? Reference::ModeDatagram : Reference::ModeTwoway, connection->endpoint()->secure(), + Ice::Protocol_1_0, _instance->defaultsAndOverrides()->defaultEncoding, - connection); + connection, + -1, + Ice::Context(), + IceUtil::Optional<bool>()); } ReferencePtr diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 283238351fe..9a23982ccc0 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -1155,11 +1155,33 @@ allTests(const Ice::CommunicatorPtr& communicator) test(cl->ice_secure(true)->ice_fixed(connection)->ice_isSecure()); test(cl->ice_facet("facet")->ice_fixed(connection)->ice_getFacet() == "facet"); test(cl->ice_oneway()->ice_fixed(connection)->ice_isOneway()); + Ice::Context ctx; + ctx["one"] = "hello"; + ctx["two"] = "world"; + test(cl->ice_fixed(connection)->ice_getContext().empty()); + test(cl->ice_context(ctx)->ice_fixed(connection)->ice_getContext().size() == 2); + test(cl->ice_fixed(connection)->ice_getInvocationTimeout() == -1); + test(cl->ice_invocationTimeout(10)->ice_fixed(connection)->ice_getInvocationTimeout() == 10); test(cl->ice_fixed(connection)->ice_getConnection() == connection); test(cl->ice_fixed(connection)->ice_fixed(connection)->ice_getConnection() == connection); + test(*cl->ice_compress(true)->ice_fixed(connection)->ice_getCompress()); test(!cl->ice_fixed(connection)->ice_getTimeout()); Ice::ConnectionPtr fixedConnection = cl->ice_connectionId("ice_fixed")->ice_getConnection(); test(cl->ice_fixed(connection)->ice_fixed(fixedConnection)->ice_getConnection() == fixedConnection); + try + { + cl->ice_secure(!connection->getEndpoint()->getInfo()->secure())->ice_fixed(connection)->ice_ping(); + } + catch(const Ice::NoEndpointException&) + { + } + try + { + cl->ice_datagram()->ice_fixed(connection)->ice_ping(); + } + catch(const Ice::NoEndpointException&) + { + } } else { diff --git a/csharp/src/Ice/Reference.cs b/csharp/src/Ice/Reference.cs index c4bd632734d..52ab63a3122 100644 --- a/csharp/src/Ice/Reference.cs +++ b/csharp/src/Ice/Reference.cs @@ -558,11 +558,20 @@ namespace IceInternal string facet, Mode mode, bool secure, + Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, - Ice.ConnectionI connection) - : base(instance, communicator, identity, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, -1, null) + Ice.ConnectionI connection, + int invocationTimeout, + Dictionary<string, string> context, + Ice.Optional<bool> compress) + : base(instance, communicator, identity, facet, mode, secure, protocol, encoding, invocationTimeout, context) { _fixedConnection = connection; + if(compress.HasValue) + { + overrideCompress_ = true; + compress_ = compress.Value; + } } public override EndpointI[] getEndpoints() @@ -721,7 +730,7 @@ namespace IceInternal { if(_fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(ToString()); } break; } @@ -731,7 +740,7 @@ namespace IceInternal { if(!_fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(ToString()); } break; } @@ -753,7 +762,7 @@ namespace IceInternal } if(secure && !_fixedConnection.endpoint().secure()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(ToString()); } _fixedConnection.throwException(); // Throw in case our connection is already destroyed. @@ -1052,8 +1061,12 @@ namespace IceInternal getFacet(), getMode(), getSecure(), + getProtocol(), getEncoding(), - connection); + connection, + getInvocationTimeout(), + getContext(), + getCompress()); } public override bool isIndirect() diff --git a/csharp/src/Ice/ReferenceFactory.cs b/csharp/src/Ice/ReferenceFactory.cs index e839b1a95ee..a29f8235255 100644 --- a/csharp/src/Ice/ReferenceFactory.cs +++ b/csharp/src/Ice/ReferenceFactory.cs @@ -62,8 +62,12 @@ namespace IceInternal "", // Facet connection.endpoint().datagram() ? Reference.Mode.ModeDatagram : Reference.Mode.ModeTwoway, connection.endpoint().secure(), + Ice.Util.Protocol_1_0, _instance.defaultsAndOverrides().defaultEncoding, - connection); + connection, + -1, + null, + new Ice.Optional<bool>()); } public Reference copy(Reference r) diff --git a/csharp/test/Ice/proxy/AllTests.cs b/csharp/test/Ice/proxy/AllTests.cs index b06ef372225..9d1d0e51914 100644 --- a/csharp/test/Ice/proxy/AllTests.cs +++ b/csharp/test/Ice/proxy/AllTests.cs @@ -819,11 +819,33 @@ public class AllTests : TestCommon.AllTests test(cl.ice_secure(true).ice_fixed(connection).ice_isSecure()); test(cl.ice_facet("facet").ice_fixed(connection).ice_getFacet().Equals("facet")); test(cl.ice_oneway().ice_fixed(connection).ice_isOneway()); + Dictionary<string, string> ctx = new Dictionary<string, string>(); + ctx["one"] = "hello"; + ctx["two"] = "world"; + test(cl.ice_fixed(connection).ice_getContext().Count == 0); + test(cl.ice_context(ctx).ice_fixed(connection).ice_getContext().Count == 2); + test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1); + test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10); test(cl.ice_fixed(connection).ice_getConnection() == connection); test(cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection); test(!cl.ice_fixed(connection).ice_getTimeout().HasValue); + test(cl.ice_compress(true).ice_fixed(connection).ice_getCompress().Value); Ice.Connection fixedConnection = cl.ice_connectionId("ice_fixed").ice_getConnection(); test(cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection); + try + { + cl.ice_secure(!connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping(); + } + catch(Ice.NoEndpointException) + { + } + try + { + cl.ice_datagram().ice_fixed(connection).ice_ping(); + } + catch(Ice.NoEndpointException) + { + } } else { diff --git a/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java b/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java index 9756fb5c01f..a5412ecbbdd 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java @@ -18,11 +18,20 @@ public class FixedReference extends Reference String facet, int mode, boolean secure, + Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, - Ice.ConnectionI connection) + Ice.ConnectionI connection, + int invocationTimeout, + java.util.Map<String, String> context, + Ice.BooleanOptional compress) { - super(instance, communicator, identity, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, -1, null); + super(instance, communicator, identity, facet, mode, secure, protocol, encoding, invocationTimeout, context); _fixedConnection = connection; + if(compress.isSet()) + { + _overrideCompress = true; + _compress = compress.get(); + } } @Override @@ -233,7 +242,7 @@ public class FixedReference extends Reference { if(_fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(toString()); } break; } @@ -243,7 +252,7 @@ public class FixedReference extends Reference { if(!_fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(toString()); } break; } @@ -265,7 +274,7 @@ public class FixedReference extends Reference } if(secure && !_fixedConnection.endpoint().secure()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(toString()); } _fixedConnection.throwException(); // Throw in case our connection is already destroyed. diff --git a/java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java index d4da69fbb98..db5d4990214 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java @@ -53,8 +53,12 @@ public final class ReferenceFactory "", // Facet fixedConnection.endpoint().datagram() ? Reference.ModeDatagram : Reference.ModeTwoway, fixedConnection.endpoint().secure(), + Ice.Util.Protocol_1_0, _instance.defaultsAndOverrides().defaultEncoding, - fixedConnection); + fixedConnection, + -1, + null, + new Ice.BooleanOptional()); } public Reference diff --git a/java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java b/java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java index 187c2ae4bd9..0f9288883d6 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java @@ -299,8 +299,12 @@ public class RoutableReference extends Reference getFacet(), getMode(), getSecure(), + getProtocol(), getEncoding(), - connection); + connection, + getInvocationTimeout(), + getContext(), + getCompress()); } @Override diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java index af4d50466e8..1d27c907644 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java @@ -907,11 +907,33 @@ public class AllTests test(cl.ice_secure(true).ice_fixed(connection).ice_isSecure()); test(cl.ice_facet("facet").ice_fixed(connection).ice_getFacet().equals("facet")); test(cl.ice_oneway().ice_fixed(connection).ice_isOneway()); + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); + ctx.put("one", "hello"); + ctx.put("two", "world"); + test(cl.ice_fixed(connection).ice_getContext().isEmpty()); + test(cl.ice_context(ctx).ice_fixed(connection).ice_getContext().size() == 2); + test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1); + test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10); test(cl.ice_fixed(connection).ice_getConnection() == connection); test(cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection); test(!cl.ice_fixed(connection).ice_getTimeout().isSet()); + test(cl.ice_compress(true).ice_fixed(connection).ice_getCompress().get()); Ice.Connection fixedConnection = cl.ice_connectionId("ice_fixed").ice_getConnection(); test(cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection); + try + { + cl.ice_secure(!connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping(); + } + catch(Ice.NoEndpointException ex) + { + } + try + { + cl.ice_datagram().ice_fixed(connection).ice_ping(); + } + catch(Ice.NoEndpointException ex) + { + } } else { diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java index b1e12566833..56b08e6e109 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java @@ -18,12 +18,20 @@ public class FixedReference extends Reference String facet, int mode, boolean secure, + com.zeroc.Ice.ProtocolVersion protocol, com.zeroc.Ice.EncodingVersion encoding, - com.zeroc.Ice.ConnectionI connection) + com.zeroc.Ice.ConnectionI connection, + int invocationTimeout, + java.util.Map<String, String> context, + java.util.Optional<Boolean> compress) { - super(instance, communicator, identity, facet, mode, secure, com.zeroc.Ice.Util.Protocol_1_0, encoding, -1, - null); + super(instance, communicator, identity, facet, mode, secure, protocol, encoding, invocationTimeout, context); _fixedConnection = connection; + if(compress.isPresent()) + { + _overrideCompress = true; + _compress = compress.get(); + } } @Override @@ -248,7 +256,7 @@ public class FixedReference extends Reference { if(_fixedConnection.endpoint().datagram()) { - throw new com.zeroc.Ice.NoEndpointException(""); + throw new com.zeroc.Ice.NoEndpointException(toString()); } break; } @@ -258,7 +266,7 @@ public class FixedReference extends Reference { if(!_fixedConnection.endpoint().datagram()) { - throw new com.zeroc.Ice.NoEndpointException(""); + throw new com.zeroc.Ice.NoEndpointException(toString()); } break; } @@ -280,7 +288,7 @@ public class FixedReference extends Reference } if(secure && !_fixedConnection.endpoint().secure()) { - throw new com.zeroc.Ice.NoEndpointException(""); + throw new com.zeroc.Ice.NoEndpointException(toString()); } _fixedConnection.throwException(); // Throw in case our connection is already destroyed. diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java index 00888a66d8c..7bbdc84ef67 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java @@ -56,8 +56,12 @@ public final class ReferenceFactory "", // Facet fixedConnection.endpoint().datagram() ? Reference.ModeDatagram : Reference.ModeTwoway, fixedConnection.endpoint().secure(), + com.zeroc.Ice.Util.Protocol_1_0, _instance.defaultsAndOverrides().defaultEncoding, - fixedConnection); + fixedConnection, + -1, + null, + java.util.Optional.empty()); } public Reference diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java index b2ef5cf7987..8261365382e 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java @@ -313,8 +313,12 @@ public class RoutableReference extends Reference getFacet(), getMode(), getSecure(), + getProtocol(), getEncoding(), - connection); + connection, + getInvocationTimeout(), + getContext(), + getCompress()); } @Override diff --git a/java/test/src/main/java/test/Ice/proxy/AllTests.java b/java/test/src/main/java/test/Ice/proxy/AllTests.java index a3d5240101e..9132eaf514e 100644 --- a/java/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java/test/src/main/java/test/Ice/proxy/AllTests.java @@ -844,11 +844,33 @@ public class AllTests test(cl.ice_secure(true).ice_fixed(connection).ice_isSecure()); test(cl.ice_facet("facet").ice_fixed(connection).ice_getFacet().equals("facet")); test(cl.ice_oneway().ice_fixed(connection).ice_isOneway()); + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); + ctx.put("one", "hello"); + ctx.put("two", "world"); + test(cl.ice_fixed(connection).ice_getContext().isEmpty()); + test(cl.ice_context(ctx).ice_fixed(connection).ice_getContext().size() == 2); + test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1); + test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10); test(cl.ice_fixed(connection).ice_getConnection() == connection); test(cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection); test(!cl.ice_fixed(connection).ice_getTimeout().isPresent()); + test(cl.ice_compress(true).ice_fixed(connection).ice_getCompress().get()); com.zeroc.Ice.Connection fixedConnection = cl.ice_connectionId("ice_fixed").ice_getConnection(); test(cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection); + try + { + cl.ice_secure(!connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping(); + } + catch(com.zeroc.Ice.NoEndpointException ex) + { + } + try + { + cl.ice_datagram().ice_fixed(connection).ice_ping(); + } + catch(com.zeroc.Ice.NoEndpointException ex) + { + } } else { diff --git a/js/src/Ice/Reference.js b/js/src/Ice/Reference.js index 84a302cc676..cc46bb5f2b0 100644 --- a/js/src/Ice/Reference.js +++ b/js/src/Ice/Reference.js @@ -113,8 +113,11 @@ class ReferenceFactory "", // Facet fixedConnection.endpoint().datagram() ? RefMode.ModeDatagram : RefMode.ModeTwoway, fixedConnection.endpoint().secure(), + Ice.Protocol_1_0, this._instance.defaultsAndOverrides().defaultEncoding, - fixedConnection); + fixedConnection, + -1, + null); } copy(r) @@ -1454,9 +1457,10 @@ Ice.Reference = Reference; class FixedReference extends Reference { - constructor(instance, communicator, identity, facet, mode, secure, encoding, connection) + constructor(instance, communicator, identity, facet, mode, secure, protocol, encoding, connection, + invocationTimeout, context) { - super(instance, communicator, identity, facet, mode, secure, Ice.Protocol_1_0, encoding); + super(instance, communicator, identity, facet, mode, secure, protocol, encoding, invocationTimeout, context); this._fixedConnection = connection; } @@ -1593,8 +1597,17 @@ class FixedReference extends Reference clone() { - const r = new FixedReference(this.getInstance(), this.getCommunicator(), this.getIdentity(), this.getFacet(), - this.getMode(), this.getSecure(), this.getEncoding(), this._fixedConnection); + const r = new FixedReference(this.getInstance(), + this.getCommunicator(), + this.getIdentity(), + this.getFacet(), + this.getMode(), + this.getSecure(), + this.getProtocol(), + this.getEncoding(), + this._fixedConnection, + this.getInvocationTimeout(), + this.getContext()); this.copyMembers(r); return r; } @@ -1609,7 +1622,7 @@ class FixedReference extends Reference { if(this._fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(this.toString()); } break; } @@ -1619,7 +1632,7 @@ class FixedReference extends Reference { if(!this._fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(this.toString()); } break; } @@ -1633,7 +1646,7 @@ class FixedReference extends Reference const secure = defaultsAndOverrides.overrideSecure ? defaultsAndOverrides.overrideSecureValue : this.getSecure(); if(secure && !this._fixedConnection.endpoint().secure()) { - throw new Ice.NoEndpointException(""); + throw new Ice.NoEndpointException(this.toString()); } this._fixedConnection.throwException(); // Throw in case our connection is already destroyed. @@ -1886,8 +1899,11 @@ class RoutableReference extends Reference this.getFacet(), this.getMode(), this.getSecure(), + this.getProtocol(), this.getEncoding(), - newConnection); + newConnection, + this.getInvocationTimeout(), + this.getContext()); } isIndirect() diff --git a/js/test/Ice/proxy/Client.js b/js/test/Ice/proxy/Client.js index e5c811fde7f..3880fb45049 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -777,11 +777,35 @@ test(cl.ice_secure(true).ice_fixed(connection).ice_isSecure()); test(cl.ice_facet("facet").ice_fixed(connection).ice_getFacet() == "facet"); test(cl.ice_oneway().ice_fixed(connection).ice_isOneway()); + const ctx = new Map(); + ctx.set("one", "hello"); + ctx.set("two", "world"); + test(cl.ice_fixed(connection).ice_getContext().size == 0); + test(cl.ice_context(ctx).ice_fixed(connection).ice_getContext().size == 2); + test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1); + test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10); test(await cl.ice_fixed(connection).ice_getConnection() == connection); test(await cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection); test(cl.ice_fixed(connection).ice_getTimeout() === undefined); const fixedConnection = await cl.ice_connectionId("ice_fixed").ice_getConnection(); test(await cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection); + try + { + await cl.ice_secure(!connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping(); + } + catch(ex) + { + test(ex instanceof Ice.NoEndpointException); + } + try + { + await cl.ice_datagram().ice_fixed(connection).ice_ping(); + } + catch(ex) + { + test(ex instanceof Ice.NoEndpointException); + } + } else { diff --git a/objective-c/test/Ice/proxy/AllTests.m b/objective-c/test/Ice/proxy/AllTests.m index 5b5828ec3eb..886bbbab0da 100644 --- a/objective-c/test/Ice/proxy/AllTests.m +++ b/objective-c/test/Ice/proxy/AllTests.m @@ -723,11 +723,32 @@ proxyAllTests(id<ICECommunicator> communicator) test([[[cl ice_secure:YES] ice_fixed:connection] ice_isSecure]); test([[[[cl ice_facet:@"facet"] ice_fixed:connection] ice_getFacet] isEqualToString:@"facet"]); test([[[cl ice_oneway] ice_fixed:connection] ice_isOneway]); + ICEMutableContext* ctx = [ICEMutableContext dictionary]; + [ctx setObject:@"hello" forKey:@"one"]; + [ctx setObject:@"world" forKey:@"two"]; + test([[[cl ice_fixed:connection] ice_getContext] count] == 0); + test([[[[cl ice_context:ctx] ice_fixed:connection] ice_getContext] count] == 2); + test([[cl ice_fixed:connection] ice_getInvocationTimeout] == -1); + test([[[cl ice_invocationTimeout:10] ice_fixed:connection] ice_getInvocationTimeout] == 10); test([[cl ice_fixed:connection] ice_getConnection] == connection); test([[[cl ice_fixed:connection] ice_fixed:connection] ice_getConnection] == connection); test([[cl ice_fixed:connection] ice_getTimeout] == nil); id<ICEConnection> fixedConnection = [[cl ice_connectionId:@"ice_fixed"] ice_getConnection]; test([[[cl ice_fixed:connection] ice_fixed:fixedConnection] ice_getConnection] == fixedConnection); + @try + { + [[[cl ice_secure:![[[connection getEndpoint] getInfo] secure]] ice_fixed:connection] ice_ping]; + } + @catch(ICENoEndpointException*) + { + } + @try + { + [[[cl ice_datagram] ice_fixed:connection] ice_ping]; + } + @catch(ICENoEndpointException*) + { + } } else { diff --git a/php/src/php5/Proxy.cpp b/php/src/php5/Proxy.cpp index 4758dd3db12..57d5ee52a55 100644 --- a/php/src/php5/Proxy.cpp +++ b/php/src/php5/Proxy.cpp @@ -1275,6 +1275,27 @@ ZEND_METHOD(Ice_ObjectPrx, ice_invocationTimeout) } } +ZEND_METHOD(Ice_ObjectPrx, ice_getInvocationTimeout) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + try + { + ZVAL_LONG(return_value, static_cast<long>(_this->proxy->ice_getInvocationTimeout())); + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_connectionId) { ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); @@ -1770,6 +1791,7 @@ static zend_function_entry _proxyMethods[] = ZEND_ME(Ice_ObjectPrx, ice_timeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_invocationTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_getInvocationTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_connectionId, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_fixed, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getConnection, ICE_NULLPTR, ZEND_ACC_PUBLIC) diff --git a/php/src/php7/Proxy.cpp b/php/src/php7/Proxy.cpp index 54772d4afe3..55c9e242a7c 100644 --- a/php/src/php7/Proxy.cpp +++ b/php/src/php7/Proxy.cpp @@ -1262,6 +1262,27 @@ ZEND_METHOD(Ice_ObjectPrx, ice_invocationTimeout ) } } +ZEND_METHOD(Ice_ObjectPrx, ice_getInvocationTimeout) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + try + { + ZVAL_LONG(return_value, static_cast<long>(_this->proxy->ice_getInvocationTimeout())); + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_connectionId) { ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis()); @@ -1723,6 +1744,7 @@ static zend_function_entry _proxyMethods[] = ZEND_ME(Ice_ObjectPrx, ice_timeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_invocationTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_getInvocationTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_connectionId, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_fixed, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getConnection, ICE_NULLPTR, ZEND_ACC_PUBLIC) diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php index e0aad1e35db..a4210d0ff10 100644 --- a/php/test/Ice/proxy/Client.php +++ b/php/test/Ice/proxy/Client.php @@ -522,8 +522,8 @@ function allTests($communicator) $c["one"] = "hello"; $c["two"] = "world"; - $cl = $base->ice_checkedCast("::Test::MyClass", $c); - $c2 = $cl->getContext(); + $clc = $base->ice_checkedCast("::Test::MyClass", $c); + $c2 = $clc->getContext(); test($c == $c2); echo "ok\n"; @@ -537,11 +537,33 @@ function allTests($communicator) test($cl->ice_secure(true)->ice_fixed($connection)->ice_isSecure()); test($cl->ice_facet("facet")->ice_fixed($connection)->ice_getFacet() == "facet"); test($cl->ice_oneway()->ice_fixed($connection)->ice_isOneway()); + $ctx = []; + $ctx["one"] = "hello"; + $ctx["two"] = "world"; + echo count($cl->ice_fixed($connection)->ice_getContext()); + test($cl->ice_fixed($connection)->ice_getContext() == null); + test(count($cl->ice_context($ctx)->ice_fixed($connection)->ice_getContext()) == 2); + test($cl->ice_fixed($connection)->ice_getInvocationTimeout() == -1); + test($cl->ice_invocationTimeout(10)->ice_fixed($connection)->ice_getInvocationTimeout() == 10); test($cl->ice_fixed($connection)->ice_getConnection() == $connection); test($cl->ice_fixed($connection)->ice_fixed($connection)->ice_getConnection() == $connection); test($cl->ice_fixed($connection)->ice_getTimeout() == $none); $fixedConnection = $cl->ice_connectionId("ice_fixed")->ice_getConnection(); test($cl->ice_fixed($connection)->ice_fixed($fixedConnection)->ice_getConnection() == $fixedConnection); + try + { + $cl->ice_secure(!$connection->getEndpoint()->getInfo()->secure())->ice_fixed($connection)->ice_ping(); + } + catch(Exception $ex) + { + } + try + { + $cl->ice_datagram()->ice_fixed($connection)->ice_ping(); + } + catch(Exception $ex) + { + } } else { diff --git a/python/test/Ice/proxy/AllTests.py b/python/test/Ice/proxy/AllTests.py index 1777666cc96..1dd076debfe 100644 --- a/python/test/Ice/proxy/AllTests.py +++ b/python/test/Ice/proxy/AllTests.py @@ -663,11 +663,26 @@ def allTests(communicator, collocated): test(cl.ice_secure(True).ice_fixed(connection).ice_isSecure()) test(cl.ice_facet("facet").ice_fixed(connection).ice_getFacet() == "facet") test(cl.ice_oneway().ice_fixed(connection).ice_isOneway()) + ctx = { } + ctx["one"] = "hello" + ctx["two"] = "world" + test(len(cl.ice_fixed(connection).ice_getContext()) == 0); + test(len(cl.ice_context(ctx).ice_fixed(connection).ice_getContext()) == 2); + test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1); + test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10); test(cl.ice_fixed(connection).ice_getConnection() == connection) test(cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection) test(cl.ice_fixed(connection).ice_getTimeout() == Ice.Unset) fixedConnection = cl.ice_connectionId("ice_fixed").ice_getConnection() test(cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection) + try: + cl.ice_secure(not connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping(); + except Ice.NoEndpointException: + pass + try: + cl.ice_datagram().ice_fixed(connection).ice_ping(); + except Ice.NoEndpointException: + pass else: try: cl.ice_fixed(connection) diff --git a/ruby/test/Ice/proxy/AllTests.rb b/ruby/test/Ice/proxy/AllTests.rb index a83885fe27f..b00156f372c 100644 --- a/ruby/test/Ice/proxy/AllTests.rb +++ b/ruby/test/Ice/proxy/AllTests.rb @@ -660,11 +660,26 @@ def allTests(communicator) test(cl.ice_secure(true).ice_fixed(connection).ice_isSecure()) test(cl.ice_facet("facet").ice_fixed(connection).ice_getFacet() == "facet") test(cl.ice_oneway().ice_fixed(connection).ice_isOneway()) + ctx = { } + ctx["one"] = "hello" + ctx["two"] = "world" + test(cl.ice_fixed(connection).ice_getContext().length == 0); + test(cl.ice_context(ctx).ice_fixed(connection).ice_getContext().length == 2); + test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1); + test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10); test(cl.ice_fixed(connection).ice_getConnection() == connection) test(cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection) test(cl.ice_fixed(connection).ice_getTimeout() == Ice::Unset) fixedConnection = cl.ice_connectionId("ice_fixed").ice_getConnection() test(cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection) + begin + cl.ice_secure(!connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping(); + rescue Ice::NoEndpointException + end + begin + cl.ice_datagram().ice_fixed(connection).ice_ping(); + rescue Ice::NoEndpointException + end else begin cl.ice_fixed(connection) |