geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject incubator-geode git commit: GEODE-971 CI Failure: PRClientServerRegionFunctionExecutionFailoverDUnitTest.testOnRegionFailoverWithTwoServerDownHA
Date Mon, 21 Mar 2016 20:32:00 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 4d166a46e -> f1ff67cbb


GEODE-971 CI Failure: PRClientServerRegionFunctionExecutionFailoverDUnitTest.testOnRegionFailoverWithTwoServerDownHA

I've reworked the test to no longer catch and log underlying exceptions
so that we can tell why the test fails the next time GEODE-971 happens in
a Jenkins build.  The test passes every time I run it outside of Jenkins.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f1ff67cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f1ff67cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f1ff67cb

Branch: refs/heads/develop
Commit: f1ff67cbb8285d2bd096b30edf1b0d4b61083de5
Parents: 4d166a4
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Mon Mar 21 13:29:00 2016 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Mon Mar 21 13:29:00 2016 -0700

----------------------------------------------------------------------
 ...tServerRegionFunctionExecutionDUnitTest.java | 390 ++++++++-----------
 ...egionFunctionExecutionFailoverDUnitTest.java |   2 +-
 .../cache/execute/PRClientServerTestBase.java   | 141 +++----
 3 files changed, 210 insertions(+), 323 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f1ff67cb/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
index ed61274..d9ce258 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
@@ -421,7 +421,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
 
 
   public static void regionSingleKeyExecutionNonHA(Boolean isByName,
-      Function function, Boolean toRegister) {
+      Function function, Boolean toRegister) throws Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -450,15 +450,13 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     } catch (Exception ex) {
       if (!(ex.getCause() instanceof ServerConnectivityException)
           && !(ex.getCause() instanceof FunctionInvocationTargetException)) {
-        ex.printStackTrace();
-        LogWriterUtils.getLogWriter().info("Exception : ", ex);
-        fail("Test failed after the execute operation");
+        throw ex;
       }
     }
   }
   
   public static void regionExecutionHAOneServerDown (Boolean isByName,
-      Function function, Boolean toRegister) {
+      Function function, Boolean toRegister) throws Exception {
 
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
@@ -477,23 +475,18 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
 
     region.put(testKey, new Integer(1));
-    try {
-      ArrayList<String> args = new ArrayList<String>();
-      args.add(retryRegionName);
-      args.add("regionExecutionHAOneServerDown");
+    
+    ArrayList<String> args = new ArrayList<String>();
+    args.add(retryRegionName);
+    args.add("regionExecutionHAOneServerDown");
 
-      ResultCollector rs = execute(dataSet, testKeysSet, args,
-          function, isByName);
-      assertEquals(1, ((List)rs.getResult()).size());
-    } catch (Exception ex) {
-        ex.printStackTrace();
-        LogWriterUtils.getLogWriter().info("Exception : ", ex);
-        Assert.fail("Test failed after the execute operation", ex);
-    }
+    ResultCollector rs = execute(dataSet, testKeysSet, args,
+        function, isByName);
+    assertEquals(1, ((List)rs.getResult()).size());
   }
   
   public static void regionExecutionHATwoServerDown (Boolean isByName,
-      Function function, Boolean toRegister) {
+      Function function, Boolean toRegister) throws Exception {
 
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
@@ -512,19 +505,14 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
 
     region.put(testKey, new Integer(1));
-    try {
-      ArrayList<String> args = new ArrayList<String>();
-      args.add(retryRegionName);
-      args.add("regionExecutionHATwoServerDown");
 
-      ResultCollector rs = execute(dataSet, testKeysSet, args,
-          function, isByName);
-      assertEquals(1, ((List)rs.getResult()).size());
-    } catch (Exception ex) {
-        ex.printStackTrace();
-        LogWriterUtils.getLogWriter().info("Exception : ", ex);
-        fail("Test failed after the execute operation");
-    }
+    ArrayList<String> args = new ArrayList<String>();
+    args.add(retryRegionName);
+    args.add("regionExecutionHATwoServerDown");
+
+    ResultCollector rs = execute(dataSet, testKeysSet, args,
+        function, isByName);
+    assertEquals(1, ((List)rs.getResult()).size());
   }
   
   public static void createReplicatedRegion(){
@@ -544,21 +532,16 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
   
   public static void verifyMetaData(Integer arg1, Integer arg2) {
     
-    try {
-      if (arg1 == 0) {
-        assertNull(metaDataRegion.get("stopped"));
-      } else {
-        assertEquals(metaDataRegion.get("stopped"), arg1);
-      }
+    if (arg1 == 0) {
+      assertNull(metaDataRegion.get("stopped"));
+    } else {
+      assertEquals(metaDataRegion.get("stopped"), arg1);
+    }
 
-      if (arg2 == 0) {
-        assertNull(metaDataRegion.get("sentresult"));
-      } else {
-        assertEquals(metaDataRegion.get("sentresult"), arg2);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail("The metadata doesn't match with the expected value.");
+    if (arg2 == 0) {
+      assertNull(metaDataRegion.get("sentresult"));
+    } else {
+      assertEquals(metaDataRegion.get("sentresult"), arg2);
     }
   }
   
@@ -674,12 +657,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
         assertEquals(Boolean.TRUE, i.next());
       }
     }
-    catch (Exception e) {
-      LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
-      assertTrue(e instanceof EOFException || e instanceof SocketException
-          || e instanceof SocketTimeoutException
-          || e instanceof ServerException || e instanceof IOException
-          || e instanceof CacheClosedException);
+    catch (CacheClosedException e) {
+      // okay - ignore
     }
   }
   
@@ -751,7 +730,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     assertNotNull(entrySet);
   }
 
