Beispiel #1
0
        public void TestConditionalPutAll()
        {
            Hashtable ht = new Hashtable();

            ht.Add("key1", 100);
            ht.Add("key2", 200);
            ht.Add("key3", 300);
            ConditionalPutAll conditionalPutAll  = new ConditionalPutAll(AlwaysFilter.Instance, ht);
            ConditionalPutAll conditionalPutAll1 = new ConditionalPutAll(AlwaysFilter.Instance, ht);

            Assert.AreEqual(conditionalPutAll.ToString(), conditionalPutAll1.ToString());

            LocalCache           lCache = new LocalCache();
            IInvocableCacheEntry entry  = new LocalCache.Entry(lCache, "key2", 400);
            Object result = conditionalPutAll.Process(entry);

            Assert.AreEqual(200, entry.Value);

            // testing on remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            ht = new Hashtable();
            ht.Add("conditionalPutAllKey1", 435);
            ht.Add("conditionalPutAllKey2", 253);
            ht.Add("conditionalPutAllKey3", 200);
            ht.Add("conditionalPutAllKey4", 333);
            cache.InsertAll(ht);

            Hashtable htPut = new Hashtable();

            htPut.Add("conditionalPutAllKey1", 100);
            htPut.Add("conditionalPutAllKey6", 80);
            htPut.Add("conditionalPutAllKey3", 10);

            // put key1 and compare cache value with the put one
            ConditionalPutAll processor = new ConditionalPutAll(AlwaysFilter.Instance, htPut);

            cache.Invoke("conditionalPutAllKey1", processor);
            Assert.IsNotNull(cache["conditionalPutAllKey1"]);
            Assert.AreEqual(cache["conditionalPutAllKey1"], htPut["conditionalPutAllKey1"]);

            // put all keys from htPut and compare cache values with put ones
            cache.InvokeAll(htPut.Keys, processor);
            Assert.IsTrue(cache.Count == 5);
            Assert.AreEqual(cache["conditionalPutAllKey1"], htPut["conditionalPutAllKey1"]);
            Assert.AreEqual(cache["conditionalPutAllKey6"], htPut["conditionalPutAllKey6"]);
            Assert.AreEqual(cache["conditionalPutAllKey3"], htPut["conditionalPutAllKey3"]);

            htPut.Clear();
            htPut.Add("conditionalPutAllKey4", 355);
            processor = new ConditionalPutAll(AlwaysFilter.Instance, htPut);

            cache.InvokeAll(new GreaterFilter(IdentityExtractor.Instance, 300), processor);
            Assert.AreEqual(cache["conditionalPutAllKey4"], htPut["conditionalPutAllKey4"]);

            CacheFactory.Shutdown();
        }
        public void ShouldRunInvokeAllAndTimeout()
        {
            ArrayList keys = new ArrayList {
                "Foo-Key"
            };

            Assert.Throws(Is.TypeOf(typeof(RequestTimeoutException)), () => m_cache.InvokeAll(keys, m_priorityProcessorDefault));
        }
