summaryrefslogtreecommitdiff
path: root/java/test/Ice/ami
diff options
context:
space:
mode:
Diffstat (limited to 'java/test/Ice/ami')
-rw-r--r--java/test/Ice/ami/AMI.java127
-rw-r--r--java/test/Ice/ami/AllTests.java18
-rw-r--r--java/test/Ice/ami/Client.java2
-rw-r--r--java/test/Ice/ami/Collocated.java2
-rw-r--r--java/test/Ice/ami/lambda/AMI.java117
5 files changed, 218 insertions, 48 deletions
diff --git a/java/test/Ice/ami/AMI.java b/java/test/Ice/ami/AMI.java
index 67c6920d142..aa3f9c9b328 100644
--- a/java/test/Ice/ami/AMI.java
+++ b/java/test/Ice/ami/AMI.java
@@ -100,6 +100,13 @@ public class AMI
}
public void
+ connection(Ice.AsyncResult result)
+ {
+ test(result.getProxy().end_ice_getConnection(result) != null);
+ called();
+ }
+
+ public void
op(Ice.AsyncResult result)
{
TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result);
@@ -204,6 +211,24 @@ public class AMI
}
public void
+ connectionEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_getConnection(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
opEx(Ice.AsyncResult result)
{
try
@@ -256,6 +281,13 @@ public class AMI
}
public void
+ connection(Ice.Connection conn)
+ {
+ test(conn != null);
+ called();
+ }
+
+ public void
op()
{
called();
@@ -317,6 +349,12 @@ public class AMI
}
public void
+ connection(Ice.Connection conn)
+ {
+ test(false);
+ }
+
+ public void
op()
{
test(false);
@@ -548,11 +586,12 @@ public class AMI
}
public static void
- run(Application app, Ice.Communicator communicator, TestIntfPrx p, TestIntfControllerPrx testController)
+ run(Application app, Ice.Communicator communicator, boolean collocated, TestIntfPrx p,
+ TestIntfControllerPrx testController)
{
-
+
PrintWriter out = app.getWriter();
-
+
out.print("testing begin/end invocation... ");
out.flush();
{
@@ -579,6 +618,12 @@ public class AMI
result = p.begin_ice_ids(ctx);
test(p.end_ice_ids(result).length == 2);
+ if(!collocated)
+ {
+ result = p.begin_ice_getConnection();
+ test(p.end_ice_getConnection(result) != null);
+ }
+
result = p.begin_op();
p.end_op(result);
result = p.begin_op(ctx);
@@ -701,6 +746,20 @@ public class AMI
});
cb.check();
+ if(!collocated)
+ {
+ p.begin_ice_getConnection(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.connection(r);
+ }
+ });
+ cb.check();
+ }
+
p.begin_op(new Ice.Callback()
{
@Override
@@ -912,6 +971,27 @@ public class AMI
});
cb.check();
+ if(!collocated)
+ {
+ p.begin_ice_getConnection(new Ice.Callback_Object_ice_getConnection()
+ {
+ @Override
+ public void
+ response(Ice.Connection conn)
+ {
+ cb.connection(conn);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ }
+
p.begin_op(new Callback_TestIntf_op()
{
@Override
@@ -1131,6 +1211,20 @@ public class AMI
});
cb.check();
+ if(!collocated)
+ {
+ i.begin_ice_getConnection(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.connectionEx(r);
+ }
+ });
+ cb.check();
+ }
+
i.begin_op(new Ice.Callback()
{
@Override
@@ -1222,6 +1316,27 @@ public class AMI
});
cb.check();
+ if(!collocated)
+ {
+ i.begin_ice_getConnection(new Ice.Callback_Object_ice_getConnection()
+ {
+ @Override
+ public void
+ response(Ice.Connection conn)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+ }
+
i.begin_op(new Callback_TestIntf_op()
{
@Override
@@ -2198,7 +2313,7 @@ public class AMI
{
test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() ||
!r1.sentSynchronously() && !r1.isCompleted());
-
+
test(!r2.sentSynchronously() && !r2.isCompleted());
}
}
@@ -2298,9 +2413,9 @@ public class AMI
//
// Send multiple opWithPayload, followed by a close and followed by multiple opWithPaylod.
- // The goal is to make sure that none of the opWithPayload fail even if the server closes
+ // The goal is to make sure that none of the opWithPayload fail even if the server closes
// the connection gracefully in between.
- //
+ //
int maxQueue = 2;
boolean done = false;
while(!done && maxQueue < 50)
diff --git a/java/test/Ice/ami/AllTests.java b/java/test/Ice/ami/AllTests.java
index 8e98a2e7667..ffe95450b2c 100644
--- a/java/test/Ice/ami/AllTests.java
+++ b/java/test/Ice/ami/AllTests.java
@@ -27,9 +27,9 @@ public class AllTests
throw new RuntimeException();
}
}
-
+
public static void
- allTests(Application app)
+ allTests(Application app, boolean collocated)
{
Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
@@ -47,22 +47,22 @@ public class AllTests
TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
out.println("testing with new AMI mapping... ");
- test.Ice.ami.AMI.run(app, communicator, p, testController);
-
+ test.Ice.ami.AMI.run(app, communicator, collocated, p, testController);
+
//
// Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
- //
+ //
try
{
Class<?> cls = IceInternal.Util.findClass("test.Ice.ami.lambda.AMI", null);
if(cls != null)
{
- java.lang.reflect.Method run = cls.getDeclaredMethod("run",
- new Class<?>[]{test.Util.Application.class, Ice.Communicator.class, TestIntfPrx.class,
+ java.lang.reflect.Method run = cls.getDeclaredMethod("run",
+ new Class<?>[]{test.Util.Application.class, Ice.Communicator.class, boolean.class, TestIntfPrx.class,
TestIntfControllerPrx.class});
out.println("testing with lambda AMI mapping... ");
out.flush();
- run.invoke(null, app, communicator, p, testController);
+ run.invoke(null, app, communicator, collocated, p, testController);
}
}
catch(java.lang.NoSuchMethodException ex)
@@ -77,7 +77,7 @@ public class AllTests
{
throw new RuntimeException(ex);
}
-
+
p.shutdown();
}
}
diff --git a/java/test/Ice/ami/Client.java b/java/test/Ice/ami/Client.java
index e95e0e9bfb6..3e547a17ec0 100644
--- a/java/test/Ice/ami/Client.java
+++ b/java/test/Ice/ami/Client.java
@@ -14,7 +14,7 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- AllTests.allTests(this);
+ AllTests.allTests(this, false);
return 0;
}
diff --git a/java/test/Ice/ami/Collocated.java b/java/test/Ice/ami/Collocated.java
index 765c8944413..3385facc305 100644
--- a/java/test/Ice/ami/Collocated.java
+++ b/java/test/Ice/ami/Collocated.java
@@ -22,7 +22,7 @@ public class Collocated extends test.Util.Application
adapter2.add(new TestControllerI(adapter), communicator().stringToIdentity("testController"));
adapter2.activate();
- AllTests.allTests(this);
+ AllTests.allTests(this, true);
return 0;
}
diff --git a/java/test/Ice/ami/lambda/AMI.java b/java/test/Ice/ami/lambda/AMI.java
index b89a51ae0f5..0e013b97435 100644
--- a/java/test/Ice/ami/lambda/AMI.java
+++ b/java/test/Ice/ami/lambda/AMI.java
@@ -101,6 +101,13 @@ public class AMI
}
public void
+ connection(Ice.AsyncResult result)
+ {
+ test(result.getProxy().end_ice_getConnection(result) != null);
+ called();
+ }
+
+ public void
op(Ice.AsyncResult result)
{
TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result);
@@ -205,6 +212,24 @@ public class AMI
}
public void
+ connectionEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_getConnection(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.Exception ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
opEx(Ice.AsyncResult result)
{
try
@@ -257,6 +282,13 @@ public class AMI
}
public void
+ connection(Ice.Connection conn)
+ {
+ test(conn != null);
+ called();
+ }
+
+ public void
op()
{
called();
@@ -318,6 +350,12 @@ public class AMI
}
public void
+ connection(Ice.Connection conn)
+ {
+ test(false);
+ }
+
+ public void
op()
{
test(false);
@@ -549,9 +587,10 @@ public class AMI
}
public static void
- run(Application app, Ice.Communicator communicator, TestIntfPrx p, TestIntfControllerPrx testController)
+ run(Application app, Ice.Communicator communicator, boolean collocated, TestIntfPrx p,
+ TestIntfControllerPrx testController)
{
-
+
PrintWriter out = app.getWriter();
out.print("testing response callback... ");
@@ -560,12 +599,12 @@ public class AMI
final ResponseCallback cb = new ResponseCallback();
java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
- p.begin_ice_isA("::Test::TestIntf",
+ p.begin_ice_isA("::Test::TestIntf",
(boolean r) -> cb.isA(r),
(Ice.Exception ex) -> test(false));
cb.check();
-
- p.begin_ice_isA("::Test::TestIntf",
+
+ p.begin_ice_isA("::Test::TestIntf",
(boolean r) -> cb.isA(r),
(Ice.Exception ex) -> test(false));
cb.check();
@@ -574,8 +613,8 @@ public class AMI
() -> cb.ping(),
(Ice.Exception ex) -> test(false));
cb.check();
-
- p.begin_ice_ping(ctx,
+
+ p.begin_ice_ping(ctx,
() -> cb.ping(),
(Ice.Exception ex) -> test(false));
cb.check();
@@ -584,8 +623,8 @@ public class AMI
(String id) -> cb.id(id),
(Ice.Exception ex) -> test(false));
cb.check();
-
- p.begin_ice_id(ctx,
+
+ p.begin_ice_id(ctx,
(String id) -> cb.id(id),
(Ice.Exception ex) -> test(false));
cb.check();
@@ -594,18 +633,26 @@ public class AMI
(String[] ids) -> cb.ids(ids),
(Ice.Exception ex) -> test(false));
cb.check();
-
+
p.begin_ice_ids(ctx,
(String[] ids) -> cb.ids(ids),
(Ice.Exception ex) -> test(false));
cb.check();
+ if(!collocated)
+ {
+ p.begin_ice_getConnection(
+ (Ice.Connection conn) -> cb.connection(conn),
+ (Ice.Exception ex) -> test(false));
+ cb.check();
+ }
+
p.begin_op(
() -> cb.op(),
(Ice.Exception ex) -> test(false));
cb.check();
-
- p.begin_op(ctx,
+
+ p.begin_op(ctx,
() -> cb.op(),
(Ice.Exception ex) -> test(false));
cb.check();
@@ -614,8 +661,8 @@ public class AMI
(int r) -> cb.opWithResult(r),
(Ice.Exception ex) -> test(false));
cb.check();
-
- p.begin_opWithResult(ctx,
+
+ p.begin_opWithResult(ctx,
(int r) -> cb.opWithResult(r),
(Ice.Exception ex) -> test(false));
cb.check();
@@ -625,8 +672,8 @@ public class AMI
(Ice.UserException ex) -> cb.opWithUE(ex),
(Ice.Exception ex) -> test(false));
cb.check();
-
- p.begin_opWithUE(ctx,
+
+ p.begin_opWithUE(ctx,
() -> test(false),
(Ice.UserException ex) -> cb.opWithUE(ex),
(Ice.Exception ex) -> test(false));
@@ -640,7 +687,7 @@ public class AMI
TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
final ExceptionCallback cb = new ExceptionCallback();
- i.begin_ice_isA("::Test::TestIntf",
+ i.begin_ice_isA("::Test::TestIntf",
(boolean r) -> test(false),
(Ice.Exception ex) -> cb.ex(ex));
cb.check();
@@ -660,6 +707,14 @@ public class AMI
(Ice.Exception ex) -> cb.ex(ex));
cb.check();
+ if(!collocated)
+ {
+ i.begin_ice_getConnection(
+ (Ice.Connection conn) -> test(false),
+ (Ice.Exception ex) -> cb.ex(ex));
+ cb.check();
+ }
+
i.begin_op(
() -> test(false),
(Ice.Exception ex) -> cb.ex(ex));
@@ -672,7 +727,7 @@ public class AMI
{
final SentCallback cb = new SentCallback();
- p.begin_ice_isA("",
+ p.begin_ice_isA("",
(boolean r) -> cb.isA(r),
(Ice.Exception ex) -> cb.ex(ex),
(boolean ss) -> cb.sent(ss));
@@ -965,7 +1020,7 @@ public class AMI
}
out.println("ok");
}
-
+
out.print("testing null callbacks...");
try
{
@@ -978,27 +1033,27 @@ public class AMI
{
// Excepted when response and exception callback are both null.
}
-
+
try
{
p.begin_ice_ping(() -> {}, null);
-
+
}
catch(IllegalArgumentException ex)
{
test(false);
}
-
+
try
{
p.begin_ice_ping(null, (Ice.Exception ex) -> {});
-
+
}
catch(IllegalArgumentException ex)
{
test(false);
}
-
+
try
{
IceInternal.Functional_BoolCallback response = null;
@@ -1010,27 +1065,27 @@ public class AMI
{
// Excepted when response and exception callback are both null.
}
-
+
try
{
p.begin_ice_isA("::Test::TestIntf", (boolean v) -> {}, null);
-
+
}
catch(IllegalArgumentException ex)
{
test(false);
}
-
+
try
{
p.begin_ice_isA("::Test::TestIntf", null, (Ice.Exception ex) -> {});
-
+
}
catch(IllegalArgumentException ex)
{
test(false);
}
-
+
try
{
IceInternal.Functional_VoidCallback response = null;
@@ -1043,7 +1098,7 @@ public class AMI
// an operation that throws user exceptions both user exception callback
// an local exception callback must be present.
}
-
+
try
{
IceInternal.Functional_VoidCallback response = null;
@@ -1056,7 +1111,7 @@ public class AMI
// an operation that throws user exceptions both user exception callback
// an local exception callback must be present.
}
-
+
try
{
IceInternal.Functional_VoidCallback response = null;