Ejemplo n.º 1
0
    internal static void oneways(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        p = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway());

        {
            p.ice_ping();
        }

        {
            p.opVoid();
        }

        {
            p.opIdempotent();
        }

        {
            p.opNonmutating();
        }

        {
            byte b;
            try
            {
                p.opByte((byte)0xff, (byte)0x0f, out b);
                test(false);
            }
            catch(Ice.TwowayOnlyException)
            {
            }
        }
    }
Ejemplo n.º 2
0
    internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        string[] literals = p.opStringLiterals();

        test(Test.s0.value.Equals("\\") &&
             Test.s0.value.Equals(Test.sw0.value) &&
             Test.s0.value.Equals(literals[0]) &&
             Test.s0.value.Equals(literals[11]));

        test(Test.s1.value.Equals("A") &&
             Test.s1.value.Equals(Test.sw1.value) &&
             Test.s1.value.Equals(literals[1]) &&
             Test.s1.value.Equals(literals[12]));

        test(Test.s2.value.Equals("Ice") &&
             Test.s2.value.Equals(Test.sw2.value) &&
             Test.s2.value.Equals(literals[2]) &&
             Test.s2.value.Equals(literals[13]));

        test(Test.s3.value.Equals("A21") &&
             Test.s3.value.Equals(Test.sw3.value) &&
             Test.s3.value.Equals(literals[3]) &&
             Test.s3.value.Equals(literals[14]));

        test(Test.s4.value.Equals("\\u0041 \\U00000041") &&
             Test.s4.value.Equals(Test.sw4.value) &&
             Test.s4.value.Equals(literals[4]) &&
             Test.s4.value.Equals(literals[15]));

        test(Test.s5.value.Equals("\u00FF") &&
             Test.s5.value.Equals(Test.sw5.value) &&
             Test.s5.value.Equals(literals[5]) &&
             Test.s5.value.Equals(literals[16]));

        test(Test.s6.value.Equals("\u03FF") &&
             Test.s6.value.Equals(Test.sw6.value) &&
             Test.s6.value.Equals(literals[6]) &&
             Test.s6.value.Equals(literals[17]));

        test(Test.s7.value.Equals("\u05F0") &&
             Test.s7.value.Equals(Test.sw7.value) &&
             Test.s7.value.Equals(literals[7]) &&
             Test.s7.value.Equals(literals[18]));

        test(Test.s8.value.Equals("\U00010000") &&
             Test.s8.value.Equals(Test.sw8.value) &&
             Test.s8.value.Equals(literals[8]) &&
             Test.s8.value.Equals(literals[19]));

        test(Test.s9.value.Equals("\U0001F34C") &&
             Test.s9.value.Equals(Test.sw9.value) &&
             Test.s9.value.Equals(literals[9]) &&
             Test.s9.value.Equals(literals[20]));

        test(Test.s10.value.Equals("\u0DA7") &&
             Test.s10.value.Equals(Test.sw10.value) &&
             Test.s10.value.Equals(literals[10]) &&
             Test.s10.value.Equals(literals[21]));

        test(Test.ss0.value.Equals("\'\"\u003f\\\a\b\f\n\r\t\v") &&
             Test.ss0.value.Equals(Test.ss1.value) &&
             Test.ss0.value.Equals(Test.ss2.value) &&
             Test.ss0.value.Equals(literals[22]) &&
             Test.ss0.value.Equals(literals[23]) &&
             Test.ss0.value.Equals(literals[24]));

        test(Test.ss3.value.Equals("\\\\U\\u\\") &&
             Test.ss3.value.Equals(literals[25]));

        test(Test.ss4.value.Equals("\\A\\") &&
             Test.ss4.value.Equals(literals[26]));

        test(Test.ss5.value.Equals("\\u0041\\") &&
             Test.ss5.value.Equals(literals[27]));

        test(Test.su0.value.Equals(Test.su1.value) &&
             Test.su0.value.Equals(Test.su2.value) &&
             Test.su0.value.Equals(literals[28]) &&
             Test.su0.value.Equals(literals[29]) &&
             Test.su0.value.Equals(literals[30]));

        p.ice_ping();

        test(Test.MyClassPrxHelper.ice_staticId().Equals(Test.MyClass.ice_staticId()));
        test(Ice.ObjectPrxHelper.ice_staticId().Equals(Ice.ObjectImpl.ice_staticId()));

        test(p.ice_isA(Test.MyClass.ice_staticId()));

        test(p.ice_id().Equals(Test.MyDerivedClass.ice_staticId()));

        {
            string[] ids = p.ice_ids();
            test(ids.Length == 3);
            test(ids[0].Equals("::Ice::Object"));
            test(ids[1].Equals("::Test::MyClass"));
            test(ids[2].Equals("::Test::MyDerivedClass"));
        }

        {
            p.opVoid();
        }

        {
            byte b;
            byte r;

            r = p.opByte(0xff, 0x0f, out b);
            test(b == 0xf0);
            test(r == 0xff);
        }

        {
            bool b;
            bool r;

            r = p.opBool(true, false, out b);
            test(b);
            test(!r);
        }

        {
            short s;
            int i;
            long l;
            long r;

            r = p.opShortIntLong(10, 11, 12L, out s, out i, out l);
            test(s == 10);
            test(i == 11);
            test(l == 12);
            test(r == 12L);

            r = p.opShortIntLong(Int16.MinValue, Int32.MinValue, Int64.MinValue, out s, out i, out l);
            test(s == Int16.MinValue);
            test(i == Int32.MinValue);
            test(l == Int64.MinValue);
            test(r == Int64.MinValue);

            r = p.opShortIntLong(Int16.MaxValue, Int32.MaxValue, Int64.MaxValue, out s, out i, out l);
            test(s == Int16.MaxValue);
            test(i == Int32.MaxValue);
            test(l == Int64.MaxValue);
            test(r == Int64.MaxValue);
        }

        {
            float f;
            double d;
            double r;

            r = p.opFloatDouble(3.14f, 1.1e10, out f, out d);
            test(f == 3.14f);
            test(d == 1.1e10);
            test(r == 1.1e10);

            r = p.opFloatDouble(Single.Epsilon, Double.MinValue, out f, out d);
            test(f == Single.Epsilon);
            test(d == Double.MinValue);
            test(r == Double.MinValue);

            r = p.opFloatDouble(Single.MaxValue, Double.MaxValue, out f, out d);
            test(f == Single.MaxValue);
            test(d == Double.MaxValue);
            test(r == Double.MaxValue);
        }

        {
            string s;
            string r;

            r = p.opString("hello", "world", out s);
            test(s.Equals("world hello"));
            test(r.Equals("hello world"));
        }

        {
            Test.MyEnum e;
            Test.MyEnum r;

            r = p.opMyEnum(Test.MyEnum.enum2, out e);
            test(e == Test.MyEnum.enum2);
            test(r == Test.MyEnum.enum3);
        }

        {
            Test.MyClassPrx c1;
            Test.MyClassPrx c2;
            Test.MyClassPrx r;

            r = p.opMyClass(p, out c1, out c2);
            test(Ice.Util.proxyIdentityAndFacetCompare(c1, p) == 0);
            test(Ice.Util.proxyIdentityAndFacetCompare(c2, p) != 0);
            test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0);
            test(c1.ice_getIdentity().Equals(communicator.stringToIdentity("test")));
            test(c2.ice_getIdentity().Equals(communicator.stringToIdentity("noSuchIdentity")));
            test(r.ice_getIdentity().Equals(communicator.stringToIdentity("test")));
            r.opVoid();
            c1.opVoid();
            try
            {
                c2.opVoid();
                test(false);
            }
            catch(Ice.ObjectNotExistException)
            {
            }

            r = p.opMyClass(null, out c1, out c2);
            test(c1 == null);
            test(c2 != null);
            test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0);
            r.opVoid();
        }

        {
            Test.Structure si1 = new Test.Structure();
            si1.p = p;
            si1.e = Test.MyEnum.enum3;
            si1.s = new Test.AnotherStruct();
            si1.s.s = "abc";
            Test.Structure si2 = new Test.Structure();
            si2.p = null;
            si2.e = Test.MyEnum.enum2;
            si2.s = new Test.AnotherStruct();
            si2.s.s = "def";

            Test.Structure so;
            Test.Structure rso = p.opStruct(si1, si2, out so);
            test(rso.p == null);
            test(rso.e == Test.MyEnum.enum2);
            test(rso.s.s.Equals("def"));
            test(so.p.Equals(p));
            test(so.e == Test.MyEnum.enum3);
            test(so.s.s.Equals("a new string"));
            so.p.opVoid();

            //
            // Test marshalling of null structs and structs with null members.
            //
            si1 = new Test.Structure();
            si2 = null;

            rso = p.opStruct(si1, si2, out so);
            test(rso.p == null);
            test(rso.e == Test.MyEnum.enum1);
            test(rso.s.s.Equals(""));
            test(so.p == null);
            test(so.e == Test.MyEnum.enum1);
            test(so.s.s.Equals("a new string"));
        }

        {
            byte[] bsi1 = new byte[] { 0x01, 0x11, 0x12, 0x22 };
            byte[] bsi2 = new byte[] { 0xf1, 0xf2, 0xf3, 0xf4 };

            byte[] bso;
            byte[] rso;

            rso = p.opByteS(bsi1, bsi2, out bso);
            test(bso.Length == 4);
            test(bso[0] == 0x22);
            test(bso[1] == 0x12);
            test(bso[2] == 0x11);
            test(bso[3] == 0x01);
            test(rso.Length == 8);
            test(rso[0] == 0x01);
            test(rso[1] == 0x11);
            test(rso[2] == 0x12);
            test(rso[3] == 0x22);
            test(rso[4] == 0xf1);
            test(rso[5] == 0xf2);
            test(rso[6] == 0xf3);
            test(rso[7] == 0xf4);
        }

        {
            bool[] bsi1 = new bool[] { true, true, false };
            bool[] bsi2 = new bool[] { false };

            bool[] bso;
            bool[] rso;

            rso = p.opBoolS(bsi1, bsi2, out bso);
            test(bso.Length == 4);
            test(bso[0]);
            test(bso[1]);
            test(!bso[2]);
            test(!bso[3]);
            test(rso.Length == 3);
            test(!rso[0]);
            test(rso[1]);
            test(rso[2]);
        }

        {
            short[] ssi = new short[] { 1, 2, 3 };
            int[] isi = new int[] { 5, 6, 7, 8 };
            long[] lsi = new long[] { 10, 30, 20 };

            short[] sso;
            int[] iso;
            long[] lso;
            long[] rso;

            rso = p.opShortIntLongS(ssi, isi, lsi, out sso, out iso, out lso);
            test(sso.Length == 3);
            test(sso[0] == 1);
            test(sso[1] == 2);
            test(sso[2] == 3);
            test(iso.Length == 4);
            test(iso[0] == 8);
            test(iso[1] == 7);
            test(iso[2] == 6);
            test(iso[3] == 5);
            test(lso.Length == 6);
            test(lso[0] == 10);
            test(lso[1] == 30);
            test(lso[2] == 20);
            test(lso[3] == 10);
            test(lso[4] == 30);
            test(lso[5] == 20);
            test(rso.Length == 3);
            test(rso[0] == 10);
            test(rso[1] == 30);
            test(rso[2] == 20);
        }

        {
            float[] fsi = new float[] { 3.14f, 1.11f };
            double[] dsi = new double[] { 1.1e10, 1.2e10, 1.3e10 };

            float[] fso;
            double[] dso;
            double[] rso;

            rso = p.opFloatDoubleS(fsi, dsi, out fso, out dso);
            test(fso.Length == 2);
            test(fso[0] == 3.14f);
            test(fso[1] == 1.11f);
            test(dso.Length == 3);
            test(dso[0] == 1.3e10);
            test(dso[1] == 1.2e10);
            test(dso[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);
        }

        {
            string[] ssi1 = new string[] { "abc", "de", "fghi" };
            string[] ssi2 = new string[] { "xyz" };

            string[] sso;
            string[] rso;

            rso = p.opStringS(ssi1, ssi2, out sso);
            test(sso.Length == 4);
            test(sso[0].Equals("abc"));
            test(sso[1].Equals("de"));
            test(sso[2].Equals("fghi"));
            test(sso[3].Equals("xyz"));
            test(rso.Length == 3);
            test(rso[0].Equals("fghi"));
            test(rso[1].Equals("de"));
            test(rso[2].Equals("abc"));
        }

        {
            byte[] s11 = new byte[] { 0x01, 0x11, 0x12 };
            byte[] s12 = new byte[] { 0xff };
            byte[][] bsi1 = new byte[][] { s11, s12 };

            byte[] s21 = new byte[] { 0x0e };
            byte[] s22 = new byte[] { 0xf2, 0xf1 };
            byte[][] bsi2 = new byte[][] { s21, s22 };

            byte[][] bso;
            byte[][] rso;

            rso = p.opByteSS(bsi1, bsi2, out bso);
            test(bso.Length == 2);
            test(bso[0].Length == 1);
            test(bso[0][0] == 0xff);
            test(bso[1].Length == 3);
            test(bso[1][0] == 0x01);
            test(bso[1][1] == 0x11);
            test(bso[1][2] == 0x12);
            test(rso.Length == 4);
            test(rso[0].Length == 3);
            test(rso[0][0] == 0x01);
            test(rso[0][1] == 0x11);
            test(rso[0][2] == 0x12);
            test(rso[1].Length == 1);
            test(rso[1][0] == 0xff);
            test(rso[2].Length == 1);
            test(rso[2][0] == 0x0e);
            test(rso[3].Length == 2);
            test(rso[3][0] == 0xf2);
            test(rso[3][1] == 0xf1);
        }

        {
            bool[] s11 = new bool[] {true};
            bool[] s12 = new bool[] {false};
            bool[] s13 = new bool[] {true, true};
            bool[][] bsi1 = new bool[][] {s11, s12, s13};

            bool[] s21 = new bool[] {false, false, true};
            bool[][] bsi2 = new bool[][] {s21};

            bool[][] rso;
            bool[][] bso;

            rso = p.opBoolSS(bsi1, bsi2, out bso);
            test(bso.Length == 4);
            test(bso[0].Length == 1);
            test(bso[0][0]);
            test(bso[1].Length == 1);
            test(!bso[1][0]);
            test(bso[2].Length == 2);
            test(bso[2][0]);
            test(bso[2][1]);
            test(bso[3].Length == 3);
            test(!bso[3][0]);
            test(!bso[3][1]);
            test(bso[3][2]);
            test(rso.Length == 3);
            test(rso[0].Length == 2);
            test(rso[0][0]);
            test(rso[0][1]);
            test(rso[1].Length == 1);
            test(!rso[1][0]);
            test(rso[2].Length == 1);
            test(rso[2][0]);
        }

        {
            short[] s11 = new short[] {1, 2, 5};
            short[] s12 = new short[] {13};
            short[] s13 = new short[] {};
            short[][] ssi = new short[][] {s11, s12, s13};

            int[] i11 = new int[] {24, 98};
            int[] i12 = new int[] {42};
            int[][] isi = new int[][] {i11, i12};

            long[] l11 = new long[] {496, 1729};
            long[][] lsi = new long[][] {l11};

            short[][] sso;
            int[][] iso;
            long[][] lso;
            long[][] rso;

            rso = p.opShortIntLongSS(ssi, isi, lsi, out sso, out iso, out lso);
            test(rso.Length == 1);
            test(rso[0].Length == 2);
            test(rso[0][0] == 496);
            test(rso[0][1] == 1729);
            test(sso.Length == 3);
            test(sso[0].Length == 3);
            test(sso[0][0] == 1);
            test(sso[0][1] == 2);
            test(sso[0][2] == 5);
            test(sso[1].Length == 1);
            test(sso[1][0] == 13);
            test(sso[2].Length == 0);
            test(iso.Length == 2);
            test(iso[0].Length == 1);
            test(iso[0][0] == 42);
            test(iso[1].Length == 2);
            test(iso[1][0] == 24);
            test(iso[1][1] == 98);
            test(lso.Length == 2);
            test(lso[0].Length == 2);
            test(lso[0][0] == 496);
            test(lso[0][1] == 1729);
            test(lso[1].Length == 2);
            test(lso[1][0] == 496);
            test(lso[1][1] == 1729);
        }

        {
            float[] f11 = new float[] { 3.14f };
            float[] f12 = new float[] { 1.11f };
            float[] f13 = new float[] { };
            float[][] fsi = new float[][] { f11, f12, f13 };

            double[] d11 = new double[] { 1.1e10, 1.2e10, 1.3e10 };
            double[][] dsi = new double[][] { d11 };

            float[][] fso;
            double[][] dso;
            double[][] rso;

            rso = p.opFloatDoubleSS(fsi, dsi, out fso, out dso);
            test(fso.Length == 3);
            test(fso[0].Length == 1);
            test(fso[0][0] == 3.14f);
            test(fso[1].Length == 1);
            test(fso[1][0] == 1.11f);
            test(fso[2].Length == 0);
            test(dso.Length == 1);
            test(dso[0].Length == 3);
            test(dso[0][0] == 1.1e10);
            test(dso[0][1] == 1.2e10);
            test(dso[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);
        }

        {
            string[] s11 = new string[] { "abc" };
            string[] s12 = new string[] { "de", "fghi" };
            string[][] ssi1 = new string[][] { s11, s12 };

            string[] s21 = new string[] {};
            string[] s22 = new string[] {};
            string[] s23 = new string[] { "xyz" };
            string[][] ssi2 = new string[][] { s21, s22, s23 };

            string[][] sso;
            string[][] rso;

            rso = p.opStringSS(ssi1, ssi2, out sso);
            test(sso.Length == 5);
            test(sso[0].Length == 1);
            test(sso[0][0].Equals("abc"));
            test(sso[1].Length == 2);
            test(sso[1][0].Equals("de"));
            test(sso[1][1].Equals("fghi"));
            test(sso[2].Length == 0);
            test(sso[3].Length == 0);
            test(sso[4].Length == 1);
            test(sso[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);
        }

        {
            string[] s111 = new string[] { "abc", "de"};
            string[] s112 = new string[] { "xyz" };
            string[][] ss11 = new string[][] { s111, s112 };
            string[] s121 = new string[] { "hello"};
            string[][] ss12 = new string[][] { s121 };
            string[][][] sssi1 = new string[][][] { ss11, ss12 };

            string[] s211 = new string[] { "", ""};
            string[] s212 = new string[] { "abcd" };
            string[][] ss21 = new string[][] { s211, s212 };
            string[] s221 = new string[] { ""};
            string[][] ss22 = new string[][] { s221 };
            string[][] ss23 = new string[][] {};
            string[][][] sssi2 = new string[][][] { ss21, ss22, ss23 };

            string[][][] ssso;
            string[][][] rsso;

            rsso = p.opStringSSS(sssi1, sssi2, out ssso);
            test(ssso.Length == 5);
            test(ssso[0].Length == 2);
            test(ssso[0][0].Length == 2);
            test(ssso[0][1].Length == 1);
            test(ssso[1].Length == 1);
            test(ssso[1][0].Length == 1);
            test(ssso[2].Length == 2);
            test(ssso[2][0].Length == 2);
            test(ssso[2][1].Length == 1);
            test(ssso[3].Length == 1);
            test(ssso[3][0].Length == 1);
            test(ssso[4].Length == 0);
            test(ssso[0][0][0].Equals("abc"));
            test(ssso[0][0][1].Equals("de"));
            test(ssso[0][1][0].Equals("xyz"));
            test(ssso[1][0][0].Equals("hello"));
            test(ssso[2][0][0].Equals(""));
            test(ssso[2][0][1].Equals(""));
            test(ssso[2][1][0].Equals("abcd"));
            test(ssso[3][0][0].Equals(""));

            test(rsso.Length == 3);
            test(rsso[0].Length == 0);
            test(rsso[1].Length == 1);
            test(rsso[1][0].Length == 1);
            test(rsso[2].Length == 2);
            test(rsso[2][0].Length == 2);
            test(rsso[2][1].Length == 1);
            test(rsso[1][0][0].Equals(""));
            test(rsso[2][0][0].Equals(""));
            test(rsso[2][0][1].Equals(""));
            test(rsso[2][1][0].Equals("abcd"));
        }

        {
            Dictionary<byte, bool> di1 = new Dictionary<byte, bool>();
            di1[10] = true;
            di1[100] = false;
            Dictionary<byte, bool> di2 = new Dictionary<byte, bool>();
            di2[10] = true;
            di2[11] = false;
            di2[101] = true;

            Dictionary<byte, bool> _do;
            Dictionary<byte, bool> ro = p.opByteBoolD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[10] == true);
            test(ro[11] == false);
            test(ro[100] == false);
            test(ro[101] == true);
        }

        {
            Dictionary<short, int> di1 = new Dictionary<short, int>();
            di1[110] = -1;
            di1[1100] = 123123;
            Dictionary<short, int> di2 = new Dictionary<short, int>();
            di2[110] = -1;
            di2[111] = -100;
            di2[1101] = 0;

            Dictionary<short, int> _do;
            Dictionary<short, int> ro = p.opShortIntD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[110] == -1);
            test(ro[111] == -100);
            test(ro[1100] == 123123);
            test(ro[1101] == 0);
        }

        {
            Dictionary<long, float> di1 = new Dictionary<long, float>();
            di1[999999110L] = -1.1f;
            di1[999999111L] = 123123.2f;
            Dictionary<long, float> di2 = new Dictionary<long, float>();
            di2[999999110L] = -1.1f;
            di2[999999120L] = -100.4f;
            di2[999999130L] = 0.5f;

            Dictionary<long, float> _do;
            Dictionary<long, float> ro = p.opLongFloatD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[999999110L] == -1.1f);
            test(ro[999999120L] == -100.4f);
            test(ro[999999111L] == 123123.2f);
            test(ro[999999130L] == 0.5f);
        }

        {
            Dictionary<string, string> di1 = new Dictionary<string, string>();
            di1["foo"] = "abc -1.1";
            di1["bar"] = "abc 123123.2";
            Dictionary<string, string> di2 = new Dictionary<string, string>();
            di2["foo"] = "abc -1.1";
            di2["FOO"] = "abc -100.4";
            di2["BAR"] = "abc 0.5";

            Dictionary<string, string> _do;
            Dictionary<string, string> ro = p.opStringStringD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro["foo"].Equals("abc -1.1"));
            test(ro["FOO"].Equals("abc -100.4"));
            test(ro["bar"].Equals("abc 123123.2"));
            test(ro["BAR"].Equals("abc 0.5"));
        }

        {
            Dictionary<string, Test.MyEnum> di1 = new Dictionary<string, Test.MyEnum>();
            di1["abc"] = Test.MyEnum.enum1;
            di1[""] = Test.MyEnum.enum2;
            Dictionary<string, Test.MyEnum> di2 = new Dictionary<string, Test.MyEnum>();
            di2["abc"] = Test.MyEnum.enum1;
            di2["qwerty"] = Test.MyEnum.enum3;
            di2["Hello!!"] = Test.MyEnum.enum2;

            Dictionary<string, Test.MyEnum> _do;
            Dictionary<string, Test.MyEnum> ro = p.opStringMyEnumD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro["abc"] == Test.MyEnum.enum1);
            test(ro["qwerty"] == Test.MyEnum.enum3);
            test(ro[""] == Test.MyEnum.enum2);
            test(ro["Hello!!"] == Test.MyEnum.enum2);
        }

        {
            Dictionary<Test.MyEnum, string> di1 = new Dictionary<Test.MyEnum, string>();
            di1[Test.MyEnum.enum1] = "abc";
            Dictionary<Test.MyEnum, string> di2 = new Dictionary<Test.MyEnum, string>();
            di2[Test.MyEnum.enum2] = "Hello!!";
            di2[Test.MyEnum.enum3] = "qwerty";

            Dictionary<Test.MyEnum, string> _do;
            Dictionary<Test.MyEnum, string> ro = p.opMyEnumStringD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 3);
            test(ro[Test.MyEnum.enum1].Equals("abc"));
            test(ro[Test.MyEnum.enum2].Equals("Hello!!"));
            test(ro[Test.MyEnum.enum3].Equals("qwerty"));
        }

        {
            Test.MyStruct s11 = new Test.MyStruct(1, 1);
            Test.MyStruct s12 = new Test.MyStruct(1, 2);
            Dictionary<Test.MyStruct, Test.MyEnum> di1 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di1[s11] = Test.MyEnum.enum1;
            di1[s12] = Test.MyEnum.enum2;

            Test.MyStruct s22 = new Test.MyStruct(2, 2);
            Test.MyStruct s23 = new Test.MyStruct(2, 3);
            Dictionary<Test.MyStruct, Test.MyEnum> di2 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di2[s11] = Test.MyEnum.enum1;
            di2[s22] = Test.MyEnum.enum3;
            di2[s23] = Test.MyEnum.enum2;

            Dictionary<Test.MyStruct, Test.MyEnum> _do;
            Dictionary<Test.MyStruct, Test.MyEnum> ro = p.opMyStructMyEnumD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[s11] == Test.MyEnum.enum1);
            test(ro[s12] == Test.MyEnum.enum2);
            test(ro[s22] == Test.MyEnum.enum3);
            test(ro[s23] == Test.MyEnum.enum2);
        }

        {
            Dictionary<byte, bool>[] dsi1 = new Dictionary<byte, bool>[2];
            Dictionary<byte, bool>[] dsi2 = new Dictionary<byte, bool>[1];

            Dictionary<byte, bool> di1 = new Dictionary<byte, bool>();
            di1[10] = true;
            di1[100] = false;
            Dictionary<byte, bool> di2 = new Dictionary<byte, bool>();
            di2[10] = true;
            di2[11] = false;
            di2[101] = true;
            Dictionary<byte, bool> di3 = new Dictionary<byte, bool>();
            di3[100] = false;
            di3[101] = false;

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<byte, bool>[] _do;
            Dictionary<byte, bool>[] ro = p.opByteBoolDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 3);
            test(ro[0][10]);
            test(!ro[0][11]);
            test(ro[0][101]);
            test(ro[1].Count == 2);
            test(ro[1][10]);
            test(!ro[1][100]);

            test(_do.Length == 3);
            test(_do[0].Count == 2);
            test(!_do[0][100]);
            test(!_do[0][101]);
            test(_do[1].Count == 2);
            test(_do[1][10]);
            test(!_do[1][100]);
            test(_do[2].Count == 3);
            test(_do[2][10]);
            test(!_do[2][11]);
            test(_do[2][101]);
        }

        {
            Dictionary<short, int>[] dsi1 = new Dictionary<short, int>[2];
            Dictionary<short, int>[] dsi2 = new Dictionary<short, int>[1];

            Dictionary<short, int> di1 = new Dictionary<short, int>();
            di1[110] = -1;
            di1[1100] = 123123;
            Dictionary<short, int> di2 = new Dictionary<short, int>();
            di2[110] = -1;
            di2[111] = -100;
            di2[1101] = 0;
            Dictionary<short, int> di3 = new Dictionary<short, int>();
            di3[100] = -1001;

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<short, int>[] _do;
            Dictionary<short, int>[] ro = p.opShortIntDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 3);
            test(ro[0][110] == -1);
            test(ro[0][111] == -100);
            test(ro[0][1101] == 0);
            test(ro[1].Count == 2);
            test(ro[1][110] == -1);
            test(ro[1][1100] == 123123);

            test(_do.Length == 3);
            test(_do[0].Count == 1);
            test(_do[0][100] == -1001);
            test(_do[1].Count == 2);
            test(_do[1][110] == -1);
            test(_do[1][1100] == 123123);
            test(_do[2].Count == 3);
            test(_do[2][110] == -1);
            test(_do[2][111] == -100);
            test(_do[2][1101] == 0);
        }

        {
            Dictionary<long, float>[] dsi1 = new Dictionary<long, float>[2];
            Dictionary<long, float>[] dsi2 = new Dictionary<long, float>[1];

            Dictionary<long, float> di1 = new Dictionary<long, float>();
            di1[999999110L] = -1.1f;
            di1[999999111L] = 123123.2f;
            Dictionary<long, float> di2 = new Dictionary<long, float>();
            di2[999999110L] = -1.1f;
            di2[999999120L] = -100.4f;
            di2[999999130L] = 0.5f;
            Dictionary<long, float> di3 = new Dictionary<long, float>();
            di3[999999140L] = 3.14f;

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<long, float>[] _do;
            Dictionary<long, float>[] ro = p.opLongFloatDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 3);
            test(ro[0][999999110L] == -1.1f);
            test(ro[0][999999120L] == -100.4f);
            test(ro[0][999999130L] == 0.5f);
            test(ro[1].Count == 2);
            test(ro[1][999999110L] == -1.1f);
            test(ro[1][999999111L] == 123123.2f);

            test(_do.Length == 3);
            test(_do[0].Count == 1);
            test(_do[0][999999140L] == 3.14f);
            test(_do[1].Count == 2);
            test(_do[1][999999110L] == -1.1f);
            test(_do[1][999999111L] == 123123.2f);
            test(_do[2].Count == 3);
            test(_do[2][999999110L] == -1.1f);
            test(_do[2][999999120L] == -100.4f);
            test(_do[2][999999130L] == 0.5f);

        }

        {
            Dictionary<string, string>[] dsi1 = new Dictionary<string, string>[2];
            Dictionary<string, string>[] dsi2 = new Dictionary<string, string>[1];

            Dictionary<string, string> di1 = new Dictionary<string, string>();
            di1["foo"] = "abc -1.1";
            di1["bar"] = "abc 123123.2";
            Dictionary<string, string> di2 = new Dictionary<string, string>();
            di2["foo"] = "abc -1.1";
            di2["FOO"] = "abc -100.4";
            di2["BAR"] = "abc 0.5";
            Dictionary<string, string> di3 = new Dictionary<string, string>();
            di3["f00"] = "ABC -3.14";

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<string, string>[] _do;
            Dictionary<string, string>[] ro = p.opStringStringDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 3);
            test(ro[0]["foo"].Equals("abc -1.1"));
            test(ro[0]["FOO"].Equals("abc -100.4"));
            test(ro[0]["BAR"].Equals("abc 0.5"));
            test(ro[1].Count == 2);
            test(ro[1]["foo"] == "abc -1.1");
            test(ro[1]["bar"] == "abc 123123.2");

            test(_do.Length == 3);
            test(_do[0].Count == 1);
            test(_do[0]["f00"].Equals("ABC -3.14"));
            test(_do[1].Count == 2);
            test(_do[1]["foo"].Equals("abc -1.1"));
            test(_do[1]["bar"].Equals("abc 123123.2"));
            test(_do[2].Count == 3);
            test(_do[2]["foo"].Equals("abc -1.1"));
            test(_do[2]["FOO"].Equals("abc -100.4"));
            test(_do[2]["BAR"].Equals("abc 0.5"));
        }

        {
            Dictionary<string, Test.MyEnum>[] dsi1 = new Dictionary<string, Test.MyEnum>[2];
            Dictionary<string, Test.MyEnum>[] dsi2 = new Dictionary<string, Test.MyEnum>[1];

            Dictionary<string, Test.MyEnum> di1 = new Dictionary<string, Test.MyEnum>();
            di1["abc"] = Test.MyEnum.enum1;
            di1[""] = Test.MyEnum.enum2;
            Dictionary<string, Test.MyEnum> di2 = new Dictionary<string, Test.MyEnum>();
            di2["abc"] = Test.MyEnum.enum1;
            di2["qwerty"] = Test.MyEnum.enum3;
            di2["Hello!!"] = Test.MyEnum.enum2;
            Dictionary<string, Test.MyEnum> di3 = new Dictionary<string, Test.MyEnum>();
            di3["Goodbye"] = Test.MyEnum.enum1;

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<string, Test.MyEnum>[] _do;
            Dictionary<string, Test.MyEnum>[] ro = p.opStringMyEnumDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 3);
            test(ro[0]["abc"] == Test.MyEnum.enum1);
            test(ro[0]["qwerty"] == Test.MyEnum.enum3);
            test(ro[0]["Hello!!"] == Test.MyEnum.enum2);
            test(ro[1].Count == 2);
            test(ro[1]["abc"] == Test.MyEnum.enum1);
            test(ro[1][""] == Test.MyEnum.enum2);

            test(_do.Length == 3);
            test(_do[0].Count == 1);
            test(_do[0]["Goodbye"] == Test.MyEnum.enum1);
            test(_do[1].Count == 2);
            test(_do[1]["abc"] == Test.MyEnum.enum1);
            test(_do[1][""] == Test.MyEnum.enum2);
            test(_do[2].Count == 3);
            test(_do[2]["abc"] == Test.MyEnum.enum1);
            test(_do[2]["qwerty"] == Test.MyEnum.enum3);
            test(_do[2]["Hello!!"] == Test.MyEnum.enum2);
        }

        {
            Dictionary<Test.MyEnum, string>[] dsi1 = new Dictionary<Test.MyEnum, string>[2];
            Dictionary<Test.MyEnum, string>[] dsi2 = new Dictionary<Test.MyEnum, string>[1];

            Dictionary<Test.MyEnum, string> di1 = new Dictionary<Test.MyEnum, string>();
            di1[Test.MyEnum.enum1] = "abc";
            Dictionary<Test.MyEnum, string> di2 = new Dictionary<Test.MyEnum, string>();
            di2[Test.MyEnum.enum2] = "Hello!!";
            di2[Test.MyEnum.enum3] = "qwerty";
            Dictionary<Test.MyEnum, string> di3 = new Dictionary<Test.MyEnum, string>();
            di3[Test.MyEnum.enum1] = "Goodbye";

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<Test.MyEnum, string>[] _do;
            Dictionary<Test.MyEnum, string>[] ro = p.opMyEnumStringDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 2);
            test(ro[0][Test.MyEnum.enum2].Equals("Hello!!"));
            test(ro[0][Test.MyEnum.enum3].Equals("qwerty"));
            test(ro[1].Count == 1);
            test(ro[1][Test.MyEnum.enum1].Equals("abc"));

            test(_do.Length == 3);
            test(_do[0].Count == 1);
            test(_do[0][Test.MyEnum.enum1].Equals("Goodbye"));
            test(_do[1].Count == 1);
            test(_do[1][Test.MyEnum.enum1].Equals("abc"));
            test(_do[2].Count == 2);
            test(_do[2][Test.MyEnum.enum2].Equals("Hello!!"));
            test(_do[2][Test.MyEnum.enum3].Equals("qwerty"));
        }

        {
            Dictionary<Test.MyStruct, Test.MyEnum>[] dsi1 = new Dictionary<Test.MyStruct, Test.MyEnum>[2];
            Dictionary<Test.MyStruct, Test.MyEnum>[] dsi2 = new Dictionary<Test.MyStruct, Test.MyEnum>[1];

            Test.MyStruct s11 = new Test.MyStruct(1, 1);
            Test.MyStruct s12 = new Test.MyStruct(1, 2);
            Dictionary<Test.MyStruct, Test.MyEnum> di1 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di1[s11] = Test.MyEnum.enum1;
            di1[s12] = Test.MyEnum.enum2;

            Test.MyStruct s22 = new Test.MyStruct(2, 2);
            Test.MyStruct s23 = new Test.MyStruct(2, 3);
            Dictionary<Test.MyStruct, Test.MyEnum> di2 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di2[s11] = Test.MyEnum.enum1;
            di2[s22] = Test.MyEnum.enum3;
            di2[s23] = Test.MyEnum.enum2;

            Dictionary<Test.MyStruct, Test.MyEnum> di3 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di3[s23] = Test.MyEnum.enum3;

            dsi1[0] = di1;
            dsi1[1] = di2;
            dsi2[0] = di3;

            Dictionary<Test.MyStruct, Test.MyEnum>[] _do;
            Dictionary<Test.MyStruct, Test.MyEnum>[] ro = p.opMyStructMyEnumDS(dsi1, dsi2, out _do);

            test(ro.Length == 2);
            test(ro[0].Count == 3);
            test(ro[0][s11] == Test.MyEnum.enum1);
            test(ro[0][s22] == Test.MyEnum.enum3);
            test(ro[0][s23] == Test.MyEnum.enum2);
            test(ro[1].Count == 2);
            test(ro[1][s11] == Test.MyEnum.enum1);
            test(ro[1][s12] == Test.MyEnum.enum2);

            test(_do.Length == 3);
            test(_do[0].Count == 1);
            test(_do[0][s23] == Test.MyEnum.enum3);
            test(_do[1].Count == 2);
            test(_do[1][s11] == Test.MyEnum.enum1);
            test(_do[1][s12] == Test.MyEnum.enum2);
            test(_do[2].Count == 3);
            test(_do[2][s11] == Test.MyEnum.enum1);
            test(_do[2][s22] == Test.MyEnum.enum3);
            test(_do[2][s23] == Test.MyEnum.enum2);
        }

        {
            Dictionary<byte, byte[]> sdi1 = new Dictionary<byte, byte[]>();
            Dictionary<byte, byte[]> sdi2 = new Dictionary<byte, byte[]>();

            byte[] si1 = new byte[] { 0x01, 0x11 };
            byte[] si2 = new byte[] { 0x12 };
            byte[] si3 = new byte[] { 0xf2, 0xf3 };

            sdi1[0x01] = si1;
            sdi1[0x22] = si2;
            sdi2[0xf1] = si3;

            Dictionary<byte, byte[]> _do;
            Dictionary<byte, byte[]> ro = p.opByteByteSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[0xf1].Length == 2);
            test(_do[0xf1][0] == 0xf2);
            test(_do[0xf1][1] == 0xf3);

            test(ro.Count == 3);
            test(ro[0x01].Length == 2);
            test(ro[0x01][0] == 0x01);
            test(ro[0x01][1] == 0x11);
            test(ro[0x22].Length == 1);
            test(ro[0x22][0] == 0x12);
            test(ro[0xf1].Length == 2);
            test(ro[0xf1][0] == 0xf2);
            test(ro[0xf1][1] == 0xf3);
        }

        {
            Dictionary<bool, bool[]> sdi1 = new Dictionary<bool, bool[]>();
            Dictionary<bool, bool[]> sdi2 = new Dictionary<bool, bool[]>();

            bool[] si1 = new bool[] { true, false };
            bool[] si2 = new bool[] { false, true, true };

            sdi1[false] = si1;
            sdi1[true] = si2;
            sdi2[false] = si1;

            Dictionary<bool, bool[]> _do;
            Dictionary<bool, bool[]> ro = p.opBoolBoolSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[false].Length == 2);
            test(_do[false][0]);
            test(!_do[false][1]);
            test(ro.Count == 2);
            test(ro[false].Length == 2);
            test(ro[false][0]);
            test(!ro[false][1]);
            test(ro[true].Length == 3);
            test(!ro[true][0]);
            test(ro[true][1]);
            test(ro[true][2]);
        }

        {
            Dictionary<short, short[]> sdi1 = new Dictionary<short, short[]>();
            Dictionary<short, short[]> sdi2 = new Dictionary<short, short[]>();

            short[] si1 = new short[] { 1, 2, 3 };
            short[] si2 = new short[] { 4, 5 };
            short[] si3 = new short[] { 6, 7 };

            sdi1[1] = si1;
            sdi1[2] = si2;
            sdi2[4] = si3;

            Dictionary<short, short[]> _do;
            Dictionary<short, short[]> ro = p.opShortShortSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[4].Length == 2);
            test(_do[4][0] == 6);
            test(_do[4][1] == 7);

            test(ro.Count == 3);
            test(ro[1].Length == 3);
            test(ro[1][0] == 1);
            test(ro[1][1] == 2);
            test(ro[1][2] == 3);
            test(ro[2].Length == 2);
            test(ro[2][0] == 4);
            test(ro[2][1] == 5);
            test(ro[4].Length == 2);
            test(ro[4][0] == 6);
            test(ro[4][1] == 7);
        }

        {
            Dictionary<int, int[]> sdi1 = new Dictionary<int, int[]>();
            Dictionary<int, int[]> sdi2 = new Dictionary<int, int[]>();

            int[] si1 = new int[] { 100, 200, 300 };
            int[] si2 = new int[] { 400, 500 };
            int[] si3 = new int[] { 600, 700 };

            sdi1[100] = si1;
            sdi1[200] = si2;
            sdi2[400] = si3;

            Dictionary<int, int[]> _do;
            Dictionary<int, int[]> ro = p.opIntIntSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[400].Length == 2);
            test(_do[400][0] == 600);
            test(_do[400][1] == 700);

            test(ro.Count == 3);
            test(ro[100].Length == 3);
            test(ro[100][0] == 100);
            test(ro[100][1] == 200);
            test(ro[100][2] == 300);
            test(ro[200].Length == 2);
            test(ro[200][0] == 400);
            test(ro[200][1] == 500);
            test(ro[400].Length == 2);
            test(ro[400][0] == 600);
            test(ro[400][1] == 700);
        }

        {
            Dictionary<long, long[]> sdi1 = new Dictionary<long, long[]>();
            Dictionary<long, long[]> sdi2 = new Dictionary<long, long[]>();

            long[] si1 = new long[] { 999999110L, 999999111L, 999999110L };
            long[] si2 = new long[] { 999999120L, 999999130L };
            long[] si3 = new long[] { 999999110L, 999999120L };

            sdi1[999999990L] = si1;
            sdi1[999999991L] = si2;
            sdi2[999999992L] = si3;

            Dictionary<long, long[]> _do;
            Dictionary<long, long[]> ro = p.opLongLongSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[999999992L].Length == 2);
            test(_do[999999992L][0] == 999999110L);
            test(_do[999999992L][1] == 999999120L);
            test(ro.Count == 3);
            test(ro[999999990L].Length == 3);
            test(ro[999999990L][0] == 999999110L);
            test(ro[999999990L][1] == 999999111L);
            test(ro[999999990L][2] == 999999110L);
            test(ro[999999991L].Length == 2);
            test(ro[999999991L][0] == 999999120L);
            test(ro[999999991L][1] == 999999130L);
            test(ro[999999992L].Length == 2);
            test(ro[999999992L][0] == 999999110L);
            test(ro[999999992L][1] == 999999120L);
        }

        {
            Dictionary<string, float[]> sdi1 = new Dictionary<string, float[]>();
            Dictionary<string, float[]> sdi2 = new Dictionary<string, float[]>();

            float[] si1 = new float[] { -1.1f, 123123.2f, 100.0f };
            float[] si2 = new float[] { 42.24f, -1.61f };
            float[] si3 = new float[] { -3.14f, 3.14f };

            sdi1["abc"] = si1;
            sdi1["ABC"] = si2;
            sdi2["aBc"] = si3;

            Dictionary<string, float[]> _do;
            Dictionary<string, float[]> ro = p.opStringFloatSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do["aBc"].Length == 2);
            test(_do["aBc"][0] == -3.14f);
            test(_do["aBc"][1] == 3.14f);

            test(ro.Count == 3);
            test(ro["abc"].Length == 3);
            test(ro["abc"][0] == -1.1f);
            test(ro["abc"][1] == 123123.2f);
            test(ro["abc"][2] == 100.0f);
            test(ro["ABC"].Length == 2);
            test(ro["ABC"][0] == 42.24f);
            test(ro["ABC"][1] == -1.61f);
            test(ro["aBc"].Length == 2);
            test(ro["aBc"][0] == -3.14f);
            test(ro["aBc"][1] == 3.14f);
        }

        {
            Dictionary<string, double[]> sdi1 = new Dictionary<string, double[]>();
            Dictionary<string, double[]> sdi2 = new Dictionary<string, double[]>();

            double[] si1 = new double[] { 1.1E10, 1.2E10, 1.3E10 };
            double[] si2 = new double[] { 1.4E10, 1.5E10 };
            double[] si3 = new double[] { 1.6E10, 1.7E10 };

            sdi1["Hello!!"] = si1;
            sdi1["Goodbye"] = si2;
            sdi2[""] = si3;

            Dictionary<string, double[]> _do;
            Dictionary<string, double[]> ro = p.opStringDoubleSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[""].Length == 2);
            test(_do[""][0] == 1.6E10);
            test(_do[""][1] == 1.7E10);
            test(ro.Count == 3);
            test(ro["Hello!!"].Length == 3);
            test(ro["Hello!!"][0] == 1.1E10);
            test(ro["Hello!!"][1] == 1.2E10);
            test(ro["Hello!!"][2] == 1.3E10);
            test(ro["Goodbye"].Length == 2);
            test(ro["Goodbye"][0] == 1.4E10);
            test(ro["Goodbye"][1] == 1.5E10);
            test(ro[""].Length == 2);
            test(ro[""][0] == 1.6E10);
            test(ro[""][1] == 1.7E10);
        }

        {
            Dictionary<string, string[]> sdi1 = new Dictionary<string, string[]>();
            Dictionary<string, string[]> sdi2 = new Dictionary<string, string[]>();

            string[] si1 = new string[] { "abc", "de", "fghi" };
            string[] si2 = new string[] { "xyz", "or" };
            string[] si3 = new string[] { "and", "xor" };

            sdi1["abc"] = si1;
            sdi1["def"] = si2;
            sdi2["ghi"] = si3;

            Dictionary<string, string[]> _do;
            Dictionary<string, string[]> ro = p.opStringStringSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do["ghi"].Length == 2);
            test(_do["ghi"][0].Equals("and"));
            test(_do["ghi"][1].Equals("xor"));

            test(ro.Count == 3);
            test(ro["abc"].Length == 3);
            test(ro["abc"][0].Equals("abc"));
            test(ro["abc"][1].Equals("de"));
            test(ro["abc"][2].Equals("fghi"));
            test(ro["def"].Length == 2);
            test(ro["def"][0].Equals("xyz"));
            test(ro["def"][1].Equals("or"));
            test(ro["ghi"].Length == 2);
            test(ro["ghi"][0].Equals("and"));
            test(ro["ghi"][1].Equals("xor"));
        }

        {
            Dictionary<Test.MyEnum, Test.MyEnum[]> sdi1 = new Dictionary<Test.MyEnum, Test.MyEnum[]>();
            Dictionary<Test.MyEnum, Test.MyEnum[]> sdi2 = new Dictionary<Test.MyEnum, Test.MyEnum[]>();

            Test.MyEnum[] si1 = new Test.MyEnum[] { Test.MyEnum.enum1, Test.MyEnum.enum1, Test.MyEnum.enum2 };
            Test.MyEnum[] si2 = new Test.MyEnum[] { Test.MyEnum.enum1, Test.MyEnum.enum2 };
            Test.MyEnum[] si3 = new Test.MyEnum[] { Test.MyEnum.enum3, Test.MyEnum.enum3 };

            sdi1[Test.MyEnum.enum3] = si1;
            sdi1[Test.MyEnum.enum2] = si2;
            sdi2[Test.MyEnum.enum1] = si3;

            Dictionary<Test.MyEnum, Test.MyEnum[]> _do;
            Dictionary<Test.MyEnum, Test.MyEnum[]> ro = p.opMyEnumMyEnumSD(sdi1, sdi2, out _do);

            test(_do.Count == 1);
            test(_do[Test.MyEnum.enum1].Length == 2);
            test(_do[Test.MyEnum.enum1][0] == Test.MyEnum.enum3);
            test(_do[Test.MyEnum.enum1][1] == Test.MyEnum.enum3);
            test(ro.Count == 3);
            test(ro[Test.MyEnum.enum3].Length == 3);
            test(ro[Test.MyEnum.enum3][0] == Test.MyEnum.enum1);
            test(ro[Test.MyEnum.enum3][1] == Test.MyEnum.enum1);
            test(ro[Test.MyEnum.enum3][2] == Test.MyEnum.enum2);
            test(ro[Test.MyEnum.enum2].Length == 2);
            test(ro[Test.MyEnum.enum2][0] == Test.MyEnum.enum1);
            test(ro[Test.MyEnum.enum2][1] == Test.MyEnum.enum2);
            test(ro[Test.MyEnum.enum1].Length == 2);
            test(ro[Test.MyEnum.enum1][0] == Test.MyEnum.enum3);
            test(ro[Test.MyEnum.enum1][1] == Test.MyEnum.enum3);
        }

        {
            int[] lengths = new int[] { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };

            for(int l = 0; l < lengths.Length; ++l)
            {
                int[] s = new int[lengths[l]];
                for(int i = 0; i < lengths[l]; ++i)
                {
                    s[i] = i;
                }

                int[] r = p.opIntS(s);
                test(r.Length == lengths[l]);
                for(int j = 0; j < r.Length; ++j)
                {
                    test(r[j] == -j);
                }
            }
        }

        {
            Dictionary<string, string> ctx = new Dictionary<string, string>();
            ctx["one"] = "ONE";
            ctx["two"] = "TWO";
            ctx["three"] = "THREE";
            {
                test(p.ice_getContext().Count == 0);
                Dictionary<string, string> r = p.opContext();
                test(!r.Equals(ctx));
            }
            {
                Dictionary<string, string> r = p.opContext(ctx);
                test(p.ice_getContext().Count == 0);
                test(Ice.CollectionComparer.Equals(r, ctx));
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                test(Ice.CollectionComparer.Equals(p2.ice_getContext(), ctx));
                Dictionary<string, string> r = p2.opContext();
                test(Ice.CollectionComparer.Equals(r, ctx));
                r = p2.opContext(ctx);
                test(Ice.CollectionComparer.Equals(r, ctx));
            }
        }

        if(p.ice_getConnection() != null)
        {
            //
            // Test implicit context propagation
            //

            String[] impls = {"Shared", "PerThread"};
            for(int i = 0; i < 2; i++)
            {
                Ice.InitializationData initData = new Ice.InitializationData();
                initData.properties = communicator.getProperties().ice_clone_();
                initData.properties.setProperty("Ice.ImplicitContext", impls[i]);

                Ice.Communicator ic = Ice.Util.initialize(initData);

                Dictionary<string, string> ctx = new Dictionary<string, string>();
                ctx["one"] = "ONE";
                ctx["two"] = "TWO";
                ctx["three"] = "THREE";

                Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(
                    ic.stringToProxy("test:default -p 12010"));

                ic.getImplicitContext().setContext(ctx);
                test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx));
                test(Ice.CollectionComparer.Equals(p3.opContext(), ctx));

                test(ic.getImplicitContext().containsKey("zero") == false);
                String r = ic.getImplicitContext().put("zero", "ZERO");
                test(r.Equals(""));
                test(ic.getImplicitContext().get("zero").Equals("ZERO"));

                ctx = ic.getImplicitContext().getContext();
                test(Ice.CollectionComparer.Equals(p3.opContext(), ctx));

                Dictionary<string, string> prxContext = new Dictionary<string, string>();
                prxContext["one"] = "UN";
                prxContext["four"] = "QUATRE";

                Dictionary<string, string> combined = new Dictionary<string, string>(prxContext);
                foreach(KeyValuePair<string, string> e in ctx)
                {
                    try
                    {
                        combined.Add(e.Key, e.Value);
                    }
                    catch(System.ArgumentException)
                    {
                        // Ignore.
                    }
                }
                test(combined["one"].Equals("UN"));

                p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext));

                ic.getImplicitContext().setContext(null);
                test(Ice.CollectionComparer.Equals(p3.opContext(), prxContext));

                ic.getImplicitContext().setContext(ctx);
                test(Ice.CollectionComparer.Equals(p3.opContext(), combined));

                test(ic.getImplicitContext().remove("one").Equals("ONE"));

                if(impls[i].Equals("PerThread"))
                {
                    PerThreadContextInvokeThread thread = new PerThreadContextInvokeThread(
                        Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(null)));
                    thread.Start();
                    thread.Join();
                }
                ic.destroy();
            }
        }

        {
            p.opIdempotent();
        }

        {
            p.opNonmutating();
        }

        {
            test(p.opByte1(0xFF) == 0xFF);
            test(p.opShort1(0x7FFF) == 0x7FFF);
            test(p.opInt1(0x7FFFFFFF) == 0x7FFFFFFF);
            test(p.opLong1(0x7FFFFFFFFFFFFFFF) == 0x7FFFFFFFFFFFFFFF);
            test(p.opFloat1(1.0f) == 1.0f);
            test(p.opDouble1(1.0d) == 1.0d);
            test(p.opString1("opString1").Equals("opString1"));
            test(p.opStringS1(null).Length == 0);
            test(p.opByteBoolD1(null).Count == 0);
            test(p.opStringS2(null).Length == 0);
            test(p.opByteBoolD2(null).Count == 0);

            Test.MyDerivedClassPrx d = Test.MyDerivedClassPrxHelper.uncheckedCast(p);
            Test.MyStruct1 s = new Test.MyStruct1();
            s.tesT = "Test.MyStruct1.s";
            s.myClass = null;
            s.myStruct1 = "Test.MyStruct1.myStruct1";
            s = d.opMyStruct1(s);
            test(s.tesT.Equals("Test.MyStruct1.s"));
            test(s.myClass == null);
            test(s.myStruct1.Equals("Test.MyStruct1.myStruct1"));
            Test.MyClass1 c = new Test.MyClass1();
            c.tesT = "Test.MyClass1.testT";
            c.myClass = null;
            c.myClass1 = "Test.MyClass1.myClass1";
            c = d.opMyClass1(c);
            test(c.tesT.Equals("Test.MyClass1.testT"));
            test(c.myClass == null);
            test(c.myClass1.Equals("Test.MyClass1.myClass1"));
        }
    }
