public void TestExtractorEventTransformer()
        {
            //testing on remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Hashtable ht       = new Hashtable();
            Address   address1 = new Address("Street1", "City1", "State1", "Zip1");
            Address   address2 = new Address("Street2", "City2", "State2", "Zip2");

            ht.Add("key1", address1);
            ht.Add("key2", address2);
            cache.InsertAll(ht);

            SyncListener           listener    = new SyncListener();
            IFilter                filter      = new ValueChangeEventFilter("getStreet");
            IValueExtractor        extractor   = IdentityExtractor.Instance;
            ICacheEventTransformer transformer = new ExtractorEventTransformer(null, extractor);

            cache.AddCacheListener(listener,
                                   new CacheEventTransformerFilter(filter,
                                                                   transformer),
                                   false);
            Assert.IsNull(listener.CacheEvent);

            cache["key1"] = new Address("Street1", "City1a", "State1a", "Zip1a");
            Assert.IsNull(listener.CacheEvent);

            cache["key1"] = new Address("Street1a", "City1a", "State1a", "Zip1a");
            Assert.IsNotNull(listener.CacheEvent);

            CacheFactory.Shutdown();
        }
        public void TestPofExtractorWithValueChangeEventFilter1()
        {
            // Testing on remote cache using CustomerKeyClass, which is not
            // defined on Java side
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            // CustomerKeyClass is not defined on the Java side
            //
            Hashtable      ht   = new Hashtable();
            CustomKeyClass key1 = new CustomKeyClass("Customer1");
            CustomKeyClass key2 = new CustomKeyClass("Customer2");

            ht.Add("key1", key1);
            ht.Add("key2", key2);
            cache.InsertAll(ht);

            SyncListener listener = new SyncListener();
            IFilter      filter   = new ValueChangeEventFilter(new PofExtractor(typeof(String), 0));

            cache.AddCacheListener(listener,
                                   filter,
                                   false);
            Assert.IsNull(listener.CacheEvent);

            cache["key1"] = new CustomKeyClass("Customer1");
            Assert.IsNull(listener.CacheEvent);

            cache["key1"] = new CustomKeyClass("Customer12");
            Assert.IsNotNull(listener.CacheEvent);

            CacheFactory.Shutdown();
        }
        public void TestPofExtractorWithValueChangeEventFilter2()
        {
            // Testing on remote cache using Address, which is defined on
            // Java side.
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Hashtable ht       = new Hashtable();
            Address   address1 = new Address("Street1", "City1", "State1", "Zip1");
            Address   address2 = new Address("Street2", "City2", "State2", "Zip2");

            ht.Add("key1", address1);
            ht.Add("key2", address2);
            cache.InsertAll(ht);

            SyncListener listener = new SyncListener();
            IFilter      filter   = new ValueChangeEventFilter(new PofExtractor(typeof(String), 0));

            cache.AddCacheListener(listener,
                                   filter,
                                   false);
            Assert.IsNull(listener.CacheEvent);

            cache["key1"] = new Address("Street1", "City1a", "State1a", "Zip1a");
            Assert.IsNull(listener.CacheEvent);

            cache["key1"] = new Address("Street1a", "City1", "State1", "Zip1");
            Assert.IsNotNull(listener.CacheEvent);

            CacheFactory.Shutdown();
        }