http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java index 10cafe3..8b87539 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java @@ -16,29 +16,10 @@ */ package com.gemstone.gemfire.distributed; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.PrintStream; -import java.lang.management.ManagementFactory; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import com.gemstone.gemfire.test.junit.runners.CategoryWithParameterizedRunnerFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.distributed.AbstractLauncher.Status; import com.gemstone.gemfire.distributed.LocatorLauncher.Builder; import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.DistributionLocator; import com.gemstone.gemfire.internal.GemFireVersion; @@ -51,9 +32,28 @@ import com.gemstone.gemfire.internal.process.ProcessType; import com.gemstone.gemfire.internal.process.ProcessUtils; import com.gemstone.gemfire.test.junit.categories.FlakyTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import com.gemstone.gemfire.test.junit.runners.CategoryWithParameterizedRunnerFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.lang.management.ManagementFactory; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + /** * Integration tests for launching a Locator in a forked process. * @@ -67,7 +67,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche protected volatile Process process; protected volatile ProcessStreamReader processOutReader; protected volatile ProcessStreamReader processErrReader; - + @Before public final void setUpLocatorLauncherRemoteTest() throws Exception { } @@ -91,7 +91,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche final ProcessControllerFactory factory = new ProcessControllerFactory(); assertTrue(factory.isAttachAPIFound()); } - + @Test @Ignore("TRAC bug #52304: test is broken and needs to be reworked") public void testRunningLocatorOutlivesForkingProcess() throws Exception { @@ -153,7 +153,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche public void testStartCreatesPidFile() throws Throwable { // build and start the locator final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -177,7 +177,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche .build(); try { waitForLocatorToStart(this.launcher); - + // validate the pid file and its contents this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName()); assertTrue(this.pidFile.exists()); @@ -185,9 +185,9 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(pid > 0); assertTrue(ProcessUtils.isProcessAlive(pid)); - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); - + // check the status final LocatorState locatorState = this.launcher.status(); assertNotNull(locatorState); @@ -195,7 +195,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche } catch (Throwable e) { this.errorCollector.addError(e); } - + // stop the locator try { assertEquals(Status.STOPPED, this.launcher.stop().getStatus()); @@ -220,10 +220,10 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName()); this.statusFile.createNewFile(); assertTrue(this.statusFile.exists()); - + // build and start the locator final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -260,9 +260,9 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche waitForFileToDelete(this.stopRequestFile); waitForFileToDelete(this.statusRequestFile); waitForFileToDelete(this.statusFile); - + // validate log file was created - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); } catch (Throwable e) { this.errorCollector.addError(e); @@ -286,7 +286,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche // build and start the locator final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -318,7 +318,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(ProcessUtils.isProcessAlive(pid)); assertFalse(pid == Integer.MAX_VALUE); - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); } catch (Throwable e) { this.errorCollector.addError(e); @@ -344,7 +344,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche // build and start the locator final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -379,7 +379,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(pid != otherPid); // validate log file was created - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); } catch (Throwable e) { this.errorCollector.addError(e); @@ -398,9 +398,9 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche public void testStartUsingPortInUseFails() throws Throwable { this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1); this.locatorPort = this.socket.getLocalPort(); - + final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -416,10 +416,12 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche String expectedString = "java.net.BindException"; AtomicBoolean outputContainedExpectedString = new AtomicBoolean(); - + this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start(); - this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start(); - this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start(); + this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()) + .inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start(); + this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()) + .inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start(); // wait for locator to start and fail final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() @@ -431,22 +433,22 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche } catch (Throwable e) { this.errorCollector.addError(e); } - + try { // check the status final LocatorState locatorState = dirLauncher.status(); assertNotNull(locatorState); assertEquals(Status.NOT_RESPONDING, locatorState.getStatus()); - - final String logFileName = getUniqueName()+".log"; + + final String logFileName = getUniqueName() + ".log"; assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); } catch (Throwable e) { this.errorCollector.addError(e); } - + // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines // or this test needs to use MainLauncher in ProcessWrapper - + // validate that output contained BindException this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true))); @@ -454,10 +456,10 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche LocatorState status = null; try { status = dirLauncher.stop(); - } catch (Throwable t) { + } catch (Throwable t) { // ignore } - + this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning()))); } @@ -468,15 +470,15 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1); this.locatorPort = this.socket.getLocalPort(); - + assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET)); assertTrue(this.socket.isBound()); assertFalse(this.socket.isClosed()); - + // launch locator final List<String> jvmArguments = getJvmArguments(); jvmArguments.add("-D" + DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.locatorPort); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -488,11 +490,13 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche command.add(LocatorLauncher.Command.START.getName()); command.add(getUniqueName()); command.add("--redirect-output"); - + this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start(); - this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start(); - this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start(); - + this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()) + .inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start(); + this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()) + .inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start(); + // wait for locator to start up final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()) @@ -503,23 +507,23 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche } catch (Throwable e) { this.errorCollector.addError(e); } - + try { // check the status final LocatorState locatorState = dirLauncher.status(); assertNotNull(locatorState); assertEquals(Status.NOT_RESPONDING, locatorState.getStatus()); - + // creation of log file seems to be random -- look into why sometime - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); } catch (Throwable e) { this.errorCollector.addError(e); } - + // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines // or this test needs to use MainLauncher in ProcessWrapper - + // validate that output contained BindException this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true))); @@ -527,10 +531,10 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche LocatorState status = null; try { status = dirLauncher.stop(); - } catch (Throwable t) { + } catch (Throwable t) { // ignore } - + this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning()))); } @@ -621,7 +625,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche @Test public void testStatusUsingPid() throws Throwable { final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -641,7 +645,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche // wait for locator to start int pid = 0; - LocatorLauncher pidLauncher = null; + LocatorLauncher pidLauncher = null; final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()) .build(); @@ -656,7 +660,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(ProcessUtils.isProcessAlive(pid)); // validate log file was created - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); // use launcher with pid @@ -677,7 +681,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertEquals(jvmArguments, actualStatus.getJvmArguments()); assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath()); assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion()); - assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion()); + assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion()); assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile()); assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost()); assertEquals(getUniqueName(), actualStatus.getMemberName()); @@ -691,10 +695,10 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertEquals(Status.STOPPED, dirLauncher.stop().getStatus()); } else { assertEquals(Status.STOPPED, pidLauncher.stop().getStatus()); - } + } waitForPidToStop(pid); waitForFileToDelete(this.pidFile); - + } catch (Throwable e) { this.errorCollector.addError(e); } @@ -704,7 +708,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche @Test public void testStatusUsingWorkingDirectory() throws Throwable { final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -738,7 +742,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(ProcessUtils.isProcessAlive(pid)); // validate log file was created - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); assertNotNull(dirLauncher); @@ -754,7 +758,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertEquals(jvmArguments, actualStatus.getJvmArguments()); assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath()); assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion()); - assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion()); + assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion()); assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile()); assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost()); assertEquals(getUniqueName(), actualStatus.getMemberName()); @@ -770,12 +774,12 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche this.errorCollector.addError(e); } } - + @Test public void testStatusWithEmptyPidFile() throws Exception { this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName()); assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile()); - + final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()) .build(); @@ -792,7 +796,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertThat(actualStatus.getHost(), is(nullValue())); assertThat(actualStatus.getMemberName(), is(nullValue())); } - + @Test public void testStatusWithNoPidFile() throws Exception { final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() @@ -801,14 +805,14 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche LocatorState locatorState = dirLauncher.status(); assertEquals(Status.NOT_RESPONDING, locatorState.getStatus()); } - + @Test public void testStatusWithStalePidFile() throws Exception { this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName()); final int pid = 0; assertFalse(ProcessUtils.isProcessAlive(pid)); writePid(this.pidFile, pid); - + final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()) .build(); @@ -825,11 +829,11 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertThat(actualStatus.getHost(), is(nullValue())); assertThat(actualStatus.getMemberName(), is(nullValue())); } - + @Test public void testStopUsingPid() throws Throwable { final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -844,12 +848,14 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche command.add("--redirect-output"); this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start(); - this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start(); - this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start(); + this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()) + .inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start(); + this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()) + .inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start(); // wait for locator to start int pid = 0; - LocatorLauncher pidLauncher = null; + LocatorLauncher pidLauncher = null; final LocatorLauncher dirLauncher = new LocatorLauncher.Builder() .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()) .build(); @@ -864,7 +870,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(ProcessUtils.isProcessAlive(pid)); // validate log file was created - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); // use launcher with pid @@ -891,10 +897,10 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertEquals(Status.STOPPED, dirLauncher.stop().getStatus()); } else { assertEquals(Status.STOPPED, pidLauncher.stop().getStatus()); - } + } waitForPidToStop(pid); waitForFileToDelete(pidFile); - + } catch (Throwable e) { this.errorCollector.addError(e); } @@ -904,7 +910,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche @Test public void testStopUsingWorkingDirectory() throws Throwable { final List<String> jvmArguments = getJvmArguments(); - + final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); for (String jvmArgument : jvmArguments) { @@ -938,7 +944,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertTrue(ProcessUtils.isProcessAlive(pid)); // validate log file was created - final String logFileName = getUniqueName()+".log"; + final String logFileName = getUniqueName() + ".log"; assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists()); } catch (Throwable e) { @@ -950,7 +956,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche assertEquals(Status.STOPPED, dirLauncher.stop().getStatus()); waitForPidToStop(pid); assertFalse("PID file still exists!", this.pidFile.exists()); - + } catch (Throwable e) { this.errorCollector.addError(e); } @@ -974,16 +980,16 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getAbsolutePath()); command.add("-cp"); command.add(System.getProperty("java.class.path")); - command.add("-Dgemfire.mcast-port=0"); + command.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "mcast-port=0"); command.add(LocatorLauncher.class.getName()); command.add(LocatorLauncher.Command.START.getName()); command.add(LocatorLauncherForkingProcess.class.getSimpleName() + "_Locator"); command.add("--port=" + port); command.add("--redirect-output"); - + logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main command: " + command); logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main starting..."); - + Process forkedProcess = new ProcessBuilder(command).start(); @SuppressWarnings("unused") @@ -998,8 +1004,7 @@ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLaunche logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main exiting..."); System.exit(0); - } - catch (Throwable t) { + } catch (Throwable t) { logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t); System.exit(-1); }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java index c54a238..29d9b4c 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java @@ -16,11 +16,11 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; - -import java.net.InetAddress; -import java.net.UnknownHostException; - +import com.gemstone.gemfire.distributed.LocatorLauncher.Builder; +import com.gemstone.gemfire.distributed.LocatorLauncher.Command; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.i18n.LocalizedStrings; +import com.gemstone.gemfire.test.junit.categories.UnitTest; import joptsimple.OptionException; import org.junit.Rule; import org.junit.Test; @@ -28,11 +28,10 @@ import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; -import com.gemstone.gemfire.distributed.LocatorLauncher.Builder; -import com.gemstone.gemfire.distributed.LocatorLauncher.Command; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.i18n.LocalizedStrings; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import java.net.InetAddress; +import java.net.UnknownHostException; + +import static org.junit.Assert.*; /** * The LocatorLauncherTest class is a test suite of test cases for testing the contract and functionality of @@ -315,18 +314,18 @@ public class LocatorLauncherTest { LocatorLauncher launcher = new Builder() .setCommand(LocatorLauncher.Command.START) .setMemberName(null) - .set(DistributionConfig.NAME_NAME, "locatorABC") + .set(SystemConfigurationProperties.NAME, "locatorABC") .build(); assertNotNull(launcher); assertEquals(LocatorLauncher.Command.START, launcher.getCommand()); assertNull(launcher.getMemberName()); - assertEquals("locatorABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME)); + assertEquals("locatorABC", launcher.getProperties().getProperty(SystemConfigurationProperties.NAME)); } @Test public void testBuildWithMemberNameSetInSystemPropertiesOnStart() { - System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "locatorXYZ"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + SystemConfigurationProperties.NAME, "locatorXYZ"); LocatorLauncher launcher = new Builder() .setCommand(LocatorLauncher.Command.START) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java index 25428b2..466b818 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java @@ -16,10 +16,6 @@ */ package com.gemstone.gemfire.distributed; -import java.util.Iterator; -import java.util.Properties; -import java.util.Set; - import com.gemstone.gemfire.distributed.internal.DM; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; @@ -29,6 +25,13 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import java.util.Iterator; +import java.util.Properties; +import java.util.Set; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; + /** * Tests the setting of Roles in a DistributedSystem * @@ -57,8 +60,8 @@ public class RoleDUnitTest extends DistributedTestCase { // final List rolesList = Arrays.asList(rolesArray); distributionProperties = new Properties(); - distributionProperties.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - distributionProperties.setProperty(DistributionConfig.LOCATORS_NAME, ""); + distributionProperties.setProperty(MCAST_PORT, "0"); + distributionProperties.setProperty(LOCATORS, ""); distributionProperties.setProperty(DistributionConfig.ROLES_NAME, rolesProp); InternalDistributedSystem system = getSystem(distributionProperties); @@ -153,8 +156,8 @@ public class RoleDUnitTest extends DistributedTestCase { final String rolesProp = "A,A"; Properties config = new Properties(); - config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - config.setProperty(DistributionConfig.LOCATORS_NAME, ""); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); config.setProperty(DistributionConfig.ROLES_NAME, rolesProp); distributionProperties = config; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java index 34d613d..49c6446 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java @@ -16,16 +16,11 @@ */ package com.gemstone.gemfire.distributed; -import static com.googlecode.catchexception.apis.BDDCatchException.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.BDDAssertions.then; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.net.InetAddress; -import java.util.Properties; - +import com.gemstone.gemfire.distributed.ServerLauncher.Builder; +import com.gemstone.gemfire.distributed.ServerLauncher.Command; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.i18n.LocalizedStrings; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.RestoreSystemProperties; @@ -33,11 +28,16 @@ import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.junit.rules.TestName; -import com.gemstone.gemfire.distributed.ServerLauncher.Builder; -import com.gemstone.gemfire.distributed.ServerLauncher.Command; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.i18n.LocalizedStrings; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.net.InetAddress; +import java.util.Properties; + +import static com.googlecode.catchexception.apis.BDDCatchException.caughtException; +import static com.googlecode.catchexception.apis.BDDCatchException.when; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.BDDAssertions.then; /** * Integration tests for ServerLauncher class. These tests may require file system and/or network I/O. @@ -183,8 +183,8 @@ public class ServerLauncherIntegrationTest { public void testBuildWithMemberNameSetInGemFirePropertiesOnStart() throws Exception { // given: gemfire.properties with a name Properties gemfireProperties = new Properties(); - gemfireProperties.setProperty(DistributionConfig.NAME_NAME, "server123"); - useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", gemfireProperties); + gemfireProperties.setProperty(SystemConfigurationProperties.NAME, "server123"); + useGemFirePropertiesFileInTemporaryFolder(DistributionConfig.GEMFIRE_PREFIX + "properties", gemfireProperties); // when: starting with null MemberName ServerLauncher launcher = new Builder() @@ -201,7 +201,7 @@ public class ServerLauncherIntegrationTest { @Test public void testBuildWithNoMemberNameOnStart() throws Exception { // given: gemfire.properties with no name - useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", new Properties()); + useGemFirePropertiesFileInTemporaryFolder(DistributionConfig.GEMFIRE_PREFIX + "properties", new Properties()); // when: no MemberName is specified when(new Builder() http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java index 52deb38..e8c1afb 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java @@ -16,22 +16,6 @@ */ package com.gemstone.gemfire.distributed; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.lang.management.ManagementFactory; -import java.net.BindException; -import java.net.InetAddress; - -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.DataPolicy; import com.gemstone.gemfire.cache.Scope; @@ -51,6 +35,23 @@ import com.gemstone.gemfire.internal.process.ProcessControllerFactory; import com.gemstone.gemfire.internal.process.ProcessType; import com.gemstone.gemfire.internal.process.ProcessUtils; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.lang.management.ManagementFactory; +import java.net.BindException; +import java.net.InetAddress; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.*; /** * Integration tests for ServerLauncher as a local API in the local JVM. @@ -91,7 +92,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setWorkingDirectory(rootFolder) .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true") .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0") + .set(MCAST_PORT, "0") .build(); assertNotNull(this.launcher); @@ -109,8 +110,8 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn assertNotNull(distributedSystem); assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME)); assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME)); - assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME)); - assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME)); + assertEquals("0", distributedSystem.getProperties().getProperty(MCAST_PORT)); + assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(SystemConfigurationProperties.NAME)); } catch (Throwable e) { this.errorCollector.addError(e); @@ -141,7 +142,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); assertNotNull(this.launcher); @@ -197,7 +198,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); @@ -252,7 +253,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); @@ -301,7 +302,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); @@ -357,7 +358,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); @@ -414,7 +415,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setMemberName(getUniqueName()) .setRedirectOutput(true) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "0"); assertTrue(builder.getForce()); this.launcher = builder.build(); @@ -497,7 +498,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setServerPort(freeTCPPorts[1]) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); this.launcher.start(); @@ -566,7 +567,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setServerPort(this.serverPort) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); this.launcher.start(); @@ -616,7 +617,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); @@ -695,7 +696,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setMemberName(getUniqueName()) .setRedirectOutput(true) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); @@ -777,7 +778,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setServerPort(freeTCPPort) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); this.launcher = builder.build(); @@ -837,7 +838,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); @@ -903,7 +904,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); @@ -969,7 +970,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); @@ -1026,7 +1027,7 @@ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIn .setRedirectOutput(true) .setWorkingDirectory(rootFolder) .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0"); + .set(MCAST_PORT, "0"); assertFalse(builder.getForce()); this.launcher = builder.build(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java index ace30d7..c2ccf2f 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java @@ -16,28 +16,6 @@ */ package com.gemstone.gemfire.distributed; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.lang.management.ManagementFactory; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.DataPolicy; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.AbstractLauncher.Status; @@ -54,14 +32,23 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator; import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation; import com.gemstone.gemfire.internal.logging.InternalLogWriter; import com.gemstone.gemfire.internal.logging.LocalLogWriter; -import com.gemstone.gemfire.internal.process.PidUnavailableException; -import com.gemstone.gemfire.internal.process.ProcessControllerFactory; -import com.gemstone.gemfire.internal.process.ProcessStreamReader; -import com.gemstone.gemfire.internal.process.ProcessType; -import com.gemstone.gemfire.internal.process.ProcessUtils; +import com.gemstone.gemfire.internal.process.*; import com.gemstone.gemfire.test.junit.categories.FlakyTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import com.gemstone.gemfire.test.process.ProcessWrapper; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.*; +import java.lang.management.ManagementFactory; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; /** * Integration tests for launching a Server in a forked process. @@ -656,7 +643,7 @@ public class ServerLauncherRemoteIntegrationTest extends AbstractServerLauncherR // launch server and specify a different port final List<String> jvmArguments = getJvmArguments(); - jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath()); + jvmArguments.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "" + DistributionConfig.CACHE_XML_FILE_NAME + "=" + cacheXmlFile.getCanonicalPath()); final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); @@ -741,7 +728,7 @@ public class ServerLauncherRemoteIntegrationTest extends AbstractServerLauncherR // launch server and specify a different port final List<String> jvmArguments = getJvmArguments(); - jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath()); + jvmArguments.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "" + DistributionConfig.CACHE_XML_FILE_NAME + "=" + cacheXmlFile.getCanonicalPath()); final List<String> command = new ArrayList<String>(); command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath()); @@ -1311,8 +1298,8 @@ public class ServerLauncherRemoteIntegrationTest extends AbstractServerLauncherR @Override protected List<String> getJvmArguments() { final List<String> jvmArguments = new ArrayList<String>(); - jvmArguments.add("-Dgemfire.log-level=config"); - jvmArguments.add("-Dgemfire.mcast-port=0"); + jvmArguments.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "log-level=config"); + jvmArguments.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "mcast-port=0"); return jvmArguments; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java index b8f4a0c..864d8f9 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java @@ -16,14 +16,14 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Collections; -import java.util.concurrent.atomic.AtomicBoolean; - +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.server.CacheServer; +import com.gemstone.gemfire.distributed.ServerLauncher.Builder; +import com.gemstone.gemfire.distributed.ServerLauncher.Command; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.distributed.support.DistributedSystemAdapter; +import com.gemstone.gemfire.internal.i18n.LocalizedStrings; +import com.gemstone.gemfire.test.junit.categories.UnitTest; import edu.umd.cs.mtc.MultithreadedTestCase; import edu.umd.cs.mtc.TestFramework; import org.jmock.Expectations; @@ -38,14 +38,13 @@ import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.server.CacheServer; -import com.gemstone.gemfire.distributed.ServerLauncher.Builder; -import com.gemstone.gemfire.distributed.ServerLauncher.Command; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.support.DistributedSystemAdapter; -import com.gemstone.gemfire.internal.i18n.LocalizedStrings; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Collections; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.junit.Assert.*; /** * The ServerLauncherTest class is a test suite of unit tests testing the contract, functionality and invariants @@ -501,18 +500,18 @@ public class ServerLauncherTest { ServerLauncher launcher = new Builder() .setCommand(ServerLauncher.Command.START) .setMemberName(null) - .set(DistributionConfig.NAME_NAME, "serverABC") + .set(SystemConfigurationProperties.NAME, "serverABC") .build(); assertNotNull(launcher); assertEquals(ServerLauncher.Command.START, launcher.getCommand()); assertNull(launcher.getMemberName()); - assertEquals("serverABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME)); + assertEquals("serverABC", launcher.getProperties().getProperty(SystemConfigurationProperties.NAME)); } @Test public void testBuildWithMemberNameSetInSystemPropertiesOnStart() { - System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "serverXYZ"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + SystemConfigurationProperties.NAME, "serverXYZ"); ServerLauncher launcher = new Builder() .setCommand(ServerLauncher.Command.START) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java index f04c7cf..e40d287 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java @@ -16,20 +16,19 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; - +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.distributed.AbstractLauncher.Status; +import com.gemstone.gemfire.distributed.ServerLauncher.Builder; +import com.gemstone.gemfire.internal.process.ProcessType; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.mockito.Mockito; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.distributed.AbstractLauncher.Status; -import com.gemstone.gemfire.distributed.ServerLauncher.Builder; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.process.ProcessType; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * Extracted from ServerLauncherLocalIntegrationTest. @@ -60,7 +59,7 @@ public class ServerLauncherWithProviderIntegrationTest extends AbstractServerLau .setForce(true) .setMemberName(getUniqueName()) .setSpringXmlLocation("spring/spring-gemfire-context.xml") - .set(DistributionConfig.MCAST_PORT_NAME, "0") + .set(MCAST_PORT, "0") .build(); assertNotNull(this.launcher); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java index d906c09..7eaa5e2 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java @@ -15,32 +15,18 @@ * limitations under the License. */ package com.gemstone.gemfire.distributed.internal; - + +import com.gemstone.gemfire.DataSerializable; +import com.gemstone.gemfire.ToDataException; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.cache30.CacheTestCase; +import com.gemstone.gemfire.test.dunit.*; + import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; import java.util.Properties; -import com.gemstone.gemfire.*; -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.InterestPolicy; -import com.gemstone.gemfire.cache.PartitionAttributes; -import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.SubscriptionAttributes; -import com.gemstone.gemfire.cache30.CacheTestCase; -import com.gemstone.gemfire.internal.cache.lru.Sizeable; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.Invoke; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; - public class Bug40751DUnitTest extends CacheTestCase { public Bug40751DUnitTest(String name) { @@ -111,8 +97,8 @@ public class Bug40751DUnitTest extends CacheTestCase { public Properties getDistributedSystemProperties() { Properties props = new Properties(); System.setProperty("p2p.oldIO", "true"); - props.setProperty("conserve-sockets", "true"); - // props.setProperty("mcast-port", "12333"); + props.setProperty(DistributionConfig.CONSERVE_SOCKETS_NAME, "true"); + // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "12333"); // props.setProperty(DistributionConfig.DISABLE_TCP_NAME, "true"); return props; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java index 2aa9d27..99fd245 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java @@ -16,39 +16,19 @@ */ package com.gemstone.gemfire.distributed.internal; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Properties; -import java.util.Set; - import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.DistributedLockService; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.Config; -import com.gemstone.gemfire.internal.admin.Alert; -import com.gemstone.gemfire.internal.admin.AlertListener; -import com.gemstone.gemfire.internal.admin.ApplicationVM; -import com.gemstone.gemfire.internal.admin.DLockInfo; -import com.gemstone.gemfire.internal.admin.EntryValueNode; -import com.gemstone.gemfire.internal.admin.GemFireVM; -import com.gemstone.gemfire.internal.admin.GfManagerAgent; -import com.gemstone.gemfire.internal.admin.GfManagerAgentConfig; -import com.gemstone.gemfire.internal.admin.GfManagerAgentFactory; -import com.gemstone.gemfire.internal.admin.StatResource; +import com.gemstone.gemfire.internal.admin.*; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.IgnoredException; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.*; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Set; /** * This class tests the functionality of the {@linkplain com.gemstone.gemfire.internal.admin internal http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java index 8e1031f..6a23679 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java @@ -16,28 +16,23 @@ */ package com.gemstone.gemfire.distributed.internal; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.*; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.InternalGemFireException; import com.gemstone.gemfire.UnmodifiableException; import com.gemstone.gemfire.internal.ConfigSource; import com.gemstone.gemfire.management.internal.security.JSONAuthorization; import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.lang.reflect.Method; +import java.util.*; + +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; @Category(UnitTest.class) public class DistributionConfigJUnitTest { @@ -54,7 +49,7 @@ public class DistributionConfigJUnitTest { @Before public void before() { - classMap = new HashMap<Class<?>, Class<?>>(); + classMap = new HashMap<>(); classMap.put(boolean.class, Boolean.class); classMap.put(byte.class, Byte.class); classMap.put(short.class, Short.class); @@ -126,7 +121,6 @@ public class DistributionConfigJUnitTest { if(!attList.contains(attName)){ System.out.println("Has unused description for "+attName.toString()); } - //assertTrue("Has unused description for "+attName.toString(), attList.contains(attName)); } } @@ -239,8 +233,8 @@ public class DistributionConfigJUnitTest { } } assertEquals(modifiables.size(), 2); - assertEquals(modifiables.get(0), "http-service-port"); - assertEquals(modifiables.get(1), "jmx-manager-http-port"); + assertEquals(modifiables.get(0), DistributionConfig.HTTP_SERVICE_PORT_NAME); + assertEquals(modifiables.get(1), DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME); } @Test @@ -256,16 +250,16 @@ public class DistributionConfigJUnitTest { } assertEquals(modifiables.size(), 10); - assertEquals(modifiables.get(0), "archive-disk-space-limit"); - assertEquals(modifiables.get(1), "archive-file-size-limit"); - assertEquals(modifiables.get(2), "http-service-port"); - assertEquals(modifiables.get(3), "jmx-manager-http-port"); - assertEquals(modifiables.get(4), "log-disk-space-limit"); - assertEquals(modifiables.get(5), "log-file-size-limit"); - assertEquals(modifiables.get(6), "log-level"); - assertEquals(modifiables.get(7), "statistic-archive-file"); - assertEquals(modifiables.get(8), "statistic-sample-rate"); - assertEquals(modifiables.get(9), "statistic-sampling-enabled"); + assertEquals(modifiables.get(0), DistributionConfig.ARCHIVE_DISK_SPACE_LIMIT_NAME); + assertEquals(modifiables.get(1), DistributionConfig.ARCHIVE_FILE_SIZE_LIMIT_NAME); + assertEquals(modifiables.get(2), DistributionConfig.HTTP_SERVICE_PORT_NAME); + assertEquals(modifiables.get(3), DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME); + assertEquals(modifiables.get(4), DistributionConfig.LOG_DISK_SPACE_LIMIT_NAME); + assertEquals(modifiables.get(5), DistributionConfig.LOG_FILE_SIZE_LIMIT_NAME); + assertEquals(modifiables.get(6), DistributionConfig.LOG_LEVEL_NAME); + assertEquals(modifiables.get(7), DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME); + assertEquals(modifiables.get(8), DistributionConfig.STATISTIC_SAMPLE_RATE_NAME); + assertEquals(modifiables.get(9), DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME); } @Test(expected = IllegalArgumentException.class) @@ -275,18 +269,18 @@ public class DistributionConfigJUnitTest { @Test(expected = UnmodifiableException.class) public void testSetUnmodifiableAttributeObject() { - config.setAttributeObject("archive-disk-space-limit", 0, ConfigSource.api()); + config.setAttributeObject(DistributionConfig.ARCHIVE_DISK_SPACE_LIMIT_NAME, 0, ConfigSource.api()); } @Test public void testValidAttributeObject() { - config.setAttributeObject("http-service-port", 8080, ConfigSource.api()); + config.setAttributeObject(DistributionConfig.HTTP_SERVICE_PORT_NAME, 8080, ConfigSource.api()); assertEquals(config.getHttpServicePort(), 8080); } @Test(expected = IllegalArgumentException.class) public void testOutOfRangeAttributeObject() { - config.setAttributeObject("http-service-port", -1, ConfigSource.api()); + config.setAttributeObject(DistributionConfig.HTTP_SERVICE_PORT_NAME, -1, ConfigSource.api()); } @Test @@ -318,11 +312,11 @@ public class DistributionConfigJUnitTest { public void testAttributesAlwaysModifiable() { config.modifiable = false; assertTrue(config.isAttributeModifiable(DistributionConfig.HTTP_SERVICE_PORT_NAME)); - assertTrue(config.isAttributeModifiable("jmx-manager-http-port")); + assertTrue(config.isAttributeModifiable(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME)); config.modifiable = true; assertTrue(config.isAttributeModifiable(DistributionConfig.HTTP_SERVICE_PORT_NAME)); - assertTrue(config.isAttributeModifiable("jmx-manager-http-port")); + assertTrue(config.isAttributeModifiable(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME)); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java index d1487ee..325b3a2 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java @@ -16,29 +16,12 @@ */ package com.gemstone.gemfire.distributed.internal; -import java.net.InetAddress; -import java.util.Properties; - -import org.apache.logging.log4j.Logger; -import org.junit.Assert; - import com.gemstone.gemfire.LogWriter; -import com.gemstone.gemfire.admin.AdminDistributedSystem; -import com.gemstone.gemfire.admin.AdminDistributedSystemFactory; -import com.gemstone.gemfire.admin.Alert; -import com.gemstone.gemfire.admin.AlertLevel; -import com.gemstone.gemfire.admin.AlertListener; -import com.gemstone.gemfire.admin.DistributedSystemConfig; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheListener; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.EntryEvent; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionEvent; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.admin.*; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.MembershipManager; import com.gemstone.gemfire.distributed.internal.membership.NetView; @@ -46,15 +29,15 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManage import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager; import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager; import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.test.dunit.internal.JUnit3DistributedTestCase; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.IgnoredException; -import com.gemstone.gemfire.test.dunit.NetworkUtils; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.*; +import org.apache.logging.log4j.Logger; +import org.junit.Assert; + +import java.net.InetAddress; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.BIND_ADDRESS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * This class tests the functionality of the {@link @@ -144,7 +127,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { MembershipManager mgr = MembershipManagerHelper.getMembershipManager(sys); InternalDistributedMember idm = mgr.getLocalMember(); // TODO GMS needs to have a system property allowing the bind-port to be set - System.setProperty("gemfire.jg-bind-port", ""+idm.getPort()); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "jg-bind-port", "" + idm.getPort()); try { sys.disconnect(); sys = getSystem(); @@ -156,7 +139,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { assertTrue("should not have used a different udp port", idm.getPort() == idm2.getPort()); } finally { - System.getProperties().remove("gemfire.jg-bind-port"); + System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + "jg-bind-port"); } } @@ -265,14 +248,14 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { // in order to set a small ack-wait-threshold, we have to remove the // system property established by the dunit harness String oldAckWait = (String)System.getProperties() - .remove("gemfire." + DistributionConfig.ACK_WAIT_THRESHOLD_NAME); + .remove(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.ACK_WAIT_THRESHOLD_NAME); try { final Properties props = getDistributedSystemProperties(); - props.setProperty("mcast-port", "0"); + props.setProperty(MCAST_PORT, "0"); props.setProperty(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, "3"); props.setProperty(DistributionConfig.ACK_SEVERE_ALERT_THRESHOLD_NAME, "3"); - props.setProperty(DistributionConfig.NAME_NAME, "putter"); + props.setProperty(SystemConfigurationProperties.NAME, "putter"); getSystem(props); Region rgn = (new RegionFactory()) @@ -283,7 +266,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { vm1.invoke(new SerializableRunnable("Connect to distributed system") { public void run() { - props.setProperty(DistributionConfig.NAME_NAME, "sleeper"); + props.setProperty(SystemConfigurationProperties.NAME, "sleeper"); getSystem(props); IgnoredException.addIgnoredException("elapsed while waiting for replies"); RegionFactory rf = new RegionFactory(); @@ -330,7 +313,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { } finally { if (oldAckWait != null) { - System.setProperty("gemfire." + DistributionConfig.ACK_WAIT_THRESHOLD_NAME, oldAckWait); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.ACK_WAIT_THRESHOLD_NAME, oldAckWait); } } } @@ -407,14 +390,14 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { // in order to set a small ack-wait-threshold, we have to remove the // system property established by the dunit harness String oldAckWait = (String)System.getProperties() - .remove("gemfire." + DistributionConfig.ACK_WAIT_THRESHOLD_NAME); + .remove(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.ACK_WAIT_THRESHOLD_NAME); try { final Properties props = getDistributedSystemProperties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); // loner + props.setProperty(MCAST_PORT, "0"); // loner props.setProperty(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, "5"); props.setProperty(DistributionConfig.ACK_SEVERE_ALERT_THRESHOLD_NAME, "5"); - props.setProperty(DistributionConfig.NAME_NAME, "putter"); + props.setProperty(SystemConfigurationProperties.NAME, "putter"); getSystem(props); Region rgn = (new RegionFactory()) @@ -425,7 +408,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { vm1.invoke(new SerializableRunnable("Connect to distributed system") { public void run() { - props.setProperty(DistributionConfig.NAME_NAME, "sleeper"); + props.setProperty(SystemConfigurationProperties.NAME, "sleeper"); getSystem(props); LogWriter log = basicGetSystem().getLogWriter(); log.info("<ExpectedException action=add>service failure</ExpectedException>"); @@ -502,7 +485,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { } finally { if (oldAckWait != null) { - System.setProperty("gemfire." + DistributionConfig.ACK_WAIT_THRESHOLD_NAME, oldAckWait); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.ACK_WAIT_THRESHOLD_NAME, oldAckWait); } } } @@ -515,9 +498,9 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { disconnectAllFromDS(); final Properties props = getDistributedSystemProperties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); // loner + props.setProperty(MCAST_PORT, "0"); // loner // use a valid address that's not proper for this machine - props.setProperty(DistributionConfig.BIND_ADDRESS_NAME, "www.yahoo.com"); + props.setProperty(BIND_ADDRESS, "www.yahoo.com"); props.setProperty(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, "5"); props.setProperty(DistributionConfig.ACK_SEVERE_ALERT_THRESHOLD_NAME, "5"); try { @@ -526,14 +509,14 @@ public class DistributionManagerDUnitTest extends DistributedTestCase { com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("caught expected exception (1)", e); } // use an invalid address - props.setProperty(DistributionConfig.BIND_ADDRESS_NAME, "bruce.schuchardt"); + props.setProperty(BIND_ADDRESS, "bruce.schuchardt"); try { getSystem(props); } catch (IllegalArgumentException e) { com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("caught expected exception (2_", e); } // use a valid bind address - props.setProperty(DistributionConfig.BIND_ADDRESS_NAME, InetAddress.getLocalHost().getCanonicalHostName()); + props.setProperty(BIND_ADDRESS, InetAddress.getLocalHost().getCanonicalHostName()); getSystem().disconnect(); }