-  public static void serverMultiKeyExecutionOnASingleBucket(Boolean isByName) {
+  public static void serverMultiKeyExecutionOnASingleBucket(Boolean isByName) throws Exception
{
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final HashSet testKeysSet = new HashSet();
@@ -765,32 +744,25 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     }
     DistributedSystem.setThreadsSocketPolicy(false);
     for (Iterator kiter = testKeysSet.iterator(); kiter.hasNext();) {
-      try {
-        Set singleKeySet = Collections.singleton(kiter.next());
-        Function function = new TestFunction(true,TEST_FUNCTION2);
-        FunctionService.registerFunction(function);
-        Execution dataSet = FunctionService.onRegion(region);
-        ResultCollector rc1 = execute(dataSet, singleKeySet, Boolean.TRUE,  function, isByName);
-        List l = null;
-        l = ((List)rc1.getResult());
-        assertEquals(1, l.size());
-
-        ResultCollector rc2 =  execute(dataSet, singleKeySet, new HashSet(singleKeySet),

-            function, isByName);
-        List l2 = null;
-        l2 = ((List)rc2.getResult());
-        
-        assertEquals(1, l2.size());
-        List subList = (List)l2.iterator().next();
-        assertEquals(1, subList.size());
-        assertEquals(region.get(singleKeySet.iterator().next()), subList
-            .iterator().next());
-      }
-      catch (Exception expected) {
-        LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
-        expected.printStackTrace();
-        fail("Test failed after the put operation");
-      }
+      Set singleKeySet = Collections.singleton(kiter.next());
+      Function function = new TestFunction(true,TEST_FUNCTION2);
+      FunctionService.registerFunction(function);
+      Execution dataSet = FunctionService.onRegion(region);
+      ResultCollector rc1 = execute(dataSet, singleKeySet, Boolean.TRUE,  function, isByName);
+      List l = null;
+      l = ((List)rc1.getResult());
+      assertEquals(1, l.size());
+
+      ResultCollector rc2 =  execute(dataSet, singleKeySet, new HashSet(singleKeySet), 
+          function, isByName);
+      List l2 = null;
+      l2 = ((List)rc2.getResult());
+
+      assertEquals(1, l2.size());
+      List subList = (List)l2.iterator().next();
+      assertEquals(1, subList.size());
+      assertEquals(region.get(singleKeySet.iterator().next()), subList
+          .iterator().next());
     }
   }
   
