geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hiteshkhame...@apache.org
Subject [44/94] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4
Date Wed, 15 Jun 2016 00:08:00 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/DeclarativeIndexCreationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/DeclarativeIndexCreationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/DeclarativeIndexCreationJUnitTest.java
index 839f81b..7e84eb8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/DeclarativeIndexCreationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/DeclarativeIndexCreationJUnitTest.java
@@ -20,6 +20,17 @@
  */
 package com.gemstone.gemfire.cache.query.internal.index;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Collection;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Region;
@@ -28,22 +39,7 @@ import com.gemstone.gemfire.cache.query.CacheUtils;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import com.gemstone.gemfire.util.test.TestUtil;
-import junit.framework.Assert;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Collection;
-import java.util.Properties;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-/**
- * 
- *         To change the template for this generated type comment go to Window -
- *         Preferences - Java - Code Generation - Code and Comments
- */
 @Category(IntegrationTest.class)
 public class DeclarativeIndexCreationJUnitTest {
 
@@ -76,13 +72,12 @@ public class DeclarativeIndexCreationJUnitTest {
     IndexManager im = IndexUtils.getIndexManager(root, true);
     Collection coll = im.getIndexes();
     if (coll.size() > 0) {
-      Assert.assertTrue(true);
+      assertTrue(true);
       CacheUtils.log("List of indexes= " + im.toString());
       RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(!ra.getIndexMaintenanceSynchronous());
+      assertTrue(!ra.getIndexMaintenanceSynchronous());
     } else
-      Assert
-          .fail("DeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
+      fail("DeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
   }
 
   @Test
@@ -91,18 +86,16 @@ public class DeclarativeIndexCreationJUnitTest {
     IndexManager im = IndexUtils.getIndexManager(root, true);
     Collection coll = im.getIndexes();
     if (coll.size() > 0) {
-      Assert.assertTrue(true);
+      assertTrue(true);
       CacheUtils.log("List of indexes= " + im.toString());
       RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(ra.getIndexMaintenanceSynchronous());
+      assertTrue(ra.getIndexMaintenanceSynchronous());
     } else
-      Assert
-          .fail("DeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion Region:No index found in the root region");
+      fail("DeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion Region:No index found in the root region");
     root = cache.getRegion("/root/string1");
     im = IndexUtils.getIndexManager(root, true);
     if (!im.isIndexMaintenanceTypeSynchronous())
-      Assert
-          .fail("DeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion: The index update type not synchronous if no index-update-type attribuet specified in cache.cml");
+      fail("DeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion: The index update type not synchronous if no index-update-type attribuet specified in cache.cml");
   }
 
   @Test
@@ -111,12 +104,11 @@ public class DeclarativeIndexCreationJUnitTest {
     IndexManager im = IndexUtils.getIndexManager(root, true);
     Collection coll = im.getIndexes();
     if (coll.size() > 0) {
-      Assert.assertTrue(true);
+      assertTrue(true);
       CacheUtils.log("List of indexes= " + im.toString());
       RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(ra.getIndexMaintenanceSynchronous());
+      assertTrue(ra.getIndexMaintenanceSynchronous());
     } else
-      Assert
-          .fail("DeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
+      fail("DeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquiJoinIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquiJoinIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquiJoinIntegrationTest.java
new file mode 100644
index 0000000..622777e
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquiJoinIntegrationTest.java
@@ -0,0 +1,437 @@
+/*
+ * 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.internal.index;
+
+import static org.junit.Assert.*;
+
+import java.io.Serializable;
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.query.CacheUtils;
+import com.gemstone.gemfire.cache.query.FunctionDomainException;
+import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.query.IndexExistsException;
+import com.gemstone.gemfire.cache.query.IndexNameConflictException;
+import com.gemstone.gemfire.cache.query.NameResolutionException;
+import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.TypeMismatchException;
+import com.gemstone.gemfire.cache.query.functional.StructSetOrResultsSet;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class EquiJoinIntegrationTest {
+  QueryService qs;
+  Region region1, region2, region3, region4;
+  
+  @Before
+  public void setUp() throws java.lang.Exception {
+    CacheUtils.startCache();
+    qs = CacheUtils.getQueryService();
+  }
+  
+  @After
+  public void tearDown() {
+    region2.destroyRegion();
+    region1.destroyRegion();
+  }
+  
+  protected void createRegions() throws Exception {
+    region1 = createReplicatedRegion("region1");
+    region2 = createReplicatedRegion("region2");
+  }
+  
+  protected void createAdditionalRegions() throws Exception {
+    region3 = createReplicatedRegion("region3");
+    region4 = createReplicatedRegion("region4");
+  }
+  
+  protected void destroyAdditionalRegions() throws Exception {
+    if (region3 != null) {
+      region3.destroyRegion();
+    }
+    if (region4 != null) {
+      region4.destroyRegion();
+    }
+  }
+
+  @Test
+  public void testSingleFilterWithSingleEquijoinOneToOneMapping() throws Exception {
+    createRegions();
+
+    String[] queries = new String[]{
+        "<trace>select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid",
+        "<trace>select * from /region1 c, /region2 s where c.pkid=1 and s.pkid = c.pkid",
+        "<trace>select * from /region1 c, /region2 s where c.pkid = s.pkid and c.pkid=1",
+        "<trace>select * from /region1 c, /region2 s where s.pkid = c.pkid and c.pkid=1",
+    };
+    
+    for (int i = 0; i < 1000; i++) {
+      region1.put( i, new Customer(i, i));
+      region2.put( i, new Customer(i, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries);
+  }
+  
+  @Test
+  public void testSingleFilterWithSingleEquijoinOneToOneMappingWithAdditionalJoins() throws Exception {
+    createRegions();
+    try {
+      createAdditionalRegions();
+      
+      String[] queries = new String[]{
+          "<trace>select * from /region1 c, /region2 s, /region3 d where c.pkid=1 and c.pkid = s.pkid and d.pkid = s.pkid",  //this should derive d after deriving s from c
+          "<trace>select * from /region1 c, /region2 s, /region3 d, /region4 f where c.pkid=1 and c.pkid = s.pkid and d.pkid = s.pkid and f.pkid = d.pkid",  //this should f from d from s from c
+          "<trace>select * from /region1 c, /region2 s, /region3 d where c.pkid=1 and c.pkid = s.pkid and d.pkid = c.pkid",  //this should derive d and s from c 
+          "<trace>select * from /region1 c, /region2 s, /region3 d where c.pkid=1 and c.pkid = s.pkid and s.pkid = d.pkid",  //this should derive d after deriving s from c (order is just switched in the query)
+      };
+      
+      for (int i = 0; i < 30; i++) {
+        region1.put( i, new Customer(i, i));
+        region2.put( i, new Customer(i, i));
+        region3.put( i, new Customer(i, i));
+        region4.put( i, new Customer(i, i));
+      }
+      
+      executeQueriesWithIndexCombinations(queries);
+    }
+    finally {
+      destroyAdditionalRegions();
+    }
+  }
+
+  
+  /**
+   * We do not want to test this with Primary Key on the many side or else only 1 result will be returned
+   */
+  @Test
+  public void testSingleFilterWithSingleEquijoinOneToManyMapping() throws Exception {
+    createRegions();
+
+    String[] queries = new String[]{
+        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid",
+        "select * from /region1 c, /region2 s where c.pkid=1 and s.pkid = c.pkid",
+        "select * from /region1 c, /region2 s where c.pkid = s.pkid and c.pkid=1",
+        "select * from /region1 c, /region2 s where s.pkid = c.pkid and c.pkid=1",
+    };
+    
+    for (int i = 0; i < 1000; i++) {
+      region1.put( i, new Customer(i, i));
+      region2.put( i, new Customer(i % 100, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
+      protected String[] createIndexTypesForRegion2() {
+        return new String[] { "Compact", "Hash"};
+      }
+    }, false);
+  }
+
+  @Test
+  public void testSingleFilterWithSingleEquijoinMultipleFiltersOnSameRegionOnSameIteratorMapping() throws Exception {
+    createRegions();
+
+    String[] queries = new String[]{
+        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid and c.id = 1",
+        "select * from /region1 c, /region2 s where c.id = 1 and c.pkid=1 and s.pkid = c.pkid",
+        
+    };
+    
+    for (int i = 0; i < 1000; i++) {
+      region1.put( i, new Customer(i, i % 10));
+      region2.put( i, new Customer(i, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
+      Index secondaryIndex;
+      
+      @Override
+      public void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+        secondaryIndex = qs.createIndex("region1 id", "p.id", "/region1 p");
+        super.createIndexForRegion1(indexTypeId);
+      }
+
+      @Override
+      public void destroyIndexForRegion1(int indexTypeId) {
+        qs.removeIndex(secondaryIndex);
+        super.destroyIndexForRegion1(indexTypeId);
+      }
+      
+    }, false /*want to compare actual results and not size only*/);
+  }
+
+  @Test
+  public void testSingleFilterWithSingleEquijoinWithRangeFilters() throws Exception {
+    createRegions();
+
+    String[] queries = new String[]{
+        "<trace>select * from /region1 c, /region2 s where c.pkid = 1 and c.id > 1 and c.id < 10 and c.pkid = s.pkid",
+        "<trace>select * from /region1 c, /region2 s where c.pkid >= 0 and c.pkid < 10 and c.id < 10 and c.pkid = s.pkid"
+    };
+    
+    //just need enough so that there are 1-10 ids per pkid
+    for (int i = 0; i < 1000; i++) {
+      region1.put(i, new Customer(i % 5, i % 10));
+      region2.put(i, new Customer(i, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
+      protected String[] createIndexTypesForRegion1() {
+        return new String[] { "Compact", "Hash"};
+      }
+    }, false /*want to compare actual results and not size only*/);
+  }
+
+  @Test
+  public void testSingleFilterWithSingleEquijoinLimit() throws Exception {
+    //In this test we are hoping the index being used will properly use the limit while taking into consideration the filters of c.id and c.pkid
+    //This test is set up so that if the pkid index is used and limit applied, if id is not taken into consideration until later stages, it will lead to incorrect results (0)
+    createRegions();
+
+    String[] queries = new String[]{
+        "select * from /region1 c, /region2 s where c.id = 3 and c.pkid > 2  and c.pkid = s.pkid limit 1",
+    };
+    
+    for (int i = 0; i < 1000; i++) {
+      region1.put( i, new Customer(i, i % 10));
+      region2.put( i, new Customer(i, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
+      Index secondaryIndex;
+      
+      @Override
+      public void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+        secondaryIndex = qs.createIndex("region1 id", "p.id", "/region1 p");
+        super.createIndexForRegion1(indexTypeId);
+      }
+
+      @Override
+      public void destroyIndexForRegion1(int indexTypeId) {
+        qs.removeIndex(secondaryIndex);
+        super.destroyIndexForRegion1(indexTypeId);
+      }
+      
+    }, true);
+  }
+
+  @Test
+  public void testSingleFilterWithSingleEquijoinNestedQuery() throws Exception {
+    createRegions();
+
+    String[] queries = new String[]{
+        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid and c.pkid in (select t.pkid from /region1 t,/region2 s where s.pkid=t.pkid and s.pkid = 1)",
+        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid or c.pkid in set (1,2,3,4)",
+    };
+    
+    for (int i = 0; i < 1000; i++) {
+      region1.put( i, new Customer(i, i));
+      region2.put( i, new Customer(i, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries);
+  }
+
+  public static class Customer implements Serializable {
+    public int pkid;
+    public int id;
+    public String name;
+    public Map<String, Customer> nested = new HashMap<String, Customer>();
+
+    public Customer(int pkid, int id) {
+      this.pkid = pkid;
+      this.id = id;
+      this.name = "name" + pkid;
+    }
+
+    public String toString() {
+      return "Customer pkid = " + pkid + ", id: " + id + " name:" + name;
+    }
+  }
+
+  private Region createReplicatedRegion(String regionName) throws ParseException {
+    Cache cache = CacheUtils.getCache();
+    AttributesFactory attributesFactory = new AttributesFactory();
+    attributesFactory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes regionAttributes = attributesFactory.create();
+    return cache.createRegion(regionName, regionAttributes);
+  }
+
+  protected void executeQueriesWithIndexCombinations(String[] queries) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException, QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException {
+    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs), false);
+  }
+  
+  protected void executeQueriesWithIndexCombinations(String[] queries, IndexCreatorCallback indexCreator, boolean sizeOnly) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException, QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException {
+    Object[] nonIndexedResults = executeQueries(queries);
+    
+    for (int r1Index = 0; r1Index < indexCreator.getNumIndexTypesForRegion1(); r1Index++) {
+      indexCreator.createIndexForRegion1(r1Index);
+      for (int r2Index = 0; r2Index < indexCreator.getNumIndexTypesForRegion2(); r2Index++) {
+        indexCreator.createIndexForRegion2(r2Index);
+        Object[] indexedResults = executeQueries(queries);
+        compareResults(nonIndexedResults, indexedResults, queries, sizeOnly);
+        indexCreator.destroyIndexForRegion2(r2Index);
+      }
+      indexCreator.destroyIndexForRegion1(r1Index);
+    }
+  }
+  
+  protected Object[] executeQueries(String[] queries) throws QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException {
+    Object[] results = new SelectResults[queries.length];
+    for (int i = 0; i < queries.length; i++) {
+      results[i] = qs.newQuery(queries[i]).execute();
+    }
+    return results;
+  }
+  
+  interface IndexCreatorCallback {
+    int getNumIndexTypesForRegion1();
+    int getNumIndexTypesForRegion2();
+    void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException;
+    void createIndexForRegion2(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException;
+    void destroyIndexForRegion1(int indexTypeId) ;
+    void destroyIndexForRegion2(int indexTypeId) ;
+  }
+  
+  static class DefaultIndexCreatorCallback implements IndexCreatorCallback {
+    protected String[] indexTypesForRegion1 = createIndexTypesForRegion1();
+    protected String[] indexTypesForRegion2 = createIndexTypesForRegion2();
+    protected Index indexOnR1, indexOnR2;
+    protected QueryService qs;
+    
+    DefaultIndexCreatorCallback(QueryService qs) {
+      this.qs = qs;
+    }
+    protected String[] createIndexTypesForRegion1() {
+      return new String[] { "Compact", "Hash", "PrimaryKey"};
+    }
+    
+    protected String[] createIndexTypesForRegion2() {
+      return new String[] { "Compact", "Hash", "PrimaryKey"};
+    }
+    
+    public int getNumIndexTypesForRegion1() {
+      return indexTypesForRegion1.length; 
+    }
+    
+    public int getNumIndexTypesForRegion2() {
+      return indexTypesForRegion2.length;
+    }
+    
+    public void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      indexOnR1 = createIndex(indexTypesForRegion1[indexTypeId], "region1", "pkid");
+
+    }
+    
+    public void createIndexForRegion2(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      indexOnR2 = createIndex(indexTypesForRegion2[indexTypeId], "region2", "pkid");
+    }
+
+    //Type id is not used here but at some future time we could store a map of indexes or find a use for this id?
+    public void destroyIndexForRegion1(int indexTypeId) {
+      qs.removeIndex(indexOnR1);
+    }
+    
+    public void destroyIndexForRegion2(int indexTypeId) {
+      qs.removeIndex(indexOnR2);
+    }
+    
+    
+    private Index createIndex(String type, String regionName, String field) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      Index index = null;
+      switch (type) {
+      case "Compact":
+        index = createCompactRangeIndex(regionName, field);
+        break;
+      case "Range":
+        index = createRangeIndexOnFirstIterator(regionName, field);
+        break;
+      case "Hash":
+        index = createHashIndex(regionName, field);
+        break;
+      case "PrimaryKey":
+        index = createPrimaryKeyIndex(regionName, field);
+        break;
+      }
+      return index;
+    }
+    
+    private Index createCompactRangeIndex(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      String fromClause = "/" + regionName + " r";
+      String indexedExpression = "r." + fieldName;
+      return qs.createIndex("Compact " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
+    }
+    
+    private Index createHashIndex(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      String fromClause = "/" + regionName + " r";
+      String indexedExpression = "r." + fieldName;
+      return qs.createHashIndex("Hash " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
+    }
+    
+    private Index createPrimaryKeyIndex(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      String fromClause = "/" + regionName + " r";
+      String indexedExpression = "r." + fieldName;
+      return qs.createKeyIndex("PrimaryKey " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
+    }
+    
+    private Index createRangeIndexOnFirstIterator(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      String fromClause = "/" + regionName + " r, r.nested.values v";
+      String indexedExpression = "r." + fieldName;
+      return qs.createIndex("Range " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
+    }
+    
+    private Index createRangeIndexOnSecondIterator(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
+      String fromClause = "/" + regionName + " r, r.nested.values v";
+      String indexedExpression = "v." + fieldName;
+      return qs.createIndex("Range " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
+    }
+  }
+  
+  private void compareResults(Object[] nonIndexedResults, Object[] indexedResults, String[] queries, boolean sizeOnly) {
+    if (sizeOnly) {
+      for (int i = 0; i < queries.length; i++) {
+        assertTrue(((SelectResults)nonIndexedResults[i]).size() == ((SelectResults)indexedResults[i]).size());
+        assertTrue(((SelectResults)nonIndexedResults[i]).size() > 0);
+      }
+    }
+    else {
+      StructSetOrResultsSet util = new StructSetOrResultsSet();
+      for (int i = 0; i < queries.length; i++) {
+        Object[][] resultsToCompare = new Object[1][2];
+        resultsToCompare[0][0] = nonIndexedResults[i];
+        resultsToCompare[0][1] = indexedResults[i];
+        util.CompareQueryResultsWithoutAndWithIndexes(resultsToCompare, 1, new String[]{queries[i]});
+        assertTrue(((SelectResults)nonIndexedResults[i]).size() > 0);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquijoinDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquijoinDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquijoinDUnitTest.java
deleted file mode 100644
index 5718fce..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/EquijoinDUnitTest.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * 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.internal.index;
-
-import java.io.Serializable;
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.query.CacheUtils;
-import com.gemstone.gemfire.cache.query.FunctionDomainException;
-import com.gemstone.gemfire.cache.query.Index;
-import com.gemstone.gemfire.cache.query.IndexExistsException;
-import com.gemstone.gemfire.cache.query.IndexNameConflictException;
-import com.gemstone.gemfire.cache.query.NameResolutionException;
-import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
-import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.RegionNotFoundException;
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache.query.TypeMismatchException;
-import com.gemstone.gemfire.cache.query.functional.StructSetOrResultsSet;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-@Category(IntegrationTest.class)
-public class EquijoinDUnitTest extends TestCase {
-  QueryService qs;
-  Region region1, region2, region3, region4;
-  
-  @Before
-  public void setUp() throws java.lang.Exception {
-    CacheUtils.startCache();
-    qs = CacheUtils.getQueryService();
-  }
-  
-  @After
-  public void tearDown() {
-    region2.destroyRegion();
-    region1.destroyRegion();
-  }
-  
-  protected void createRegions() throws Exception {
-    region1 = createReplicatedRegion("region1");
-    region2 = createReplicatedRegion("region2");
-  }
-  
-  protected void createAdditionalRegions() throws Exception {
-    region3 = createReplicatedRegion("region3");
-    region4 = createReplicatedRegion("region4");
-  }
-  
-  protected void destroyAdditionalRegions() throws Exception {
-    if (region3 != null) {
-      region3.destroyRegion();
-    }
-    if (region4 != null) {
-      region4.destroyRegion();
-    }
-  }
-
-  @Test
-  public void testSingleFilterWithSingleEquijoinOneToOneMapping() throws Exception {
-    createRegions();
-
-    String[] queries = new String[]{
-        "<trace>select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid",
-        "<trace>select * from /region1 c, /region2 s where c.pkid=1 and s.pkid = c.pkid",
-        "<trace>select * from /region1 c, /region2 s where c.pkid = s.pkid and c.pkid=1",
-        "<trace>select * from /region1 c, /region2 s where s.pkid = c.pkid and c.pkid=1",
-    };
-    
-    for (int i = 0; i < 1000; i++) {
-      region1.put( i, new Customer(i, i));
-      region2.put( i, new Customer(i, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries);
-  }
-  
-  @Test
-  public void testSingleFilterWithSingleEquijoinOneToOneMappingWithAdditionalJoins() throws Exception {
-    createRegions();
-    try {
-      createAdditionalRegions();
-      
-      String[] queries = new String[]{
-          "<trace>select * from /region1 c, /region2 s, /region3 d where c.pkid=1 and c.pkid = s.pkid and d.pkid = s.pkid",  //this should derive d after deriving s from c
-          "<trace>select * from /region1 c, /region2 s, /region3 d, /region4 f where c.pkid=1 and c.pkid = s.pkid and d.pkid = s.pkid and f.pkid = d.pkid",  //this should f from d from s from c
-          "<trace>select * from /region1 c, /region2 s, /region3 d where c.pkid=1 and c.pkid = s.pkid and d.pkid = c.pkid",  //this should derive d and s from c 
-          "<trace>select * from /region1 c, /region2 s, /region3 d where c.pkid=1 and c.pkid = s.pkid and s.pkid = d.pkid",  //this should derive d after deriving s from c (order is just switched in the query)
-      };
-      
-      for (int i = 0; i < 30; i++) {
-        region1.put( i, new Customer(i, i));
-        region2.put( i, new Customer(i, i));
-        region3.put( i, new Customer(i, i));
-        region4.put( i, new Customer(i, i));
-      }
-      
-      executeQueriesWithIndexCombinations(queries);
-    }
-    finally {
-      destroyAdditionalRegions();
-    }
-  }
-
-  
-  /**
-   * We do not want to test this with Primary Key on the many side or else only 1 result will be returned
-   */
-  @Test
-  public void testSingleFilterWithSingleEquijoinOneToManyMapping() throws Exception {
-    createRegions();
-
-    String[] queries = new String[]{
-        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid",
-        "select * from /region1 c, /region2 s where c.pkid=1 and s.pkid = c.pkid",
-        "select * from /region1 c, /region2 s where c.pkid = s.pkid and c.pkid=1",
-        "select * from /region1 c, /region2 s where s.pkid = c.pkid and c.pkid=1",
-    };
-    
-    for (int i = 0; i < 1000; i++) {
-      region1.put( i, new Customer(i, i));
-      region2.put( i, new Customer(i % 100, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
-      protected String[] createIndexTypesForRegion2() {
-        return new String[] { "Compact", "Hash"};
-      }
-    }, false);
-  }
-
-  @Test
-  public void testSingleFilterWithSingleEquijoinMultipleFiltersOnSameRegionOnSameIteratorMapping() throws Exception {
-    createRegions();
-
-    String[] queries = new String[]{
-        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid and c.id = 1",
-        "select * from /region1 c, /region2 s where c.id = 1 and c.pkid=1 and s.pkid = c.pkid",
-        
-    };
-    
-    for (int i = 0; i < 1000; i++) {
-      region1.put( i, new Customer(i, i % 10));
-      region2.put( i, new Customer(i, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
-      Index secondaryIndex;
-      
-      @Override
-      public void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-        secondaryIndex = qs.createIndex("region1 id", "p.id", "/region1 p");
-        super.createIndexForRegion1(indexTypeId);
-      }
-
-      @Override
-      public void destroyIndexForRegion1(int indexTypeId) {
-        qs.removeIndex(secondaryIndex);
-        super.destroyIndexForRegion1(indexTypeId);
-      }
-      
-    }, false /*want to compare actual results and not size only*/);
-  }
-
-  @Test  
-  public void testSingleFilterWithSingleEquijoinWithRangeFilters() throws Exception {
-    createRegions();
-
-    String[] queries = new String[]{
-        "<trace>select * from /region1 c, /region2 s where c.pkid = 1 and c.id > 1 and c.id < 10 and c.pkid = s.pkid",
-        "<trace>select * from /region1 c, /region2 s where c.pkid >= 0 and c.pkid < 10 and c.id < 10 and c.pkid = s.pkid"
-    };
-    
-    //just need enough so that there are 1-10 ids per pkid
-    for (int i = 0; i < 1000; i++) {
-      region1.put(i, new Customer(i % 5, i % 10));
-      region2.put(i, new Customer(i, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
-      protected String[] createIndexTypesForRegion1() {
-        return new String[] { "Compact", "Hash"};
-      }
-    }, false /*want to compare actual results and not size only*/);
-  }
-
-  @Test 
-  public void testSingleFilterWithSingleEquijoinLimit() throws Exception {
-    //In this test we are hoping the index being used will properly use the limit while taking into consideration the filters of c.id and c.pkid
-    //This test is set up so that if the pkid index is used and limit applied, if id is not taken into consideration until later stages, it will lead to incorrect results (0)
-    createRegions();
-
-    String[] queries = new String[]{
-        "select * from /region1 c, /region2 s where c.id = 3 and c.pkid > 2  and c.pkid = s.pkid limit 1",
-    };
-    
-    for (int i = 0; i < 1000; i++) {
-      region1.put( i, new Customer(i, i % 10));
-      region2.put( i, new Customer(i, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs) {
-      Index secondaryIndex;
-      
-      @Override
-      public void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-        secondaryIndex = qs.createIndex("region1 id", "p.id", "/region1 p");
-        super.createIndexForRegion1(indexTypeId);
-      }
-
-      @Override
-      public void destroyIndexForRegion1(int indexTypeId) {
-        qs.removeIndex(secondaryIndex);
-        super.destroyIndexForRegion1(indexTypeId);
-      }
-      
-    }, true);
-  }
-
-  @Test
-  public void testSingleFilterWithSingleEquijoinNestedQuery() throws Exception {
-    createRegions();
-
-    String[] queries = new String[]{
-        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid and c.pkid in (select t.pkid from /region1 t,/region2 s where s.pkid=t.pkid and s.pkid = 1)",
-        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid or c.pkid in set (1,2,3,4)",
-    };
-    
-    for (int i = 0; i < 1000; i++) {
-      region1.put( i, new Customer(i, i));
-      region2.put( i, new Customer(i, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries);
-  }
-
-  public static class Customer implements Serializable {
-    public int pkid;
-    public int id;
-    public String name;
-    public Map<String, Customer> nested = new HashMap<String, Customer>();
-
-    public Customer(int pkid, int id) {
-      this.pkid = pkid;
-      this.id = id;
-      this.name = "name" + pkid;
-    }
-
-    public String toString() {
-      return "Customer pkid = " + pkid + ", id: " + id + " name:" + name;
-    }
-  }
-
-  private Region createReplicatedRegion(String regionName) throws ParseException {
-    Cache cache = CacheUtils.getCache();
-    AttributesFactory attributesFactory = new AttributesFactory();
-    attributesFactory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes regionAttributes = attributesFactory.create();
-    return cache.createRegion(regionName, regionAttributes);
-  }
-
-  protected void executeQueriesWithIndexCombinations(String[] queries) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException, QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException {
-    executeQueriesWithIndexCombinations(queries, new DefaultIndexCreatorCallback(qs), false);
-  }
-  
-  protected void executeQueriesWithIndexCombinations(String[] queries, IndexCreatorCallback indexCreator, boolean sizeOnly) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException, QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException {
-    Object[] nonIndexedResults = executeQueries(queries);
-    
-    for (int r1Index = 0; r1Index < indexCreator.getNumIndexTypesForRegion1(); r1Index++) {
-      indexCreator.createIndexForRegion1(r1Index);
-      for (int r2Index = 0; r2Index < indexCreator.getNumIndexTypesForRegion2(); r2Index++) {
-        indexCreator.createIndexForRegion2(r2Index);
-        Object[] indexedResults = executeQueries(queries);
-        compareResults(nonIndexedResults, indexedResults, queries, sizeOnly);
-        indexCreator.destroyIndexForRegion2(r2Index);
-      }
-      indexCreator.destroyIndexForRegion1(r1Index);
-    }
-  }
-  
-  protected Object[] executeQueries(String[] queries) throws QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException {
-    Object[] results = new SelectResults[queries.length];
-    for (int i = 0; i < queries.length; i++) {
-      results[i] = qs.newQuery(queries[i]).execute();
-    }
-    return results;
-  }
-  
-  interface IndexCreatorCallback {
-    int getNumIndexTypesForRegion1();
-    int getNumIndexTypesForRegion2();
-    void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException;
-    void createIndexForRegion2(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException;
-    void destroyIndexForRegion1(int indexTypeId) ;
-    void destroyIndexForRegion2(int indexTypeId) ;
-  }
-  
-  static class DefaultIndexCreatorCallback implements IndexCreatorCallback {
-    protected String[] indexTypesForRegion1 = createIndexTypesForRegion1();
-    protected String[] indexTypesForRegion2 = createIndexTypesForRegion2();
-    protected Index indexOnR1, indexOnR2;
-    protected QueryService qs;
-    
-    DefaultIndexCreatorCallback(QueryService qs) {
-      this.qs = qs;
-    }
-    protected String[] createIndexTypesForRegion1() {
-      return new String[] { "Compact", "Hash", "PrimaryKey"};
-    }
-    
-    protected String[] createIndexTypesForRegion2() {
-      return new String[] { "Compact", "Hash", "PrimaryKey"};
-    }
-    
-    public int getNumIndexTypesForRegion1() {
-      return indexTypesForRegion1.length; 
-    }
-    
-    public int getNumIndexTypesForRegion2() {
-      return indexTypesForRegion2.length;
-    }
-    
-    public void createIndexForRegion1(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      indexOnR1 = createIndex(indexTypesForRegion1[indexTypeId], "region1", "pkid");
-
-    }
-    
-    public void createIndexForRegion2(int indexTypeId) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      indexOnR2 = createIndex(indexTypesForRegion2[indexTypeId], "region2", "pkid");
-    }
-
-    //Type id is not used here but at some future time we could store a map of indexes or find a use for this id?
-    public void destroyIndexForRegion1(int indexTypeId) {
-      qs.removeIndex(indexOnR1);
-    }
-    
-    public void destroyIndexForRegion2(int indexTypeId) {
-      qs.removeIndex(indexOnR2);
-    }
-    
-    
-    private Index createIndex(String type, String regionName, String field) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      Index index = null;
-      switch (type) {
-      case "Compact":
-        index = createCompactRangeIndex(regionName, field);
-        break;
-      case "Range":
-        index = createRangeIndexOnFirstIterator(regionName, field);
-        break;
-      case "Hash":
-        index = createHashIndex(regionName, field);
-        break;
-      case "PrimaryKey":
-        index = createPrimaryKeyIndex(regionName, field);
-        break;
-      }
-      return index;
-    }
-    
-    private Index createCompactRangeIndex(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      String fromClause = "/" + regionName + " r";
-      String indexedExpression = "r." + fieldName;
-      return qs.createIndex("Compact " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
-    }
-    
-    private Index createHashIndex(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      String fromClause = "/" + regionName + " r";
-      String indexedExpression = "r." + fieldName;
-      return qs.createHashIndex("Hash " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
-    }
-    
-    private Index createPrimaryKeyIndex(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      String fromClause = "/" + regionName + " r";
-      String indexedExpression = "r." + fieldName;
-      return qs.createKeyIndex("PrimaryKey " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
-    }
-    
-    private Index createRangeIndexOnFirstIterator(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      String fromClause = "/" + regionName + " r, r.nested.values v";
-      String indexedExpression = "r." + fieldName;
-      return qs.createIndex("Range " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
-    }
-    
-    private Index createRangeIndexOnSecondIterator(String regionName, String fieldName) throws RegionNotFoundException, IndexExistsException, IndexNameConflictException {
-      String fromClause = "/" + regionName + " r, r.nested.values v";
-      String indexedExpression = "v." + fieldName;
-      return qs.createIndex("Range " + fromClause + ":" + indexedExpression, indexedExpression, fromClause);
-    }
-  }
-  
-  private void compareResults(Object[] nonIndexedResults, Object[] indexedResults, String[] queries, boolean sizeOnly) {
-    if (sizeOnly) {
-      for (int i = 0; i < queries.length; i++) {
-        assertTrue(((SelectResults)nonIndexedResults[i]).size() == ((SelectResults)indexedResults[i]).size());
-        assertTrue(((SelectResults)nonIndexedResults[i]).size() > 0);
-      }
-    }
-    else {
-      StructSetOrResultsSet util = new StructSetOrResultsSet();
-      for (int i = 0; i < queries.length; i++) {
-        Object[][] resultsToCompare = new Object[1][2];
-        resultsToCompare[0][0] = nonIndexedResults[i];
-        resultsToCompare[0][1] = indexedResults[i];
-        util.CompareQueryResultsWithoutAndWithIndexes(resultsToCompare, 1, new String[]{queries[i]});
-        assertTrue(((SelectResults)nonIndexedResults[i]).size() > 0);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexTrackingQueryObserverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexTrackingQueryObserverDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexTrackingQueryObserverDUnitTest.java
index 02a6f07..4e4d76a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexTrackingQueryObserverDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexTrackingQueryObserverDUnitTest.java
@@ -19,6 +19,15 @@
  */
 package com.gemstone.gemfire.cache.query.internal.index;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import java.util.Collection;
 import java.util.Map;
 
@@ -54,17 +63,19 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
 /**
  *
  */
-public class IndexTrackingQueryObserverDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class IndexTrackingQueryObserverDUnitTest extends JUnit4CacheTestCase {
 
   private final int NUM_BKTS = 10;
   private static final String queryStr = "select * from /portfolio where ID >= 0";
   protected static final int TOTAL_OBJECTS = 1000;
   public static final String INDEX_NAME = "keyIndex1"; 
 
-  public IndexTrackingQueryObserverDUnitTest(String name) {
-    super(name);
+  public IndexTrackingQueryObserverDUnitTest() {
+    super();
   }
   
+  @Test
   public void testNothing() {
     
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/InitializeIndexEntryDestroyQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/InitializeIndexEntryDestroyQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/InitializeIndexEntryDestroyQueryDUnitTest.java
index 6e064f1..83e718d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/InitializeIndexEntryDestroyQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/InitializeIndexEntryDestroyQueryDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.internal.index;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
 
 import java.util.Arrays;
@@ -52,7 +61,8 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
  * Then destroys and puts back entries in separated thread in the same region and runs
  * query parallely and checks for UNDEFINED values in result set of the query.
  */
-public class InitializeIndexEntryDestroyQueryDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class InitializeIndexEntryDestroyQueryDUnitTest extends JUnit4CacheTestCase {
 
   PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
 
@@ -70,14 +80,15 @@ public class InitializeIndexEntryDestroyQueryDUnitTest extends CacheTestCase {
   /**
    * @param name
    */
-  public InitializeIndexEntryDestroyQueryDUnitTest(String name) {
-    super(name);
+  public InitializeIndexEntryDestroyQueryDUnitTest() {
+    super();
   }
   public void setCacheInVMs(VM... vms) {
     for (VM vm : vms) {
       vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
     }
   }
+  @Test
   public void testAsyncIndexInitDuringEntryDestroyAndQuery() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -210,6 +221,7 @@ public class InitializeIndexEntryDestroyQueryDUnitTest extends CacheTestCase {
   }
 
   @Category(FlakyTest.class) // GEODE-1036: uses PRQueryDUnitHelper, time sensitive, async actions, overly long joins (16+ minutes), eats exceptions (fixed 1), thread sleeps
+  @Test
   public void testAsyncIndexInitDuringEntryDestroyAndQueryOnPR() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -334,6 +346,7 @@ public class InitializeIndexEntryDestroyQueryDUnitTest extends CacheTestCase {
     }
   }
 
+  @Test
   public void testConcurrentRemoveIndexAndQueryOnPR() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
index e18e720..f4e57be 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.internal.index;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import java.util.Collection;
 import java.util.List;
 
@@ -39,15 +48,17 @@ import com.gemstone.gemfire.test.dunit.ThreadUtils;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 
-public class MultiIndexCreationDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class MultiIndexCreationDUnitTest extends JUnit4CacheTestCase {
 
   private final String regionName = "MultiIndexCreationDUnitTest";
   public static volatile boolean hooked = false;
 
-  public MultiIndexCreationDUnitTest(String name) {
-    super(name);
+  public MultiIndexCreationDUnitTest() {
+    super();
   }
 
+  @Test
   public void testConcurrentMultiIndexCreationAndQuery() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
new file mode 100644
index 0000000..01b245a
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.internal.index;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.cache.query.CacheUtils;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class PartitionedRegionEquiJoinIntegrationTest extends EquiJoinIntegrationTest {
+ 
+  @Override
+  protected void createRegions() {
+    region1 = createPartitionRegion("region1");
+    region2 = createColocatedPartitionRegion("region2", "region1");
+    FunctionService.registerFunction(equijoinTestFunction);
+  }
+  
+  @Override
+  protected void createAdditionalRegions() throws Exception {
+    region3 = createColocatedPartitionRegion("region3", "region1");
+    region4 = createColocatedPartitionRegion("region4", "region1");
+  }
+ 
+  @Test
+  public void testSingleFilterWithSingleEquijoinNestedQuery() throws Exception {
+    createRegions();
+
+    String[] queries = new String[]{
+        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid or c.pkid in set (1,2,3,4)",
+    };
+    
+    for (int i = 0; i < 1000; i++) {
+      region1.put( i, new Customer(i, i));
+      region2.put( i, new Customer(i, i));
+    }
+    
+    executeQueriesWithIndexCombinations(queries);
+  }
+
+  public Region createPartitionRegion(String regionName) {
+    PartitionAttributesFactory paf = new PartitionAttributesFactory();
+    RegionFactory factory = CacheUtils.getCache().createRegionFactory(RegionShortcut.PARTITION)
+        .setPartitionAttributes(paf.create());
+    return factory.create(regionName);
+  }
+ 
+  public Region createColocatedPartitionRegion(String regionName, final String colocatedRegion) {
+     PartitionAttributesFactory paf = new PartitionAttributesFactory();
+        paf.setColocatedWith(colocatedRegion);
+    RegionFactory factory = CacheUtils.getCache().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create());
+    return factory.create(regionName);
+  }
+  
+
+  @Override
+  protected Object[] executeQueries(String[] queries) {
+    ResultCollector collector = FunctionService.onRegion(region1).withArgs(queries).execute(equijoinTestFunction.getId());
+    Object result = collector.getResult();
+    return (Object[])((ArrayList)result).get(0);
+  }
+  
+  Function equijoinTestFunction = new Function(){
+    @Override
+    public boolean hasResult() {
+      return true;
+    }
+
+    @Override
+    public void execute(FunctionContext context) {
+      try {
+        String[] queries = (String[]) context.getArguments();
+        QueryService qs = CacheUtils.getCache().getQueryService();
+        
+        Object[] results = new SelectResults[queries.length];
+        for (int i = 0; i < queries.length; i++) {
+          results[i] = qs.newQuery(queries[i]).execute((RegionFunctionContext)context);
+        }
+        context.getResultSender().lastResult(results);
+      }
+      catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+
+    @Override
+    public String getId() {
+      return "Equijoin Query";
+    }
+
+    @Override
+    public boolean optimizeForWrite() {
+      return false;
+    }
+
+    @Override
+    public boolean isHA() {
+      return false;
+    }
+  };
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquijoinDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquijoinDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquijoinDUnitTest.java
deleted file mode 100644
index 3fa6848..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PartitionedRegionEquijoinDUnitTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.internal.index;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.PartitionAttributesFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionFactory;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.cache.query.CacheUtils;
-import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-@Category(IntegrationTest.class)
-public class PartitionedRegionEquijoinDUnitTest extends EquijoinDUnitTest {
- 
-  @Override
-  protected void createRegions() {
-    region1 = createPartitionRegion("region1");
-    region2 = createColocatedPartitionRegion("region2", "region1");
-    FunctionService.registerFunction(equijoinTestFunction);
-  }
-  
-  @Override
-  protected void createAdditionalRegions() throws Exception {
-    region3 = createColocatedPartitionRegion("region3", "region1");
-    region4 = createColocatedPartitionRegion("region4", "region1");
-  }
- 
-  @Test
-  public void testSingleFilterWithSingleEquijoinNestedQuery() throws Exception {
-    createRegions();
-
-    String[] queries = new String[]{
-        "select * from /region1 c, /region2 s where c.pkid=1 and c.pkid = s.pkid or c.pkid in set (1,2,3,4)",
-    };
-    
-    for (int i = 0; i < 1000; i++) {
-      region1.put( i, new Customer(i, i));
-      region2.put( i, new Customer(i, i));
-    }
-    
-    executeQueriesWithIndexCombinations(queries);
-  }
-
-  public Region createPartitionRegion(String regionName) {
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-    RegionFactory factory = CacheUtils.getCache().createRegionFactory(RegionShortcut.PARTITION)
-        .setPartitionAttributes(paf.create());
-    return factory.create(regionName);
-  }
- 
-  public Region createColocatedPartitionRegion(String regionName, final String colocatedRegion) {
-     PartitionAttributesFactory paf = new PartitionAttributesFactory();
-        paf.setColocatedWith(colocatedRegion);
-    RegionFactory factory = CacheUtils.getCache().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create());
-    return factory.create(regionName);
-  }
-  
-
-  @Override
-  protected Object[] executeQueries(String[] queries) {
-    ResultCollector collector = FunctionService.onRegion(region1).withArgs(queries).execute(equijoinTestFunction.getId());
-    Object result = collector.getResult();
-    return (Object[])((ArrayList)result).get(0);
-  }
-  
-  Function equijoinTestFunction = new Function(){
-    @Override
-    public boolean hasResult() {
-      return true;
-    }
-
-    @Override
-    public void execute(FunctionContext context) {
-      try {
-        String[] queries = (String[]) context.getArguments();
-        QueryService qs = CacheUtils.getCache().getQueryService();
-        
-        Object[] results = new SelectResults[queries.length];
-        for (int i = 0; i < queries.length; i++) {
-          results[i] = qs.newQuery(queries[i]).execute((RegionFunctionContext)context);
-        }
-        context.getResultSender().lastResult(results);
-      }
-      catch (Exception e) {
-        e.printStackTrace();
-      }
-    }
-
-    @Override
-    public String getId() {
-      return "Equijoin Query";
-    }
-
-    @Override
-    public boolean optimizeForWrite() {
-      return false;
-    }
-
-    @Override
-    public boolean isHA() {
-      return false;
-    }
-  };
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PdxCopyOnReadQueryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PdxCopyOnReadQueryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PdxCopyOnReadQueryJUnitTest.java
index e14df54..6f151bd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PdxCopyOnReadQueryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PdxCopyOnReadQueryJUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.internal.index;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Region;
@@ -26,14 +35,6 @@ import com.gemstone.gemfire.cache.query.SelectResults;
 import com.gemstone.gemfire.cache.query.data.PortfolioPdx;
 import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
 
 @Category(IntegrationTest.class)
 public class PdxCopyOnReadQueryJUnitTest {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
index 0929567..a6ff920 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
@@ -16,43 +16,46 @@
  */
 package com.gemstone.gemfire.cache.query.internal.index;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+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.Region;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.query.data.PortfolioPdx;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-/**
- *
- */
 @Category(DistributedTest.class)
-@Ignore("Test was disabled by renaming to DisabledTest")
-public class PutAllWithIndexPerfDUnitTest extends CacheTestCase {
+public class PutAllWithIndexPerfDUnitTest extends JUnit4CacheTestCase {
 
   /** The port on which the bridge server was started in this VM */
   private static int bridgeServerPort;
   static long timeWithoutStructTypeIndex = 0;
   static long timeWithStructTypeIndex = 0;
   
-  public PutAllWithIndexPerfDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     disconnectAllFromDS();
@@ -63,6 +66,8 @@ public class PutAllWithIndexPerfDUnitTest extends CacheTestCase {
     disconnectAllFromDS();
   }
 
+  @Ignore("TODO: test is disabled")
+  @Test
   public void testPutAllWithIndexes() {
     final String name = "testRegion";
     final Host host = Host.getHost(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java
index bc901f4..4f33afe 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.partitioned;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import static com.gemstone.gemfire.cache.query.Utils.*;
 
 import java.util.Collection;
@@ -38,10 +47,11 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.ThreadUtils;
 import com.gemstone.gemfire.test.dunit.VM;
 
+@Category(DistributedTest.class)
 public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCase {
 
-  public PRBasicIndexCreationDUnitTest(String name) {
-    super(name);
+  public PRBasicIndexCreationDUnitTest() {
+    super();
   }
 
   public void setCacheInVMsUsingXML(String xmlFile, VM... vms) {
@@ -75,6 +85,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * 
    * @throws Exception  if an exception is generated
    */
+  @Test
   public void testPRBasicIndexCreate() throws Exception
   {
     Host host = Host.getHost(0);
@@ -121,6 +132,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * Tests creation of multiple index creation on a partitioned region system.
    * @throws Exception if any excpetion are generated
    */
+  @Test
   public void testPRMultiIndexCreation() throws Exception
   {
     Host host = Host.getHost(0);
@@ -163,6 +175,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    *
    * @throws Exception if any exception are generated
    */
+  @Test
   public void testPRMultiIndexCreationAndGetIndex() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -240,6 +253,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
   /**
    * Creats partitioned index from an xml discription.
    */
+  @Test
   public void testCreatePartitionedIndexThroughXML() throws Exception
   {
     IgnoredException ie = IgnoredException.addIgnoredException(IndexNameConflictException.class.getName());
@@ -284,6 +298,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * in the sytem.
    * 
    */ 
+  @Test
   public void testCreatePartitionedRegionThroughXMLAndAPI()
   {
     Host host = Host.getHost(0);
@@ -331,6 +346,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * serialQueryEntry.conf hydra test before putting the data in the partitioned
    * region.
    */ 
+  @Test
   public void testCreatePartitionedIndexWithNoAliasBeforePuts () throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -363,6 +379,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * Test creating index on partitioned region like created in test
    * serialQueryEntry.conf but after putting some data in.
    */
+  @Test
   public void testCreatePartitionedIndexWithNoAliasAfterPuts () throws Exception { 
     
     Host host = Host.getHost(0);
@@ -397,6 +414,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
   /**
    * Test index usage with query on a partitioned region with bucket indexes.
    */
+  @Test
   public void testPartitionedIndexUsageWithPRQuery () throws Exception { 
     
     Host host = Host.getHost(0);
@@ -442,6 +460,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * Test index usage with query on a partitioned region with bucket indexes.
    * @throws Throwable 
    */
+  @Test
   public void testPartitionedIndexCreationDuringPersistentRecovery() throws Throwable { 
     
     Host host = Host.getHost(0);
@@ -494,6 +513,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * Test for bug 37089 where if there is an index on one attribute
    * (CompiledComparision) of the where clause query produces wrong results.
    */
+  @Test
   public void testPartitionedQueryWithIndexOnIdBug37089 () throws Exception { 
     
     Host host = Host.getHost(0);
@@ -534,6 +554,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
   /**
    * Creats partitioned index on keys and values of a bucket regions.
    */
+  @Test
   public void testCreatePartitionedIndexWithKeysValuesAndFunction() throws Exception
   {
 
@@ -576,6 +597,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
   /**
    * Bug Fix 37201, creating index from a data accessor.
    */
+  @Test
   public void testCreateIndexFromAccessor() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -617,6 +639,7 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    * accessor VM.
    */
   
+  @Test
   public void testCreateIndexAndAddAnAccessor() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -656,7 +679,8 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
    *
    * @throws Exception
    */
- public void testIndexQueryingWithOrderBy() throws Exception
+  @Test
+  public void testIndexQueryingWithOrderBy() throws Exception
  {
    int dataSize = 10;
    int step = 2;
@@ -754,7 +778,8 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
   *
   * @throws Exception
   */
- public void testIndexQueryingWithOrderAndVerify() throws Exception
+  @Test
+  public void testIndexQueryingWithOrderAndVerify() throws Exception
  {
    int dataSize = 10;
    int step = 2;
@@ -842,7 +867,8 @@ public class PRBasicIndexCreationDUnitTest extends PartitionedRegionDUnitTestCas
        "PRQueryDUnitTest#testPRDAckCreationAndQuerying : *Querying PR's with DACK Test ENDED*****");
  }
 
-public void testIndexQueryingWithOrderByLimit() throws Exception
+  @Test
+  public void testIndexQueryingWithOrderByLimit() throws Exception
  {
    int dataSize = 10;
    int step = 2;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
index ecfbfae..20041bd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.partitioned;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import static com.gemstone.gemfire.cache.query.Utils.createPortfoliosAndPositions;
 
 import java.io.File;
@@ -36,6 +45,7 @@ import com.gemstone.gemfire.test.dunit.Wait;
 /**
  * 
  */
+@Category(DistributedTest.class)
 public class PRBasicIndexCreationDeadlockDUnitTest extends
     PartitionedRegionDUnitTestCase
 
@@ -46,8 +56,8 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
    * @param name
    */
 
-  public PRBasicIndexCreationDeadlockDUnitTest(String name) {
-    super(name);
+  public PRBasicIndexCreationDeadlockDUnitTest() {
+    super();
   }
   public void setCacheInVMs(VM... vms) {
     for (VM vm : vms) {
@@ -74,6 +84,7 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
   public static volatile boolean hook_vm1, hook_vm2;
 
   //Dummy test method to be removed when test is fixed
+  @Test
   public void testIndexCreationMessageDiskRecoveryDeadLock() {
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
index fcc5c49..c83626e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.partitioned;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import static com.gemstone.gemfire.cache.query.Utils.*;
 
 import java.util.ArrayList;
@@ -34,10 +43,11 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 
+@Category(DistributedTest.class)
 public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTestCase {
 
-  public PRBasicMultiIndexCreationDUnitTest(String name) {
-    super(name);
+  public PRBasicMultiIndexCreationDUnitTest() {
+    super();
   }
 
   public void setCacheInVMs(VM... vms) {
@@ -61,6 +71,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * 
    * @throws Exception  if an exception is generated
    */
+  @Test
   public void testPRBasicIndexCreate() throws Exception
   {
     Host host = Host.getHost(0);
@@ -123,6 +134,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    *
    * @throws Exception if any exception are generated
    */
+  @Test
   public void testPRMultiIndexCreationAndGetIndex() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -209,6 +221,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * in the system.
    * 
    */ 
+  @Test
   public void testCreatePartitionedRegionThroughXMLAndAPI()
   {
     Host host = Host.getHost(0);
@@ -264,6 +277,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * serialQueryEntry.conf hydra test before putting the data in the partitioned
    * region.
    */ 
+  @Test
   public void testCreatePartitionedIndexWithNoAliasBeforePuts () throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -311,6 +325,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * Test creating index on partitioned region like created in test
    * serialQueryEntry.conf but after putting some data in.
    */
+  @Test
   public void testCreatePartitionedIndexWithNoAliasAfterPuts () throws Exception { 
     
     Host host = Host.getHost(0);
@@ -355,6 +370,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
   /**
    * Test index usage with query on a partitioned region with bucket indexes.
    */
+  @Test
   public void testPartitionedIndexUsageWithPRQuery () throws Exception { 
     
     Host host = Host.getHost(0);
@@ -406,6 +422,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * Test index usage with query on a partitioned region with bucket indexes.
    * @throws Throwable 
    */
+  @Test
   public void testPartitionedIndexCreationDuringPersistentRecovery() throws Throwable { 
     
     Host host = Host.getHost(0);
@@ -465,6 +482,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * Test for bug 37089 where if there is an index on one attribute
    * (CompiledComparision) of the where clause query produces wrong results.
    */
+  @Test
   public void testPartitionedQueryWithIndexOnIdBug37089 () throws Exception { 
     
     Host host = Host.getHost(0);
@@ -511,6 +529,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
   /**
    * Creats partitioned index on keys and values of a bucket regions.
    */
+  @Test
   public void testCreatePartitionedIndexWithKeysValuesAndFunction() throws Exception
   {
 
@@ -561,6 +580,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
   /**
    * Bug Fix 37201, creating index from a data accessor.
    */
+  @Test
   public void testCreateIndexFromAccessor() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -604,6 +624,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    * accessor VM.
    */
   
+  @Test
   public void testCreateIndexAndAddAnAccessor() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -646,7 +667,8 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
    *
    * @throws Exception
    */
- public void testIndexQueryingWithOrderBy() throws Exception
+  @Test
+  public void testIndexQueryingWithOrderBy() throws Exception
  {
    int dataSize = 10;
    int step = 2;
@@ -747,7 +769,8 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
   *
   * @throws Exception
   */
- public void testIndexQueryingWithOrderAndVerify() throws Exception
+  @Test
+  public void testIndexQueryingWithOrderAndVerify() throws Exception
  {
    int dataSize = 10;
    int step = 2;
@@ -838,7 +861,8 @@ public class PRBasicMultiIndexCreationDUnitTest extends PartitionedRegionDUnitTe
        "PRQueryDUnitTest#testPRDAckCreationAndQuerying : *Querying PR's with DACK Test ENDED*****");
  }
 
-public void testIndexQueryingWithOrderByLimit() throws Exception
+  @Test
+  public void testIndexQueryingWithOrderByLimit() throws Exception
  {
   int step = 2;
   int totalDataSize = 90;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
index bbe3c90..0d8f48a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.partitioned;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import static com.gemstone.gemfire.cache.query.Utils.*;
 
 import com.gemstone.gemfire.cache.Cache;
@@ -38,6 +47,7 @@ import com.gemstone.gemfire.test.dunit.VM;
  * firing a simple query and validating the ResultSet size and Contents. 
  * 
  */
+@Category(DistributedTest.class)
 public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
 
 {
@@ -47,8 +57,8 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
    * @param name
    */
 
-  public PRBasicQueryDUnitTest(String name) {
-    super(name);
+  public PRBasicQueryDUnitTest() {
+    super();
   }
 
   public void setCacheInVMs(VM... vms) {
@@ -74,6 +84,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
    * 3. Fires a query on accessor VM and verifies the result. 
    * @throws Exception
    */
+  @Test
   public void testPRBasicQuerying() throws Exception
   {
     Host host = Host.getHost(0);
@@ -142,6 +153,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
             "PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR's Test ENDED");
   }
   
+  @Test
   public void testPRCountStarQuery() throws Exception
   {
     Host host = Host.getHost(0);
@@ -221,6 +233,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
             "PRQBasicQueryDUnitTest#testPRCountStarQuery: Querying PR's Test ENDED");
   }
   
+  @Test
   public void testPROrderBy() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
index bdbaeb3..9f07f6e 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
@@ -16,60 +16,51 @@
  */
 package com.gemstone.gemfire.cache.query.partitioned;
 
-import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+import static com.gemstone.gemfire.cache.query.Utils.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.query.data.PortfolioData;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
- * Basic funtional test for removing index from a partitioned region system.
- * 
+ * Basic functional test for removing index from a partitioned region system.
  */
-public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase
-{
-  /**
-   * Constructor
-   * @param name
-   */  
-  public PRBasicRemoveIndexDUnitTest (String name) {
-    super(name);
-  }
+@Category(DistributedTest.class)
+public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase {
+
+  private final PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
+
+  private final int start = 0;
+
+  private final int end = 1003;
 
-  public void setCacheInVMs(VM... vms) {
-    for (VM vm : vms) {
-      vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
-    }
-  }
-  
-  PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
-  
   /**
    * Name of the partitioned region for the test.
    */
-  final String name = "PartionedPortfolios";
-  
-  
-  final int start = 0;
-  
-  final int end = 1003;
+  private final String name = "PartitionedPortfolios";
 
   /**
-   * Reduncancy level for the pr.
+   * Redundancy level for the pr.
    */
-  final int redundancy = 0;
+  private final int redundancy = 0;
 
+  public void setCacheInVMs(VM... vms) {
+    for (VM vm : vms) {
+      vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+    }
+  }
   
   /**
    * Remove index test to remove all the indexes in a given partitioned region
-   * 
-   * @throws Exception
-   *           if the test fails
    */
-  public void testPRBasicIndexRemove() throws Exception
-  {
+  @Test
+  public void testPRBasicIndexRemove() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
@@ -106,12 +97,12 @@ public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase
     
     LogWriterUtils.getLogWriter().info(
     "PRBasicRemoveIndexDUnitTest.testPRBasicRemoveIndex test now  ends sucessfully");
-
   }
   
   /**
    * Test removing single index on a pr.
    */
+  @Test
   public void testPRBasicRemoveParticularIndex() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);



Mime
View raw message