You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/04/14 02:36:51 UTC
incubator-geode git commit: Fix dunit failures
Repository: incubator-geode
Updated Branches:
refs/heads/feature/GEODE-1162 aece5de3c -> d9344e0a7
Fix dunit failures
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/d9344e0a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d9344e0a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d9344e0a
Branch: refs/heads/feature/GEODE-1162
Commit: d9344e0a7c3b014969e95aba783ad7463e7df1ae
Parents: aece5de
Author: Kirk Lund <kl...@apache.org>
Authored: Wed Apr 13 17:36:23 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed Apr 13 17:36:23 2016 -0700
----------------------------------------------------------------------
.../gemfire/internal/lang/ThrowableUtils.java | 101 ++++++++
.../query/dunit/SelectStarQueryDUnitTest.java | 216 +++++++++--------
.../gemfire/cache30/MultiVMRegionTestCase.java | 13 +-
.../cache/partitioned/ShutdownAllDUnitTest.java | 10 +-
.../PersistentRecoveryOrderDUnitTest.java | 6 +-
.../internal/lang/ThrowableUtilsTest.java | 242 +++++++++++++++++++
.../com/gemstone/gemfire/test/dunit/VM.java | 26 +-
7 files changed, 477 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/main/java/com/gemstone/gemfire/internal/lang/ThrowableUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/lang/ThrowableUtils.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/lang/ThrowableUtils.java
new file mode 100644
index 0000000..eb3188b
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/lang/ThrowableUtils.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.lang;
+
+/**
+ * The ThrowableUtils class is an abstract utility class for working with {@code Throwable}s.
+ * <p/>
+ * @see java.lang.Throwable
+ */
+public abstract class ThrowableUtils {
+
+ /**
+ * Get the root cause of a {@link Throwable}. Returns the specified
+ * {@code throwable} if its {@code getCause} returns null.
+ *
+ * @param throwable the {@code Throwable} to get the root cause of.
+ * @return the root cause of the specified {@code throwable}.
+ *
+ * @throws NullPointerException if {@code throwable} is null
+ */
+ public static Throwable getRootCause(Throwable throwable) {
+ if (throwable.getCause() == null) {
+ return throwable;
+ }
+
+ Throwable cause;
+ while ((cause = throwable.getCause()) != null) {
+ throwable = cause;
+ }
+ return throwable;
+ }
+
+ /**
+ * Returns true if the {@link Throwable} or any of its causes as returned
+ * by {@code getCause()} are an instance of the specified subclass of
+ * {@code Throwable}.
+ *
+ * @param throwable the {@code Throwable} to check the causes of.
+ * @param causeClass the subclass of {@code Throwable} to check for.
+ * @return true if any cause of {@code throwable} is an instance of
+ * {@code causeClass}.
+ *
+ * @throws NullPointerException if {@code throwable} is null
+ */
+ public static boolean hasCauseType(Throwable throwable, Class<? extends Throwable> causeClass) {
+ if (causeClass.isInstance(throwable)) {
+ return true;
+ }
+
+ Throwable cause;
+ while ((cause = throwable.getCause()) != null) {
+ throwable = cause;
+ if (causeClass.isInstance(throwable)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns true if the {@link Throwable} or any of its causes contain the
+ * specified {@code message}.
+ *
+ * @param throwable the {@code Throwable} to check the causes of.
+ * @param message the {@code Throwable} message to check for.
+ * @return true if any cause of {@code throwable} contains the specified
+ * {@code message}.
+ *
+ * @throws NullPointerException if {@code throwable} is null
+ */
+ public static boolean hasCauseMessage(Throwable throwable, String message) {
+ if (throwable.getMessage().contains(message)) {
+ return true;
+ }
+
+ Throwable cause;
+ while ((cause = throwable.getCause()) != null) {
+ throwable = cause;
+ if (throwable.getMessage().contains(message)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
index b92426a..11b76de 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
@@ -14,11 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.cache.query.dunit;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Invoke.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
+
import java.io.Serializable;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.client.ClientCache;
@@ -35,28 +42,25 @@ import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.cache.query.internal.StructImpl;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
import com.gemstone.gemfire.pdx.PdxInstance;
-import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Test for #44807 to eliminate unnecessary serialization/deserialization in
* select * queries
- *
- *
*/
-public class SelectStarQueryDUnitTest extends CacheTestCase {
- public SelectStarQueryDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class SelectStarQueryDUnitTest extends JUnit4CacheTestCase {
+
+ /** Used for saving & restoring oldObserver without serialization */
+ private static volatile QueryObserver oldObserver;
private final String regName = "exampleRegion";
private final String regName2 = "exampleRegion2";
@@ -87,6 +91,12 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
+ regName2 + " q, q.positions.values pos", };
private final int[] resultSize2 = { 400, 5, 400, 400, 1, 400, 400, 400, 1600 };
+ @Override
+ public final void preTearDownCacheTestCase() throws Exception {
+ invokeInEveryVM(() -> oldObserver = null);
+ }
+
+ @Test
public void testSelectStarQueryForPartitionedRegion() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -103,13 +113,11 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
final int port2 = startPartitionedCacheServer(server2, portfolios);
final int port3 = startPartitionedCacheServer(server3, portfolios);
- final QueryObserver oldObserver = (QueryObserver) server1
- .invoke(new SerializableCallable("Set observer") {
+ server1.invoke(new SerializableCallable("Set observer") {
@Override
public Object call() throws Exception {
- QueryObserver observer = QueryObserverHolder
- .setInstance(new QueryResultTrackingObserver());
- return observer;
+ oldObserver = QueryObserverHolder.setInstance(new QueryResultTrackingObserver());
+ return null;
}
});
@@ -118,9 +126,9 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port1);
- cf.addPoolServer(NetworkUtils.getServerHostName(server2.getHost()), port2);
- cf.addPoolServer(NetworkUtils.getServerHostName(server3.getHost()), port3);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(getServerHostName(server2.getHost()), port2);
+ cf.addPoolServer(getServerHostName(server3.getHost()), port3);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -144,14 +152,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults[][] sr = new SelectResults[1][2];
SelectResults res = null;
@@ -163,7 +171,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -217,14 +225,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < queries.length; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -268,6 +276,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
closeCache(server3);
}
+ @Test
public void testSelectStarQueryForReplicatedRegion() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(1);
@@ -275,13 +284,11 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
// create servers and regions
final int port1 = startReplicatedCacheServer(server1);
- final QueryObserver oldObserver = (QueryObserver) server1
- .invoke(new SerializableCallable("Set observer") {
+ server1.invoke(new SerializableCallable("Set observer") {
@Override
public Object call() throws Exception {
- QueryObserver observer = QueryObserverHolder
- .setInstance(new QueryResultTrackingObserver());
- return observer;
+ oldObserver = QueryObserverHolder.setInstance(new QueryResultTrackingObserver());
+ return null;
}
});
@@ -290,7 +297,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -318,14 +325,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -340,7 +347,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + multipleRegionQueries[i], e);
+ fail("Error executing query: " + multipleRegionQueries[i], e);
}
assertEquals(resultSize2[i], res.size());
if (i == 4) {
@@ -397,7 +404,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < multipleRegionQueries.length; i++) {
@@ -405,7 +412,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
res = (SelectResults) qs.newQuery(multipleRegionQueries[i])
.execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + multipleRegionQueries[i], e);
+ fail("Error executing query: " + multipleRegionQueries[i], e);
}
assertEquals(resultSize2[i], res.size());
if (i == 4) {
@@ -450,6 +457,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
closeCache(server1);
}
+ @Test
public void testByteArrayReplicatedRegion() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -475,13 +483,11 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
}
});
- final QueryObserver oldObserver = (QueryObserver) server1
- .invoke(new SerializableCallable("Set observer") {
+ server1.invoke(new SerializableCallable("Set observer") {
@Override
public Object call() throws Exception {
- QueryObserver observer = QueryObserverHolder
- .setInstance(new QueryResultTrackingObserver());
- return observer;
+ oldObserver = QueryObserverHolder.setInstance(new QueryResultTrackingObserver());
+ return null;
}
});
@@ -490,7 +496,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -514,14 +520,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -534,7 +540,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -585,14 +591,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < 6; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -631,6 +637,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
closeCache(server1);
}
+ @Test
public void testByteArrayPartitionedRegion() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -648,13 +655,11 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
final int port2 = startPartitionedCacheServer(server2, objs);
final int port3 = startPartitionedCacheServer(server3, objs);
- final QueryObserver oldObserver = (QueryObserver) server1
- .invoke(new SerializableCallable("Set observer") {
+ server1.invoke(new SerializableCallable("Set observer") {
@Override
public Object call() throws Exception {
- QueryObserver observer = QueryObserverHolder
- .setInstance(new QueryResultTrackingObserver());
- return observer;
+ oldObserver = QueryObserverHolder.setInstance(new QueryResultTrackingObserver());
+ return null;
}
});
@@ -663,9 +668,9 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port1);
- cf.addPoolServer(NetworkUtils.getServerHostName(server2.getHost()), port2);
- cf.addPoolServer(NetworkUtils.getServerHostName(server3.getHost()), port3);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(getServerHostName(server2.getHost()), port2);
+ cf.addPoolServer(getServerHostName(server3.getHost()), port3);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -689,14 +694,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -709,7 +714,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -760,14 +765,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < 6; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -808,6 +813,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
}
+ @Test
public void testSelectStarQueryForIndexes() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -819,7 +825,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -852,7 +858,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
qs = getCache().getQueryService();
qs.createIndex("status", "status", "/" + regName);
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
return null;
@@ -863,14 +869,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -885,7 +891,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + multipleRegionQueries[i], e);
+ fail("Error executing query: " + multipleRegionQueries[i], e);
}
assertEquals(resultSize2[i], res.size());
if (i == 4) {
@@ -928,7 +934,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
qs = getCache().getQueryService();
qs.createIndex("status", "status", "/" + regName2);
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
return null;
@@ -939,14 +945,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -961,7 +967,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + multipleRegionQueries[i], e);
+ fail("Error executing query: " + multipleRegionQueries[i], e);
}
assertEquals(resultSize2[i], res.size());
if (i == 4) {
@@ -999,6 +1005,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
closeCache(server1);
}
+ @Test
public void testSelectStarQueryForPdxObjects() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -1006,13 +1013,11 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
// create servers and regions
final int port1 = startReplicatedCacheServer(server1);
- final QueryObserver oldObserver = (QueryObserver) server1
- .invoke(new SerializableCallable("Set observer") {
+ server1.invoke(new SerializableCallable("Set observer") {
@Override
public Object call() throws Exception {
- QueryObserver observer = QueryObserverHolder
- .setInstance(new QueryResultTrackingObserver());
- return observer;
+ oldObserver = QueryObserverHolder.setInstance(new QueryResultTrackingObserver());
+ return null;
}
});
@@ -1021,7 +1026,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -1045,14 +1050,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -1065,7 +1070,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1120,14 +1125,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < queries.length; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1176,14 +1181,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < queries.length; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1219,6 +1224,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
closeCache(server1);
}
+ @Test
public void testSelectStarQueryForPdxAndNonPdxObjects() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -1227,13 +1233,11 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
// put domain objects
final int port1 = startReplicatedCacheServer(server1);
- final QueryObserver oldObserver = (QueryObserver) server1
- .invoke(new SerializableCallable("Set observer") {
+ server1.invoke(new SerializableCallable("Set observer") {
@Override
public Object call() throws Exception {
- QueryObserver observer = QueryObserverHolder
- .setInstance(new QueryResultTrackingObserver());
- return observer;
+ oldObserver = QueryObserverHolder.setInstance(new QueryResultTrackingObserver());
+ return null;
}
});
@@ -1242,7 +1246,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -1266,14 +1270,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -1286,7 +1290,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1343,14 +1347,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < queries.length; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1399,14 +1403,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
try {
qs = getCache().getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
for (int i = 0; i < queries.length; i++) {
try {
res = (SelectResults) qs.newQuery(queries[i]).execute();
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1443,8 +1447,8 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
closeCache(server1);
}
- public void testSelectStarQueryForPdxObjectsReadSerializedTrue()
- throws Exception {
+ @Test
+ public void testSelectStarQueryForPdxObjectsReadSerializedTrue() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
final VM client = host.getVM(3);
@@ -1469,7 +1473,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(NetworkUtils.getServerHostName(server1.getHost()), port);
+ cf.addPoolServer(getServerHostName(server1.getHost()), port);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -1485,14 +1489,14 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- LogWriterUtils.getLogWriter().info("Querying remotely from client");
+ getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
localQS = ((ClientCache) getCache()).getLocalQueryService();
remoteQS = ((ClientCache) getCache()).getQueryService();
} catch (Exception e) {
- Assert.fail("Exception getting query service ", e);
+ fail("Exception getting query service ", e);
}
SelectResults res = null;
SelectResults[][] sr = new SelectResults[1][2];
@@ -1505,7 +1509,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
sr[0][1] = res;
CacheUtils.compareResultsOfWithAndWithoutIndex(sr);
} catch (Exception e) {
- Assert.fail("Error executing query: " + queries[i], e);
+ fail("Error executing query: " + queries[i], e);
}
assertEquals(resultSize[i], res.size());
if (i == 3) {
@@ -1597,17 +1601,17 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
});
}
- public class QueryResultTrackingObserver extends QueryObserverAdapter
- implements Serializable{
+ public class QueryResultTrackingObserver extends QueryObserverAdapter implements Serializable {
+
private boolean isObjectSerialized = false;
+
@Override
- public void beforeIterationEvaluation(CompiledValue executer,
- Object currentObject) {
+ public void beforeIterationEvaluation(CompiledValue executer, Object currentObject) {
if (currentObject instanceof VMCachedDeserializable) {
- LogWriterUtils.getLogWriter().fine("currentObject is serialized object");
+ getLogWriter().fine("currentObject is serialized object");
isObjectSerialized = true;
} else {
- LogWriterUtils.getLogWriter().fine("currentObject is deserialized object");
+ getLogWriter().fine("currentObject is deserialized object");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
index 8f4740c..68e50bd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache30;
+import static com.gemstone.gemfire.internal.lang.ThrowableUtils.*;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
@@ -9047,16 +9049,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
try {
async.getResult();
} catch (Throwable e) {
- if (e.getCause() instanceof RMIException) {
- Throwable e2 = e.getCause();
- if (e2.getCause() instanceof AssertionFailedError &&
- e2.getCause().getMessage().equals(expectedError)) {
- failed=true;
- }
- }
- if (!failed) {
- com.gemstone.gemfire.test.dunit.Assert.fail("asyncInvocation 0 returned exception", e);
- }
+ assertTrue(hasCauseMessage(e, expectedError));
}
return failed;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
index a1ba6d2..426d0ca 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+import static com.gemstone.gemfire.internal.lang.ThrowableUtils.getRootCause;
+
import java.io.IOException;
import java.util.Set;
import java.util.TreeSet;
@@ -556,12 +558,8 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
try {
a0.getResult(MAX_WAIT);
fail("should have received a cache closed exception");
- } catch(Exception e) {
- if(!(e.getCause() instanceof RMIException)) {
- throw e;
- }
- RMIException cause = (RMIException) e.getCause();
- if(!(cause.getCause() instanceof CacheClosedException)) {
+ } catch(AssertionError e) {
+ if(!CacheClosedException.class.isInstance(getRootCause(e))) {
throw e;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
index 321fffe..4f0fcca 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache.persistence;
+import static com.gemstone.gemfire.internal.lang.ThrowableUtils.*;
+
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
@@ -1317,8 +1319,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
try {
async1.getResult();
fail("Should have seen a CacheClosedException");
- } catch (Exception e) {
- if (! (e.getCause().getCause() instanceof CacheClosedException)) {
+ } catch (AssertionError e) {
+ if (!CacheClosedException.class.isInstance(getRootCause(e))) {
throw e;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/test/java/com/gemstone/gemfire/internal/lang/ThrowableUtilsTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/lang/ThrowableUtilsTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/lang/ThrowableUtilsTest.java
new file mode 100644
index 0000000..08feb63
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/lang/ThrowableUtilsTest.java
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.lang;
+
+import static org.assertj.core.api.Assertions.*;
+import static com.googlecode.catchexception.CatchException.*;
+import static com.googlecode.catchexception.CatchException.caughtException;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link ThrowableUtils}
+ */
+@Category(UnitTest.class)
+public class ThrowableUtilsTest {
+
+ @Test
+ public void getRootCauseOfNullShouldThrowNullPointerException() {
+ catchException(this).getRootCause(null);
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void getRootCauseOfLeafExceptionShouldReturnSameInstance() {
+ Throwable exception = new Exception();
+ Throwable rootCause = getRootCause(exception);
+
+ assertThat(rootCause).isSameAs(exception);
+ }
+
+ @Test
+ public void getRootCauseOfExceptionShouldReturnCause() {
+ Throwable cause = new Exception();
+ Throwable rootCause = getRootCause(new Exception(cause));
+
+ assertThat(rootCause).isSameAs(cause);
+ }
+
+ @Test
+ public void getRootCauseOfExceptionTreeShouldReturnCause() {
+ Throwable cause = new Exception();
+ Throwable rootCause = getRootCause(new Exception(new Exception(cause)));
+
+ assertThat(rootCause).isSameAs(cause);
+ }
+
+ @Test
+ public void getRootCauseOfErrorTreeShouldReturnCause() {
+ Throwable cause = new Error();
+ Throwable rootCause = getRootCause(new Error(new Error(cause)));
+
+ assertThat(rootCause).isSameAs(cause);
+ }
+
+ @Test
+ public void hasCauseTypeOfNullClassShouldThrowNullPointerException() {
+ catchException(this).hasCauseType(new Exception(), null);
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void hasCauseTypeOfNullThrowableShouldThrowNullPointerException() {
+ catchException(this).hasCauseType(null, Exception.class);
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void hasCauseTypeOfNonMatchingShouldReturnFalse() {
+ assertThat(hasCauseType(new OneException(), OtherException.class)).isFalse();
+ }
+
+ @Test
+ public void hasCauseTypeOfSameClassShouldReturnTrue() {
+ assertThat(hasCauseType(new OneException(), OneException.class)).isTrue();
+ }
+
+ @Test
+ public void hasCauseTypeOfSuperClassShouldReturnFalse() {
+ assertThat(hasCauseType(new OneException(), SubException.class)).isFalse();
+ }
+
+ @Test
+ public void hasCauseTypeOfSubClassShouldReturnTrue() {
+ assertThat(hasCauseType(new SubException(), OneException.class)).isTrue();
+ }
+
+ @Test
+ public void hasCauseTypeOfWrappedClassShouldReturnTrue() {
+ assertThat(hasCauseType(new OneException(new TwoException()), TwoException.class)).isTrue();
+ }
+
+ @Test
+ public void hasCauseTypeOfWrappingClassShouldReturnTrue() {
+ assertThat(hasCauseType(new OneException(new TwoException()), OneException.class)).isTrue();
+ }
+
+ @Test
+ public void hasCauseTypeOfNestedClassShouldReturnTrue() {
+ assertThat(hasCauseType(new OneException(new TwoException(new OtherException())), OtherException.class)).isTrue();
+ }
+
+ @Test
+ public void hasCauseMessageForNullShouldThrowNullPointerException() {
+ catchException(this).hasCauseMessage(null, "message");
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void hasCauseMessageOfNullShouldThrowNullPointerException() {
+ catchException(this).hasCauseMessage(new OneException(), null);
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void hasCauseMessageForNullMessageShouldThrowNullPointerException() {
+ catchException(this).hasCauseMessage(new OneException((String)null), null);
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void hasCauseMessageOfNonMatchingNullMessageShouldThrowNullPointerException() {
+ catchException(this).hasCauseMessage(new OneException("message"), null);
+
+ assertThat((Exception)caughtException()).isExactlyInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ public void hasCauseMessageOfEmptyMessageShouldReturnTrue() {
+ assertThat(hasCauseMessage(new OneException(""), "")).isTrue();
+ }
+
+ @Test
+ public void hasCauseMessageOfMatchingMessageShouldReturnTrue() {
+ assertThat(hasCauseMessage(new OneException("message"), "message")).isTrue();
+ }
+
+ @Test
+ public void hasCauseMessageOfNonMatchingMessageShouldReturnFalse() {
+ assertThat(hasCauseMessage(new OneException("non-matching"), "message")).isFalse();
+ }
+
+ @Test
+ public void hasCauseMessageOfContainedMessageShouldReturnTrue() {
+ assertThat(hasCauseMessage(new OneException("this is the message"), "message")).isTrue();
+ }
+
+ @Test
+ public void hasCauseMessageOfPartialMatchingMessageShouldReturnFalse() {
+ assertThat(hasCauseMessage(new OneException("message"), "this is the message")).isFalse();
+ }
+
+ public Throwable getRootCause(final Throwable throwable) {
+ return ThrowableUtils.getRootCause(throwable);
+ }
+
+ public boolean hasCauseType(final Throwable throwable, final Class<? extends Throwable> causeClass) {
+ return ThrowableUtils.hasCauseType(throwable, causeClass);
+ }
+
+ public boolean hasCauseMessage(final Throwable throwable, final String message) {
+ return ThrowableUtils.hasCauseMessage(throwable, message);
+ }
+
+ private static class OneException extends Exception {
+ public OneException() {
+ }
+ public OneException(String message) {
+ super(message);
+ }
+ public OneException(Throwable cause) {
+ super(cause);
+ }
+ public OneException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+
+ private static class SubException extends OneException {
+ public SubException() {
+ }
+ public SubException(String message) {
+ super(message);
+ }
+ public SubException(Throwable cause) {
+ super(cause);
+ }
+ public SubException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+
+ private static class TwoException extends Exception {
+ public TwoException() {
+ }
+ public TwoException(String message) {
+ super(message);
+ }
+ public TwoException(Throwable cause) {
+ super(cause);
+ }
+ public TwoException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+
+ private static class OtherException extends Exception {
+ public OtherException() {
+ }
+ public OtherException(String message) {
+ super(message);
+ }
+ public OtherException(Throwable cause) {
+ super(cause);
+ }
+ public OtherException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d9344e0a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
index 40006d2..eb52ffc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
@@ -440,22 +440,22 @@ public class VM implements Serializable {
}
private MethExecutorResult execute(final Class targetClass, final String methodName, final Object[] args) {
- try {
- return this.client.executeMethodOnClass(targetClass.getName(), methodName, args);
- } catch (RemoteException e) {
- throw new RMIException(this, targetClass.getName(), methodName, e );
- }
+ try {
+ return this.client.executeMethodOnClass(targetClass.getName(), methodName, args);
+ } catch (RemoteException exception) {
+ throw new RMIException(this, targetClass.getName(), methodName, exception);
+ }
}
private MethExecutorResult execute(final Object targetObject, final String methodName, final Object[] args) {
- try {
- if (args == null) {
- return this.client.executeMethodOnObject(targetObject, methodName);
- } else {
- return this.client.executeMethodOnObject(targetObject, methodName, args);
- }
- } catch (RemoteException e) {
- throw new RMIException(this, targetObject.getClass().getName(), methodName, e );
+ try {
+ if (args == null) {
+ return this.client.executeMethodOnObject(targetObject, methodName);
+ } else {
+ return this.client.executeMethodOnObject(targetObject, methodName, args);
}
+ } catch (RemoteException exception) {
+ throw new RMIException(this, targetObject.getClass().getName(), methodName, exception);
+ }
}
}