Beispiel #3
0
        public void TestConditionalRemove()
        {
            ConditionalRemove conditionalRemove  = new ConditionalRemove(new GreaterFilter(IdentityExtractor.Instance, 100), true);
            ConditionalRemove conditionalRemove1 = new ConditionalRemove(new GreaterFilter(IdentityExtractor.Instance, 100), true);

            Assert.AreEqual(conditionalRemove, conditionalRemove1);
            Assert.AreEqual(conditionalRemove.ToString(), conditionalRemove1.ToString());
            Assert.AreEqual(conditionalRemove.GetHashCode(), conditionalRemove1.GetHashCode());

            IInvocableCacheEntry entry = new LocalCache.Entry(new LocalCache(), "key1", 1200);
            Object result = conditionalRemove.Process(entry);

            Assert.IsNull(entry.Value);

            entry  = new LocalCache.Entry(new LocalCache(), "key1", 50);
            result = conditionalRemove.Process(entry);
            Assert.AreEqual(50, entry.Value);

            // testing on remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("conditionalPutAllKey1", 435);
            ht.Add("conditionalPutAllKey2", 253);
            ht.Add("conditionalPutAllKey3", 200);
            ht.Add("conditionalPutAllKey4", 333);
            cache.InsertAll(ht);

            IFilter greaterThen300 = new GreaterFilter(IdentityExtractor.Instance, 300);
            IFilter lessThen300    = new LessFilter(IdentityExtractor.Instance, 300);

            Assert.IsTrue(cache.Count == 4);

            // remove key1 with greaterThen300 filter applied
            ConditionalRemove processor = new ConditionalRemove(greaterThen300, false);

            cache.Invoke("conditionalPutAllKey1", processor);
            Assert.IsTrue(cache.Count == 3);

            // remove all entries that satisfy filter criteria
            processor = new ConditionalRemove(greaterThen300, false);
            cache.InvokeAll(ht.Keys, processor);
            Assert.IsTrue(cache.Count == 2);
            Assert.IsNotNull(cache["conditionalPutAllKey2"]);
            Assert.IsNotNull(cache["conditionalPutAllKey3"]);

            processor = new ConditionalRemove(lessThen300, false);
            cache.InvokeAll(new GreaterFilter(IdentityExtractor.Instance, 200), processor);
            Assert.IsTrue(cache.Count == 1);
            Assert.IsNotNull(cache["conditionalPutAllKey3"]);

            CacheFactory.Shutdown();
        }
        public void TestRemove()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml");

            ccf.Config = config;

            INamedCache cache = CacheFactory.GetCache("local-default");

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("conditionalPutAllKey1", 435);
            ht.Add("conditionalPutAllKey2", 253);
            ht.Add("conditionalPutAllKey3", 200);
            ht.Add("conditionalPutAllKey4", 333);
            cache.InsertAll(ht);

            IFilter greaterThen300 = new GreaterFilter(IdentityExtractor.Instance, 300);
            IFilter lessThen300    = new LessFilter(IdentityExtractor.Instance, 300);
            IFilter key3           = new LikeFilter(new KeyExtractor(IdentityExtractor.Instance), "%Key3", '\\', false);

            Assert.IsTrue(cache.Count == 4);

            // remove key1 with greaterThen300 filter applied
            ConditionalRemove processor = new ConditionalRemove(greaterThen300, false);

            cache.Invoke("conditionalPutAllKey1", processor);
            Assert.IsTrue(cache.Count == 3);

            // remove all entries that satisfy filter criteria
            processor = new ConditionalRemove(greaterThen300, false);
            cache.InvokeAll(ht.Keys, processor);
            Assert.IsTrue(cache.Count == 2);
            Assert.IsNotNull(cache["conditionalPutAllKey2"]);
            Assert.IsNotNull(cache["conditionalPutAllKey3"]);

            processor = new ConditionalRemove(lessThen300, false);
            cache.InvokeAll(new GreaterFilter(IdentityExtractor.Instance, 200), processor);
            Assert.IsTrue(cache.Count == 1);
            Assert.IsNotNull(cache["conditionalPutAllKey3"]);

            processor = new ConditionalRemove(key3, false);
            cache.InvokeAll(new GreaterFilter(IdentityExtractor.Instance, 100), processor);
            Assert.IsTrue(cache.Count == 0);

            CacheFactory.Shutdown();
        }
        /// <summary>
        /// Perform the example update to contacts.
        /// </summary>
        /// <param name="cache">
        /// The target cache.
        /// </param>
        public virtual void Execute(INamedCache cache)
        {
            Console.WriteLine("------ProcessorExample begins------");
            // People who live in Massachusetts moved to an in-state office
            Address addrWork = new Address("200 Newbury St.", "Yoyodyne, Ltd.",
                                           "Boston", "MA", "02116", "US");

            // Apply the OfficeUpdater on all contacts who live in MA
            cache.InvokeAll(new EqualsFilter("getHomeAddress.getState", "MA"),
                            new OfficeUpdater(addrWork));
            Console.WriteLine("------ProcessorExample completed------");
        }
