You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/12/07 21:52:01 UTC

geode git commit: wip

Repository: geode
Updated Branches:
  refs/heads/cluster-config-cleanup [created] 93399b961


wip

wip

wip


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/93399b96
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/93399b96
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/93399b96

Branch: refs/heads/cluster-config-cleanup
Commit: 93399b961f002a5b4c3e3a84c1e71d36a808ef9b
Parents: 4876c78
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Tue Dec 6 14:08:14 2016 -0800
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Wed Dec 7 13:50:55 2016 -0800

----------------------------------------------------------------------
 .../internal/DistributionConfig.java            |   2 +-
 .../ConnectToLocatorSSLDUnitTest.java           |   2 +-
 .../configuration/ClusterConfigDUnitTest.java   | 247 +++++++++++++++++++
 .../ClusterConfigWithoutSecurityDUnitTest.java  |   2 +-
 .../security/PeerAuthenticatorDUnitTest.java    |   4 +-
 ...eerSecurityWithEmbeddedLocatorDUnitTest.java |   8 +-
 .../SecurityClusterConfigDUnitTest.java         |   2 +-
 .../SecurityWithoutClusterConfigDUnitTest.java  |   2 +-
 .../security/StartServerAuthorizationTest.java  |  21 +-
 .../dunit/rules/LocatorServerStartupRule.java   |  74 ++++--
 .../test/dunit/rules/ServerStarterRule.java     |  10 +-
 .../internal/configuration/cluster_config.zip   | Bin 0 -> 4666 bytes
 .../LuceneClusterConfigurationDUnitTest.java    |   4 +-
 13 files changed, 329 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
