예제 #1
0
 public Test.Structure opStruct(Test.Structure p1, Test.Structure p2,
                                out Test.Structure p3, Ice.Current current)
 {
     p3     = p1;
     p3.s.s = "a new string";
     return(p2);
 }
예제 #2
0
        opStructAsync(Test.Structure p1, Test.Structure p2, Current current)
        {
            var p3 = p1;

            p3.s.s = "a new string";
            return(Task.FromResult(new Test.IMyClass.OpStructReturnValue(p2, p3)));
        }
예제 #3
0
 public override void opStruct_async(Test.AMD_MyClass_opStruct cb, Test.Structure p1, Test.Structure p2,
                                     Ice.Current current)
 {
     Test.Structure p3 = p1;
     p3.s.s = "a new string";
     cb.ice_response(p2, p3);
 }
예제 #4
0
                    opStructAsync(Test.Structure p1, Test.Structure p2, Ice.Current current)
                    {
                        var p3 = p1;

                        p3.s.s = "a new string";
                        return(Task.FromResult(new Test.MyClass_OpStructResult(p2, p3)));
                    }
예제 #5
0
            opStruct(Test.Structure p1, Test.Structure p2, Current current)
            {
                var p3 = p1;

                p3.s.s = "a new string";
                return(new Test.MyClass.OpStructReturnValue(p2, p3));
            }
예제 #6
0
 public override void ice_response(Test.Structure rso, Test.Structure so)
 {
     test(rso.p == null);
     test(rso.e == Test.MyEnum.enum2);
     test(rso.s.s.Equals("def"));
     test(so.e == Test.MyEnum.enum3);
     test(so.s.s.Equals("a new string"));
     // We can't do the callbacks below in thread per connection mode.
     if (_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
     {
         so.p.opVoid();
     }
     callback.called();
 }
예제 #7
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();
        }
    }
예제 #8
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();
        }
    }