Beispiel #6
0
        public void TestExtractor()
        {
            Address            addr = new Address("Champs-Elysees", "Paris", "France", "1616");
            ExtractorProcessor extractorProcessor  = new ExtractorProcessor(new ReflectionExtractor("Street"));
            ExtractorProcessor extractorProcessor1 = new ExtractorProcessor(new ReflectionExtractor("Street"));

            Assert.AreEqual(extractorProcessor, extractorProcessor1);
            Assert.AreEqual(extractorProcessor.GetHashCode(), extractorProcessor1.GetHashCode());
            Assert.AreEqual(extractorProcessor.ToString(), extractorProcessor1.ToString());

            LocalCache.Entry entry  = new LocalCache.Entry(new LocalCache(), "addr1", addr);
            Object           result = extractorProcessor.Process(entry);

            Assert.AreEqual("Champs-Elysees", result);

            extractorProcessor = new ExtractorProcessor(new KeyExtractor(IdentityExtractor.Instance));
            result             = extractorProcessor.Process(entry);
            Assert.AreEqual("addr1", result);

            // testing on Remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();
            ExtractorProcessor processor = new ExtractorProcessor(new ReflectionExtractor("getStreet"));
            Address            addr1     = new Address("XI krajiske divizije", "Belgrade", "Serbia", "11000");
            Address            addr2     = new Address("Pere Velimirovica", "Uzice", "Serbia", "11000");
            Address            addr3     = new Address("Rige od Fere", "Novi Sad", "Serbia", "11000");

            cache.Insert("addr1", addr1);
            cache.Insert("addr2", addr2);
            cache.Insert("addr3", addr3);

            Assert.IsTrue(cache.Count == 3);

            result = cache.Invoke("addr1", processor);

            Assert.IsNotNull(result);
            Assert.AreEqual(addr1.Street, result as String);

            processor = new ExtractorProcessor(new ReflectionExtractor("getCity"));
            IDictionary dictResult = cache.InvokeAll(cache.Keys, processor);

            Assert.AreEqual(addr1.City, dictResult["addr1"]);
            Assert.AreEqual(addr2.City, dictResult["addr2"]);
            Assert.AreEqual(addr3.City, dictResult["addr3"]);

            CacheFactory.Shutdown();
        }
        public void TestExtractor()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml");

            ccf.Config = config;

            INamedCache cache = CacheFactory.GetCache("local-default");

            cache.Clear();
            ExtractorProcessor processor = new ExtractorProcessor(new ReflectionExtractor("Street"));
            Address            addr1     = new Address("XI krajiske divizije", "Belgrade", "Serbia", "11000");
            Address            addr2     = new Address("Pere Velimirovica", "Uzice", "Serbia", "11000");
            Address            addr3     = new Address("Rige od Fere", "Novi Sad", "Serbia", "11000");

            cache.Insert("addr1", addr1);
            cache.Insert("addr2", addr2);
            cache.Insert("addr3", addr3);

            Assert.IsTrue(cache.Count == 3);

            Object result = cache.Invoke("addr1", processor);

            Assert.IsNotNull(result);
            Assert.AreEqual(addr1.Street, result as String);

            processor = new ExtractorProcessor(new ReflectionExtractor("City"));
            IDictionary dictResult = cache.InvokeAll(cache.Keys, processor);

            Assert.AreEqual(addr1.City, dictResult["addr1"]);
            Assert.AreEqual(addr2.City, dictResult["addr2"]);
            Assert.AreEqual(addr3.City, dictResult["addr3"]);

            CacheFactory.Shutdown();
        }
        public void TestInvoke()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml");

            ccf.Config = config;

            INamedCache cache = CacheFactory.GetCache("local-default");

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("conditionalPutKey1", 435);
            ht.Add("conditionalPutKey2", 253);
            ht.Add("conditionalPutKey3", 3);
            ht.Add("conditionalPutKey4", 200);
            ht.Add("conditionalPutKey5", 333);
            cache.InsertAll(ht);

            IFilter greaterThen600 = new GreaterFilter(IdentityExtractor.Instance, 600);
            IFilter greaterThen200 = new GreaterFilter(IdentityExtractor.Instance, 200);

            // no entries with value>600
            ICollection keys = cache.GetKeys(greaterThen600);

            Assert.IsTrue(keys.Count == 0);

            // invoke processor for one entry with filter that will evaluate to false
            // again, no entries with value>600
            IEntryProcessor processor = new ConditionalPut(greaterThen600, 666);

            cache.Invoke("conditionalPutKey1", processor);
            keys = cache.GetKeys(greaterThen600);
            Assert.IsTrue(keys.Count == 0);

            // invoke processor for one entry with filter that will evaluate to true
            // this will change one entry
            processor = new ConditionalPut(AlwaysFilter.Instance, 666);
            cache.Invoke("conditionalPutKey1", processor);
            keys = cache.GetKeys(greaterThen600);
            Assert.AreEqual(keys.Count, 1);
            Assert.AreEqual(cache["conditionalPutKey1"], 666);

            // 3 entries with value>200
            keys = cache.GetKeys(greaterThen200);
            Assert.AreEqual(keys.Count, 3);

            // invoke processor for these three entries
            processor = new ConditionalPut(greaterThen200, 666);
            cache.InvokeAll(cache.Keys, processor);
            keys = cache.GetKeys(greaterThen600);
            Assert.AreEqual(keys.Count, 3);

            cache.Clear();

            ht = new Hashtable();
            ht.Add("conditionalPutAllKey1", 435);
            ht.Add("conditionalPutAllKey2", 253);
            ht.Add("conditionalPutAllKey3", 200);
            ht.Add("conditionalPutAllKey4", 333);
            cache.InsertAll(ht);

            Hashtable htPut = new Hashtable();

            htPut.Add("conditionalPutAllKey1", 100);
            htPut.Add("conditionalPutAllKey6", 80);
            htPut.Add("conditionalPutAllKey3", 10);

            // put key1 and compare cache value with the put one
            processor = new ConditionalPutAll(AlwaysFilter.Instance, htPut);
            cache.Invoke("conditionalPutAllKey1", processor);
            Assert.IsNotNull(cache["conditionalPutAllKey1"]);
            Assert.AreEqual(cache["conditionalPutAllKey1"], htPut["conditionalPutAllKey1"]);

            // TODO: Decide wheter putall should insert new entries or not
            // put all keys from htPut and compare cache values with put ones
            //cache.InvokeAll(htPut.Keys, processor);
            //Assert.IsTrue(cache.Count == 5);
            //Assert.AreEqual(cache["conditionalPutAllKey1"], htPut["conditionalPutAllKey1"]);
            //Assert.AreEqual(cache["conditionalPutAllKey6"], htPut["conditionalPutAllKey6"]);
            //Assert.AreEqual(cache["conditionalPutAllKey3"], htPut["conditionalPutAllKey3"]);

            //htPut.Clear();
            //htPut.Add("conditionalPutAllKey4", 355);
            //processor = new ConditionalPutAll(AlwaysFilter.Instance, htPut);

            //cache.InvokeAll(new GreaterFilter(IdentityExtractor.Instance, 300), processor);
            //Assert.AreEqual(cache["conditionalPutAllKey4"], htPut["conditionalPutAllKey4"]);

            CacheFactory.Shutdown();
        }
        public void TestComposite()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml");

            ccf.Config = config;

            INamedCache cache = CacheFactory.GetCache("local-default");

            cache.Clear();

            Address addr1 = new Address("XI krajiske divizije", "Belgrade", "Serbia", "11000");
            Address addr2 = new Address("Pere Velimirovica", "Belgrade", "Serbia", "11000");
            Address addr3 = new Address("Rige od Fere", "Belgrade", "Serbia", "11000");

            cache.Insert("addr1", addr1);
            cache.Insert("addr2", addr2);

            Assert.IsTrue(cache.Count == 2);

            LikeFilter         likeXI        = new LikeFilter(new ReflectionExtractor("Street"), "XI%", '\\', true);
            ExtractorProcessor extractStreet = new ExtractorProcessor(new ReflectionExtractor("Street"));
            IEntryProcessor    putAddr3      = new ConditionalPut(AlwaysFilter.Instance, addr3);
            IEntryProcessor    removeLikeXI  = new ConditionalRemove(likeXI, false);

            IEntryProcessor[]  processors = new IEntryProcessor[] { extractStreet, removeLikeXI, putAddr3 };
            CompositeProcessor processor  = new CompositeProcessor(processors);

            Object objResult = cache.Invoke("addr1", processor);

            Assert.IsTrue(cache.Count == 2);
            object[] objResultArr = objResult as object[];
            Assert.IsNotNull(objResultArr);
            Assert.AreEqual(addr1.Street, objResultArr[0]);

            Address res = cache["addr1"] as Address;

            Assert.IsNotNull(res);
            Assert.AreEqual(addr3.City, res.City);
            Assert.AreEqual(addr3.State, res.State);
            Assert.AreEqual(addr3.Street, res.Street);
            Assert.AreEqual(addr3.ZIP, res.ZIP);

            res = cache["addr2"] as Address;
            Assert.IsNotNull(res);
            Assert.AreEqual(addr2.City, res.City);
            Assert.AreEqual(addr2.State, res.State);
            Assert.AreEqual(addr2.Street, res.Street);
            Assert.AreEqual(addr2.ZIP, res.ZIP);

            IDictionary dictResult = cache.InvokeAll(new ArrayList(new object[] { "addr1", "addr2" }), processor);

            Assert.IsTrue(cache.Count == 2);
            Address address = cache["addr1"] as Address;

            Assert.IsNotNull(address);
            Assert.AreEqual(addr3.Street, address.Street);
            address = cache["addr2"] as Address;
            Assert.IsNotNull(address);
            Assert.AreEqual(addr3.Street, address.Street);
            object[] objectArr = dictResult["addr1"] as object[];
            Assert.IsNotNull(objectArr);
            Assert.AreEqual(objectArr[0], addr3.Street);
            objectArr = dictResult["addr2"] as object[];
            Assert.IsNotNull(objectArr);
            Assert.AreEqual(objectArr[0], addr2.Street);

            CacheFactory.Shutdown();
        }
