コード例 #1
0
        internal static void TestParseUpdate(ITestPlatformSupport platform, String fileNameInit, String fileName, Action <mtest.IStructSix> updateDelegate)
        {
            mtest.StructSix_subscriber subs = new  mtest.StructSix_subscriber();
            //subs.debugOnlySetData(GetPublishableSix());
            SimpleBuffer       bufferInit = SimpleBuffer.readFromFile(fileNameInit);
            IPublishableParser parserInit = platform.makePublishableParser(bufferInit.getReadIterator());

            subs.applyStateSyncMessage(parserInit);

            SimpleBuffer       buffer = SimpleBuffer.readFromFile(fileName);
            IPublishableParser parser = platform.makePublishableParser(buffer.getReadIterator());

            subs.applyMessageWithUpdates(parser);

            //mtest.StructSix actual = ( mtest.StructSix)subs.debugOnlyGetData();
            mtest.StructSix expected = GetPublishableSix();

            if (updateDelegate != null)
            {
                // not equal yet
                Assert.False(subs.isEquivalent(expected));

                updateDelegate(expected);
            }

            Assert.True(subs.isEquivalent(expected));
        }
コード例 #2
0
        public static void TestGmQueueWithStructSix()
        {
            MwsrThreadQueue msgQueue = new MwsrThreadQueue(5);
            MetaPool        mp       = initializeGmQueue(msgQueue);

            mtest.StructSix_publisher publ = new mtest.StructSix_publisher();

            mtest.StructSix data = test_publishable_six.GetPublishableSix();
            publ.debugOnlySetData(data);

            mp.add(publ);

            string path = getSubscriptionAddress("StructSix");

            mtest.StructSix_subscriber subs1 = new mtest.StructSix_subscriber();

            Assert.False(publ.isEquivalent(subs1));

            mp.add(subs1);
            mp.subscribe(subs1, path);

            int msgCnt = 0;

            mp.postAllUpdates();
            deliverAllMessages(mp, msgQueue, null, ref msgCnt);

            Assert.True(publ.isEquivalent(subs1));

            mtest.StructSix_subscriber subs2 = new mtest.StructSix_subscriber();
            //mtest.StructSix data2 = (mtest.StructSix)subs2.debugOnlyGetData();

            mp.add(subs2);
            mp.subscribe(subs2, path);

            mtest.StructSix_subscriber subs3 = new mtest.StructSix_subscriber();
            //mtest.StructSix data3 = (mtest.StructSix)subs3.debugOnlyGetData();

            mp.add(subs3);
            mp.subscribe(subs3, path);

            mp.postAllUpdates();
            deliverAllMessages(mp, msgQueue, null, ref msgCnt);

            Assert.True(publ.isEquivalent(subs2));
            Assert.True(publ.isEquivalent(subs3));

            test_publishable_six.doUpdate1(publ);

            Assert.False(publ.isEquivalent(subs1));
            Assert.False(publ.isEquivalent(subs2));
            Assert.False(publ.isEquivalent(subs3));

            mp.postAllUpdates();
            deliverAllMessages(mp, msgQueue, null, ref msgCnt);

            Assert.True(publ.isEquivalent(subs1));
            Assert.True(publ.isEquivalent(subs2));
            Assert.True(publ.isEquivalent(subs3));
        }
コード例 #3
0
        internal static void TestParseStateSync(ITestPlatformSupport platform, String fileName)
        {
            mtest.StructSix_subscriber subs = new  mtest.StructSix_subscriber();

            SimpleBuffer       buffer = SimpleBuffer.readFromFile(fileName);
            IPublishableParser parser = platform.makePublishableParser(buffer.getReadIterator());

            subs.applyStateSyncMessage(parser);

            Assert.True(subs.isEquivalent(GetPublishableSix()));
        }