예제 #9
0
    internal static void twowaysNewAMI(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            Ice.AsyncResult r = p.begin_ice_ping();
            p.end_ice_ping(r);
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ping().whenCompleted(cb.ice_ping, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_isA(Test.MyClass.ice_staticId());
            test(p.end_ice_isA(r));
        }

        {
            Callback cb = new Callback();
            p.begin_ice_isA(Test.MyClass.ice_staticId()).whenCompleted(cb.ice_isA, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_ids();
            test(p.end_ice_ids(r).Length == 3);
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ids().whenCompleted(cb.ice_ids, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_id();
            test(p.end_ice_id(r).Equals(Test.MyDerivedClass.ice_staticId()));
        }

        {
            Callback cb = new Callback();
            p.begin_ice_id().whenCompleted(cb.ice_id, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opVoid();
            p.end_opVoid(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opVoid().whenCompleted(cb.opVoid, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opByte(0xff, 0x0f);
            byte            p3;
            byte            ret = p.end_opByte(out p3, r);
            test(p3 == 0xf0);
            test(ret == 0xff);
        }

        {
            Callback cb = new Callback();
            p.begin_opByte(0xff, 0x0f).whenCompleted(cb.opByte, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opBool(true, false).whenCompleted(cb.opBool, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opShortIntLong(10, 11, 12).whenCompleted(cb.opShortIntLong, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opFloatDouble(3.14f, 1.1E10).whenCompleted(cb.opFloatDouble, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opString("hello", "world").whenCompleted(cb.opString, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opMyEnum(Test.MyEnum.enum2).whenCompleted(cb.opMyEnum, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback(communicator);
            p.begin_opMyClass(p).whenCompleted(cb.opMyClass, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback(communicator);
            p.begin_opStruct(si1, si2).whenCompleted(cb.opStruct, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opByteS(bsi1, bsi2).whenCompleted(cb.opByteS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opBoolS(bsi1, bsi2).whenCompleted(cb.opBoolS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opShortIntLongS(ssi, isi, lsi).whenCompleted(cb.opShortIntLongS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opFloatDoubleS(fsi, dsi).whenCompleted(cb.opFloatDoubleS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opStringS(ssi1, ssi2).whenCompleted(cb.opStringS, cb.exCB);
            cb.check();
        }

        {
            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 });

            Callback cb = new Callback();
            p.begin_opByteSS(bsi1, bsi2).whenCompleted(cb.opByteSS, cb.exCB);
            cb.check();
        }

        {
            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 });

            Callback cb = new Callback();
            p.begin_opFloatDoubleSS(fsi, dsi).whenCompleted(cb.opFloatDoubleSS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opStringSS(ssi1, ssi2).whenCompleted(cb.opStringSS, cb.exCB);
            cb.check();
        }

        {
            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("");

            Callback cb = new Callback();
            p.begin_opStringSSS(sssi1, sssi2).whenCompleted(cb.opStringSSS, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opByteBoolD(di1, di2).whenCompleted(cb.opByteBoolD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opShortIntD(di1, di2).whenCompleted(cb.opShortIntD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opLongFloatD(di1, di2).whenCompleted(cb.opLongFloatD, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opStringStringD(di1, di2).whenCompleted(cb.opStringStringD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opStringMyEnumD(di1, di2).whenCompleted(cb.opStringMyEnumD, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opMyEnumStringD(di1, di2).whenCompleted(cb.opMyEnumStringD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opMyStructMyEnumD(di1, di2).whenCompleted(cb.opMyStructMyEnumD, cb.exCB);
            cb.check();
        }

        {
            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);
                }

                Callback cb = new Callback(lengths[l]);
                p.begin_opIntS(s).whenCompleted(cb.opIntS, cb.exCB);
                cb.check();
            }
        }

        {
            Dictionary <string, string> ctx = new Dictionary <string, string>();
            ctx["one"]   = "ONE";
            ctx["two"]   = "TWO";
            ctx["three"] = "THREE";
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext().whenCompleted(cb.opContextNotEqual, cb.exCB);
                cb.check();
            }
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext(ctx).whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                test(Ice.CollectionComparer.Equals(p2.ice_getContext(), ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext().whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                Callback        cb = new Callback(ctx);
                p2.begin_opContext(ctx).whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
        }

        {
            //
            // 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));
                {
                    Ice.AsyncResult             r = p3.begin_opContext();
                    Dictionary <string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, ctx));
                }

                ic.getImplicitContext().put("zero", "ZERO");

                ctx = ic.getImplicitContext().getContext();
                {
                    Ice.AsyncResult             r = p3.begin_opContext();
                    Dictionary <string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, ctx));
                }

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

                Dictionary <string, string> combined = 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(p.ice_context(prxContext));

                ic.getImplicitContext().setContext(null);
                {
                    Ice.AsyncResult             r = p3.begin_opContext();
                    Dictionary <string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, prxContext));
                }

                ic.getImplicitContext().setContext(ctx);
                {
                    Ice.AsyncResult             r = p3.begin_opContext();
                    Dictionary <string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, combined));
                }

                //ic.getImplicitContext().setContext(null);
                ic.destroy();
            }
        }

        {
            Ice.AsyncResult r = p.begin_opIdempotent();
            p.end_opIdempotent(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opIdempotent().whenCompleted(cb.opIdempotent, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opNonmutating();
            p.end_opNonmutating(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opNonmutating().whenCompleted(cb.opNonmutating, cb.exCB);
            cb.check();
        }

        {
            Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
            test(derived != null);
            Callback cb = new Callback();
            derived.begin_opDerived().whenCompleted(cb.opDerived, cb.exCB);
            cb.check();
        }
    }
예제 #10
0
    internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            Ice.AsyncResult r = p.begin_ice_ping();
            p.end_ice_ping(r);
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ping().whenCompleted(cb.ice_ping, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ping().whenCompleted(
                () =>
                {
                    cb.ice_ping();
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_isA(Test.MyClass.ice_staticId());
            test(p.end_ice_isA(r));
        }

        {
            Callback cb = new Callback();
            p.begin_ice_isA(Test.MyClass.ice_staticId()).whenCompleted(cb.ice_isA, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_ice_isA(Test.MyClass.ice_staticId()).whenCompleted(
                (bool v) =>
                {
                    cb.ice_isA(v);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_ids();
            test(p.end_ice_ids(r).Length == 3);
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ids().whenCompleted(cb.ice_ids, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ids().whenCompleted(
                (string[] ids) =>
                {
                    cb.ice_ids(ids);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_id();
            test(p.end_ice_id(r).Equals(Test.MyDerivedClass.ice_staticId()));
        }

        {
            Callback cb = new Callback();
            p.begin_ice_id().whenCompleted(cb.ice_id, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_ice_id().whenCompleted(
                (string id) =>
                {
                    cb.ice_id(id);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opVoid();
            p.end_opVoid(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opVoid().whenCompleted(cb.opVoid, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opVoid().whenCompleted(
                () =>
                {
                    cb.opVoid();
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opByte(0xff, 0x0f);
            byte p3;
            byte ret = p.end_opByte(out p3, r);
            test(p3 == 0xf0);
            test(ret == 0xff);
        }

        {
            Callback cb = new Callback();
            p.begin_opByte(0xff, 0x0f).whenCompleted(cb.opByte, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opByte(0xff, 0x0f).whenCompleted(
                (byte r, byte b) =>
                {
                    cb.opByte(r, b);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opBool(true, false).whenCompleted(cb.opBool, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opBool(true, false).whenCompleted(
                (bool r, bool b) =>
                {
                    cb.opBool(r, b);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opShortIntLong(10, 11, 12).whenCompleted(cb.opShortIntLong, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opShortIntLong(10, 11, 12).whenCompleted(
                (long r, short s, int i, long l) =>
                {
                    cb.opShortIntLong(r, s, i, l);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opFloatDouble(3.14f, 1.1E10).whenCompleted(cb.opFloatDouble, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opFloatDouble(3.14f, 1.1E10).whenCompleted(
                (double r, float f, double d) =>
                {
                    cb.opFloatDouble(r, f, d);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opString("hello", "world").whenCompleted(cb.opString, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opString("hello", "world").whenCompleted(
                (string r, string s) =>
                {
                    cb.opString(r, s);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opMyEnum(Test.MyEnum.enum2).whenCompleted(cb.opMyEnum, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opMyEnum(Test.MyEnum.enum2).whenCompleted(
                (Test.MyEnum r, Test.MyEnum e) =>
                {
                    cb.opMyEnum(r, e);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Callback cb = new Callback(communicator);
            p.begin_opMyClass(p).whenCompleted(cb.opMyClass, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback(communicator);
            p.begin_opMyClass(p).whenCompleted(
                (Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2) =>
                {
                    cb.opMyClass(r, c1, c2);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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";

            Callback cb = new Callback(communicator);
            p.begin_opStruct(si1, si2).whenCompleted(cb.opStruct, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback(communicator);
            p.begin_opStruct(si1, si2).whenCompleted(
                (Test.Structure rso, Test.Structure so) =>
                {
                    cb.opStruct(rso, so);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opByteS(bsi1, bsi2).whenCompleted(cb.opByteS, cb.exCB);
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opByteS(bsi1, bsi2).whenCompleted(
                (byte[] rso, byte[] bso) =>
                {
                    cb.opByteS(rso, bso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opBoolS(bsi1, bsi2).whenCompleted(cb.opBoolS, cb.exCB);
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opBoolS(bsi1, bsi2).whenCompleted(
                (bool[] rso, bool[] bso) =>
                {
                    cb.opBoolS(rso, bso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opShortIntLongS(ssi, isi, lsi).whenCompleted(cb.opShortIntLongS, cb.exCB);
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opShortIntLongS(ssi, isi, lsi).whenCompleted(
                (long[] rso, short[] sso, int[] iso, long[] lso) =>
                {
                    cb.opShortIntLongS(rso, sso, iso, lso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opFloatDoubleS(fsi, dsi).whenCompleted(cb.opFloatDoubleS, cb.exCB);
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opFloatDoubleS(fsi, dsi).whenCompleted(
                (double[] rso, float[] fso, double[] dso) =>
                {
                    cb.opFloatDoubleS(rso, fso, dso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opStringS(ssi1, ssi2).whenCompleted(cb.opStringS, cb.exCB);
            cb.check();
        }

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

            Callback cb = new Callback();
            p.begin_opStringS(ssi1, ssi2).whenCompleted(
                (string[] rso, string[] sso) =>
                {
                    cb.opStringS(rso, sso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opByteSS(bsi1, bsi2).whenCompleted(cb.opByteSS, cb.exCB);
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opByteSS(bsi1, bsi2).whenCompleted(
                (byte[][] rso, byte[][] bso) =>
                {
                    cb.opByteSS(rso, bso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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};

            Callback cb = new Callback();
            p.begin_opBoolSS(bsi1, bsi2).whenCompleted(cb.opBoolSS, cb.exCB);
            cb.check();
        }

        {
            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};

            Callback cb = new Callback();
            p.begin_opBoolSS(bsi1, bsi2).whenCompleted(
                (bool[][] rso, bool[][] bso) =>
                {
                    cb.opBoolSS(rso, bso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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};

            Callback cb = new Callback();
            p.begin_opShortIntLongSS(ssi, isi, lsi).whenCompleted(cb.opShortIntLongSS, cb.exCB);
            cb.check();
        }

        {
            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};

            Callback cb = new Callback();
            p.begin_opShortIntLongSS(ssi, isi, lsi).whenCompleted(
                (long[][] rso, short[][] sso, int[][] iso, long[][] lso) =>
                {
                    cb.opShortIntLongSS(rso, sso, iso, lso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opFloatDoubleSS(fsi, dsi).whenCompleted(cb.opFloatDoubleSS, cb.exCB);
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opFloatDoubleSS(fsi, dsi).whenCompleted(
                (double[][] rso, float[][] fso, double[][] dso) =>
                {
                    cb.opFloatDoubleSS(rso, fso, dso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opStringSS(ssi1, ssi2).whenCompleted(cb.opStringSS, cb.exCB);
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opStringSS(ssi1, ssi2).whenCompleted(
                (string[][] rso, string[][] sso) =>
                {
                    cb.opStringSS(rso, sso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opStringSSS(sssi1, sssi2).whenCompleted(cb.opStringSSS, cb.exCB);
            cb.check();
        }

        {
            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 };

            Callback cb = new Callback();
            p.begin_opStringSSS(sssi1, sssi2).whenCompleted(
                (string[][][] rsso, string[][][] ssso) =>
                {
                    cb.opStringSSS(rsso, ssso);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opByteBoolD(di1, di2).whenCompleted(cb.opByteBoolD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opByteBoolD(di1, di2).whenCompleted(
                (Dictionary<byte, bool> ro, Dictionary<byte, bool> _do) =>
                {
                    cb.opByteBoolD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opShortIntD(di1, di2).whenCompleted(cb.opShortIntD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opShortIntD(di1, di2).whenCompleted(
                (Dictionary<short, int> ro, Dictionary<short, int> _do) =>
                {
                    cb.opShortIntD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opLongFloatD(di1, di2).whenCompleted(cb.opLongFloatD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opLongFloatD(di1, di2).whenCompleted(
                (Dictionary<long, float> ro, Dictionary<long, float> _do) =>
                {
                    cb.opLongFloatD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opStringStringD(di1, di2).whenCompleted(cb.opStringStringD, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opStringStringD(di1, di2).whenCompleted(
                (Dictionary<string, string> ro, Dictionary<string, string> _do) =>
                {
                    cb.opStringStringD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opStringMyEnumD(di1, di2).whenCompleted(cb.opStringMyEnumD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opStringMyEnumD(di1, di2).whenCompleted(
                (Dictionary<string, Test.MyEnum> ro, Dictionary<string, Test.MyEnum> _do) =>
                {
                    cb.opStringMyEnumD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opMyEnumStringD(di1, di2).whenCompleted(cb.opMyEnumStringD, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opMyEnumStringD(di1, di2).whenCompleted(
                (Dictionary<Test.MyEnum, string> ro, Dictionary<Test.MyEnum, string> _do) =>
                {
                    cb.opMyEnumStringD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opMyStructMyEnumD(di1, di2).whenCompleted(cb.opMyStructMyEnumD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opMyStructMyEnumD(di1, di2).whenCompleted(
                (Dictionary<Test.MyStruct, Test.MyEnum> ro,
                 Dictionary<Test.MyStruct, Test.MyEnum> _do) =>
                {
                    cb.opMyStructMyEnumD(ro, _do);
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            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;
                }

                Callback cb = new Callback(lengths[l]);
                p.begin_opIntS(s).whenCompleted(cb.opIntS, cb.exCB);
                cb.check();
            }
        }

        {
            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;
                }

                Callback cb = new Callback(lengths[l]);
                p.begin_opIntS(s).whenCompleted(
                    (int[] r) =>
                    {
                        cb.opIntS(r);
                    },
                    (Ice.Exception ex) =>
                    {
                         cb.exCB(ex);
                    });
                cb.check();
            }
        }

        {
            Dictionary<string, string> ctx = new Dictionary<string, string>();
            ctx["one"] = "ONE";
            ctx["two"] = "TWO";
            ctx["three"] = "THREE";
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext().whenCompleted(cb.opContextNotEqual, cb.exCB);
                cb.check();
            }
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext(ctx).whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                test(Ice.CollectionComparer.Equals(p2.ice_getContext(), ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext().whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext(ctx).whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
        }

        {
            Dictionary<string, string> ctx = new Dictionary<string, string>();
            ctx["one"] = "ONE";
            ctx["two"] = "TWO";
            ctx["three"] = "THREE";
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext().whenCompleted(
                    (Dictionary<string, string> r) =>
                    {
                        cb.opContextNotEqual(r);
                    },
                    (Ice.Exception ex) =>
                    {
                         cb.exCB(ex);
                    });
                cb.check();
            }
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext(ctx).whenCompleted(
                    (Dictionary<string, string> r) =>
                    {
                        cb.opContextEqual(r);
                    },
                    (Ice.Exception ex) =>
                    {
                         cb.exCB(ex);
                    });
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                test(Ice.CollectionComparer.Equals(p2.ice_getContext(), ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext().whenCompleted(
                    (Dictionary<string, string> r) =>
                    {
                        cb.opContextEqual(r);
                    },
                    (Ice.Exception ex) =>
                    {
                         cb.exCB(ex);
                    });
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext(ctx).whenCompleted(
                    (Dictionary<string, string> r) =>
                    {
                        cb.opContextEqual(r);
                    },
                    (Ice.Exception ex) =>
                    {
                         cb.exCB(ex);
                    });
                cb.check();
            }
        }

        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));
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, ctx));
                }

                ic.getImplicitContext().put("zero", "ZERO");

                ctx = ic.getImplicitContext().getContext();
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, ctx));
                }

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

                Dictionary<string, string> combined = 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(p.ice_context(prxContext));

                ic.getImplicitContext().setContext(null);
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, prxContext));
                }

                ic.getImplicitContext().setContext(ctx);
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, combined));
                }

                //ic.getImplicitContext().setContext(null);
                ic.destroy();
            }
        }

        {
            Ice.AsyncResult r = p.begin_opIdempotent();
            p.end_opIdempotent(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opIdempotent().whenCompleted(cb.opIdempotent, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opIdempotent().whenCompleted(
                () =>
                {
                    cb.opIdempotent();
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opNonmutating();
            p.end_opNonmutating(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opNonmutating().whenCompleted(cb.opNonmutating, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opNonmutating().whenCompleted(
                () =>
                {
                    cb.opNonmutating();
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }

        {
            Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
            test(derived != null);
            Callback cb = new Callback();
            derived.begin_opDerived().whenCompleted(cb.opDerived, cb.exCB);
            cb.check();
        }

        {
            Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
            test(derived != null);
            Callback cb = new Callback();
            derived.begin_opDerived().whenCompleted(
                () =>
                {
                    cb.opDerived();
                },
                (Ice.Exception ex) =>
                {
                     cb.exCB(ex);
                });
            cb.check();
        }
    }
예제 #11
0
                    opMStruct2Async(Test.Structure p1, Ice.Current current)
                    {
                        await Task.Delay(0);

                        return(new Test.MyClass_OpMStruct2MarshaledResult(p1, p1, current));
                    }
예제 #12
0
 public Test.IMyClass.OpMStruct2MarshaledReturnValue opMStruct2(Test.Structure p1, Current current) =>
 new Test.IMyClass.OpMStruct2MarshaledReturnValue(p1, p1, current);
예제 #13
0
 public Test.MyClass_OpMStruct2MarshaledResult opMStruct2(Test.Structure p1, Ice.Current current)
 {
     return(new Test.MyClass_OpMStruct2MarshaledResult(p1, p1, current));
 }
예제 #14
0
                opMStruct2Async(Test.Structure p1, Current current)
                {
                    await Task.Delay(0);

                    return(new Test.MyClass.OpMStruct2MarshaledReturnValue(p1, p1, current));
                }
예제 #15
0
    internal static void twowaysNewAMI(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            Ice.AsyncResult r = p.begin_ice_ping();
            p.end_ice_ping(r);
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ping().whenCompleted(cb.ice_ping, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_isA(Test.MyClass.ice_staticId());
            test(p.end_ice_isA(r));
        }

        {
            Callback cb = new Callback();
            p.begin_ice_isA(Test.MyClass.ice_staticId()).whenCompleted(cb.ice_isA, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_ids();
            test(p.end_ice_ids(r).Length == 3);
        }

        {
            Callback cb = new Callback();
            p.begin_ice_ids().whenCompleted(cb.ice_ids, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_ice_id();
            test(p.end_ice_id(r).Equals(Test.MyDerivedClass.ice_staticId()));
        }

        {
            Callback cb = new Callback();
            p.begin_ice_id().whenCompleted(cb.ice_id, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opVoid();
            p.end_opVoid(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opVoid().whenCompleted(cb.opVoid, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opByte(0xff, 0x0f);
            byte p3;
            byte ret = p.end_opByte(out p3, r);
            test(p3 == 0xf0);
            test(ret == 0xff);
        }

        {
            Callback cb = new Callback();
            p.begin_opByte(0xff, 0x0f).whenCompleted(cb.opByte, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opBool(true, false).whenCompleted(cb.opBool, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opShortIntLong(10, 11, 12).whenCompleted(cb.opShortIntLong, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opFloatDouble(3.14f, 1.1E10).whenCompleted(cb.opFloatDouble, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opString("hello", "world").whenCompleted(cb.opString, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback();
            p.begin_opMyEnum(Test.MyEnum.enum2).whenCompleted(cb.opMyEnum, cb.exCB);
            cb.check();
        }

        {
            Callback cb = new Callback(communicator);
            p.begin_opMyClass(p).whenCompleted(cb.opMyClass, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback(communicator);
            p.begin_opStruct(si1, si2).whenCompleted(cb.opStruct, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opByteS(bsi1, bsi2).whenCompleted(cb.opByteS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opBoolS(bsi1, bsi2).whenCompleted(cb.opBoolS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opShortIntLongS(ssi, isi, lsi).whenCompleted(cb.opShortIntLongS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opFloatDoubleS(fsi, dsi).whenCompleted(cb.opFloatDoubleS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opStringS(ssi1, ssi2).whenCompleted(cb.opStringS, cb.exCB);
            cb.check();
        }

        {
            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 });

            Callback cb = new Callback();
            p.begin_opByteSS(bsi1, bsi2).whenCompleted(cb.opByteSS, cb.exCB);
            cb.check();
        }

        {
            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 });

            Callback cb = new Callback();
            p.begin_opFloatDoubleSS(fsi, dsi).whenCompleted(cb.opFloatDoubleSS, cb.exCB);
            cb.check();
        }

        {
            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);

            Callback cb = new Callback();
            p.begin_opStringSS(ssi1, ssi2).whenCompleted(cb.opStringSS, cb.exCB);
            cb.check();
        }

        {
            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("");

            Callback cb = new Callback();
            p.begin_opStringSSS(sssi1, sssi2).whenCompleted(cb.opStringSSS, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opByteBoolD(di1, di2).whenCompleted(cb.opByteBoolD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opShortIntD(di1, di2).whenCompleted(cb.opShortIntD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opLongFloatD(di1, di2).whenCompleted(cb.opLongFloatD, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opStringStringD(di1, di2).whenCompleted(cb.opStringStringD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opStringMyEnumD(di1, di2).whenCompleted(cb.opStringMyEnumD, cb.exCB);
            cb.check();
        }

        {
            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";

            Callback cb = new Callback();
            p.begin_opMyEnumStringD(di1, di2).whenCompleted(cb.opMyEnumStringD, cb.exCB);
            cb.check();
        }

        {
            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;

            Callback cb = new Callback();
            p.begin_opMyStructMyEnumD(di1, di2).whenCompleted(cb.opMyStructMyEnumD, cb.exCB);
            cb.check();
        }

        {
            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);
                }

                Callback cb = new Callback(lengths[l]);
                p.begin_opIntS(s).whenCompleted(cb.opIntS, cb.exCB);
                cb.check();
            }
        }

        {
            Dictionary<string, string> ctx = new Dictionary<string, string>();
            ctx["one"] = "ONE";
            ctx["two"] = "TWO";
            ctx["three"] = "THREE";
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext().whenCompleted(cb.opContextNotEqual, cb.exCB);
                cb.check();
            }
            {
                test(p.ice_getContext().Count == 0);
                Callback cb = new Callback(ctx);
                p.begin_opContext(ctx).whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                test(Ice.CollectionComparer.Equals(p2.ice_getContext(), ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext().whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
            {
                Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
                Callback cb = new Callback(ctx);
                p2.begin_opContext(ctx).whenCompleted(cb.opContextEqual, cb.exCB);
                cb.check();
            }
        }

        {
            //
            // 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));
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, ctx));
                }

                ic.getImplicitContext().put("zero", "ZERO");

                ctx = ic.getImplicitContext().getContext();
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, ctx));
                }

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

                Dictionary<string, string> combined = 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(p.ice_context(prxContext));

                ic.getImplicitContext().setContext(null);
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, prxContext));
                }

                ic.getImplicitContext().setContext(ctx);
                {
                    Ice.AsyncResult r = p3.begin_opContext();
                    Dictionary<string, string> c = p3.end_opContext(r);
                    test(Ice.CollectionComparer.Equals(c, combined));
                }

                //ic.getImplicitContext().setContext(null);
                ic.destroy();
            }
        }

        {
            Ice.AsyncResult r = p.begin_opIdempotent();
            p.end_opIdempotent(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opIdempotent().whenCompleted(cb.opIdempotent, cb.exCB);
            cb.check();
        }

        {
            Ice.AsyncResult r = p.begin_opNonmutating();
            p.end_opNonmutating(r);
        }

        {
            Callback cb = new Callback();
            p.begin_opNonmutating().whenCompleted(cb.opNonmutating, cb.exCB);
            cb.check();
        }

        {
            Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
            test(derived != null);
            Callback cb = new Callback();
            derived.begin_opDerived().whenCompleted(cb.opDerived, cb.exCB);
            cb.check();
        }
    }
예제 #16
0
 public Test.MyClass.OpMStruct2MarshaledReturnValue opMStruct2(Test.Structure p1, Current current)
 {
     return(new Test.MyClass.OpMStruct2MarshaledReturnValue(p1, p1, current));
 }
예제 #17
0
    internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            // Check that a call to a void operation raises NoEndpointException
            // in the ice_exception() callback instead of at the point of call.
            Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
            AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI();
            try
            {
                test(!indirect.opVoid_async(cb));
            }
            catch(Ice.Exception)
            {
                test(false);
            }
            cb.check();
        }

        {
            // Check that a call to a twoway operation raises NoEndpointException
            // in the ice_exception() callback instead of at the point of call.
            Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
            AMI_MyClass_opByteExI cb = new AMI_MyClass_opByteExI();
            try
            {
                test(!indirect.opByte_async(cb, (byte)0, (byte)0));
            }
            catch(Ice.Exception)
            {
                test(false);
            }
            cb.check();
        }

        {
            AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI();
            p.opVoid_async(cb);
            cb.check();
            // Let's check if we can reuse the callback object for another call.
            p.opVoid_async(cb);
            cb.check();
        }

        {
            Ice.InitializationData initData = new Ice.InitializationData();
            initData.properties = communicator.getProperties().ice_clone_();
            Ice.Communicator ic = Ice.Util.initialize(initData);

            Ice.ObjectPrx obj = ic.stringToProxy(p.ToString());
            Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(obj);

            ic.destroy();

            AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI();
            try
            {
                test(!p2.opVoid_async(cb));
                test(false);
            }
            catch(Ice.CommunicatorDestroyedException)
            {
                // Expected.
            }
        }

        {
            AMI_MyClass_opByteI cb = new AMI_MyClass_opByteI();
            p.opByte_async(cb, 0xff, 0x0f);
            cb.check();
        }

        {
            AMI_MyClass_opBoolI cb = new AMI_MyClass_opBoolI();
            p.opBool_async(cb, true, false);
            cb.check();
        }

        {
            AMI_MyClass_opShortIntLongI cb = new AMI_MyClass_opShortIntLongI();
            p.opShortIntLong_async(cb, (short) 10, 11, 12L);
            cb.check();
        }

        {
            AMI_MyClass_opFloatDoubleI cb = new AMI_MyClass_opFloatDoubleI();
            p.opFloatDouble_async(cb, 3.14f, 1.1e10);
            cb.check();
        }

        {
            AMI_MyClass_opStringI cb = new AMI_MyClass_opStringI();
            p.opString_async(cb, "hello", "world");
            cb.check();
        }

        {
            AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI();
            p.opMyEnum_async(cb, Test.MyEnum.enum2);
            cb.check();
        }

        {
            AMI_MyClass_opMyClassI cb = new AMI_MyClass_opMyClassI(communicator);
            p.opMyClass_async(cb, p);
            cb.check();
        }

        {
            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";

            AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(communicator);
            p.opStruct_async(cb, si1, si2);
            cb.check();
        }

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

            AMI_MyClass_opByteSI cb = new AMI_MyClass_opByteSI();
            p.opByteS_async(cb, bsi1, bsi2);
            cb.check();
        }

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

            AMI_MyClass_opBoolSI cb = new AMI_MyClass_opBoolSI();
            p.opBoolS_async(cb, bsi1, bsi2);
            cb.check();
        }

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

            AMI_MyClass_opShortIntLongSI cb = new AMI_MyClass_opShortIntLongSI();
            p.opShortIntLongS_async(cb, ssi, isi, lsi);
            cb.check();
        }

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

            AMI_MyClass_opFloatDoubleSI cb = new AMI_MyClass_opFloatDoubleSI();
            p.opFloatDoubleS_async(cb, fsi, dsi);
            cb.check();
        }

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

            AMI_MyClass_opStringSI cb = new AMI_MyClass_opStringSI();
            p.opStringS_async(cb, ssi1, ssi2);
            cb.check();
        }

        {
            Test.ByteSS bsi1 = new Test.ByteSS();
            bsi1.Add(new Test.ByteS());
            bsi1.Add(new Test.ByteS());
            bsi1[0].Add(0x01);
            bsi1[0].Add(0x11);
            bsi1[0].Add(0x12);
            bsi1[1].Add(0xff);
            Test.ByteSS bsi2 = new Test.ByteSS();
            bsi2.Add(new Test.ByteS());
            bsi2.Add(new Test.ByteS());
            bsi2[0].Add(0x0e);
            bsi2[1].Add(0xf2);
            bsi2[1].Add(0xf1);

            AMI_MyClass_opByteSSI cb = new AMI_MyClass_opByteSSI();
            p.opByteSS_async(cb, bsi1, bsi2);
            cb.check();
        }

        {
            Test.FloatSS fsi = new Test.FloatSS();
            fsi.Add(new Test.FloatS(new float[] { 3.14f }));
            fsi.Add(new Test.FloatS(new float[] { 1.11f }));
            fsi.Add(new Test.FloatS(new float[] { }));

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

            AMI_MyClass_opFloatDoubleSSI cb = new AMI_MyClass_opFloatDoubleSSI();
            p.opFloatDoubleSS_async(cb, fsi, dsi);
            cb.check();
        }

        {
            Test.StringSS ssi1 = new Test.StringSS();
            ssi1.Add(new Test.StringS());
            ssi1.Add(new Test.StringS());
            ssi1[0].Add("abc");
            ssi1[1].Add("de");
            ssi1[1].Add("fghi");
            Test.StringSS ssi2 = new Test.StringSS();
            ssi2.Add(new Test.StringS());
            ssi2.Add(new Test.StringS());
            ssi2.Add(new Test.StringS());
            ssi2[2].Add("xyz");

            AMI_MyClass_opStringSSI cb = new AMI_MyClass_opStringSSI();
            p.opStringSS_async(cb, ssi1, ssi2);
            cb.check();
        }

        {
            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("");

            AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI();
            p.opStringSSS_async(cb, sssi1, sssi2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping.
            di2[11] = false;
            di2[101] = true;

            AMI_MyClass_opByteBoolDI cb = new AMI_MyClass_opByteBoolDI();
            p.opByteBoolD_async(cb, di1, di2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping.
            di2[111] = -100;
            di2[1101] = 0;

            AMI_MyClass_opShortIntDI cb = new AMI_MyClass_opShortIntDI();
            p.opShortIntD_async(cb, di1, di2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping.
            di2[999999120L] = -100.4f;
            di2[999999130L] = 0.5f;

            AMI_MyClass_opLongFloatDI cb = new AMI_MyClass_opLongFloatDI();
            p.opLongFloatD_async(cb, di1, di2);
            cb.check();
        }

        {
            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"; // Disabled since new dictionary mapping
            di2["FOO"] = "abc -100.4";
            di2["BAR"] = "abc 0.5";

            AMI_MyClass_opStringStringDI cb = new AMI_MyClass_opStringStringDI();
            p.opStringStringD_async(cb, di1, di2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping
            di2["qwerty"] = Test.MyEnum.enum3;
            di2["Hello!!"] = Test.MyEnum.enum2;

            AMI_MyClass_opStringMyEnumDI cb = new AMI_MyClass_opStringMyEnumDI();
            p.opStringMyEnumD_async(cb, di1, di2);
            cb.check();
        }

        {
            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";

            AMI_MyClass_opMyEnumStringDI cb = new AMI_MyClass_opMyEnumStringDI();
            p.opMyEnumStringD_async(cb, di1, di2);
            cb.check();
        }

        {
            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[s22] = Test.MyEnum.enum3;
            di2[s23] = Test.MyEnum.enum2;

            AMI_MyClass_opMyStructMyEnumDI cb = new AMI_MyClass_opMyStructMyEnumDI();
            p.opMyStructMyEnumD_async(cb, di1, di2);
            cb.check();
        }

        {
            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);
                }
                AMI_MyClass_opIntSI cb = new AMI_MyClass_opIntSI(lengths[l]);
                p.opIntS_async(cb, s);
                cb.check();
            }
        }

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

        {
            //
            // 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));
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
                    p3.opContext_async(cb);
                    cb.check();
                }

                ic.getImplicitContext().put("zero", "ZERO");

                ctx = ic.getImplicitContext().getContext();
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
                    p3.opContext_async(cb);
                    cb.check();
                }

                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);
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext);
                    p3.opContext_async(cb);
                    cb.check();
                }

                ic.getImplicitContext().setContext(ctx);
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined);
                    p3.opContext_async(cb);
                    cb.check();
                }

                ic.getImplicitContext().setContext(null);
                ic.destroy();
            }
        }

        {
            AMI_MyClass_opIdempotentI cb = new AMI_MyClass_opIdempotentI();
            p.opIdempotent_async(cb);
            cb.check();
        }

        {
            AMI_MyClass_opNonmutatingI cb = new AMI_MyClass_opNonmutatingI();
            p.opNonmutating_async(cb);
            cb.check();
        }

        {
            Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
            test(derived != null);
            AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI();
            derived.opDerived_async(cb);
            cb.check();
        }
    }
예제 #18
0
파일: Twoways.cs 프로젝트: Crysty-Yui/ice
    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"));
        }
    }
예제 #19
0
    internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            // Check that a call to a void operation raises NoEndpointException
            // in the ice_exception() callback instead of at the point of call.
            Test.MyClassPrx       indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
            AMI_MyClass_opVoidExI cb       = new AMI_MyClass_opVoidExI();
            try
            {
                test(!indirect.opVoid_async(cb));
            }
            catch (Ice.Exception)
            {
                test(false);
            }
            cb.check();
        }

        {
            // Check that a call to a twoway operation raises NoEndpointException
            // in the ice_exception() callback instead of at the point of call.
            Test.MyClassPrx       indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
            AMI_MyClass_opByteExI cb       = new AMI_MyClass_opByteExI();
            try
            {
                test(!indirect.opByte_async(cb, (byte)0, (byte)0));
            }
            catch (Ice.Exception)
            {
                test(false);
            }
            cb.check();
        }

        {
            AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI();
            p.opVoid_async(cb);
            cb.check();
            // Let's check if we can reuse the callback object for another call.
            p.opVoid_async(cb);
            cb.check();
        }

        {
            Ice.InitializationData initData = new Ice.InitializationData();
            initData.properties = communicator.getProperties().ice_clone_();
            Ice.Communicator ic = Ice.Util.initialize(initData);

            Ice.ObjectPrx   obj = ic.stringToProxy(p.ToString());
            Test.MyClassPrx p2  = Test.MyClassPrxHelper.checkedCast(obj);

            ic.destroy();

            AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI();
            try
            {
                test(!p2.opVoid_async(cb));
                test(false);
            }
            catch (Ice.CommunicatorDestroyedException)
            {
                // Expected.
            }
        }

        {
            AMI_MyClass_opByteI cb = new AMI_MyClass_opByteI();
            p.opByte_async(cb, 0xff, 0x0f);
            cb.check();
        }

        {
            AMI_MyClass_opBoolI cb = new AMI_MyClass_opBoolI();
            p.opBool_async(cb, true, false);
            cb.check();
        }

        {
            AMI_MyClass_opShortIntLongI cb = new AMI_MyClass_opShortIntLongI();
            p.opShortIntLong_async(cb, (short)10, 11, 12L);
            cb.check();
        }

        {
            AMI_MyClass_opFloatDoubleI cb = new AMI_MyClass_opFloatDoubleI();
            p.opFloatDouble_async(cb, 3.14f, 1.1e10);
            cb.check();
        }

        {
            AMI_MyClass_opStringI cb = new AMI_MyClass_opStringI();
            p.opString_async(cb, "hello", "world");
            cb.check();
        }

        {
            AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI();
            p.opMyEnum_async(cb, Test.MyEnum.enum2);
            cb.check();
        }

        {
            AMI_MyClass_opMyClassI cb = new AMI_MyClass_opMyClassI(communicator);
            p.opMyClass_async(cb, p);
            cb.check();
        }

        {
            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";

            AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(communicator);
            p.opStruct_async(cb, si1, si2);
            cb.check();
        }

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

            AMI_MyClass_opByteSI cb = new AMI_MyClass_opByteSI();
            p.opByteS_async(cb, bsi1, bsi2);
            cb.check();
        }

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

            AMI_MyClass_opBoolSI cb = new AMI_MyClass_opBoolSI();
            p.opBoolS_async(cb, bsi1, bsi2);
            cb.check();
        }

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

            AMI_MyClass_opShortIntLongSI cb = new AMI_MyClass_opShortIntLongSI();
            p.opShortIntLongS_async(cb, ssi, isi, lsi);
            cb.check();
        }

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

            AMI_MyClass_opFloatDoubleSI cb = new AMI_MyClass_opFloatDoubleSI();
            p.opFloatDoubleS_async(cb, fsi, dsi);
            cb.check();
        }

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

            AMI_MyClass_opStringSI cb = new AMI_MyClass_opStringSI();
            p.opStringS_async(cb, ssi1, ssi2);
            cb.check();
        }

        {
            Test.ByteSS bsi1 = new Test.ByteSS();
            bsi1.Add(new Test.ByteS());
            bsi1.Add(new Test.ByteS());
            bsi1[0].Add(0x01);
            bsi1[0].Add(0x11);
            bsi1[0].Add(0x12);
            bsi1[1].Add(0xff);
            Test.ByteSS bsi2 = new Test.ByteSS();
            bsi2.Add(new Test.ByteS());
            bsi2.Add(new Test.ByteS());
            bsi2[0].Add(0x0e);
            bsi2[1].Add(0xf2);
            bsi2[1].Add(0xf1);

            AMI_MyClass_opByteSSI cb = new AMI_MyClass_opByteSSI();
            p.opByteSS_async(cb, bsi1, bsi2);
            cb.check();
        }

        {
            Test.FloatSS fsi = new Test.FloatSS();
            fsi.Add(new Test.FloatS(new float[] { 3.14f }));
            fsi.Add(new Test.FloatS(new float[] { 1.11f }));
            fsi.Add(new Test.FloatS(new float[] { }));

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

            AMI_MyClass_opFloatDoubleSSI cb = new AMI_MyClass_opFloatDoubleSSI();
            p.opFloatDoubleSS_async(cb, fsi, dsi);
            cb.check();
        }

        {
            Test.StringSS ssi1 = new Test.StringSS();
            ssi1.Add(new Test.StringS());
            ssi1.Add(new Test.StringS());
            ssi1[0].Add("abc");
            ssi1[1].Add("de");
            ssi1[1].Add("fghi");
            Test.StringSS ssi2 = new Test.StringSS();
            ssi2.Add(new Test.StringS());
            ssi2.Add(new Test.StringS());
            ssi2.Add(new Test.StringS());
            ssi2[2].Add("xyz");

            AMI_MyClass_opStringSSI cb = new AMI_MyClass_opStringSSI();
            p.opStringSS_async(cb, ssi1, ssi2);
            cb.check();
        }

        {
            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("");

            AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI();
            p.opStringSSS_async(cb, sssi1, sssi2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping.
            di2[11]  = false;
            di2[101] = true;

            AMI_MyClass_opByteBoolDI cb = new AMI_MyClass_opByteBoolDI();
            p.opByteBoolD_async(cb, di1, di2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping.
            di2[111]  = -100;
            di2[1101] = 0;

            AMI_MyClass_opShortIntDI cb = new AMI_MyClass_opShortIntDI();
            p.opShortIntD_async(cb, di1, di2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping.
            di2[999999120L] = -100.4f;
            di2[999999130L] = 0.5f;

            AMI_MyClass_opLongFloatDI cb = new AMI_MyClass_opLongFloatDI();
            p.opLongFloatD_async(cb, di1, di2);
            cb.check();
        }

        {
            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"; // Disabled since new dictionary mapping
            di2["FOO"] = "abc -100.4";
            di2["BAR"] = "abc 0.5";

            AMI_MyClass_opStringStringDI cb = new AMI_MyClass_opStringStringDI();
            p.opStringStringD_async(cb, di1, di2);
            cb.check();
        }

        {
            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; // Disabled since new dictionary mapping
            di2["qwerty"]  = Test.MyEnum.enum3;
            di2["Hello!!"] = Test.MyEnum.enum2;

            AMI_MyClass_opStringMyEnumDI cb = new AMI_MyClass_opStringMyEnumDI();
            p.opStringMyEnumD_async(cb, di1, di2);
            cb.check();
        }

        {
            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";

            AMI_MyClass_opMyEnumStringDI cb = new AMI_MyClass_opMyEnumStringDI();
            p.opMyEnumStringD_async(cb, di1, di2);
            cb.check();
        }

        {
            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[s22] = Test.MyEnum.enum3;
            di2[s23] = Test.MyEnum.enum2;

            AMI_MyClass_opMyStructMyEnumDI cb = new AMI_MyClass_opMyStructMyEnumDI();
            p.opMyStructMyEnumD_async(cb, di1, di2);
            cb.check();
        }

        {
            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);
                }
                AMI_MyClass_opIntSI cb = new AMI_MyClass_opIntSI(lengths[l]);
                p.opIntS_async(cb, s);
                cb.check();
            }
        }

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

        {
            //
            // 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));
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
                    p3.opContext_async(cb);
                    cb.check();
                }

                ic.getImplicitContext().put("zero", "ZERO");

                ctx = ic.getImplicitContext().getContext();
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx);
                    p3.opContext_async(cb);
                    cb.check();
                }

                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);
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext);
                    p3.opContext_async(cb);
                    cb.check();
                }

                ic.getImplicitContext().setContext(ctx);
                {
                    AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined);
                    p3.opContext_async(cb);
                    cb.check();
                }

                ic.getImplicitContext().setContext(null);
                ic.destroy();
            }
        }

        {
            AMI_MyClass_opIdempotentI cb = new AMI_MyClass_opIdempotentI();
            p.opIdempotent_async(cb);
            cb.check();
        }

        {
            AMI_MyClass_opNonmutatingI cb = new AMI_MyClass_opNonmutatingI();
            p.opNonmutating_async(cb);
            cb.check();
        }

        {
            Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p);
            test(derived != null);
            AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI();
            derived.opDerived_async(cb);
            cb.check();
        }
    }