Beispiel #10
0
        public void TestVersionPutAll()
        {
            Hashtable ht = new Hashtable();

            ht.Add("noon", new Temperature(100, 'f', 12));
            ht.Add("midnight", new Temperature(25, 'f', 0));
            IEntryProcessor processor  = new VersionedPutAll(ht, true, false);
            IEntryProcessor processor1 = new VersionedPutAll(ht, true, false);

            Assert.AreEqual(processor.ToString(), processor1.ToString());

            Temperature temperature = new Temperature(500, 'C', 1);

            LocalCache.Entry entry = new LocalCache.Entry(new LocalCache(), "morning", temperature);

            processor.Process(entry);

            Temperature entryTemp = entry.Value as Temperature;

            Assert.AreEqual(entryTemp.Grade, temperature.Grade);
            Assert.AreEqual(entryTemp.Value, temperature.Value);

            temperature = new Temperature(500, 'C', 12);
            entry       = new LocalCache.Entry(new LocalCache(), "noon", temperature);

            processor.Process(entry);

            entryTemp = entry.Value as Temperature;
            Assert.AreEqual(entryTemp.Grade, 'F');
            Assert.AreEqual(entryTemp.Value, 100);

            // testing on Remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Temperature t1 = new Temperature(3, 'c', 8);
            Temperature t2 = new Temperature(24, 'c', 12);
            Temperature t3 = new Temperature(15, 'c', 18);
            Temperature t4 = new Temperature(0, 'c', 0);

            cache.Insert("morning", t1);
            cache.Insert("noon", t2);
            cache.Insert("afternoon", t3);
            cache.Insert("midnight", t4);

            ht = new Hashtable();
            ht.Add("noon", new Temperature(100, 'f', 12));
            ht.Add("midnight", new Temperature(25, 'f', 0));

            processor = new VersionedPutAll(ht, true, false);
            cache.InvokeAll(cache.Keys, processor);

            Temperature after = (Temperature)cache["midnight"];

            Assert.AreEqual(25, after.Value);
            Assert.AreEqual('F', after.Grade);
            Assert.AreEqual(1, after.Version);

            after = (Temperature)cache["noon"];
            Assert.AreEqual(100, after.Value);
            Assert.AreEqual('F', after.Grade);
            Assert.AreEqual(13, after.Version);

            CacheFactory.Shutdown();
        }