Ejemplo n.º 3
0
    internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        p.ice_ping();

        test(p.ice_isA(Test.MyClass.ice_staticId()));

        test(p.ice_id().Equals(Test.MyDerivedClass.ice_staticId()));

        {
            string[] ids = p.ice_ids();
            test(ids.Length == 3);
            test(ids[0].Equals("::Ice::Object"));
            test(ids[1].Equals("::Test::MyClass"));
            test(ids[2].Equals("::Test::MyDerivedClass"));
        }

        {
            p.opVoid();
        }

        {
            byte b;
            byte r;

            r = p.opByte(0xff, 0x0f, out b);
            test(b == 0xf0);
            test(r == 0xff);
        }

        {
            bool b;
            bool r;

            r = p.opBool(true, false, out b);
            test(b);
            test(!r);
        }

        {
            short s;
            int i;
            long l;
            long r;

            r = p.opShortIntLong(10, 11, 12L, out s, out i, out l);
            test(s == 10);
            test(i == 11);
            test(l == 12);
            test(r == 12L);

            r = p.opShortIntLong(Int16.MinValue, Int32.MinValue, Int64.MinValue, out s, out i, out l);
            test(s == Int16.MinValue);
            test(i == Int32.MinValue);
            test(l == Int64.MinValue);
            test(r == Int64.MinValue);

            r = p.opShortIntLong(Int16.MaxValue, Int32.MaxValue, Int64.MaxValue, out s, out i, out l);
            test(s == Int16.MaxValue);
            test(i == Int32.MaxValue);
            test(l == Int64.MaxValue);
            test(r == Int64.MaxValue);
        }

        {
            float f;
            double d;
            double r;

            r = p.opFloatDouble(3.14f, 1.1e10, out f, out d);
            test(f == 3.14f);
            test(d == 1.1e10);
            test(r == 1.1e10);

            r = p.opFloatDouble(Single.Epsilon, Double.MinValue, out f, out d);
            test(f == Single.Epsilon);
            test(d == Double.MinValue);
            test(r == Double.MinValue);

            r = p.opFloatDouble(Single.MaxValue, Double.MaxValue, out f, out d);
            test(f == Single.MaxValue);
            test(d == Double.MaxValue);
            test(r == Double.MaxValue);
        }

        {
            string s;
            string r;

            r = p.opString("hello", "world", out s);
            test(s.Equals("world hello"));
            test(r.Equals("hello world"));
        }

        {
            Test.MyEnum e;
            Test.MyEnum r;

            r = p.opMyEnum(Test.MyEnum.enum2, out e);
            test(e == Test.MyEnum.enum2);
            test(r == Test.MyEnum.enum3);
        }

        {
            Test.MyClassPrx c1;
            Test.MyClassPrx c2;
            Test.MyClassPrx r;

            r = p.opMyClass(p, out c1, out c2);
            test(Ice.Util.proxyIdentityAndFacetCompare(c1, p) == 0);
            test(Ice.Util.proxyIdentityAndFacetCompare(c2, p) != 0);
            test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0);
            test(c1.ice_getIdentity().Equals(communicator.stringToIdentity("test")));
            test(c2.ice_getIdentity().Equals(communicator.stringToIdentity("noSuchIdentity")));
            test(r.ice_getIdentity().Equals(communicator.stringToIdentity("test")));
            r.opVoid();
            c1.opVoid();
            try
            {
                c2.opVoid();
                test(false);
            }
            catch(Ice.ObjectNotExistException)
            {
            }

            r = p.opMyClass(null, out c1, out c2);
            test(c1 == null);
            test(c2 != null);
            test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0);
            r.opVoid();
        }

        {
            Test.Structure si1 = new Test.Structure();
            si1.p = p;
            si1.e = Test.MyEnum.enum3;
            si1.s = new Test.AnotherStruct();
            si1.s.s = "abc";
            Test.Structure si2 = new Test.Structure();
            si2.p = null;
            si2.e = Test.MyEnum.enum2;
            si2.s = new Test.AnotherStruct();
            si2.s.s = "def";

            Test.Structure so;
            Test.Structure rso = p.opStruct(si1, si2, out so);
            test(rso.p == null);
            test(rso.e == Test.MyEnum.enum2);
            test(rso.s.s.Equals("def"));
            test(so.p.Equals(p));
            test(so.e == Test.MyEnum.enum3);
            test(so.s.s.Equals("a new string"));
            so.p.opVoid();
        }

        {
            byte[] tbsi1 = new byte[] { 0x01, 0x11, 0x12, 0x22 };
            Test.ByteS bsi1 = new Test.ByteS(tbsi1);
            byte[] tbsi2 = new byte[] { 0xf1, 0xf2, 0xf3, 0xf4 };
            Test.ByteS bsi2 = new Test.ByteS(tbsi2);

            Test.ByteS bso;
            Test.ByteS rso;

            rso = p.opByteS(bsi1, bsi2, out bso);
            test(bso.Count == 4);
            test(bso[0] == 0x22);
            test(bso[1] == 0x12);
            test(bso[2] == 0x11);
            test(bso[3] == 0x01);
            test(rso.Count == 8);
            test(rso[0] == 0x01);
            test(rso[1] == 0x11);
            test(rso[2] == 0x12);
            test(rso[3] == 0x22);
            test(rso[4] == 0xf1);
            test(rso[5] == 0xf2);
            test(rso[6] == 0xf3);
            test(rso[7] == 0xf4);
        }

        {
            bool[] tbsi1 = new bool[] { true, true, false };
            Test.BoolS bsi1 = new Test.BoolS(tbsi1);
            bool[] tbsi2 = new bool[] { false };
            Test.BoolS bsi2 = new Test.BoolS(tbsi2);

            Test.BoolS bso;
            Test.BoolS rso;

            rso = p.opBoolS(bsi1, bsi2, out bso);
            test(bso.Count == 4);
            test(bso[0]);
            test(bso[1]);
            test(!bso[2]);
            test(!bso[3]);
            test(rso.Count == 3);
            test(!rso[0]);
            test(rso[1]);
            test(rso[2]);
        }

        {
            short[] tssi = new short[] { 1, 2, 3 };
            Test.ShortS ssi = new Test.ShortS(tssi);
            int[] tisi = new int[] { 5, 6, 7, 8 };
            Test.IntS isi = new Test.IntS(tisi);
            long[] tlsi = new long[] { 10, 30, 20 };
            Test.LongS lsi = new Test.LongS(tlsi);

            Test.ShortS sso;
            Test.IntS iso;
            Test.LongS lso;
            Test.LongS rso;

            rso = p.opShortIntLongS(ssi, isi, lsi, out sso, out iso, out lso);
            test(sso.Count == 3);
            test(sso[0] == 1);
            test(sso[1] == 2);
            test(sso[2] == 3);
            test(iso.Count == 4);
            test(iso[0] == 8);
            test(iso[1] == 7);
            test(iso[2] == 6);
            test(iso[3] == 5);
            test(lso.Count == 6);
            test(lso[0] == 10);
            test(lso[1] == 30);
            test(lso[2] == 20);
            test(lso[3] == 10);
            test(lso[4] == 30);
            test(lso[5] == 20);
            test(rso.Count == 3);
            test(rso[0] == 10);
            test(rso[1] == 30);
            test(rso[2] == 20);
        }

        {
            float[] tfsi = new float[] { 3.14f, 1.11f };
            Test.FloatS fsi = new Test.FloatS(tfsi);
            double[] tdsi = new double[] { 1.1e10, 1.2e10, 1.3e10 };
            Test.DoubleS dsi = new Test.DoubleS(tdsi);

            Test.FloatS fso;
            Test.DoubleS dso;
            Test.DoubleS rso;

            rso = p.opFloatDoubleS(fsi, dsi, out fso, out dso);
            test(fso.Count == 2);
            test(fso[0] == 3.14f);
            test(fso[1] == 1.11f);
            test(dso.Count == 3);
            test(dso[0] == 1.3e10);
            test(dso[1] == 1.2e10);
            test(dso[2] == 1.1e10);
            test(rso.Count == 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);
        }

        {
            string[] tssi1 = new string[] { "abc", "de", "fghi" };
            Test.StringS ssi1 = new Test.StringS(tssi1);
            string[] tssi2 = new string[] { "xyz" };
            Test.StringS ssi2 = new Test.StringS(tssi2);

            Test.StringS sso;
            Test.StringS rso;

            rso = p.opStringS(ssi1, ssi2, out sso);
            test(sso.Count == 4);
            test(sso[0].Equals("abc"));
            test(sso[1].Equals("de"));
            test(sso[2].Equals("fghi"));
            test(sso[3].Equals("xyz"));
            test(rso.Count == 3);
            test(rso[0].Equals("fghi"));
            test(rso[1].Equals("de"));
            test(rso[2].Equals("abc"));
        }

        {
            Test.ByteS s11 = new Test.ByteS(new byte[] { 0x01, 0x11, 0x12 });
            Test.ByteS s12 = new Test.ByteS(new byte[] { 0xff });
            Test.ByteSS bsi1 = new Test.ByteSS(new Test.ByteS[] { s11, s12 });

            Test.ByteS s21 = new Test.ByteS(new byte[] { 0x0e });
            Test.ByteS s22 = new Test.ByteS(new byte[] { 0xf2, 0xf1 });
            Test.ByteSS bsi2 = new Test.ByteSS(new Test.ByteS[] { s21, s22 });

            Test.ByteSS bso;
            Test.ByteSS rso;

            rso = p.opByteSS(bsi1, bsi2, out bso);
            test(bso.Count == 2);
            test(bso[0].Count == 1);
            test(bso[0][0] == 0xff);
            test(bso[1].Count == 3);
            test(bso[1][0] == 0x01);
            test(bso[1][1] == 0x11);
            test(bso[1][2] == 0x12);
            test(rso.Count == 4);
            test(rso[0].Count == 3);
            test(rso[0][0] == 0x01);
            test(rso[0][1] == 0x11);
            test(rso[0][2] == 0x12);
            test(rso[1].Count == 1);
            test(rso[1][0] == 0xff);
            test(rso[2].Count == 1);
            test(rso[2][0] == 0x0e);
            test(rso[3].Count == 2);
            test(rso[3][0] == 0xf2);
            test(rso[3][1] == 0xf1);
        }

        {
            Test.FloatS f11 = new Test.FloatS(new float[] { 3.14f });
            Test.FloatS f12 = new Test.FloatS(new float[] { 1.11f });
            Test.FloatS f13 = new Test.FloatS(new float[] { });
            Test.FloatSS fsi = new Test.FloatSS(new Test.FloatS[] { f11, f12, f13 });

            Test.DoubleS d11 = new Test.DoubleS(new double[] { 1.1e10, 1.2e10, 1.3e10 });
            Test.DoubleSS dsi = new Test.DoubleSS(new Test.DoubleS[] { d11 });

            Test.FloatSS fso;
            Test.DoubleSS dso;
            Test.DoubleSS rso;

            rso = p.opFloatDoubleSS(fsi, dsi, out fso, out dso);
            test(fso.Count == 3);
            test(fso[0].Count == 1);
            test(fso[0][0] == 3.14f);
            test(fso[1].Count == 1);
            test(fso[1][0] == 1.11f);
            test(fso[2].Count == 0);
            test(dso.Count == 1);
            test(dso[0].Count == 3);
            test(dso[0][0] == 1.1e10);
            test(dso[0][1] == 1.2e10);
            test(dso[0][2] == 1.3e10);
            test(rso.Count == 2);
            test(rso[0].Count == 3);
            test(rso[0][0] == 1.1e10);
            test(rso[0][1] == 1.2e10);
            test(rso[0][2] == 1.3e10);
            test(rso[1].Count == 3);
            test(rso[1][0] == 1.1e10);
            test(rso[1][1] == 1.2e10);
            test(rso[1][2] == 1.3e10);
        }

        {
            Test.StringS s11 = new Test.StringS();
            s11.Add("abc");
            Test.StringS s12 = new Test.StringS();
            s12.Add("de");
            s12.Add("fghi");
            Test.StringSS ssi1 = new Test.StringSS();
            ssi1.Add(s11);
            ssi1.Add(s12);

            Test.StringS s21 = new Test.StringS();
            Test.StringS s22 = new Test.StringS();
            Test.StringS s23 = new Test.StringS();
            s23.Add("xyz");
            Test.StringSS ssi2 = new Test.StringSS();
            ssi2.Add(s21);
            ssi2.Add(s22);
            ssi2.Add(s23);

            Test.StringSS sso;
            Test.StringSS rso;

            rso = p.opStringSS(ssi1, ssi2, out sso);
            test(sso.Count == 5);
            test(sso[0].Count == 1);
            test(sso[0][0].Equals("abc"));
            test(sso[1].Count == 2);
            test(sso[1][0].Equals("de"));
            test(sso[1][1].Equals("fghi"));
            test(sso[2].Count == 0);
            test(sso[3].Count == 0);
            test(sso[4].Count == 1);
            test(sso[4][0].Equals("xyz"));
            test(rso.Count == 3);
            test(rso[0].Count == 1);
            test(rso[0][0].Equals("xyz"));
            test(rso[1].Count == 0);
            test(rso[2].Count == 0);
        }

        {
            Test.StringSS[] sssi1 = { new Test.StringSS(), new Test.StringSS() };
            sssi1[0].Add(new Test.StringS());
            sssi1[0].Add(new Test.StringS());
            sssi1[0][0].Add("abc");
            sssi1[0][0].Add("de");
            sssi1[0][1].Add("xyz");
            sssi1[1].Add(new Test.StringS());
            sssi1[1][0].Add("hello");
            Test.StringSS[] sssi2 = { new Test.StringSS(), new Test.StringSS(), new Test.StringSS() };
            sssi2[0].Add(new Test.StringS());
            sssi2[0].Add(new Test.StringS());
            sssi2[0][0].Add("");
            sssi2[0][0].Add("");
            sssi2[0][1].Add("abcd");
            sssi2[1].Add(new Test.StringS());
            sssi2[1][0].Add("");

            Test.StringSS[] ssso;
            Test.StringSS[] rsso = p.opStringSSS(sssi1, sssi2, out ssso);
            test(ssso.Length == 5);
            test(ssso[0].Count == 2);
            test(ssso[0][0].Count == 2);
            test(ssso[0][1].Count == 1);
            test(ssso[1].Count == 1);
            test(ssso[1][0].Count == 1);
            test(ssso[2].Count == 2);
            test(ssso[2][0].Count == 2);
            test(ssso[2][1].Count == 1);
            test(ssso[3].Count == 1);
            test(ssso[3][0].Count == 1);
            test(ssso[4].Count == 0);
            test(ssso[0][0][0].Equals("abc"));
            test(ssso[0][0][1].Equals("de"));
            test(ssso[0][1][0].Equals("xyz"));
            test(ssso[1][0][0].Equals("hello"));
            test(ssso[2][0][0].Equals(""));
            test(ssso[2][0][1].Equals(""));
            test(ssso[2][1][0].Equals("abcd"));
            test(ssso[3][0][0].Equals(""));

            test(rsso.Length == 3);
            test(rsso[0].Count == 0);
            test(rsso[1].Count == 1);
            test(rsso[1][0].Count == 1);
            test(rsso[2].Count == 2);
            test(rsso[2][0].Count == 2);
            test(rsso[2][1].Count == 1);
            test(rsso[1][0][0].Equals(""));
            test(rsso[2][0][0].Equals(""));
            test(rsso[2][0][1].Equals(""));
            test(rsso[2][1][0].Equals("abcd"));
        }

        {
            Dictionary<byte, bool> di1 = new Dictionary<byte, bool>();
            di1[10] = true;
            di1[100] = false;
            Dictionary<byte, bool> di2 = new Dictionary<byte, bool>();
            di2[10] = true;
            di2[11] = false;
            di2[101] = true;

            Dictionary<byte, bool> _do;
            Dictionary<byte, bool> ro = p.opByteBoolD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[10] == true);
            test(ro[11] == false);
            test(ro[100] == false);
            test(ro[101] == true);
        }

        {
            Dictionary<short, int> di1 = new Dictionary<short, int>();
            di1[110] = -1;
            di1[1100] = 123123;
            Dictionary<short, int> di2 = new Dictionary<short, int>();
            di2[110] = -1;
            di2[111] = -100;
            di2[1101] = 0;

            Dictionary<short, int> _do;
            Dictionary<short, int> ro = p.opShortIntD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[110] == -1);
            test(ro[111] == -100);
            test(ro[1100] == 123123);
            test(ro[1101] == 0);
        }

        {
            Dictionary<long, float> di1 = new Dictionary<long, float>();
            di1[999999110L] = -1.1f;
            di1[999999111L] = 123123.2f;
            Dictionary<long, float> di2 = new Dictionary<long, float>();
            di2[999999110L] = -1.1f;
            di2[999999120L] = -100.4f;
            di2[999999130L] = 0.5f;

            Dictionary<long, float> _do;
            Dictionary<long, float> ro = p.opLongFloatD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[999999110L] == -1.1f);
            test(ro[999999120L] == -100.4f);
            test(ro[999999111L] == 123123.2f);
            test(ro[999999130L] == 0.5f);
        }

        {
            Dictionary<string, string> di1 = new Dictionary<string, string>();
            di1["foo"] = "abc -1.1";
            di1["bar"] = "abc 123123.2";
            Dictionary<string, string> di2 = new Dictionary<string, string>();
            di2["foo"] = "abc -1.1";
            di2["FOO"] = "abc -100.4";
            di2["BAR"] = "abc 0.5";

            Dictionary<string, string> _do;
            Dictionary<string, string> ro = p.opStringStringD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro["foo"].Equals("abc -1.1"));
            test(ro["FOO"].Equals("abc -100.4"));
            test(ro["bar"].Equals("abc 123123.2"));
            test(ro["BAR"].Equals("abc 0.5"));
        }

        {
            Dictionary<string, Test.MyEnum> di1 = new Dictionary<string, Test.MyEnum>();
            di1["abc"] = Test.MyEnum.enum1;
            di1[""] = Test.MyEnum.enum2;
            Dictionary<string, Test.MyEnum> di2 = new Dictionary<string, Test.MyEnum>();
            di2["abc"] = Test.MyEnum.enum1;
            di2["qwerty"] = Test.MyEnum.enum3;
            di2["Hello!!"] = Test.MyEnum.enum2;

            Dictionary<string, Test.MyEnum> _do;
            Dictionary<string, Test.MyEnum> ro = p.opStringMyEnumD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro["abc"] == Test.MyEnum.enum1);
            test(ro["qwerty"] == Test.MyEnum.enum3);
            test(ro[""] == Test.MyEnum.enum2);
            test(ro["Hello!!"] == Test.MyEnum.enum2);
        }

        {
            Dictionary<Test.MyEnum, string> di1 = new Dictionary<Test.MyEnum, string>();
            di1[Test.MyEnum.enum1] = "abc";
            Dictionary<Test.MyEnum, string> di2 = new Dictionary<Test.MyEnum, string>();
            di2[Test.MyEnum.enum2] = "Hello!!";
            di2[Test.MyEnum.enum3] = "qwerty";

            Dictionary<Test.MyEnum, string> _do;
            Dictionary<Test.MyEnum, string> ro = p.opMyEnumStringD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 3);
            test(ro[Test.MyEnum.enum1].Equals("abc"));
            test(ro[Test.MyEnum.enum2].Equals("Hello!!"));
            test(ro[Test.MyEnum.enum3].Equals("qwerty"));
        }

        {
            Test.MyStruct s11 = new Test.MyStruct(1, 1);
            Test.MyStruct s12 = new Test.MyStruct(1, 2);
            Dictionary<Test.MyStruct, Test.MyEnum> di1 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di1[s11] = Test.MyEnum.enum1;
            di1[s12] = Test.MyEnum.enum2;

            Test.MyStruct s22 = new Test.MyStruct(2, 2);
            Test.MyStruct s23 = new Test.MyStruct(2, 3);
            Dictionary<Test.MyStruct, Test.MyEnum> di2 = new Dictionary<Test.MyStruct, Test.MyEnum>();
            di2[s11] = Test.MyEnum.enum1;
            di2[s22] = Test.MyEnum.enum3;
            di2[s23] = Test.MyEnum.enum2;

            Dictionary<Test.MyStruct, Test.MyEnum> _do;
            Dictionary<Test.MyStruct, Test.MyEnum> ro = p.opMyStructMyEnumD(di1, di2, out _do);

            test(Ice.CollectionComparer.Equals(_do, di1));
            test(ro.Count == 4);
            test(ro[s11] == Test.MyEnum.enum1);
            test(ro[s12] == Test.MyEnum.enum2);
            test(ro[s22] == Test.MyEnum.enum3);
            test(ro[s23] == Test.MyEnum.enum2);
        }

        {
            int[] lengths = new int[] { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };

            for(int l = 0; l < lengths.Length; ++l)
            {
                Test.IntS s = new Test.IntS();
                for(int i = 0; i < lengths[l]; ++i)
                {
                    s.Add(i);
                }
                Test.IntS r = p.opIntS(s);
                test(r.Count == lengths[l]);
                for(int j = 0; j < r.Count; ++j)
                {
                    test(r[j] == -j);
                }
            }
        }

        {
            Dictionary<string, string> ctx = new Dictionary<string, string>();
            ctx["one"] = "ONE";
            ctx["two"] = "TWO";
            ctx["three"] = "THREE";
            {
                test(p.ice_getContext().Count == 0);
                Dictionary<string, string> r = p.opContext();
                test(!r.Equals(ctx));
            }
            {
                Dictionary<string, string> r = p.opContext(ctx);
                test(p.ice_getContext().Count == 0);
                test(Ice.CollectionComparer.Equals(r, ctx));
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                test(Ice.CollectionComparer.Equals(p2.ice_getContext(), ctx));
                Dictionary<string, string> r = p2.opContext();
                test(Ice.CollectionComparer.Equals(r, ctx));
                r = p2.opContext(ctx);
                test(Ice.CollectionComparer.Equals(r, ctx));
            }
        }
        {
            //
            // Test implicit context propagation
            //

            String[] impls = {"Shared", "PerThread"};
            for(int i = 0; i < 2; i++)
            {
                Ice.InitializationData initData = new Ice.InitializationData();
                initData.properties = communicator.getProperties().ice_clone_();
                initData.properties.setProperty("Ice.ImplicitContext", impls[i]);

                Ice.Communicator ic = Ice.Util.initialize(initData);

                Dictionary<string, string> ctx = new Dictionary<string, string>();
                ctx["one"] = "ONE";
                ctx["two"] = "TWO";
                ctx["three"] = "THREE";

                Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(
                    ic.stringToProxy("test:default -p 12010"));

                ic.getImplicitContext().setContext(ctx);
                test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx));
                test(Ice.CollectionComparer.Equals(p3.opContext(), ctx));

                test(ic.getImplicitContext().containsKey("zero") == false);
                String r = ic.getImplicitContext().put("zero", "ZERO");
                test(r.Equals(""));
                test(ic.getImplicitContext().get("zero").Equals("ZERO"));

                ctx = ic.getImplicitContext().getContext();
                test(Ice.CollectionComparer.Equals(p3.opContext(), ctx));

                Dictionary<string, string> prxContext = new Dictionary<string, string>();
                prxContext["one"] = "UN";
                prxContext["four"] = "QUATRE";

                Dictionary<string, string> combined = new Dictionary<string, string>(prxContext);
                foreach(KeyValuePair<string, string> e in ctx)
                {
                    try
                    {
                        combined.Add(e.Key, e.Value);
                    }
                    catch(System.ArgumentException)
                    {
                        // Ignore.
                    }
                }
                test(combined["one"].Equals("UN"));

                p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext));

                ic.getImplicitContext().setContext(null);
                test(Ice.CollectionComparer.Equals(p3.opContext(), prxContext));

                ic.getImplicitContext().setContext(ctx);
                test(Ice.CollectionComparer.Equals(p3.opContext(), combined));

                test(ic.getImplicitContext().remove("one").Equals("ONE"));

                if(impls[i].Equals("PerThread"))
                {
                    PerThreadContextInvokeThread thread = new PerThreadContextInvokeThread(
                        Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(null)));
                    thread.Start();
                    thread.Join();
                }
                ic.destroy();
            }
        }

        {
            p.opIdempotent();
        }

        {
            p.opNonmutating();
        }
    }
Ejemplo n.º 4
0
        public void opMyClass(Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2)
        {
            test(c1.ice_getIdentity().Equals(_communicator.stringToIdentity("test")));
            test(c2.ice_getIdentity().Equals(_communicator.stringToIdentity("noSuchIdentity")));
            test(r.ice_getIdentity().Equals(_communicator.stringToIdentity("test")));

            //
            // We can't do the callbacks below in connection serialization mode.
            //
            if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
            {
                r.opVoid();
                c1.opVoid();
                try
                {
                    c2.opVoid();
                    test(false);
                }
                catch(Ice.ObjectNotExistException)
                {
                }
            }
            called();
        }