summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-08-27 08:59:34 +0000
committerMichi Henning <michi@zeroc.com>2003-08-27 08:59:34 +0000
commit3e55486ea753901101bed6974e872d0002c8aaed (patch)
treea615409a0cf6472a00162709cd007ff045b690c8 /java/test
parentAdded test for ice_getContext(). (diff)
downloadice-3e55486ea753901101bed6974e872d0002c8aaed.tar.bz2
ice-3e55486ea753901101bed6974e872d0002c8aaed.tar.xz
ice-3e55486ea753901101bed6974e872d0002c8aaed.zip
Added per-proxy contexts to icej. For ice, added context to operator== and
the hash function for proxies.
Diffstat (limited to 'java/test')
-rw-r--r--java/test/Ice/operations/MyDerivedClassI.java6
-rw-r--r--java/test/Ice/operations/Test.ice2
-rw-r--r--java/test/Ice/operations/Twoways.java25
-rw-r--r--java/test/Ice/operations/TwowaysAMI.java91
-rw-r--r--java/test/Ice/operationsAMD/MyDerivedClassI.java6
-rw-r--r--java/test/Ice/operationsAMD/TestAMD.ice2
6 files changed, 132 insertions, 0 deletions
diff --git a/java/test/Ice/operations/MyDerivedClassI.java b/java/test/Ice/operations/MyDerivedClassI.java
index ba044139357..465bfc9dda4 100644
--- a/java/test/Ice/operations/MyDerivedClassI.java
+++ b/java/test/Ice/operations/MyDerivedClassI.java
@@ -298,6 +298,12 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
return r;
}
+ public java.util.Map
+ opContext(Ice.Current current)
+ {
+ return current.ctx;
+ }
+
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 201f10fc8c5..3efa1db86e9 100644
--- a/java/test/Ice/operations/Test.ice
+++ b/java/test/Ice/operations/Test.ice
@@ -143,6 +143,8 @@ dictionary<string, MyEnum> StringMyEnumD;
IntS opIntS(IntS s);
+ StringStringD opContext();
+
};
["ami"] class MyDerivedClass extends MyClass
diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java
index 6606b9351d3..d18e5b23c0d 100644
--- a/java/test/Ice/operations/Twoways.java
+++ b/java/test/Ice/operations/Twoways.java
@@ -526,5 +526,30 @@ class Twoways
}
}
}
+
+ {
+ java.util.HashMap ctx = new java.util.HashMap();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+ {
+ test(p.ice_getContext().isEmpty());
+ java.util.Map r = p.opContext();
+ test(!r.equals(ctx));
+ }
+ {
+ java.util.Map r = p.opContext(ctx);
+ test(p.ice_getContext().isEmpty());
+ test(r.equals(ctx));
+ }
+ {
+ Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx));
+ test(p2.ice_getContext().equals(ctx));
+ java.util.Map r = p2.opContext();
+ test(r.equals(ctx));
+ r = p2.opContext(ctx);
+ test(r.equals(ctx));
+ }
+ }
}
}
diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java
index 6ba6595a334..61a5c89dc32 100644
--- a/java/test/Ice/operations/TwowaysAMI.java
+++ b/java/test/Ice/operations/TwowaysAMI.java
@@ -849,6 +849,66 @@ class TwowaysAMI
private Callback callback = new Callback();
};
+ private static class AMI_MyClass_opContextEqualI extends Test.AMI_MyClass_opContext
+ {
+ AMI_MyClass_opContextEqualI(java.util.Map d)
+ {
+ _d = d;
+ }
+
+ public void
+ ice_response(java.util.Map r)
+ {
+ test(r.equals(_d));
+ callback.called();
+ }
+
+ public void
+ ice_exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private java.util.Map _d;
+ private Callback callback = new Callback();
+ };
+
+ private static class AMI_MyClass_opContextNotEqualI extends Test.AMI_MyClass_opContext
+ {
+ AMI_MyClass_opContextNotEqualI(java.util.Map d)
+ {
+ _d = d;
+ }
+
+ public void
+ ice_response(java.util.Map r)
+ {
+ test(!r.equals(_d));
+ callback.called();
+ }
+
+ public void
+ ice_exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private java.util.Map _d;
+ private Callback callback = new Callback();
+ };
+
private static class AMI_MyDerivedClass_opDerivedI extends Test.AMI_MyDerivedClass_opDerived
{
public void
@@ -1137,6 +1197,37 @@ class TwowaysAMI
}
{
+ java.util.Map ctx = new java.util.HashMap();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+ {
+ test(p.ice_getContext().isEmpty());
+ AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(ctx);
+ p.opContext_async(cb);
+ test(cb.check());
+ }
+ {
+ test(p.ice_getContext().isEmpty());
+ AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
+ p.opContext_async(cb, ctx);
+ test(cb.check());
+ }
+ Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx));
+ test(p2.ice_getContext().equals(ctx));
+ {
+ AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
+ p2.opContext_async(cb);
+ test(cb.check());
+ }
+ {
+ AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
+ p2.opContext_async(cb, ctx);
+ 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 e0cd474179f..e5c3d7280ea 100644
--- a/java/test/Ice/operationsAMD/MyDerivedClassI.java
+++ b/java/test/Ice/operationsAMD/MyDerivedClassI.java
@@ -336,6 +336,12 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
}
public void
+ opContext_async(Test.AMD_MyClass_opContext cb, Ice.Current current)
+ {
+ cb.ice_response(current.ctx);
+ }
+
+ 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 b69fd08f7c1..349880ab7e9 100644
--- a/java/test/Ice/operationsAMD/TestAMD.ice
+++ b/java/test/Ice/operationsAMD/TestAMD.ice
@@ -143,6 +143,8 @@ dictionary<string, MyEnum> StringMyEnumD;
IntS opIntS(IntS s);
+ StringStringD opContext();
+
};
["ami", "amd"] class MyDerivedClass extends MyClass