コード例 #1
0
        public void VerifyTallies()
        {
            IRegion <object, object> region1 = CacheHelper.GetVerifyRegion <object, object>(m_regionNames[0]);
            IRegion <object, object> region2 = CacheHelper.GetVerifyRegion <object, object>(m_regionNames[1]);

            TallyLoader <object, object>   loader1   = (TallyLoader <object, object>)region1.Attributes.CacheLoader;
            TallyListener <object, object> listener1 = (TallyListener <object, object>)region1.Attributes.CacheListener;
            TallyWriter <object, object>   writer1   = (TallyWriter <object, object>)region1.Attributes.CacheWriter;
            TallyResolver <object, object> resolver1 = (TallyResolver <object, object>)region1.Attributes.PartitionResolver;

            TallyLoader <object, object>   loader2   = (TallyLoader <object, object>)region2.Attributes.CacheLoader;
            TallyListener <object, object> listener2 = (TallyListener <object, object>)region2.Attributes.CacheListener;
            TallyWriter <object, object>   writer2   = (TallyWriter <object, object>)region2.Attributes.CacheWriter;
            TallyResolver <object, object> resolver2 = (TallyResolver <object, object>)region2.Attributes.PartitionResolver;

            loader1.ShowTallies();
            writer1.ShowTallies();
            listener1.ShowTallies();
            resolver1.ShowTallies();

            loader2.ShowTallies();
            writer2.ShowTallies();
            listener2.ShowTallies();
            resolver2.ShowTallies();

            // We don't assert for partition resolver because client metadata service may
            // not have fetched PR single hop info to trigger the resolver.

            Assert.AreEqual(1, loader1.ExpectLoads(1));
            //Assert.AreEqual(1, resolver1.ExpectLoads(1));
            Assert.AreEqual(1, writer1.ExpectCreates(1));
            Assert.AreEqual(0, writer1.ExpectUpdates(0));
            Assert.AreEqual(2, listener1.ExpectCreates(2));
            Assert.AreEqual(1, listener1.ExpectUpdates(1));

            Assert.AreEqual(1, loader2.ExpectLoads(1));
            //Assert.AreEqual(1, resolver2.ExpectLoads(1));
            Assert.AreEqual(1, writer2.ExpectCreates(1));
            Assert.AreEqual(0, writer2.ExpectUpdates(0));
            Assert.AreEqual(2, listener2.ExpectCreates(2));
            Assert.AreEqual(1, listener2.ExpectUpdates(1));
        }
コード例 #2
0
        public void StepThreeCallbacks()
        {
            Assert.AreEqual(2, m_reg1Listener1.ExpectCreates(2),
                            "Two creation events were expected for region1.");
            Assert.AreEqual(2, m_reg2Listener1.ExpectCreates(2),
                            "Two creation events were expected for region2.");

            Assert.AreEqual(0, m_reg1Listener1.ExpectUpdates(0),
                            "No update event was expected for region1.");
            Assert.AreEqual(0, m_reg2Listener1.ExpectUpdates(0),
                            "No update event was expected for region2.");

            Assert.AreEqual(1, m_reg1Loader1.ExpectLoads(1),
                            "One loader event was expected for region1.");
            Assert.AreEqual(1, m_reg2Loader1.ExpectLoads(1),
                            "One loader event was expected for region2.");

            Assert.AreEqual(1, m_reg1Writer1.ExpectCreates(1),
                            "One writer create event was expected for region1.");
            Assert.AreEqual(1, m_reg2Writer1.ExpectCreates(1),
                            "One writer create event was expected for region2.");
        }