summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-04-30 11:57:21 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-04-30 11:57:21 +0200
commit06024a6fc1ceb70d70e41f93ba0016edefe36289 (patch)
tree40f4bdf32862e466d059bbf0dd1a7293aa522604
parentWin32 fixes, C# port (diff)
downloadice-06024a6fc1ceb70d70e41f93ba0016edefe36289.tar.bz2
ice-06024a6fc1ceb70d70e41f93ba0016edefe36289.tar.xz
ice-06024a6fc1ceb70d70e41f93ba0016edefe36289.zip
Python port, added tests to Ice/info
-rw-r--r--cpp/include/Ice/ProtocolPluginFacade.h5
-rw-r--r--cpp/src/Ice/ProtocolPluginFacade.cpp6
-rw-r--r--cpp/src/Ice/TcpEndpointI.cpp1
-rw-r--r--cpp/src/Ice/UdpEndpointI.cpp1
-rw-r--r--cpp/src/IceSSL/EndpointI.cpp1
-rw-r--r--cpp/src/IceSSL/Instance.cpp6
-rw-r--r--cpp/src/IceSSL/Instance.h1
-rw-r--r--cpp/test/Ice/info/AllTests.cpp18
-rw-r--r--cs/src/Ice/ProtocolPluginFacade.cs13
-rw-r--r--cs/src/Ice/TcpEndpointI.cs3
-rw-r--r--cs/src/Ice/UdpEndpointI.cs3
-rw-r--r--cs/src/IceSSL/EndpointI.cs3
-rw-r--r--cs/src/IceSSL/Instance.cs5
-rw-r--r--cs/test/Ice/info/AllTests.cs48
-rw-r--r--java/src/IceInternal/EndpointI.java4
-rw-r--r--java/src/IceInternal/ProtocolPluginFacade.java5
-rw-r--r--java/src/IceInternal/ProtocolPluginFacadeI.java10
-rw-r--r--java/src/IceInternal/TcpEndpointI.java4
-rw-r--r--java/src/IceInternal/UdpEndpointI.java2
-rw-r--r--java/src/IceSSL/EndpointI.java2
-rw-r--r--java/src/IceSSL/Instance.java6
-rw-r--r--java/test/Ice/info/AllTests.java14
-rw-r--r--py/modules/IcePy/Current.cpp17
-rw-r--r--py/modules/IcePy/EndpointInfo.cpp83
-rw-r--r--py/modules/IcePy/Init.cpp14
-rw-r--r--py/modules/IcePy/Operation.cpp51
-rw-r--r--py/modules/IcePy/Proxy.cpp60
-rw-r--r--py/modules/IcePy/Util.cpp245
-rw-r--r--py/modules/IcePy/Util.h24
-rw-r--r--py/python/Ice.py13
-rw-r--r--py/python/Makefile3
-rw-r--r--py/test/Ice/info/AllTests.py9
-rw-r--r--py/test/Ice/proxy/AllTests.py64
33 files changed, 612 insertions, 132 deletions
diff --git a/cpp/include/Ice/ProtocolPluginFacade.h b/cpp/include/Ice/ProtocolPluginFacade.h
index ac329b8a784..e4cfa0469d7 100644
--- a/cpp/include/Ice/ProtocolPluginFacade.h
+++ b/cpp/include/Ice/ProtocolPluginFacade.h
@@ -47,6 +47,11 @@ public:
std::string getDefaultHost() const;
//
+ // Get the default encoding to be used in endpoints.
+ //
+ Ice::EncodingVersion getDefaultEncoding() const;
+
+ //
// Get the network trace level and category name.
//
int getNetworkTraceLevel() const;
diff --git a/cpp/src/Ice/ProtocolPluginFacade.cpp b/cpp/src/Ice/ProtocolPluginFacade.cpp
index 383ef5db4e2..7f7c3a822e3 100644
--- a/cpp/src/Ice/ProtocolPluginFacade.cpp
+++ b/cpp/src/Ice/ProtocolPluginFacade.cpp
@@ -38,6 +38,12 @@ IceInternal::ProtocolPluginFacade::getDefaultHost() const
return _instance->defaultsAndOverrides()->defaultHost;
}
+Ice::EncodingVersion
+IceInternal::ProtocolPluginFacade::getDefaultEncoding() const
+{
+ return _instance->defaultsAndOverrides()->defaultEncoding;
+}
+
int
IceInternal::ProtocolPluginFacade::getNetworkTraceLevel() const
{
diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp
index eb59bd8ea52..5443b055328 100644
--- a/cpp/src/Ice/TcpEndpointI.cpp
+++ b/cpp/src/Ice/TcpEndpointI.cpp
@@ -36,6 +36,7 @@ IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const strin
}
IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) :
+ EndpointI(Ice::currentProtocol, instance->defaultsAndOverrides()->defaultEncoding),
_instance(instance),
_port(0),
_timeout(-1),
diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp
index 61a9a89bab7..e17ab77dd58 100644
--- a/cpp/src/Ice/UdpEndpointI.cpp
+++ b/cpp/src/Ice/UdpEndpointI.cpp
@@ -38,6 +38,7 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin
}
IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) :
+ EndpointI(Ice::currentProtocol, instance->defaultsAndOverrides()->defaultEncoding),
_instance(instance),
_port(0),
_mcastTtl(-1),
diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp
index e889e989aa2..4d389371d42 100644
--- a/cpp/src/IceSSL/EndpointI.cpp
+++ b/cpp/src/IceSSL/EndpointI.cpp
@@ -36,6 +36,7 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int
}
IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) :
+ IceInternal::EndpointI(Ice::currentProtocol, instance->defaultEncoding()),
_instance(instance),
_port(0),
_timeout(-1),
diff --git a/cpp/src/IceSSL/Instance.cpp b/cpp/src/IceSSL/Instance.cpp
index 4b2a26e0ffa..7bb126e95c6 100644
--- a/cpp/src/IceSSL/Instance.cpp
+++ b/cpp/src/IceSSL/Instance.cpp
@@ -800,6 +800,12 @@ IceSSL::Instance::defaultHost() const
return _facade->getDefaultHost();
}
+Ice::EncodingVersion
+IceSSL::Instance::defaultEncoding() const
+{
+ return _facade->getDefaultEncoding();
+}
+
int
IceSSL::Instance::networkTraceLevel() const
{
diff --git a/cpp/src/IceSSL/Instance.h b/cpp/src/IceSSL/Instance.h
index d332a251e3f..55af46a6c99 100644
--- a/cpp/src/IceSSL/Instance.h
+++ b/cpp/src/IceSSL/Instance.h
@@ -40,6 +40,7 @@ public:
IceInternal::EndpointHostResolverPtr endpointHostResolver() const;
IceInternal::ProtocolSupport protocolSupport() const;
std::string defaultHost() const;
+ Ice::EncodingVersion defaultEncoding() const;
int networkTraceLevel() const;
std::string networkTraceCategory() const;
int securityTraceLevel() const;
diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp
index a83f7a546c9..b7527f182fb 100644
--- a/cpp/test/Ice/info/AllTests.cpp
+++ b/cpp/test/Ice/info/AllTests.cpp
@@ -20,14 +20,22 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "testing proxy endpoint information... " << flush;
{
- Ice::ObjectPrx p1 = communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:"
+ Ice::ObjectPrx p1 = communicator->stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:"
"udp -h udphost -p 10001 --interface eth0 --ttl 5:"
- "opaque -t 100 -v ABCD");
+ "opaque -e 1.8 -t 100 -v ABCD");
Ice::EndpointSeq endps = p1->ice_getEndpoints();
Ice::IPEndpointInfoPtr ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(endps[0]->getInfo());
test(ipEndpoint);
+ Ice::ProtocolVersion pv;
+ pv.major = 1;
+ pv.minor = 4;
+ test(ipEndpoint->protocol == pv);
+ Ice::EncodingVersion ev;
+ ev.major = 1;
+ ev.minor = 3;
+ test(ipEndpoint->encoding == ev);
test(ipEndpoint->host == "tcphost");
test(ipEndpoint->port == 10000);
test(ipEndpoint->timeout == 1200);
@@ -40,6 +48,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endps[1]->getInfo());
test(udpEndpoint);
+ test(udpEndpoint->protocol == Ice::currentProtocol);
+ test(udpEndpoint->encoding == Ice::currentEncoding);
test(udpEndpoint->host == "udphost");
test(udpEndpoint->port == 10001);
test(udpEndpoint->mcastInterface == "eth0");
@@ -52,6 +62,10 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::OpaqueEndpointInfoPtr opaqueEndpoint = Ice::OpaqueEndpointInfoPtr::dynamicCast(endps[2]->getInfo());
test(opaqueEndpoint);
+ Ice::EncodingVersion rev;
+ rev.major = 1;
+ rev.minor = 8;
+ test(opaqueEndpoint->rawEncoding == rev);
}
cout << "ok" << endl;
diff --git a/cs/src/Ice/ProtocolPluginFacade.cs b/cs/src/Ice/ProtocolPluginFacade.cs
index 27c8a3b268e..16c26058c06 100644
--- a/cs/src/Ice/ProtocolPluginFacade.cs
+++ b/cs/src/Ice/ProtocolPluginFacade.cs
@@ -29,6 +29,11 @@ namespace IceInternal
int getProtocolSupport();
//
+ // Get the default encoding to be used in endpoints.
+ //
+ Ice.EncodingVersion getDefaultEncoding();
+
+ //
// Get the default hostname to be used in endpoints.
//
string getDefaultHost();
@@ -93,6 +98,14 @@ namespace IceInternal
//
// Get the default hostname to be used in endpoints.
//
+ public Ice.EncodingVersion getDefaultEncoding()
+ {
+ return _instance.defaultsAndOverrides().defaultEncoding;
+ }
+
+ //
+ // Get the default hostname to be used in endpoints.
+ //
public string getDefaultHost()
{
return _instance.defaultsAndOverrides().defaultHost;
diff --git a/cs/src/Ice/TcpEndpointI.cs b/cs/src/Ice/TcpEndpointI.cs
index c2f4a8cd630..6d6564437ca 100644
--- a/cs/src/Ice/TcpEndpointI.cs
+++ b/cs/src/Ice/TcpEndpointI.cs
@@ -29,7 +29,8 @@ namespace IceInternal
calcHashValue();
}
- public TcpEndpointI(Instance instance, string str, bool oaEndpoint)
+ public TcpEndpointI(Instance instance, string str, bool oaEndpoint) :
+ base(Ice.Util.currentProtocol, instance.defaultsAndOverrides().defaultEncoding)
{
_instance = instance;
_host = null;
diff --git a/cs/src/Ice/UdpEndpointI.cs b/cs/src/Ice/UdpEndpointI.cs
index 272525f2cea..911660e9afe 100644
--- a/cs/src/Ice/UdpEndpointI.cs
+++ b/cs/src/Ice/UdpEndpointI.cs
@@ -33,7 +33,8 @@ namespace IceInternal
calcHashValue();
}
- public UdpEndpointI(Instance instance, string str, bool oaEndpoint)
+ public UdpEndpointI(Instance instance, string str, bool oaEndpoint) :
+ base(Ice.Util.currentProtocol, instance.defaultsAndOverrides().defaultEncoding)
{
instance_ = instance;
_host = null;
diff --git a/cs/src/IceSSL/EndpointI.cs b/cs/src/IceSSL/EndpointI.cs
index e2442af3f45..d995d3c3a3a 100644
--- a/cs/src/IceSSL/EndpointI.cs
+++ b/cs/src/IceSSL/EndpointI.cs
@@ -29,7 +29,8 @@ namespace IceSSL
calcHashValue();
}
- internal EndpointI(Instance instance, string str, bool oaEndpoint)
+ internal EndpointI(Instance instance, string str, bool oaEndpoint) :
+ base(Ice.Util.currentProtocol, instance.defaultEncoding())
{
_instance = instance;
_host = null;
diff --git a/cs/src/IceSSL/Instance.cs b/cs/src/IceSSL/Instance.cs
index d5dc87acb9b..670033213ad 100644
--- a/cs/src/IceSSL/Instance.cs
+++ b/cs/src/IceSSL/Instance.cs
@@ -305,6 +305,11 @@ namespace IceSSL
return _facade.getProtocolSupport();
}
+ internal Ice.EncodingVersion defaultEncoding()
+ {
+ return _facade.getDefaultEncoding();
+ }
+
internal string defaultHost()
{
return _facade.getDefaultHost();
diff --git a/cs/test/Ice/info/AllTests.cs b/cs/test/Ice/info/AllTests.cs
index 435d7efb504..1f3a18604a4 100644
--- a/cs/test/Ice/info/AllTests.cs
+++ b/cs/test/Ice/info/AllTests.cs
@@ -11,25 +11,25 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
-using Test;
-
-#if SILVERLIGHT
-using System.Windows.Controls;
+using Test;
+
+#if SILVERLIGHT
+using System.Windows.Controls;
#endif
public class AllTests : TestCommon.TestApp
{
-#if SILVERLIGHT
- public override Ice.InitializationData initData()
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- return initData;
- }
-
- override
- public void run(Ice.Communicator communicator)
+#if SILVERLIGHT
+ public override Ice.InitializationData initData()
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
+
+ override
+ public void run(Ice.Communicator communicator)
#else
public static void allTests(Ice.Communicator communicator)
#endif
@@ -37,14 +37,17 @@ public class AllTests : TestCommon.TestApp
Write("testing proxy endpoint information... ");
Flush();
{
- Ice.ObjectPrx p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" +
- "udp -h udphost -p 10001 --interface eth0 --ttl 5:" +
- "opaque -t 100 -v ABCD");
+ Ice.ObjectPrx p1 = communicator.stringToProxy(
+ "test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" +
+ "udp -h udphost -p 10001 --interface eth0 --ttl 5:" +
+ "opaque -e 1.8 -t 100 -v ABCD");
Ice.Endpoint[] endps = p1.ice_getEndpoints();
Ice.IPEndpointInfo ipEndpoint = (Ice.IPEndpointInfo)endps[0].getInfo();
+ test(ipEndpoint.protocol.Equals(new Ice.ProtocolVersion(1, 4)));
+ test(ipEndpoint.encoding.Equals(new Ice.EncodingVersion(1, 3)));
test(ipEndpoint.host.Equals("tcphost"));
test(ipEndpoint.port == 10000);
test(ipEndpoint.timeout == 1200);
@@ -62,6 +65,8 @@ public class AllTests : TestCommon.TestApp
#endif
Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endps[1].getInfo();
+ test(udpEndpoint.protocol.Equals(Ice.Util.currentProtocol));
+ test(udpEndpoint.encoding.Equals(Ice.Util.currentEncoding));
test(udpEndpoint.host.Equals("udphost"));
test(udpEndpoint.port == 10001);
test(udpEndpoint.mcastInterface.Equals("eth0"));
@@ -74,10 +79,11 @@ public class AllTests : TestCommon.TestApp
Ice.OpaqueEndpointInfo opaqueEndpoint = (Ice.OpaqueEndpointInfo)endps[2].getInfo();
test(opaqueEndpoint.rawBytes.Length > 0);
+ test(opaqueEndpoint.rawEncoding.Equals(new Ice.EncodingVersion(1, 8)));
}
WriteLine("ok");
- string defaultHost = communicator.getProperties().getProperty("Ice.Default.Host");
+ string defaultHost = communicator.getProperties().getProperty("Ice.Default.Host");
#if !SILVERLIGHT
Ice.ObjectAdapter adapter;
Write("test object adapter endpoint information... ");
@@ -130,8 +136,8 @@ public class AllTests : TestCommon.TestApp
adapter.destroy();
}
WriteLine("ok");
-#endif
-
+#endif
+
Ice.ObjectPrx @base = communicator.stringToProxy("test:default -p 12010:udp -p 12010");
TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(@base);
diff --git a/java/src/IceInternal/EndpointI.java b/java/src/IceInternal/EndpointI.java
index 2196d6b6684..0000be4a8fa 100644
--- a/java/src/IceInternal/EndpointI.java
+++ b/java/src/IceInternal/EndpointI.java
@@ -19,8 +19,8 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En
public EndpointI()
{
- _protocol = (Ice.ProtocolVersion)Protocol.currentProtocol.clone();
- _encoding = (Ice.EncodingVersion)Protocol.currentEncoding.clone();
+ _protocol = (Ice.ProtocolVersion)Protocol.currentProtocol;
+ _encoding = (Ice.EncodingVersion)Protocol.currentEncoding;
}
public String
diff --git a/java/src/IceInternal/ProtocolPluginFacade.java b/java/src/IceInternal/ProtocolPluginFacade.java
index b55b6a58824..717010b0312 100644
--- a/java/src/IceInternal/ProtocolPluginFacade.java
+++ b/java/src/IceInternal/ProtocolPluginFacade.java
@@ -28,6 +28,11 @@ public interface ProtocolPluginFacade
int getProtocolSupport();
//
+ // Get the default encoding to be used in endpoints.
+ //
+ Ice.EncodingVersion getDefaultEncoding();
+
+ //
// Get the default hostname to be used in endpoints.
//
String getDefaultHost();
diff --git a/java/src/IceInternal/ProtocolPluginFacadeI.java b/java/src/IceInternal/ProtocolPluginFacadeI.java
index 2d219c36818..ca10a4f412c 100644
--- a/java/src/IceInternal/ProtocolPluginFacadeI.java
+++ b/java/src/IceInternal/ProtocolPluginFacadeI.java
@@ -45,6 +45,16 @@ public class ProtocolPluginFacadeI implements ProtocolPluginFacade
{
return _instance.protocolSupport();
}
+
+ //
+ // Get the default encoding to be used in endpoints.
+ //
+ public Ice.EncodingVersion
+ getDefaultEncoding()
+ {
+ return _instance.defaultsAndOverrides().defaultEncoding;
+ }
+
//
// Get the default hostname to be used in endpoints.
//
diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java
index 328c34a05b7..0d2ab229193 100644
--- a/java/src/IceInternal/TcpEndpointI.java
+++ b/java/src/IceInternal/TcpEndpointI.java
@@ -28,6 +28,7 @@ final class TcpEndpointI extends EndpointI
public
TcpEndpointI(Instance instance, String str, boolean oaEndpoint)
{
+ super(Protocol.currentProtocol, instance.defaultsAndOverrides().defaultEncoding);
_instance = instance;
_host = null;
_port = 0;
@@ -171,6 +172,7 @@ final class TcpEndpointI extends EndpointI
public
TcpEndpointI(BasicStream s)
{
+ super(new Ice.ProtocolVersion(), new Ice.EncodingVersion());
_instance = s.instance();
s.startReadEncaps();
_host = s.readString();
@@ -179,7 +181,9 @@ final class TcpEndpointI extends EndpointI
_compress = s.readBool();
if(!s.getReadEncoding().equals(Ice.Util.Encoding_1_0))
{
+ _protocol = new Ice.ProtocolVersion();
_protocol.__read(s);
+ _encoding = new Ice.EncodingVersion();
_encoding.__read(s);
}
else
diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java
index aa675437c86..d3a8c23f27f 100644
--- a/java/src/IceInternal/UdpEndpointI.java
+++ b/java/src/IceInternal/UdpEndpointI.java
@@ -30,6 +30,7 @@ final class UdpEndpointI extends EndpointI
public
UdpEndpointI(Instance instance, String str, boolean oaEndpoint)
{
+ super(Protocol.currentProtocol, instance.defaultsAndOverrides().defaultEncoding);
_instance = instance;
_host = null;
_port = 0;
@@ -187,6 +188,7 @@ final class UdpEndpointI extends EndpointI
public
UdpEndpointI(BasicStream s)
{
+ super(new Ice.ProtocolVersion(), new Ice.EncodingVersion());
_instance = s.instance();
s.startReadEncaps();
_host = s.readString();
diff --git a/java/src/IceSSL/EndpointI.java b/java/src/IceSSL/EndpointI.java
index 8a5f29fd40a..8ccd13656fc 100644
--- a/java/src/IceSSL/EndpointI.java
+++ b/java/src/IceSSL/EndpointI.java
@@ -28,6 +28,7 @@ final class EndpointI extends IceInternal.EndpointI
public
EndpointI(Instance instance, String str, boolean oaEndpoint)
{
+ super(IceInternal.Protocol.currentProtocol, instance.defaultEncoding());
_instance = instance;
_host = null;
_port = 0;
@@ -170,6 +171,7 @@ final class EndpointI extends IceInternal.EndpointI
public
EndpointI(Instance instance, IceInternal.BasicStream s)
{
+ super(new Ice.ProtocolVersion(), new Ice.EncodingVersion());
_instance = instance;
s.startReadEncaps();
_host = s.readString();
diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java
index 8c0f5934c3a..4a8c1d3638b 100644
--- a/java/src/IceSSL/Instance.java
+++ b/java/src/IceSSL/Instance.java
@@ -647,6 +647,12 @@ class Instance
return _facade.getProtocolSupport();
}
+ Ice.EncodingVersion
+ defaultEncoding()
+ {
+ return _facade.getDefaultEncoding();
+ }
+
String
defaultHost()
{
diff --git a/java/test/Ice/info/AllTests.java b/java/test/Ice/info/AllTests.java
index 656059952e9..6a0ac187232 100644
--- a/java/test/Ice/info/AllTests.java
+++ b/java/test/Ice/info/AllTests.java
@@ -31,14 +31,17 @@ public class AllTests
out.print("testing proxy endpoint information... ");
out.flush();
{
- Ice.ObjectPrx p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" +
- "udp -h udphost -p 10001 --interface eth0 --ttl 5:" +
- "opaque -t 100 -v ABCD");
-
+ Ice.ObjectPrx p1 = communicator.stringToProxy(
+ "test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" +
+ "udp -h udphost -p 10001 --interface eth0 --ttl 5:" +
+ "opaque -e 1.8 -t 100 -v ABCD");
+
Ice.Endpoint[] endps = p1.ice_getEndpoints();
Ice.IPEndpointInfo ipEndpoint = (Ice.IPEndpointInfo)endps[0].getInfo();
+ test(ipEndpoint.protocol.equals(new Ice.ProtocolVersion((byte)1, (byte)4)));
+ test(ipEndpoint.encoding.equals(new Ice.EncodingVersion((byte)1, (byte)3)));
test(ipEndpoint.host.equals("tcphost"));
test(ipEndpoint.port == 10000);
test(ipEndpoint.timeout == 1200);
@@ -51,6 +54,8 @@ public class AllTests
ipEndpoint.type() == IceSSL.EndpointType.value && ipEndpoint instanceof IceSSL.EndpointInfo);
Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endps[1].getInfo();
+ test(udpEndpoint.protocol.equals(Ice.Util.currentProtocol()));
+ test(udpEndpoint.encoding.equals(Ice.Util.currentEncoding()));
test(udpEndpoint.host.equals("udphost"));
test(udpEndpoint.port == 10001);
test(udpEndpoint.mcastInterface.equals("eth0"));
@@ -62,6 +67,7 @@ public class AllTests
test(udpEndpoint.type() == Ice.UDPEndpointType.value);
Ice.OpaqueEndpointInfo opaqueEndpoint = (Ice.OpaqueEndpointInfo)endps[2].getInfo();
+ test(opaqueEndpoint.rawEncoding.equals(new Ice.EncodingVersion((byte)1, (byte)8)));
}
out.println("ok");
diff --git a/py/modules/IcePy/Current.cpp b/py/modules/IcePy/Current.cpp
index 865e9f8ab02..7082d2ed0f2 100644
--- a/py/modules/IcePy/Current.cpp
+++ b/py/modules/IcePy/Current.cpp
@@ -35,6 +35,7 @@ struct CurrentObject
PyObject* mode;
PyObject* ctx;
PyObject* requestId;
+ PyObject* encoding;
};
//
@@ -48,6 +49,7 @@ const Py_ssize_t CURRENT_OPERATION = 4;
const Py_ssize_t CURRENT_MODE = 5;
const Py_ssize_t CURRENT_CTX = 6;
const Py_ssize_t CURRENT_REQUEST_ID = 7;
+const Py_ssize_t CURRENT_ENCODING = 8;
}
@@ -72,6 +74,7 @@ currentNew(PyTypeObject* type, PyObject* /*args*/, PyObject* /*kwds*/)
self->mode = 0;
self->ctx = 0;
self->requestId = 0;
+ self->encoding = 0;
return self;
}
@@ -90,6 +93,7 @@ currentDealloc(CurrentObject* self)
Py_XDECREF(self->mode);
Py_XDECREF(self->ctx);
Py_XDECREF(self->requestId);
+ Py_XDECREF(self->encoding);
delete self->current;
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
@@ -223,6 +227,17 @@ currentGetter(CurrentObject* self, void* closure)
result = self->requestId;
break;
}
+ case CURRENT_ENCODING:
+ {
+ if(!self->encoding)
+ {
+ self->encoding = IcePy::createEncodingVersion(self->current->encoding);
+ assert(self->encoding);
+ }
+ Py_INCREF(self->encoding);
+ result = self->encoding;
+ break;
+ }
}
return result;
@@ -246,6 +261,8 @@ static PyGetSetDef CurrentGetSetters[] =
reinterpret_cast<void*>(CURRENT_CTX) },
{ STRCAST("requestId"), reinterpret_cast<getter>(currentGetter), 0, STRCAST("requestId"),
reinterpret_cast<void*>(CURRENT_REQUEST_ID) },
+ { STRCAST("encoding"), reinterpret_cast<getter>(currentGetter), 0, STRCAST("encoding"),
+ reinterpret_cast<void*>(CURRENT_ENCODING) },
{ 0 } /* Sentinel */
};
diff --git a/py/modules/IcePy/EndpointInfo.cpp b/py/modules/IcePy/EndpointInfo.cpp
index ae6c0750458..2af26990059 100644
--- a/py/modules/IcePy/EndpointInfo.cpp
+++ b/py/modules/IcePy/EndpointInfo.cpp
@@ -123,86 +123,60 @@ endpointInfoSecure(EndpointInfoObject* self)
extern "C"
#endif
static PyObject*
-endpointInfoGetTimeout(EndpointInfoObject* self)
-{
- return PyLong_FromLong((*self->endpointInfo)->timeout);
-}
-
-#ifdef WIN32
-extern "C"
-#endif
-static PyObject*
-endpointInfoGetCompress(EndpointInfoObject* self)
-{
- PyObject* result = (*self->endpointInfo)->compress ? getTrue() : getFalse();
- Py_INCREF(result);
- return result;
-}
-
-#ifdef WIN32
-extern "C"
-#endif
-static PyObject*
-ipEndpointInfoGetHost(EndpointInfoObject* self)
+endpointInfoGetProtocol(EndpointInfoObject* self)
{
- Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
- assert(info);
- return createString(info->host);
+ return createProtocolVersion((*self->endpointInfo)->protocol);
}
#ifdef WIN32
extern "C"
#endif
static PyObject*
-ipEndpointInfoGetPort(EndpointInfoObject* self)
+endpointInfoGetEncoding(EndpointInfoObject* self)
{
- Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
- assert(info);
- return PyLong_FromLong(info->port);
+ return createEncodingVersion((*self->endpointInfo)->encoding);
}
#ifdef WIN32
extern "C"
#endif
static PyObject*
-udpEndpointInfoGetProtocolMajor(EndpointInfoObject* self)
+endpointInfoGetTimeout(EndpointInfoObject* self)
{
- Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
- assert(info);
- return PyLong_FromLong(info->protocolMajor);
+ return PyLong_FromLong((*self->endpointInfo)->timeout);
}
#ifdef WIN32
extern "C"
#endif
static PyObject*
-udpEndpointInfoGetProtocolMinor(EndpointInfoObject* self)
+endpointInfoGetCompress(EndpointInfoObject* self)
{
- Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
- assert(info);
- return PyLong_FromLong(info->protocolMinor);
+ PyObject* result = (*self->endpointInfo)->compress ? getTrue() : getFalse();
+ Py_INCREF(result);
+ return result;
}
#ifdef WIN32
extern "C"
#endif
static PyObject*
-udpEndpointInfoGetEncodingMajor(EndpointInfoObject* self)
+ipEndpointInfoGetHost(EndpointInfoObject* self)
{
- Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
+ Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
assert(info);
- return PyLong_FromLong(info->encodingMajor);
+ return createString(info->host);
}
#ifdef WIN32
extern "C"
#endif
static PyObject*
-udpEndpointInfoGetEncodingMinor(EndpointInfoObject* self)
+ipEndpointInfoGetPort(EndpointInfoObject* self)
{
- Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
+ Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo);
assert(info);
- return PyLong_FromLong(info->encodingMinor);
+ return PyLong_FromLong(info->port);
}
#ifdef WIN32
@@ -244,6 +218,17 @@ opaqueEndpointInfoGetRawBytes(EndpointInfoObject* self)
#endif
}
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
+opaqueEndpointInfoGetRawEncoding(EndpointInfoObject* self)
+{
+ Ice::OpaqueEndpointInfoPtr info = Ice::OpaqueEndpointInfoPtr::dynamicCast(*self->endpointInfo);
+ assert(info);
+ return IcePy::createEncodingVersion(info->rawEncoding);
+}
+
static PyMethodDef EndpointInfoMethods[] =
{
{ STRCAST("type"), reinterpret_cast<PyCFunction>(endpointInfoType), METH_NOARGS,
@@ -257,6 +242,10 @@ static PyMethodDef EndpointInfoMethods[] =
static PyGetSetDef EndpointInfoGetters[] =
{
+ { STRCAST("protocol"), reinterpret_cast<getter>(endpointInfoGetProtocol), 0,
+ PyDoc_STR(STRCAST("protocol version supported by the endpoint")), 0 },
+ { STRCAST("encoding"), reinterpret_cast<getter>(endpointInfoGetEncoding), 0,
+ PyDoc_STR(STRCAST("encoding version supported by the endpoint")), 0 },
{ STRCAST("timeout"), reinterpret_cast<getter>(endpointInfoGetTimeout), 0,
PyDoc_STR(STRCAST("timeout in milliseconds")), 0 },
{ STRCAST("compress"), reinterpret_cast<getter>(endpointInfoGetCompress), 0,
@@ -275,14 +264,6 @@ static PyGetSetDef IPEndpointInfoGetters[] =
static PyGetSetDef UDPEndpointInfoGetters[] =
{
- { STRCAST("protocolMajor"), reinterpret_cast<getter>(udpEndpointInfoGetProtocolMajor), 0,
- PyDoc_STR(STRCAST("protocol major version")), 0 },
- { STRCAST("protocolMinor"), reinterpret_cast<getter>(udpEndpointInfoGetProtocolMinor), 0,
- PyDoc_STR(STRCAST("protocol minor version")), 0 },
- { STRCAST("encodingMajor"), reinterpret_cast<getter>(udpEndpointInfoGetEncodingMajor), 0,
- PyDoc_STR(STRCAST("encoding major version")), 0 },
- { STRCAST("encodingMinor"), reinterpret_cast<getter>(udpEndpointInfoGetEncodingMinor), 0,
- PyDoc_STR(STRCAST("encoding minor version")), 0 },
{ STRCAST("mcastInterface"), reinterpret_cast<getter>(udpEndpointInfoGetMcastInterface), 0,
PyDoc_STR(STRCAST("multicast interface")), 0 },
{ STRCAST("mcastTtl"), reinterpret_cast<getter>(udpEndpointInfoGetMcastTtl), 0,
@@ -294,6 +275,8 @@ static PyGetSetDef OpaqueEndpointInfoGetters[] =
{
{ STRCAST("rawBytes"), reinterpret_cast<getter>(opaqueEndpointInfoGetRawBytes), 0,
PyDoc_STR(STRCAST("raw encoding")), 0 },
+ { STRCAST("rawEncoding"), reinterpret_cast<getter>(opaqueEndpointInfoGetRawEncoding), 0,
+ PyDoc_STR(STRCAST("raw encoding version")), 0 },
{ 0, 0 } /* sentinel */
};
diff --git a/py/modules/IcePy/Init.cpp b/py/modules/IcePy/Init.cpp
index 33096000691..afcd7e59019 100644
--- a/py/modules/IcePy/Init.cpp
+++ b/py/modules/IcePy/Init.cpp
@@ -36,6 +36,20 @@ static PyMethodDef methods[] =
PyDoc_STR(STRCAST("stringVersion() -> string")) },
{ STRCAST("intVersion"), reinterpret_cast<PyCFunction>(IcePy_intVersion), METH_NOARGS,
PyDoc_STR(STRCAST("intVersion() -> int")) },
+ { STRCAST("currentProtocol"), reinterpret_cast<PyCFunction>(IcePy_currentProtocol), METH_NOARGS,
+ PyDoc_STR(STRCAST("currentProtocol() -> Ice.ProtocolVersion")) },
+ { STRCAST("currentProtocolEncoding"), reinterpret_cast<PyCFunction>(IcePy_currentProtocolEncoding), METH_NOARGS,
+ PyDoc_STR(STRCAST("currentProtocolEncoding() -> Ice.EncodingVersion")) },
+ { STRCAST("currentEncoding"), reinterpret_cast<PyCFunction>(IcePy_currentEncoding), METH_NOARGS,
+ PyDoc_STR(STRCAST("currentEncoding() -> Ice.EncodingVersion")) },
+ { STRCAST("stringToProtocolVersion"), reinterpret_cast<PyCFunction>(IcePy_stringToProtocolVersion), METH_VARARGS,
+ PyDoc_STR(STRCAST("stringToProtocolVersion(str) -> Ice.ProtocolVersion")) },
+ { STRCAST("protocolVersionToString"), reinterpret_cast<PyCFunction>(IcePy_protocolVersionToString), METH_VARARGS,
+ PyDoc_STR(STRCAST("stringToProtocolVersion(Ice.ProtocolVersion) -> string")) },
+ { STRCAST("stringToEncodingVersion"), reinterpret_cast<PyCFunction>(IcePy_stringToEncodingVersion), METH_VARARGS,
+ PyDoc_STR(STRCAST("stringToEncodingVersion(str) -> Ice.EncodingVersion")) },
+ { STRCAST("encodingVersionToString"), reinterpret_cast<PyCFunction>(IcePy_encodingVersionToString), METH_VARARGS,
+ PyDoc_STR(STRCAST("stringToEncodingVersion(Ice.EncodingVersion) -> string")) },
{ STRCAST("generateUUID"), reinterpret_cast<PyCFunction>(IcePy_generateUUID), METH_NOARGS,
PyDoc_STR(STRCAST("generateUUID() -> string")) },
{ STRCAST("createProperties"), reinterpret_cast<PyCFunction>(IcePy_createProperties), METH_VARARGS,
diff --git a/py/modules/IcePy/Operation.cpp b/py/modules/IcePy/Operation.cpp
index 9506c978d20..5c2263f2903 100644
--- a/py/modules/IcePy/Operation.cpp
+++ b/py/modules/IcePy/Operation.cpp
@@ -256,8 +256,8 @@ class Upcall : virtual public IceUtil::Shared
public:
virtual void dispatch(PyObject*, const pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&) = 0;
- virtual void response(PyObject*) = 0;
- virtual void exception(PyException&) = 0;
+ virtual void response(PyObject*, const Ice::EncodingVersion&) = 0;
+ virtual void exception(PyException&, const Ice::EncodingVersion&) = 0;
};
typedef IceUtil::Handle<Upcall> UpcallPtr;
@@ -272,8 +272,8 @@ public:
TypedUpcall(const OperationPtr&, const Ice::AMD_Object_ice_invokePtr&, const Ice::CommunicatorPtr&);
virtual void dispatch(PyObject*, const pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
- virtual void response(PyObject*);
- virtual void exception(PyException&);
+ virtual void response(PyObject*, const Ice::EncodingVersion&);
+ virtual void exception(PyException&, const Ice::EncodingVersion&);
private:
@@ -295,8 +295,8 @@ public:
BlobjectUpcall(bool, const Ice::AMD_Object_ice_invokePtr&);
virtual void dispatch(PyObject*, const pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
- virtual void response(PyObject*);
- virtual void exception(PyException&);
+ virtual void response(PyObject*, const Ice::EncodingVersion&);
+ virtual void exception(PyException&, const Ice::EncodingVersion&);
private:
@@ -354,6 +354,7 @@ struct AMDCallbackObject
{
PyObject_HEAD
UpcallPtr* upcall;
+ Ice::EncodingVersion encoding;
};
struct AsyncResultObject
@@ -673,7 +674,7 @@ amdCallbackIceResponse(AMDCallbackObject* self, PyObject* args)
try
{
assert(self->upcall);
- (*self->upcall)->response(args);
+ (*self->upcall)->response(args, self->encoding);
}
catch(...)
{
@@ -703,7 +704,7 @@ amdCallbackIceException(AMDCallbackObject* self, PyObject* args)
{
assert(self->upcall);
PyException pye(ex); // No traceback information available.
- (*self->upcall)->exception(pye);
+ (*self->upcall)->exception(pye, self->encoding);
}
catch(...)
{
@@ -1399,7 +1400,7 @@ IcePy::TypedInvocation::prepareRequest(PyObject* args, MappingType mapping, vect
// Marshal the in parameters.
//
Ice::OutputStreamPtr os = Ice::createOutputStream(_communicator);
-
+ os->startEncapsulation(_prx->ice_getEncodingVersion());
ObjectMap objectMap;
int i = 0;
for(ParamInfoList::iterator p = _op->inParams.begin(); p != _op->inParams.end(); ++p, ++i)
@@ -1431,7 +1432,7 @@ IcePy::TypedInvocation::prepareRequest(PyObject* args, MappingType mapping, vect
{
os->writePendingObjects();
}
-
+ os->endEncapsulation();
os->finished(bytes);
}
catch(const AbortMarshaling&)
@@ -1459,6 +1460,7 @@ IcePy::TypedInvocation::unmarshalResults(const pair<const Ice::Byte*, const Ice:
if(results.get() && numResults > 0)
{
Ice::InputStreamPtr is = Ice::createInputStream(_communicator, bytes);
+ is->startEncapsulation();
for(ParamInfoList::iterator p = _op->outParams.begin(); p != _op->outParams.end(); ++p, ++i)
{
void* closure = reinterpret_cast<void*>(i);
@@ -1474,6 +1476,7 @@ IcePy::TypedInvocation::unmarshalResults(const pair<const Ice::Byte*, const Ice:
{
is->readPendingObjects();
}
+ is->endEncapsulation();
}
return results.release();
@@ -1485,6 +1488,7 @@ IcePy::TypedInvocation::unmarshalException(const pair<const Ice::Byte*, const Ic
int traceSlicing = -1;
Ice::InputStreamPtr is = Ice::createInputStream(_communicator, bytes);
+ is->startEncapsulation();
bool usesClasses;
is->read(usesClasses);
@@ -3057,6 +3061,7 @@ IcePy::TypedUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*, con
Ice::InputStreamPtr is = Ice::createInputStream(_communicator, inBytes);
try
{
+ is->startEncapsulation();
Py_ssize_t i = start;
for(ParamInfoList::iterator p = _op->inParams.begin(); p != _op->inParams.end(); ++p, ++i)
{
@@ -3067,6 +3072,7 @@ IcePy::TypedUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*, con
{
is->readPendingObjects();
}
+ is->endEncapsulation();
}
catch(const AbortMarshaling&)
{
@@ -3095,6 +3101,7 @@ IcePy::TypedUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*, con
throwPythonException();
}
obj->upcall = new UpcallPtr(this);
+ obj->encoding = current.encoding;
if(PyTuple_SET_ITEM(args.get(), 0, (PyObject*)obj) < 0) // PyTuple_SET_ITEM steals a reference.
{
Py_DECREF(obj);
@@ -3126,18 +3133,18 @@ IcePy::TypedUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*, con
if(PyErr_Occurred())
{
PyException ex; // Retrieve it before another Python API call clears it.
- exception(ex);
+ exception(ex, current.encoding);
return;
}
if(!_op->amd)
{
- response(result.get());
+ response(result.get(), current.encoding);
}
}
void
-IcePy::TypedUpcall::response(PyObject* args)
+IcePy::TypedUpcall::response(PyObject* args, const Ice::EncodingVersion& encoding)
{
if(_finished)
{
@@ -3173,6 +3180,7 @@ IcePy::TypedUpcall::response(PyObject* args)
}
}
+ os->startEncapsulation(encoding);
ObjectMap objectMap;
for(ParamInfoList::iterator p = _op->outParams.begin(); p != _op->outParams.end(); ++p, ++i)
@@ -3229,6 +3237,8 @@ IcePy::TypedUpcall::response(PyObject* args)
os->writePendingObjects();
}
+ os->endEncapsulation();
+
Ice::ByteSeq bytes;
os->finished(bytes);
pair<const Ice::Byte*, const Ice::Byte*> ob(static_cast<const Ice::Byte*>(0),
@@ -3255,7 +3265,7 @@ IcePy::TypedUpcall::response(PyObject* args)
}
void
-IcePy::TypedUpcall::exception(PyException& ex)
+IcePy::TypedUpcall::exception(PyException& ex, const Ice::EncodingVersion& encoding)
{
if(_finished)
{
@@ -3298,7 +3308,7 @@ IcePy::TypedUpcall::exception(PyException& ex)
else
{
Ice::OutputStreamPtr os = Ice::createOutputStream(_communicator);
-
+ os->startEncapsulation(encoding);
os->write(info->usesClasses);
ObjectMap objectMap;
@@ -3308,7 +3318,7 @@ IcePy::TypedUpcall::exception(PyException& ex)
{
os->writePendingObjects();
}
-
+ os->endEncapsulation();
Ice::ByteSeq bytes;
os->finished(bytes);
pair<const Ice::Byte*, const Ice::Byte*> ob(static_cast<const Ice::Byte*>(0),
@@ -3457,6 +3467,7 @@ IcePy::BlobjectUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*,
throwPythonException();
}
obj->upcall = new UpcallPtr(this);
+ obj->encoding = current.encoding;
if(PyTuple_SET_ITEM(args.get(), 0, (PyObject*)obj) < 0) // PyTuple_SET_ITEM steals a reference.
{
Py_DECREF(obj);
@@ -3488,18 +3499,18 @@ IcePy::BlobjectUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*,
if(PyErr_Occurred())
{
PyException ex; // Retrieve it before another Python API call clears it.
- exception(ex);
+ exception(ex, current.encoding);
return;
}
if(!_amd)
{
- response(result.get());
+ response(result.get(), current.encoding);
}
}
void
-IcePy::BlobjectUpcall::response(PyObject* args)
+IcePy::BlobjectUpcall::response(PyObject* args, const Ice::EncodingVersion&)
{
if(_finished)
{
@@ -3572,7 +3583,7 @@ IcePy::BlobjectUpcall::response(PyObject* args)
}
void
-IcePy::BlobjectUpcall::exception(PyException& ex)
+IcePy::BlobjectUpcall::exception(PyException& ex, const Ice::EncodingVersion&)
{
if(_finished)
{
diff --git a/py/modules/IcePy/Proxy.cpp b/py/modules/IcePy/Proxy.cpp
index 110dee1f30d..da53698dbc7 100644
--- a/py/modules/IcePy/Proxy.cpp
+++ b/py/modules/IcePy/Proxy.cpp
@@ -1014,6 +1014,62 @@ proxyIceSecure(ProxyObject* self, PyObject* args)
return createProxy(newProxy, *self->communicator, reinterpret_cast<PyObject*>(Py_TYPE(self)));
}
+
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
+proxyIceGetEncodingVersion(ProxyObject* self)
+{
+ PyObject* cls = lookupType("Ice.EncodingVersion");
+ assert(cls);
+
+ assert(self->proxy);
+
+ PyObject* version;
+ try
+ {
+ version = IcePy::createEncodingVersion((*self->proxy)->ice_getEncodingVersion());
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+
+ Py_INCREF(version);
+ return version;
+}
+
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
+proxyIceEncodingVersion(ProxyObject* self, PyObject* args)
+{
+ Ice::EncodingVersion val;
+ if(!getEncodingVersion(args, val))
+ {
+ PyErr_Format(PyExc_ValueError, STRCAST("ice_encodingVersion requires an encoding version"));
+ return 0;
+ }
+
+ assert(self->proxy);
+
+ Ice::ObjectPrx newProxy;
+ try
+ {
+ newProxy = (*self->proxy)->ice_encodingVersion(val);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+
+ return createProxy(newProxy, *self->communicator, reinterpret_cast<PyObject*>(Py_TYPE(self)));
+}
+
#ifdef WIN32
extern "C"
#endif
@@ -2198,6 +2254,10 @@ static PyMethodDef ProxyMethods[] =
PyDoc_STR(STRCAST("ice_isSecure() -> bool")) },
{ STRCAST("ice_secure"), reinterpret_cast<PyCFunction>(proxyIceSecure), METH_VARARGS,
PyDoc_STR(STRCAST("ice_secure(bool) -> Ice.ObjectPrx")) },
+ { STRCAST("ice_getEncodingVersion"), reinterpret_cast<PyCFunction>(proxyIceGetEncodingVersion), METH_NOARGS,
+ PyDoc_STR(STRCAST("ice_getEncodingVersion() -> Ice.EncodingVersion")) },
+ { STRCAST("ice_encodingVersion"), reinterpret_cast<PyCFunction>(proxyIceEncodingVersion), METH_VARARGS,
+ PyDoc_STR(STRCAST("ice_endpointSelection(Ice.EncodingVersion) -> Ice.ObjectPrx")) },
{ STRCAST("ice_isPreferSecure"), reinterpret_cast<PyCFunction>(proxyIceIsPreferSecure), METH_NOARGS,
PyDoc_STR(STRCAST("ice_isPreferSecure() -> bool")) },
{ STRCAST("ice_preferSecure"), reinterpret_cast<PyCFunction>(proxyIcePreferSecure), METH_VARARGS,
diff --git a/py/modules/IcePy/Util.cpp b/py/modules/IcePy/Util.cpp
index dafe4057ff7..837ed1e3b71 100644
--- a/py/modules/IcePy/Util.cpp
+++ b/py/modules/IcePy/Util.cpp
@@ -21,6 +21,150 @@
using namespace std;
using namespace Slice::Python;
+namespace IcePy
+{
+
+bool
+checkIsInstance(PyObject* p, const char* type)
+{
+ PyObject* pyType = lookupType(type);
+ return PyObject_IsInstance(p, pyType) == 1;
+}
+
+template<typename T, const char* PT> bool
+setVersion(PyObject* p, const T& version)
+{
+ assert(checkIsInstance(p, PT));
+
+ PyObjectHandle major = PyInt_FromLong(version.major);
+ PyObjectHandle minor = PyInt_FromLong(version.minor);
+ if(!major.get() || !minor.get())
+ {
+ return false;
+ }
+ if(PyObject_SetAttrString(p, STRCAST("major"), major.get()) < 0 ||
+ PyObject_SetAttrString(p, STRCAST("minor"), minor.get()) < 0)
+ {
+ return false;
+ }
+ return true;
+}
+
+template<typename T, const char* PT> bool
+getVersion(PyObject* p, T& v)
+{
+ assert(checkIsInstance(p, PT));
+ PyObjectHandle major = PyObject_GetAttrString(p, STRCAST("major"));
+ PyObjectHandle minor = PyObject_GetAttrString(p, STRCAST("minor"));
+ if(major.get())
+ {
+ if(!PyInt_Check(major.get()))
+ {
+ PyErr_Format(PyExc_ValueError, STRCAST("version major must be a numeric value"));
+ return false;
+ }
+ int m = PyInt_AsLong(major.get());
+ if(m < 0 || m > 255)
+ {
+ PyErr_Format(PyExc_ValueError, STRCAST("version major must be a value between 0 and 255"));
+ return false;
+ }
+ v.major = static_cast<Ice::Byte>(m);
+ }
+ if(minor.get())
+ {
+ if(!PyInt_Check(minor.get()))
+ {
+ PyErr_Format(PyExc_ValueError, STRCAST("version minor must be a numeric value"));
+ return false;
+ }
+ int m = PyInt_AsLong(minor.get());
+ if(m < 0 || m > 255)
+ {
+ PyErr_Format(PyExc_ValueError, STRCAST("version minor must be a value between 0 and 255"));
+ return false;
+ }
+ v.minor = static_cast<Ice::Byte>(m);
+ }
+ return true;
+}
+
+template<typename T, const char* PT> PyObject*
+createVersion(const T& version)
+{
+ PyObject* versionType = lookupType(PT);
+
+ PyObjectHandle obj = PyObject_CallObject(versionType, 0);
+ if(!obj.get())
+ {
+ return 0;
+ }
+
+ if(!setVersion<T, PT>(obj.get(), version))
+ {
+ return 0;
+ }
+
+ return obj.release();
+}
+
+template<typename T, const char* PT> PyObject*
+versionToString(PyObject* args)
+{
+ PyObject* versionType = IcePy::lookupType(PT);
+ PyObject* p;
+ if(!PyArg_ParseTuple(args, STRCAST("O!"), versionType, &p))
+ {
+ return NULL;
+ }
+
+ T v;
+ if(!getVersion<T, PT>(p, v))
+ {
+ return NULL;
+ }
+
+ string s;
+ try
+ {
+ s = IceInternal::versionToString<T>(v);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ IcePy::setPythonException(ex);
+ return NULL;
+ }
+ return PyString_FromString(const_cast<char*>(s.c_str()));
+}
+
+template<typename T, const char* PT> PyObject*
+stringToVersion(PyObject* args)
+{
+ char* str;
+ if(!PyArg_ParseTuple(args, STRCAST("s"), &str))
+ {
+ return NULL;
+ }
+
+ T v;
+ try
+ {
+ v = IceInternal::stringToVersion<T>(str);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ IcePy::setPythonException(ex);
+ return NULL;
+ }
+
+ return createVersion<T, PT>(v);
+}
+
+char Ice_ProtocolVersion[] = "Ice.ProtocolVersion";
+char Ice_EncodingVersion[] = "Ice.EncodingVersion";
+
+}
+
string
IcePy::getString(PyObject* p)
{
@@ -666,26 +810,18 @@ convertLocalException(const Ice::LocalException& ex, PyObject* p)
catch(const Ice::UnsupportedProtocolException& e)
{
IcePy::PyObjectHandle m;
- m = PyLong_FromLong(e.badMajor);
- PyObject_SetAttrString(p, STRCAST("badMajor"), m.get());
- m = PyLong_FromLong(e.badMinor);
- PyObject_SetAttrString(p, STRCAST("badMinor"), m.get());
- m = PyLong_FromLong(e.major);
- PyObject_SetAttrString(p, STRCAST("major"), m.get());
- m = PyLong_FromLong(e.minor);
- PyObject_SetAttrString(p, STRCAST("minor"), m.get());
+ m = IcePy::createProtocolVersion(e.bad);
+ PyObject_SetAttrString(p, STRCAST("bad"), m.get());
+ m = IcePy::createProtocolVersion(e.supported);
+ PyObject_SetAttrString(p, STRCAST("supported"), m.get());
}
catch(const Ice::UnsupportedEncodingException& e)
{
IcePy::PyObjectHandle m;
- m = PyLong_FromLong(e.badMajor);
- PyObject_SetAttrString(p, STRCAST("badMajor"), m.get());
- m = PyLong_FromLong(e.badMinor);
- PyObject_SetAttrString(p, STRCAST("badMinor"), m.get());
- m = PyLong_FromLong(e.major);
- PyObject_SetAttrString(p, STRCAST("major"), m.get());
- m = PyLong_FromLong(e.minor);
- PyObject_SetAttrString(p, STRCAST("minor"), m.get());
+ m = IcePy::createEncodingVersion(e.bad);
+ PyObject_SetAttrString(p, STRCAST("bad"), m.get());
+ m = IcePy::createEncodingVersion(e.supported);
+ PyObject_SetAttrString(p, STRCAST("supported"), m.get());
}
catch(const Ice::NoObjectFactoryException& e)
{
@@ -933,6 +1069,38 @@ IcePy::getIdentity(PyObject* p, Ice::Identity& ident)
return true;
}
+PyObject*
+IcePy::createProtocolVersion(const Ice::ProtocolVersion& v)
+{
+ return createVersion<Ice::ProtocolVersion, Ice_ProtocolVersion>(v);
+}
+
+PyObject*
+IcePy::createEncodingVersion(const Ice::EncodingVersion& v)
+{
+ return createVersion<Ice::EncodingVersion, Ice_EncodingVersion>(v);
+}
+
+bool
+IcePy::getEncodingVersion(PyObject* args, Ice::EncodingVersion& v)
+{
+ PyObject* versionType = IcePy::lookupType(IcePy::Ice_EncodingVersion);
+ PyObject* p;
+ if(!PyArg_ParseTuple(args, STRCAST("O!"), versionType, &p))
+ {
+ return false;
+ }
+
+
+ if(!getVersion<Ice::EncodingVersion, IcePy::Ice_EncodingVersion>(p, v))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+
extern "C"
PyObject*
IcePy_stringVersion(PyObject* /*self*/)
@@ -950,6 +1118,51 @@ IcePy_intVersion(PyObject* /*self*/)
extern "C"
PyObject*
+IcePy_currentProtocol(PyObject* /*self*/)
+{
+ return IcePy::createProtocolVersion(Ice::currentProtocol);
+}
+
+extern "C"
+PyObject*
+IcePy_currentProtocolEncoding(PyObject* /*self*/)
+{
+ return IcePy::createEncodingVersion(Ice::currentProtocolEncoding);
+}
+
+extern "C"
+PyObject*
+IcePy_currentEncoding(PyObject* /*self*/)
+{
+ return IcePy::createEncodingVersion(Ice::currentEncoding);
+}
+
+extern "C" PyObject*
+IcePy_protocolVersionToString(PyObject* /*self*/, PyObject* args)
+{
+ return IcePy::versionToString<Ice::ProtocolVersion, IcePy::Ice_ProtocolVersion>(args);
+}
+
+extern "C" PyObject*
+IcePy_stringToProtocolVersion(PyObject* /*self*/, PyObject* args)
+{
+ return IcePy::stringToVersion<Ice::ProtocolVersion, IcePy::Ice_ProtocolVersion>(args);
+}
+
+extern "C" PyObject*
+IcePy_encodingVersionToString(PyObject* /*self*/, PyObject* args)
+{
+ return IcePy::versionToString<Ice::EncodingVersion, IcePy::Ice_EncodingVersion>(args);
+}
+
+extern "C" PyObject*
+IcePy_stringToEncodingVersion(PyObject* /*self*/, PyObject* args)
+{
+ return IcePy::stringToVersion<Ice::EncodingVersion, IcePy::Ice_EncodingVersion>(args);
+}
+
+extern "C"
+PyObject*
IcePy_generateUUID(PyObject* /*self*/)
{
string uuid = IceUtil::generateUUID();
diff --git a/py/modules/IcePy/Util.h b/py/modules/IcePy/Util.h
index eff5d97f902..fdbef73b5c8 100644
--- a/py/modules/IcePy/Util.h
+++ b/py/modules/IcePy/Util.h
@@ -233,12 +233,32 @@ bool setIdentity(PyObject*, const Ice::Identity&);
//
bool getIdentity(PyObject*, Ice::Identity&);
+//
+// Create a Python instance of Ice.ProtocolVersion.
+//
+PyObject* createProtocolVersion(const Ice::ProtocolVersion&);
+
+//
+// Create a Python instance of Ice.EncodingVersion.
+//
+PyObject* createEncodingVersion(const Ice::EncodingVersion&);
+
+//
+// Extracts the members of an encoding version
+//
+bool getEncodingVersion(PyObject*, Ice::EncodingVersion&);
+
}
extern "C" PyObject* IcePy_stringVersion(PyObject*);
extern "C" PyObject* IcePy_intVersion(PyObject*);
-extern "C" PyObject* IcePy_identityToString(PyObject*, PyObject*);
-extern "C" PyObject* IcePy_stringToIdentity(PyObject*, PyObject*);
+extern "C" PyObject* IcePy_currentProtocol(PyObject*);
+extern "C" PyObject* IcePy_currentProtocolEncoding(PyObject*);
+extern "C" PyObject* IcePy_currentEncoding(PyObject*);
+extern "C" PyObject* IcePy_protocolVersionToString(PyObject*, PyObject*);
+extern "C" PyObject* IcePy_stringToProtocolVersion(PyObject*, PyObject*);
+extern "C" PyObject* IcePy_encodingVersionToString(PyObject*, PyObject*);
+extern "C" PyObject* IcePy_stringToEncodingVersion(PyObject*, PyObject*);
extern "C" PyObject* IcePy_generateUUID(PyObject*);
#endif
diff --git a/py/python/Ice.py b/py/python/Ice.py
index be703c05255..38554d15fae 100644
--- a/py/python/Ice.py
+++ b/py/python/Ice.py
@@ -58,6 +58,13 @@ if _dlopenflags >= 0:
ObjectPrx = IcePy.ObjectPrx
stringVersion = IcePy.stringVersion
intVersion = IcePy.intVersion
+currentProtocol = IcePy.currentProtocol
+currentProtocolEncoding = IcePy.currentProtocolEncoding
+currentEncoding = IcePy.currentEncoding
+stringToProtocolVersion = IcePy.stringToProtocolVersion
+protocolVersionToString = IcePy.protocolVersionToString
+stringToEncodingVersion = IcePy.stringToEncodingVersion
+encodingVersionToString = IcePy.encodingVersionToString
generateUUID = IcePy.generateUUID
loadSlice = IcePy.loadSlice
AsyncResult = IcePy.AsyncResult
@@ -310,6 +317,7 @@ import Ice_Properties_ice
import Ice_Router_ice
import Ice_ServantLocator_ice
import Ice_Connection_ice
+import Ice_Version_ice
#
# Replace EndpointInfo with our implementation.
@@ -1381,3 +1389,8 @@ def getType(o):
#
def getHash(o):
return hash(o)
+
+Protocol_1_0 = ProtocolVersion(1, 0)
+Encoding_1_0 = EncodingVersion(1, 0)
+Encoding_1_1 = EncodingVersion(1, 1)
+
diff --git a/py/python/Makefile b/py/python/Makefile
index 19629214cc1..b1a4b15d036 100644
--- a/py/python/Makefile
+++ b/py/python/Makefile
@@ -51,7 +51,8 @@ ICE_SRCS = Ice_LocalException_ice.py \
Ice_SliceChecksumDict_ice.py \
Ice_Endpoint_ice.py \
Ice_EndpointF_ice.py \
- Ice_EndpointTypes_ice.py
+ Ice_EndpointTypes_ice.py \
+ Ice_Version_ice.py
GLACIER2_SRCS = Glacier2_RouterF_ice.py \
Glacier2_Router_ice.py \
diff --git a/py/test/Ice/info/AllTests.py b/py/test/Ice/info/AllTests.py
index 78e7d397dd5..012e2f09416 100644
--- a/py/test/Ice/info/AllTests.py
+++ b/py/test/Ice/info/AllTests.py
@@ -17,14 +17,16 @@ def allTests(communicator, collocated):
sys.stdout.write("testing proxy endpoint information... ")
sys.stdout.flush()
- p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" + \
+ p1 = communicator.stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" + \
"udp -h udphost -p 10001 --interface eth0 --ttl 5:" + \
- "opaque -t 100 -v ABCD")
+ "opaque -e 1.8 -t 100 -v ABCD")
endps = p1.ice_getEndpoints()
ipEndpoint = endps[0].getInfo()
test(isinstance(ipEndpoint, Ice.IPEndpointInfo))
+ test(ipEndpoint.protocol == Ice.ProtocolVersion(1, 4))
+ test(ipEndpoint.encoding == Ice.EncodingVersion(1, 3))
test(ipEndpoint.host == "tcphost")
test(ipEndpoint.port == 10000)
test(ipEndpoint.timeout == 1200)
@@ -37,6 +39,8 @@ def allTests(communicator, collocated):
udpEndpoint = endps[1].getInfo()
test(isinstance(udpEndpoint, Ice.UDPEndpointInfo))
+ test(udpEndpoint.protocol == Ice.currentProtocol())
+ test(udpEndpoint.encoding == Ice.currentEncoding())
test(udpEndpoint.host == "udphost")
test(udpEndpoint.port == 10001)
test(udpEndpoint.mcastInterface == "eth0")
@@ -49,6 +53,7 @@ def allTests(communicator, collocated):
opaqueEndpoint = endps[2].getInfo()
test(isinstance(opaqueEndpoint, Ice.OpaqueEndpointInfo))
+ test(opaqueEndpoint.rawEncoding == Ice.EncodingVersion(1, 8))
print("ok")
diff --git a/py/test/Ice/proxy/AllTests.py b/py/test/Ice/proxy/AllTests.py
index c971ad9b6de..da1db1f2324 100644
--- a/py/test/Ice/proxy/AllTests.py
+++ b/py/test/Ice/proxy/AllTests.py
@@ -285,6 +285,26 @@ def allTests(communicator, collocated):
#test(not b1.ice_isCollocationOptimized())
#prop.setProperty(property, "")
+ property = propertyPrefix + ".EncodingVersion"
+ test(b1.ice_getEncodingVersion() == Ice.currentEncoding())
+ prop.setProperty(property, "1.0")
+ b1 = communicator.propertyToProxy(propertyPrefix)
+ test(b1.ice_getEncodingVersion().major == 1 and b1.ice_getEncodingVersion().minor == 0)
+ prop.setProperty(property, "6.5")
+ try:
+ communicator.propertyToProxy(propertyPrefix)
+ test(false)
+ except Ice.UnsupportedEncodingException:
+ pass
+
+ prop.setProperty(property, "1.2")
+ try :
+ communicator.propertyToProxy(propertyPrefix)
+ test(false)
+ except Ice.UnsupportedEncodingException:
+ pass
+ prop.setProperty(property, "")
+
print("ok")
sys.stdout.write("testing proxyToProperty... ")
@@ -296,6 +316,7 @@ def allTests(communicator, collocated):
b1 = b1.ice_preferSecure(False)
b1 = b1.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)
b1 = b1.ice_locatorCacheTimeout(100)
+ b1 = b1.ice_encodingVersion(Ice.EncodingVersion(1, 0))
router = communicator.stringToProxy("router")
#router = router.ice_collocationOptimized(false)
@@ -315,10 +336,11 @@ def allTests(communicator, collocated):
b1 = b1.ice_locator(Ice.LocatorPrx.uncheckedCast(locator))
proxyProps = communicator.proxyToProperty(b1, "Test")
- test(len(proxyProps) == 18)
+ test(len(proxyProps) == 21)
test(proxyProps["Test"] == "test -t")
#test(proxyProps["Test.CollocationOptimized"] == "1")
+ test(proxyProps["Test.EncodingVersion"] == "1.0");
test(proxyProps["Test.ConnectionCached"] == "1")
test(proxyProps["Test.PreferSecure"] == "0")
test(proxyProps["Test.EndpointSelection"] == "Ordered")
@@ -326,18 +348,26 @@ def allTests(communicator, collocated):
test(proxyProps["Test.Locator"] == "locator -t")
#test(proxyProps["Test.Locator.CollocationOptimized"] == "1")
+ test(proxyProps["Test.Locator.EncodingVersion"] == Ice.encodingVersionToString(Ice.currentEncoding()));
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.Router"] == "router -t")
+ test(proxyProps["Test.Locator.Router.EncodingVersion"] == 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")
+ try:
+ b1.ice_encodingVersion(Ice.EncodingVersion(3, 4));
+ test(false);
+ except Ice.UnsupportedEncodingException:
+ pass
+
print("ok")
sys.stdout.write("testing ice_getCommunicator... ")
@@ -364,6 +394,9 @@ def allTests(communicator, collocated):
#test(!base.ice_collocationOptimized(false)->ice_isCollocationOptimized())
test(base.ice_preferSecure(True).ice_isPreferSecure())
test(not 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);
print("ok")
sys.stdout.write("testing proxy comparison... ")
@@ -498,6 +531,11 @@ def allTests(communicator, collocated):
test(not (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(not (compObj.ice_encodingVersion(Ice.Encoding_1_1) < compObj.ice_encodingVersion(Ice.Encoding_1_0)));
+
#
# TODO: Ideally we should also test comparison of fixed proxies.
#
@@ -625,18 +663,26 @@ def allTests(communicator, collocated):
pass
# Legal TCP endpoint expressed as opaque endpoint
- p1 = communicator.stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==")
+ p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==")
pstr = communicator.proxyToString(p1)
test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000")
+ # 1.1 TCP endpoint encoded with 1.1 encoding.
+ p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE=");
+ test(communicator.proxyToString(p2) == "test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000");
+
+ # 1.0 TCP endpoint encoded with 1.1 encoding.
+ p2 = communicator.stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA=");
+ test(communicator.proxyToString(p2) == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000");
+
if communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0:
# Working?
ssl = communicator.getProperties().getProperty("Ice.Default.Protocol") == "ssl"
if not ssl:
- p1.ice_ping()
+ p1.ice_encodingVersion(Ice.Encoding_1_0).ice_ping()
# Two legal TCP endpoints expressed as opaque endpoints
- p1 = communicator.stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==")
+ p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==")
pstr = communicator.proxyToString(p1)
test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000")
@@ -644,10 +690,10 @@ def allTests(communicator, collocated):
# Test that an SSL endpoint and a nonsense endpoint get written
# back out as an opaque endpoint.
#
- p1 = communicator.stringToProxy("test:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch")
+ p1 = communicator.stringToProxy("test:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch")
pstr = communicator.proxyToString(p1)
if not ssl:
- test(pstr == "test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch")
+ test(pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch")
else:
test(pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -v abch")
@@ -657,7 +703,7 @@ def allTests(communicator, collocated):
# running with SSL).
#
try:
- p1.ice_ping()
+ p1.ice_encodingVersion(Ice.Encoding_1_0).ice_ping()
test(False)
except Ice.NoEndpointException:
test(not ssl)
@@ -673,9 +719,9 @@ def allTests(communicator, collocated):
p2 = derived.echo(p1)
pstr = communicator.proxyToString(p2)
if not ssl:
- test(pstr == "test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch")
+ test(pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch")
else:
- test(pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -v abch")
+ test(pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch")
print("ok")