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 2017/05/17 17:42:43 UTC
[1/2] geode git commit: GEODE-1279: rename Bug51193DUnitTest to
ClientFunctionTimeoutRegressionTest
Repository: geode
Updated Branches:
refs/heads/develop a22b9405f -> 9e5c75c15
GEODE-1279: rename Bug51193DUnitTest to ClientFunctionTimeoutRegressionTest
* renamed test class and cleaned up test code
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/a5479727
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/a5479727
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/a5479727
Branch: refs/heads/develop
Commit: a54797278b056dc97076b7412289f9868a7c3028
Parents: a22b940
Author: Kirk Lund <kl...@apache.org>
Authored: Tue May 16 16:34:37 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Tue May 16 18:11:35 2017 -0700
----------------------------------------------------------------------
.../cache/execute/Bug51193DUnitTest.java | 243 -------------------
.../ClientFunctionTimeoutRegressionTest.java | 225 +++++++++++++++++
2 files changed, 225 insertions(+), 243 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/a5479727/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
deleted file mode 100644
index 0dfbe6c..0000000
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.cache.execute;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.PartitionAttributesFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionFactory;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionAdapter;
-import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.AvailablePort;
-import org.apache.geode.internal.cache.CacheServerImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.tier.ClientHandShake;
-import org.apache.geode.internal.cache.tier.sockets.AcceptorImpl;
-import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
-import org.apache.geode.test.dunit.DistributedTestUtils;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-@SuppressWarnings("serial")
-public class Bug51193DUnitTest extends JUnit4DistributedTestCase {
-
- private static final String REGION_NAME = "Bug51193DUnitTest_region";
-
- private static GemFireCacheImpl cache;
-
- private static VM server0;
-
- private VM client0;
-
- @Override
- public final void postSetUp() throws Exception {
- Host host = Host.getHost(0);
- server0 = host.getVM(0);
- client0 = host.getVM(1);
- }
-
- @Override
- public final void preTearDown() throws Exception {
- closeCache();
- server0.invoke(() -> Bug51193DUnitTest.closeCache());
- client0.invoke(() -> Bug51193DUnitTest.closeCache());
- }
-
- public static void closeCache() {
- System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "CLIENT_FUNCTION_TIMEOUT");
- if (cache != null && !cache.isClosed()) {
- cache.close();
- cache.getDistributedSystem().disconnect();
- }
- }
-
- @SuppressWarnings("deprecation")
- public static void createClientCache(String hostName, Integer port, Integer timeout)
- throws Exception {
- try {
- if (timeout > 0) {
- System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "CLIENT_FUNCTION_TIMEOUT",
- String.valueOf(timeout));
- }
- Properties props = new Properties();
- props.setProperty(LOCATORS, "");
- props.setProperty(MCAST_PORT, "0");
- DistributedSystem ds = new Bug51193DUnitTest().getSystem(props);
- ds.disconnect();
- ClientCacheFactory ccf = new ClientCacheFactory(props);
- ccf.addPoolServer(hostName, port);
- cache = (GemFireCacheImpl) ccf.create();
-
- ClientRegionFactory<String, String> crf =
- cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
-
- crf.create(REGION_NAME);
- } finally {
- System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "CLIENT_FUNCTION_TIMEOUT");
- }
- }
-
- @SuppressWarnings("deprecation")
- public static Integer createServerCache(Boolean createPR) throws Exception {
- Properties props = new Properties();
- props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
-
- Bug51193DUnitTest test = new Bug51193DUnitTest();
- DistributedSystem ds = test.getSystem(props);
- ds.disconnect();
- cache = (GemFireCacheImpl) CacheFactory.create(test.getSystem());
-
- RegionFactory<String, String> rf = null;
- if (createPR) {
- rf = cache.createRegionFactory(RegionShortcut.PARTITION);
- rf.setPartitionAttributes(new PartitionAttributesFactory<String, String>()
- .setRedundantCopies(1).setTotalNumBuckets(4).create());
- } else {
- rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
- }
-
- rf.create(REGION_NAME);
-
- CacheServer server = cache.addCacheServer();
- server.setPort(AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
- server.start();
- return server.getPort();
- }
-
- public static void executeFunction(String mode, Integer timeout) {
- Function function = new TestFunction(mode + timeout);
- FunctionService.registerFunction(function);
- Execution dataSet = null;
- if ("region".equalsIgnoreCase(mode)) {
- dataSet = FunctionService.onRegion(cache.getRegion(REGION_NAME)).setArguments(timeout);
- } else if ("server".equalsIgnoreCase(mode)) {
- dataSet = FunctionService.onServer(cache.getDefaultPool()).setArguments(timeout);
- } else {
- dataSet = FunctionService.onServers(cache).setArguments(timeout);
- }
- ResultCollector rs = dataSet.execute(function);
- assertTrue("Server did not read client_function_timeout from client.",
- (Boolean) ((ArrayList) rs.getResult()).get(0));
- }
-
- @SuppressWarnings("rawtypes")
- public static void doPutsAndGet(Integer num) {
- Region r = cache.getRegion(REGION_NAME);
- for (int i = 0; i < num; ++i) {
- r.put("KEY_" + i, "VALUE_" + i);
- }
- r.get("KEY_0");
- }
-
- public void doTest(boolean createPR, int timeout, String mode) throws Throwable {
- // start server
- int port = (Integer) server0.invoke(() -> Bug51193DUnitTest.createServerCache(createPR));
- // start client
- client0.invoke(
- () -> Bug51193DUnitTest.createClientCache(client0.getHost().getHostName(), port, timeout));
- // do puts and get
- server0.invoke(() -> Bug51193DUnitTest.doPutsAndGet(10));
- // execute function & verify timeout has been received at server.
- client0.invoke(() -> Bug51193DUnitTest.executeFunction(mode, timeout));
- }
-
- @Test
- public void testExecuteFunctionReadsDefaultTimeout() throws Throwable {
- doTest(false, 0, "server");
- }
-
- @Test
- public void testExecuteRegionFunctionReadsDefaultTimeout() throws Throwable {
- doTest(false, 0, "region");
- }
-
- @Test
- public void testExecuteRegionFunctionSingleHopReadsDefaultTimeout() throws Throwable {
- doTest(true, 0, "region");
- }
-
- @Test
- public void testExecuteFunctionReadsTimeout() throws Throwable {
- doTest(false, 6000, "server");
- }
-
- @Test
- public void testExecuteRegionFunctionReadsTimeout() throws Throwable {
- doTest(false, 6000, "region");
- }
-
- @Test
- public void testExecuteRegionFunctionSingleHopReadsTimeout() throws Throwable {
- doTest(true, 6000, "region");
- }
-
- static class TestFunction extends FunctionAdapter {
-
- private String id;
-
- public TestFunction(String id) {
- this.id = id;
- }
-
- @Override
- public void execute(FunctionContext context) {
- boolean timeoutMatches = false;
- int expected = (Integer) context.getArguments();
- AcceptorImpl acceptor = ((CacheServerImpl) cache.getCacheServers().get(0)).getAcceptor();
- ServerConnection[] scs = acceptor.getAllServerConnectionList();
- for (int i = 0; i < scs.length; ++i) {
- ClientHandShake hs = scs[i].getHandshake();
- if (hs != null && expected == hs.getClientReadTimeout()) {
- timeoutMatches = true;
- }
- }
-
- context.getResultSender().lastResult(timeoutMatches);
- }
-
- @Override
- public String getId() {
- return this.id;
- }
-
- @Override
- public boolean isHA() {
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/a5479727/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientFunctionTimeoutRegressionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientFunctionTimeoutRegressionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientFunctionTimeoutRegressionTest.java
new file mode 100644
index 0000000..b69a6b9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientFunctionTimeoutRegressionTest.java
@@ -0,0 +1,225 @@
+/*
+ * 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 org.apache.geode.internal.cache.execute;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.client.ClientCacheFactory;
+import org.apache.geode.cache.client.ClientRegionFactory;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+import org.apache.geode.cache.client.internal.InternalClientCache;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.internal.AvailablePort;
+import org.apache.geode.internal.cache.CacheServerImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.tier.ClientHandShake;
+import org.apache.geode.internal.cache.tier.sockets.AcceptorImpl;
+import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
+import org.apache.geode.test.dunit.DistributedTestUtils;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.Invoke;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Properties;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+@Category(DistributedTest.class)
+@RunWith(JUnitParamsRunner.class)
+@SuppressWarnings("serial")
+public class ClientFunctionTimeoutRegressionTest extends JUnit4DistributedTestCase {
+
+ private static final String REGION_NAME =
+ ClientFunctionTimeoutRegressionTest.class.getSimpleName() + "_region";
+
+ private static InternalCache serverCache;
+
+ private static InternalClientCache clientCache;
+
+ private VM server;
+
+ private VM client;
+
+ @Rule
+ public DistributedRestoreSystemProperties restoreSystemProperties =
+ new DistributedRestoreSystemProperties();
+
+ @Before
+ public void before() throws Exception {
+ server = Host.getHost(0).getVM(0);
+ client = Host.getHost(0).getVM(1);
+
+ disconnectAllFromDS();
+ }
+
+ @After
+ public void after() throws Exception {
+ Invoke.invokeInEveryVM(() -> closeCache());
+ }
+
+ @Test
+ @Parameters({"false,0,server", "false,0,region", "true,0,region", "false,6000,server",
+ "false,6000,region", "true,6000,region"})
+ public void testExecuteFunctionReadsDefaultTimeout(boolean createPR, int timeout, String mode)
+ throws Exception {
+ // start server
+ int port = server.invoke(() -> createServerCache(createPR));
+ // start client
+ client.invoke(() -> createClientCache(client.getHost().getHostName(), port, timeout));
+ // do puts and get
+ server.invoke(() -> doPutsAndGet(10));
+ // execute function & verify timeout has been received at server.
+ client.invoke(() -> executeFunction(mode, timeout));
+ }
+
+ private void closeCache() {
+ if (clientCache != null) {
+ clientCache.close();
+ clientCache = null;
+ }
+ if (serverCache != null) {
+ serverCache.close();
+ serverCache = null;
+ }
+ }
+
+ private void createClientCache(String hostName, Integer port, Integer timeout) {
+ if (timeout > 0) {
+ System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "CLIENT_FUNCTION_TIMEOUT",
+ String.valueOf(timeout));
+ }
+
+ Properties props = new Properties();
+ props.setProperty(LOCATORS, "");
+ props.setProperty(MCAST_PORT, "0");
+
+ ClientCacheFactory ccf = new ClientCacheFactory(props);
+ ccf.addPoolServer(hostName, port);
+ clientCache = (InternalClientCache) ccf.create();
+
+ ClientRegionFactory<String, String> crf =
+ clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
+
+ crf.create(REGION_NAME);
+ }
+
+ private Integer createServerCache(Boolean createPR) throws IOException {
+ Properties props = new Properties();
+ props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
+
+ serverCache = (InternalCache) new CacheFactory(props).create();
+
+ RegionFactory<String, String> rf;
+ if (createPR) {
+ rf = serverCache.createRegionFactory(RegionShortcut.PARTITION);
+ rf.setPartitionAttributes(new PartitionAttributesFactory<String, String>()
+ .setRedundantCopies(1).setTotalNumBuckets(4).create());
+ } else {
+ rf = serverCache.createRegionFactory(RegionShortcut.REPLICATE);
+ }
+
+ rf.create(REGION_NAME);
+
+ CacheServer server = serverCache.addCacheServer();
+ server.setPort(AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
+ server.start();
+ return server.getPort();
+ }
+
+ private void executeFunction(String mode, Integer timeout) {
+ Function function = new TestFunction(mode + timeout);
+ FunctionService.registerFunction(function);
+ Execution dataSet;
+ if ("region".equalsIgnoreCase(mode)) {
+ dataSet = FunctionService.onRegion(clientCache.getRegion(REGION_NAME)).setArguments(timeout);
+ } else if ("server".equalsIgnoreCase(mode)) {
+ dataSet = FunctionService.onServer(clientCache.getDefaultPool()).setArguments(timeout);
+ } else {
+ dataSet = FunctionService.onServers(clientCache).setArguments(timeout);
+ }
+ ResultCollector rs = dataSet.execute(function);
+ assertThat((Boolean) ((ArrayList) rs.getResult()).get(0))
+ .as("Server did not read client_function_timeout from client.").isTrue();
+ }
+
+ private void doPutsAndGet(Integer num) {
+ Region r = serverCache.getRegion(REGION_NAME);
+ for (int i = 0; i < num; ++i) {
+ r.put("KEY_" + i, "VALUE_" + i);
+ }
+ r.get("KEY_0");
+ }
+
+ private static class TestFunction extends FunctionAdapter {
+
+ private final String id;
+
+ public TestFunction(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public void execute(FunctionContext context) {
+ boolean timeoutMatches = false;
+ int expected = (Integer) context.getArguments();
+ AcceptorImpl acceptor =
+ ((CacheServerImpl) serverCache.getCacheServers().get(0)).getAcceptor();
+ ServerConnection[] scs = acceptor.getAllServerConnectionList();
+ for (ServerConnection sc : scs) {
+ ClientHandShake hs = sc.getHandshake();
+ if (hs != null && expected == hs.getClientReadTimeout()) {
+ timeoutMatches = true;
+ }
+ }
+
+ context.getResultSender().lastResult(timeoutMatches);
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public boolean isHA() {
+ return false;
+ }
+ }
+}
[2/2] geode git commit: GEODE-2934: refactor
AnalyzeSerializablesJUnitTest and subclasses
Posted by kl...@apache.org.
GEODE-2934: refactor AnalyzeSerializablesJUnitTest and subclasses
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9e5c75c1
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9e5c75c1
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9e5c75c1
Branch: refs/heads/develop
Commit: 9e5c75c156a5a24fc7512ddaec3877218af1e466
Parents: a547972
Author: Kirk Lund <kl...@apache.org>
Authored: Tue May 16 17:53:46 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed May 17 10:19:09 2017 -0700
----------------------------------------------------------------------
.../apache/geode/internal/lang/SystemUtils.java | 7 +
.../AnalyzeSerializablesJUnitTest.java | 380 +++++++++----------
.../internal/lang/SystemUtilsJUnitTest.java | 4 +
.../AnalyzeCQSerializablesJUnitTest.java | 55 +--
.../AnalyzeWANSerializablesJUnitTest.java | 67 +---
5 files changed, 195 insertions(+), 318 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/9e5c75c1/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
index 3485ede..2e47556 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
@@ -301,4 +301,11 @@ public class SystemUtils {
public static String getLineSeparator() {
return LINE_SEPARATOR;
}
+
+ /**
+ * Returns the value of {@code System.getProperty("java.version")}.
+ */
+ public static String getJavaVersion() {
+ return System.getProperty("java.version");
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9e5c75c1/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java b/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
index 5b78f06..ee61a85 100644
--- a/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
@@ -14,11 +14,34 @@
*/
package org.apache.geode.codeAnalysis;
-import static org.junit.Assert.fail;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.diffSortedClassesAndMethods;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.diffSortedClassesAndVariables;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.loadClassesAndMethods;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.loadClassesAndVariables;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.parseClassFilesInDir;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.storeClassesAndMethods;
+import static org.apache.geode.codeAnalysis.CompiledClassUtils.storeClassesAndVariables;
+import static org.apache.geode.internal.lang.SystemUtils.getJavaVersion;
+import static org.apache.geode.internal.lang.SystemUtils.isJavaVersionAtLeast;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assume.assumeThat;
+
+import org.apache.geode.codeAnalysis.decode.CompiledClass;
+import org.apache.geode.codeAnalysis.decode.CompiledField;
+import org.apache.geode.codeAnalysis.decode.CompiledMethod;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -26,83 +49,137 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import org.junit.AfterClass;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.codeAnalysis.decode.CompiledClass;
-import org.apache.geode.codeAnalysis.decode.CompiledField;
-import org.apache.geode.codeAnalysis.decode.CompiledMethod;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.util.test.TestUtil;
-
@Category(IntegrationTest.class)
public class AnalyzeSerializablesJUnitTest {
/** all loaded classes */
- protected static Map<String, CompiledClass> classes = new HashMap<String, CompiledClass>();
+ private Map<String, CompiledClass> classes;
- private static boolean ClassesNotFound;
+ private List<ClassAndMethodDetails> expectedDataSerializables;
+ private List<ClassAndVariableDetails> expectedSerializables;
+
+ private File actualDataSerializablesFile;
+ private File actualSerializablesFile;
+
+ @Rule
+ public TestName testName = new TestName();
@Before
- public void loadClasses() throws Exception {
- String version = System.getProperty("java.runtime.version");
- boolean jdk18 = version != null && version.startsWith("1.8");
- // sanctioned info is based on a 1.7 compiler
- Assume.assumeTrue(
- "AnalyzeSerializables requires a Java 8 but tests are running with v" + version, jdk18);
- if (classes.size() > 0) {
- return;
+ public void setUp() throws Exception {
+ assumeThat(
+ "AnalyzeSerializables requires Java 8 but tests are running with v" + getJavaVersion(),
+ isJavaVersionAtLeast("1.8"), is(true));
+
+ this.classes = new HashMap<>();
+
+ loadClasses();
+
+ // setup expectedDataSerializables
+
+ File expectedDataSerializablesFile = getResourceAsFile("sanctionedDataSerializables.txt");
+ assertThat(expectedDataSerializablesFile).exists().canRead();
+
+ this.expectedDataSerializables = loadClassesAndMethods(expectedDataSerializablesFile);
+ Collections.sort(this.expectedDataSerializables);
+
+ // setup expectedSerializables
+
+ File expectedSerializablesFile = getResourceAsFile("sanctionedSerializables.txt");
+ assertThat(expectedSerializablesFile).exists().canRead();
+
+ this.expectedSerializables = loadClassesAndVariables(expectedSerializablesFile);
+ Collections.sort(this.expectedSerializables);
+
+ // setup empty actual files
+
+ this.actualDataSerializablesFile = createEmptyFile("actualDataSerializables.dat");
+ this.actualSerializablesFile = createEmptyFile("actualSerializables.dat");
+ }
+
+ /**
+ * Override only this one method in sub-classes
+ */
+ protected String getModuleName() {
+ return "geode-core";
+ }
+
+ @Test
+ public void testDataSerializables() throws Exception {
+ System.out.println(this.testName.getMethodName() + " starting");
+
+ List<ClassAndMethods> actualDataSerializables = findToDatasAndFromDatas();
+ storeClassesAndMethods(actualDataSerializables, this.actualDataSerializablesFile);
+
+ String diff =
+ diffSortedClassesAndMethods(this.expectedDataSerializables, actualDataSerializables);
+ if (diff.length() > 0) {
+ System.out.println(
+ "++++++++++++++++++++++++++++++testDataSerializables found discrepencies++++++++++++++++++++++++++++++++++++");
+ System.out.println(diff);
+ fail(
+ diff + "\n\nIf the class is not persisted or sent over the wire add it to the excludedClasses.txt file in the "
+ + "\norg/apache/geode/codeAnalysis directory. Otherwise if this doesn't "
+ + "\nbreak backward compatibility move the file actualDataSerializables.dat to the codeAnalysis "
+ + "\ntest directory and rename to sanctionedDataSerializables.txt");
}
+ }
+
+ @Test
+ public void testSerializables() throws Exception {
+ System.out.println(this.testName.getMethodName() + " starting");
+
+ List<ClassAndVariables> actualSerializables = findSerializables();
+ storeClassesAndVariables(actualSerializables, this.actualSerializablesFile);
+
+ String diff = diffSortedClassesAndVariables(this.expectedSerializables, actualSerializables);
+ if (diff.length() > 0) {
+ System.out.println(
+ "++++++++++++++++++++++++++++++testSerializables found discrepencies++++++++++++++++++++++++++++++++++++");
+ System.out.println(diff);
+ fail(
+ diff + "\n\nIf the class is not persisted or sent over the wire add it to the excludedClasses.txt file in the "
+ + "\n/org/apache/geode/codeAnalysis/ directory. Otherwise if this doesn't "
+ + "\nbreak backward compatibility move the file actualSerializables.dat to the "
+ + "\ncodeAnalysis test directory and rename to sanctionedSerializables.txt");
+ }
+ }
+
+ private void loadClasses() throws IOException {
System.out.println("loadClasses starting");
- List<String> excludedClasses = loadExcludedClasses(new File(
- TestUtil.getResourcePath(AnalyzeSerializablesJUnitTest.class, "excludedClasses.txt")));
- List<String> openBugs = loadOpenBugs(
- new File(TestUtil.getResourcePath(AnalyzeSerializablesJUnitTest.class, "openBugs.txt")));
+ List<String> excludedClasses = loadExcludedClasses(getResourceAsFile("excludedClasses.txt"));
+ List<String> openBugs = loadOpenBugs(getResourceAsFile("openBugs.txt"));
+
excludedClasses.addAll(openBugs);
- String cp = System.getProperty("java.class.path");
- System.out.println("java classpath is " + cp);
- System.out.flush();
- String[] entries = cp.split(File.pathSeparator);
- String buildDirName = "geode-core" + File.separatorChar + "build" + File.separatorChar
+ String classpath = System.getProperty("java.class.path");
+ System.out.println("java classpath is " + classpath);
+
+ String[] entries = classpath.split(File.pathSeparator);
+ String buildDirName = getModuleName() + File.separatorChar + "build" + File.separatorChar
+ "classes" + File.separatorChar + "main";
String buildDir = null;
for (int i = 0; i < entries.length && buildDir == null; i++) {
System.out.println("examining '" + entries[i] + "'");
- System.out.flush();
if (entries[i].endsWith(buildDirName)) {
buildDir = entries[i];
}
}
- if (buildDir != null) {
- System.out.println("loading class files from " + buildDir);
- System.out.flush();
- long start = System.currentTimeMillis();
- loadClassesFromBuild(new File(buildDir), excludedClasses);
- long finish = System.currentTimeMillis();
- System.out.println("done loading " + classes.size() + " classes. elapsed time = "
- + (finish - start) / 1000 + " seconds");
- } else {
- fail("unable to find geode classes");
- }
- }
- @AfterClass
- public static void cleanup() {
- if (classes != null) {
- classes.clear();
- }
+ assertThat(buildDir).isNotNull();
+ System.out.println("loading class files from " + buildDir);
+
+ long start = System.currentTimeMillis();
+ loadClassesFromBuild(new File(buildDir), excludedClasses);
+ long finish = System.currentTimeMillis();
+
+ System.out.println("done loading " + classes.size() + " classes. elapsed time = "
+ + (finish - start) / 1000 + " seconds");
}
- protected static List<String> loadExcludedClasses(File exclusionsFile) throws Exception {
- List<String> excludedClasses = new LinkedList<String>();
+ private List<String> loadExcludedClasses(File exclusionsFile) throws IOException {
+ List<String> excludedClasses = new LinkedList<>();
FileReader fr = new FileReader(exclusionsFile);
BufferedReader br = new BufferedReader(fr);
try {
@@ -119,8 +196,8 @@ public class AnalyzeSerializablesJUnitTest {
return excludedClasses;
}
- protected static List<String> loadOpenBugs(File exclusionsFile) throws Exception {
- List<String> excludedClasses = new LinkedList<String>();
+ private List<String> loadOpenBugs(File exclusionsFile) throws IOException {
+ List<String> excludedClasses = new LinkedList<>();
FileReader fr = new FileReader(exclusionsFile);
BufferedReader br = new BufferedReader(fr);
try {
@@ -131,7 +208,7 @@ public class AnalyzeSerializablesJUnitTest {
if (line.length() > 0 && !line.startsWith("#")) {
String[] split = line.split(",");
if (split.length != 2) {
- fail("unable to load classes due to misformatted line in openBugs.txt: " + line);
+ fail("unable to load classes due to malformed line in openBugs.txt: " + line);
}
excludedClasses.add(line.split(",")[1].trim());
}
@@ -142,183 +219,78 @@ public class AnalyzeSerializablesJUnitTest {
return excludedClasses;
}
- private static void removeExclusions(Map<String, CompiledClass> classes,
- List<String> exclusions) {
+ private void removeExclusions(Map<String, CompiledClass> classes, List<String> exclusions) {
for (String exclusion : exclusions) {
exclusion = exclusion.replace('.', '/');
classes.remove(exclusion);
}
}
- @Test
- public void testDataSerializables() throws Exception {
- System.out.println("testDataSerializables starting");
- if (ClassesNotFound) {
- System.out.println("... test not run due to not being able to locate product class files");
- return;
- }
- String compareToFileName =
- TestUtil.getResourcePath(getClass(), "sanctionedDataSerializables.txt");
-
- String storeInFileName = "actualDataSerializables.dat";
- File storeInFile = new File(storeInFileName);
- if (storeInFile.exists() && !storeInFile.canWrite()) {
- throw new RuntimeException("can't write " + storeInFileName);
- }
- List<ClassAndMethods> toDatas = findToDatasAndFromDatas();
- CompiledClassUtils.storeClassesAndMethods(toDatas, storeInFile);
-
- File compareToFile = new File(compareToFileName);
- if (!compareToFile.exists()) {
- throw new RuntimeException("can't find " + compareToFileName);
- }
- if (!compareToFile.canRead()) {
- throw new RuntimeException("can't read " + compareToFileName);
- }
-
- List<ClassAndMethodDetails> goldRecord =
- CompiledClassUtils.loadClassesAndMethods(compareToFile);
- Collections.sort(goldRecord);
-
- String diff = CompiledClassUtils.diffSortedClassesAndMethods(goldRecord, toDatas);
- if (diff.length() > 0) {
- System.out.println(
- "++++++++++++++++++++++++++++++testDataSerializables found discrepencies++++++++++++++++++++++++++++++++++++");
- System.out.println(diff);
- fail(
- diff + "\n\nIf the class is not persisted or sent over the wire add it to the excludedClasses.txt file in the "
- + "\norg/apache/geode/codeAnalysis directory. Otherwise if this doesn't "
- + "\nbreak backward compatibility move the file actualDataSerializables.dat to the codeAnalysis "
- + "\ntest directory and rename to sanctionedDataSerializables.txt");
- }
- }
-
- @Test
- public void testSerializables() throws Exception {
- System.out.println("testSerializables starting");
- System.out.flush();
- if (ClassesNotFound) {
- System.out.println("... test not run due to not being able to locate product class files");
- return;
- }
- String compareToFileName = TestUtil.getResourcePath(getClass(), "sanctionedSerializables.txt");
- File compareToFile = new File(compareToFileName);
-
- String storeInFileName = "actualSerializables.dat";
- File storeInFile = new File(storeInFileName);
- if (storeInFile.exists() && !storeInFile.canWrite()) {
- throw new RuntimeException("can't write " + storeInFileName);
- }
-
- List<ClassAndVariables> serializables = findSerializables();
- reset();
- CompiledClassUtils.storeClassesAndVariables(serializables, storeInFile);
-
-
- if (!compareToFile.exists()) {
- throw new RuntimeException("can't find " + compareToFileName);
- }
- if (!compareToFile.canRead()) {
- throw new RuntimeException("can't read " + compareToFileName);
- }
- List<ClassAndVariableDetails> goldRecord =
- CompiledClassUtils.loadClassesAndVariables(compareToFile);
- Collections.sort(goldRecord);
-
- String diff = CompiledClassUtils.diffSortedClassesAndVariables(goldRecord, serializables);
- classes.clear();
- if (diff.length() > 0) {
- System.out.println(
- "++++++++++++++++++++++++++++++testSerializables found discrepencies++++++++++++++++++++++++++++++++++++");
- System.out.println(diff);
- fail(
- diff + "\n\nIf the class is not persisted or sent over the wire add it to the excludedClasses.txt file in the "
- + "\n/org/apache/geode/codeAnalysis/ directory. Otherwise if this doesn't "
- + "\nbreak backward compatibility move the file actualSerializables.dat to the "
- + "\ncodeAnalysis test directory and rename to sanctionedSerializables.txt");
- }
- }
-
- /**
- * load the classes from the given files and directories
- *
- * @param excludedClasses names of classes to exclude
- */
- public static void loadClasses(String directory, boolean recursive,
- List<String> excludedClasses) {
- String[] filenames = new String[] {directory};
- List<File> classFiles = CompiledClassUtils.findClassFiles("", filenames, recursive);
- Map<String, CompiledClass> newClasses = CompiledClassUtils.parseClassFiles(classFiles);
- removeExclusions(newClasses, excludedClasses);
- classes.putAll(newClasses);
- }
-
- public static void loadClassesFromBuild(File buildDir, List<String> excludedClasses) {
- Map<String, CompiledClass> newClasses = CompiledClassUtils.parseClassFilesInDir(buildDir);
+ private void loadClassesFromBuild(File buildDir, List<String> excludedClasses) {
+ Map<String, CompiledClass> newClasses = parseClassFilesInDir(buildDir);
removeExclusions(newClasses, excludedClasses);
- classes.putAll(newClasses);
+ this.classes.putAll(newClasses);
}
- /**
- * load the classes from the given jar file
- */
- public static void loadClasses(File jar, List<String> excludedClasses) {
- Map<String, CompiledClass> newClasses = CompiledClassUtils.parseClassFilesInJar(jar);
- removeExclusions(newClasses, excludedClasses);
- classes.putAll(newClasses);
- }
+ private List<ClassAndMethods> findToDatasAndFromDatas() {
+ List<ClassAndMethods> result = new ArrayList<>();
+ for (Map.Entry<String, CompiledClass> entry : this.classes.entrySet()) {
+ CompiledClass compiledClass = entry.getValue();
+ ClassAndMethods classAndMethods = null;
- /**
- * clears all loaded classes
- */
- public void reset() {
- classes.clear();
- }
+ for (int i = 0; i < compiledClass.methods.length; i++) {
+ CompiledMethod method = compiledClass.methods[i];
- public List<ClassAndMethods> findToDatasAndFromDatas() {
- List<ClassAndMethods> result = new ArrayList<ClassAndMethods>();
- for (Map.Entry<String, CompiledClass> dentry : classes.entrySet()) {
- CompiledClass dclass = dentry.getValue();
- ClassAndMethods entry = null;
- for (int i = 0; i < dclass.methods.length; i++) {
- CompiledMethod method = dclass.methods[i];
if (!method.isAbstract() && method.descriptor().equals("void")) {
String name = method.name();
if (name.startsWith("toData") || name.startsWith("fromData")) {
- if (entry == null) {
- entry = new ClassAndMethods(dclass);
+ if (classAndMethods == null) {
+ classAndMethods = new ClassAndMethods(compiledClass);
}
- entry.methods.put(method.name(), method);
+ classAndMethods.methods.put(method.name(), method);
}
}
}
- if (entry != null) {
- result.add(entry);
+ if (classAndMethods != null) {
+ result.add(classAndMethods);
}
}
Collections.sort(result);
return result;
}
- public List<ClassAndVariables> findSerializables() {
- List<ClassAndVariables> result = new ArrayList<ClassAndVariables>(2000);
- for (Map.Entry<String, CompiledClass> entry : classes.entrySet()) {
- CompiledClass dclass = entry.getValue();
- System.out.println("processing class " + dclass.fullyQualifiedName());
- System.out.flush();
- if (!dclass.isInterface() && dclass.isSerializableAndNotDataSerializable()) {
- ClassAndVariables cav = new ClassAndVariables(dclass);
- for (int i = 0; i < dclass.fields_count; i++) {
- CompiledField f = dclass.fields[i];
- if (!f.isStatic() && !f.isTransient()) {
- cav.variables.put(f.name(), f);
+ private List<ClassAndVariables> findSerializables() {
+ List<ClassAndVariables> result = new ArrayList<>(2000);
+ for (Map.Entry<String, CompiledClass> entry : this.classes.entrySet()) {
+ CompiledClass compiledClass = entry.getValue();
+ System.out.println("processing class " + compiledClass.fullyQualifiedName());
+
+ if (!compiledClass.isInterface() && compiledClass.isSerializableAndNotDataSerializable()) {
+ ClassAndVariables classAndVariables = new ClassAndVariables(compiledClass);
+ for (int i = 0; i < compiledClass.fields_count; i++) {
+ CompiledField compiledField = compiledClass.fields[i];
+ if (!compiledField.isStatic() && !compiledField.isTransient()) {
+ classAndVariables.variables.put(compiledField.name(), compiledField);
}
}
- result.add(cav);
+ result.add(classAndVariables);
}
}
Collections.sort(result);
return result;
}
+ private File createEmptyFile(String fileName) throws IOException {
+ File file = new File(fileName);
+ if (file.exists()) {
+ assertThat(file.delete()).isTrue();
+ }
+ assertThat(file.createNewFile()).isTrue();
+ assertThat(file).exists().canWrite();
+ return file;
+ }
+
+ private File getResourceAsFile(String resourceName) {
+ return new File(getClass().getResource(resourceName).getFile());
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9e5c75c1/geode-core/src/test/java/org/apache/geode/internal/lang/SystemUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/SystemUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/SystemUtilsJUnitTest.java
index 8a83dc0..5e669b3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/SystemUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/SystemUtilsJUnitTest.java
@@ -137,4 +137,8 @@ public class SystemUtilsJUnitTest {
assertThat(getBootClassPath()).isEqualTo(value);
}
+ @Test
+ public void getJavaVersionShouldReturnJavaVersionValue() {
+ assertThat(getJavaVersion()).isEqualTo(System.getProperty("java.version"));
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9e5c75c1/geode-cq/src/test/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesJUnitTest.java b/geode-cq/src/test/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesJUnitTest.java
index 747dd8b..4ba17e0 100755
--- a/geode-cq/src/test/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesJUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesJUnitTest.java
@@ -14,61 +14,14 @@
*/
package org.apache.geode.codeAnalysis;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
-
import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.util.test.TestUtil;
+import org.junit.experimental.categories.Category;
-/**
- *
- */
@Category(IntegrationTest.class)
public class AnalyzeCQSerializablesJUnitTest extends AnalyzeSerializablesJUnitTest {
- @Before
- public void loadClasses() throws Exception {
- if (classes.size() > 0) {
- return;
- }
- System.out.println("loadClasses starting");
- List<String> excludedClasses = loadExcludedClasses(new File(
- TestUtil.getResourcePath(AnalyzeCQSerializablesJUnitTest.class, "excludedClasses.txt")));
- List<String> openBugs = loadOpenBugs(
- new File(TestUtil.getResourcePath(AnalyzeCQSerializablesJUnitTest.class, "openBugs.txt")));
- excludedClasses.addAll(openBugs);
-
- String cp = System.getProperty("java.class.path");
- System.out.println("java classpath is " + cp);
- System.out.flush();
- String[] entries = cp.split(File.pathSeparator);
- String buildDirName = "geode-cq" + File.separatorChar + "build" + File.separatorChar + "classes"
- + File.separatorChar + "main";
- String buildDir = null;
-
- for (int i = 0; i < entries.length && buildDir == null; i++) {
- System.out.println("examining '" + entries[i] + "'");
- System.out.flush();
- if (entries[i].endsWith(buildDirName)) {
- buildDir = entries[i];
- }
- }
- if (buildDir != null) {
- System.out.println("loading class files from " + buildDir);
- System.out.flush();
- long start = System.currentTimeMillis();
- loadClassesFromBuild(new File(buildDir), excludedClasses);
- long finish = System.currentTimeMillis();
- System.out.println("done loading " + classes.size() + " classes. elapsed time = "
- + (finish - start) / 1000 + " seconds");
- } else {
- fail("unable to find CQ classes");
- }
+ @Override
+ protected String getModuleName() {
+ return "geode-cq";
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9e5c75c1/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java b/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
index 77c541c..5098131 100755
--- a/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
@@ -14,73 +14,14 @@
*/
package org.apache.geode.codeAnalysis;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.AfterClass;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.codeAnalysis.decode.CompiledClass;
import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.util.test.TestUtil;
+import org.junit.experimental.categories.Category;
-/**
- *
- */
@Category(IntegrationTest.class)
public class AnalyzeWANSerializablesJUnitTest extends AnalyzeSerializablesJUnitTest {
- @Before
- public void loadClasses() throws Exception {
- if (classes.size() > 0) {
- return;
- }
- System.out.println("loadClasses starting");
- List<String> excludedClasses = loadExcludedClasses(new File(
- TestUtil.getResourcePath(AnalyzeWANSerializablesJUnitTest.class, "excludedClasses.txt")));
- List<String> openBugs = loadOpenBugs(
- new File(TestUtil.getResourcePath(AnalyzeWANSerializablesJUnitTest.class, "openBugs.txt")));
- excludedClasses.addAll(openBugs);
-
- String cp = System.getProperty("java.class.path");
- System.out.println("java classpath is " + cp);
- System.out.flush();
- String[] entries = cp.split(File.pathSeparator);
- String buildDirName = "geode-wan" + File.separatorChar + "build" + File.separatorChar
- + "classes" + File.separatorChar + "main";
- String buildDir = null;
-
- for (int i = 0; i < entries.length && buildDir == null; i++) {
- System.out.println("examining '" + entries[i] + "'");
- System.out.flush();
- if (entries[i].endsWith(buildDirName)) {
- buildDir = entries[i];
- }
- }
- if (buildDir != null) {
- System.out.println("loading class files from " + buildDir);
- System.out.flush();
- long start = System.currentTimeMillis();
- loadClassesFromBuild(new File(buildDir), excludedClasses);
- long finish = System.currentTimeMillis();
- System.out.println("done loading " + classes.size() + " classes. elapsed time = "
- + (finish - start) / 1000 + " seconds");
- } else {
- fail("unable to find WAN classes");
- }
+ @Override
+ protected String getModuleName() {
+ return "geode-wan";
}
-
- @AfterClass
- public static void cleanup() {
- if (classes != null) {
- classes.clear();
- }
- }
-
}