Example #1
0
        private Message ConstructMessage()
        {
            int delay = 15;
            int count = 4;

            MyValueFactory vf1 = new MyValueFactory("tcp:");

            Field mf_delay = new Field("delay");
            Field mf_count = new Field("count");

            XType mt_request = new XType("_Etch_KeepAliveReq");

            mt_request.PutValidator(mf_delay, Validator_int.Get(0));
            mt_request.PutValidator(mf_count, Validator_int.Get(0));
            vf1.AddType(mt_request);

            XType mt_response = new XType("_Etch_KeepAliveResp");

            vf1.AddType(mt_response);

            mt_request.SetResult(mt_response);

            Message msg = new Message(mt_request, vf1);

            msg.Add(mf_delay, delay);
            msg.Add(mf_count, count);

            return(msg);
        }
Example #2
0
        public void Init()
        {
            unregistered = false;

            //     AlarmManager.SetAlarmManager(null);

            redelivered = new List <Element>();

            vf = new MyValueFactory();

            mt_foo = new XType("foo");

            foo_msg = new Message(mt_foo, vf);

            fred_who = new WhoAmI();

            mt_bar = new XType("bar");

            bar_msg = new Message(mt_bar, vf);

            alice_who = new WhoAmI();

            notify = new MyNotify();

            notify1x = new MyNotify();
        }
Example #3
0
        public void testTypes()
        {
            MyValueFactory vf = new MyValueFactory();

            List <XType> eTypes = MkTypeSet(
                vf.GetType("_Etch_RuntimeException"),
                vf.GetType("_Etch_List"),
                vf.GetType("_Etch_Map"),
                vf.GetType("_Etch_Datetime"),
                vf.GetType("_Etch_AuthException"),
                vf.GetType("_exception"),
                MyValueFactory._mt_x,
                MyValueFactory._mt_y
                );

            //Dump("eTypes", eTypes);
            //Dump("vf.GetTypes()", vf.GetTypes());

            Assert.IsTrue(CompareTypeLists(eTypes, vf.GetTypes()));

            foreach (XType t in eTypes)
            {
                TestType(t);
            }
        }
Example #4
0
 public void Initialize()
 {
     transport = new MyTransport();
     session   = new MySession();
     vf        = new MyValueFactory("tcp:");
     resources = new Resources();
     resources.Add(TransportConsts.VALUE_FACTORY, vf);
 }
Example #5
0
        public void Test_add_perf()
        {
            vf = new MyValueFactory();

            XType add = vf.GetType("add");

            Field x = new Field("x");

            add.PutValidator(x, Validator_int.Get(0));

            Field y = new Field("y");

            add.PutValidator(y, Validator_int.Get(0));

            Field _mf__messageId = DefaultValueFactory._mf__messageId;

            add.PutValidator(_mf__messageId, Validator_long.Get(0));

            long msgid = 0x0123456789abcdefL;

            Message msg = new Message(add, vf);

            msg.Add(x, 123456789);
            msg.Add(y, 876543210);
            msg.Add(_mf__messageId, msgid);

            Resources res = new Resources();

            res.Add(TransportConsts.VALUE_FACTORY, vf);
            MyPacketSource ps = new MyPacketSource();
            Messagizer     m  = new Messagizer(ps, "foo:?Messagizer.format=binary", res);

            m.TransportMessage(null, msg);


            int n = 900973;

            for (int i = 0; i < 3; i++)
            {
                TestPerf("test_add_perf", i, m, msg, n);
            }
        }
Example #6
0
 public TestBinaryTaggedDataInOut()
 {
     vf     = new MyValueFactory();
     mt_foo = vf.GetType("foo");
     mf_x   = new Field("x");
 }