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/05/03 22:37:09 UTC
[2/3] incubator-geode git commit: Cleanup tests
Cleanup tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/fa7106e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/fa7106e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/fa7106e0
Branch: refs/heads/feature/GEODE-1255
Commit: fa7106e05c12d5a9b002465e52f33ca7def92816
Parents: c66649f
Author: Kirk Lund <kl...@apache.org>
Authored: Tue May 3 09:49:36 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Tue May 3 09:49:36 2016 -0700
----------------------------------------------------------------------
.../SharedConfigurationEndToEndDUnitTest.java | 10 +-
.../distributed/HostedLocatorsDUnitTest.java | 25 +--
...leProcessControllerIntegrationJUnitTest.java | 12 +-
.../cli/HeadlessGfshIntegrationTest.java | 18 +--
...WithCacheLoaderDuringCacheMissDUnitTest.java | 159 +++++++++----------
...stAndDescribeDiskStoreCommandsDUnitTest.java | 117 +++++++-------
.../SharedConfigurationCommandsDUnitTest.java | 141 ++++++++--------
7 files changed, 237 insertions(+), 245 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
index 2998722..200c379 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
@@ -66,6 +66,7 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
private static final int TIMEOUT = 10000;
private static final int INTERVAL = 500;
+
private static final String REGION1 = "R1";
private static final String REGION2 = "R2";
private static final String INDEX1 = "ID1";
@@ -73,8 +74,7 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
private static Set<String> serverNames = new HashSet<>();
private static Set<String> jarFileNames = new HashSet<>();
- private transient ClassBuilder classBuilder = new ClassBuilder();
-
+ private transient ClassBuilder classBuilder;
private transient String jmxHost;
private transient int jmxPort;
private transient int httpPort;
@@ -86,6 +86,8 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
addIgnoredException("EntryDestroyedException");
+ this.classBuilder = new ClassBuilder();
+
Object[] result = setup();
int locatorPort = (Integer) result[0];
@@ -95,9 +97,13 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
this.locatorString = "localHost[" + locatorPort + "]";
}
+ @Override
public final void preTearDownCliCommandTestBase() throws Exception {
//shutdown everything
shutdownAll();
+
+ serverNames.clear();
+ jarFileNames.clear();
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
index 2b067d0..1e5c8b0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
@@ -16,6 +16,10 @@
*/
package com.gemstone.gemfire.distributed;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+
import java.io.File;
import java.util.Collection;
import java.util.HashSet;
@@ -23,6 +27,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
+import org.junit.Test;
+
import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
@@ -30,20 +36,18 @@ import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.SocketCreator;
import com.gemstone.gemfire.internal.util.StopWatch;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
/**
* Extracted from LocatorLauncherLocalIntegrationTest.
*
* @since 8.0
*/
-public class HostedLocatorsDUnitTest extends DistributedTestCase {
+public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase {
protected static final int TIMEOUT_MILLISECONDS = 5 * 60 * 1000; // 5 minutes
@@ -59,23 +63,20 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
public final void preTearDown() throws Exception {
disconnectAllFromDS();
}
-
- public HostedLocatorsDUnitTest(String name) {
- super(name);
- }
+ @Test
public void testGetAllHostedLocators() throws Exception {
final InternalDistributedSystem system = getSystem();
final String dunitLocator = system.getConfig().getLocators();
assertNotNull(dunitLocator);
assertFalse(dunitLocator.isEmpty());
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(4);
+ final int[] ports = getRandomAvailableTCPPorts(4);
final String uniqueName = getUniqueName();
for (int i = 0 ; i < 4; i++) {
final int whichvm = i;
- Host.getHost(0).getVM(whichvm).invoke(new SerializableCallable() {
+ getHost(0).getVM(whichvm).invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
try {
@@ -131,7 +132,7 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
// validate fix for #46324
for (int whichvm = 0 ; whichvm < 4; whichvm++) {
- Host.getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
+ getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
@Override
public void run() {
final DistributionManager dm = (DistributionManager)InternalDistributedSystem.getAnyInstance().getDistributionManager();
@@ -148,7 +149,7 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
// validation with locators
for (int whichvm = 0 ; whichvm < 4; whichvm++) {
- Host.getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
+ getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
@Override
public void run() {
final DistributionManager dm = (DistributionManager)InternalDistributedSystem.getAnyInstance().getDistributionManager();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
index 660716c..583f4d1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
@@ -50,16 +50,16 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
*/
@Category(IntegrationTest.class)
public class FileProcessControllerIntegrationJUnitTest {
-
+
+ private ProcessType processType;
+ private ExecutorService executor;
+
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Rule
public TestName testName = new TestName();
- private ProcessType processType;
- private ExecutorService executor;
-
@Before
public void setUp() throws Exception {
this.processType = ProcessType.LOCATOR;
@@ -113,8 +113,8 @@ public class FileProcessControllerIntegrationJUnitTest {
// when: status is called in one thread and json is written to the file
AtomicReference<String> status = new AtomicReference<String>();
AtomicReference<Exception> exception = new AtomicReference<Exception>();
- ExecutorService executor = Executors.newSingleThreadExecutor();
- executor.execute(new Runnable() {
+ this.executor = Executors.newSingleThreadExecutor();
+ this.executor.execute(new Runnable() {
@Override
public void run() {
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
index 05b2d8e..7bfde5b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.management.internal.cli;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePort.*;
import static org.junit.Assert.*;
import java.io.IOException;
@@ -29,8 +31,6 @@ import org.junit.rules.TestName;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@@ -49,15 +49,15 @@ public class HeadlessGfshIntegrationTest {
@SuppressWarnings({"deprecation"})
@Test
public void testHeadlessGfshTest() throws ClassNotFoundException, IOException, InterruptedException {
- int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ int port = getRandomAvailablePort(SOCKET);
Properties properties = new Properties();
- properties.put(DistributionConfig.NAME_NAME, this.testName.getMethodName());
- properties.put(DistributionConfig.JMX_MANAGER_NAME, "true");
- properties.put(DistributionConfig.JMX_MANAGER_START_NAME, "true");
- properties.put(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(port));
- properties.put(DistributionConfig.HTTP_SERVICE_PORT_NAME, "0");
- properties.put(DistributionConfig.MCAST_PORT_NAME, "0");
+ properties.put(NAME_NAME, this.testName.getMethodName());
+ properties.put(JMX_MANAGER_NAME, "true");
+ properties.put(JMX_MANAGER_START_NAME, "true");
+ properties.put(JMX_MANAGER_PORT_NAME, String.valueOf(port));
+ properties.put(HTTP_SERVICE_PORT_NAME, "0");
+ properties.put(MCAST_PORT_NAME, "0");
DistributedSystem ds = DistributedSystem.connect(properties);
GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.create(ds);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
index 4d41189..9390ba0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
@@ -16,7 +16,9 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import static com.gemstone.gemfire.test.dunit.Wait.*;
@@ -35,7 +37,6 @@ import com.gemstone.gemfire.cache.LoaderHelper;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.management.DistributedRegionMXBean;
import com.gemstone.gemfire.management.ManagementService;
import com.gemstone.gemfire.management.ManagerMXBean;
@@ -46,7 +47,6 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
import com.gemstone.gemfire.management.internal.cli.result.ResultData;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
@@ -56,7 +56,6 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* The GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest class is test suite of test cases testing the Gfsh
* 'get' data command when a cache miss occurs on data in a Region with a CacheLoader defined.
- * <p>
*
* @see com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase
* @see com.gemstone.gemfire.management.internal.cli.commands.DataCommands
@@ -71,12 +70,63 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
private static final String GEMFIRE_LOG_LEVEL = System.getProperty("logLevel", "config");
private static final String USERS_REGION_NAME = "Users";
- protected static String getRegionPath(final String regionName) {
- return (regionName.startsWith(Region.SEPARATOR) ? regionName : String.format("%1$s%2$s", Region.SEPARATOR,
- regionName));
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ Properties managerDistributedSystemProperties = createDistributedSystemProperties(GEMFIRE_MANAGER_NAME);
+ HeadlessGfsh gfsh = createDefaultSetup(managerDistributedSystemProperties);
+
+ assertNotNull(gfsh);
+ assertTrue(gfsh.isConnectedAndReady());
+
+ setupGemFire();
+ verifyGemFireSetup(createPeer(getHost(0).getVM(0), managerDistributedSystemProperties));
+ }
+
+ @Test
+ public void testGetOnCacheMiss() {
+ doHousekeeping();
+
+ CommandStringBuilder command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "jonbloom");
+
+ assertResult(true, runCommand(command.toString()));
+
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "jondoe");
+ command.addOption(CliStrings.GET__LOAD, "false");
+
+ assertResult(false, runCommand(command.toString()));
+
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "jondoe");
+ command.addOption(CliStrings.GET__LOAD, "true");
+
+ assertResult(true, runCommand(command.toString()));
+
+ // NOTE test the unspecified default value for the --load-on-cache-miss
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "janedoe");
+
+ assertResult(true, runCommand(command.toString()));
+
+ // NOTE now test an absolute cache miss both for in the Region as well as the CacheLoader
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "nonexistinguser");
+ command.addOption(CliStrings.GET__LOAD, "true");
+
+ assertResult(false, runCommand(command.toString()));
+ }
+
+ private static String getRegionPath(final String regionName) {
+ return (regionName.startsWith(Region.SEPARATOR) ? regionName : String.format("%1$s%2$s", Region.SEPARATOR, regionName));
}
- protected static String toString(final Result result) {
+ private static String toString(final Result result) {
assert result != null : "The Result object from the command execution was null!";
StringBuilder buffer = new StringBuilder(System.getProperty("line.separator"));
@@ -89,39 +139,25 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
return buffer.toString();
}
- @Override
- public final void postSetUpCliCommandTestBase() throws Exception {
- Properties managerDistributedSystemProperties = createDistributedSystemProperties(GEMFIRE_MANAGER_NAME);
- HeadlessGfsh gfsh = createDefaultSetup(managerDistributedSystemProperties);
-
- assertNotNull(gfsh);
- assertTrue(gfsh.isConnectedAndReady());
-
- setupGemFire();
- verifyGemFireSetup(createPeer(Host.getHost(0).getVM(0), managerDistributedSystemProperties));
- }
-
private void setupGemFire() throws Exception {
- initializePeer(createPeer(Host.getHost(0).getVM(1), createDistributedSystemProperties(GEMFIRE_SERVER_NAME)));
+ initializePeer(createPeer(getHost(0).getVM(1), createDistributedSystemProperties(GEMFIRE_SERVER_NAME)));
}
- protected Properties createDistributedSystemProperties(final String gemfireName) {
+ private Properties createDistributedSystemProperties(final String gemfireName) {
Properties distributedSystemProperties = new Properties();
- distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, GEMFIRE_LOG_LEVEL);
- distributedSystemProperties.setProperty(DistributionConfig.NAME_NAME, gemfireName);
+ distributedSystemProperties.setProperty(LOG_LEVEL_NAME, GEMFIRE_LOG_LEVEL);
+ distributedSystemProperties.setProperty(NAME_NAME, gemfireName);
return distributedSystemProperties;
}
- protected Peer createPeer(final VM vm, final Properties distributedSystemProperties) {
+ private Peer createPeer(final VM vm, final Properties distributedSystemProperties) {
return new Peer(vm, distributedSystemProperties);
}
- protected void initializePeer(final Peer peer) throws Exception {
- peer.run(new SerializableRunnable(
- String.format("Initializes the '%1$s' with the '%2$s' Region having a CacheLoader.", GEMFIRE_SERVER_NAME,
- USERS_REGION_NAME)) {
+ private void initializePeer(final Peer peer) throws Exception {
+ peer.run(new SerializableRunnable(String.format("Initializes the '%1$s' with the '%2$s' Region having a CacheLoader.", GEMFIRE_SERVER_NAME, USERS_REGION_NAME)) {
@Override
public void run() {
// create the GemFire Distributed System with custom distribution configuration properties and settings
@@ -161,16 +197,14 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
@Override
public boolean done() {
ManagerMXBean managerBean = managementService.getManagerMXBean();
- DistributedRegionMXBean usersRegionBean = managementService.getDistributedRegionMXBean(
- getRegionPath(USERS_REGION_NAME));
+ DistributedRegionMXBean usersRegionBean = managementService.getDistributedRegionMXBean(getRegionPath(USERS_REGION_NAME));
return !(managerBean == null || usersRegionBean == null);
}
@Override
public String description() {
- return String.format("Probing for the GemFire Manager '%1$s' and '%2$s' Region MXBeans...",
- manager.getName(), USERS_REGION_NAME);
+ return String.format("Probing for the GemFire Manager '%1$s' and '%2$s' Region MXBeans...", manager.getName(), USERS_REGION_NAME);
}
};
@@ -179,7 +213,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
});
}
- protected void doHousekeeping() {
+ private void doHousekeeping() {
runCommand(CliStrings.LIST_MEMBER);
runCommand(new CommandStringBuilder(CliStrings.DESCRIBE_MEMBER).addOption(CliStrings.DESCRIBE_MEMBER__IDENTIFIER,
@@ -191,16 +225,16 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
USERS_REGION_NAME).toString());
}
- protected void log(final Result result) {
+ private void log(final Result result) {
log("Result", toString(result));
}
- protected void log(final String tag, final String message) {
+ private void log(final String tag, final String message) {
//System.out.printf("%1$s (%2$s)%n", tag, message);
getLogWriter().info(String.format("%1$s (%2$s)%n", tag, message));
}
- protected CommandResult runCommand(final String command) {
+ private CommandResult runCommand(final String command) {
CommandResult result = executeCommand(command);
assertNotNull(result);
@@ -211,57 +245,16 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
return result;
}
- protected void assertResult(final boolean expectedResult, final CommandResult commandResult) {
+ private void assertResult(final boolean expectedResult, final CommandResult commandResult) {
if (ResultData.TYPE_COMPOSITE.equals(commandResult.getType())) {
- boolean actualResult = (Boolean) ((CompositeResultData) commandResult.getResultData()).retrieveSectionByIndex(
- 0).retrieveObject("Result");
+ boolean actualResult = (Boolean) ((CompositeResultData) commandResult.getResultData()).retrieveSectionByIndex(0).retrieveObject("Result");
assertEquals(expectedResult, actualResult);
} else {
fail(String.format("Expected composite result data; but was '%1$s'!%n", commandResult.getType()));
}
}
- @Test
- public void testGetOnCacheMiss() {
- doHousekeeping();
-
- CommandStringBuilder command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "jonbloom");
-
- assertResult(true, runCommand(command.toString()));
-
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "jondoe");
- command.addOption(CliStrings.GET__LOAD, "false");
-
- assertResult(false, runCommand(command.toString()));
-
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "jondoe");
- command.addOption(CliStrings.GET__LOAD, "true");
-
- assertResult(true, runCommand(command.toString()));
-
- // NOTE test the unspecified default value for the --load-on-cache-miss
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "janedoe");
-
- assertResult(true, runCommand(command.toString()));
-
- // NOTE now test an absolute cache miss both for in the Region as well as the CacheLoader
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "nonexistinguser");
- command.addOption(CliStrings.GET__LOAD, "true");
-
- assertResult(false, runCommand(command.toString()));
- }
-
- protected static final class Peer implements Serializable {
+ private static final class Peer implements Serializable {
private final Properties distributedSystemProperties;
private final VM vm;
@@ -277,7 +270,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
public String getName() {
- return getConfiguration().getProperty(DistributionConfig.NAME_NAME);
+ return getConfiguration().getProperty(NAME_NAME);
}
public VM getVm() {
@@ -305,7 +298,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
}
- protected static class User implements Serializable {
+ private static class User implements Serializable {
private final String username;
@@ -346,7 +339,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
}
- protected static class UserDataStoreCacheLoader implements CacheLoader<String, User>, Serializable {
+ private static class UserDataStoreCacheLoader implements CacheLoader<String, User>, Serializable {
private static final Map<String, User> userDataStore = new HashMap<String, User>(5);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
index 6fbe62d..fcf3fc7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
@@ -16,7 +16,9 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import java.io.Serializable;
@@ -31,10 +33,8 @@ import com.gemstone.gemfire.cache.DiskStore;
import com.gemstone.gemfire.cache.DiskStoreFactory;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
@@ -51,7 +51,49 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
@Category(DistributedTest.class)
public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBase {
- protected static String toString(final Result result) {
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ createDefaultSetup(null);
+ setupGemFire();
+ }
+
+ @Test
+ public void testListDiskStore() throws Exception {
+ final Result result = executeCommand(CliStrings.LIST_DISK_STORE);
+
+ assertNotNull(result);
+ getLogWriter().info(toString(result));
+ assertEquals(Result.Status.OK, result.getStatus());
+ }
+
+ @Test
+ public void testDescribeDiskStore() throws Exception {
+ final Result result = executeCommand(CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=producerData");
+
+ assertNotNull(result);
+ getLogWriter().info(toString(result));
+ assertEquals(Result.Status.OK, result.getStatus());
+ }
+
+ @Test
+ public void testDescribeDiskStoreWithInvalidMemberName() throws Exception {
+ final Result commandResult = executeCommand(CliStrings.DESCRIBE_DISK_STORE + " --member=badMemberName --name=producerData");
+
+ assertNotNull(commandResult);
+ assertEquals(Result.Status.ERROR, commandResult.getStatus());
+ assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "badMemberName"), toString(commandResult));
+ }
+
+ @Test
+ public void testDescribeDiskStoreWithInvalidDiskStoreName() {
+ final Result commandResult = executeCommand(CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=badDiskStoreName");
+
+ assertNotNull(commandResult);
+ assertEquals(Result.Status.ERROR, commandResult.getStatus());
+ assertEquals("A disk store with name (badDiskStoreName) was not found on member (producerServer).", toString(commandResult));
+ }
+
+ private static String toString(final Result result) {
assert result != null : "The Result object from the command execution cannot be null!";
final StringBuilder buffer = new StringBuilder(System.getProperty("line.separator"));
@@ -64,21 +106,13 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
return buffer.toString().trim();
}
- @Override
- public final void postSetUpCliCommandTestBase() throws Exception {
- createDefaultSetup(null);
- setupGemFire();
- }
-
- protected Peer createPeer(final Properties distributedSystemConfiguration, final VM vm) {
+ private Peer createPeer(final Properties distributedSystemConfiguration, final VM vm) {
return new Peer(distributedSystemConfiguration, vm);
}
- protected void setupGemFire() throws Exception {
- final Host host = Host.getHost(0);
-
- final VM vm1 = host.getVM(1);
- final VM vm2 = host.getVM(2);
+ private void setupGemFire() throws Exception {
+ final VM vm1 = getHost(0).getVM(1);
+ final VM vm2 = getHost(0).getVM(2);
final Peer peer1 = createPeer(createDistributedSystemProperties("consumerServer"), vm1);
final Peer peer2 = createPeer(createDistributedSystemProperties("producerServer"), vm2);
@@ -89,16 +123,16 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
createPersistentRegion(peer2, "producer-factory", "producerData");
}
- protected Properties createDistributedSystemProperties(final String gemfireName) {
+ private Properties createDistributedSystemProperties(final String gemfireName) {
final Properties distributedSystemProperties = new Properties();
- distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
- distributedSystemProperties.setProperty(DistributionConfig.NAME_NAME, gemfireName);
+ distributedSystemProperties.setProperty(LOG_LEVEL_NAME, getDUnitLogLevel());
+ distributedSystemProperties.setProperty(NAME_NAME, gemfireName);
return distributedSystemProperties;
}
- protected void createPersistentRegion(final Peer peer, final String regionName, final String diskStoreName) throws Exception {
+ private void createPersistentRegion(final Peer peer, final String regionName, final String diskStoreName) throws Exception {
peer.run(new SerializableRunnable("Creating Persistent Region for Member " + peer.getName()) {
@Override
public void run() {
@@ -124,48 +158,7 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
});
}
- @Test
- public void testListDiskStore() throws Exception {
- final Result result = executeCommand(CliStrings.LIST_DISK_STORE);
-
- assertNotNull(result);
- getLogWriter().info(toString(result));
- assertEquals(Result.Status.OK, result.getStatus());
- }
-
- @Test
- public void testDescribeDiskStore() throws Exception {
- final Result result = executeCommand(
- CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=producerData");
-
- assertNotNull(result);
- getLogWriter().info(toString(result));
- assertEquals(Result.Status.OK, result.getStatus());
- }
-
- @Test
- public void testDescribeDiskStoreWithInvalidMemberName() throws Exception {
- final Result commandResult = executeCommand(
- CliStrings.DESCRIBE_DISK_STORE + " --member=badMemberName --name=producerData");
-
- assertNotNull(commandResult);
- assertEquals(Result.Status.ERROR, commandResult.getStatus());
- assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "badMemberName"),
- toString(commandResult));
- }
-
- @Test
- public void testDescribeDiskStoreWithInvalidDiskStoreName() {
- final Result commandResult = executeCommand(
- CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=badDiskStoreName");
-
- assertNotNull(commandResult);
- assertEquals(Result.Status.ERROR, commandResult.getStatus());
- assertEquals("A disk store with name (badDiskStoreName) was not found on member (producerServer).",
- toString(commandResult));
- }
-
- protected static class Peer implements Serializable {
+ private static class Peer implements Serializable {
private final Properties distributedSystemConfiguration;
private final VM vm;
@@ -181,7 +174,7 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
}
public String getName() {
- return getDistributedSystemConfiguration().getProperty(DistributionConfig.NAME_NAME);
+ return getDistributedSystemConfiguration().getProperty(NAME_NAME);
}
public VM getVm() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa7106e0/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
index 84dc977..4182601 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
@@ -18,19 +18,19 @@ package com.gemstone.gemfire.management.internal.cli.commands;
import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+import static com.gemstone.gemfire.management.internal.cli.CliUtil.*;
+import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
import static com.gemstone.gemfire.test.dunit.Host.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
import static com.gemstone.gemfire.test.dunit.Wait.*;
import java.io.File;
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -43,9 +43,7 @@ import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
import com.gemstone.gemfire.internal.ClassBuilder;
import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.cli.Result.Status;
-import static com.gemstone.gemfire.management.internal.cli.CliUtil.*;
import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
-import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
import com.gemstone.gemfire.management.internal.configuration.SharedConfigurationTestUtils;
@@ -65,8 +63,58 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
private static final int TIMEOUT = 10000;
private static final int INTERVAL = 500;
- private File newDeployableJarFile = new File("DeployCommandsDUnit1.jar");
- private transient ClassBuilder classBuilder = new ClassBuilder();
+ private final String region1Name = "r1";
+ private final String region2Name = "r2";
+ private final String logLevel = "info";
+
+ private String groupName;
+
+ private String deployedJarName;
+ private File newDeployableJarFile;
+ private ClassBuilder classBuilder;
+
+ private String sharedConfigZipFileName;
+ private String startArchiveFileName;
+ private int[] ports;
+
+ private int locator1Port;
+ private String locator1Name;
+ private String locator1LogFilePath;
+
+ private int locator2Port;
+ private String locator2Name;
+ private String locator2LogFilePath;
+
+ private int locator1HttpPort;
+ private int locator1JmxPort;
+ private String locator1JmxHost;
+
+ @Override
+ protected final void postSetUpCliCommandTestBase() throws Exception {
+ disconnectAllFromDS();
+
+ this.groupName = getName();
+
+ this.deployedJarName = "DeployCommandsDUnit1.jar";
+ this.newDeployableJarFile = new File(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + deployedJarName);
+ this.classBuilder = new ClassBuilder();
+
+ this.sharedConfigZipFileName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "sharedConfig.zip";
+ this.startArchiveFileName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "stats.gfs";
+ this.ports = getRandomAvailableTCPPorts(4);
+
+ this.locator1Port = this.ports[0];
+ this.locator1Name = "locator1-" + this.locator1Port;
+ this.locator1LogFilePath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + this.locator1Port + ".log";
+
+ this.locator2Port = this.ports[1];
+ this.locator2Name = "Locator2-" + this.locator2Port;
+ this.locator2LogFilePath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + this.locator2Port + ".log";
+
+ this.locator1HttpPort = ports[2];
+ this.locator1JmxPort = ports[3];
+ this.locator1JmxHost = getIPLiteral();
+ }
@Override
public final void postTearDownCacheTestCase() throws Exception {
@@ -77,44 +125,12 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
@Test
public void testExportImportSharedConfiguration() throws IOException {
- disconnectAllFromDS();
-
- final String region1Name = "r1";
- final String region2Name = "r2";
- final String groupName = "testRegionSharedConfigGroup";
- final String sharedConfigZipFileName = "sharedConfig.zip";
- final String deployedJarName = "DeployCommandsDUnit1.jar";
- final String logLevel = "info";
- final String startArchiveFileName = "stats.gfs";
- final int[] ports = getRandomAvailableTCPPorts(3);
-
- // TODO Sourabh - the code below is similar to CliCommandTestBase.createDefaultSetup(..); we may want to consider
- // refactoring this and combine the duplicate code blocks using either the Template Method and/or Strategy design
- // patterns. We can talk about this.
// Start the Locator and wait for shared configuration to be available
-
- final int locator1Port = ports[0];
- final String locator1Name = "locator1-" + locator1Port;
VM locatorAndMgr = getHost(0).getVM(3);
- Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
+ Set<DistributedMember> normalMembers1 = (Set<DistributedMember>) locatorAndMgr.invoke(new SerializableCallable() {
@Override
public Object call() {
- int httpPort;
- int jmxPort;
- String jmxHost;
-
- try {
- jmxHost = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException ignore) {
- jmxHost = "localhost";
- }
-
- final int[] ports = getRandomAvailableTCPPorts(2);
-
- jmxPort = ports[0];
- httpPort = ports[1];
-
- final File locatorLogFile = new File("locator-" + locator1Port + ".log");
+ final File locatorLogFile = new File(locator1LogFilePath);
final Properties locatorProps = new Properties();
locatorProps.setProperty(NAME_NAME, locator1Name);
@@ -123,45 +139,36 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
locatorProps.setProperty(JMX_MANAGER_NAME, "true");
locatorProps.setProperty(JMX_MANAGER_START_NAME, "true");
- locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
- locatorProps.setProperty(JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
- locatorProps.setProperty(HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+ locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(locator1JmxHost));
+ locatorProps.setProperty(JMX_MANAGER_PORT_NAME, String.valueOf(locator1JmxPort));
+ locatorProps.setProperty(HTTP_SERVICE_PORT_NAME, String.valueOf(locator1HttpPort));
try {
final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return locator.isSharedConfigurationRunning();
}
-
@Override
public String description() {
return "Waiting for shared configuration to be started";
}
};
waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
} catch (IOException e) {
fail("Unable to create a locator with a shared configuration", e);
}
- final Object[] result = new Object[4];
- result[0] = jmxHost;
- result[1] = jmxPort;
- result[2] = httpPort;
- result[3] = getAllNormalMembers(CacheFactory.getAnyInstance());
-
- return result;
+ return getAllNormalMembers(CacheFactory.getAnyInstance());
}
});
HeadlessGfsh gfsh = getDefaultShell();
- String jmxHost = (String) result[0];
- int jmxPort = (Integer) result[1];
- int httpPort = (Integer) result[2];
- Set<DistributedMember> normalMembers1 = (Set<DistributedMember>) result[3]; // TODO: never used
+ shellConnect(locator1JmxHost, locator1JmxPort, locator1HttpPort, gfsh);
- shellConnect(jmxHost, jmxPort, httpPort, gfsh);
// Create a cache in VM 1
VM dataMember = getHost(0).getVM(1);
normalMembers1 = (Set<DistributedMember>) dataMember.invoke(new SerializableCallable() {
@@ -183,7 +190,7 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
this.classBuilder.writeJarFromName("DeployCommandsDUnitA", this.newDeployableJarFile);
// Deploy the JAR
- CommandResult cmdResult = executeCommand("deploy --jar=" + deployedJarName);
+ CommandResult cmdResult = executeCommand("deploy --jar=" + this.newDeployableJarFile.getCanonicalPath());
assertEquals(Result.Status.OK, cmdResult.getStatus());
//Create the region1 on the group
@@ -210,7 +217,7 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT, "32");
commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT, "49");
commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE, "120");
- commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE, startArchiveFileName);
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE, this.startArchiveFileName);
commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED, "true");
commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT, "10");
cmdResult = executeCommand(commandStringBuilder.getCommandString());
@@ -228,7 +235,7 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
assertEquals(Status.OK, cmdResult.getStatus());
commandStringBuilder = new CommandStringBuilder(EXPORT_SHARED_CONFIG);
- commandStringBuilder.addOption(EXPORT_SHARED_CONFIG__FILE, sharedConfigZipFileName);
+ commandStringBuilder.addOption(EXPORT_SHARED_CONFIG__FILE, this.sharedConfigZipFileName);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
resultString = commandResultToString(cmdResult);
getLogWriter().info("#SB Result\n");
@@ -237,7 +244,7 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
//Import into a running system should fail
commandStringBuilder = new CommandStringBuilder(IMPORT_SHARED_CONFIG);
- commandStringBuilder.addOption(IMPORT_SHARED_CONFIG__ZIP, sharedConfigZipFileName);
+ commandStringBuilder.addOption(IMPORT_SHARED_CONFIG__ZIP, this.sharedConfigZipFileName);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
assertEquals(Status.ERROR, cmdResult.getStatus());
@@ -268,19 +275,16 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
//Now execute import shared configuration
//Now import the shared configuration and it should succeed.
commandStringBuilder = new CommandStringBuilder(IMPORT_SHARED_CONFIG);
- commandStringBuilder.addOption(IMPORT_SHARED_CONFIG__ZIP, sharedConfigZipFileName);
+ commandStringBuilder.addOption(IMPORT_SHARED_CONFIG__ZIP, this.sharedConfigZipFileName);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
assertEquals(Status.OK, cmdResult.getStatus());
//Start a new locator , test if it has all the imported shared configuration artifacts
VM newLocator = getHost(0).getVM(2);
- final int locator2Port = ports[1];
- final String locator2Name = "Locator2-" + locator2Port;
-
newLocator.invoke(new SerializableRunnable() {
@Override
public void run() {
- final File locatorLogFile = new File("locator-" + locator2Port + ".log");
+ final File locatorLogFile = new File(locator2LogFilePath);
final Properties locatorProps = new Properties();
locatorProps.setProperty(NAME_NAME, locator2Name);
locatorProps.setProperty(MCAST_PORT_NAME, "0");
@@ -323,10 +327,5 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
}
}
});
-
- //Clean up -- TODO: move to tearDown
- File sharedConfigZipFile = new File(sharedConfigZipFileName);
- FileUtils.deleteQuietly(sharedConfigZipFile);
- FileUtils.deleteQuietly(newDeployableJarFile);
}
}