public void TestExtractorSerialization()
        {
            ConfigurablePofContext ctx = new ConfigurablePofContext("assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-config.xml");

            Assert.IsNotNull(ctx);

            ChainedExtractor         chainedExtractor         = new ChainedExtractor("member1");
            ComparisonValueExtractor comparisonValueExtractor = new ComparisonValueExtractor("member2", "member3");
            IdentityExtractor        identityExtractor        = new IdentityExtractor();
            KeyExtractor             keyExtractor             = new KeyExtractor("member4");
            MultiExtractor           multiExtractor           = new MultiExtractor("member5,member6,member7");
            ReflectionExtractor      reflectionExtractor      = new ReflectionExtractor("member8");

            Stream stream = new MemoryStream();

            ctx.Serialize(new DataWriter(stream), chainedExtractor);
            ctx.Serialize(new DataWriter(stream), comparisonValueExtractor);
            ctx.Serialize(new DataWriter(stream), identityExtractor);
            ctx.Serialize(new DataWriter(stream), keyExtractor);
            ctx.Serialize(new DataWriter(stream), multiExtractor);
            ctx.Serialize(new DataWriter(stream), reflectionExtractor);

            stream.Position = 0;
            Assert.AreEqual(chainedExtractor, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(comparisonValueExtractor, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(identityExtractor, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(keyExtractor, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(multiExtractor, ctx.Deserialize(new DataReader(stream)));
            Assert.AreEqual(reflectionExtractor, ctx.Deserialize(new DataReader(stream)));

            stream.Close();
        }
        public void TestMultiExtractor()
        {
            IValueExtractor extractor = new MultiExtractor("field,Property,GetMethod");

            IValueExtractor re1 = new ReflectionExtractor("field");
            IValueExtractor re2 = new ReflectionExtractor("Property");
            IValueExtractor re3 = new ReflectionExtractor("GetMethod");

            IValueExtractor[] res = { re1, re2, re3 };

            IValueExtractor extractor1 = new MultiExtractor(res);

            Assert.IsNotNull(extractor);
            Assert.IsNotNull(extractor1);
            Assert.AreEqual(extractor, extractor1);
            Assert.AreEqual(extractor.ToString(), extractor1.ToString());
            Assert.AreEqual(extractor.GetHashCode(), extractor1.GetHashCode());

            IValueExtractor[] extractors = (extractor as MultiExtractor).Extractors;
            Assert.IsNotNull(extractors);
            Assert.AreEqual(extractors.Length, 3);
            Assert.AreEqual(extractors[0], re1);
            Assert.AreEqual(extractors[1], re2);
            Assert.AreEqual(extractors[2], re3);

            ReflectionTestType o1 = new ReflectionTestType();
            IList list            = (IList)extractor.Extract(o1);

            Assert.AreEqual(list.Count, extractors.Length);
            for (int i = 0; i < extractors.Length; i++)
            {
                Assert.AreEqual(list[i], extractors[i].Extract(o1));
            }
            Assert.IsNull(extractor.Extract(null));

            ReflectionTestType  o2     = new ReflectionTestType();
            TestQueryCacheEntry entry1 = new TestQueryCacheEntry("key1", o1);
            TestQueryCacheEntry entry2 = new TestQueryCacheEntry("key2", o2);

            Assert.AreEqual((extractor as MultiExtractor).CompareEntries(entry1, entry2), 0);
            o2.field = 100;
            Assert.AreEqual((extractor as MultiExtractor).CompareEntries(entry1, entry2), -1);

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

            cache.Clear();

            Address a1 = new Address("street1", "city1", "state1", "zip1");
            Address a2 = new Address("treet2", "city2", "tate2", "zip2");
            Address a3 = new Address("street3", "city3", "state3", "zip3");

            Hashtable ht = new Hashtable();

            ht.Add("multiExtractorKey1", a1);
            ht.Add("multiExtractorKey2", a2);
            ht.Add("multiExtractorKey3", a3);
            cache.InsertAll(ht);

            extractor1 = new ReflectionExtractor("getStreet");
            IValueExtractor extractor2 = new ReflectionExtractor("getState");

            extractor = new MultiExtractor(new IValueExtractor[] { extractor1, extractor2 });

            IFilter     filter = new ContainsFilter(extractor, "street1");
            ICollection keys   = cache.GetKeys(filter);

            Assert.AreEqual(keys.Count, 1);
            Assert.Contains("multiExtractorKey1", (IList)keys);

            CacheFactory.Shutdown();
        }