@@ -965,7 +937,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     }
   }
   
-  public static void serverSingleKeyExecutionSocketTimeOut(Boolean isByName) {
+  public static void serverSingleKeyExecutionSocketTimeOut(Boolean isByName) throws Exception
{
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -978,20 +950,15 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
     
     region.put(testKey, new Integer(1));
-    try {
-      ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE,
-          function, isByName);
-      assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0));
 
-      ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function,
-          isByName);
-      assertEquals(testKey, ((List)rs2.getResult()).get(0));
+    ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE,
+        function, isByName);
+    assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0));
+
+    ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function,
+        isByName);
+    assertEquals(testKey, ((List)rs2.getResult()).get(0));
 
-    }catch (Exception ex) {
-      ex.printStackTrace();
-      LogWriterUtils.getLogWriter().info("Exception : " , ex);
-      Assert.fail("Test failed after the put operation",ex);
-    }
   }
   
   public static void serverMultiKeyExecution_Inline() {
@@ -1098,7 +1065,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
 
   }
   
-  public static void serverMultiKeyExecutionNoResult(Boolean isByName) {
+  public static void serverMultiKeyExecutionNoResult(Boolean isByName) throws Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final HashSet testKeysSet = new HashSet();
@@ -1127,9 +1094,6 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     } catch(FunctionException expected) {
       assertTrue(expected.getMessage().startsWith((LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE
           .toLocalizedString("return any"))));
-    }
-    catch (Exception notexpected) {
-      Assert.fail("Test failed during execute or sleeping", notexpected);
     } finally {
       cache.getLogger().info("<ExpectedException action=remove>" +
           "FunctionException" +
@@ -1160,7 +1124,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     assertEquals("KB_1", region.get(new Integer(1)));    
   }
   
-  public static void serverSingleKeyExecution(Boolean isByName, Boolean toRegister) {
+  public static void serverSingleKeyExecution(Boolean isByName, Boolean toRegister) throws
Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -1181,39 +1145,33 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     try {
       execute(dataSet, testKeysSet, Boolean.TRUE,  function, isByName);
     }
-    catch (Exception expected) {
-      assertTrue(expected.getMessage().contains(
-          "No target node found for KEY = " + testKey)
-          || expected.getMessage()
-              .startsWith("Server could not send the reply")
-          || expected.getMessage().startsWith("Unexpected exception during"));
+    catch (Exception ex) {
+      if ( ! (ex.getMessage().contains("No target node found for KEY = " + testKey)
+          || ex.getMessage().startsWith("Server could not send the reply")
+          || ex.getMessage().startsWith("Unexpected exception during")) ) {
+        throw ex;
+      }
     }
     region.put(testKey, new Integer(1));
-    try {
-      ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE,
-          function, isByName);
-      assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0));
-
-      ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function,
-          isByName);
-      assertEquals(new Integer(1), ((List)rs2.getResult()).get(0));
+    
+    ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE,
+        function, isByName);
+    assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0));
 
-      HashMap putData = new HashMap();
-      putData.put(testKey + "1", new Integer(2));
-      putData.put(testKey + "2", new Integer(3));
+    ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function,
+        isByName);
+    assertEquals(new Integer(1), ((List)rs2.getResult()).get(0));
 
-      ResultCollector rs1 = execute(dataSet, testKeysSet, putData, function,
-          isByName);
-      assertEquals(Boolean.TRUE, ((List)rs1.getResult()).get(0));
+    HashMap putData = new HashMap();
+    putData.put(testKey + "1", new Integer(2));
+    putData.put(testKey + "2", new Integer(3));
 
