You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2015/10/23 00:31:58 UTC

incubator-geode git commit: [GEODE-140]: QueryUsingFunctionContextDUnitTest.testQueriesWithFilterKeysOnPRWithRebalancing failed due to suspect string Test was failing due to server being down before function executes This is "expected" as it can occur ba

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-409 b49025701 -> e87e3b7fc


[GEODE-140]: QueryUsingFunctionContextDUnitTest.testQueriesWithFilterKeysOnPRWithRebalancing failed due to suspect string
Test was failing due to server being down before function executes
This is "expected" as it can occur based on this test.


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

Branch: refs/heads/feature/GEODE-409
Commit: e87e3b7fc93a6da74ff077291c354c5b4d6685db
Parents: b490257
Author: Jason Huynh <hu...@gmail.com>
Authored: Tue Oct 20 10:55:57 2015 -0700
Committer: Jason Huynh <hu...@gmail.com>
Committed: Thu Oct 22 15:35:49 2015 -0700

----------------------------------------------------------------------
 .../QueryUsingFunctionContextDUnitTest.java     | 25 +++++++++++++-------
 .../query/functional/StructSetOrResultsSet.java |  4 ++--
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e87e3b7f/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
index 6ed01a2..22fe767 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
@@ -26,6 +26,7 @@ import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.ServerConnectivityException;
 import com.gemstone.gemfire.cache.execute.Function;
 import com.gemstone.gemfire.cache.execute.FunctionAdapter;
 import com.gemstone.gemfire.cache.execute.FunctionContext;
@@ -34,7 +35,6 @@ import com.gemstone.gemfire.cache.execute.FunctionService;
 import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
 import com.gemstone.gemfire.cache.execute.ResultCollector;
 import com.gemstone.gemfire.cache.query.Query;
-import com.gemstone.gemfire.cache.query.QueryInvalidException;
 import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
 import com.gemstone.gemfire.cache.query.QueryService;
 import com.gemstone.gemfire.cache.query.SelectResults;
@@ -430,8 +430,9 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
  public void testQueriesWithFilterKeysOnPRWithRebalancing() {
    addExpectedException("QueryInvocationTargetException");
    addExpectedException("java.net.SocketException");
-   Object[][] r = new Object[queries.length][2];
-   Set filter =  new HashSet();
+   addExpectedException("ServerConnectivityException");
+   addExpectedException("FunctionException");
+   addExpectedException("IOException");
 
    // Close cache on server1
    server1.invoke(new CacheSerializableRunnable("Set QueryObserver in cache on server1") {
@@ -478,9 +479,16 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
            //Should not come here, an exception is expected from above function call.
            fail("Function call did not fail for query with function context");
          } catch (FunctionException ex) {
-           //ex.printStackTrace();
-           if (!(ex.getCause() instanceof QueryInvocationTargetException)) {
-             fail("Should have received an QueryInvocationTargetException but recieved"+ex.getMessage());
+           if (!((ex.getCause() instanceof QueryInvocationTargetException) || (ex.getCause() instanceof ServerConnectivityException))) {
+             if (ex.getCause() instanceof FunctionException) {
+               FunctionException fe = (FunctionException)ex.getCause();
+               if (!fe.getMessage().startsWith("IOException")) {
+                 fail("Should have received an QueryInvocationTargetException but recieved"+ex.getMessage());
+               }
+             }
+             else {
+               fail("Should have received an QueryInvocationTargetException but recieved"+ex.getMessage());
+             }
            }
          }
        }//For loop ends here.
@@ -497,9 +505,8 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
 
  }
 
- // DISABLED due to high rate of failure in unit test runs.
- // See internal ticket #52270
- public void disabledtestNonColocatedRegionQueries() {
+ 
+ public void testNonColocatedRegionQueries() {
    addExpectedException("UnsupportedOperationException");
    client.invoke(new CacheSerializableRunnable("Test query on non-colocated regions on server") {
      @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e87e3b7f/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/StructSetOrResultsSet.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/StructSetOrResultsSet.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/StructSetOrResultsSet.java
index 7f3e14d..c4e6f8f 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/StructSetOrResultsSet.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/StructSetOrResultsSet.java
@@ -368,8 +368,8 @@ public class StructSetOrResultsSet extends TestCase {
   private void checkResultSizes(Collection r1, Collection r2, String query) {
     if (r1.size() != r2.size()) {
       fail("FAILED:SelectResults size is different in both the cases. Size1="
-          + ((SelectResults) r1).size() + " Size2 = "
-          + ((SelectResults) r2).size() + "; failed query=" + query);
+          + r1.size() + " Size2 = "
+          + r2.size() + "; failed query=" + query);
     }
   }