Beispiel #11
0
        public void TestConditionalPut()
        {
            ConditionalPut       conditionalPut  = new ConditionalPut(AlwaysFilter.Instance, 1500);
            ConditionalPut       conditionalPut1 = new ConditionalPut(AlwaysFilter.Instance, 1500);
            IInvocableCacheEntry entry           = new LocalCache.Entry(new LocalCache(), "key1", 1200);
            Object result = conditionalPut.Process(entry);

            Assert.AreEqual(1500, entry.Value);

            ConditionalPut conditionalPut2 = new ConditionalPut(new GreaterFilter(IdentityExtractor.Instance, 100), 100);

            entry  = new LocalCache.Entry(new LocalCache(), "key1", 1200);
            result = conditionalPut2.Process(entry);
            Assert.AreEqual(100, entry.Value);

            entry  = new LocalCache.Entry(new LocalCache(), "key1", 80);
            result = conditionalPut2.Process(entry);
            Assert.AreEqual(80, entry.Value);

            Assert.AreEqual(conditionalPut, conditionalPut1);
            Assert.AreEqual(conditionalPut.ToString(), conditionalPut1.ToString());
            Assert.AreEqual(conditionalPut.GetHashCode(), conditionalPut1.GetHashCode());

            // testing on remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            Hashtable ht = new Hashtable();

            ht.Add("conditionalPutKey1", 435);
            ht.Add("conditionalPutKey2", 253);
            ht.Add("conditionalPutKey3", 3);
            ht.Add("conditionalPutKey4", 200);
            ht.Add("conditionalPutKey5", 333);
            cache.InsertAll(ht);

            IFilter greaterThen600 = new GreaterFilter(IdentityExtractor.Instance, 600);
            IFilter greaterThen200 = new GreaterFilter(IdentityExtractor.Instance, 200);

            // no entries with value>600
            ICollection keys = cache.GetKeys(greaterThen600);

            Assert.IsTrue(keys.Count == 0);

            // invoke processor for one entry with filter that will evaluate to false
            // again, no entries with value>600
            IEntryProcessor processor = new ConditionalPut(greaterThen600, 666);

            cache.Invoke("conditionalPutKey1", processor);
            keys = cache.GetKeys(greaterThen600);
            Assert.IsTrue(keys.Count == 0);

            // invoke processor for one entry with filter that will evaluate to true
            // this will change one entry
            processor = new ConditionalPut(AlwaysFilter.Instance, 666);
            cache.Invoke("conditionalPutKey1", processor);
            keys = cache.GetKeys(greaterThen600);
            Assert.AreEqual(keys.Count, 1);
            Assert.AreEqual(cache["conditionalPutKey1"], 666);

            // 3 entries with value>200
            keys = cache.GetKeys(greaterThen200);
            Assert.AreEqual(keys.Count, 3);

            // invoke processor for these three entries
            processor = new ConditionalPut(greaterThen200, 666);
            IDictionary results = cache.InvokeAll(cache.Keys, processor);

            keys = cache.GetKeys(greaterThen600);
            Assert.AreEqual(keys.Count, 3);

            CacheFactory.Shutdown();
        }