-      assertEquals(new Integer(2), region.get(testKey + "1"));
-      assertEquals(new Integer(3), region.get(testKey + "2"));
+    ResultCollector rs1 = execute(dataSet, testKeysSet, putData, function,
+        isByName);
+    assertEquals(Boolean.TRUE, ((List)rs1.getResult()).get(0));
 
-    }catch (Exception ex) {
-      ex.printStackTrace();
-      LogWriterUtils.getLogWriter().info("Exception : " , ex);
-      Assert.fail("Test failed after the put operation",ex);
-    }
+    assertEquals(new Integer(2), region.get(testKey + "1"));
+    assertEquals(new Integer(3), region.get(testKey + "2"));
   }
   
   public static void executeRegisteredFunction() {
@@ -1238,7 +1196,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
   }
   
   public static void serverSingleKeyExecution_SendException(Boolean isByName,
-      Boolean toRegister) {
+      Boolean toRegister) throws Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -1260,35 +1218,22 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
     region.put(testKey, new Integer(1));
     ResultCollector rs = null;
-    try {
-      rs = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName);
-      assertTrue(((List)rs.getResult()).get(0) instanceof MyFunctionExecutionException);
-    }
-    catch (Exception ex) {
-      ex.printStackTrace();
-      LogWriterUtils.getLogWriter().info("Exception : ", ex);
-      Assert.fail("Test failed after the put operation", ex);
-    }
+
+    rs = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName);
+    assertTrue(((List)rs.getResult()).get(0) instanceof MyFunctionExecutionException);
     
-    try {
-      rs = execute(dataSet, testKeysSet, (Serializable)testKeysSet, function, isByName);
-      List resultList = (List)rs.getResult();
-      assertEquals((testKeysSet.size()+1), resultList.size());
-      Iterator resultIterator = resultList.iterator();
-      int exceptionCount = 0;
-      while(resultIterator.hasNext()){
-        Object o = resultIterator.next();
-        if(o instanceof MyFunctionExecutionException){
-          exceptionCount++;
-        }
+    rs = execute(dataSet, testKeysSet, (Serializable)testKeysSet, function, isByName);
+    List resultList = (List)rs.getResult();
+    assertEquals((testKeysSet.size()+1), resultList.size());
+    Iterator resultIterator = resultList.iterator();
+    int exceptionCount = 0;
+    while(resultIterator.hasNext()){
+      Object o = resultIterator.next();
+      if(o instanceof MyFunctionExecutionException){
+        exceptionCount++;
       }
-      assertEquals(1, exceptionCount);
-    }
-    catch (Exception ex) {
-      ex.printStackTrace();
-      LogWriterUtils.getLogWriter().info("Exception : ", ex);
-      Assert.fail("Test failed after the put operation", ex);
     }
+    assertEquals(1, exceptionCount);
   }
   
   public static void serverSingleKeyExecution_ThrowException(Boolean isByName,
@@ -1319,8 +1264,6 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
       fail("Exception Expected");
     }
     catch (Exception ex) {
-      ex.printStackTrace();
-      assertTrue(ex instanceof Exception);
     }
   }
   
@@ -1342,15 +1285,9 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     
     Execution dataSet1 = FunctionService.onRegion(region1);
     region1.put(testKey, new Integer(1));
-    try {
-      ResultCollector rs = dataSet1.execute(function.getId());
-      assertEquals(Boolean.FALSE, ((List)rs.getResult()).get(0));
 
-    }catch (Exception ex) {
-      ex.printStackTrace();
-      LogWriterUtils.getLogWriter().info("Exception : " , ex);
-      Assert.fail("Test failed after the put operation",ex);
-    }
+    ResultCollector rs = dataSet1.execute(function.getId());
+    assertEquals(Boolean.FALSE, ((List)rs.getResult()).get(0));
     
     Region region2 = cache.getRegion(PartitionedRegionName+"2");
     assertNotNull(region2);
