Ejemplo n.º 1
0
        public void CreateRegion(string locators,
                                 bool caching, bool listener, bool writer)
        {
            if (listener)
            {
                m_listener = new TallyListener <int, object>();
            }
            else
            {
                m_listener = null;
            }
            GIRegion region = null;

            region = CacheHelper.CreateTCRegion_Pool <int, object>(RegionName, true, caching,
                                                                   m_listener, locators, "__TESTPOOL1_", true);
            if (listener)
            {
                m_listener.SetCallBackArg(key0);
            }

            if (writer)
            {
                m_writer = new TallyWriter <int, object>();
            }
            else
            {
                m_writer = null;
            }
            if (writer)
            {
                AttributesMutator <int, object> at = region.AttributesMutator;
                at.SetCacheWriter(m_writer);
                m_writer.SetCallBackArg(key0);
            }
        }
        public void CreateRegion(string locators, bool caching,
                                 bool listener, bool writer)
        {
            Util.Log(" in CreateRegion " + listener + " : " + writer);
            if (listener)
            {
                m_listener = new TallyListener <object, object>();
            }
            else
            {
                m_listener = null;
            }
            IRegion <object, object> region = null;

            region = CacheHelper.CreateTCRegion_Pool <object, object>(RegionName, true, caching,
                                                                      m_listener, locators, "__TESTPOOL1_", true);

            if (writer)
            {
                m_writer = new TallyWriter <object, object>();
            }
            else
            {
                m_writer = null;
            }
            Util.Log("region created  ");
            AttributesMutator <object, object> at = region.AttributesMutator;

            at.SetCacheWriter(m_writer);
        }
        private void ClearRegionListenersStep1()
        {
            var region0 = CacheHelper.GetVerifyRegion <object, object>(m_regionNames[0]);

            region0.GetSubscriptionService().RegisterAllKeys();
            var attrMutator = region0.AttributesMutator;
            var listener    = new TallyListener <object, object>();

            attrMutator.SetCacheListener(listener);
            var writer = new TallyWriter <object, object>();

            attrMutator.SetCacheWriter(writer);
        }
Ejemplo n.º 4
0
        public void CreateRegion(string regionName, string locators, bool listener)
        {
            if (listener)
            {
                m_listener = new TallyListener <object, object>();
            }
            else
            {
                m_listener = null;
            }

            Region region = null;

            region = CacheHelper.CreateTCRegion_Pool <object, object>(regionName, false, false,
                                                                      m_listener, locators, "__TESTPOOL1_", false);
        }
