geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [37/70] [partial] incubator-geode git commit: WAN and CQ code drop under the Pivotal SGA
Date Thu, 28 Jan 2016 18:13:39 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6df75241/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java
new file mode 100644
index 0000000..51a60d2
--- /dev/null
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java
@@ -0,0 +1,686 @@
+package com.gemstone.gemfire.cache.query.dunit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.query.CqAttributes;
+import com.gemstone.gemfire.cache.query.CqAttributesFactory;
+import com.gemstone.gemfire.cache.query.CqEvent;
+import com.gemstone.gemfire.cache.query.CqListener;
+import com.gemstone.gemfire.cache.query.CqQuery;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.Struct;
+import com.gemstone.gemfire.cache.query.cq.dunit.CqQueryTestListener;
+import com.gemstone.gemfire.cache.query.dunit.PdxQueryCQTestBase.TestObject;
+import com.gemstone.gemfire.cache30.ClientServerTestCase;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+
+import dunit.Host;
+import dunit.SerializableRunnable;
+import dunit.VM;
+import dunit.DistributedTestCase.WaitCriterion;
+
+public class PdxQueryCQDUnitTest extends PdxQueryCQTestBase {
+
+  public PdxQueryCQDUnitTest(String name) {
+    super(name);
+  }
+  
+  /**
+   * Tests client-server query on PdxInstance.
+   */
+  public void testCq() throws CacheException {
+    
+    final Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0);
+    VM vm1 = host.getVM(1);
+    VM vm2 = host.getVM(2);
+    VM vm3 = host.getVM(3);
+    final int numberOfEntries = 10;
+    final int queryLimit = 6;  // where id > 5 (0-5)
+    
+    // Start server1
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        Region region = getRootRegion().getSubregion(regionName);
+        for (int i=0; i<numberOfEntries; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }
+      }
+    });
+
+    // Start server2
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        Region region = getRootRegion().getSubregion(regionName);
+      }
+    });
+
+    // Client pool.
+    final int port0 = vm0.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+    final int port1 = vm1.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+
+    final String host0 = getServerHostName(vm0.getHost());
+
+    // Create client pool.
+    final String poolName = "testCqPool"; 
+    createPool(vm2, poolName, new String[]{host0}, new int[]{port0}, true);
+    createPool(vm3, poolName, new String[]{host0}, new int[]{port1}, true);
+    final String cqName = "testCq";
+    
+    // Execute CQ
+    SerializableRunnable executeCq = new CacheSerializableRunnable("Execute queries") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Create CQ. ###" + cqName);
+        // Get CQ Service.
+        QueryService qService = null;
+        try {
+          qService = (PoolManager.find(poolName)).getQueryService();
+        } catch (Exception cqe) {
+          fail("Failed to getCQService.", cqe);
+        }
+        // Create CQ Attributes.
+        CqAttributesFactory cqf = new CqAttributesFactory();
+        CqListener[] cqListeners = {new CqQueryTestListener(getLogWriter())};
+        ((CqQueryTestListener)cqListeners[0]).cqName = cqName;
+
+        cqf.initCqListeners(cqListeners);
+        CqAttributes cqa = cqf.create();
+
+        // Create CQ.
+        try {
+          CqQuery cq = qService.newCq(cqName, queryString[3], cqa);
+          SelectResults sr = cq.executeWithInitialResults();
+          for (Object o: sr.asSet()) {
+            Struct s = (Struct)o;
+            Object value = s.get("value");
+            if (!(value instanceof TestObject)) {
+              fail("Expected type TestObject, not found in result set. Found type :" + o.getClass());
+            } 
+          }
+        } catch (Exception ex){
+          AssertionError err = new AssertionError("Failed to create CQ " + cqName + " . ");
+          err.initCause(ex);
+          getLogWriter().info("QueryService is :" + qService, err);
+          throw err;
+        }
+      }
+    };
+
+    vm2.invoke(executeCq);
+    vm3.invoke(executeCq);
+
+    // Check for TestObject instances on Server2.
+    // It should be 0
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+    // update
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        for (int i=0; i<numberOfEntries * 2; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }
+        // Check for TestObject instances.        
+        assertEquals(numberOfEntries * 3, TestObject.numInstance);
+      }
+    });
+
+    // Check for TestObject instances on Server2.
+    // It should be 0
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+
+    SerializableRunnable validateCq = new CacheSerializableRunnable("Validate CQs") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Validating CQ. ### " + cqName);
+        // Get CQ Service.
+        QueryService cqService = null;
+        try {          
+          cqService = getCache().getQueryService();
+        } catch (Exception cqe) {
+          fail("Failed to getCQService.", cqe);
+        }
+        
+        CqQuery cQuery = cqService.getCq(cqName);
+        if (cQuery == null) {
+          fail("Failed to get CqQuery for CQ : " + cqName);
+        }
+        
+        CqAttributes cqAttr = cQuery.getCqAttributes();
+        CqListener cqListeners[] = cqAttr.getCqListeners();
+        final CqQueryTestListener listener = (CqQueryTestListener) cqListeners[0];
+        
+        //Wait for the events to show up on the client.
+        waitForCriterion(new WaitCriterion() {
+          
+          public boolean done() {
+            return listener.getTotalEventCount() >= (numberOfEntries * 2 - queryLimit);
+          }
+          
+          public String description() {
+            return null;
+          }
+        }, 30000, 100, false);
+        
+        listener.printInfo(false);
+    
+        // Check for event type.
+        Object[] cqEvents = listener.getEvents();
+        for (Object o: cqEvents) {
+          CqEvent cqEvent = (CqEvent)o;
+          Object value = cqEvent.getNewValue();
+          if (!(value instanceof TestObject)) {
+            fail("Expected type TestObject, not found in result set. Found type :" + o.getClass());
+          } 
+        }
+        
+        // Check for totalEvents count.
+        assertEquals("Total Event Count mismatch", (numberOfEntries * 2 - queryLimit), listener.getTotalEventCount());
+                
+        // Check for create count.
+        assertEquals("Create Event mismatch", numberOfEntries, listener.getCreateEventCount());
+        
+        // Check for update count.
+        assertEquals("Update Event mismatch", numberOfEntries  - queryLimit, listener.getUpdateEventCount());      
+      }
+    };
+    
+    vm2.invoke(validateCq);
+    vm3.invoke(validateCq);
+    
+    this.closeClient(vm2);
+    this.closeClient(vm3);
+    this.closeClient(vm1);
+    this.closeClient(vm0);
+  }
+  
+  /**
+   * Tests client-server query on PdxInstance.
+   */
+  
+  public void testCqAndInterestRegistrations() throws CacheException {
+    
+    final Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0);
+    VM vm1 = host.getVM(1);
+    VM vm2 = host.getVM(2);
+    VM vm3 = host.getVM(3);
+    final int numberOfEntries = 10;
+    final int queryLimit = 6;  // where id > 5 (0-5)
+    
+    final String[] queries = new String[] {
+        "SELECT * FROM " + regName + " p WHERE p.ticker = 'vmware'",
+        "SELECT * FROM " + regName + " WHERE id > 5", 
+      };
+    
+    // Start server1
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer(false, true);
+        Region region = getRootRegion().getSubregion(regionName);
+      }
+    });
+
+    // Start server2
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer(false, true);
+        Region region = getRootRegion().getSubregion(regionName);
+      }
+    });
+
+    // Client pool.
+    final int port0 = vm0.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+    final int port1 = vm1.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+
+    final String host0 = getServerHostName(vm0.getHost());
+
+    // Create client pool.
+    final String poolName = "testCqPool"; 
+    
+    createPool(vm2, poolName, new String[]{host0, host0}, new int[]{port0, port1}, true);
+    createPool(vm3, poolName, new String[]{host0, host0}, new int[]{port1, port0}, true);
+    
+    final String cqName = "testCq";
+
+    vm3.invoke(new CacheSerializableRunnable("init region") {
+      public void run2() throws CacheException {
+        QueryService localQueryService = null;
+
+        AttributesFactory factory = new AttributesFactory();
+        factory.setScope(Scope.LOCAL);
+        ClientServerTestCase.configureConnectionPool(factory, host0, port1,-1, true, -1, -1, null);
+        Region region = createRegion(regionName, rootRegionName,  factory.create());
+
+        for (int i=0; i<numberOfEntries; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }   
+      }
+    });
+
+    vm2.invoke(new CacheSerializableRunnable("init region") {
+      public void run2() throws CacheException {
+        QueryService localQueryService = null;
+
+        AttributesFactory factory = new AttributesFactory();
+        factory.setScope(Scope.LOCAL);
+        ClientServerTestCase.configureConnectionPool(factory, host0, port0,-1, true, -1, -1, null);
+        Region region = createRegion(regionName, rootRegionName,  factory.create());
+      }
+    });
+    
+    SerializableRunnable subscribe = new CacheSerializableRunnable("subscribe") {
+      public void run2() throws CacheException {
+        
+        // Register interest
+        Region region = getRootRegion().getSubregion(regionName);
+        List list = new ArrayList();
+        for (int i = 1; i <= numberOfEntries * 3; i++) {
+          if (i % 4 == 0) {
+            list.add("key-"+i);
+          }
+        }
+        region.registerInterest(list);
+        
+        getLogWriter().info("### Create CQ. ###" + cqName);
+        // Get CQ Service.
+        QueryService qService = null;
+        try {
+          qService = (PoolManager.find(poolName)).getQueryService();
+        } catch (Exception cqe) {
+          fail("Failed to getCQService.", cqe);
+        }
+        // Create CQ Attributes.
+        for (int i=0; i < queries.length; i++) {
+          CqAttributesFactory cqf = new CqAttributesFactory();
+          CqListener[] cqListeners = {new CqQueryTestListener(getLogWriter())};
+          ((CqQueryTestListener)cqListeners[0]).cqName = (cqName + i);
+
+          cqf.initCqListeners(cqListeners);
+          CqAttributes cqa = cqf.create();
+
+          // Create CQ.
+          try {
+            CqQuery cq = qService.newCq(cqName + i, queries[i], cqa);
+            SelectResults sr = cq.executeWithInitialResults();
+            for (Object o: sr.asSet()) {
+              Struct s = (Struct)o;
+              Object value = s.get("value");
+              if (!(value instanceof TestObject)) {
+                fail("Expected type TestObject, not found in result set. Found type :" + o.getClass());
+              } 
+            }
+          } catch (Exception ex){
+            AssertionError err = new AssertionError("Failed to create CQ " + cqName + " . ");
+            err.initCause(ex);
+            getLogWriter().info("QueryService is :" + qService, err);
+            throw err;
+          }
+        }
+      }
+    };
+
+    vm2.invoke(subscribe);
+    vm3.invoke(subscribe);
+
+    // Check for TestObject instances on Server2.
+    // It should be 0
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        // Check for TestObject instances.        
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+
+    vm3.invoke(new CacheSerializableRunnable("Update") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        
+        for (int i=0; i<numberOfEntries * 2; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }        
+      }
+    });
+    
+    // Validate CQs.
+    for (int i=0; i < queries.length; i++) {
+      int expectedEvent = 0;
+      int updateEvents = 0;
+
+      if (i != 0) {
+        expectedEvent = numberOfEntries * 2 - queryLimit;
+        updateEvents = numberOfEntries - queryLimit;
+      } else {
+        expectedEvent = numberOfEntries * 2;
+        updateEvents = numberOfEntries;
+      }
+
+      validateCq (vm2, cqName + i, expectedEvent, numberOfEntries, updateEvents);
+      validateCq (vm3, cqName + i, expectedEvent, numberOfEntries, updateEvents);
+    }
+    
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        // Check for TestObject instances.        
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+    // Check for TestObject instances on Server2.
+    // It should be 0
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+    
+    this.closeClient(vm2);
+    this.closeClient(vm3);
+    this.closeClient(vm1);
+    this.closeClient(vm0);
+  }
+  
+  /**
+   * Tests client-server query on PdxInstance.
+   */
+  public void testCqAndInterestRegistrationsWithFailOver() throws CacheException {
+    
+    final Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0);
+    VM vm1 = host.getVM(1);
+    VM vm2 = host.getVM(2);
+    VM vm3 = host.getVM(3);
+    final int numberOfEntries = 10;
+    final int queryLimit = 6;  // where id > 5 (0-5)
+    
+    final String[] queries = new String[] {
+        "SELECT * FROM " + regName + " p WHERE p.ticker = 'vmware'",
+        "SELECT * FROM " + regName + " WHERE id > 5", 
+      };
+    
+    // Start server1
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer(false, true);
+        Region region = getRootRegion().getSubregion(regionName);
+      }
+    });
+
+    // Start server2
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer(false, true);
+        Region region = getRootRegion().getSubregion(regionName);
+      }
+    });
+
+    // Start server3
+    vm2.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer(false, true);
+        Region region = getRootRegion().getSubregion(regionName);
+      }
+    });
+    
+    // Client pool.
+    final int port0 = vm0.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+    final int port1 = vm1.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+    final int port2 = vm2.invokeInt(PdxQueryCQTestBase.class, "getCacheServerPort");
+    
+    final String host0 = getServerHostName(vm0.getHost());
+
+    // Create client pool.
+    final String poolName = "testCqPool";     
+    createPool(vm3, poolName, new String[]{host0, host0, host0}, new int[]{port1, port0, port2}, true, 1);
+    
+    final String cqName = "testCq";
+
+    vm3.invoke(new CacheSerializableRunnable("init region") {
+      public void run2() throws CacheException {
+        QueryService localQueryService = null;
+
+        AttributesFactory factory = new AttributesFactory();
+        factory.setScope(Scope.LOCAL);
+        ClientServerTestCase.configureConnectionPool(factory, host0, port1,-1, true, -1, -1, null);
+        Region region = createRegion(regionName, rootRegionName,  factory.create());
+
+        for (int i=0; i<numberOfEntries; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }   
+      }
+    });
+
+    SerializableRunnable subscribe = new CacheSerializableRunnable("subscribe") {
+      public void run2() throws CacheException {
+        
+        // Register interest
+        Region region = getRootRegion().getSubregion(regionName);
+        List list = new ArrayList();
+        for (int i = 1; i <= numberOfEntries * 3; i++) {
+          if (i % 4 == 0) {
+            list.add("key-"+i);
+          }
+        }
+        region.registerInterest(list);
+        
+        getLogWriter().info("### Create CQ. ###" + cqName);
+        // Get CQ Service.
+        QueryService qService = null;
+        try {
+          qService = (PoolManager.find(poolName)).getQueryService();
+        } catch (Exception cqe) {
+          fail("Failed to getCQService.", cqe);
+        }
+        // Create CQ Attributes.
+        for (int i=0; i < queries.length; i++) {
+          CqAttributesFactory cqf = new CqAttributesFactory();
+          CqListener[] cqListeners = {new CqQueryTestListener(getLogWriter())};
+          ((CqQueryTestListener)cqListeners[0]).cqName = (cqName + i);
+
+          cqf.initCqListeners(cqListeners);
+          CqAttributes cqa = cqf.create();
+
+          // Create CQ.
+          try {
+            CqQuery cq = qService.newCq(cqName + i, queries[i], cqa);
+            SelectResults sr = cq.executeWithInitialResults();
+            for (Object o: sr.asSet()) {
+              Struct s = (Struct)o;
+              Object value = s.get("value");
+              if (!(value instanceof TestObject)) {
+                fail("Expected type TestObject, not found in result set. Found type :" + o.getClass());
+              } 
+            }
+          } catch (Exception ex){
+            AssertionError err = new AssertionError("Failed to create CQ " + cqName + " . ");
+            err.initCause(ex);
+            getLogWriter().info("QueryService is :" + qService, err);
+            throw err;
+          }
+        }
+      }
+    };
+
+    vm3.invoke(subscribe);
+
+    // Check for TestObject instances on Server2.
+    // It should be 0
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        // Check for TestObject instances.        
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+
+    // update
+    vm3.invoke(new CacheSerializableRunnable("Update") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        
+        for (int i=0; i<numberOfEntries * 2; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }        
+      }
+    });
+    
+    // Validate CQs.
+    for (int i=0; i < queries.length; i++) {
+      int expectedEvent = 0;
+      int updateEvents = 0;
+
+      if (i != 0) {
+        expectedEvent = (numberOfEntries * 2) - queryLimit;
+        updateEvents = numberOfEntries - queryLimit;
+      } else {
+        expectedEvent = numberOfEntries * 2;
+        updateEvents = numberOfEntries;
+      }
+
+      validateCq (vm3, cqName + i, expectedEvent, numberOfEntries, updateEvents);
+    }
+    
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        // Check for TestObject instances.        
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+
+    vm1.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+
+    // Update
+    vm3.invokeAsync(new CacheSerializableRunnable("Update") {
+      public void run2() throws CacheException {
+        Region region = getRootRegion().getSubregion(regionName);
+        
+        for (int i=0; i<numberOfEntries * 2; i++) {
+          region.put("key-"+i, new TestObject(i, "vmware"));
+        }        
+      }
+    });
+    
+    // Kill server
+    this.closeClient(vm0);
+    
+    // validate cq
+    for (int i=0; i < queries.length; i++) {
+      int expectedEvent = 0;
+      int updateEvents = 0;
+
+      if (i != 0) {
+        expectedEvent = (numberOfEntries * 4) - (queryLimit * 2); // Double the previous time
+        updateEvents = (numberOfEntries * 3) - (queryLimit * 2); 
+      } else {
+        expectedEvent = numberOfEntries * 4;
+        updateEvents = numberOfEntries * 3;
+      }
+
+      validateCq (vm3, cqName + i, expectedEvent, numberOfEntries, updateEvents);
+    }
+    
+    this.closeClient(vm1);
+    
+    // Check for TestObject instances on Server3.
+    // It should be 0
+    vm2.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        assertEquals(0, TestObject.numInstance);
+      }
+    });
+    
+    
+    this.closeClient(vm2);
+    this.closeClient(vm3);
+    
+  }
+  
+  public void validateCq(VM vm, final String cqName, final int expectedEvents, final int createEvents,
+      final int updateEvents) {
+        vm.invoke(new CacheSerializableRunnable("Validate CQs") {
+          public void run2() throws CacheException {
+            getLogWriter().info("### Validating CQ. ### " + cqName);
+            // Get CQ Service.
+            QueryService cqService = null;
+              try {          
+                cqService = getCache().getQueryService();
+              } catch (Exception cqe) {
+                fail("Failed to getCQService.", cqe);
+              }
+      
+              CqQuery cQuery = cqService.getCq(cqName);
+              if (cQuery == null) {
+                fail("Failed to get CqQuery for CQ : " + cqName);
+              }
+      
+              CqAttributes cqAttr = cQuery.getCqAttributes();
+              CqListener cqListeners[] = cqAttr.getCqListeners();
+              CqQueryTestListener listener = (CqQueryTestListener) cqListeners[0];
+              listener.printInfo(false);
+      
+              // Check for event type.
+              Object[] cqEvents = listener.getEvents();
+              for (Object o: cqEvents) {
+                CqEvent cqEvent = (CqEvent)o;
+                Object value = cqEvent.getNewValue();
+                if (!(value instanceof TestObject)) {
+                  fail("Expected type TestObject, not found in result set. Found type :" + o.getClass());
+                } 
+              }
+      
+              // Check for totalEvents count.
+              if (listener.getTotalEventCount() != expectedEvents) {
+                listener.waitForTotalEvents(expectedEvents);
+              }
+              
+              assertEquals("Total Event Count mismatch", (expectedEvents), listener.getTotalEventCount());
+      
+              // Check for create count.
+              assertEquals("Create Event mismatch", createEvents, listener.getCreateEventCount());
+      
+              // Check for update count.
+              assertEquals("Update Event mismatch", updateEvents, listener.getUpdateEventCount());      
+            }
+        });
+      }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6df75241/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
new file mode 100755
index 0000000..de1ed89
--- /dev/null
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
@@ -0,0 +1,500 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.query.dunit;
+
+import java.io.IOException;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.PoolFactory;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.query.CacheUtils;
+import com.gemstone.gemfire.cache.query.CqAttributes;
+import com.gemstone.gemfire.cache.query.CqEvent;
+import com.gemstone.gemfire.cache.query.CqListener;
+import com.gemstone.gemfire.cache.query.CqQuery;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.Struct;
+import com.gemstone.gemfire.cache.query.cq.dunit.CqQueryTestListener;
+import com.gemstone.gemfire.cache.query.data.PortfolioPdx;
+import com.gemstone.gemfire.cache.query.data.PositionPdx;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.compression.Compressor;
+import com.gemstone.gemfire.compression.SnappyCompressor;
+import com.gemstone.gemfire.i18n.LogWriterI18n;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.pdx.PdxReader;
+import com.gemstone.gemfire.pdx.PdxSerializable;
+import com.gemstone.gemfire.pdx.PdxWriter;
+
+import dunit.Host;
+import dunit.SerializableRunnable;
+import dunit.VM;
+
+public abstract class PdxQueryCQTestBase extends CacheTestCase {
+
+  /** The port on which the bridge server was started in this VM */
+  private static int bridgeServerPort;
+  protected static final Compressor compressor = SnappyCompressor.getDefaultInstance();
+  protected final String rootRegionName = "root";
+  protected final String regionName = "PdxTest";
+  protected final String regionName2 = "PdxTest2";
+  protected final String regName = "/" + rootRegionName + "/" + regionName;
+  protected final String regName2 = "/" + rootRegionName + "/" + regionName2;
+  protected final String[] queryString = new String[] {
+      "SELECT DISTINCT id FROM " + regName, // 0
+      "SELECT * FROM " + regName, // 1
+      "SELECT ticker FROM " + regName, // 2
+      "SELECT * FROM " + regName + " WHERE id > 5", // 3
+      "SELECT p FROM " + regName + " p, p.idTickers idTickers WHERE p.ticker = 'vmware'", // 4
+    };
+
+  private static int getCacheServerPort() {
+    return bridgeServerPort;
+  }
+
+  public void tearDown2() throws Exception {
+    disconnectAllFromDS(); // tests all expect to create a new ds
+    // Reset the testObject numinstance for the next test.
+    TestObject.numInstance = 0;
+    // In all VM.
+    resetTestObjectInstanceCount();    
+  }
+
+  private void resetTestObjectInstanceCount() {
+    final Host host = Host.getHost(0);
+    for (int i=0; i < 4; i++) {
+      VM vm = host.getVM(i);
+      vm.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+        public void run2() throws CacheException {
+          TestObject.numInstance = 0;
+          PortfolioPdx.numInstance = 0;
+          PositionPdx.numInstance = 0;
+          PositionPdx.cnt = 0;
+          TestObject2.numInstance = 0;
+        }
+      });
+    }
+  }
+
+  public void createPool(VM vm, String poolName, String server, int port,
+      boolean subscriptionEnabled) {
+        createPool(vm, poolName, new String[]{server}, new int[]{port}, subscriptionEnabled);  
+      }
+
+  public void createPool(VM vm, String poolName, String server, int port) {
+    createPool(vm, poolName, new String[]{server}, new int[]{port}, false);  
+  }
+
+  public void createPool(VM vm, final String poolName, final String[] servers, final int[] ports,
+      final boolean subscriptionEnabled) {
+        createPool(vm, poolName, servers, ports, subscriptionEnabled, 0);    
+      }
+
+  public void createPool(VM vm, final String poolName, final String[] servers, final int[] ports,
+      final boolean subscriptionEnabled, final int redundancy) {
+        vm.invoke(new CacheSerializableRunnable("createPool :" + poolName) {
+          public void run2() throws CacheException {
+            // Create Cache.
+            Properties props = new Properties();
+            props.setProperty("mcast-port", "0");
+            props.setProperty("locators", "");
+            getSystem(props );
+            getCache();        
+            PoolFactory cpf = PoolManager.createFactory();
+            cpf.setSubscriptionEnabled(subscriptionEnabled);
+            cpf.setSubscriptionRedundancy(redundancy);
+            for (int i=0; i < servers.length; i++){
+              getLogWriter().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
+              cpf.addServer(servers[i], ports[i]);
+            }
+            cpf.create(poolName);
+          }
+        });   
+      }
+
+  public void executeClientQueries(VM vm, final String poolName, final String queryStr) {
+    vm.invoke(new CacheSerializableRunnable("Execute queries") {
+      public void run2() throws CacheException {
+        SelectResults results = null;
+        Comparator comparator = null;
+        Object[] resultsArray = null;
+        QueryService remoteQueryService = null;
+        QueryService localQueryService = null;
+        SelectResults[][] rs = new SelectResults[1][2];
+        
+        try {
+          remoteQueryService = (PoolManager.find(poolName)).getQueryService();
+          localQueryService = getCache().getQueryService();
+        } catch (Exception e) {
+          fail("Failed to get QueryService.", e);
+        }          
+  
+        try {
+          getLogWriter().info("### Executing Query on server:" + queryStr);
+          Query query = remoteQueryService.newQuery(queryStr);
+          rs[0][0] = (SelectResults)query.execute();
+          //printResults (rs[0][0], " ### Remote Query Results : ####");
+          getLogWriter().info("### Executing Query locally:" + queryStr);
+          query = localQueryService.newQuery(queryStr);
+          rs[0][1] = (SelectResults)query.execute();
+          getLogWriter().info("### Remote Query rs size: " + (rs[0][0]).size() + 
+              "Local Query rs size: " + (rs[0][1]).size());
+          //printResults (rs[0][1], " ### Local Query Results : ####");
+          // Compare local and remote query results.
+          if (!CacheUtils.compareResultsOfWithAndWithoutIndex(rs))
+          {
+             fail("Local and Remote Query Results are not matching for query :" + queryStr);  
+          }
+        } catch (Exception e) {
+          fail("Failed executing " + queryStr, e);
+        }
+      }
+    });
+  }
+
+  public void printResults(SelectResults results, String message) {
+    Object r;
+    Struct s;
+    LogWriterI18n logger = GemFireCacheImpl.getInstance().getLoggerI18n();
+    logger.fine(message);
+    int row = 0;
+    for (Iterator iter = results.iterator(); iter.hasNext(); ) {
+      r = iter.next();
+      row++;
+      if (r instanceof Struct) {
+         s = (Struct)r;
+         String[] fieldNames = ((Struct)r).getStructType().getFieldNames();
+         for (int i=0; i < fieldNames.length; i++){
+            logger.fine("### Row " + row  + "\n" + "Field: " +
+                fieldNames[i] + " > " + s.get(fieldNames[i]).toString());
+         }
+      } else {
+        logger.fine("#### Row " + row + "\n" + r);
+      }
+    }
+  }
+
+  protected void configAndStartBridgeServer() {
+    configAndStartBridgeServer(false, false, false, null); 
+  }
+
+  protected void configAndStartBridgeServer(boolean isPr, boolean isAccessor) {
+    configAndStartBridgeServer(false, false, false, null); 
+  }
+
+  protected void configAndStartBridgeServer(boolean isPr, boolean isAccessor,
+      boolean asyncIndex, Compressor compressor) {
+        AttributesFactory factory = new AttributesFactory();
+        if (isPr) {
+          PartitionAttributesFactory paf = new PartitionAttributesFactory();
+          //factory.setDataPolicy(DataPolicy.PARTITION);
+          if (isAccessor){
+            paf.setLocalMaxMemory(0);
+          }
+          PartitionAttributes prAttr = paf.setTotalNumBuckets(20).setRedundantCopies(0).create();
+          factory.setPartitionAttributes(prAttr);
+        } else {
+          factory.setScope(Scope.DISTRIBUTED_ACK);
+          factory.setDataPolicy(DataPolicy.REPLICATE);      
+        }
+        if (asyncIndex) {
+          factory.setIndexMaintenanceSynchronous(!asyncIndex);
+        }
+        if (compressor != null) {
+          factory.setCompressor(compressor);
+        }
+        
+        createRegion(this.regionName, this.rootRegionName, factory.create());
+        createRegion(this.regionName2, this.rootRegionName, factory.create());
+        
+        try {
+          startBridgeServer(0, false);
+        } catch (Exception ex) {
+          fail("While starting CacheServer", ex);
+        }
+      }
+
+  protected void executeCompiledQueries(String poolName, Object[][] params) {
+    SelectResults results = null;
+    Comparator comparator = null;
+    Object[] resultsArray = null;
+    QueryService qService = null;
+  
+    try {
+      qService = (PoolManager.find(poolName)).getQueryService();
+    } catch (Exception e) {
+      fail("Failed to get QueryService.", e);
+    }          
+  
+    for (int i=0; i < queryString.length; i++){
+      try {
+        getLogWriter().info("### Executing Query :" + queryString[i]);
+        Query query = qService.newQuery(queryString[i]);
+        results = (SelectResults)query.execute(params[i]);
+      } catch (Exception e) {
+        fail("Failed executing " + queryString[i], e);
+      }
+    }        
+  }
+
+  /**
+   * Starts a bridge server on the given port, using the given
+   * deserializeValues and notifyBySubscription to serve up the
+   * given region.
+   */
+  protected void startBridgeServer(int port, boolean notifyBySubscription)
+      throws IOException {
+      
+        Cache cache = getCache();
+        CacheServer bridge = cache.addCacheServer();
+        bridge.setPort(port);
+        bridge.setNotifyBySubscription(notifyBySubscription);
+        bridge.start();
+        bridgeServerPort = bridge.getPort();
+      }
+
+  /**
+   * Stops the bridge server that serves up the given cache.
+   */
+  protected void stopBridgeServer(Cache cache) {
+    CacheServer bridge =
+      (CacheServer) cache.getCacheServers().iterator().next();
+    bridge.stop();
+    assertFalse(bridge.isRunning());
+  }
+
+  public void closeClient(VM client) {
+    SerializableRunnable closeCache =
+      new CacheSerializableRunnable("Close Client") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Close Client. ###");
+        try {
+          closeCache();
+          disconnectFromDS();
+        } catch (Exception ex) {
+          getLogWriter().info("### Failed to get close client. ###");
+        }
+      }
+    };
+    
+    client.invoke(closeCache);
+  }
+
+  public static class TestObject2 implements PdxSerializable {
+    public int _id;
+    public static int numInstance = 0;
+    
+    public TestObject2(){
+      numInstance++;
+    }
+    
+    public TestObject2(int id){
+      this._id = id;
+      numInstance++;
+    }
+    
+    public int getId() {
+      return this._id;
+    }
+    
+    public void toData(PdxWriter out) {
+      out.writeInt("id", this._id);
+    }
+    
+    public void fromData(PdxReader in) {
+      this._id = in.readInt("id");
+    }
+    
+    @Override
+    public boolean equals(Object o){
+      getLogWriter().info("In TestObject2.equals() this: " + this + " other :" + o);
+      GemFireCacheImpl.getInstance().getLoggerI18n().fine("In TestObject2.equals() this: " + this + " other :" + o);
+      TestObject2 other = (TestObject2)o;
+      if (_id == other._id) {
+        return true;
+      } else {
+        getLogWriter().info("NOT EQUALS");  
+        return false;
+      }
+    }
+    
+    @Override
+    public int hashCode(){
+      GemFireCacheImpl.getInstance().getLoggerI18n().fine("In TestObject2.hashCode() : " + this._id);
+      return this._id;
+    }
+  }
+
+  public static class TestObject implements PdxSerializable {
+      public static LogWriter log;
+      protected String _ticker;
+      protected int _price;
+      public int id;
+      public int important;
+      public int selection;
+      public int select;
+      public static int numInstance = 0;
+      public Map idTickers = new HashMap();
+      public HashMap positions = new HashMap();
+      public TestObject2 test;
+      
+      public TestObject() {
+        if (log != null) {
+          log.info("TestObject ctor stack trace", new Exception());
+        }
+        numInstance++;
+        //GemFireCacheImpl.getInstance().getLoggerI18n().fine(new Exception("DEBUG"));
+      }
+  
+      public TestObject(int id, String ticker) {
+        if (log != null) {
+          log.info("TestObject ctor stack trace", new Exception());
+        }
+        this.id = id;
+        this._ticker = ticker;
+        this._price = id;
+        this.important = id;
+        this.selection =id;
+        this.select =id;
+        //GemFireCacheImpl.getInstance().getLoggerI18n().fine(new Exception("DEBUG"));
+        numInstance++;
+        idTickers.put(id + "", ticker);
+        this.test = new TestObject2(id);
+      }
+  
+      public TestObject(int id, String ticker, int numPositions) {
+        this(id, ticker);
+        for (int i=0; i < numPositions; i++) {
+          positions.put(id + i, new PositionPdx(ticker + ":" +  id + ":" + i , (id + 100)));
+        }
+      }
+      
+      public int getIdValue() {
+        return this.id;
+      }
+  
+      public String getTicker() {
+        return this._ticker;
+      }
+  
+      public int getPriceValue() {
+        return this._price;
+      }
+  
+      public HashMap getPositions(String id) {
+        return this.positions;  
+      }
+  
+      public String getStatus(){
+        return (id % 2 == 0) ? "active" : "inactive";
+      }
+  
+      public void toData(PdxWriter out)
+      {
+        //System.out.println("Is serializing in WAN: " + GatewayEventImpl.isSerializingValue());
+        out.writeInt("id", this.id);
+        out.writeString("ticker", this._ticker);
+        out.writeInt("price", this._price);
+        out.writeObject("idTickers", this.idTickers);
+        out.writeObject("positions", this.positions);
+        out.writeObject("test", this.test);
+      }
+  
+      public void fromData(PdxReader in)
+      {
+        //System.out.println("Is deserializing in WAN: " + GatewayEventImpl.isDeserializingValue());
+        this.id = in.readInt("id");
+        this._ticker = in.readString("ticker");
+        this._price = in.readInt("price");
+        this.idTickers = (Map)in.readObject("idTickers");
+        this.positions = (HashMap)in.readObject("positions");
+        this.test = (TestObject2)in.readObject("test");
+      }
+  
+      public String toString() {
+        StringBuffer buffer = new StringBuffer();
+        buffer
+        .append("TestObject [")
+        .append("id=")
+        .append(this.id)
+        .append("; ticker=")
+        .append(this._ticker)
+        .append("; price=")
+        .append(this._price)
+        .append("]");
+        return buffer.toString();
+      }
+  
+      @Override
+      public boolean equals(Object o){
+  //      getLogWriter().info("In TestObject.equals() this: " + this + " other :" + o);
+  //      GemFireCacheImpl.getInstance().getLoggerI18n().fine("In TestObject.equals() this: " + this + " other :" + o);
+        TestObject other = (TestObject)o;
+        if ((id == other.id) && (_ticker.equals(other._ticker))) {
+          return true;
+        } else {
+  //        getLogWriter().info("NOT EQUALS");  
+          return false;
+        }
+      }
+      
+      @Override
+      public int hashCode(){
+        GemFireCacheImpl.getInstance().getLoggerI18n().fine("In TestObject.hashCode() : " + this.id);
+        return this.id;
+      }
+  
+    }
+
+  /**
+   * Starts a bridge server on the given port, using the given
+   * deserializeValues and notifyBySubscription to serve up the
+   * given region.
+   */
+  protected void startCacheServer(int port, boolean notifyBySubscription)
+      throws IOException {
+      
+        Cache cache = CacheFactory.getAnyInstance();
+        CacheServer bridge = cache.addCacheServer();
+        bridge.setPort(port);
+        bridge.setNotifyBySubscription(notifyBySubscription);
+        bridge.start();
+        bridgeServerPort = bridge.getPort();
+      }
+
+  public PdxQueryCQTestBase(String name) {
+    super(name);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6df75241/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java
new file mode 100644
index 0000000..fa4f610
--- /dev/null
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java
@@ -0,0 +1,814 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+/**
+ * 
+ */
+package com.gemstone.gemfire.cache.query.dunit;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.MirrorType;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.PoolFactory;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.cq.dunit.CqQueryUsingPoolDUnitTest;
+import com.gemstone.gemfire.cache.query.data.Portfolio;
+import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
+import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache30.ClientServerTestCase;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.cache30.CertifiableTestCacheListener;
+
+import dunit.Host;
+import dunit.SerializableRunnable;
+import dunit.VM;
+
+/**
+ * This class tests register interest behavior on client at startup given that
+ * client has already created a Index on region on which it registers interest.
+ * Then client run a query on region in local cache (Not on server) using the
+ * Index.
+ * 
+ * @author shoagarwal
+ *
+ */
+public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
+
+  /** The port on which the bridge server was started in this VM */
+  private static int bridgeServerPort;
+  
+  private String region = "regionA";
+  private final int KEYS = 1;
+  private final int REGEX = 2;
+
+  private String rootQ = "SELECT ALL * FROM /root p where p.ID > 0";
+  private String incompleteQ = "SELECT ALL * FROM /root/"+region+" p where "; //User needs to append where cond.
+  
+  static public final String KEY = "key-";
+  static public final String REGULAR_EXPRESSION = ".*1+?.*";
+
+  private static final String ROOT = "root";
+  
+  public QueryIndexUpdateRIDUnitTest(String name) {
+    super(name);
+  }
+
+  /* Test creates 1 Client and 1 Server. Client and Server create same region in their cache.
+   * Client creates index and registers interest in region on server and runs a query.
+   * Query must fail as registerInterest does not update indexes on client.
+   */
+
+  public void testClientIndexUpdateWithRIOnKeys() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("CqRegisterInterestIndexUpdateDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, false);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    // Init values at server. 
+    final int size = 10;
+    this.createValues(server, cqDUnitTest.regions[0], size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    cqDUnitTest.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root/regionA p");
+
+    //Register Interest in all Keys on server 
+    this.registerInterestList(client, cqDUnitTest.regions[0], 4, KEYS);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, cqDUnitTest.cqs[0], 4);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  /**
+   * Tests overlap keys between client region and server region to verify the server region values are synched
+   * with client region on register interest.
+   * @throws Exception
+   */
+  public void testClientIndexUpdateWithRIOnOverlapKeys() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("CqRegisterInterestIndexUpdateDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, false);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    cqDUnitTest.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root/regionA p");
+
+    final int size = 10;
+    // Init values at client
+    this.createValues(client, cqDUnitTest.regions[0], size, 1);
+
+    //wait for index to get updated.
+    pause(5 * 1000);
+    //this.validateQueryOnIndex(client, incompleteQ+"p.getID() > 0", 10);
+    
+    this.validateQueryOnIndex(client, incompleteQ+"p.ID > 0", 10);
+
+    // Init values at server.
+    this.createValues(server, cqDUnitTest.regions[0], size, 4 /*start index*/);
+
+    //Register Interest in all Keys on server 
+    this.registerInterestList(client, cqDUnitTest.regions[0], size, KEYS, 4 /*start index*/);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, incompleteQ+"p.ID < "+ 4*4, 3);
+    this.validateQueryOnIndex(client, incompleteQ+"p.ID >= 16", 7);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  public void testClientIndexUpdateWithRIOnRegion() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("CqRegisterInterestIndexUpdateDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, false);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    //Init values at server. 
+    final int size = 10;
+    this.createValues(server, cqDUnitTest.regions[0], size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    cqDUnitTest.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root/regionA p");
+
+    //Register Interest in all Keys on server 
+    cqDUnitTest.registerInterestListCQ(client, cqDUnitTest.regions[0], size, true);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, cqDUnitTest.cqs[0], size);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  public void testClientIndexUpdateWithRIOnRegEx() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, false);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    //Init values at server. 
+    final int size = 10;
+    this.createValues(server, cqDUnitTest.regions[0], size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    cqDUnitTest.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root/regionA p");
+
+    //Register Interest in all Keys on server 
+    this.registerInterestList(client, cqDUnitTest.regions[0], 2, REGEX);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, cqDUnitTest.cqs[0], 2);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  /**
+   * This test tests the RegionClearedException Path in AbsractRegionMap while doing
+   * initialImagePut() during registerInterest on client.
+   * 
+   * @throws Exception
+   */
+  public void testClientIndexUpdateWithRIOnClearedRegion() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, false);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    //Init values at server. 
+    final int size = 1000;
+    this.createValues(server, cqDUnitTest.regions[0], size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    cqDUnitTest.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root/regionA p");
+
+    //Create entries on client to clear region later
+    this.createValues(client, cqDUnitTest.regions[0], size);
+
+    //Register Interest in all Keys on server 
+    //client.invoke(this.getSRRegisterInterestList(cqDUnitTest.regions[0], size, -1 /* Default ALL KEYS */, 0));
+    //this.asyncRegisterInterestList(client, cqDUnitTest.regions[0], size, -1 /* Default ALL KEYS */, 0);
+    registerInterestList(client, cqDUnitTest.regions[0], size, -1);
+    
+    //Wait for Index to get updated.
+    //pause(500);
+    
+    //Start clearing region on client asynchronously.
+    //this.asyncClearRegion(client, cqDUnitTest.regions[0]);
+    client.invoke(this.getSRClearRegion(cqDUnitTest.regions[0]));
+    
+   //Let register interest finish during region clearance
+    //pause(5*1000);
+    
+    //This query execution should fail as it will run on client index and region has been cleared.
+    //Validate query results.
+    this.validateQueryOnIndexWithRegion(client, cqDUnitTest.cqs[0], 0, region);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  /* 
+   * Same tests as above using Partitioned Regions. 
+   */
+
+  public void testClientIndexUpdateWithRIOnPRRegion() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, true);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    // Init values at server. 
+    final int size = 10;
+    this.createValues(server, ROOT, size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    this.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root p");
+
+    //Register Interest in all Keys on server 
+    this.registerInterestList(client, ROOT, size, 0);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, this.rootQ, size);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  public void testClientIndexUpdateWithRIOnPRKeys() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, true);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    // Init values at server. 
+    final int size = 10;
+    this.createValues(server, ROOT, size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    this.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root p");
+
+    //Register Interest in all Keys on server 
+    this.registerInterestList(client, ROOT, 4, KEYS);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, this.rootQ, 4);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  public void testClientIndexUpdateWithRIOnPRRegEx() throws Exception{
+    
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    
+    final Host host = Host.getHost(0);
+    VM server = host.getVM(0);
+    VM client = host.getVM(1);
+
+    this.createServer(server, 0, true);
+
+    final int port = server.invokeInt(QueryIndexUpdateRIDUnitTest.class,
+        "getCacheServerPort");
+    final String host0 = getServerHostName(server.getHost());
+
+    // Init values at server. 
+    final int size = 10;
+    this.createValues(server, ROOT, size);
+
+    String poolName = "testClientIndexUpdateWithRegisterInterest";
+    cqDUnitTest.createPool(client, poolName, host0, port);
+    
+    // Create client.
+    this.createClient(client, port, host0);
+    //Create Index on client
+    cqDUnitTest.createFunctionalIndex(client, "IdIndex", "p.ID", "/root p");
+
+    //Register Interest in all Keys on server 
+    this.registerInterestList(client, "root", 2, REGEX);
+
+    //Wait for Index to get updated.
+    pause(5 * 1000);
+
+    //This query execution should fail as it will run on client index and index are not updated just by registerInterest.
+    //Validate query results.
+    this.validateQueryOnIndex(client, this.rootQ, 2);
+
+    // Close.
+    cqDUnitTest.closeClient(client);
+    cqDUnitTest.closeServer(server);
+  }
+
+  /* Register Interest on data on server */
+  public void registerInterestList(VM vm, final String regionName, final int keySize, final int policy) {
+    registerInterestList(vm, regionName, keySize, policy, 0);    
+  }
+
+  /* Register Interest on data on server */
+  public void registerInterestList(VM vm, final String regionName, final int keySize, final int policy, final int start) {
+    vm.invoke(new CacheSerializableRunnable("Register InterestList") {
+      public void run2() throws CacheException {
+        
+        // Get Query Service.
+        Region region = null;
+        try {
+          if("root".equals(regionName)){
+            region = getRootRegion();
+          } else {
+            region = getRootRegion().getSubregion(regionName);
+          }
+          region.getAttributesMutator().setCacheListener(new CertifiableTestCacheListener(getLogWriter()));
+        } catch (Exception cqe) {
+          AssertionError err = new AssertionError("Failed to get Region.");
+          err.initCause(cqe);
+          throw err;
+        }
+        try {
+          switch (policy) {
+            case REGEX:
+              region.registerInterestRegex(REGULAR_EXPRESSION);
+              break;
+            case KEYS:
+              List list = new ArrayList();
+              for (int i = start != 0 ? start : 1; i <= keySize; i++) {
+                list.add(KEY+i);
+              }
+              region.registerInterest(list);
+              break;
+            default:
+              region.registerInterest("ALL_KEYS");
+          }
+        } catch (Exception ex) {
+          AssertionError err = new AssertionError("Failed to Register InterestList");
+          err.initCause(ex);
+          throw err;
+        }
+      }
+    });   
+  }
+
+  /* Register Interest on data on server */
+  public void asyncRegisterInterestList(VM vm, final String regionName, final int keySize, final int policy, final int start) {
+    vm.invokeAsync(new CacheSerializableRunnable("Register InterestList") {
+      public void run2() throws CacheException {
+        
+        // Get Query Service.
+        Region region = null;
+        try {
+          if("root".equals(regionName)){
+            region = getRootRegion();
+          } else {
+            region = getRootRegion().getSubregion(regionName);
+          }
+          region.getAttributesMutator().setCacheListener(new CertifiableTestCacheListener(getLogWriter()));
+        } catch (Exception cqe) {
+          AssertionError err = new AssertionError("Failed to get Region.");
+          err.initCause(cqe);
+          throw err;
+        }
+        try {
+          switch (policy) {
+            case REGEX:
+              region.registerInterestRegex(REGULAR_EXPRESSION);
+              break;
+            case KEYS:
+              List list = new ArrayList();
+              for (int i = start != 0 ? start : 1; i <= keySize; i++) {
+                list.add(KEY+i);
+              }
+              region.registerInterest(list);
+              break;
+            default:
+              region.registerInterest("ALL_KEYS");
+          }
+        } catch (Exception ex) {
+          AssertionError err = new AssertionError("Failed to Register InterestList");
+          err.initCause(ex);
+          throw err;
+        }
+      }
+    });   
+  }
+
+  public void createServer(VM server, final int thePort, final boolean partitioned)
+  {
+    SerializableRunnable createServer = new CacheSerializableRunnable(
+        "Create Cache Server") {
+      public void run2() throws CacheException
+      {
+        getLogWriter().info("### Create Cache Server. ###");
+        AttributesFactory factory = new AttributesFactory();
+        factory.setMirrorType(MirrorType.KEYS_VALUES);
+
+        // setting the eviction attributes.
+        if (partitioned) {
+          factory.setDataPolicy(DataPolicy.PARTITION);
+          createRootRegion(factory.createRegionAttributes());
+        } else {
+          factory.setScope(Scope.DISTRIBUTED_ACK);
+          createRegion(region, factory.createRegionAttributes());
+        }
+
+        
+        
+        pause(2000);
+
+        try {
+          startBridgeServer(thePort, true);
+        }
+
+        catch (Exception ex) {
+          fail("While starting CacheServer", ex);
+        }
+        pause(2000);
+        
+      }
+    };
+
+    server.invoke(createServer);
+  }
+
+  /**
+   * Starts a bridge server on the given port, using the given
+   * deserializeValues and notifyBySubscription to serve up the
+   * given region.
+   *
+   * @since 6.6
+   */
+  public void startBridgeServer(int port, boolean notifyBySubscription)
+  throws IOException {
+    
+    Cache cache = getCache();
+    CacheServer bridge = cache.addCacheServer();
+    bridge.setPort(port);
+    bridge.setNotifyBySubscription(notifyBySubscription);
+    bridge.start();
+    bridgeServerPort = bridge.getPort();
+  }
+
+  /* Create Init values */
+  public void createValues(VM vm, final String regionName, final int size) {
+    createValues(vm, regionName, size, 0);
+  }
+
+
+  /**
+   * Creates Init Values. start specifies the start index from which key no would start.
+   * @param vm
+   * @param regionName
+   * @param size
+   * @param start
+   */
+  public void createValues(VM vm, final String regionName, final int size, final int start) {
+    vm.invoke(new CacheSerializableRunnable("Create values") {
+      public void run2() throws CacheException {
+        Region region1;
+        if(!"root".equals(regionName)){
+          region1 = getRootRegion().getSubregion(regionName);
+        } else {
+          region1 = getRootRegion();
+        }
+        for (int i = ((start != 0) ? start : 1); i <= size; i++) {
+//          getLogWriter().info("### puting '"+KEY+i+"' in region " + region1);
+          region1.put(KEY+i, new Portfolio((start != 0 ? start : 1) * i, i));
+        }
+        getLogWriter().info("### Number of Entries in Region :" + region1.keys().size());
+      }
+    });
+  }
+
+  /* Returns Cache Server Port */
+  static int getCacheServerPort() {
+    return bridgeServerPort;
+  }
+
+  /* Create Client */
+  public void createClient(VM client, final int serverPort, final String serverHost) {
+    int[] serverPorts = new int[] {serverPort};
+    createClient(client, serverPorts, serverHost, null, null); 
+  }
+
+  /* Create Client */
+  public void createClient(VM client, final int[] serverPorts, final String serverHost, final String redundancyLevel, 
+      final String poolName) {
+    SerializableRunnable createQService =
+      new CacheSerializableRunnable("Create Client") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Create Client. ###");
+        //Region region1 = null;
+        // Initialize CQ Service.
+        try {
+          getCache().getQueryService();
+        } catch (Exception cqe) {
+          fail("Failed to getCQService.", cqe);
+        }
+        
+        AttributesFactory regionFactory = new AttributesFactory();
+        regionFactory.setScope(Scope.LOCAL);
+        
+        if (poolName != null) {
+          regionFactory.setPoolName(poolName);
+        } else {
+          if (redundancyLevel != null){
+            ClientServerTestCase.configureConnectionPool(regionFactory, serverHost, serverPorts, true, Integer.parseInt(redundancyLevel), -1, null);
+          } else {
+            ClientServerTestCase.configureConnectionPool(regionFactory, serverHost,serverPorts, true, -1, -1, null);
+          }
+        }
+               
+          createRootRegion(regionFactory.createRegionAttributes());
+          getLogWriter().info("### Successfully Created Root Region on Client");
+      }
+    };
+    
+    client.invoke(createQService);
+  }
+
+  public void validateQueryOnIndex(VM vm, final String query, final int resultSize) {
+    validateQueryOnIndexWithRegion(vm, query, resultSize, null);
+  }
+
+  /**
+   * Validates a query result with client region values if region is not null, otherwise verifies the size only.
+   * @param vm
+   * @param query
+   * @param resultSize
+   * @param region
+   */
+  public void validateQueryOnIndexWithRegion(VM vm, final String query, final int resultSize, final String region) {
+    vm.invoke(new CacheSerializableRunnable("Validate Query") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Validating Query. ###");
+        QueryService qs = getCache().getQueryService();
+        
+        Query q = qs.newQuery(query);
+        //Set the index observer
+        QueryObserverImpl observer = new QueryObserverImpl();
+        QueryObserverHolder.setInstance(observer);
+        try {
+          Object r = q.execute();
+          if(r instanceof SelectResults){
+            int rSize = ((SelectResults)r).asSet().size();
+            getLogWriter().info("### Result Size is :" + rSize);
+            
+            if(region == null) {
+              assertEquals(resultSize, rSize);
+            } else {
+              Region reg;
+              if(region != null && (reg = getCache().getRegion("/root/"+region)) != null) {
+                assertEquals(rSize, reg.size());
+                for (Object value : reg.values()) {
+                  if(!((SelectResults)r).asSet().contains((Portfolio)value)){
+                    fail("Query resultset mismatch with region values for value: " + value);
+                  }                
+                }
+              }
+            }
+          }
+        }
+        catch (Exception e) {
+          fail("Failed to execute the query.", e);
+        }
+        if(!observer.isIndexesUsed) {
+          fail("Index not used for query");
+        }
+      }
+    });
+  }
+
+  public void asyncClearRegion(VM vm, final String regionName){
+    vm.invokeAsync(new CacheSerializableRunnable("Destroy entries") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Clearing Region. ###");
+        Region region1;
+        if(!"root".equals(regionName)){
+          region1 = getRootRegion().getSubregion(regionName);
+        } else {
+          region1 = getRootRegion();
+        }
+        region1.clear();
+        getLogWriter().info("### Number of Entries in Region :" + region1.keys().size());
+      }
+    });
+  }
+
+  private SerializableRunnable getSRClearRegion(final String regionName) {
+    SerializableRunnable sr = new CacheSerializableRunnable("Destroy entries") {
+      public void run2() throws CacheException {
+        getLogWriter().info("### Clearing Region. ###");
+        Region region1;
+        if(!"root".equals(regionName)){
+          region1 = getRootRegion().getSubregion(regionName);
+        } else {
+          region1 = getRootRegion();
+        }
+        region1.clear();
+        getLogWriter().info("### Number of Entries in Region :" + region1.keys().size());
+      }
+    };
+    return sr;
+  }
+
+  private SerializableRunnable getSRRegisterInterestList(final String regionName, 
+      final int keySize, final int policy, final int start) {
+    SerializableRunnable sr = new CacheSerializableRunnable("Register InterestList") {
+      public void run2() throws CacheException {
+        
+        // Get Query Service.
+        Region region = null;
+        try {
+          if("root".equals(regionName)){
+            region = getRootRegion();
+          } else {
+            region = getRootRegion().getSubregion(regionName);
+          }
+          region.getAttributesMutator().setCacheListener(new CertifiableTestCacheListener(getLogWriter()));
+        } catch (Exception cqe) {
+          AssertionError err = new AssertionError("Failed to get Region.");
+          err.initCause(cqe);
+          throw err;
+        }
+        try {
+          switch (policy) {
+            case REGEX:
+              region.registerInterestRegex(REGULAR_EXPRESSION);
+              break;
+            case KEYS:
+              List list = new ArrayList();
+              for (int i = start != 0 ? start : 1; i <= keySize; i++) {
+                list.add(KEY+i);
+              }
+              region.registerInterest(list);
+              break;
+            default:
+              region.registerInterest("ALL_KEYS");
+          }
+        } catch (Exception ex) {
+          AssertionError err = new AssertionError("Failed to Register InterestList");
+          err.initCause(ex);
+          throw err;
+        }
+      }
+    };    
+   return sr;
+  }
+
+  public static class QueryObserverImpl extends QueryObserverAdapter {
+    boolean isIndexesUsed = false;
+    ArrayList indexesUsed = new ArrayList();
+
+    public void beforeIndexLookup(Index index, int oper, Object key) {
+      indexesUsed.add(index.getName());
+    }
+
+    public void afterIndexLookup(Collection results) {
+      if (results != null) {
+        isIndexesUsed = true;
+      }
+    }
+  }
+
+}


Mime
View raw message