diff options
author | Mark Spruiell <mes@zeroc.com> | 2001-12-12 23:58:31 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2001-12-12 23:58:31 +0000 |
commit | 0202b93b703d77b027c39f36658a30187420f684 (patch) | |
tree | 66eab33c1b61abf98fa075b35d28c6820b12b136 /java | |
parent | initial check-in (diff) | |
download | ice-0202b93b703d77b027c39f36658a30187420f684.tar.bz2 ice-0202b93b703d77b027c39f36658a30187420f684.tar.xz ice-0202b93b703d77b027c39f36658a30187420f684.zip |
initial check-in
Diffstat (limited to 'java')
-rw-r--r-- | java/test/Ice/operations/AllTests.java | 74 | ||||
-rw-r--r-- | java/test/Ice/operations/Client.java | 66 | ||||
-rw-r--r-- | java/test/Ice/operations/Test.ice | 167 | ||||
-rw-r--r-- | java/test/Ice/operations/Twoways.java | 624 |
4 files changed, 931 insertions, 0 deletions
diff --git a/java/test/Ice/operations/AllTests.java b/java/test/Ice/operations/AllTests.java new file mode 100644 index 00000000000..48884fe27c2 --- /dev/null +++ b/java/test/Ice/operations/AllTests.java @@ -0,0 +1,74 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +public class AllTests +{ + private static void + test(boolean b) + { + if (!b) + { + throw new RuntimeException(); + } + } + + public static Test.MyClassPrx + allTests(Ice.Communicator communicator) + { + Ice.Properties properties = communicator.getProperties(); + + String address = properties.getProperty("Ice.Address"); + String protocol = properties.getProperty("Ice.Protocol"); + String secure = ""; + + if (protocol == null) + { + protocol = "tcp"; + } + + if (protocol.equals("ssl")) + { + secure = " -s "; + } + + String ref = "test" + secure + ":" + protocol + " -p 12345 -t 2000"; + if (address != null) + { + ref += " -h " + address; + } + + System.out.print("testing stringToProxy... "); + System.out.flush(); + Ice.ObjectPrx base = communicator.stringToProxy(ref); + test(base != null); + System.out.println("ok"); + + System.out.print("testing checked cast... "); + System.out.flush(); + Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(base); + test(cl != null); + Test.MyDerivedClassPrx derived = + Test.MyDerivedClassPrxHelper.checkedCast(cl); + test(derived != null); + test(cl.equals(base)); + test(derived.equals(base)); + test(cl.equals(derived)); + System.out.println("ok"); + + System.out.print("testing twoway operations... "); + System.out.flush(); + Twoways.twoways(cl); + Twoways.twoways(derived); + derived.opDerived(); + System.out.println("ok"); + + return cl; + } +} diff --git a/java/test/Ice/operations/Client.java b/java/test/Ice/operations/Client.java new file mode 100644 index 00000000000..54c97bc7b1a --- /dev/null +++ b/java/test/Ice/operations/Client.java @@ -0,0 +1,66 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +public class Client +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + Test.MyClassPrx myClass = AllTests.allTests(communicator); + + System.out.print("testing server shutdown... "); + System.out.flush(); + myClass.shutdown(); + try + { + myClass.opVoid(); + throw new RuntimeException(); + } + catch (Ice.ConnectFailedException ex) + { + System.out.println("ok"); + } + + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(args); + status = run(args, communicator); + } + catch (Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + + if (communicator != null) + { + try + { + communicator.destroy(); + } + catch (Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + } + + System.exit(status); + } +} diff --git a/java/test/Ice/operations/Test.ice b/java/test/Ice/operations/Test.ice new file mode 100644 index 00000000000..ee6d9c68054 --- /dev/null +++ b/java/test/Ice/operations/Test.ice @@ -0,0 +1,167 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +module Test +{ + +enum MyEnum +{ + enum1, + enum2, + enum3 +}; + +class MyClass; + +struct AnotherStruct +{ + string s; +}; + +struct Struct +{ + MyClass* p; + MyEnum e; + AnotherStruct s; +}; + +sequence<byte> ByteS; +sequence<bool> BoolS; +sequence<short> ShortS; +sequence<int> IntS; +sequence<long> LongS; +sequence<float> FloatS; +sequence<double> DoubleS; +sequence<string> StringS; +sequence<wstring> WStringS; +sequence<MyEnum> MyEnumS; +sequence<MyClass*> MyClassS; + +sequence<ByteS> ByteSS; +sequence<BoolS> BoolSS; +sequence<ShortS> ShortSS; +sequence<IntS> IntSS; +sequence<LongS> LongSS; +sequence<FloatS> FloatSS; +sequence<DoubleS> DoubleSS; +sequence<StringS> StringSS; +sequence<WStringS> WStringSS; +sequence<MyEnumS> MyEnumSS; +sequence<MyClassS> MyClassSS; + +dictionary<byte, bool> ByteBoolD; +dictionary<short, int> ShortIntD; +dictionary<long, float> LongFloatD; +dictionary<double, string> DoubleStringD; +dictionary<string, string> StringStringD; +dictionary<wstring, MyEnum> WStringMyEnumD; +dictionary<MyClass*, string> MyClassStringD; + +class MyClass +{ + void shutdown(); + + void opVoid(); + + byte opByte(byte p1, byte p2; + byte p3); + + bool opBool(bool p1, bool p2; + bool p3); + + long opShortIntLong(short p1, int p2, long p3; + short p4, int p5, long p6); + + double opFloatDouble(float p1, double p2; + float p3, double p4); + + string opString(string p1, string p2; + string p3); + + wstring opWString(wstring p1, wstring p2; + wstring p3); + + MyEnum opMyEnum(MyEnum p1; MyEnum p2); + + MyClass* opMyClass(MyClass* p1; MyClass* p2, MyClass* p3); + + Struct opStruct(Struct p1, Struct p2; + Struct p3); + + ByteS opByteS(ByteS p1, ByteS p2; + ByteS p3); + + BoolS opBoolS(BoolS p1, BoolS p2; + BoolS p3); + + LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3; + ::Test::ShortS p4, IntS p5, LongS p6); + + DoubleS opFloatDoubleS(FloatS p1, DoubleS p2; + FloatS p3, DoubleS p4); + + StringS opStringS(StringS p1, StringS p2; + StringS p3); + + WStringS opWStringS(WStringS p1, WStringS p2; + WStringS p3); + + ByteSS opByteSS(ByteSS p1, ByteSS p2; + ByteSS p3); + + BoolSS opBoolSS(BoolSS p1, BoolSS p2; + BoolSS p3); + + LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3; + ShortSS p4, IntSS p5, LongSS p6); + + + DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2; + FloatSS p3, DoubleSS p4); + + StringSS opStringSS(StringSS p1, StringSS p2; + StringSS p3); + + WStringSS opWStringSS(WStringSS p1, WStringSS p2; + WStringSS p3); + + ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2; + ByteBoolD p3); + + ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2; + ShortIntD p3); + + LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2; + LongFloatD p3); + + DoubleStringD opDoubleStringD(DoubleStringD p1, DoubleStringD p2; + DoubleStringD p3); + + StringStringD opStringStringD(StringStringD p1, StringStringD p2; + StringStringD p3); + + WStringMyEnumD opWStringMyEnumD(WStringMyEnumD p1, WStringMyEnumD p2; + WStringMyEnumD p3); + + MyClassStringD opMyClassStringD(MyClassStringD p1, MyClassStringD p2; + MyClassStringD p3); +}; + +class MyDerivedClass extends MyClass +{ + void opDerived(); +}; + +}; + +#endif diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java new file mode 100644 index 00000000000..fc3423cdf56 --- /dev/null +++ b/java/test/Ice/operations/Twoways.java @@ -0,0 +1,624 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Twoways +{ + private static void + test(boolean b) + { + if (!b) + { + throw new RuntimeException(); + } + } + + static void + twoways(Test.MyClassPrx p) + { + { + p.opVoid(); + } + + { + Ice.ByteHolder b = new Ice.ByteHolder(); + byte r; + + r = p.opByte((byte)0xff, (byte)0x0f, b); + test(b.value == (byte)0xf0); + test(r == (byte)0xff); + } + + { + Ice.BooleanHolder b = new Ice.BooleanHolder(); + boolean r; + + r = p.opBool(true, false, b); + test(b.value); + test(!r); + } + + { + Ice.ShortHolder s = new Ice.ShortHolder(); + Ice.IntHolder i = new Ice.IntHolder(); + Ice.LongHolder l = new Ice.LongHolder(); + long r; + + r = p.opShortIntLong((short)10, 11, 12L, s, i, l); + test(s.value == 10); + test(i.value == 11); + test(l.value == 12); + test(r == 12L); + + r = p.opShortIntLong(Short.MIN_VALUE, Integer.MIN_VALUE, + Long.MIN_VALUE, s, i, l); + test(s.value == Short.MIN_VALUE); + test(i.value == Integer.MIN_VALUE); + test(l.value == Long.MIN_VALUE); + test(r == Long.MIN_VALUE); + + r = p.opShortIntLong(Short.MAX_VALUE, Integer.MAX_VALUE, + Long.MAX_VALUE, s, i, l); + test(s.value == Short.MAX_VALUE); + test(i.value == Integer.MAX_VALUE); + test(l.value == Long.MAX_VALUE); + test(r == Long.MAX_VALUE); + } + + { + Ice.FloatHolder f = new Ice.FloatHolder(); + Ice.DoubleHolder d = new Ice.DoubleHolder(); + double r; + + r = p.opFloatDouble(3.14f, 1.1E10, f, d); + test(f.value == 3.14f); + test(d.value == 1.1E10); + test(r == 1.1E10); + + r = p.opFloatDouble(Float.MIN_VALUE, Double.MIN_VALUE, f, d); + test(f.value == Float.MIN_VALUE); + test(d.value == Double.MIN_VALUE); + test(r == Double.MIN_VALUE); + + r = p.opFloatDouble(Float.MAX_VALUE, Double.MAX_VALUE, f, d); + test(f.value == Float.MAX_VALUE); + test(d.value == Double.MAX_VALUE); + test(r == Double.MAX_VALUE); + } + + { + Ice.StringHolder s = new Ice.StringHolder(); + String r; + + r = p.opString("hello", "world", s); + test(s.value.equals("world hello")); + test(r.equals("hello world")); + } + + { + Ice.StringHolder s = new Ice.StringHolder(); + String r; + + r = p.opWString("hello", "world", s); + test(s.value.equals("world hello")); + test(r.equals("hello world")); + } + + { + Test.MyEnumHolder e = new Test.MyEnumHolder(); + Test.MyEnum r; + + r = p.opMyEnum(Test.MyEnum.enum2, e); + test(e.value == Test.MyEnum.enum2); + test(r == Test.MyEnum.enum3); + } + + { + Test.MyClassPrxHolder c1 = new Test.MyClassPrxHolder(); + Test.MyClassPrxHolder c2 = new Test.MyClassPrxHolder(); + Test.MyClassPrx r; + + r = p.opMyClass(p, c1, c2); + test(c1.value.equals(p)); + test(c2.value != p); + test(r.equals(p)); + test(c1.value.ice_getIdentity().equals("test")); + test(c2.value.ice_getIdentity().equals("noSuchIdentity")); + test(r.ice_getIdentity().equals("test")); + r.opVoid(); + c1.value.opVoid(); + try + { + c2.value.opVoid(); + test(false); + } + catch (Ice.ObjectNotExistException ex) + { + } + + r = p.opMyClass(null, c1, c2); + test(c1.value == null); + test(c2.value != null); + test(r.equals(p)); + r.opVoid(); + } + + + { + Test.Struct si1 = new Test.Struct(); + si1.p = p; + si1.e = Test.MyEnum.enum3; + si1.s = new Test.AnotherStruct(); + si1.s.s = "abc"; + Test.Struct si2 = new Test.Struct(); + si2.p = null; + si2.e = Test.MyEnum.enum2; + si2.s = new Test.AnotherStruct(); + si2.s.s = "def"; + + Test.StructHolder so = new Test.StructHolder(); + Test.Struct rso = p.opStruct(si1, si2, so); + test(rso.p == null); + test(rso.e == Test.MyEnum.enum2); + test(rso.s.s.equals("def")); + test(so.value.p.equals(p)); + test(so.value.e == Test.MyEnum.enum3); + test(so.value.s.s.equals("a new string")); + so.value.p.opVoid(); + } + + { + final byte[] bsi1 = + { + (byte)0x01, + (byte)0x11, + (byte)0x12, + (byte)0x22 + }; + final byte[] bsi2 = + { + (byte)0xf1, + (byte)0xf2, + (byte)0xf3, + (byte)0xf4 + }; + + Test.ByteSHolder bso = new Test.ByteSHolder(); + byte[] rso; + + rso = p.opByteS(bsi1, bsi2, bso); + test(bso.value.length == 4); + test(bso.value[0] == (byte)0x22); + test(bso.value[1] == (byte)0x12); + test(bso.value[2] == (byte)0x11); + test(bso.value[3] == (byte)0x01); + test(rso.length == 8); + test(rso[0] == (byte)0x01); + test(rso[1] == (byte)0x11); + test(rso[2] == (byte)0x12); + test(rso[3] == (byte)0x22); + test(rso[4] == (byte)0xf1); + test(rso[5] == (byte)0xf2); + test(rso[6] == (byte)0xf3); + test(rso[7] == (byte)0xf4); + } + + { + final boolean[] bsi1 = { true, true, false }; + final boolean[] bsi2 = { false }; + + Test.BoolSHolder bso = new Test.BoolSHolder(); + boolean[] rso; + + rso = p.opBoolS(bsi1, bsi2, bso); + test(bso.value.length == 4); + test(bso.value[0]); + test(bso.value[1]); + test(!bso.value[2]); + test(!bso.value[3]); + test(rso.length == 3); + test(!rso[0]); + test(rso[1]); + test(rso[2]); + } + + { + final short[] ssi = { 1, 2, 3 }; + final int[] isi = { 5, 6, 7, 8 }; + final long[] lsi = { 10, 30, 20 }; + + Test.ShortSHolder sso = new Test.ShortSHolder(); + Test.IntSHolder iso = new Test.IntSHolder(); + Test.LongSHolder lso = new Test.LongSHolder(); + long[] rso; + + rso = p.opShortIntLongS(ssi, isi, lsi, sso, iso, lso); + test(sso.value.length == 3); + test(sso.value[0] == 1); + test(sso.value[1] == 2); + test(sso.value[2] == 3); + test(iso.value.length == 4); + test(iso.value[0] == 8); + test(iso.value[1] == 7); + test(iso.value[2] == 6); + test(iso.value[3] == 5); + test(lso.value.length == 6); + test(lso.value[0] == 10); + test(lso.value[1] == 30); + test(lso.value[2] == 20); + test(lso.value[3] == 10); + test(lso.value[4] == 30); + test(lso.value[5] == 20); + test(rso.length == 3); + test(rso[0] == 10); + test(rso[1] == 30); + test(rso[2] == 20); + } + + { + final float[] fsi = { 3.14f, 1.11f }; + final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; + + Test.FloatSHolder fso = new Test.FloatSHolder(); + Test.DoubleSHolder dso = new Test.DoubleSHolder(); + double[] rso; + + rso = p.opFloatDoubleS(fsi, dsi, fso, dso); + test(fso.value.length == 2); + test(fso.value[0] == 3.14f); + test(fso.value[1] == 1.11f); + test(dso.value.length == 3); + test(dso.value[0] == 1.3E10); + test(dso.value[1] == 1.2E10); + test(dso.value[2] == 1.1E10); + test(rso.length == 5); + test(rso[0] == 1.1E10); + test(rso[1] == 1.2E10); + test(rso[2] == 1.3E10); + test((float)rso[3] == 3.14f); + test((float)rso[4] == 1.11f); + } + + { + final String[] ssi1 = { "abc", "de", "fghi" }; + final String[] ssi2 = { "xyz" }; + + Test.StringSHolder sso = new Test.StringSHolder(); + String[] rso; + + rso = p.opStringS(ssi1, ssi2, sso); + test(sso.value.length == 4); + test(sso.value[0].equals("abc")); + test(sso.value[1].equals("de")); + test(sso.value[2].equals("fghi")); + test(sso.value[3].equals("xyz")); + test(rso.length == 3); + test(rso[0].equals("fghi")); + test(rso[1].equals("de")); + test(rso[2].equals("abc")); + } + + { + final String[] ssi1 = { "abc", "de", "fghi" }; + final String[] ssi2 = { "xyz" }; + + Test.WStringSHolder sso = new Test.WStringSHolder(); + String[] rso; + + rso = p.opWStringS(ssi1, ssi2, sso); + test(sso.value.length == 4); + test(sso.value[0].equals("abc")); + test(sso.value[1].equals("de")); + test(sso.value[2].equals("fghi")); + test(sso.value[3].equals("xyz")); + test(rso.length == 3); + test(rso[0].equals("fghi")); + test(rso[1].equals("de")); + test(rso[2].equals("abc")); + } + + { + final byte[][] bsi1 = + { + { (byte)0x01, (byte)0x11, (byte)0x12 }, + { (byte)0xff } + }; + final byte[][] bsi2 = + { + { (byte)0x0e }, + { (byte)0xf2, (byte)0xf1 } + }; + + Test.ByteSSHolder bso = new Test.ByteSSHolder(); + byte[][] rso; + + rso = p.opByteSS(bsi1, bsi2, bso); + test(bso.value.length == 2); + test(bso.value[0].length == 1); + test(bso.value[0][0] == (byte)0xff); + test(bso.value[1].length == 3); + test(bso.value[1][0] == (byte)0x01); + test(bso.value[1][1] == (byte)0x11); + test(bso.value[1][2] == (byte)0x12); + test(rso.length == 4); + test(rso[0].length == 3); + test(rso[0][0] == (byte)0x01); + test(rso[0][1] == (byte)0x11); + test(rso[0][2] == (byte)0x12); + test(rso[1].length == 1); + test(rso[1][0] == (byte)0xff); + test(rso[2].length == 1); + test(rso[2][0] == (byte)0x0e); + test(rso[3].length == 2); + test(rso[3][0] == (byte)0xf2); + test(rso[3][1] == (byte)0xf1); + } + + { + final float[][] fsi = + { + { 3.14f }, + { 1.11f }, + { }, + }; + final double[][] dsi = + { + { 1.1E10, 1.2E10, 1.3E10 } + }; + + Test.FloatSSHolder fso = new Test.FloatSSHolder(); + Test.DoubleSSHolder dso = new Test.DoubleSSHolder(); + double[][] rso; + + rso = p.opFloatDoubleSS(fsi, dsi, fso, dso); + test(fso.value.length == 3); + test(fso.value[0].length == 1); + test(fso.value[0][0] == 3.14f); + test(fso.value[1].length == 1); + test(fso.value[1][0] == 1.11f); + test(fso.value[2].length == 0); + test(dso.value.length == 1); + test(dso.value[0].length == 3); + test(dso.value[0][0] == 1.1E10); + test(dso.value[0][1] == 1.2E10); + test(dso.value[0][2] == 1.3E10); + test(rso.length == 2); + test(rso[0].length == 3); + test(rso[0][0] == 1.1E10); + test(rso[0][1] == 1.2E10); + test(rso[0][2] == 1.3E10); + test(rso[1].length == 3); + test(rso[1][0] == 1.1E10); + test(rso[1][1] == 1.2E10); + test(rso[1][2] == 1.3E10); + } + + { + final String[][] ssi1 = + { + { "abc" }, + { "de", "fghi" } + }; + final String[][] ssi2 = + { + { }, + { }, + { "xyz" } + }; + + Test.StringSSHolder sso = new Test.StringSSHolder(); + String[][] rso; + + rso = p.opStringSS(ssi1, ssi2, sso); + test(sso.value.length == 5); + test(sso.value[0].length == 1); + test(sso.value[0][0].equals("abc")); + test(sso.value[1].length == 2); + test(sso.value[1][0].equals("de")); + test(sso.value[1][1].equals("fghi")); + test(sso.value[2].length == 0); + test(sso.value[3].length == 0); + test(sso.value[4].length == 1); + test(sso.value[4][0].equals("xyz")); + test(rso.length == 3); + test(rso[0].length == 1); + test(rso[0][0].equals("xyz")); + test(rso[1].length == 0); + test(rso[2].length == 0); + } + + { + final String[][] ssi1 = + { + { "abc" }, + { "de", "fghi" } + }; + final String[][] ssi2 = + { + { }, + { }, + { "xyz" } + }; + + Test.WStringSSHolder sso = new Test.WStringSSHolder(); + String[][] rso; + + rso = p.opWStringSS(ssi1, ssi2, sso); + test(sso.value.length == 5); + test(sso.value[0].length == 1); + test(sso.value[0][0].equals("abc")); + test(sso.value[1].length == 2); + test(sso.value[1][0].equals("de")); + test(sso.value[1][1].equals("fghi")); + test(sso.value[2].length == 0); + test(sso.value[3].length == 0); + test(sso.value[4].length == 1); + test(sso.value[4][0].equals("xyz")); + test(rso.length == 3); + test(rso[0].length == 1); + test(rso[0][0].equals("xyz")); + test(rso[1].length == 0); + test(rso[2].length == 0); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put(new Byte((byte)10), Boolean.TRUE); + di1.put(new Byte((byte)100), Boolean.FALSE); + java.util.Map di2 = new java.util.HashMap(); + di2.put(new Byte((byte)10), Boolean.TRUE); + di2.put(new Byte((byte)11), Boolean.FALSE); + di2.put(new Byte((byte)101), Boolean.TRUE); + + Test.ByteBoolDHolder _do = new Test.ByteBoolDHolder(); + java.util.Map ro = p.opByteBoolD(di1, di2, _do); + + test(_do.value.equals(di1)); + test(ro.size() == 4); + test(((Boolean)ro.get(new Byte((byte)10))).booleanValue() == true); + test(((Boolean)ro.get(new Byte((byte)11))).booleanValue() == false); + test(((Boolean)ro.get(new Byte((byte)100))).booleanValue() == false); + test(((Boolean)ro.get(new Byte((byte)101))).booleanValue() == true); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put(new Short((short)110), new Integer(-1)); + di1.put(new Short((short)1100), new Integer(123123)); + java.util.Map di2 = new java.util.HashMap(); + di2.put(new Short((short)110), new Integer(-1)); + di2.put(new Short((short)111), new Integer(-100)); + di2.put(new Short((short)1101), new Integer(0)); + + Test.ShortIntDHolder _do = new Test.ShortIntDHolder(); + java.util.Map ro = p.opShortIntD(di1, di2, _do); + + test(_do.value.equals(di1)); + test(ro.size() == 4); + test(((Integer)ro.get(new Short((short)110))).intValue() == -1); + test(((Integer)ro.get(new Short((short)111))).intValue() == -100); + test(((Integer)ro.get(new Short((short)1100))).intValue() == 123123); + test(((Integer)ro.get(new Short((short)1101))).intValue() == 0); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put(new Long(999999110L), new Float(-1.1f)); + di1.put(new Long(9999991100L), new Float(123123.2f)); + java.util.Map di2 = new java.util.HashMap(); + di2.put(new Long(999999110L), new Float(-1.1f)); + di2.put(new Long(999999111L), new Float(-100.4f)); + di2.put(new Long(9999991101L), new Float(0.5f)); + + Test.LongFloatDHolder _do = new Test.LongFloatDHolder(); + java.util.Map ro = p.opLongFloatD(di1, di2, _do); + + test(_do.value.equals(di1)); + test(ro.size() == 4); + test(((Float)ro.get(new Long(999999110L))).floatValue() == -1.1f); + test(((Float)ro.get(new Long(999999111L))).floatValue() == -100.4f); + test(((Float)ro.get(new Long(9999991100L))).floatValue() == 123123.2f); + test(((Float)ro.get(new Long(9999991101L))).floatValue() == 0.5f); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put(new Double(999999110.10E10), "abc -1.1"); + di1.put(new Double(9999991100.10E10), "abc 123123.2"); + java.util.Map di2 = new java.util.HashMap(); + di2.put(new Double(999999110.10E10), "abc -1.1"); + di2.put(new Double(999999111.10E10), "abc -100.4"); + di2.put(new Double(9999991101.10E10), "abc 0.5"); + + Test.DoubleStringDHolder _do = new Test.DoubleStringDHolder(); + java.util.Map ro = p.opDoubleStringD(di1, di2, _do); + + test(_do.value.equals(di1)); + test(ro.size() == 4); + test(((String)ro.get(new Double(999999110.10E10))).equals("abc -1.1")); + test(((String)ro.get(new Double(999999111.10E10))).equals("abc -100.4")); + test(((String)ro.get(new Double(9999991100.10E10))).equals("abc 123123.2")); + test(((String)ro.get(new Double(9999991101.10E10))).equals("abc 0.5")); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put("foo", "abc -1.1"); + di1.put("bar", "abc 123123.2"); + java.util.Map di2 = new java.util.HashMap(); + di2.put("foo", "abc -1.1"); + di2.put("FOO", "abc -100.4"); + di2.put("BAR", "abc 0.5"); + + Test.StringStringDHolder _do = new Test.StringStringDHolder(); + java.util.Map ro = p.opStringStringD(di1, di2, _do); + + test(_do.value.equals(di1)); + test(ro.size() == 4); + test(((String)ro.get("foo")).equals("abc -1.1")); + test(((String)ro.get("FOO")).equals("abc -100.4")); + test(((String)ro.get("bar")).equals("abc 123123.2")); + test(((String)ro.get("BAR")).equals("abc 0.5")); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put("abc", Test.MyEnum.enum1); + di1.put("", Test.MyEnum.enum2); + java.util.Map di2 = new java.util.HashMap(); + di2.put("abc", Test.MyEnum.enum1); + di2.put("qwerty", Test.MyEnum.enum3); + di2.put("Hello!!", Test.MyEnum.enum2); + + Test.WStringMyEnumDHolder _do = new Test.WStringMyEnumDHolder(); + java.util.Map ro = p.opWStringMyEnumD(di1, di2, _do); + + test(_do.value.equals(di1)); + test(ro.size() == 4); + test(((Test.MyEnum)ro.get("abc")) == Test.MyEnum.enum1); + test(((Test.MyEnum)ro.get("qwerty")) == Test.MyEnum.enum3); + test(((Test.MyEnum)ro.get("")) == Test.MyEnum.enum2); + test(((Test.MyEnum)ro.get("Hello!!")) == Test.MyEnum.enum2); + } + + { + java.util.Map di1 = new java.util.HashMap(); + di1.put(p, "abc"); + di1.put(null, "def"); + java.util.Map di2 = new java.util.HashMap(); + di2.put(p, "abc"); + + Test.MyClassStringDHolder _do = new Test.MyClassStringDHolder(); + java.util.Map ro = p.opMyClassStringD(di1, di2, _do); + + //test(_do.value.equals(di1)); + test(ro.size() == 2); + test(((String)ro.get(p)).equals("abc")); + test(((String)ro.get(null)).equals("def")); + + /* + int i = 0; + for (Test.MyClassStringD::iterator q = ro.begin(); q != ro.end(); ++q, ++i) + { + test(i < 2); + + if (i == 0) + { + test(!q.first); + } + else + { + test(q.first); + q.first.opVoid(); + } + } + */ + } + } +} |