geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hiteshkhame...@apache.org
Subject [47/94] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4
Date Wed, 15 Jun 2016 00:08:03 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/CountStarJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/CountStarJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/CountStarJUnitTest.java
index f58d4bd..5272f2b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/CountStarJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/CountStarJUnitTest.java
@@ -19,26 +19,34 @@
  */
 package com.gemstone.gemfire.cache.query.functional;
 
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.query.*;
-import com.gemstone.gemfire.cache.query.data.Portfolio;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import static org.junit.Assert.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+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.IndexType;
+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.data.Portfolio;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
 /**
  * This test runs {Select COUNT(*) from /regionName [where clause]} queries
  * on different types of regions with and without multiple indexes.
- * 
- *
  */
 @Category(IntegrationTest.class)
 public class CountStarJUnitTest {
@@ -47,9 +55,6 @@ public class CountStarJUnitTest {
   private static String exampleRegionName = "employee";
   private int numElem = 100;
   
-  public CountStarJUnitTest() {
-  }
-
   @Before
   public void setUp() throws Exception {
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "Query.VERBOSE", "true");
@@ -63,7 +68,6 @@ public class CountStarJUnitTest {
 
   private static HashMap<String, Integer> countStarQueries = new HashMap<String, Integer>();
 
-
   //EquiJoin Queries
   private static String[] countStarQueriesWithEquiJoins = { "select COUNT(*) from /" + regionName + " p, /"+ exampleRegionName +" e where p.ID = e.ID AND p.ID > 0",
     "select COUNT(*) from /" + regionName + " p, /"+ exampleRegionName +" e where p.ID = e.ID AND p.ID > 20 AND e.ID > 40",
@@ -98,11 +102,12 @@ public class CountStarJUnitTest {
   }
   
   //Queries without indexes.
+
   /**
    * Test on Local Region data
    */
   @Test
-  public void testCountStartQueriesOnLocalRegion(){
+  public void testCountStartQueriesOnLocalRegion() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createLocalRegion();
@@ -112,27 +117,23 @@ public class CountStarJUnitTest {
     QueryService queryService = cache.getQueryService();
     Query query1 = null;
     Query query2 = null;
-    try {
-      for(String queryStr: countStarQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        assertEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-        
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+
+    for(String queryStr: countStarQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      assertEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
+
     }
   }
 
@@ -140,7 +141,7 @@ public class CountStarJUnitTest {
    * Test on Replicated Region data
    */
   @Test
-  public void testCountStarQueriesOnReplicatedRegion(){
+  public void testCountStarQueriesOnReplicatedRegion() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createReplicatedRegion();
@@ -150,28 +151,24 @@ public class CountStarJUnitTest {
     QueryService queryService = cache.getQueryService();
     Query query1 = null;
     Query query2 = null;
-    try {
-      for(String queryStr: countStarQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        assertEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+
+    for(String queryStr: countStarQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      assertEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
-    
+
     //Destroy current Region for other tests
     cache.getRegion(regionName).destroyRegion();
   }
@@ -180,7 +177,7 @@ public class CountStarJUnitTest {
    * Test on Partitioned Region data
    */
   @Test
-  public void testCountStarQueriesOnPartitionedRegion(){
+  public void testCountStarQueriesOnPartitionedRegion() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createPartitionedRegion();
@@ -190,35 +187,31 @@ public class CountStarJUnitTest {
     QueryService queryService = cache.getQueryService();
     Query query1 = null;
     Query query2 = null;
-    try {
-      for(String queryStr: countStarQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+
+    for(String queryStr: countStarQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
-    
+
     //Destroy current Region for other tests
     cache.getRegion(regionName).destroyRegion();
   }
 
   //Test with indexes available on region
   @Test
-  public void testCountStartQueriesOnLocalRegionWithIndex(){
+  public void testCountStartQueriesOnLocalRegionWithIndex() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createLocalRegion();
@@ -228,14 +221,10 @@ public class CountStarJUnitTest {
     QueryService queryService = cache.getQueryService();
     
     //CReate Index on status and ID
-    try {
-      queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
-    } catch (Exception e1) {
-      fail("Index Creation Failed with message: " + e1.getMessage());
-    }
-    
+    queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
+
     Region region = cache.getRegion(regionName);
     //Verify Index Creation
     assertNotNull(queryService.getIndex(region, "sampleIndex-1"));
@@ -245,34 +234,30 @@ public class CountStarJUnitTest {
     //Run queries
     Query query1 = null;
     Query query2 = null;
-    try {
-      for(String queryStr: countStarQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+
+    for(String queryStr: countStarQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
-    
+
     //Destroy current Region for other tests
     region.destroyRegion();
   }
 
   @Test
-  public void testCountStarQueriesOnReplicatedRegionWithIndex(){
+  public void testCountStarQueriesOnReplicatedRegionWithIndex() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createReplicatedRegion();
@@ -281,52 +266,43 @@ public class CountStarJUnitTest {
     
     QueryService queryService = cache.getQueryService();
     //CReate Index on status and ID
-    try {
-      queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
-    } catch (Exception e1) {
-      fail("Index Creation Failed with message: " + e1.getMessage());
-    }
-    
+    queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
+
     Region region = cache.getRegion(regionName);
     //Verify Index Creation
     assertNotNull(queryService.getIndex(region, "sampleIndex-1"));
     assertNotNull(queryService.getIndex(region, "sampleIndex-2"));
     assertEquals(3, queryService.getIndexes().size());
 
-
-  //Run queries
+    //Run queries
     Query query1 = null;
     Query query2 = null;
-    try {
-      for(String queryStr: countStarQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+
+    for(String queryStr: countStarQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
-    
+
     //Destroy current Region for other tests
     region.destroyRegion();
   }
 
   @Test
-  public void testCountStarQueriesOnPartitionedRegionWithIndex(){
+  public void testCountStarQueriesOnPartitionedRegionWithIndex() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createPartitionedRegion();
@@ -336,15 +312,10 @@ public class CountStarJUnitTest {
     QueryService queryService = cache.getQueryService();
     //CReate Index on status and ID
     
-    try {
-      queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
-      //queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
-      //queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
-    } catch (Exception e1) {
-      fail("Index Creation Failed with message: " + e1.getMessage());
-    }
-    
-    
+    queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
+    //queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
+    //queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
+
     Region region = cache.getRegion(regionName);
     //Verify Index Creation
     //assertNotNull(queryService.getIndex(region, "sampleIndex-1"));
@@ -354,34 +325,30 @@ public class CountStarJUnitTest {
     //Run queries
     Query query1 = null;
     Query query2 = null;
-    try {
-      for(String queryStr: countStarQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+
+    for(String queryStr: countStarQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
+
     //Destroy current Region for other tests
     region.destroyRegion();
   }
 
   @Test
-  public void testEquiJoinCountStarQueries(){
-
+  public void testEquiJoinCountStarQueries() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createLocalRegion();
@@ -397,38 +364,29 @@ public class CountStarJUnitTest {
     Query query2 = null;
     
     // Without Indexes
-    try {
-      for(String queryStr: countStarQueriesWithEquiJoins){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+    for(String queryStr: countStarQueriesWithEquiJoins){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
-    
+
     //CReate Index on status and ID
-    try {
-      queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "e.ID", "/"+exampleRegionName+ " e");
-      queryService.createIndex("sampleIndex-4", IndexType.FUNCTIONAL, "e.status", "/"+exampleRegionName+ " e");
-    } catch (Exception e1) {
-      fail("Index Creation Failed with message: " + e1.getMessage());
-    }
-    
+    queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "e.ID", "/"+exampleRegionName+ " e");
+    queryService.createIndex("sampleIndex-4", IndexType.FUNCTIONAL, "e.status", "/"+exampleRegionName+ " e");
+
     Region region = cache.getRegion(regionName);
     Region region2 = cache.getRegion(exampleRegionName);
     //Verify Index Creation
@@ -439,35 +397,30 @@ public class CountStarJUnitTest {
     assertEquals(4, queryService.getIndexes().size());
 
     //With Indexes
-    try {
-      for(String queryStr: countStarQueriesWithEquiJoins){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query with indexes: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+    for(String queryStr: countStarQueriesWithEquiJoins){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query with indexes: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarQueries.get(queryStr).intValue(), count);
     }
-    
+
     //Destroy current Region for other tests
     region.destroyRegion();
     region2.destroyRegion();
   }
   
   @Test
-  public void testCountStarOnCollection() {
+  public void testCountStarOnCollection() throws Exception {
     String collection = "$1";
     HashMap<String, Integer> countStarQueriesWithParms = new HashMap<String, Integer>();
     countStarQueriesWithParms.put("select COUNT(*) from " + collection , 100);
@@ -495,32 +448,26 @@ public class CountStarJUnitTest {
       portfolios.add(new Portfolio(i, i));
     }
     // Without Indexes
-    try {
-      for(String queryStr: countStarQueriesWithParms.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute(new Object[]{portfolios});
-        SelectResults result2 = (SelectResults)query2.execute(new Object[]{portfolios});
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        assertEquals("Query: "+ queryStr, countStarQueriesWithParms.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+    for(String queryStr: countStarQueriesWithParms.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute(new Object[]{portfolios});
+      SelectResults result2 = (SelectResults)query2.execute(new Object[]{portfolios});
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      assertEquals("Query: "+ queryStr, countStarQueriesWithParms.get(queryStr).intValue(), count);
     }
   }
   
   @Test
-  public void testCountStarWithDuplicateValues() {
-
+  public void testCountStarWithDuplicateValues() throws Exception {
     Cache cache = CacheUtils.getCache();
 
     createLocalRegion();
@@ -539,7 +486,6 @@ public class CountStarJUnitTest {
     countStarDistinctQueries.put("select distinct COUNT(*) from /" + regionName + " where ID IN SET(1, 2, 3, 4, 5)", 5);
     countStarDistinctQueries.put("select distinct COUNT(*) from /" + regionName + " where NOT (ID > 5)", 5);
     
-
     QueryService queryService = cache.getQueryService();
     //Run queries
     Query query1 = null;
@@ -556,65 +502,52 @@ public class CountStarJUnitTest {
       region.put(i+100, new Portfolio(i, i));
     }
     // Without Indexes
-    try {
-      for(String queryStr: countStarDistinctQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarDistinctQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
-    }
-    
-  //CReate Index on status and ID
-    try {
-      queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
-      queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
-    } catch (Exception e1) {
-      fail("Index Creation Failed with message: " + e1.getMessage());
+    for(String queryStr: countStarDistinctQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarDistinctQueries.get(queryStr).intValue(), count);
     }
-    
+
+    //CReate Index on status and ID
+    queryService.createIndex("sampleIndex-1", IndexType.FUNCTIONAL, "p.ID", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-2", IndexType.FUNCTIONAL, "p.status", "/"+regionName+ " p");
+    queryService.createIndex("sampleIndex-3", IndexType.FUNCTIONAL, "pos.secId", "/"+regionName+" p, p.positions.values pos");
+
     //Verify Index Creation
     assertNotNull(queryService.getIndex(region, "sampleIndex-1"));
     assertNotNull(queryService.getIndex(region, "sampleIndex-2"));
     assertEquals(3, queryService.getIndexes().size());
 
- // Without Indexes
-    try {
-      for(String queryStr: countStarDistinctQueries.keySet()){
-        query1 = queryService.newQuery(queryStr);
-        query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
-        
-        SelectResults result1 = (SelectResults)query1.execute();
-        SelectResults result2 = (SelectResults)query2.execute();
-        assertEquals(queryStr, 1, result1.size());
-        assertTrue(result1.asList().get(0) instanceof Integer);
-        
-        int count = ((Integer)result1.asList().get(0)).intValue();
-        
-        //Also verify with size of result2 to count
-        assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
-        
-        //assertIndexDetailsEquals("Query: "+ queryStr, countStarDistinctQueries.get(queryStr).intValue(), count);
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-      fail("Query "+ query1+" Execution Failed!");
+    // Without Indexes
+    for(String queryStr: countStarDistinctQueries.keySet()){
+      query1 = queryService.newQuery(queryStr);
+      query2 = queryService.newQuery(queryStr.replace("COUNT(*)", "*"));
+
+      SelectResults result1 = (SelectResults)query1.execute();
+      SelectResults result2 = (SelectResults)query2.execute();
+      assertEquals(queryStr, 1, result1.size());
+      assertTrue(result1.asList().get(0) instanceof Integer);
+
+      int count = ((Integer)result1.asList().get(0)).intValue();
+
+      //Also verify with size of result2 to count
+      assertEquals("COUNT(*) query result is wrong for query: " + queryStr , result2.size(), count);
+
+      //assertIndexDetailsEquals("Query: "+ queryStr, countStarDistinctQueries.get(queryStr).intValue(), count);
     }
   }
+
   private void createLocalRegion() {
     Cache cache = CacheUtils.getCache();
     AttributesFactory attributesFactory = new AttributesFactory();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/FunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/FunctionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/FunctionJUnitTest.java
index f2a1743..5c845ff 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/FunctionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/FunctionJUnitTest.java
@@ -22,6 +22,8 @@
  */
 package com.gemstone.gemfire.cache.query.functional;
 
+import static org.junit.Assert.*;
+
 import java.text.SimpleDateFormat;
 import java.util.Collection;
 import java.util.Date;
@@ -32,10 +34,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import static org.junit.Assert.*;
-
-import junit.framework.TestCase;
-
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.query.CacheUtils;
 import com.gemstone.gemfire.cache.query.FunctionDomainException;
@@ -49,13 +47,9 @@ import com.gemstone.gemfire.cache.query.internal.ExecutionContext;
 import com.gemstone.gemfire.cache.query.internal.parse.OQLLexerTokenTypes;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
-/**
- *
- */
 @Category(IntegrationTest.class)
 public class FunctionJUnitTest {
 
-
   @Before
   public void setUp() throws java.lang.Exception {
     CacheUtils.startCache();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
index c4042da..1eaa1f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
@@ -21,6 +21,19 @@
  */
 package com.gemstone.gemfire.cache.query.functional;
 
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.query.CacheUtils;
 import com.gemstone.gemfire.cache.query.Index;
@@ -36,30 +49,11 @@ import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
 import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-import junit.framework.TestCase;
-
-/**
- *
- */
 @Category(IntegrationTest.class)
 public class IUMRShuffleIteratorsJUnitTest {
 
-
   @Before
-  public void setUp() throws java.lang.Exception {
+  public void setUp() throws Exception {
     CacheUtils.startCache();
     Region r1 = CacheUtils.createRegion("portfolios", Portfolio.class);
     for(int i=0;i<4;i++){
@@ -83,41 +77,33 @@ public class IUMRShuffleIteratorsJUnitTest {
     for(int i=0;i<4;i++){
       r3.put(new Integer(i), new Address("411001","Pune",str,ph));
     }
-
   }
 
   @After
-  public void tearDown() throws java.lang.Exception {
+  public void tearDown() throws Exception {
     CacheUtils.closeCache();
   }
 
   @Test
   public void testQueryWithNOIndexes1() throws Exception {
-    //        Object r = new Object();
     CacheUtils.getQueryService();
+
     String queries[] = {
         "select distinct * from /portfolios p, /employees e",
         "Select distinct * from /portfolios pf,/employees e  where pf.status='active'"
-
     };
 
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        q.execute();
-        if(observer.isIndexesUsed){
-          fail("Index is uesd");
-        }
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      q.execute();
+      if(observer.isIndexesUsed){
+        fail("Index is uesd");
       }
     }
-
   }//end of test 1
 
   @Test
@@ -128,41 +114,31 @@ public class IUMRShuffleIteratorsJUnitTest {
 
     String queries[] = {
         "Select distinct * from /portfolios pf,/employees e  where pf.status='active'"
-
     };
+
     //Execute Queries without Indexes
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        r[i][0] = q.execute();
-      } catch (Exception e) {
-        e.printStackTrace();
-      }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      r[i][0] = q.execute();
     }
     //Create Index and Execute the Queries
     qs.createIndex("statusIndex", IndexType.FUNCTIONAL,"status","/portfolios");
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        r[i][1] = q.execute();
-        if(!observer.isIndexesUsed){
-          fail("Index is NOT uesd");
-        }
-        CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
-
-        Iterator itr = observer.indexesUsed.iterator();
-        assertEquals("statusIndex",itr.next().toString());
-
-      } catch (Exception e) {
-        e.printStackTrace();
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      r[i][1] = q.execute();
+      if(!observer.isIndexesUsed){
+        fail("Index is NOT uesd");
       }
+      CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
+
+      Iterator itr = observer.indexesUsed.iterator();
+      assertEquals("statusIndex",itr.next().toString());
     }
     //Verifying the query results
     StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -181,39 +157,27 @@ public class IUMRShuffleIteratorsJUnitTest {
     //Execute Queries without Indexes
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        r[i][0] = q.execute();
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
-      }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      r[i][0] = q.execute();
     }
     //Create Index andExecute the Queries
     qs.createIndex("nameIndex", IndexType.FUNCTIONAL,"e.name","/employees e");
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        r[i][1] = q.execute();
-
-        if(!observer.isIndexesUsed){
-          fail("Index is NOT uesd");
-          //Test fails here. Index on second region is not getting used.
-        }
-        CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
-        Iterator itr = observer.indexesUsed.iterator();
-        assertEquals("nameIndex",itr.next().toString());
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      r[i][1] = q.execute();
+
+      if(!observer.isIndexesUsed){
+        fail("Index is NOT uesd");
+        //Test fails here. Index on second region is not getting used.
       }
+      CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
+      Iterator itr = observer.indexesUsed.iterator();
+      assertEquals("nameIndex",itr.next().toString());
     }
     //Verifying the query results
     StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -226,21 +190,18 @@ public class IUMRShuffleIteratorsJUnitTest {
     Object r[][] = new Object[9][2];
     QueryService qs;
     qs = CacheUtils.getQueryService();
+
     String queries[] = {
         //Test Case No. IUMR002
         "Select distinct * from /portfolios pf, /employees e  where e.name ='empName' and pf.status='active'",
     };
+
     //Execute Query without Indexes
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        r[i][0] = q.execute();
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
-      }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      r[i][0] = q.execute();
     }
 
     //Create Indexes and Execute Queries
@@ -249,41 +210,34 @@ public class IUMRShuffleIteratorsJUnitTest {
 
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        r[i][1] = q.execute();
-        if(!observer.isIndexesUsed){
-          fail("Index is NOT uesd");
-        }
-        int indxs = observer.indexesUsed.size();
-        CacheUtils.log("***********Indexes Used :::: "+indxs+" IndexName::"+observer.IndexName);
-        if(indxs!=2){
-          fail("FAILED: Both The Indexes should be used. Presently only "+indxs+" Index(es) is used");
-        }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      r[i][1] = q.execute();
+      if(!observer.isIndexesUsed){
+        fail("Index is NOT uesd");
+      }
+      int indxs = observer.indexesUsed.size();
+      CacheUtils.log("***********Indexes Used :::: "+indxs+" IndexName::"+observer.IndexName);
+      if(indxs!=2){
+        fail("FAILED: Both The Indexes should be used. Presently only "+indxs+" Index(es) is used");
+      }
 
-        Iterator itr = observer.indexesUsed.iterator();
-        String temp;
+      Iterator itr = observer.indexesUsed.iterator();
+      String temp;
 
-        while(itr.hasNext()){
-          temp = itr.next().toString();
+      while(itr.hasNext()){
+        temp = itr.next().toString();
 
-          if(temp.equals("nameIndex")){
-            break;
-          }else if(temp.equals("statusIndex")){
-            break;
-          }else{
-            fail("indices used do not match with those which are expected to be used" +
-                "<nameIndex> and <statusIndex> were expected but found " +itr.next());
-          }
+        if(temp.equals("nameIndex")){
+          break;
+        }else if(temp.equals("statusIndex")){
+          break;
+        }else{
+          fail("indices used do not match with those which are expected to be used" +
+              "<nameIndex> and <statusIndex> were expected but found " +itr.next());
         }
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
       }
     }
     //Verifying the query results
@@ -303,20 +257,14 @@ public class IUMRShuffleIteratorsJUnitTest {
         "select distinct * from /address a, /portfolios p, /employees e, a.street s  where s.street ='DPStreet1'",
         //Scenario B: Only Index on the first region in the Query is used
         //"select distinct * from /address a, /portfolios p, /employees e, a.street s where p.status='active' and s.street ='DPStreet1'",
-
     };
+
     //Execute queries without Indexes
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        r [i][0]= q.execute();
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
-      }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      r [i][0]= q.execute();
     }
     //Create Indexes and Execute the queries
     qs.createIndex("nameIndex", IndexType.FUNCTIONAL,"e.name","/employees e");
@@ -324,25 +272,18 @@ public class IUMRShuffleIteratorsJUnitTest {
     qs.createIndex("streetIndex", IndexType.FUNCTIONAL,"s.street","/address a, a.street s");
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        r [i][1]= q.execute();
-        if(!observer.isIndexesUsed){
-          fail("Index is NOT uesd");
-        }
-        int indxs = observer.indexesUsed.size();
-        CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
-        Iterator itr = observer.indexesUsed.iterator();
-        assertEquals("streetIndex",itr.next().toString());
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      r [i][1]= q.execute();
+      if(!observer.isIndexesUsed){
+        fail("Index is NOT uesd");
       }
-
+      int indxs = observer.indexesUsed.size();
+      CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
+      Iterator itr = observer.indexesUsed.iterator();
+      assertEquals("streetIndex",itr.next().toString());
     }
     //Verifying the query results
     StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -359,42 +300,31 @@ public class IUMRShuffleIteratorsJUnitTest {
         "select distinct * from /address itr1,itr1.phoneNo itr2,itr1.street itr3 where itr2.mobile>333",
         "select distinct * from /address itr1,itr1.street itr2,itr1.phoneNo itr3 where itr3.mobile>333",
     };
+
     //Execute the query without index
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        r[i][0] = q.execute();
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
-      }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      r[i][0] = q.execute();
     }
     //Create index and Execute the query
     qs.createIndex("mobileIndex",IndexType.FUNCTIONAL,"itr2.mobile","/address itr1,itr1.phoneNo itr2,itr1.street itr3");
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        r[i][1] = q.execute();
-        if(!observer.isIndexesUsed){
-          fail("Index is NOT uesd");
-        }
-        int indxs = observer.indexesUsed.size();
-        CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
-
-        Iterator itr = observer.indexesUsed.iterator();
-        assertEquals("mobileIndex",itr.next().toString());
-
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      r[i][1] = q.execute();
+      if(!observer.isIndexesUsed){
+        fail("Index is NOT uesd");
       }
+      int indxs = observer.indexesUsed.size();
+      CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
+
+      Iterator itr = observer.indexesUsed.iterator();
+      assertEquals("mobileIndex",itr.next().toString());
     }
     //Verifying the query results
     StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -414,15 +344,9 @@ public class IUMRShuffleIteratorsJUnitTest {
     //Execute queries without Indexes
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        r [i][0]= q.execute();
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
-      }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      r [i][0]= q.execute();
     }
     //Create Indexes and Execute the queries
     qs.createIndex("nameIndex", IndexType.FUNCTIONAL,"e.name","/employees e");
@@ -430,54 +354,51 @@ public class IUMRShuffleIteratorsJUnitTest {
     qs.createIndex("streetIndex", IndexType.FUNCTIONAL,"s.street","/address a, a.street s");
     for (int i = 0; i < queries.length; i++) {
       Query q = null;
-      try {
-        q = CacheUtils.getQueryService().newQuery(queries[i]);
-        CacheUtils.getLogger().info("Executing query: " + queries[i]);
-        QueryObserverImpl observer = new QueryObserverImpl();
-        QueryObserverHolder.setInstance(observer);
-        r [i][1]= q.execute();
-        if(!observer.isIndexesUsed){
-          fail("Index is NOT uesd");
-        }
-        int indxs = observer.indexesUsed.size();
-        CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
-
-        Iterator itr = observer.indexesUsed.iterator();
-        String temp;
-
-        while(itr.hasNext()){
-          temp = itr.next().toString();
-
-          if(temp.equals("streetIndex")){
-            break;
-          }else if(temp.equals("statusIndex")){
-            break;
-          }else{
-            fail("indices used do not match with those which are expected to be used" +
-                "<streetIndex> and <statusIndex> were expected but found " +itr.next());
-          }
+      q = CacheUtils.getQueryService().newQuery(queries[i]);
+      CacheUtils.getLogger().info("Executing query: " + queries[i]);
+      QueryObserverImpl observer = new QueryObserverImpl();
+      QueryObserverHolder.setInstance(observer);
+      r [i][1]= q.execute();
+      if(!observer.isIndexesUsed){
+        fail("Index is NOT uesd");
+      }
+      int indxs = observer.indexesUsed.size();
+      CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
+
+      Iterator itr = observer.indexesUsed.iterator();
+      String temp;
+
+      while(itr.hasNext()){
+        temp = itr.next().toString();
+
+        if(temp.equals("streetIndex")){
+          break;
+        }else if(temp.equals("statusIndex")){
+          break;
+        }else{
+          fail("indices used do not match with those which are expected to be used" +
+              "<streetIndex> and <statusIndex> were expected but found " +itr.next());
         }
-
-      } catch (Exception e) {
-        e.printStackTrace();
-        fail(q.getQueryString());
       }
-
     }
     //Verifying the query results
     StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
     ssORrs.CompareQueryResultsWithoutAndWithIndexes(r,queries.length,queries);
   } //end of test7
 
-  class QueryObserverImpl extends QueryObserverAdapter{
+  private static class QueryObserverImpl extends QueryObserverAdapter {
+
     boolean isIndexesUsed = false;
     ArrayList indexesUsed = new ArrayList();
     String IndexName;
+
+    @Override
     public void beforeIndexLookup(Index index, int oper, Object key) {
       IndexName = index.getName();
       indexesUsed.add(index.getName());
     }
 
+    @Override
     public void afterIndexLookup(Collection results) {
       if(results != null){
         isIndexesUsed = true;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
index 3a2d9da..8f02f63 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
@@ -16,14 +16,10 @@
  */
 package com.gemstone.gemfire.cache.query.functional;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.io.File;
 
-import junit.framework.Assert;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -49,25 +45,21 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 import com.gemstone.gemfire.test.dunit.ThreadUtils;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
-/**
-*
-*/
 @Category(IntegrationTest.class)
-public class IndexCreationDeadLockJUnitTest
-{
-  protected boolean testFailed = false;
+public class IndexCreationDeadLockJUnitTest {
+
+  private static final String indexName = "queryTest";
 
-  protected String cause = "";
+  private boolean testFailed = false;
 
-  boolean exceptionInCreatingIndex = false;
+  private String cause = "";
 
-  Region region;
+  private boolean exceptionInCreatingIndex = false;
 
-  final String indexName = "queryTest";
+  private Region region;
 
   @Before
-  public void setUp() throws java.lang.Exception
-  {
+  public void setUp() throws Exception {
     CacheUtils.startCache();
     this.testFailed = false;
     this.cause = "";
@@ -83,25 +75,21 @@ public class IndexCreationDeadLockJUnitTest
   }
 
   @After
-  public void tearDown() throws java.lang.Exception
-  {
-	try{
-		this.region.localDestroyRegion();
-	}catch(RegionDestroyedException  rde) {
-		//Ignore
-	}
+  public void tearDown() throws Exception {
+    try{
+      this.region.localDestroyRegion();
+    }catch(RegionDestroyedException  rde) {
+      //Ignore
+    }
 
     CacheUtils.closeCache();
   }
 
   /**
    * Tests Index creation and maintenance deadlock scenario for in memory region
-   *
    */
   @Test
-  public void testIndexCreationDeadLock() throws Exception
-  {
-
+  public void testIndexCreationDeadLock() throws Exception {
     simulateDeadlockScenario();
     assertFalse(this.cause, this.testFailed);
     assertFalse("Index creation failed", this.exceptionInCreatingIndex);
@@ -111,8 +99,7 @@ public class IndexCreationDeadLockJUnitTest
    * Tests  Index creation and maintenance deadlock scenario for Persistent only disk region
    */
   @Test
-  public void testIndexCreationDeadLockForDiskOnlyRegion()
-  {
+  public void testIndexCreationDeadLockForDiskOnlyRegion() {
     this.region.destroyRegion();
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -132,14 +119,11 @@ public class IndexCreationDeadLockJUnitTest
     assertFalse("Index creation failed", this.exceptionInCreatingIndex);
   }
 
-
   /**
    * Tests  Index creation and maintenance deadlock scenario for a region with stats enabled
-   *
    */
   @Test
-  public void testIndexCreationDeadLockForStatsEnabledRegion()
-  {
+  public void testIndexCreationDeadLockForStatsEnabledRegion() {
     this.region.destroyRegion();
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -157,8 +141,7 @@ public class IndexCreationDeadLockJUnitTest
    * Tests inability to create index on a region which overflows to disk   *
    */
   @Test
-  public void testIndexCreationDeadLockForOverflowToDiskRegion()
-  {
+  public void testIndexCreationDeadLockForOverflowToDiskRegion() {
     this.region.destroyRegion();
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -181,7 +164,6 @@ public class IndexCreationDeadLockJUnitTest
   }
 
   private void simulateDeadlockScenario() {
-
     Thread th = new IndexCreationDeadLockJUnitTest.PutThread("put thread");
     th.start();
     ThreadUtils.join(th, 60 * 1000);
@@ -190,8 +172,7 @@ public class IndexCreationDeadLockJUnitTest
   /**
    * following thread will perform the operations of data population and index creation.
    */
-  public class HelperThread extends Thread
-  {
+  private class HelperThread extends Thread {
 
     public HelperThread(String thName) {
       super(thName);
@@ -201,8 +182,8 @@ public class IndexCreationDeadLockJUnitTest
               + thName);
     }
 
-    public void run()
-    {
+    @Override
+    public void run() {
       try {
 
         System.out
@@ -227,19 +208,17 @@ public class IndexCreationDeadLockJUnitTest
   /**
    * thread to put the entries in region
    */
-  public class PutThread extends Thread
-  {
+  private class PutThread extends Thread {
 
     public PutThread(String thName) {
       super(thName);
       System.out
           .println("--------------------- Thread started ------------------------- "
               + thName);
-
     }
 
-    public void run()
-    {
+    @Override
+    public void run() {
       try {
         System.out
             .println("--------------------- Populating Data -------------------------");
@@ -275,12 +254,12 @@ public class IndexCreationDeadLockJUnitTest
   /**
    *  make the update to wait for a while before updatation to simulate the deadlock condiction
    */
-  public class BeforeUpdateCallBack extends CacheWriterAdapter
-  {
+  private class BeforeUpdateCallBack extends CacheWriterAdapter {
+
     int cnt = 0;
 
-    public void beforeCreate(EntryEvent event) throws CacheWriterException
-    {
+    @Override
+    public void beforeCreate(EntryEvent event) throws CacheWriterException {
       cnt++;
       if (cnt == 10) {
         System.out


Mime
View raw message