You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/04/22 18:56:33 UTC
incubator-geode git commit: More debugging
Repository: incubator-geode
Updated Branches:
refs/heads/feature/GEODE-1255 682c7e93e -> 504400191
More debugging
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/50440019
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/50440019
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/50440019
Branch: refs/heads/feature/GEODE-1255
Commit: 504400191c320a632dc53ed02fadd9f76564ab90
Parents: 682c7e9
Author: Kirk Lund <kl...@apache.org>
Authored: Fri Apr 22 09:56:21 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Apr 22 09:56:21 2016 -0700
----------------------------------------------------------------------
.../LocatorLauncherRemoteJUnitTest.java | 66 ++++++++++++++++++++
1 file changed, 66 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/50440019/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
index 7cf9087..f270fd0 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
@@ -278,6 +278,72 @@ public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnit
}
@Test
+ public void testStartUsesCustomLoggingConfigurationWithLauncherLifecycleCommands() throws Throwable {
+ // TODO: create working dir, copy custom xml to that dir and point log4j at it
+
+ // 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) {
+ command.add(jvmArgument);
+ }
+ command.add("-Dlog4j.configurationFile=/Users/klund/dev/gemfire/open/geode-core/src/test/resources/com/gemstone/gemfire/internal/logging/log4j/custom/log4j2.xml");
+ //command.add("-D" + ConfigurationFactory.CONFIGURATION_FILE_PROPERTY + "=/Users/klund/dev/doesnotexist.xml");
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ for (String line : command) {
+ System.out.println("KIRK:testStartUsesCustomLoggingConfiguration:stdout: " + line);
+ }
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(new ToSystemOut()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(new ToSystemOut()).build().start();
+
+ int pid = 0;
+ String workingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+ System.out.println("KIRK: workingDirectory=" + workingDirectory);
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(workingDirectory)
+ .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());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ 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);
+ assertEquals(Status.ONLINE, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
public void testStartDeletesStaleControlFiles() throws Throwable {
// create existing control files
this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());