index 5eb070d..c2a395d 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
@@ -384,7 +384,7 @@ public interface DistributionConfig extends Config, LogConfig {
    * Default will be the current working directory as determined by
    * <code>System.getProperty("user.dir")</code>.
    */
-  File DEFAULT_DEPLOY_WORKING_DIR = new File(".");
+  File DEFAULT_DEPLOY_WORKING_DIR = new File(System.getProperty("user.dir"));
 
   /**
    * Returns the value of the {@link ConfigurationProperties#USER_COMMAND_PACKAGES} property

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
index 751425a..fa3b781 100644
--- a/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/ConnectToLocatorSSLDUnitTest.java
@@ -83,7 +83,7 @@ public class ConnectToLocatorSSLDUnitTest extends JUnit4DistributedTestCase {
   }
 
   public void setUpLocatorAndConnect(Properties securityProps) throws Exception {
-    lsRule.getLocatorVM(0, securityProps);
+    lsRule.startLocatorVM(0, securityProps);
 
     // saving the securityProps to a file
     OutputStream out = new FileOutputStream(securityPropsFile);

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDUnitTest.java
new file mode 100644
index 0000000..6703f5a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDUnitTest.java
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geode.management.internal.configuration;
+
+
+import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_CONFIGURATION_DIR;
+import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOAD_CLUSTER_CONFIGURATION_FROM_DIR;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE_SIZE_LIMIT;
+import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.SharedConfiguration;
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.management.internal.configuration.domain.Configuration;
+import org.apache.geode.management.internal.configuration.utils.ZipUtils;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Properties;
+
+@Category(DistributedTest.class)
+public class ClusterConfigDUnitTest extends JUnit4DistributedTestCase {
+  // cluster: {maxLogFileSize: 5000, regions: regionForCluster }, group1: { regions:
+
+  private static final ExpectedConfiguration
+      EXPECTED_CLUSTER_CONFIG =
+      new ExpectedConfiguration("5000",
+          new String[]{"regionForCluster"},
+          new String[]{"cluster.jar"});
+  private static final ExpectedConfiguration
+      EXPECTED_GROUP1_CONFIG =
+      new ExpectedConfiguration("6000",
+          new String[]{"regionForCluster", "regionForGroup1"},
+          new String[]{"cluster.jar", "group1.jar"});
+  private static final ExpectedConfiguration
+      EXPECTED_GROUP2_CONFIG =
+      new ExpectedConfiguration("7000",
+          new String[]{"regionForCluster", "regionForGroup2"},
+          new String[]{"cluster.jar", "group2.jar"});
+  private static final ExpectedConfiguration
+      EXPECTED_GROUP1and2_CONFIG =
+      new ExpectedConfiguration("7000",
+          new String[]{"regionForCluster", "regionForGroup1", "regionForGroup2"},
+          new String[]{"cluster.jar", "group1.jar", "group2.jar"});
+
+  private static final String[] CONFIG_NAMES = new String[]{"cluster", "group1", "group2"};
+
+
+  private static class ExpectedConfiguration {
+    public String maxLogFileSize;
+    public String[] regions;
+    public String[] jars;
+
+    public ExpectedConfiguration(String maxLogFileSize, String[] regions, String[] jars) {
+      this.maxLogFileSize = maxLogFileSize;
+      this.regions = regions;
+      this.jars = jars;
+    }
+  }
+
+
+  private static final String EXPORTED_CLUSTER_CONFIG_ZIP = "cluster_config.zip";
+  private String locatorString = null;
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Before
+  // starts up locator-0 with --load-cluster-coniguration-from-dir and verify it's loaded
+  public void before() throws Exception {
+    File locator0Dir = lsRule.getRootFolder().newFolder("locator-0");
+    // unzip the cluster_config.zip into the tempFolder/locator-0
+    // the content is tempFolder/locator-0/cluster_config/cluster...
+    ZipUtils.unzip(getClass().getResource(EXPORTED_CLUSTER_CONFIG_ZIP).getPath(),
+        locator0Dir.getCanonicalPath());
+
+    // start the locator with --load-from-configuration-dir=true
+    Properties locator0Props = new Properties();
+    locator0Props.setProperty(LOAD_CLUSTER_CONFIGURATION_FROM_DIR, "true");
+    locator0Props.setProperty(CLUSTER_CONFIGURATION_DIR,
+        locator0Dir.getCanonicalPath());
+    locator0Props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+    VM locator0 = lsRule.startLocatorVM(0, locator0Props);
+    verifyConfigFilesExistOnLocator(lsRule.getWorkingDir(0));
+    locatorString = "localhost[" + lsRule.getPort(0) + "]";
+
+    locator0.invoke(() -> {
+      InternalLocator locator = LocatorServerStartupRule.locatorStarter.locator;
+      verifyConfigExistInLocatorInternalRegion(locator.getSharedConfiguration());
+    });
+
+    verifyConfigFilesExistOnLocator(lsRule.getWorkingDir(0));
+  }
+
+  @Test
+  // verify another locator starts up and sc is loaded to this locator.
+  public void testLocatorStartup() throws IOException {
+    // start another locator and verify it gets the same cc as the first one.
+    Properties locator1Props = new Properties();
+    locator1Props.setProperty(LOCATORS, locatorString);
+    locator1Props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+    VM locator1 = lsRule.startLocatorVM(1, locator1Props);
+
+    locator1.invoke(() -> {
+      InternalLocator locator = LocatorServerStartupRule.locatorStarter.locator;
+      verifyConfigExistInLocatorInternalRegion(locator.getSharedConfiguration());
+    });
+
+    verifyConfigFilesExistOnLocator(lsRule.getWorkingDir(1));
+  }
+
+  @Test
+  // verify another server starts up and sc is loaded to this server
+  public void testServerStarup() throws Exception {
+    // start the server and verify the sc is applied correctly
+    Properties serverProps = new Properties();
+    serverProps.setProperty(LOCATORS, locatorString);
+    serverProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+    VM serverWithNoGroup = lsRule.startServerVM(1, serverProps);
+
+    // verify cluster config is applied
+    serverWithNoGroup.invoke(() -> this.verifyClusterConfig(EXPECTED_CLUSTER_CONFIG, lsRule.getWorkingDir(1)));
+
+    serverProps.setProperty(GROUPS, "group1");
+    VM serverForGroup1 = lsRule.startServerVM(2, serverProps);
+    serverForGroup1.invoke(() -> this.verifyClusterConfig(EXPECTED_GROUP1_CONFIG, lsRule.getWorkingDir(2)));
+
+    serverProps.setProperty(GROUPS, "group2");
+    VM serverForGroup2 = lsRule.startServerVM(3, serverProps);
+    serverForGroup2.invoke(() -> this.verifyClusterConfig(EXPECTED_GROUP2_CONFIG, lsRule.getWorkingDir(3)));
+  }
+
+  @Test
+  // verify another server starts up and sc is loaded to this server
+  public void testServerWithMultipleGroups() throws Exception {
+    // start the server and verify the sc is applied correctly
+    Properties serverProps = new Properties();
+    serverProps.setProperty(LOCATORS, locatorString);
+    serverProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+    serverProps.setProperty(GROUPS, "group1,group2");
+    VM serverWithNoGroup = lsRule.startServerVM(1, serverProps);
+
+    serverWithNoGroup.invoke(() -> this.verifyClusterConfig(EXPECTED_GROUP1and2_CONFIG, lsRule.getWorkingDir(1)));
+  }
+
+  private void verifyClusterConfig(ExpectedConfiguration expectedConfiguration, File workingDir)
+      throws ClassNotFoundException {
+    verifyConfigInMemory(expectedConfiguration);
+    verifyJarFilesExistOnServer(workingDir, expectedConfiguration.jars);
+  }
+
+  private void verifyConfigInMemory(ExpectedConfiguration expectedConfiguration)
+      throws ClassNotFoundException {
+    Cache cache = LocatorServerStartupRule.serverStarter.cache;
+    for (String region : expectedConfiguration.regions) {
+      assertThat(cache.getRegion(region)).isNotNull();
+    }
+    Properties props = cache.getDistributedSystem().getProperties();
+    assertThat(props.getProperty(LOG_FILE_SIZE_LIMIT))
+        .isEqualTo(expectedConfiguration.maxLogFileSize);
+
+    for (String jar : expectedConfiguration.jars) {
+      JarClassLoader jarClassLoader = findJarClassLoader(jar);
+      assertThat(jarClassLoader).isNotNull();
+      assertThat(jarClassLoader.loadClass(getNameOfClassInJar(jar))).isNotNull();
+    }
+  }
+
+  private JarClassLoader findJarClassLoader(final String jarName) {
+    Collection<ClassLoader> classLoaders = ClassPathLoader.getLatest().getClassLoaders();
+    for (ClassLoader classLoader : classLoaders) {
+      if (classLoader instanceof JarClassLoader
+          && ((JarClassLoader) classLoader).getJarName().equals(jarName)) {
+        return (JarClassLoader) classLoader;
+      }
+    }
+    return null;
+  }
+
+  private static void verifyConfigExistInLocatorInternalRegion(SharedConfiguration sc) throws Exception {
+    for (String configName : CONFIG_NAMES) {
+      Configuration config = sc.getConfiguration(configName);
+      assertThat(config).isNotNull();
+    }
+  }
+
+  private void verifyConfigFilesExistOnLocator(File workingDir) {
+    File cluster_config_dir = new File(workingDir, "cluster_config");
+    assertThat(cluster_config_dir).exists();
+
+    for (String configName : CONFIG_NAMES) {
+      File configDir = new File(cluster_config_dir, configName);
+      assertThat(configDir).exists();
+
+      File jar = new File(configDir, configName + ".jar");
+      File properties = new File(configDir, configName + ".properties");
+      File xml = new File(configDir, configName + ".xml");
+      assertThat(configDir.listFiles()).contains(jar, properties, xml);
+    }
+  }
+
+  private void verifyJarFilesExistOnServer(File workingDir, String[] jarNames) {
+    assertThat(workingDir.listFiles()).isNotEmpty();
+
+    for (String jarName : jarNames) {
+      assertThat(workingDir.listFiles())
+          .filteredOn((File file) -> file.getName().contains(jarName))
+          .isNotEmpty();
+    }
+  }
+
+  private String getNameOfClassInJar(String jarName) {
+    //We expect e.g. cluster.jar to contain a class named Cluster
+    return StringUtils.capitalize(jarName.replace(".jar", ""));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/security/ClusterConfigWithoutSecurityDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClusterConfigWithoutSecurityDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClusterConfigWithoutSecurityDUnitTest.java
index 1ad6799..2b3dd87 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClusterConfigWithoutSecurityDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClusterConfigWithoutSecurityDUnitTest.java
@@ -50,7 +50,7 @@ public class ClusterConfigWithoutSecurityDUnitTest extends JUnit4DistributedTest
         .addIgnoredException(LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION.toString());
     IgnoredException
         .addIgnoredException(LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION_2.toString());
-    lsRule.getLocatorVM(0, new Properties());
+    lsRule.startLocatorVM(0, new Properties());
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
index 90cc6f1..97fe1e4 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
@@ -42,7 +42,7 @@ public class PeerAuthenticatorDUnitTest extends JUnit4DistributedTestCase {
   public void before() throws Exception {
     Properties props = new Properties();
     props.setProperty(SECURITY_PEER_AUTHENTICATOR, DummyAuthenticator.class.getName());
-    lsRule.getLocatorVM(0, props);
+    lsRule.startLocatorVM(0, props);
   }
 
   @Test
@@ -52,7 +52,7 @@ public class PeerAuthenticatorDUnitTest extends JUnit4DistributedTestCase {
     Properties server1Props = new Properties();
     server1Props.setProperty("security-username", "user");
     server1Props.setProperty("security-password", "user");
-    lsRule.getServerVM(1, server1Props, locatorPort);
+    lsRule.startServerVM(1, server1Props, locatorPort);
 
 
     Properties server2Props = new Properties();

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
index d69e379..a7cc920 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
@@ -47,13 +47,13 @@ public class PeerSecurityWithEmbeddedLocatorDUnitTest extends JUnit4DistributedT
     Properties server0Props = new Properties();
     server0Props.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
     server0Props.setProperty("start-locator", "localhost[" + locatorPort + "]");
-    lsRule.getServerVM(0, server0Props);
+    lsRule.startServerVM(0, server0Props);
 
 
     Properties server1Props = new Properties();
     server1Props.setProperty("security-username", "cluster");
     server1Props.setProperty("security-password", "cluster");
-    lsRule.getServerVM(1, server1Props, locatorPort);
+    lsRule.startServerVM(1, server1Props, locatorPort);
 
     Properties server2Props = new Properties();
     server2Props.setProperty("security-username", "user");
@@ -75,13 +75,13 @@ public class PeerSecurityWithEmbeddedLocatorDUnitTest extends JUnit4DistributedT
     Properties server0Props = new Properties();
     server0Props.setProperty(SECURITY_PEER_AUTHENTICATOR, DummyAuthenticator.class.getName());
     server0Props.setProperty("start-locator", "localhost[" + locatorPort + "]");
-    lsRule.getServerVM(0, server0Props);
+    lsRule.startServerVM(0, server0Props);
 
 
     Properties server1Props = new Properties();
     server1Props.setProperty("security-username", "user");
     server1Props.setProperty("security-password", "user");
-    lsRule.getServerVM(1, server1Props, locatorPort);
+    lsRule.startServerVM(1, server1Props, locatorPort);
 
     Properties server2Props = new Properties();
     server2Props.setProperty("security-username", "bogus");

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
index 220449d..38e201a 100644
--- a/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
@@ -58,7 +58,7 @@ public class SecurityClusterConfigDUnitTest extends JUnit4DistributedTestCase {
     props.setProperty(JMX_MANAGER_START, "false");
     props.setProperty(JMX_MANAGER_PORT, 0 + "");
     props.setProperty(SECURITY_POST_PROCESSOR, PDXPostProcessor.class.getName());
-    lsRule.getLocatorVM(0, props);
+    lsRule.startLocatorVM(0, props);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/security/SecurityWithoutClusterConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SecurityWithoutClusterConfigDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/SecurityWithoutClusterConfigDUnitTest.java
index 17b1031..fe83a68 100644
--- a/geode-core/src/test/java/org/apache/geode/security/SecurityWithoutClusterConfigDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/SecurityWithoutClusterConfigDUnitTest.java
@@ -51,7 +51,7 @@ public class SecurityWithoutClusterConfigDUnitTest extends JUnit4DistributedTest
     props.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
     props.setProperty(SECURITY_POST_PROCESSOR, PDXPostProcessor.class.getName());
     props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
-    lsRule.getLocatorVM(0, props);
+    lsRule.startLocatorVM(0, props);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/security/StartServerAuthorizationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/StartServerAuthorizationTest.java b/geode-core/src/test/java/org/apache/geode/security/StartServerAuthorizationTest.java
index dfa0f3d..6fc1f4f 100644
--- a/geode-core/src/test/java/org/apache/geode/security/StartServerAuthorizationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/StartServerAuthorizationTest.java
@@ -15,22 +15,21 @@
 
 package org.apache.geode.security;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.Properties;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
+import java.util.Properties;
 
 @Category({DistributedTest.class, SecurityTest.class})
 public class StartServerAuthorizationTest extends JUnit4DistributedTestCase {
@@ -42,7 +41,7 @@ public class StartServerAuthorizationTest extends JUnit4DistributedTestCase {
   public void before() throws Exception {
     Properties props = new Properties();
     props.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
-    lsRule.getLocatorVM(0, props);
+    lsRule.startLocatorVM(0, props);
   }
 
   @Test
@@ -88,7 +87,7 @@ public class StartServerAuthorizationTest extends JUnit4DistributedTestCase {
     props.setProperty("security-username", "cluster");
     props.setProperty("security-password", "cluster");
 
-    lsRule.getServerVM(1, props);
+    lsRule.startServerVM(1, props);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
index 6053e1e..e2203d5 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
@@ -21,67 +21,84 @@ import static org.apache.geode.test.dunit.Host.getHost;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.Invoke;
 import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.rules.ExternalResource;
+import org.junit.rules.TemporaryFolder;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.Properties;
 
 
 /**
- * this rule can help you start up locator/server in different VMs you can multiple locators/servers
+ * this rule can help you start up locator/server in different VMs you can multiple members/servers
  * combination
  */
 public class LocatorServerStartupRule extends ExternalResource implements Serializable {
 
-  // these are only avaialbe in each VM
+  // these are only availabe in each VM
   public static ServerStarterRule serverStarter;
   public static LocatorStarterRule locatorStarter;
+
+  // these are available in test vm
   public int[] ports = new int[4];
+  public File[] workingDirs = new File[4];
   private Host host = getHost(0);
 
+  private TemporaryFolder temporaryFolder = new SerializableTemporaryFolder();
+
   @Before
-  public void before() {
-    after();
+  public void before() throws IOException {
+    temporaryFolder.create();
+    Invoke.invokeInEveryVM("Stop each VM", () -> stop());
   }
 
   @After
   public void after() {
-    stop();
+    temporaryFolder.delete();
     Invoke.invokeInEveryVM("Stop each VM", () -> stop());
   }
 
-  /**
-   * Returns getHost(0).getVM(0) as a locator instance with the given configuration properties.
-   * 
-   * @param locatorProperties
-   *
-   * @return VM locator vm
-   *
-   * @throws IOException
-   */
-  public VM getLocatorVM(int index, Properties locatorProperties) throws IOException {
+    /**
+     * Returns getHost(0).getVM(0) as a locator instance with the given configuration properties.
+     *
+     * @param locatorProperties
+     *
+     * @return VM locator vm
+     *
+     * @throws IOException
+     */
+  public VM startLocatorVM(int index, Properties locatorProperties) throws IOException {
+    String name = "locator-"+index;
+    File workingDir = new File(temporaryFolder.getRoot(), name);
+    if(!workingDir.exists()) {
+      temporaryFolder.newFolder(name);
+    }
     VM locatorVM = host.getVM(index);
-    locatorProperties.setProperty(NAME, "locator-" + index);
+    locatorProperties.setProperty(NAME, name);
     int locatorPort = locatorVM.invoke(() -> {
+      System.setProperty("user.dir", workingDir.getCanonicalPath());
       locatorStarter = new LocatorStarterRule(locatorProperties);
       locatorStarter.startLocator();
       return locatorStarter.locator.getPort();
     });
     ports[index] = locatorPort;
+    workingDirs[index] = workingDir;
     return locatorVM;
   }
 
   /**
    * starts a cache server that does not connect to a locator
-   * 
+   *
    * @return VM node vm
    */
 
-  public VM getServerVM(int index, Properties properties) {
-    return getServerVM(index, properties, 0);
+  public VM startServerVM(int index, Properties properties) throws IOException {
+    return startServerVM(index, properties, 0);
+
   }
 
   /**
@@ -92,15 +109,22 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
    * @param locatorPort
    * @return
    */
-  public VM getServerVM(int index, Properties properties, int locatorPort) {
+  public VM startServerVM(int index, Properties properties, int locatorPort) throws IOException {
+    String name = "server-"+index;
     VM nodeVM = getNodeVM(index);
-    properties.setProperty(NAME, "server-" + index);
+    File workingDir = new File(temporaryFolder.getRoot(), name);
+    if(!workingDir.exists()) {
+      temporaryFolder.newFolder(name);
+    }
+    properties.setProperty(NAME, name);
     int port = nodeVM.invoke(() -> {
+      System.setProperty("user.dir", workingDir.getCanonicalPath());
       serverStarter = new ServerStarterRule(properties);
       serverStarter.startServer(locatorPort);
       return serverStarter.server.getPort();
     });
     ports[index] = port;
+    workingDirs[index] = workingDir;
     return nodeVM;
   }
 
@@ -120,6 +144,14 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     return ports[index];
   }
 
+  public TemporaryFolder getRootFolder(){
+    return temporaryFolder;
+  }
+
+  public File getWorkingDir(int index) {
+    return workingDirs[index];
+  }
+
 
   public final void stop() {
     if (serverStarter != null) {

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
index 8da0778..7872961 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
@@ -66,10 +66,12 @@ public class ServerStarterRule extends ExternalResource implements Serializable
     if (!properties.containsKey(NAME)) {
       properties.setProperty(NAME, this.getClass().getName());
     }
-    if (locatorPort > 0) {
-      properties.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-    } else {
-      properties.setProperty(LOCATORS, "");
+    if(!properties.containsKey(LOCATORS)) {
+      if (locatorPort > 0) {
+        properties.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
+      } else {
+        properties.setProperty(LOCATORS, "");
+      }
     }
     if (properties.containsKey(JMX_MANAGER_PORT)) {
       int jmxPort = Integer.parseInt(properties.getProperty(JMX_MANAGER_PORT));

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/cluster_config.zip
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/cluster_config.zip b/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/cluster_config.zip
new file mode 100644
index 0000000..37cacbf
Binary files /dev/null and b/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/cluster_config.zip differ

http://git-wip-us.apache.org/repos/asf/geode/blob/93399b96/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
index 02b7fe4..5f794d8 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
@@ -234,7 +234,7 @@ public class LuceneClusterConfigurationDUnitTest extends CliCommandTestBase {
     if (addGroup) {
       nodeProperties.setProperty(GROUPS, groupName);
     }
-    return ls.getServerVM(vmIndex, nodeProperties, ls.getPort(0));
+    return ls.startServerVM(vmIndex, nodeProperties, ls.getPort(0));
   }
 
   private VM startLocatorWithClusterConfigurationEnabled() throws Exception {
@@ -258,7 +258,7 @@ public class LuceneClusterConfigurationDUnitTest extends CliCommandTestBase {
     locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
     locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
     locatorProps.setProperty(CLUSTER_CONFIGURATION_DIR, dir.getCanonicalPath());
-    return ls.getLocatorVM(0, locatorProps);
+    return ls.startLocatorVM(0, locatorProps);
   }
 
   private void createLuceneIndexUsingGfsh(boolean addGroup) throws Exception {