@@ -1358,15 +1295,17 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     Execution dataSet2 = FunctionService.onRegion(region2);
     region2.put(testKey, new Integer(1));
     try {
-      ResultCollector rs = dataSet2.execute(function.getId());
+      rs = dataSet2.execute(function.getId());
       assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0));
       fail("Expected FunctionException");
-    }catch (Exception ex) {
-      assertTrue(ex.getMessage().startsWith("No Replicated Region found for executing function"));
+    } catch (Exception ex) {
+      if (!ex.getMessage().startsWith("No Replicated Region found for executing function"))
{
+        throw ex;
+      }
     }
   }
   
-  public static void serverSingleKeyExecution_NoLastResult(Boolean isByName, Boolean toRegister)
{
+  public static void serverSingleKeyExecution_NoLastResult(Boolean isByName, Boolean toRegister)
throws Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -1391,14 +1330,15 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
           function, isByName);
       assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0));
       fail("Expected FunctionException : Function did not send last result");
-    }catch (Exception ex) {
-      assertTrue(ex.getMessage().contains(
-          "did not send last result"));
+    } catch (Exception ex) {
+      if ( !ex.getMessage().contains("did not send last result")) {
+        throw ex;
+      }
       
     }
   }
   
-  public static void serverSingleKeyExecution_FunctionInvocationTargetException() {
+  public static void serverSingleKeyExecution_FunctionInvocationTargetException() throws
Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -1412,19 +1352,14 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
 
     region.put(testKey, new Integer(1));
-    try {
-      ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE,
-          function, false);
-      ArrayList list = (ArrayList)rs.getResult();
-      assertTrue(((Integer)list.get(0)) >= 5);
-    }
-    catch (Exception ex) {
-      ex.printStackTrace();
-      Assert.fail("This is not expected Exception", ex);
-    }
+
+    ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE,
+        function, false);
+    ArrayList list = (ArrayList)rs.getResult();
+    assertTrue(((Integer)list.get(0)) >= 5);
   }
   
-  public static void serverSingleKeyExecution_Inline() {
+  public static void serverSingleKeyExecution_Inline() throws Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final String testKey = "execKey";
@@ -1459,13 +1394,12 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
         }
       });
     }
