Exemple #1
0
        public void InitDurableClientNoInterest(int client, string locators,
                                                int redundancyLevel, string durableClientId, int durableTimeout)
        {
            // we use "client" to either create a DurableListener or use the existing ones
            // if the clients are initialized for the second time
            DurableListener <object, object> checker = null;

            if (client == 1)
            {
                if (ThinClientDurableTests.m_checker1 == null)
                {
                    ThinClientDurableTests.m_checker1 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker1;
            }
            else // client == 2
            {
                if (ThinClientDurableTests.m_checker2 == null)
                {
                    ThinClientDurableTests.m_checker2 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker2;
            }
            CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
                                                  durableClientId, durableTimeout);
            CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
                                            CacheHelper.Locators, "__TESTPOOL1_", true);
            CacheHelper.DCache.ReadyForEvents();
        }
Exemple #2
0
        public void InitDurableClient(int client, string locators, int redundancyLevel,
                                      string durableClientId, int durableTimeout)
        {
            // Create DurableListener for first time and use same afterward.
            DurableListener <object, object> checker = null;

            if (client == 1)
            {
                if (ThinClientDurableTests.m_checker1 == null)
                {
                    ThinClientDurableTests.m_checker1 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker1;
            }
            else // client == 2
            {
                if (ThinClientDurableTests.m_checker2 == null)
                {
                    ThinClientDurableTests.m_checker2 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker2;
            }
            CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
                                                  durableClientId, durableTimeout);
            CacheHelper.CreateTCRegion_Pool <object, object>(RegionNames[0], false, true, checker,
                                                             CacheHelper.Locators, "__TESTPOOL1_", true);

            CacheHelper.DCache.ReadyForEvents();
            IRegion <object, object> region1 = CacheHelper.GetVerifyRegion <object, object>(RegionNames[0]);

            region1.GetSubscriptionService().RegisterRegex(m_regexes[0], true);
            region1.GetSubscriptionService().RegisterRegex(m_regexes[1], false);
            //CacheableKey[] ldkeys = { new CacheableString(m_mixKeys[3]) };
            ICollection <object> lkeys = new List <object>();

            lkeys.Add((object)m_mixKeys[3]);
            region1.GetSubscriptionService().RegisterKeys(lkeys, true, false);

            ICollection <object> ldkeys = new List <object>();;

            ldkeys.Add((object)m_mixKeys[2]);
            region1.GetSubscriptionService().RegisterKeys(ldkeys, false, false);
        }
Exemple #3
0
        } // end [Test] DurableInterest

        #endregion

        #region Durable Failover Test


        public void InitDurableClientForFailover(int client, string locators,
                                                 int redundancyLevel, string durableClientId, int durableTimeout)
        {
            // we use "client" to either create a DurableListener or use the existing ones
            // if the clients are initialized for the second time
            DurableListener <object, object> checker = null;

            if (client == 1)
            {
                if (ThinClientDurableTests.m_checker1 == null)
                {
                    ThinClientDurableTests.m_checker1 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker1;
            }
            else // client == 2
            {
                if (ThinClientDurableTests.m_checker2 == null)
                {
                    ThinClientDurableTests.m_checker2 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker2;
            }
            CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
                                                  durableClientId, durableTimeout, 35000);
            CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
                                            CacheHelper.Locators, "__TESTPOOL1_", true);
            CacheHelper.DCache.ReadyForEvents();
            IRegion <object, object> region1 = CacheHelper.GetVerifyRegion <object, object>(RegionNames[0]);

            try
            {
                region1.GetSubscriptionService().RegisterRegex(m_regexes[0], true);
                region1.GetSubscriptionService().RegisterRegex(m_regexes[1], false);
            }
            catch (Exception other)
            {
                Assert.Fail("RegisterKeys threw unexpected exception: {0}", other.Message);
            }
        }
Exemple #4
0
        } // end [Test] DurableAndNonDurableBasic

        #endregion

        #region Durable Intrest Test

        public void InitDurableClientRemoveInterest(int client, string locators,
                                                    int redundancyLevel, string durableClientId, int durableTimeout)
        {
            // Client Registered Durable Intrest on two keys. We need to unregister them all here.

            DurableListener <object, object> checker = null;

            if (client == 1)
            {
                if (ThinClientDurableTests.m_checker1 == null)
                {
                    ThinClientDurableTests.m_checker1 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker1;
            }
            else // client == 2
            {
                if (ThinClientDurableTests.m_checker2 == null)
                {
                    ThinClientDurableTests.m_checker2 = DurableListener <object, object> .Create();
                }
                checker = ThinClientDurableTests.m_checker2;
            }
            CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
                                                  durableClientId, durableTimeout);
            CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
                                            CacheHelper.Locators, "__TESTPOOL1_", true);

            CacheHelper.DCache.ReadyForEvents();
            IRegion <object, object> region1 = CacheHelper.GetVerifyRegion <object, object>(RegionNames[0]);

            // Unregister Regex only durable
            region1.GetSubscriptionService().RegisterRegex(m_regexes[0], true);
            region1.GetSubscriptionService().UnregisterRegex(m_regexes[0]);

            // Unregister list only durable
            string[] ldkeys = new string[] { m_mixKeys[3] };
            region1.GetSubscriptionService().RegisterKeys(ldkeys, true, false);
            region1.GetSubscriptionService().UnregisterKeys(ldkeys);
        }