http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java index b6bce88..e1aabc0 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java @@ -29,66 +29,33 @@ package com.gemstone.gemfire.cache30; -import java.io.IOException; -import java.io.Serializable; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.CountDownLatch; - -import junit.framework.AssertionFailedError; - -import org.junit.Ignore; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.CacheLoader; -import com.gemstone.gemfire.cache.CacheTransactionManager; -import com.gemstone.gemfire.cache.CommitConflictException; -import com.gemstone.gemfire.cache.CommitIncompleteException; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.DiskAccessException; -import com.gemstone.gemfire.cache.LoaderHelper; -import com.gemstone.gemfire.cache.MirrorType; -import com.gemstone.gemfire.cache.Operation; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.TimeoutException; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.ResourceEvent; import com.gemstone.gemfire.distributed.internal.ResourceEventsListener; import com.gemstone.gemfire.distributed.internal.locks.DLockBatch; import com.gemstone.gemfire.distributed.internal.locks.DLockService; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper; -import com.gemstone.gemfire.internal.cache.CommitReplyException; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.InternalRegionArguments; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.RegionEntry; -import com.gemstone.gemfire.internal.cache.TXManagerImpl; -import com.gemstone.gemfire.internal.cache.TXState; -import com.gemstone.gemfire.internal.cache.TXStateInterface; -import com.gemstone.gemfire.internal.cache.TXStateProxyImpl; -//import com.gemstone.gemfire.internal.cache.locks.TXLockId; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.cache.locks.TXLockBatch; import com.gemstone.gemfire.internal.cache.locks.TXLockService; import com.gemstone.gemfire.internal.cache.locks.TXLockServiceImpl; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.IgnoredException; -import com.gemstone.gemfire.test.dunit.Invoke; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.*; import com.gemstone.gemfire.test.junit.categories.FlakyTest; +import junit.framework.AssertionFailedError; +import org.junit.Ignore; +import org.junit.experimental.categories.Category; + +import java.io.IOException; +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.CountDownLatch; + +//import com.gemstone.gemfire.internal.cache.locks.TXLockId; public class TXDistributedDUnitTest extends CacheTestCase { public TXDistributedDUnitTest(String name) { @@ -526,7 +493,7 @@ public class TXDistributedDUnitTest extends CacheTestCase { @Override public Properties getDistributedSystemProperties() { Properties p = super.getDistributedSystemProperties(); - p.put("log-level", LogWriterUtils.getDUnitLogLevel()); + p.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); return p; }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java index 040d15f..aa87ad7 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java @@ -16,12 +16,8 @@ */ package com.gemstone.gemfire.distributed; -import static org.assertj.core.api.Assertions.*; - -import java.io.File; -import java.io.FileWriter; -import java.util.Properties; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -29,8 +25,11 @@ import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.junit.rules.TestName; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.io.File; +import java.io.FileWriter; +import java.util.Properties; + +import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests for AbstractLauncher class. These tests require file system I/O. @@ -49,10 +48,10 @@ public class AbstractLauncherIntegrationTest { @Before public void setUp() throws Exception { - this.gemfirePropertiesFile = this.temporaryFolder.newFile("gemfire.properties"); + this.gemfirePropertiesFile = this.temporaryFolder.newFile(DistributionConfig.GEMFIRE_PREFIX + "properties"); this.expectedGemfireProperties = new Properties(); - this.expectedGemfireProperties.setProperty(DistributionConfig.NAME_NAME, "memberOne"); + this.expectedGemfireProperties.setProperty(SystemConfigurationProperties.NAME, "memberOne"); this.expectedGemfireProperties.setProperty(DistributionConfig.GROUPS_NAME, "groupOne, groupTwo"); this.expectedGemfireProperties.store(new FileWriter(this.gemfirePropertiesFile, false), this.testName.getMethodName()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java index 5f4debd..128e1df 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java @@ -16,26 +16,6 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.net.ServerSocket; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.logging.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.contrib.java.lang.system.RestoreSystemProperties; -import org.junit.rules.TestName; - import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.FileUtil; @@ -46,6 +26,22 @@ import com.gemstone.gemfire.internal.process.ProcessStreamReader.InputListener; import com.gemstone.gemfire.internal.process.ProcessUtils; import com.gemstone.gemfire.internal.util.IOUtils; import com.gemstone.gemfire.internal.util.StopWatch; +import org.apache.logging.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.contrib.java.lang.system.RestoreSystemProperties; +import org.junit.rules.TestName; + +import java.io.*; +import java.net.ServerSocket; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicBoolean; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertTrue; /** * @since GemFire 8.0 @@ -80,7 +76,7 @@ public abstract class AbstractLauncherIntegrationTestCase { @Before public final void setUpAbstractLauncherIntegrationTestCase() throws Exception { - System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0)); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, Integer.toString(0)); logger.info(EXPECTED_EXCEPTION_ADD, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java index 4111270..96e88c3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java @@ -16,19 +16,17 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; +import com.gemstone.gemfire.internal.lang.StringUtils; +import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; import java.net.MalformedURLException; import java.net.URL; import java.util.Properties; import java.util.concurrent.TimeUnit; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.lang.StringUtils; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import static org.junit.Assert.*; /** * The AbstractLauncherTest class is a test suite of unit tests testing the contract and functionality @@ -72,22 +70,22 @@ public class AbstractLauncherTest { public void testIsSet() { final Properties properties = new Properties(); - assertFalse(properties.containsKey(DistributionConfig.NAME_NAME)); - assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME)); + assertFalse(properties.containsKey(SystemConfigurationProperties.NAME)); + assertFalse(AbstractLauncher.isSet(properties, SystemConfigurationProperties.NAME)); - properties.setProperty(DistributionConfig.NAME_NAME, ""); + properties.setProperty(SystemConfigurationProperties.NAME, ""); - assertTrue(properties.containsKey(DistributionConfig.NAME_NAME)); - assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME)); + assertTrue(properties.containsKey(SystemConfigurationProperties.NAME)); + assertFalse(AbstractLauncher.isSet(properties, SystemConfigurationProperties.NAME)); - properties.setProperty(DistributionConfig.NAME_NAME, " "); + properties.setProperty(SystemConfigurationProperties.NAME, " "); - assertTrue(properties.containsKey(DistributionConfig.NAME_NAME)); - assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME)); + assertTrue(properties.containsKey(SystemConfigurationProperties.NAME)); + assertFalse(AbstractLauncher.isSet(properties, SystemConfigurationProperties.NAME)); - properties.setProperty(DistributionConfig.NAME_NAME, "memberOne"); + properties.setProperty(SystemConfigurationProperties.NAME, "memberOne"); - assertTrue(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME)); + assertTrue(AbstractLauncher.isSet(properties, SystemConfigurationProperties.NAME)); assertFalse(AbstractLauncher.isSet(properties, "NaMe")); } @@ -116,8 +114,8 @@ public class AbstractLauncherTest { Properties distributedSystemProperties = launcher.getDistributedSystemProperties(); assertNotNull(distributedSystemProperties); - assertTrue(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME)); - assertEquals("memberOne", distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME)); + assertTrue(distributedSystemProperties.containsKey(SystemConfigurationProperties.NAME)); + assertEquals("memberOne", distributedSystemProperties.getProperty(SystemConfigurationProperties.NAME)); launcher = createAbstractLauncher(null, "22"); @@ -128,7 +126,7 @@ public class AbstractLauncherTest { distributedSystemProperties = launcher.getDistributedSystemProperties(); assertNotNull(distributedSystemProperties); - assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME)); + assertFalse(distributedSystemProperties.containsKey(SystemConfigurationProperties.NAME)); launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333"); @@ -139,7 +137,7 @@ public class AbstractLauncherTest { distributedSystemProperties = launcher.getDistributedSystemProperties(); assertNotNull(distributedSystemProperties); - assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME)); + assertFalse(distributedSystemProperties.containsKey(SystemConfigurationProperties.NAME)); launcher = createAbstractLauncher(" ", "4444"); @@ -150,7 +148,7 @@ public class AbstractLauncherTest { distributedSystemProperties = launcher.getDistributedSystemProperties(); assertNotNull(distributedSystemProperties); - assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME)); + assertFalse(distributedSystemProperties.containsKey(SystemConfigurationProperties.NAME)); } @Test @@ -168,7 +166,7 @@ public class AbstractLauncherTest { Properties distributedSystemProperties = launcher.getDistributedSystemProperties(defaults); assertNotNull(distributedSystemProperties); - assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME)); + assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(SystemConfigurationProperties.NAME)); assertEquals("testValue", distributedSystemProperties.getProperty("testKey")); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java index ecfb952..826641d 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java @@ -16,13 +16,13 @@ */ package com.gemstone.gemfire.distributed; -import java.util.ArrayList; -import java.util.List; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.process.ProcessStreamReader; import org.junit.After; import org.junit.Before; -import com.gemstone.gemfire.internal.process.ProcessStreamReader; +import java.util.ArrayList; +import java.util.List; public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase extends AbstractLocatorLauncherIntegrationTestCase { @@ -53,7 +53,7 @@ public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase extends A */ protected List<String> getJvmArguments() { final List<String> jvmArguments = new ArrayList<String>(); - jvmArguments.add("-Dgemfire.log-level=config"); + jvmArguments.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "log-level=config"); return jvmArguments; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java index d4943a0..0df2019 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java @@ -16,21 +16,21 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; - -import java.util.concurrent.Callable; - +import com.gemstone.gemfire.distributed.AbstractLauncher.Status; +import com.gemstone.gemfire.distributed.ServerLauncher.ServerState; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.AvailablePortHelper; +import com.gemstone.gemfire.internal.cache.AbstractCacheServer; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.rules.ErrorCollector; import org.junit.rules.TemporaryFolder; -import com.gemstone.gemfire.distributed.AbstractLauncher.Status; -import com.gemstone.gemfire.distributed.ServerLauncher.ServerState; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.internal.cache.AbstractCacheServer; +import java.util.concurrent.Callable; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertNotNull; /** * @since GemFire 8.0 @@ -49,7 +49,7 @@ public abstract class AbstractServerLauncherIntegrationTestCase extends Abstract @Before public final void setUpServerLauncherTest() throws Exception { - System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0)); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, Integer.toString(0)); final int port = AvailablePortHelper.getRandomAvailableTCPPort(); System.setProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port)); this.serverPort = port; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java index ec7a23b..7bca8bf 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java @@ -16,16 +16,17 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.process.ProcessStreamReader; +import org.junit.After; +import org.junit.Before; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; -import org.junit.After; -import org.junit.Before; - -import com.gemstone.gemfire.internal.process.ProcessStreamReader; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; public abstract class AbstractServerLauncherRemoteIntegrationTestCase extends AbstractServerLauncherIntegrationTestCase { @@ -56,7 +57,7 @@ public abstract class AbstractServerLauncherRemoteIntegrationTestCase extends Ab */ protected List<String> getJvmArguments() { final List<String> jvmArguments = new ArrayList<String>(); - jvmArguments.add("-Dgemfire.log-level=config"); + jvmArguments.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "log-level=config"); return jvmArguments; } @@ -81,10 +82,9 @@ public abstract class AbstractServerLauncherRemoteIntegrationTestCase extends Ab } final ServerLauncher.ServerState serverState = launcher.status(); assertNotNull(serverState); - logger.info("serverState: "+serverState); + logger.info("serverState: " + serverState); return AbstractLauncher.Status.ONLINE.equals(serverState.getStatus()); - } - catch (RuntimeException e) { + } catch (RuntimeException e) { logger.error(e, e); return false; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java index 7fd6df9..3537232 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java @@ -16,18 +16,6 @@ */ package com.gemstone.gemfire.distributed; -import static com.gemstone.gemfire.test.dunit.Assert.*; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Set; - import com.gemstone.gemfire.IncompatibleSystemException; import com.gemstone.gemfire.distributed.internal.DM; import com.gemstone.gemfire.distributed.internal.DistributionConfig; @@ -42,6 +30,14 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest; import org.junit.Test; import org.junit.experimental.categories.Category; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.*; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static com.gemstone.gemfire.test.dunit.Assert.*; + /** * Tests the functionality of the {@link DistributedMember} class. * @@ -65,11 +61,11 @@ public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase { @Test public void testDefaults() { 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, ""); config.setProperty(DistributionConfig.GROUPS_NAME, ""); - config.setProperty(DistributionConfig.NAME_NAME, ""); + config.setProperty(SystemConfigurationProperties.NAME, ""); InternalDistributedSystem system = getSystem(config); try { @@ -96,9 +92,9 @@ public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase { @Test public void testNonDefaultName() { Properties config = new Properties(); - config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - config.setProperty(DistributionConfig.LOCATORS_NAME, ""); - config.setProperty(DistributionConfig.NAME_NAME, "nondefault"); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); + config.setProperty(SystemConfigurationProperties.NAME, "nondefault"); InternalDistributedSystem system = getSystem(config); try { @@ -125,8 +121,8 @@ public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase { final List bothList = Arrays.asList(new String[] {"A","B","C","D","E","F","G"}); 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); config.setProperty(DistributionConfig.GROUPS_NAME, groupsProp); @@ -159,21 +155,21 @@ public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase { Host.getHost(0).getVM(0).invoke(new SerializableRunnable() { public void run() { Properties config = new Properties(); - config.setProperty(DistributionConfig.NAME_NAME, "name0"); + config.setProperty(SystemConfigurationProperties.NAME, "name0"); getSystem(config); } }); Host.getHost(0).getVM(1).invoke(new SerializableRunnable() { public void run() { Properties config = new Properties(); - config.setProperty(DistributionConfig.NAME_NAME, "name1"); + config.setProperty(SystemConfigurationProperties.NAME, "name1"); getSystem(config); } }); Host.getHost(0).getVM(2).invoke(new SerializableRunnable() { public void run() { Properties config = new Properties(); - config.setProperty(DistributionConfig.NAME_NAME, "name0"); + config.setProperty(SystemConfigurationProperties.NAME, "name0"); try { getSystem(config); fail("expected IncompatibleSystemException"); @@ -366,9 +362,9 @@ public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase { @Test public void testGetId() { Properties config = new Properties(); - config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - config.setProperty(DistributionConfig.LOCATORS_NAME, ""); - config.setProperty(DistributionConfig.NAME_NAME, "foobar"); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); + config.setProperty(SystemConfigurationProperties.NAME, "foobar"); InternalDistributedSystem system = getSystem(config); try { @@ -426,7 +422,7 @@ public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase { @Override public Object call() throws Exception { Properties config = new Properties(); - config.setProperty(DistributionConfig.NAME_NAME, name); + config.setProperty(SystemConfigurationProperties.NAME, name); DistributedSystem ds = getSystem(config); return ds.getDistributedMember(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemConnectPerf.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemConnectPerf.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemConnectPerf.java index 6e70340..455e8ae 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemConnectPerf.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemConnectPerf.java @@ -17,8 +17,12 @@ package com.gemstone.gemfire.distributed; import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import java.io.*; -import java.util.*; + +import java.io.PrintStream; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * This program is used to measure the amount of time it takes to @@ -97,9 +101,9 @@ public class DistributedSystemConnectPerf { System.setProperty("DistributionManager.VERBOSE", "true"); Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + props.setProperty(MCAST_PORT, "0"); props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info"); - props.setProperty(DistributionConfig.LOCATORS_NAME, + props.setProperty(LOCATORS, "localhost[" + port + "]"); long totalConnect = 0; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java index 6578f77..e267e41 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java @@ -16,22 +16,6 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.util.Enumeration; -import java.util.Properties; -import java.util.concurrent.TimeoutException; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.CancelException; import com.gemstone.gemfire.GemFireConfigException; import com.gemstone.gemfire.SystemConnectException; @@ -40,13 +24,7 @@ import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionException; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystemJUnitTest; -import com.gemstone.gemfire.distributed.internal.SerialDistributionMessage; -import com.gemstone.gemfire.distributed.internal.SizeableRunnable; +import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper; import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger; @@ -54,13 +32,22 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershi import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.SocketCreator; -import com.gemstone.gemfire.test.dunit.DistributedTestUtils; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.RMIException; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; import com.gemstone.gemfire.test.junit.categories.DistributedTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.util.Enumeration; +import java.util.Properties; +import java.util.concurrent.TimeoutException; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.*; /** * Tests the functionality of the {@link DistributedSystem} class. @@ -84,8 +71,8 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { disconnectAllFromDS(); int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); Properties p = getDistributedSystemProperties(); - p.put(DistributionConfig.LOCATORS_NAME, ""); - p.put(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPort+"]"); + p.put(LOCATORS, ""); + p.put(START_LOCATOR, "localhost[" + locatorPort + "]"); p.put(DistributionConfig.DISABLE_TCP_NAME, "true"); InternalDistributedSystem ds = (InternalDistributedSystem)DistributedSystem.connect(p); try { @@ -152,10 +139,10 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { @Test public void testGetSameSystemTwice() { Properties config = new Properties(); - config.setProperty("mcast-port", "0"); - config.setProperty("locators", ""); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); // set a flow-control property for the test (bug 37562) - config.setProperty("mcast-flow-control", "3000000,0.20,3000"); + config.setProperty(DistributionConfig.MCAST_FLOW_CONTROL_NAME, "3000000,0.20,3000"); DistributedSystem system1 = DistributedSystem.connect(config); DistributedSystem system2 = DistributedSystem.connect(config); @@ -171,16 +158,16 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { @Test public void testGetDifferentSystem() { Properties config = new Properties(); - config.setProperty("mcast-port", "0"); - config.setProperty("locators", ""); - config.setProperty("mcast-flow-control", "3000000,0.20,3000"); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); + config.setProperty(DistributionConfig.MCAST_FLOW_CONTROL_NAME, "3000000,0.20,3000"); DistributedSystem system1 = DistributedSystem.connect(config); - config.setProperty("mcast-address", "224.0.0.1"); + config.setProperty(MCAST_ADDRESS, "224.0.0.1"); try { DistributedSystem.connect(config); - if (System.getProperty("gemfire.mcast-address") == null) { + if (System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "mcast-address") == null) { fail("Should have thrown an IllegalStateException"); } } @@ -199,8 +186,8 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { @Test public void testGetDifferentSystemAfterClose() { Properties config = new Properties(); - config.setProperty("mcast-port", "0"); - config.setProperty("locators", ""); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); DistributedSystem system1 = DistributedSystem.connect(config); system1.disconnect(); @@ -217,26 +204,26 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { Properties config = new Properties(); // a loner is all this test needs int unusedPort = 0; - config.setProperty("mcast-port", "0"); - config.setProperty("locators", ""); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); DistributedSystem system1 = DistributedSystem.connect(config); assertTrue(config != system1.getProperties()); - assertEquals(unusedPort, Integer.parseInt(system1.getProperties().getProperty("mcast-port"))); + assertEquals(unusedPort, Integer.parseInt(system1.getProperties().getProperty(MCAST_PORT))); system1.disconnect(); assertTrue(config != system1.getProperties()); - assertEquals(unusedPort, Integer.parseInt(system1.getProperties().getProperty("mcast-port"))); + assertEquals(unusedPort, Integer.parseInt(system1.getProperties().getProperty(MCAST_PORT))); } @Test public void testIsolatedDistributedSystem() throws Exception { Properties config = new Properties(); - config.setProperty("mcast-port", "0"); - config.setProperty("locators", ""); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); getSystem(config); try { // make sure isolated distributed system can still create a cache and region @@ -255,8 +242,8 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { public void testSpecificTcpPort() throws Exception { Properties config = new Properties(); int tcpPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - config.put("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]"); - config.setProperty("tcp-port", String.valueOf(tcpPort)); + config.put(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]"); + config.setProperty(TCP_PORT, String.valueOf(tcpPort)); InternalDistributedSystem system = getSystem(config); DistributionManager dm = (DistributionManager)system.getDistributionManager(); GMSMembershipManager mgr = (GMSMembershipManager)dm.getMembershipManager(); @@ -283,10 +270,10 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { } if (loopback != null) { Properties config = new Properties(); - config.put(DistributionConfig.MCAST_PORT_NAME, "0"); + config.put(MCAST_PORT, "0"); String locators = InetAddress.getLocalHost().getHostName()+":"+DistributedTestUtils.getDUnitLocatorPort(); - config.put(DistributionConfig.LOCATORS_NAME, locators); - config.setProperty(DistributionConfig.BIND_ADDRESS_NAME, loopback.getHostAddress()); + config.put(LOCATORS, locators); + config.setProperty(BIND_ADDRESS, loopback.getHostAddress()); LogWriterUtils.getLogWriter().info("attempting to connect with " + loopback +" and locators=" + locators); try { InternalDistributedSystem system = getSystem(config); @@ -304,7 +291,7 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { public void testUDPPortRange() throws Exception { Properties config = new Properties(); int unicastPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - config.put("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]"); + config.put(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]"); // Minimum 3 ports required in range for UDP, FD_SOCK and TcpConduit. config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, ""+unicastPort+"-"+(unicastPort+2)); @@ -347,7 +334,7 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { @Test public void testMembershipPortRangeWithExactThreeValues() throws Exception { Properties config = new Properties(); - config.setProperty("locators", "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]"); + config.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]"); int portRange = 3; int portStartRange = getPortRange(portRange); int portEndRange = portStartRange + portRange - 1; @@ -374,8 +361,8 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { final int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.MULTICAST); final int[] socketPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int unicastPort = socketPorts[0]; - config.setProperty("mcast-port", String.valueOf(mcastPort)); - config.setProperty("start-locator", "localhost["+socketPorts[1]+"]"); + config.setProperty(MCAST_PORT, String.valueOf(mcastPort)); + config.setProperty(START_LOCATOR, "localhost[" + socketPorts[1] + "]"); config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, ""+unicastPort+"-"+(unicastPort+2)); InternalDistributedSystem system = (InternalDistributedSystem)DistributedSystem.connect(config); @@ -386,8 +373,8 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { vm.invoke(new CacheSerializableRunnable("start conflicting system") { public void run2() { try { - String locators = (String)config.remove("start-locator"); - config.put("locators", locators); + String locators = (String) config.remove(START_LOCATOR); + config.put(LOCATORS, locators); DistributedSystem system = DistributedSystem.connect(config); system.disconnect(); } catch (GemFireConfigException e) { @@ -418,8 +405,8 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase { @Test public void testEmptyCacheXmlFile() throws Exception { Properties config = new Properties(); - config.setProperty("mcast-port", "0"); - config.setProperty("locators", ""); + config.setProperty(MCAST_PORT, "0"); + config.setProperty(LOCATORS, ""); config.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, ""); DistributedSystem sys = DistributedSystem.connect(config); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java index d11dea3..57bc30c 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java @@ -16,34 +16,35 @@ */ package com.gemstone.gemfire.distributed; -import static com.gemstone.gemfire.test.dunit.Assert.*; -import static com.gemstone.gemfire.test.dunit.Host.*; -import static com.gemstone.gemfire.internal.AvailablePortHelper.*; - -import java.io.File; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; - -import com.gemstone.gemfire.test.dunit.Host; -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.distributed.internal.DistributionManager; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.InternalLocator; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.SocketCreator; import com.gemstone.gemfire.internal.util.StopWatch; +import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; import com.gemstone.gemfire.test.junit.categories.DistributedTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Callable; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static com.gemstone.gemfire.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static com.gemstone.gemfire.test.dunit.Assert.*; +import static com.gemstone.gemfire.test.dunit.Host.getHost; /** * Extracted from LocatorLauncherLocalIntegrationTest. @@ -84,8 +85,8 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase { @Override public Object call() throws Exception { try { - System.setProperty("gemfire.locators", dunitLocator); - System.setProperty("gemfire.mcast-port", "0"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "locators", dunitLocator); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0"); final String name = uniqueName + "-" + whichvm; final File subdir = new File(name); @@ -103,8 +104,8 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase { waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, 10, true); return null; } finally { - System.clearProperty("gemfire.locators"); - System.clearProperty("gemfire.mcast-port"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "locators"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT); } } }); @@ -192,8 +193,8 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase { @Override public Object call() throws Exception { try { - System.setProperty("gemfire.locators", dunitLocator); - System.setProperty("gemfire.mcast-port", "0"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "locators", dunitLocator); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0"); final String name = uniqueName + "-" + whichvm; final File subdir = new File(name); @@ -211,8 +212,8 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase { waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, 10, true); return launcher.getPort(); } finally { - System.clearProperty("gemfire.locators"); - System.clearProperty("gemfire.mcast-port"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "locators"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT); } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java index e10e81d..acc3b75 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java @@ -16,28 +16,25 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; +import com.gemstone.gemfire.internal.process.ProcessUtils; +import com.gemstone.gemfire.management.MemberMXBean; +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 javax.management.*; import java.lang.management.ManagementFactory; import java.util.Properties; import java.util.Set; import java.util.concurrent.Callable; -import javax.management.MBeanServer; -import javax.management.MBeanServerInvocationHandler; -import javax.management.ObjectName; -import javax.management.Query; -import javax.management.QueryExp; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.internal.process.ProcessUtils; -import com.gemstone.gemfire.management.MemberMXBean; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * Tests querying of MemberMXBean which is used by MBeanProcessController to @@ -63,8 +60,8 @@ public class LauncherMemberMXBeanIntegrationTest extends AbstractLauncherIntegra @Test public void testQueryForMemberMXBean() throws Exception { final Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.setProperty("name", getUniqueName()); new CacheFactory(props).create(); @@ -90,8 +87,8 @@ public class LauncherMemberMXBeanIntegrationTest extends AbstractLauncherIntegra @Test public void testQueryForMemberMXBeanWithProcessId() throws Exception { final Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.setProperty("name", getUniqueName()); new CacheFactory(props).create(); @@ -117,8 +114,8 @@ public class LauncherMemberMXBeanIntegrationTest extends AbstractLauncherIntegra @Test public void testQueryForMemberMXBeanWithMemberName() throws Exception { final Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.setProperty("name", getUniqueName()); new CacheFactory(props).create(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java index 8b70221..8506620 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java @@ -49,6 +49,8 @@ import java.util.List; import java.util.Properties; import java.util.Set; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; + /** * Tests the ability of the {@link Locator} API to start and stop * locators running in remote VMs. @@ -132,11 +134,11 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("start-locator", locators); - properties.put("log-level", LogWriterUtils.getDUnitLogLevel()); - properties.put("security-peer-auth-init", "com.gemstone.gemfire.distributed.AuthInitializer.create"); - properties.put("security-peer-authenticator", "com.gemstone.gemfire.distributed.MyAuthenticator.create"); + properties.put(MCAST_PORT, "0"); + properties.put(START_LOCATOR, locators); + properties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); + properties.put(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, "com.gemstone.gemfire.distributed.AuthInitializer.create"); + properties.put(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, "com.gemstone.gemfire.distributed.MyAuthenticator.create"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); properties.put(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "false"); system = (InternalDistributedSystem) DistributedSystem.connect(properties); @@ -144,9 +146,9 @@ public class LocatorDUnitTest extends DistributedTestCase { assertEquals("expected the VM to have NORMAL vmKind", DistributionManager.NORMAL_DM_TYPE, system.getDistributedMember().getVmKind()); - properties.remove("start-locator"); - properties.put("log-level", LogWriterUtils.getDUnitLogLevel()); - properties.put("locators", locators); + properties.remove(START_LOCATOR); + properties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); + properties.put(LOCATORS, locators); SerializableRunnable startSystem = new SerializableRunnable("start system") { public void run() { system = (InternalDistributedSystem) DistributedSystem.connect(properties); @@ -203,8 +205,8 @@ public class LocatorDUnitTest extends DistributedTestCase { } }); - properties.put("start-locator", locators); - properties.put("log-level", LogWriterUtils.getDUnitLogLevel()); + properties.put(START_LOCATOR, locators); + properties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); system = (InternalDistributedSystem) DistributedSystem.connect(properties); System.out.println("done connecting distributed system. Membership view is " + MembershipManagerHelper.getMembershipManager(system).getView()); @@ -227,7 +229,7 @@ public class LocatorDUnitTest extends DistributedTestCase { assertFalse("should not have become lock grantor", service.isLockGrantor()); // Now demonstrate that a new member can join and use the lock service - properties.remove("start-locator"); + properties.remove(START_LOCATOR); vm3.invoke(startSystem); vm3.invoke(new SerializableRunnable("get the lock service and lock something(2)") { public void run() { @@ -266,12 +268,12 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); - properties.put("log-level", LogWriterUtils.getDUnitLogLevel()); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); + properties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); SerializableCallable startLocator1 = new SerializableCallable("start locator1") { @@ -373,10 +375,10 @@ public class LocatorDUnitTest extends DistributedTestCase { DistributedTestUtils.deleteLocatorStateFile(port1); final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "true"); - properties.put("disable-auto-reconnect", "true"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); File logFile = new File(""); if (logFile.exists()) { @@ -489,12 +491,12 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "true"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); - properties.put("log-level", LogWriterUtils.getDUnitLogLevel()); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); + properties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); // properties.put("log-level", "fine"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); @@ -622,11 +624,11 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "true"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); SerializableRunnable stopLocator = getStopLocatorRunnable(); @@ -767,12 +769,12 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "true"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); - properties.put("log-level", LogWriterUtils.getDUnitLogLevel()); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); + properties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); SerializableRunnable stopLocator = getStopLocatorRunnable(); @@ -904,11 +906,11 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]"; final Properties properties = new Properties(); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "true"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); SerializableRunnable disconnect = @@ -1020,8 +1022,8 @@ public class LocatorDUnitTest extends DistributedTestCase { DistributedTestUtils.deleteLocatorStateFile(port1); String locators = NetworkUtils.getServerHostName(host) + "[" + port + "]"; Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); final String expected = "java.net.ConnectException"; final String addExpected = @@ -1090,8 +1092,8 @@ public class LocatorDUnitTest extends DistributedTestCase { File logFile = new File(""); try { Properties locProps = new Properties(); - locProps.setProperty("mcast-port", "0"); - locProps.setProperty("member-timeout", "1000"); + locProps.setProperty(MCAST_PORT, "0"); + locProps.setProperty(DistributionConfig.MEMBER_TIMEOUT_NAME, "1000"); locProps.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); Locator.startLocatorAndDS(port, logFile, locProps); @@ -1107,9 +1109,9 @@ public class LocatorDUnitTest extends DistributedTestCase { public void run() { //System.setProperty("p2p.joinTimeout", "5000"); Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); - props.setProperty("member-timeout", "1000"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.MEMBER_TIMEOUT_NAME, "1000"); DistributedSystem.connect(props); } }; @@ -1117,9 +1119,9 @@ public class LocatorDUnitTest extends DistributedTestCase { vm2.invoke(connect); Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); - props.setProperty("member-timeout", "1000"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.MEMBER_TIMEOUT_NAME, "1000"); system = (InternalDistributedSystem) DistributedSystem.connect(props); @@ -1186,7 +1188,7 @@ public class LocatorDUnitTest extends DistributedTestCase { try { final Properties props = new Properties(); - props.setProperty(DistributionConfig.LOCATORS_NAME, locators); + props.setProperty(LOCATORS, locators); props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); props.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); @@ -1320,8 +1322,8 @@ public class LocatorDUnitTest extends DistributedTestCase { host0 + "[" + port2 + "]"; final Properties dsProps = new Properties(); - dsProps.setProperty("locators", locators); - dsProps.setProperty("mcast-port", "0"); + dsProps.setProperty(LOCATORS, locators); + dsProps.setProperty(MCAST_PORT, "0"); dsProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); vm0.invoke(new SerializableRunnable("Start locator on " + port1) { @@ -1355,8 +1357,8 @@ public class LocatorDUnitTest extends DistributedTestCase { new SerializableRunnable("Connect to " + locators) { public void run() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); DistributedSystem.connect(props); } }; @@ -1364,8 +1366,8 @@ public class LocatorDUnitTest extends DistributedTestCase { vm2.invoke(connect); Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); system = (InternalDistributedSystem) DistributedSystem.connect(props); @@ -1438,7 +1440,7 @@ public class LocatorDUnitTest extends DistributedTestCase { host0 + "[" + port3 + "]"; final Properties dsProps = new Properties(); - dsProps.setProperty(DistributionConfig.LOCATORS_NAME, locators); + dsProps.setProperty(LOCATORS, locators); dsProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); dsProps.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); dsProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); @@ -1503,7 +1505,7 @@ public class LocatorDUnitTest extends DistributedTestCase { final String newLocators = host0 + "[" + port2 + "]," + host0 + "[" + port3 + "]"; - dsProps.setProperty("locators", newLocators); + dsProps.setProperty(LOCATORS, newLocators); final InternalDistributedMember currentCoordinator = GMSJoinLeaveTestHelper.getCurrentCoordinator(); DistributedMember vm3ID = vm3.invoke(() -> GMSJoinLeaveTestHelper.getInternalDistributedSystem().getDM().getDistributionManagerId()); @@ -1647,11 +1649,11 @@ public class LocatorDUnitTest extends DistributedTestCase { File logFile = new File(""); try { Properties props = new Properties(); - props.setProperty("mcast-port", String.valueOf(mcastport)); - props.setProperty("locators", locators); - props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel()); - props.setProperty("mcast-ttl", "0"); - props.setProperty("enable-network-partition-detection", "true"); + props.setProperty(MCAST_PORT, String.valueOf(mcastport)); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); + props.setProperty(MCAST_TTL, "0"); + props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); Locator.startLocatorAndDS(port1, logFile, null, props); @@ -1665,11 +1667,11 @@ public class LocatorDUnitTest extends DistributedTestCase { File logFile = new File(""); try { Properties props = new Properties(); - props.setProperty("mcast-port", String.valueOf(mcastport)); - props.setProperty("locators", locators); - props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel()); - props.setProperty("mcast-ttl", "0"); - props.setProperty("enable-network-partition-detection", "true"); + props.setProperty(MCAST_PORT, String.valueOf(mcastport)); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); + props.setProperty(MCAST_TTL, "0"); + props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); Locator.startLocatorAndDS(port2, logFile, null, props); } catch (IOException ex) { @@ -1682,11 +1684,11 @@ public class LocatorDUnitTest extends DistributedTestCase { new SerializableRunnable("Connect to " + locators) { public void run() { Properties props = new Properties(); - props.setProperty("mcast-port", String.valueOf(mcastport)); - props.setProperty("locators", locators); - props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel()); - props.setProperty("mcast-ttl", "0"); - props.setProperty("enable-network-partition-detection", "true"); + props.setProperty(MCAST_PORT, String.valueOf(mcastport)); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); + props.setProperty(MCAST_TTL, "0"); + props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); DistributedSystem.connect(props); } }; @@ -1695,11 +1697,11 @@ public class LocatorDUnitTest extends DistributedTestCase { vm2.invoke(connect); Properties props = new Properties(); - props.setProperty("mcast-port", String.valueOf(mcastport)); - props.setProperty("locators", locators); - props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel()); - props.setProperty("mcast-ttl", "0"); - props.setProperty("enable-network-partition-detection", "true"); + props.setProperty(MCAST_PORT, String.valueOf(mcastport)); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); + props.setProperty(MCAST_TTL, "0"); + props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); system = (InternalDistributedSystem) DistributedSystem.connect(props); WaitCriterion ev = new WaitCriterion() { @@ -1749,8 +1751,8 @@ public class LocatorDUnitTest extends DistributedTestCase { final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]"; Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); system = (InternalDistributedSystem) DistributedSystem.connect(props); system.disconnect(); @@ -1794,9 +1796,9 @@ public class LocatorDUnitTest extends DistributedTestCase { new SerializableRunnable("Connect to " + locators) { public void run() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", locators); - props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel()); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); DistributedSystem.connect(props); } }; @@ -1828,8 +1830,8 @@ public class LocatorDUnitTest extends DistributedTestCase { File stateFile = new File("locator" + port1 + "state.dat"); VM vm0 = Host.getHost(0).getVM(0); final Properties p = new Properties(); - p.setProperty(DistributionConfig.LOCATORS_NAME, Host.getHost(0).getHostName() + "[" + port1 + "]"); - p.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + p.setProperty(LOCATORS, Host.getHost(0).getHostName() + "[" + port1 + "]"); + p.setProperty(MCAST_PORT, "0"); p.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); if (stateFile.exists()) { stateFile.delete(); @@ -1914,8 +1916,8 @@ public class LocatorDUnitTest extends DistributedTestCase { System.setProperty(InternalLocator.LOCATORS_PREFERRED_AS_COORDINATORS, "true"); System.setProperty("p2p.joinTimeout", "1000"); Properties locProps = new Properties(); - locProps.put("mcast-port", "0"); - locProps.put("log-level", LogWriterUtils.getDUnitLogLevel()); + locProps.put(MCAST_PORT, "0"); + locProps.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); Locator.startLocatorAndDS(port, logFile, locProps); } catch (IOException ex) { com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port, ex); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java index d25427a..38c4dab 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java @@ -16,48 +16,44 @@ */ package com.gemstone.gemfire.distributed; -import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*; -import static com.gemstone.gemfire.internal.AvailablePort.*; -import static org.junit.Assert.*; - -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Properties; -import java.util.function.IntSupplier; - -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.test.junit.runners.CategoryWithParameterizedRunnerFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TemporaryFolder; - import com.gemstone.gemfire.SystemConnectException; import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest; import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionResponse; import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionRequest; import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionResponse; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.InternalLocator; import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger; import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient; +import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID; import com.gemstone.gemfire.management.internal.JmxManagerAdvisor.JmxManagerProfile; 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.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.util.*; +import java.util.function.IntSupplier; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static com.gemstone.gemfire.internal.AvailablePort.SOCKET; +import static com.gemstone.gemfire.internal.AvailablePort.getRandomAvailablePort; +import static org.junit.Assert.*; + @Category(IntegrationTest.class) @RunWith(Parameterized.class) @Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) @@ -108,19 +104,19 @@ public class LocatorJUnitTest { public void testGfshConnectShouldSucceedIfJmxManagerStartIsTrueInLocator() throws Exception { Properties dsprops = new Properties(); int jmxPort = getRandomAvailablePort(SOCKET); - dsprops.setProperty("mcast-port", "0"); - dsprops.setProperty("jmx-manager-port", ""+jmxPort); - dsprops.setProperty("jmx-manager-start", "true"); - dsprops.setProperty("jmx-manager-http-port", "0"); - dsprops.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); - System.setProperty("gemfire.disableManagement", "false"); // not needed + dsprops.setProperty(MCAST_PORT, "0"); + dsprops.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "" + jmxPort); + dsprops.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true"); + dsprops.setProperty(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME, "0"); + dsprops.setProperty(SystemConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "disableManagement", "false"); // not needed try { locator = Locator.startLocatorAndDS(port, new File("testJmxManager.log"), dsprops); List<JmxManagerProfile> alreadyManaging = GemFireCacheImpl.getInstance().getJmxManagerAdvisor().adviseAlreadyManaging(); assertEquals(1, alreadyManaging.size()); assertEquals(GemFireCacheImpl.getInstance().getMyId(), alreadyManaging.get(0).getDistributedMember()); } finally { - System.clearProperty("gemfire.enabledManagement"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "enabledManagement"); } } @@ -138,9 +134,9 @@ public class LocatorJUnitTest { @Test public void testNoThreadLeftBehind() throws Exception { Properties dsprops = new Properties(); - dsprops.setProperty("mcast-port", "0"); - dsprops.setProperty("jmx-manager-start", "false"); - dsprops.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); + dsprops.setProperty(MCAST_PORT, "0"); + dsprops.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "false"); + dsprops.setProperty(SystemConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false"); JGroupsMessenger.THROW_EXCEPTION_ON_START_HOOK = true; int threadCount = Thread.activeCount(); @@ -166,8 +162,8 @@ public class LocatorJUnitTest { @Test public void testServerOnly() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(SystemConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false"); locator = Locator.startLocatorAndDS(port, tmpFile, null, props, false, true, null); assertFalse(locator.isPeerLocator()); assertTrue(locator.isServerLocator()); @@ -178,8 +174,8 @@ public class LocatorJUnitTest { @Test public void testBothPeerAndServer() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(SystemConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false"); locator = Locator.startLocatorAndDS(port, tmpFile, null, props); assertTrue(locator.isPeerLocator()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java index 5f442a2..ba7e8c6 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java @@ -16,9 +16,17 @@ */ package com.gemstone.gemfire.distributed; -import static com.googlecode.catchexception.apis.BDDCatchException.*; -import static org.assertj.core.api.BDDAssertions.*; -import static org.assertj.core.api.BDDAssertions.then; +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.IntegrationTest; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.RestoreSystemProperties; +import org.junit.experimental.categories.Category; +import org.junit.rules.TemporaryFolder; +import org.junit.rules.TestName; import java.io.File; import java.io.FileNotFoundException; @@ -27,18 +35,10 @@ import java.io.IOException; import java.net.InetAddress; import java.util.Properties; -import org.junit.Rule; -import org.junit.Test; -import org.junit.contrib.java.lang.system.RestoreSystemProperties; -import org.junit.experimental.categories.Category; -import org.junit.rules.TemporaryFolder; -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.IntegrationTest; +import static com.googlecode.catchexception.apis.BDDCatchException.caughtException; +import static com.googlecode.catchexception.apis.BDDCatchException.when; +import static org.assertj.core.api.BDDAssertions.assertThat; +import static org.assertj.core.api.BDDAssertions.then; /** * Integration tests for LocatorLauncher. These tests require file system I/O. @@ -116,8 +116,8 @@ public class LocatorLauncherIntegrationTest { public void testBuildWithMemberNameSetInGemFirePropertiesOnStart() throws Exception { // given: gemfire.properties with a name Properties gemfireProperties = new Properties(); - gemfireProperties.setProperty(DistributionConfig.NAME_NAME, "locator123"); - useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", gemfireProperties); + gemfireProperties.setProperty(SystemConfigurationProperties.NAME, "locator123"); + useGemFirePropertiesFileInTemporaryFolder(DistributionConfig.GEMFIRE_PREFIX + "properties", gemfireProperties); // when: starting with null MemberName LocatorLauncher launcher = new Builder() @@ -134,7 +134,7 @@ public class LocatorLauncherIntegrationTest { @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/LocatorLauncherLocalIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java index 9fd1cd8..46cd55f 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java @@ -16,37 +16,33 @@ */ package com.gemstone.gemfire.distributed; -import static org.junit.Assert.*; - -import java.io.File; -import java.lang.management.ManagementFactory; -import java.net.BindException; -import java.net.InetAddress; - -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.distributed.internal.InternalLocator; -import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.internal.DistributionLocator; -import com.gemstone.gemfire.internal.GemFireVersion; -import com.gemstone.gemfire.internal.SocketCreator; +import com.gemstone.gemfire.internal.*; 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 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.lang.management.ManagementFactory; +import java.net.BindException; +import java.net.InetAddress; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; + /** * Tests usage of LocatorLauncher as a local API in existing JVM. * @@ -78,7 +74,7 @@ public class LocatorLauncherLocalIntegrationTest extends AbstractLocatorLauncher .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory) .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true") .set(DistributionConfig.LOG_LEVEL_NAME, "config") - .set(DistributionConfig.MCAST_PORT_NAME, "0") + .set(MCAST_PORT, "0") .build(); try { @@ -92,9 +88,9 @@ public class LocatorLauncherLocalIntegrationTest extends AbstractLocatorLauncher assertNotNull(distributedSystem); assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME)); - assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME)); + assertEquals("0", distributedSystem.getProperties().getProperty(MCAST_PORT)); assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME)); - assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME)); + assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(SystemConfigurationProperties.NAME)); } catch (Throwable e) { this.errorCollector.addError(e); }
