summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-03-23 15:29:25 +0100
committerBenoit Foucher <benoit@zeroc.com>2017-03-23 15:29:25 +0100
commit1597a75419cd8049252cfbca6fce6ae95ef8b2c7 (patch)
tree2b2c858df1dbe68c1d576cae06c4713fd2ad5c40 /java/test
parentUse Ice\None with PHP namespace mapping (diff)
downloadice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.tar.bz2
ice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.tar.xz
ice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.zip
Fix for ICE-7125 - Added support for Ice.ClassGraphDepthMax
Diffstat (limited to 'java/test')
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/AllTests.java43
-rw-r--r--java/test/src/main/java/test/Ice/objects/AllTests.java37
-rw-r--r--java/test/src/main/java/test/Ice/objects/Collocated.java1
-rw-r--r--java/test/src/main/java/test/Ice/objects/InitialI.java11
-rw-r--r--java/test/src/main/java/test/Ice/objects/Server.java1
-rw-r--r--java/test/src/main/java/test/Ice/objects/Test.ice8
6 files changed, 85 insertions, 16 deletions
diff --git a/java/test/src/main/java/test/Ice/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/exceptions/AllTests.java
index 1cce083ca40..acfb3dc000b 100644
--- a/java/test/src/main/java/test/Ice/exceptions/AllTests.java
+++ b/java/test/src/main/java/test/Ice/exceptions/AllTests.java
@@ -438,6 +438,10 @@ public class AllTests
catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
+ catch(com.zeroc.Ice.UnknownLocalException ex)
+ {
+ // Expected with JS bidir server
+ }
catch(com.zeroc.Ice.SocketException ex)
{
// This can be raised if the connection is closed during the client's call to write().
@@ -448,24 +452,31 @@ public class AllTests
test(false);
}
- ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" +
- app.getTestEndpoint(1)));
- try
- {
- thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits)
- }
- catch(com.zeroc.Ice.MemoryLimitException ex)
- {
- }
- ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" +
- app.getTestEndpoint(2)));
try
{
- thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit
- test(false);
- }
- catch(com.zeroc.Ice.ConnectionLostException ex)
- {
+ ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" +
+ app.getTestEndpoint(1)));
+ try
+ {
+ thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits)
+ }
+ catch(com.zeroc.Ice.MemoryLimitException ex)
+ {
+ }
+ ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" +
+ app.getTestEndpoint(2)));
+ try
+ {
+ thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit
+ test(false);
+ }
+ catch(com.zeroc.Ice.ConnectionLostException ex)
+ {
+ }
+ }
+ catch(com.zeroc.Ice.ConnectionRefusedException ex)
+ {
+ // Expected with JS bidir server
}
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/objects/AllTests.java b/java/test/src/main/java/test/Ice/objects/AllTests.java
index c7b65fe7164..31dc2f69cea 100644
--- a/java/test/src/main/java/test/Ice/objects/AllTests.java
+++ b/java/test/src/main/java/test/Ice/objects/AllTests.java
@@ -27,6 +27,7 @@ import test.Ice.objects.Test.S;
import test.Ice.objects.Test.Initial;
import test.Ice.objects.Test.InitialPrx;
import test.Ice.objects.Test.J;
+import test.Ice.objects.Test.Recursive;
import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrx;
public class AllTests
@@ -241,6 +242,42 @@ public class AllTests
}
out.println("ok");
+ out.print("testing recursive type... ");
+ out.flush();
+ Recursive top = new Recursive();
+ Recursive p = top;
+ int depth = 0;
+ try
+ {
+ for(; depth <= 20000; ++depth)
+ {
+ p.v = new Recursive();
+ p = p.v;
+ if((depth < 10 && (depth % 10) == 0) ||
+ (depth < 1000 && (depth % 100) == 0) ||
+ (depth < 10000 && (depth % 1000) == 0) ||
+ (depth % 10000) == 0)
+ {
+ initial.setRecursive(top);
+ }
+ }
+ test(!initial.supportsClassGraphDepthMax());
+ }
+ catch(com.zeroc.Ice.UnknownLocalException ex)
+ {
+ // Expected marshal exception from the server (max class graph depth reached)
+ }
+ catch(com.zeroc.Ice.UnknownException ex)
+ {
+ // Expected stack overflow from the server (Java only)
+ }
+ catch(java.lang.StackOverflowError ex)
+ {
+ // Stack overflow while writing instances
+ }
+ initial.setRecursive(new Recursive());
+ out.println("ok");
+
out.print("testing compact ID...");
out.flush();
try
diff --git a/java/test/src/main/java/test/Ice/objects/Collocated.java b/java/test/src/main/java/test/Ice/objects/Collocated.java
index 44ca644bf4d..ffb62ec24e4 100644
--- a/java/test/src/main/java/test/Ice/objects/Collocated.java
+++ b/java/test/src/main/java/test/Ice/objects/Collocated.java
@@ -108,6 +108,7 @@ public class Collocated extends test.Util.Application
{
com.zeroc.Ice.InitializationData initData = super.getInitData(args, rArgs);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
return initData;
}
diff --git a/java/test/src/main/java/test/Ice/objects/InitialI.java b/java/test/src/main/java/test/Ice/objects/InitialI.java
index 8b0876bc4c6..fe879cf5276 100644
--- a/java/test/src/main/java/test/Ice/objects/InitialI.java
+++ b/java/test/src/main/java/test/Ice/objects/InitialI.java
@@ -106,6 +106,17 @@ public final class InitialI implements Initial
}
@Override
+ public void setRecursive(Recursive r, com.zeroc.Ice.Current current)
+ {
+ }
+
+ @Override
+ public boolean supportsClassGraphDepthMax(com.zeroc.Ice.Current current)
+ {
+ return false;
+ }
+
+ @Override
public com.zeroc.Ice.Value getI(com.zeroc.Ice.Current current)
{
return new II();
diff --git a/java/test/src/main/java/test/Ice/objects/Server.java b/java/test/src/main/java/test/Ice/objects/Server.java
index f6989af992b..d8e051a0592 100644
--- a/java/test/src/main/java/test/Ice/objects/Server.java
+++ b/java/test/src/main/java/test/Ice/objects/Server.java
@@ -58,6 +58,7 @@ public class Server extends test.Util.Application
{
com.zeroc.Ice.InitializationData initData = super.getInitData(args, rArgs);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0));
return initData;
}
diff --git a/java/test/src/main/java/test/Ice/objects/Test.ice b/java/test/src/main/java/test/Ice/objects/Test.ice
index c9b3b592b26..173d3e50d97 100644
--- a/java/test/src/main/java/test/Ice/objects/Test.ice
+++ b/java/test/src/main/java/test/Ice/objects/Test.ice
@@ -163,6 +163,11 @@ exception EDerived extends EBase
A1 a4;
};
+class Recursive
+{
+ Recursive v;
+};
+
interface Initial
{
void shutdown();
@@ -173,6 +178,9 @@ interface Initial
E getE();
F getF();
+ void setRecursive(Recursive p);
+ bool supportsClassGraphDepthMax();
+
["marshaled-result"] B getMB();
["amd", "marshaled-result"] B getAMDMB();