summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-03-03 17:24:14 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-03-03 17:24:14 +0000
commita36b514b0495040b032f2c764c0d4694e60e1cce (patch)
treef2582dce91f54c753d5aa28095c73374a88d6eeb /java/test
parentFixed compile error (diff)
downloadice-a36b514b0495040b032f2c764c0d4694e60e1cce.tar.bz2
ice-a36b514b0495040b032f2c764c0d4694e60e1cce.tar.xz
ice-a36b514b0495040b032f2c764c0d4694e60e1cce.zip
Synced Ice and IceE operation tests.
Diffstat (limited to 'java/test')
-rw-r--r--java/test/Ice/operations/AllTests.java16
-rw-r--r--java/test/Ice/operations/Client.java5
-rw-r--r--java/test/Ice/operations/MyDerivedClassI.java36
-rw-r--r--java/test/Ice/operations/Test.ice4
-rw-r--r--java/test/Ice/operations/Twoways.java10
-rw-r--r--java/test/Ice/operations/TwowaysAMI.java35
-rw-r--r--java/test/Ice/operationsAMD/MyDerivedClassI.java38
-rw-r--r--java/test/Ice/operationsAMD/TestAMD.ice3
8 files changed, 147 insertions, 0 deletions
diff --git a/java/test/Ice/operations/AllTests.java b/java/test/Ice/operations/AllTests.java
index fe0553cef26..6437015945a 100644
--- a/java/test/Ice/operations/AllTests.java
+++ b/java/test/Ice/operations/AllTests.java
@@ -62,6 +62,22 @@ public class AllTests
test(c.equals(c2));
System.out.println("ok");
+ if(!collocated)
+ {
+ System.out.print("testing timeout... ");
+ System.out.flush();
+ try
+ {
+ Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500));
+ clTimeout.opSleep(1000);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ }
+ System.out.println("ok");
+ }
+
System.out.print("testing twoway operations... ");
System.out.flush();
Twoways.twoways(communicator, cl);
diff --git a/java/test/Ice/operations/Client.java b/java/test/Ice/operations/Client.java
index 3edf4d4c3fd..278a2045322 100644
--- a/java/test/Ice/operations/Client.java
+++ b/java/test/Ice/operations/Client.java
@@ -54,6 +54,11 @@ public class Client
//
properties.setProperty("Ice.MessageSizeMax", "100");
+ //
+ // We don't want connection warnings because of the timeout test.
+ //
+ properties.setProperty("Ice.Warn.Connections", "0");
+
communicator = Ice.Util.initialize(argsH);
status = run(argsH.value, communicator);
}
diff --git a/java/test/Ice/operations/MyDerivedClassI.java b/java/test/Ice/operations/MyDerivedClassI.java
index 503d95907e3..a38638886b4 100644
--- a/java/test/Ice/operations/MyDerivedClassI.java
+++ b/java/test/Ice/operations/MyDerivedClassI.java
@@ -9,6 +9,15 @@
public final class MyDerivedClassI extends Test.MyDerivedClass
{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
public
MyDerivedClassI(Ice.ObjectAdapter adapter, Ice.Identity identity)
{
@@ -27,6 +36,22 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
{
}
+ public void
+ opSleep(int duration, Ice.Current current)
+ {
+ while(true)
+ {
+ try
+ {
+ Thread.currentThread().sleep(duration);
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
public boolean
opBool(boolean p1, boolean p2,
Ice.BooleanHolder p3,
@@ -304,6 +329,17 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
return current.ctx;
}
+ public void
+ opDoubleMarshaling(double p1, double[] p2, Ice.Current current)
+ {
+ double d = 1278312346.0 / 13.0;
+ test(p1 == d);
+ for(int i = 0; i < p2.length; ++i)
+ {
+ test(p2[i] == d);
+ }
+ }
+
public String[]
opStringS(String[] p1, String[] p2,
Test.StringSHolder p3,
diff --git a/java/test/Ice/operations/Test.ice b/java/test/Ice/operations/Test.ice
index 93ac5ea25bb..38ea90e48bd 100644
--- a/java/test/Ice/operations/Test.ice
+++ b/java/test/Ice/operations/Test.ice
@@ -71,6 +71,8 @@ dictionary<string, MyEnum> StringMyEnumD;
void shutdown();
void opVoid();
+
+ void opSleep(int duration);
byte opByte(byte p1, byte p2,
out byte p3);
@@ -148,6 +150,8 @@ dictionary<string, MyEnum> StringMyEnumD;
void opByteSOneway(ByteS s);
Ice::Context opContext();
+
+ void opDoubleMarshaling(double p1, DoubleS p2);
};
["ami"] class MyDerivedClass extends MyClass
diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java
index cb83bfa4108..1acbccc4526 100644
--- a/java/test/Ice/operations/Twoways.java
+++ b/java/test/Ice/operations/Twoways.java
@@ -663,5 +663,15 @@ class Twoways
communicator.setDefaultContext(new java.util.HashMap());
}
}
+
+ {
+ double d = 1278312346.0 / 13.0;
+ double[] ds = new double[5];
+ for(int i = 0; i < 5; i++)
+ {
+ ds[i] = d;
+ }
+ p.opDoubleMarshaling(d, ds);
+ }
}
}
diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java
index e4480c8b622..cc0c3464784 100644
--- a/java/test/Ice/operations/TwowaysAMI.java
+++ b/java/test/Ice/operations/TwowaysAMI.java
@@ -1039,6 +1039,29 @@ class TwowaysAMI
private Callback callback = new Callback();
}
+ private static class AMI_MyClass_opDoubleMarshalingI extends Test.AMI_MyClass_opDoubleMarshaling
+ {
+ public void
+ ice_response()
+ {
+ callback.called();
+ }
+
+ public void
+ ice_exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
static void
twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p)
{
@@ -1503,6 +1526,18 @@ class TwowaysAMI
}
{
+ double d = 1278312346.0 / 13.0;
+ double[] ds = new double[5];
+ for(int i = 0; i < 5; i++)
+ {
+ ds[i] = d;
+ }
+ AMI_MyClass_opDoubleMarshalingI cb = new AMI_MyClass_opDoubleMarshalingI();
+ p.opDoubleMarshaling_async(cb, d, ds);
+ test(cb.check());
+ }
+
+ {
Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
test(derived != null);
AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI();
diff --git a/java/test/Ice/operationsAMD/MyDerivedClassI.java b/java/test/Ice/operationsAMD/MyDerivedClassI.java
index 86f8cabc4a9..812af81dcba 100644
--- a/java/test/Ice/operationsAMD/MyDerivedClassI.java
+++ b/java/test/Ice/operationsAMD/MyDerivedClassI.java
@@ -9,6 +9,15 @@
public final class MyDerivedClassI extends Test.MyDerivedClass
{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
static class Thread_opVoid extends Thread
{
public
@@ -74,6 +83,23 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
}
public void
+ opSleep_async(Test.AMD_MyClass_opSleep cb, int duration, Ice.Current current)
+ {
+ while(true)
+ {
+ try
+ {
+ Thread.currentThread().sleep(duration);
+ cb.ice_response();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ public void
opBool_async(Test.AMD_MyClass_opBool cb,
boolean p1, boolean p2,
Ice.Current current)
@@ -343,6 +369,18 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
}
public void
+ opDoubleMarshaling_async(Test.AMD_MyClass_opDoubleMarshaling cb, double p1, double[] p2, Ice.Current current)
+ {
+ double d = 1278312346.0 / 13.0;
+ test(p1 == d);
+ for(int i = 0; i < p2.length; ++i)
+ {
+ test(p2[i] == d);
+ }
+ cb.ice_response();
+ }
+
+ public void
opStringS_async(Test.AMD_MyClass_opStringS cb,
String[] p1, String[] p2,
Ice.Current current)
diff --git a/java/test/Ice/operationsAMD/TestAMD.ice b/java/test/Ice/operationsAMD/TestAMD.ice
index 8c94cd10bb7..e2c322bde3d 100644
--- a/java/test/Ice/operationsAMD/TestAMD.ice
+++ b/java/test/Ice/operationsAMD/TestAMD.ice
@@ -71,6 +71,8 @@ dictionary<string, MyEnum> StringMyEnumD;
void shutdown();
void opVoid();
+
+ void opSleep(int duration);
byte opByte(byte p1, byte p2,
out byte p3);
@@ -149,6 +151,7 @@ dictionary<string, MyEnum> StringMyEnumD;
StringStringD opContext();
+ void opDoubleMarshaling(double p1, DoubleS p2);
};
["ami", "amd"] class MyDerivedClass extends MyClass