-    catch (Exception expected) {
-      LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
-      assertTrue(expected.getMessage().contains(
-          "No target node found for KEY = " + testKey)
-          || expected.getMessage()
-              .startsWith("Server could not send the reply")
-          || expected.getMessage().startsWith("Unexpected exception during"));
+    catch (Exception ex) {
+      if ( ! (ex.getMessage().contains("No target node found for KEY = " + testKey)
+           || ex.getMessage().startsWith("Server could not send the reply")
+           || ex.getMessage().startsWith("Unexpected exception during")) ) {
+        throw ex;
+      }
     } finally {
       cache.getLogger().info("<ExpectedException action=remove>" +
           "No target node found for KEY = " + 
@@ -1475,56 +1409,51 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
     }
     
     region.put(testKey, new Integer(1));
-    try {
-      ResultCollector rs = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new
FunctionAdapter(){
-        @Override
-        public void execute(FunctionContext context) {
-          if (context.getArguments() instanceof String) {
-            context.getResultSender().lastResult( "Success");
-          }else{
-            context.getResultSender().lastResult( "Failure");
-          }
-        }
 
-        @Override
-        public String getId() {
-          return getClass().getName();
+    ResultCollector rs = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new
FunctionAdapter(){
+      @Override
+      public void execute(FunctionContext context) {
+        if (context.getArguments() instanceof String) {
+          context.getResultSender().lastResult( "Success");
+        }else{
+          context.getResultSender().lastResult( "Failure");
         }
+      }
 
-        @Override
-        public boolean hasResult() {
-          return true;
-        }
-      });
-      assertEquals("Failure", ((List)rs.getResult()).get(0));
+      @Override
+      public String getId() {
+        return getClass().getName();
+      }
 
-      ResultCollector rs2 = dataSet.withFilter(testKeysSet).withArgs(testKey).execute(new
FunctionAdapter(){
-        @Override
-        public void execute(FunctionContext context) {
-          if (context.getArguments() instanceof String) {
-            context.getResultSender().lastResult( "Success");
-          }else{
-            context.getResultSender().lastResult( "Failure");
-          }
-        }
+      @Override
+      public boolean hasResult() {
+        return true;
+      }
+    });
+    assertEquals("Failure", ((List)rs.getResult()).get(0));
 
-        @Override
-        public String getId() {
-          return getClass().getName();
+    ResultCollector rs2 = dataSet.withFilter(testKeysSet).withArgs(testKey).execute(new FunctionAdapter(){
+      @Override
+      public void execute(FunctionContext context) {
+        if (context.getArguments() instanceof String) {
+          context.getResultSender().lastResult( "Success");
+        }else{
+          context.getResultSender().lastResult( "Failure");
         }
+      }
 
-        @Override
-        public boolean hasResult() {
-          return true;
-        }
-      });
-      assertEquals("Success", ((List)rs2.getResult()).get(0));
+      @Override
+      public String getId() {
+        return getClass().getName();
+      }
+
+      @Override
+      public boolean hasResult() {
+        return true;
+      }
+    });
+    assertEquals("Success", ((List)rs2.getResult()).get(0));
 
-    }catch (Exception ex) {
-      ex.printStackTrace();
-      LogWriterUtils.getLogWriter().info("Exception : " , ex);
-      Assert.fail("Test failed after the put operation",ex);
-    }
   }
   
   
@@ -1578,9 +1507,10 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends
PRClientServ
       });
     }
     catch (Exception expected) {
-      LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
-      assertTrue(expected.getCause().getMessage().contains(
-          "Could not create an instance of  com.gemstone.gemfire.internal.cache.execute.PRClientServerRegionFunctionExecutionDUnitTest$UnDeserializable"));
+      if (!expected.getCause().getMessage().contains(
+          "Could not create an instance of  com.gemstone.gemfire.internal.cache.execute.PRClientServerRegionFunctionExecutionDUnitTest$UnDeserializable"))
{
+        throw expected;
+      };
     } finally {
       cache.getLogger().info("<ExpectedException action=remove>" +
           "Could not create an instance of  com.gemstone.gemfire.internal.cache.execute.PRClientServerRegionFunctionExecutionDUnitTest$UnDeserializable"
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f1ff67cb/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
index d139bbf..c3cc81a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
@@ -152,7 +152,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
     client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.registerFunction());
     client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.FunctionExecution_Inline_Bug40714());
   }