Beispiel #12
0
        public void TestComposite()
        {
            Address addr1   = new Address("XI krajiske divizije", "Belgrade", "Serbia", "11000");
            Address addr2   = new Address("Pere Velimirovica", "Belgrade", "Serbia", "11000");
            Address addr3   = new Address("Rige od Fere", "Belgrade", "Serbia", "11000");
            Address addrNEW = new Address("NEW Pere", "NEW Belgrade", "Serbia", "11000");

            IEntryProcessor putLikeXI  = new ConditionalPut(new LikeFilter(new ReflectionExtractor("Street"), "XI%", '\\', true), addr2);
            IEntryProcessor putLikeRig = new ConditionalPut(new LikeFilter(new ReflectionExtractor("Street"), "Rige%", '\\', true), addrNEW);

            IEntryProcessor[]  processors = new IEntryProcessor[] { putLikeXI, putLikeRig };
            CompositeProcessor processor  = new CompositeProcessor(processors);
            CompositeProcessor processor1 = new CompositeProcessor(processors);

            Assert.AreEqual(processor, processor1);
            Assert.AreEqual(processor.GetHashCode(), processor1.GetHashCode());
            Assert.AreEqual(processor.ToString(), processor1.ToString());

            LocalCache.Entry entry = new LocalCache.Entry(new LocalCache(), "addr1", addr1);
            processor.Process(entry);
            Assert.AreEqual(addr2, entry.Value);

            entry = new LocalCache.Entry(new LocalCache(), "addr2", addr2);
            processor.Process(entry);
            Assert.AreEqual(addr2, entry.Value);

            entry = new LocalCache.Entry(new LocalCache(), "addr3", addr3);
            processor.Process(entry);
            Assert.AreEqual(addrNEW, entry.Value);

            // testing on Remote cache
            INamedCache cache = CacheFactory.GetCache(CacheName);

            cache.Clear();

            cache.Insert("addr1", addr1);
            cache.Insert("addr2", addr2);

            Assert.IsTrue(cache.Count == 2);

            LikeFilter         likeXI        = new LikeFilter(new ReflectionExtractor("getStreet"), "XI%", '\\', true);
            ExtractorProcessor extractStreet = new ExtractorProcessor(new ReflectionExtractor("getStreet"));
            IEntryProcessor    putAddr3      = new ConditionalPut(AlwaysFilter.Instance, addr3);
            IEntryProcessor    removeLikeXI  = new ConditionalRemove(likeXI, false);

            processors = new IEntryProcessor[] { extractStreet, removeLikeXI, putAddr3 };
            processor  = new CompositeProcessor(processors);

            Object objResult = cache.Invoke("addr1", processor);

            Assert.IsTrue(cache.Count == 2);
            Assert.AreEqual(addr1.Street, (objResult as Object[])[0]);

            Address res = cache["addr1"] as Address;

            Assert.AreEqual(addr3.City, res.City);
            Assert.AreEqual(addr3.State, res.State);
            Assert.AreEqual(addr3.Street, res.Street);
            Assert.AreEqual(addr3.ZIP, res.ZIP);

            res = cache["addr2"] as Address;
            Assert.AreEqual(addr2.City, res.City);
            Assert.AreEqual(addr2.State, res.State);
            Assert.AreEqual(addr2.Street, res.Street);
            Assert.AreEqual(addr2.ZIP, res.ZIP);

            IDictionary dictResult = cache.InvokeAll(new ArrayList(new object[] { "addr1", "addr2" }), processor);

            Assert.IsTrue(cache.Count == 2);
            Assert.AreEqual(addr3.Street, (cache["addr1"] as Address).Street);
            Assert.AreEqual(addr3.Street, (cache["addr2"] as Address).Street);
            Assert.AreEqual((dictResult["addr1"] as object[])[0], addr3.Street);
            Assert.AreEqual((dictResult["addr2"] as object[])[0], addr2.Street);

            CacheFactory.Shutdown();
        }