Ejemplo n.º 5
0
        public void CreateRegion(string locators,
                                 bool caching, bool listener)
        {
            if (listener)
            {
                m_listener = new TallyListener <object, object>();
            }
            else
            {
                m_listener = null;
            }
            IRegion <object, object> region = null;

            region = CacheHelper.CreateTCRegion_Pool <object, object>(RegionName, true, caching,
                                                                      m_listener, locators, "__TESTPOOL1_", true);
            m_regionw = new RegionWrapper(region);
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
0
        public void DoValidation(string clientName, string regionName,
                                 int creates, int updates, int invalidates, int destroys)
        {
            IRegion <object, object>       region   = CacheHelper.GetRegion <object, object>(regionName);
            TallyListener <object, object> listener = region.Attributes.CacheListener as TallyListener <object, object>;

            Util.Log(clientName + ": " + regionName + ": creates expected=" + creates +
                     ", actual=" + listener.Creates);
            Util.Log(clientName + ": " + regionName + ": updates expected=" + updates +
                     ", actual=" + listener.Updates);
            Util.Log(clientName + ": " + regionName + ": invalidates expected=" + invalidates +
                     ", actual=" + listener.Invalidates);
            Util.Log(clientName + ": " + regionName + ": destroys expected=" + destroys +
                     ", actual=" + listener.Destroys);

            Assert.AreEqual(creates, listener.Creates, clientName + ": " + regionName);
            Assert.AreEqual(updates, listener.Updates, clientName + ": " + regionName);
            Assert.AreEqual(invalidates, listener.Invalidates, clientName + ": " + regionName);
            Assert.AreEqual(destroys, listener.Destroys, clientName + ": " + regionName);
        }
Ejemplo n.º 8
0
        public void CreateRegion2(string locators,
                                  bool caching, bool listener, bool writer)
        {
            CallbackListener callbackLis = null;

            if (listener)
            {
                m_callbackListener = new CallbackListener();
                m_callbackListener.SetCallbackArg(m_callbackarg);
                callbackLis = m_callbackListener;
            }
            else
            {
                m_listener = null;
            }
            GIRegion region = null;

            region = CacheHelper.CreateTCRegion_Pool <int, object>(RegionName, true, caching,
                                                                   callbackLis, locators, "__TESTPOOL1_", true);
        }
Ejemplo n.º 9
0
        public void StepOneCallbacks()
        {
            m_reg1Listener1 = new TallyListener <string, string>();
            m_reg2Listener1 = new TallyListener <string, string>();
            m_reg1Loader1   = new ThinClientTallyLoader();
            m_reg2Loader1   = new ThinClientTallyLoader();
            m_reg1Writer1   = new TallyWriter <string, string>();
            m_reg2Writer1   = new TallyWriter <string, string>();

            SetCacheListener(RegionNames[0], m_reg1Listener1);
            SetCacheLoader(RegionNames[0], m_reg1Loader1);
            SetCacheWriter(RegionNames[0], m_reg1Writer1);

            SetCacheListener(RegionNames[1], m_reg2Listener1);
            SetCacheLoader(RegionNames[1], m_reg2Loader1);
            SetCacheWriter(RegionNames[1], m_reg2Writer1);

            RegisterKeys();
            m_reg3Listener1 = new TallyListener <string, string>();
            //m_reg3Loader1 = new TallyLoader<string, string>();
            m_reg3Loader1 = new ThinClientTallyLoader();
            m_reg3Writer1 = new TallyWriter <string, string>();
            var regionAttributesFactory = new RegionAttributesFactory <string, string>();

            GIRegion region = CacheHelper.CreateRegion <string, string>(PeerRegionName,
                                                                        regionAttributesFactory.Create());

            SetCacheListener(PeerRegionName, m_reg3Listener1);
            SetCacheLoader(PeerRegionName, m_reg3Loader1);
            SetCacheWriter(PeerRegionName, m_reg3Writer1);

            // Call the loader and writer
            Assert.IsNotNull(GetEntry(RegionNames[0], m_keys[0]),
                             "Found null value.");
            Assert.IsNotNull(GetEntry(RegionNames[1], m_keys[0]),
                             "Found null value.");
            Assert.IsNotNull(GetEntry(PeerRegionName, m_keys[0]),
                             "Found null value.");

            CreateEntry(PeerRegionName, m_keys[1], m_vals[1]);
        }
Ejemplo n.º 10
0
        public void CreateRegion2(string locators,
                                  bool caching, bool listener, bool writer)
        {
            CallbackListener callbackLis = null;

            if (listener)
            {
                m_callbackListener = new CallbackListener();
                m_callbackListener.SetCallbackArg(m_callbackarg);
                callbackLis = m_callbackListener;
            }
            else
            {
                m_listener = null;
            }
            GIRegion region = null;

            region = CacheHelper.CreateTCRegion_Pool <int, object>(RegionName, true, caching,
                                                                   callbackLis, locators, "__TESTPOOL1_", true);
            CacheHelper.DCache.TypeRegistry.RegisterTypeGeneric(Portfolio.CreateDeserializable);
            CacheHelper.DCache.TypeRegistry.RegisterTypeGeneric(Position.CreateDeserializable);
        }
Ejemplo n.º 11
0
        public void StepFiveCallbacks()
        {
            Assert.AreEqual(1, m_reg1Listener1.Updates,
                            "One update event was expected for region.");
            Assert.AreEqual(1, m_reg2Listener1.Updates,
                            "One update event was expected for region.");

            m_reg1Listener2 = new TallyListener <string, string>();
            m_reg2Listener2 = new TallyListener <string, string>();
            m_reg1Loader2   = new ThinClientTallyLoader();
            m_reg2Loader2   = new ThinClientTallyLoader();
            m_reg1Writer2   = new TallyWriter <string, string>();
            m_reg2Writer2   = new TallyWriter <string, string>();

            SetCacheListener(RegionNames[0], m_reg1Listener2);
            SetCacheLoader(RegionNames[0], m_reg1Loader2);
            SetCacheWriter(RegionNames[0], m_reg1Writer2);

            SetCacheListener(RegionNames[1], m_reg2Listener2);
            SetCacheLoader(RegionNames[1], m_reg2Loader2);
            SetCacheWriter(RegionNames[1], m_reg2Writer2);

            m_reg3Listener2 = new TallyListener <string, string>();
            //m_reg3Loader2 = new TallyLoader<string, string>();
            m_reg3Loader2 = new ThinClientTallyLoader();
            m_reg3Writer2 = new TallyWriter <string, string>();

            SetCacheListener(PeerRegionName, m_reg3Listener2);
            SetCacheLoader(PeerRegionName, m_reg3Loader2);
            SetCacheWriter(PeerRegionName, m_reg3Writer2);

            // Force a fresh key get to trigger the new loaders
            Assert.IsNotNull(GetEntry(RegionNames[0], m_keys[2]),
                             "Found null value.");
            Assert.IsNotNull(GetEntry(RegionNames[1], m_keys[2]),
                             "Found null value.");
        }
Ejemplo n.º 12
0
 public void SetupTimeout(TallyListener listener)
 {
     listener.IgnoreTimeout = true;
     m_region.Put(timeoutKey, timeoutKey);
     listener.IgnoreTimeout = false;
 }