summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2007-05-10 05:09:05 +0000
committerMichi Henning <michi@zeroc.com>2007-05-10 05:09:05 +0000
commit9cb97bc06da9fdf7e63d167ea5855ad5d5fbfe9c (patch)
tree7b1fecab8ebe32a9e2e8c3c32a90e9643a4bebf7 /java/test
parentFixed misplaced assignment to _rawBytes. (diff)
downloadice-9cb97bc06da9fdf7e63d167ea5855ad5d5fbfe9c.tar.bz2
ice-9cb97bc06da9fdf7e63d167ea5855ad5d5fbfe9c.tar.xz
ice-9cb97bc06da9fdf7e63d167ea5855ad5d5fbfe9c.zip
Bug 1022.
Diffstat (limited to 'java/test')
-rw-r--r--java/test/Ice/proxy/AllTests.java149
-rw-r--r--java/test/Ice/proxy/MyDerivedClassI.java6
-rw-r--r--java/test/Ice/proxy/Test.ice3
-rw-r--r--java/test/Ice/proxyAMD/MyDerivedClassI.java8
-rw-r--r--java/test/Ice/proxyAMD/TestAMD.ice1
5 files changed, 166 insertions, 1 deletions
diff --git a/java/test/Ice/proxy/AllTests.java b/java/test/Ice/proxy/AllTests.java
index 5b6b39c1759..95bfc475ec9 100644
--- a/java/test/Ice/proxy/AllTests.java
+++ b/java/test/Ice/proxy/AllTests.java
@@ -424,6 +424,155 @@ public class AllTests
test(c.equals(c2));
System.out.println("ok");
+ System.out.print("testing opaque endpoints... ");
+ System.out.flush();
+
+ try
+ {
+ // Invalid -x option
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t 99 -v abc -x abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing -t and -v
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Repeated -t
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t 1 -t 1 -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Repeated -v
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t 1 -v abc -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing -t
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing -v
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t 1");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing arg for -t
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing arg for -v
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t 1 -v");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Not a number for -t
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t x -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // < 0 for -t
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t -1 -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Invalid char for -v
+ Ice.ObjectPrx p = communicator.stringToProxy("id:opaque -t 99 -v x?c");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ // Legal TCP endpoint expressed as opaque endpoint
+ Ice.ObjectPrx p1 = communicator.stringToProxy("test:opaque -t 1 -v AOouAAAQJwAAAA==");
+ String pstr = communicator.proxyToString(p1);
+ test(pstr.equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"));
+
+ // Working?
+ p1.ice_ping();
+
+ // Two legal TCP endpoints expressed as opaque endpoints
+ p1 = communicator.stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
+ pstr = communicator.proxyToString(p1);
+ test(pstr.equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"));
+
+ // Test that an SSL endpoint and a nonsense endpoint get written back out as an opaque endpoint.
+ p1 = communicator.stringToProxy("test:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch");
+ pstr = communicator.proxyToString(p1);
+ test(pstr.equals("test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"));
+
+ // Try to invoke on the SSL endpoint to verify that we get a NoEndpointException.
+ try
+ {
+ p1.ice_ping();
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+
+ // Test that the proxy with an SSL endpoint and a nonsense endpoint (which the server doesn't understand either)
+ // can be sent over the wire and returned by the server without losing the opaque endpoints.
+ Ice.ObjectPrx p2 = derived.echo(p1);
+ pstr = communicator.proxyToString(p2);
+ test(pstr.equals("test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"));
+
+ System.out.println("ok");
+
return cl;
}
}
diff --git a/java/test/Ice/proxy/MyDerivedClassI.java b/java/test/Ice/proxy/MyDerivedClassI.java
index db4084975cf..7ee5de382bf 100644
--- a/java/test/Ice/proxy/MyDerivedClassI.java
+++ b/java/test/Ice/proxy/MyDerivedClassI.java
@@ -14,6 +14,12 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
{
}
+ public Ice.ObjectPrx
+ echo(Ice.ObjectPrx obj, Ice.Current c)
+ {
+ return obj;
+ }
+
public void
shutdown(Ice.Current c)
{
diff --git a/java/test/Ice/proxy/Test.ice b/java/test/Ice/proxy/Test.ice
index ee3b6bdb724..75b0b29d993 100644
--- a/java/test/Ice/proxy/Test.ice
+++ b/java/test/Ice/proxy/Test.ice
@@ -22,8 +22,9 @@ module Test
Ice::Context getContext();
};
-["ami"] class MyDerivedClass extends MyClass
+class MyDerivedClass extends MyClass
{
+ Object* echo(Object* obj);
};
};
diff --git a/java/test/Ice/proxyAMD/MyDerivedClassI.java b/java/test/Ice/proxyAMD/MyDerivedClassI.java
index bd1a1314abc..20d45b4aaed 100644
--- a/java/test/Ice/proxyAMD/MyDerivedClassI.java
+++ b/java/test/Ice/proxyAMD/MyDerivedClassI.java
@@ -15,6 +15,14 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
}
public void
+ echo_async(Test.AMD_MyDerivedClass_echo cb,
+ Ice.ObjectPrx obj,
+ Ice.Current c)
+ {
+ cb.ice_response(obj);
+ }
+
+ public void
shutdown_async(Test.AMD_MyClass_shutdown cb,
Ice.Current c)
{
diff --git a/java/test/Ice/proxyAMD/TestAMD.ice b/java/test/Ice/proxyAMD/TestAMD.ice
index 6ffe76a4597..f75c96d6d46 100644
--- a/java/test/Ice/proxyAMD/TestAMD.ice
+++ b/java/test/Ice/proxyAMD/TestAMD.ice
@@ -24,6 +24,7 @@ module Test
["ami", "amd"] class MyDerivedClass extends MyClass
{
+ Object* echo(Object* obj);
};
};