-
+  
   public void testOnRegionFailoverWithTwoServerDownHA()
       throws InterruptedException {
     IgnoredException.addIgnoredException("FunctionInvocationTargetException");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f1ff67cb/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
index 88d0222..d69595a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
@@ -165,7 +165,7 @@ public class PRClientServerTestBase extends CacheTestCase {
     return new Integer(server1.getPort());
   }
   
-  public static Integer createSelectorCacheServer(ArrayList commonAttributes, Integer localMaxMemory)
{
+  public static Integer createSelectorCacheServer(ArrayList commonAttributes, Integer localMaxMemory)
throws Exception {
     AttributesFactory factory = new AttributesFactory();
     PartitionAttributesFactory paf = new PartitionAttributesFactory();
     
@@ -186,18 +186,14 @@ public class PRClientServerTestBase extends CacheTestCase {
     int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     server1.setPort(port);
     server1.setMaxThreads(16);
-    try {
-      server1.start();
-    }
-    catch (IOException e) {
-      Assert.fail("Failed to start the Server", e);
-    }
+    server1.start();
     assertTrue(server1.isRunning());
 
     return new Integer(server1.getPort());
   }
 
-  public static Integer createCacheServerWith2Regions(ArrayList commonAttributes, Integer
localMaxMemory) {
+  public static Integer createCacheServerWith2Regions(ArrayList commonAttributes, Integer
localMaxMemory)
+  throws Exception {
     AttributesFactory factory = new AttributesFactory();
     PartitionAttributesFactory paf = new PartitionAttributesFactory();
     
@@ -219,33 +215,23 @@ public class PRClientServerTestBase extends CacheTestCase {
     assertNotNull(server1);
     int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     server1.setPort(port);
-    try {
-      server1.start();
-    }
-    catch (IOException e) {
-      Assert.fail("Failed to start the Server", e);
-    }
+    server1.start();
     assertTrue(server1.isRunning());
 
     return new Integer(server1.getPort());
   }
-  public static Integer createCacheServer() {
+  public static Integer createCacheServer() throws Exception {
     CacheServer server1 = cache.addCacheServer();
     assertNotNull(server1);
     int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     server1.setPort(port);
-    try {
-      server1.start();
-    }
-    catch (IOException e) {
-      Assert.fail("Failed to start the Server", e);
-    }
+    server1.start();
     assertTrue(server1.isRunning());
 
     return new Integer(server1.getPort());
   }
   
-  public static Integer createCacheServerWithDR() {
+  public static Integer createCacheServerWithDR() throws Exception {
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -257,12 +243,7 @@ public class PRClientServerTestBase extends CacheTestCase {
     assertNotNull(server1);
     int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     server1.setPort(port);
-    try {
-      server1.start();
-    }       
-    catch (IOException e) {
-      Assert.fail("Failed to start the Server", e);
-    }
+    server1.start();
     assertTrue(server1.isRunning());
 
     return new Integer(server1.getPort());
@@ -633,7 +614,7 @@ public class PRClientServerTestBase extends CacheTestCase {
     }
   }
 
-  public static void startServerHA() {
+  public static void startServerHA() throws Exception {
     WaitCriterion wc = new WaitCriterion() {
       String excuse;
 
@@ -652,15 +633,10 @@ public class PRClientServerTestBase extends CacheTestCase {
     Iterator bridgeIterator = bridgeServers.iterator();
     CacheServer bridgeServer = (CacheServer)bridgeIterator.next();
     LogWriterUtils.getLogWriter().info("start Server Bridge Server" + bridgeServer);
-    try {
-      bridgeServer.start();
-    }
-    catch (IOException e) {
-      fail("not able to start the server");
-    }
+    bridgeServer.start();
   }  
   
-  public static void stopServerHA() {
+  public static void stopServerHA() throws Exception {
     WaitCriterion wc = new WaitCriterion() {
       String excuse;
 
@@ -673,15 +649,10 @@ public class PRClientServerTestBase extends CacheTestCase {
       }
     };
     Wait.waitForCriterion(wc, 1000, 200, false);
-    try {
-      Iterator iter = cache.getCacheServers().iterator();
-      if (iter.hasNext()) {
-        CacheServer server = (CacheServer)iter.next();
-        server.stop();
-      }
-    }
-    catch (Exception e) {
-      fail("failed while stopServer()" + e);
+    Iterator iter = cache.getCacheServers().iterator();
+    if (iter.hasNext()) {
+      CacheServer server = (CacheServer)iter.next();
+      server.stop();
     }
   }  
   
@@ -719,7 +690,7 @@ public class PRClientServerTestBase extends CacheTestCase {
     }
   }
   
-  public static void serverBucketFilterExecution(Set<Integer> bucketFilterSet) {
+  public static void serverBucketFilterExecution(Set<Integer> bucketFilterSet) throws
Exception {
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
     final HashSet testKeysSet = new HashSet();
@@ -730,35 +701,27 @@ public class PRClientServerTestBase extends CacheTestCase {
     Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_BUCKET_FILTER);
     FunctionService.registerFunction(function);
     InternalExecution dataSet = (InternalExecution) FunctionService.onRegion(region);
-    try {
-      int j = 0;
-      HashSet origVals = new HashSet();
-      for (Iterator i = testKeysSet.iterator(); i.hasNext();) {
-        Integer val = new Integer(j++);
-        origVals.add(val);
-        region.put(i.next(), val);
-      }
-      
-      List l = null;
-      ResultCollector<Integer, List<Integer>> rc =  (ResultCollector<Integer,
List<Integer>>)dataSet.
-          withBucketFilter(bucketFilterSet).execute(function.getId());
-      List<Integer> results = rc.getResult();
-      assertEquals(bucketFilterSet.size(), results.size());
-      for(Integer bucket: results) {
-        bucketFilterSet.remove(bucket) ; 
-      }
-      assertTrue(bucketFilterSet.isEmpty());
+    int j = 0;
+    HashSet origVals = new HashSet();
+    for (Iterator i = testKeysSet.iterator(); i.hasNext();) {
+      Integer val = new Integer(j++);
+      origVals.add(val);
+      region.put(i.next(), val);
+    }
 
-     
-      
-    }catch(Exception e){
-      Assert.fail("Test failed ", e);
-      
+    List l = null;
+    ResultCollector<Integer, List<Integer>> rc =  (ResultCollector<Integer,
List<Integer>>)dataSet.
+        withBucketFilter(bucketFilterSet).execute(function.getId());
+    List<Integer> results = rc.getResult();
+    assertEquals(bucketFilterSet.size(), results.size());
+    for(Integer bucket: results) {
+      bucketFilterSet.remove(bucket) ; 
     }
+    assertTrue(bucketFilterSet.isEmpty());
   }
   
   public static void serverBucketFilterOverrideExecution(Set<Integer> bucketFilterSet,
-      Set<Integer> ketFilterSet) {
+      Set<Integer> ketFilterSet) throws Exception {
 
     Region region = cache.getRegion(PartitionedRegionName);
     assertNotNull(region);
@@ -774,29 +737,23 @@ public class PRClientServerTestBase extends CacheTestCase {
     for(Integer key : ketFilterSet) {
       expectedBucketSet.add(BucketFilterPRResolver.getBucketID(key));
     }
-    try {
-      int j = 0;
-      HashSet origVals = new HashSet();
-      for (Iterator i = testKeysSet.iterator(); i.hasNext();) {
-        Integer val = new Integer(j++);
-        origVals.add(val);
-        region.put(i.next(), val);
-      }
-      
-      List l = null;
-      ResultCollector<Integer, List<Integer>> rc =  (ResultCollector<Integer,
List<Integer>>)dataSet.
-          withBucketFilter(bucketFilterSet).withFilter(ketFilterSet).execute(function.getId());
-      List<Integer> results = rc.getResult();
-      assertEquals(expectedBucketSet.size(), results.size());
-      for(Integer bucket: results) {
-        expectedBucketSet.remove(bucket) ; 
-      }
-      assertTrue(expectedBucketSet.isEmpty());
-    }catch(Exception e){
-      Assert.fail("Test failed ", e);
-      
+    int j = 0;
+    HashSet origVals = new HashSet();
+    for (Iterator i = testKeysSet.iterator(); i.hasNext();) {
+      Integer val = new Integer(j++);
+      origVals.add(val);
+      region.put(i.next(), val);
     }
-  
+
+    List l = null;
+    ResultCollector<Integer, List<Integer>> rc =  (ResultCollector<Integer,
List<Integer>>)dataSet.
+        withBucketFilter(bucketFilterSet).withFilter(ketFilterSet).execute(function.getId());
+    List<Integer> results = rc.getResult();
+    assertEquals(expectedBucketSet.size(), results.size());
+    for(Integer bucket: results) {
+      expectedBucketSet.remove(bucket) ; 
+    }
+    assertTrue(expectedBucketSet.isEmpty());
   }
   
   public static class BucketFilterPRResolver implements PartitionResolver, Serializable {
   



Mime
View raw message