http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java index f19b09f..ea1df6a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java @@ -16,37 +16,30 @@ */ package com.gemstone.gemfire.distributed.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileWriter; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.UnknownHostException; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Properties; -import java.util.logging.Level; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException; import com.gemstone.gemfire.distributed.Locator; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.Config; import com.gemstone.gemfire.internal.ConfigSource; import com.gemstone.gemfire.internal.logging.InternalLogWriter; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.io.FileWriter; +import java.net.*; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Properties; +import java.util.logging.Level; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.*; /** * Tests the functionality of the {@link InternalDistributedSystem} @@ -109,8 +102,8 @@ public class InternalDistributedSystemJUnitTest public void testDefaultProperties() { Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); DistributionConfig config = createSystem(props).getConfig(); assertEquals(DistributionConfig.DEFAULT_NAME, config.getName()); @@ -120,10 +113,10 @@ public class InternalDistributedSystemJUnitTest assertEquals(DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[0], config.getMembershipPortRange()[0]); assertEquals(DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1], config.getMembershipPortRange()[1]); - if (System.getProperty("gemfire.mcast-address") == null) { + if (System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "mcast-address") == null) { assertEquals(DistributionConfig.DEFAULT_MCAST_ADDRESS, config.getMcastAddress()); } - if (System.getProperty("gemfire.bind-address") == null) { + if (System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "bind-address") == null) { assertEquals(DistributionConfig.DEFAULT_BIND_ADDRESS, config.getBindAddress()); } @@ -162,10 +155,10 @@ public class InternalDistributedSystemJUnitTest String name = "testGetName"; Properties props = new Properties(); - props.put(DistributionConfig.NAME_NAME, name); + props.put(SystemConfigurationProperties.NAME, name); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); DistributionConfig config = createSystem(props).getOriginalConfig(); assertEquals(name, config.getName()); @@ -175,8 +168,8 @@ public class InternalDistributedSystemJUnitTest public void testMemberTimeout() { Properties props = new Properties(); int memberTimeout = 100; - props.put("member-timeout", String.valueOf(memberTimeout)); - props.put("mcast-port", "0"); + props.put(DistributionConfig.MEMBER_TIMEOUT_NAME, String.valueOf(memberTimeout)); + props.put(MCAST_PORT, "0"); DistributionConfig config = createSystem(props).getOriginalConfig(); assertEquals(memberTimeout, config.getMemberTimeout()); @@ -188,7 +181,7 @@ public class InternalDistributedSystemJUnitTest try { // Totally bogus locator - props.put(DistributionConfig.LOCATORS_NAME, "14lasfk^5234"); + props.put(LOCATORS, "14lasfk^5234"); createSystem(props); fail("Should have thrown an IllegalArgumentException"); @@ -198,7 +191,7 @@ public class InternalDistributedSystemJUnitTest try { // missing port - props.put(DistributionConfig.LOCATORS_NAME, "localhost["); + props.put(LOCATORS, "localhost["); createSystem(props); fail("Should have thrown an IllegalArgumentException"); @@ -208,7 +201,7 @@ public class InternalDistributedSystemJUnitTest try { // Missing ] - props.put(DistributionConfig.LOCATORS_NAME, "localhost[234ty"); + props.put(LOCATORS, "localhost[234ty"); createSystem(props); fail("Should have thrown an IllegalArgumentException"); @@ -218,7 +211,7 @@ public class InternalDistributedSystemJUnitTest try { // Malformed port - props.put(DistributionConfig.LOCATORS_NAME, "localhost[234ty]"); + props.put(LOCATORS, "localhost[234ty]"); createSystem(props); fail("Should have thrown an IllegalArgumentException"); @@ -228,7 +221,7 @@ public class InternalDistributedSystemJUnitTest try { // Malformed port in second locator - props.put(DistributionConfig.LOCATORS_NAME, "localhost[12345],localhost[sdf3"); + props.put(LOCATORS, "localhost[12345],localhost[sdf3"); createSystem(props); fail("Should have thrown an IllegalArgumentException"); @@ -248,7 +241,7 @@ public class InternalDistributedSystemJUnitTest */ private void checkLocator(String locator) { Properties props = new Properties(); - props.put(DistributionConfig.LOCATORS_NAME, locator); + props.put(LOCATORS, locator); new DistributionConfigImpl(props); } @@ -287,8 +280,8 @@ public class InternalDistributedSystemJUnitTest */ public void _testEmptyLocators() { Properties props = new Properties(); - props.put(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0)); - props.put(DistributionConfig.LOCATORS_NAME, ""); + props.put(MCAST_PORT, String.valueOf(0)); + props.put(LOCATORS, ""); try { createSystem(props); fail("Should have thrown an IllegalArgumentException"); @@ -306,8 +299,8 @@ public class InternalDistributedSystemJUnitTest Level logLevel = Level.FINER; Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.LOG_LEVEL_NAME, logLevel.toString()); DistributionConfig config = createSystem(props).getConfig(); @@ -331,8 +324,8 @@ public class InternalDistributedSystemJUnitTest public void testGetStatisticSamplingEnabled() { Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); DistributionConfig config = createSystem(props).getConfig(); assertEquals(true, config.getStatisticSamplingEnabled()); @@ -343,8 +336,8 @@ public class InternalDistributedSystemJUnitTest String rate = String.valueOf(DistributionConfig.MIN_STATISTIC_SAMPLE_RATE); Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.STATISTIC_SAMPLE_RATE_NAME, rate); DistributionConfig config = createSystem(props).getConfig(); // The fix for 48228 causes the rate to be 1000 even if we try to set it less @@ -354,8 +347,8 @@ public class InternalDistributedSystemJUnitTest @Test public void testMembershipPortRange() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, "5100-5200"); DistributionConfig config = createSystem(props).getConfig(); assertEquals(5100, config.getMembershipPortRange()[0]); @@ -365,8 +358,8 @@ public class InternalDistributedSystemJUnitTest @Test public void testBadMembershipPortRange() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, "5200-5100"); Object exception = null; try { @@ -382,8 +375,8 @@ public class InternalDistributedSystemJUnitTest String fileName = "testGetStatisticArchiveFile"; Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME, fileName); DistributionConfig config = createSystem(props).getConfig(); assertEquals(fileName, config.getStatisticArchiveFile().getName()); @@ -398,8 +391,8 @@ public class InternalDistributedSystemJUnitTest String time = String.valueOf(DistributionConfig.MIN_ACK_WAIT_THRESHOLD); Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, time); DistributionConfig config = createSystem(props).getConfig(); assertEquals(Integer.parseInt(time), config.getAckWaitThreshold()); @@ -427,8 +420,8 @@ public class InternalDistributedSystemJUnitTest String fileName = "blah"; Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.CACHE_XML_FILE_NAME, fileName); DistributionConfig config = createSystem(props).getConfig(); assertEquals(fileName, config.getCacheXmlFile().getPath()); @@ -439,8 +432,8 @@ public class InternalDistributedSystemJUnitTest String value = String.valueOf(DistributionConfig.MIN_ARCHIVE_DISK_SPACE_LIMIT); Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.ARCHIVE_DISK_SPACE_LIMIT_NAME, value); DistributionConfig config = createSystem(props).getConfig(); assertEquals(Integer.parseInt(value), config.getArchiveDiskSpaceLimit()); @@ -464,8 +457,8 @@ public class InternalDistributedSystemJUnitTest String value = String.valueOf(DistributionConfig.MIN_ARCHIVE_FILE_SIZE_LIMIT); Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.ARCHIVE_FILE_SIZE_LIMIT_NAME, value); DistributionConfig config = createSystem(props).getConfig(); assertEquals(Integer.parseInt(value), config.getArchiveFileSizeLimit()); @@ -489,8 +482,8 @@ public class InternalDistributedSystemJUnitTest String value = String.valueOf(DistributionConfig.MIN_LOG_DISK_SPACE_LIMIT); Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.LOG_DISK_SPACE_LIMIT_NAME, value); DistributionConfig config = createSystem(props).getConfig(); assertEquals(Integer.parseInt(value), config.getLogDiskSpaceLimit()); @@ -514,8 +507,8 @@ public class InternalDistributedSystemJUnitTest String value = String.valueOf(DistributionConfig.MIN_LOG_FILE_SIZE_LIMIT); Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.LOG_FILE_SIZE_LIMIT_NAME, value); DistributionConfig config = createSystem(props).getConfig(); assertEquals(Integer.parseInt(value), config.getLogFileSizeLimit()); @@ -539,8 +532,8 @@ public class InternalDistributedSystemJUnitTest Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); InternalDistributedSystem system = createSystem(props); system.disconnect(); @@ -568,21 +561,21 @@ public class InternalDistributedSystemJUnitTest return; } } - File propFile = new File("gemfire.properties"); + File propFile = new File(DistributionConfig.GEMFIRE_PREFIX + "properties"); boolean propFileExisted = propFile.exists(); File spropFile = new File("gfsecurity.properties"); boolean spropFileExisted = spropFile.exists(); try { - System.setProperty("gemfire.log-level", "finest"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.LOG_LEVEL_NAME, "finest"); Properties apiProps = new Properties(); - apiProps.setProperty("groups", "foo, bar"); + apiProps.setProperty(DistributionConfig.GROUPS_NAME, "foo, bar"); { if (propFileExisted) { - propFile.renameTo(new File("gemfire.properties.sav")); + propFile.renameTo(new File(DistributionConfig.GEMFIRE_PREFIX + "properties.sav")); } Properties fileProps = new Properties(); fileProps.setProperty("name", "myName"); - FileWriter fw = new FileWriter("gemfire.properties"); + FileWriter fw = new FileWriter(DistributionConfig.GEMFIRE_PREFIX + "properties"); fileProps.store(fw, null); fw.close(); } @@ -591,22 +584,22 @@ public class InternalDistributedSystemJUnitTest spropFile.renameTo(new File("gfsecurity.properties.sav")); } Properties fileProps = new Properties(); - fileProps.setProperty("statistic-sample-rate", "999"); + fileProps.setProperty(DistributionConfig.STATISTIC_SAMPLE_RATE_NAME, "999"); FileWriter fw = new FileWriter("gfsecurity.properties"); fileProps.store(fw, null); fw.close(); } DistributionConfigImpl dci = new DistributionConfigImpl(apiProps); - assertEquals(null, dci.getAttributeSource("mcast-port")); - assertEquals(ConfigSource.api(), dci.getAttributeSource("groups")); - assertEquals(ConfigSource.sysprop(), dci.getAttributeSource("log-level")); + assertEquals(null, dci.getAttributeSource(MCAST_PORT)); + assertEquals(ConfigSource.api(), dci.getAttributeSource(DistributionConfig.GROUPS_NAME)); + assertEquals(ConfigSource.sysprop(), dci.getAttributeSource(DistributionConfig.LOG_LEVEL_NAME)); assertEquals(ConfigSource.Type.FILE, dci.getAttributeSource("name").getType()); - assertEquals(ConfigSource.Type.SECURE_FILE, dci.getAttributeSource("statistic-sample-rate").getType()); + assertEquals(ConfigSource.Type.SECURE_FILE, dci.getAttributeSource(DistributionConfig.STATISTIC_SAMPLE_RATE_NAME).getType()); } finally { - System.clearProperty("gemfire.log-level"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "log-level"); propFile.delete(); if (propFileExisted) { - new File("gemfire.properties.sav").renameTo(propFile); + new File(DistributionConfig.GEMFIRE_PREFIX + "properties.sav").renameTo(propFile); } spropFile.delete(); if (spropFileExisted) { @@ -622,9 +615,9 @@ public class InternalDistributedSystemJUnitTest String name = "BLAH"; Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty(DistributionConfig.NAME_NAME, name); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(SystemConfigurationProperties.NAME, name); createSystem(props); } @@ -634,8 +627,8 @@ public class InternalDistributedSystemJUnitTest Properties props = new Properties(); // a loner is all this test needs - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); props.put(DistributionConfig.LOG_LEVEL_NAME, level.toString()); InternalDistributedSystem system = createSystem(props); assertEquals(level.intValue(), system.getConfig().getLogLevel()); @@ -646,8 +639,8 @@ public class InternalDistributedSystemJUnitTest public void testStartLocator() { Properties props = new Properties(); int unusedPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - props.setProperty("mcast-port", "0"); - props.setProperty("start-locator", "localhost[" + unusedPort + "],server=false,peer=true"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(START_LOCATOR, "localhost[" + unusedPort + "],server=false,peer=true"); deleteStateFile(unusedPort); createSystem(props); Collection locators = Locator.getLocators(); @@ -670,13 +663,13 @@ public class InternalDistributedSystemJUnitTest @Test public void testValidateProps() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); Config config1 = new DistributionConfigImpl(props, false); InternalDistributedSystem sys = InternalDistributedSystem.newInstance(config1.toProperties()); try { - props.put("mcast-port", "1"); + props.put(MCAST_PORT, "1"); Config config2 = new DistributionConfigImpl(props, false); try { @@ -693,9 +686,9 @@ public class InternalDistributedSystemJUnitTest @Test public void testDeprecatedSSLProps() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty("ssl-enabled", "true"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(DistributionConfig.SSL_ENABLED_NAME, "true"); Config config1 = new DistributionConfigImpl(props, false); Properties props1 = config1.toProperties(); // For the deprecated ssl-* properties a decision was made @@ -704,12 +697,12 @@ public class InternalDistributedSystemJUnitTest // and its use in toProperties. // The other thing that is done is the ssl-* props are copied to cluster-ssl-*. // The following two assertions demonstrate this. - assertEquals(null, props1.getProperty("ssl-enabled")); - assertEquals("true", props1.getProperty("cluster-ssl-enabled")); + assertEquals(null, props1.getProperty(DistributionConfig.SSL_ENABLED_NAME)); + assertEquals("true", props1.getProperty(DistributionConfig.CLUSTER_SSL_ENABLED_NAME)); Config config2 = new DistributionConfigImpl(props1, false); assertEquals(true, config1.sameAs(config2)); Properties props3 = new Properties(props1); - props3.setProperty("ssl-enabled", "false"); + props3.setProperty(DistributionConfig.SSL_ENABLED_NAME, "false"); Config config3 = new DistributionConfigImpl(props3, false); assertEquals(false, config1.sameAs(config3)); }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java index 1629628..b422d55 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java @@ -16,14 +16,14 @@ */ package com.gemstone.gemfire.distributed.internal; -import java.util.Properties; - +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.internal.logging.LogService; import org.apache.logging.log4j.Logger; - import util.TestException; -import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.internal.logging.LogService; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; /** * A little class for testing the local DistributionManager @@ -34,7 +34,7 @@ public class LDM { public static void main(String[] args) throws Exception { Properties props = new Properties(); - props.setProperty("locators", "localhost[31576]"); + props.setProperty(LOCATORS, "localhost[31576]"); props.setProperty("mcastPort", "0"); props.setProperty("logLevel", "config"); InternalDistributedSystem system = (InternalDistributedSystem) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java index 2cc8ce2..0185e03 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java @@ -16,14 +16,7 @@ */ package com.gemstone.gemfire.distributed.internal; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.Properties; - import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.cache.client.ClientCache; @@ -33,13 +26,16 @@ import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.Locator; import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.cache.CacheServerImpl; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.START_LOCATOR; + public class ProductUseLogDUnitTest extends CacheTestCase { @@ -67,7 +63,7 @@ public class ProductUseLogDUnitTest extends CacheTestCase { // use a locator so we will monitor server load and record member->server mappings int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); Properties p = new Properties(); - p.put(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPort+"],peer=false"); + p.put(START_LOCATOR, "localhost[" + locatorPort + "],peer=false"); p.put(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "false"); InternalDistributedSystem system = getSystem(p); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/DLockReentrantLockJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/DLockReentrantLockJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/DLockReentrantLockJUnitTest.java index 2dbd231..94b153b 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/DLockReentrantLockJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/DLockReentrantLockJUnitTest.java @@ -16,22 +16,20 @@ */ package com.gemstone.gemfire.distributed.internal.locks; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; - import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; + @Category(IntegrationTest.class) public class DLockReentrantLockJUnitTest { final long id = 1213L; @@ -41,7 +39,7 @@ public class DLockReentrantLockJUnitTest { @Before public void setup() { - cache = new CacheFactory().set("mcast-port", "0").set("locators", "").create(); + cache = new CacheFactory().set(MCAST_PORT, "0").set(LOCATORS, "").create(); final RegionFactory<Long, String> regionFactory = cache.createRegionFactory("REPLICATE"); regionFactory.setScope(Scope.GLOBAL); region = regionFactory.create("ReentrantLockRegion"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java index 7a4971f..05f498e 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java @@ -16,51 +16,35 @@ */ package com.gemstone.gemfire.distributed.internal.membership; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.net.InetAddress; -import java.util.Properties; - -import org.apache.logging.log4j.Level; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.GemFireConfigException; import com.gemstone.gemfire.distributed.Locator; -import com.gemstone.gemfire.distributed.internal.DMStats; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.InternalLocator; -import com.gemstone.gemfire.distributed.internal.SerialAckedMessage; +import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.membership.gms.GMSUtil; import com.gemstone.gemfire.distributed.internal.membership.gms.ServiceConfig; import com.gemstone.gemfire.distributed.internal.membership.gms.Services; import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.JoinLeave; import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.HeartbeatMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.HeartbeatRequestMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.InstallViewMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinRequestMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinResponseMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.LeaveRequestMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.RemoveMemberMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.SuspectMembersMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.ViewAckMessage; +import com.gemstone.gemfire.distributed.internal.membership.gms.messages.*; import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.SocketCreator; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.apache.logging.log4j.Level; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.net.InetAddress; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.*; @Category(IntegrationTest.class) public class MembershipJUnitTest { @@ -117,12 +101,12 @@ public class MembershipJUnitTest { // create configuration objects Properties nonDefault = new Properties(); nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true"); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, String.valueOf(mcastPort)); + nonDefault.put(MCAST_PORT, String.valueOf(mcastPort)); nonDefault.put(DistributionConfig.LOG_FILE_NAME, ""); nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); nonDefault.put(DistributionConfig.GROUPS_NAME, "red, blue"); nonDefault.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, localHost.getHostName()+'['+port+']'); + nonDefault.put(LOCATORS, localHost.getHostName() + '[' + port + ']'); DistributionConfigImpl config = new DistributionConfigImpl(nonDefault); RemoteTransportConfig transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE); @@ -237,7 +221,7 @@ public class MembershipJUnitTest { nonDefault.clear(); - nonDefault.put(DistributionConfig.LOCATORS_NAME, SocketCreator.getLocalHost().getHostAddress()+"["+12345+"]"); + nonDefault.put(LOCATORS, SocketCreator.getLocalHost().getHostAddress() + "[" + 12345 + "]"); config = new DistributionConfigImpl(nonDefault); transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE); @@ -263,10 +247,10 @@ public class MembershipJUnitTest { public void testMulticastDiscoveryNotAllowed() { Properties nonDefault = new Properties(); nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true"); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "12345"); + nonDefault.put(MCAST_PORT, "12345"); nonDefault.put(DistributionConfig.LOG_FILE_NAME, ""); nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, ""); + nonDefault.put(LOCATORS, ""); DistributionConfigImpl config = new DistributionConfigImpl(nonDefault); RemoteTransportConfig transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java index 022d1c7..8e6221a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java @@ -16,20 +16,9 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.auth; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import java.security.Principal; -import java.util.Properties; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.contrib.java.lang.system.RestoreSystemProperties; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.LogWriter; import com.gemstone.gemfire.distributed.DistributedMember; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.membership.gms.Services; import com.gemstone.gemfire.internal.logging.InternalLogWriter; import com.gemstone.gemfire.security.AuthInitialize; @@ -38,6 +27,18 @@ import com.gemstone.gemfire.security.Authenticator; import com.gemstone.gemfire.security.GemFireSecurityException; import com.gemstone.gemfire.test.junit.categories.SecurityTest; import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.RestoreSystemProperties; +import org.junit.experimental.categories.Category; + +import java.security.Principal; +import java.util.Properties; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; @Category({ UnitTest.class, SecurityTest.class }) public class GMSAuthenticatorJUnitTest { @@ -68,19 +69,19 @@ public class GMSAuthenticatorJUnitTest { @Test public void testGetSecurityProps() throws Exception { - props.setProperty("gemfire.sys.security-peer-auth-init", "dummy1"); - props.setProperty("gemfire.sys.security-peer-authenticator", "dummy2"); + props.setProperty(DistributionConfig.GEMFIRE_PREFIX + "sys.security-peer-auth-init", "dummy1"); + props.setProperty(DistributionConfig.GEMFIRE_PREFIX + "sys.security-peer-authenticator", "dummy2"); props.setProperty("security-auth-init", "dummy3"); System.setProperties(props); Properties secProps = authenticator.getSecurityProps(); assertEquals("wrong size", 2, secProps.size()); - assertEquals("wrong value", "dummy1", secProps.getProperty("security-peer-auth-init")); - assertEquals("wrong value", "dummy2", secProps.getProperty("security-peer-authenticator")); + assertEquals("wrong value", "dummy1", secProps.getProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME)); + assertEquals("wrong value", "dummy2", secProps.getProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME)); } @Test public void testGetCredentialNormal() throws Exception { - props.setProperty("security-peer-auth-init", prefix + "TestAuthInit2.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, prefix + "TestAuthInit2.create"); TestAuthInit2 auth = new TestAuthInit2(); assertFalse(auth.isClosed()); TestAuthInit2.setAuthInitialize(auth); @@ -98,32 +99,32 @@ public class GMSAuthenticatorJUnitTest { @Test public void testGetCredentialWithEmptyAuth() throws Exception { - props.setProperty("security-peer-auth-init", ""); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, ""); Properties credential = authenticator.getCredentials(member, props); assertNull(credential); } @Test public void testGetCredentialWithNotExistAuth() throws Exception { - props.setProperty("security-peer-auth-init", prefix + "NotExistAuth.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, prefix + "NotExistAuth.create"); verifyNegativeGetCredential(props, "Failed to acquire AuthInitialize method"); } @Test public void testGetCredentialWithNullAuth() throws Exception { - props.setProperty("security-peer-auth-init", prefix + "TestAuthInit1.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, prefix + "TestAuthInit1.create"); verifyNegativeGetCredential(props, "AuthInitialize instance could not be obtained"); } @Test public void testGetCredentialWithInitError() throws Exception { - props.setProperty("security-peer-auth-init", prefix + "TestAuthInit3.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, prefix + "TestAuthInit3.create"); verifyNegativeGetCredential(props, "expected init error"); } @Test public void testGetCredentialWithError() throws Exception { - props.setProperty("security-peer-auth-init", prefix + "TestAuthInit4.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME, prefix + "TestAuthInit4.create"); verifyNegativeGetCredential(props, "expected get credential error"); } @@ -138,7 +139,7 @@ public class GMSAuthenticatorJUnitTest { @Test public void testAuthenticatorNormal() throws Exception { - props.setProperty("security-peer-authenticator", prefix + "TestAuthenticator4.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, prefix + "TestAuthenticator4.create"); TestAuthenticator4 auth = new TestAuthenticator4(); assertFalse(auth.isClosed()); TestAuthenticator4.setAuthenticator(auth); @@ -156,38 +157,38 @@ public class GMSAuthenticatorJUnitTest { @Test public void testAuthenticatorWithEmptyAuth() throws Exception { - props.setProperty("security-peer-authenticator", ""); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, ""); String result = authenticator.authenticate(member, props, props, member); assertNull(result); } @Test public void testAuthenticatorWithNotExistAuth() throws Exception { - props.setProperty("security-peer-authenticator", prefix + "NotExistAuth.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, prefix + "NotExistAuth.create"); verifyNegativeAuthenticate(props, props, "Authentication failed. See coordinator"); } @Test public void testAuthenticatorWithNullAuth() throws Exception { - props.setProperty("security-peer-authenticator", prefix + "TestAuthenticator1.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, prefix + "TestAuthenticator1.create"); verifyNegativeAuthenticate(props, props, "Authentication failed. See coordinator"); } @Test public void testAuthenticatorWithNullCredential() throws Exception { - props.setProperty("security-peer-authenticator", prefix + "TestAuthenticator1.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, prefix + "TestAuthenticator1.create"); verifyNegativeAuthenticate(null, props, "Failed to find credentials from"); } @Test public void testAuthenticatorWithAuthInitFailure() throws Exception { - props.setProperty("security-peer-authenticator", prefix + "TestAuthenticator2.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, prefix + "TestAuthenticator2.create"); verifyNegativeAuthenticate(props, props, "Authentication failed. See coordinator"); } @Test public void testAuthenticatorWithAuthFailure() throws Exception { - props.setProperty("security-peer-authenticator", prefix + "TestAuthenticator3.create"); + props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME, prefix + "TestAuthenticator3.create"); verifyNegativeAuthenticate(props, props, "Authentication failed. See coordinator"); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java index 9324783..2786508 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java @@ -16,39 +16,7 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.fd; -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; - -import org.jgroups.util.UUID; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import com.gemstone.gemfire.distributed.internal.DM; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.DistributionStats; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; +import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.NetView; import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember; @@ -66,6 +34,30 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.messages.Suspect import com.gemstone.gemfire.internal.SocketCreator; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.jgroups.util.UUID; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import java.io.*; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.*; @Category(IntegrationTest.class) public class GMSHealthMonitorJUnitTest { @@ -98,12 +90,12 @@ public class GMSHealthMonitorJUnitTest { nonDefault.put(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, "1"); nonDefault.put(DistributionConfig.ACK_SEVERE_ALERT_THRESHOLD_NAME, "10"); nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true"); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "0"); - nonDefault.put(DistributionConfig.MCAST_TTL_NAME, "0"); + nonDefault.put(MCAST_PORT, "0"); + nonDefault.put(MCAST_TTL, "0"); nonDefault.put(DistributionConfig.LOG_FILE_NAME, ""); nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); nonDefault.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, "localhost[10344]"); + nonDefault.put(LOCATORS, "localhost[10344]"); DM dm = mock(DM.class); InternalDistributedSystem system = InternalDistributedSystem.newInstanceForTesting(dm, nonDefault); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java index 00d9d05..806b8cb 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java @@ -16,29 +16,10 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.locator; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; -import java.net.InetAddress; -import java.util.Properties; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.InternalGemFireException; import com.gemstone.gemfire.distributed.Locator; -import com.gemstone.gemfire.distributed.internal.DMStats; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.InternalLocator; -import com.gemstone.gemfire.distributed.internal.LocatorStats; +import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.membership.DistributedMembershipListener; import com.gemstone.gemfire.distributed.internal.membership.MemberFactory; import com.gemstone.gemfire.distributed.internal.membership.MembershipManager; @@ -48,6 +29,20 @@ import com.gemstone.gemfire.internal.SocketCreator; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; 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 java.io.File; +import java.io.FileOutputStream; +import java.io.ObjectOutputStream; +import java.net.InetAddress; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; @Category(IntegrationTest.class) public class GMSLocatorRecoveryJUnitTest { @@ -147,11 +142,11 @@ public class GMSLocatorRecoveryJUnitTest { // create configuration objects Properties nonDefault = new Properties(); nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true"); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "0"); + nonDefault.put(MCAST_PORT, "0"); nonDefault.put(DistributionConfig.LOG_FILE_NAME, ""); nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, localHost.getHostAddress()+'['+port+']'); - nonDefault.put(DistributionConfig.BIND_ADDRESS_NAME, localHost.getHostAddress()); + nonDefault.put(LOCATORS, localHost.getHostAddress() + '[' + port + ']'); + nonDefault.put(BIND_ADDRESS, localHost.getHostAddress()); DistributionConfigImpl config = new DistributionConfigImpl(nonDefault); RemoteTransportConfig transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java index 1e1724d..732d7a1 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java @@ -16,32 +16,6 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.membership; -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.Timer; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.mockito.ArgumentCaptor; -import org.mockito.internal.verification.Times; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.mockito.verification.Timeout; - import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; @@ -60,16 +34,28 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJo import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave.TcpClientWrapper; import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave.ViewCreator; import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave.ViewReplyProcessor; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.InstallViewMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinRequestMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinResponseMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.LeaveRequestMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.NetworkPartitionMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.RemoveMemberMessage; -import com.gemstone.gemfire.distributed.internal.membership.gms.messages.ViewAckMessage; +import com.gemstone.gemfire.distributed.internal.membership.gms.messages.*; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.security.AuthenticationFailedException; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.mockito.internal.verification.Times; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.mockito.verification.Timeout; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.UnknownHostException; +import java.util.*; + +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.*; @Category(IntegrationTest.class) public class GMSJoinLeaveJUnitTest { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/StatRecorderJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/StatRecorderJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/StatRecorderJUnitTest.java index ed50a3a..5bebf99 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/StatRecorderJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/StatRecorderJUnitTest.java @@ -16,24 +16,6 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.membership; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.*; - -import java.util.Properties; -import java.util.concurrent.RejectedExecutionException; - -import org.jgroups.Event; -import org.jgroups.Message; -import org.jgroups.protocols.UNICAST3.Header; -import org.jgroups.protocols.pbcast.NakAckHeader2; -import org.jgroups.stack.Protocol; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; import com.gemstone.gemfire.distributed.internal.DistributionManager; import com.gemstone.gemfire.distributed.internal.LonerDistributionManager.DummyDMStats; @@ -44,6 +26,25 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroup import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.StatRecorder; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.jgroups.Event; +import org.jgroups.Message; +import org.jgroups.protocols.UNICAST3.Header; +import org.jgroups.protocols.pbcast.NakAckHeader2; +import org.jgroups.stack.Protocol; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.util.Properties; +import java.util.concurrent.RejectedExecutionException; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.*; /** * This class tests the GMS StatRecorder class, which records JGroups @@ -179,8 +180,8 @@ public class StatRecorderJUnitTest { // first test to see if the non-multicast stack has the recorder installed Properties nonDefault = new Properties(); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "0"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, "localhost[12345]"); + nonDefault.put(MCAST_PORT, "0"); + nonDefault.put(LOCATORS, "localhost[12345]"); DistributionConfigImpl config = new DistributionConfigImpl(nonDefault); when(mockConfig.getDistributionConfig()).thenReturn(config); @@ -195,7 +196,7 @@ public class StatRecorderJUnitTest { assertTrue(jgroupsConfig.contains("gms.messenger.StatRecorder")); // now test to see if the multicast stack has the recorder installed - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "12345"); + nonDefault.put(MCAST_PORT, "12345"); config = new DistributionConfigImpl(nonDefault); transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE); when(mockConfig.getDistributionConfig()).thenReturn(config); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java index 2ad970b..c3239b2 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java @@ -16,49 +16,10 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.messenger; -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.DataOutput; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.commons.lang.SerializationException; -import org.jgroups.Address; -import org.jgroups.Event; -import org.jgroups.JChannel; -import org.jgroups.Message; -import org.jgroups.Message.Flag; -import org.jgroups.conf.ClassConfigurator; -import org.jgroups.protocols.UNICAST3; -import org.jgroups.protocols.pbcast.NAKACK2; -import org.jgroups.util.Digest; -import org.jgroups.util.UUID; -import org.junit.After; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.ForcedDisconnectException; import com.gemstone.gemfire.GemFireIOException; import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException; -import com.gemstone.gemfire.distributed.internal.DM; -import com.gemstone.gemfire.distributed.internal.DMStats; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.DistributionMessage; -import com.gemstone.gemfire.distributed.internal.DistributionStats; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.distributed.internal.SerialAckedMessage; +import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.NetView; import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember; @@ -73,17 +34,36 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinReq import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinResponseMessage; import com.gemstone.gemfire.distributed.internal.membership.gms.messages.LeaveRequestMessage; import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger.JGroupsReceiver; -import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.internal.DataSerializableFixedID; -import com.gemstone.gemfire.internal.HeapDataOutputStream; -import com.gemstone.gemfire.internal.Version; +import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; import com.gemstone.gemfire.internal.cache.DistributedCacheOperation; import com.gemstone.gemfire.internal.logging.log4j.AlertAppender; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.apache.commons.lang.SerializationException; +import org.jgroups.Address; +import org.jgroups.Event; +import org.jgroups.JChannel; +import org.jgroups.Message; +import org.jgroups.conf.ClassConfigurator; +import org.jgroups.protocols.UNICAST3; +import org.jgroups.protocols.pbcast.NAKACK2; +import org.jgroups.util.Digest; +import org.jgroups.util.UUID; +import org.junit.After; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.IOException; +import java.util.*; -import junit.framework.Assert; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.*; @Category(IntegrationTest.class) public class JGroupsMessengerJUnitTest { @@ -106,11 +86,11 @@ public class JGroupsMessengerJUnitTest { } Properties nonDefault = new Properties(); nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true"); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, enableMcast? ""+AvailablePortHelper.getRandomAvailableUDPPort() : "0"); - nonDefault.put(DistributionConfig.MCAST_TTL_NAME, "0"); + nonDefault.put(MCAST_PORT, enableMcast ? "" + AvailablePortHelper.getRandomAvailableUDPPort() : "0"); + nonDefault.put(MCAST_TTL, "0"); nonDefault.put(DistributionConfig.LOG_FILE_NAME, ""); nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, "localhost[10344]"); + nonDefault.put(LOCATORS, "localhost[10344]"); nonDefault.put(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, "1"); DistributionConfigImpl config = new DistributionConfigImpl(nonDefault); RemoteTransportConfig tconfig = new RemoteTransportConfig(config, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java index a1d7a2d..1bc4ed2 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java @@ -16,39 +16,8 @@ */ package com.gemstone.gemfire.distributed.internal.membership.gms.mgr; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.*; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Random; -import java.util.Set; -import java.util.Timer; - -import org.jgroups.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException; -import com.gemstone.gemfire.distributed.internal.DM; -import com.gemstone.gemfire.distributed.internal.DMStats; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.DistributionMessage; -import com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.distributed.internal.MembershipListener; -import com.gemstone.gemfire.distributed.internal.ReplyProcessor21; +import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.distributed.internal.direct.DirectChannel; import com.gemstone.gemfire.distributed.internal.membership.DistributedMembershipListener; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; @@ -67,6 +36,20 @@ import com.gemstone.gemfire.internal.admin.remote.AlertListenerMessage; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; import com.gemstone.gemfire.internal.tcp.ConnectExceptions; import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.jgroups.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.util.*; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.*; @Category(UnitTest.class) public class GMSMembershipManagerJUnitTest { @@ -95,12 +78,12 @@ public class GMSMembershipManagerJUnitTest { nonDefault.put(DistributionConfig.ACK_WAIT_THRESHOLD_NAME, "1"); nonDefault.put(DistributionConfig.ACK_SEVERE_ALERT_THRESHOLD_NAME, "10"); nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true"); - nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "0"); - nonDefault.put(DistributionConfig.MCAST_TTL_NAME, "0"); + nonDefault.put(MCAST_PORT, "0"); + nonDefault.put(MCAST_TTL, "0"); nonDefault.put(DistributionConfig.LOG_FILE_NAME, ""); nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); nonDefault.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); - nonDefault.put(DistributionConfig.LOCATORS_NAME, "localhost[10344]"); + nonDefault.put(LOCATORS, "localhost[10344]"); distConfig = new DistributionConfigImpl(nonDefault); distProperties = nonDefault; RemoteTransportConfig tconfig = new RemoteTransportConfig(distConfig, DistributionManager.NORMAL_DM_TYPE); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java index 5fd0f27..897fafd 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java @@ -16,17 +16,6 @@ */ package com.gemstone.gemfire.distributed.internal.tcpserver; -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.util.Properties; -import java.util.Vector; - -import org.junit.Ignore; -import org.junit.experimental.categories.Category; - -import junit.framework.Assert; - import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.distributed.Locator; @@ -35,8 +24,6 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.gms.locator.FindCoordinatorRequest; import com.gemstone.gemfire.distributed.internal.membership.gms.locator.FindCoordinatorResponse; -import com.gemstone.gemfire.distributed.internal.tcpserver.TcpServer; -import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.SocketCreator; import com.gemstone.gemfire.internal.Version; @@ -44,9 +31,15 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.Invoke; 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.junit.categories.DistributedTest; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.io.IOException; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * This tests the rolling upgrade for locators with @@ -115,8 +108,8 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase { host.getHostName() + "[" + port1 + "]"; final Properties props = new Properties(); - props.setProperty(DistributionConfig.LOCATORS_NAME, locators); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + props.setProperty(LOCATORS, locators); + props.setProperty(MCAST_PORT, "0"); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "finest"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXExpiryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXExpiryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXExpiryJUnitTest.java index e2717bf..fb62980 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXExpiryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXExpiryJUnitTest.java @@ -16,19 +16,21 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.TXExpiryJUnitTest; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Same tests as that of {@link TXExpiryJUnitTest} after setting @@ -43,8 +45,8 @@ public class DistTXExpiryJUnitTest extends TXExpiryJUnitTest { @Override protected void createCache() throws CacheException { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner - p.setProperty("distributed-transactions", "true"); + p.setProperty(MCAST_PORT, "0"); // loner + p.setProperty(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem .connect(p)); AttributesFactory af = new AttributesFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXJUnitTest.java index 7a8b6a2..ead27d1 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXJUnitTest.java @@ -16,21 +16,23 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -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.TXJUnitTest; import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Run the basic transaction functionality tests in TXJUnitTest after setting @@ -46,9 +48,9 @@ public class DistTXJUnitTest extends TXJUnitTest { @Override protected void createCache() throws Exception { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner - p.setProperty("distributed-transactions", "true"); -// p.setProperty("log-level", "fine"); + p.setProperty(MCAST_PORT, "0"); // loner + p.setProperty(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); + // p.setProperty(DistributionConfig.LOG_LEVEL_NAME, "fine"); this.cache = (GemFireCacheImpl)CacheFactory.create(DistributedSystem.connect(p)); createRegion(); this.txMgr = this.cache.getCacheTransactionManager(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java index e4db285..e7e5a1e 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java @@ -16,18 +16,20 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import com.gemstone.gemfire.internal.cache.TXManagerImpl; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.CacheTransactionManager; import com.gemstone.gemfire.cache.RegionShortcut; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +import com.gemstone.gemfire.internal.cache.TXManagerImpl; import com.gemstone.gemfire.internal.cache.TXManagerImplJUnitTest; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; + +import java.util.Properties; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; import static junit.framework.TestCase.assertTrue; /** @@ -44,9 +46,9 @@ public class DistTXManagerImplJUnitTest extends TXManagerImplJUnitTest { @Override protected void createCache() { Properties props = new Properties(); - props.put("mcast-port", "0"); - props.put("locators", ""); - props.put("distributed-transactions", "true"); + props.put(MCAST_PORT, "0"); + props.put(LOCATORS, ""); + props.put(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); cache = new CacheFactory(props).create(); region = cache.createRegionFactory(RegionShortcut.REPLICATE).create("testRegion"); CacheTransactionManager txmgr = cache.getCacheTransactionManager(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java index e2f08a9..71d82a9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java @@ -16,12 +16,12 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache30.TXOrderDUnitTest; import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import java.util.Properties; + /** * Same tests as that of {@link TXOrderDUnitTest} after setting http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXReleasesOffHeapOnCloseJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXReleasesOffHeapOnCloseJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXReleasesOffHeapOnCloseJUnitTest.java index 984ed15..539062a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXReleasesOffHeapOnCloseJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXReleasesOffHeapOnCloseJUnitTest.java @@ -16,15 +16,18 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.CacheTransactionManager; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.offheap.TxReleasesOffHeapOnCloseJUnitTest; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** @@ -41,10 +44,10 @@ public class DistTXReleasesOffHeapOnCloseJUnitTest extends @Override protected void createCache() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty("off-heap-memory-size", "1m"); - props.put("distributed-transactions", "true"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(SystemConfigurationProperties.OFF_HEAP_MEMORY_SIZE, "1m"); + props.put(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); cache = new CacheFactory(props).create(); CacheTransactionManager txmgr = cache.getCacheTransactionManager(); assert(txmgr.isDistributed()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java index 28ae360..a935950 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java @@ -16,14 +16,10 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache30.TXRestrictionsDUnitTest; import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; +import java.util.Properties; /** * Same tests as that of {@link TXRestrictionsDUnitTest} after setting http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java index f6a3530..befeca7 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java @@ -16,11 +16,11 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.TransactionsWithDeltaDUnitTest; +import java.util.Properties; + public class DistTXWithDeltaDUnitTest extends TransactionsWithDeltaDUnitTest { public DistTXWithDeltaDUnitTest(String name) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterJUnitTest.java index 2c779f2..976d0e9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterJUnitTest.java @@ -16,19 +16,21 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.TXWriterJUnitTest; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Same tests as that of {@link TXWriterJUnitTest} after setting @@ -42,8 +44,8 @@ public class DistTXWriterJUnitTest extends TXWriterJUnitTest { protected void createCache() throws CacheException { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner - p.setProperty("distributed-transactions", "true"); + p.setProperty(MCAST_PORT, "0"); // loner + p.setProperty(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); this.cache = (GemFireCacheImpl)CacheFactory.create(DistributedSystem.connect(p)); AttributesFactory<?, ?> af = new AttributesFactory<String, String>(); af.setScope(Scope.DISTRIBUTED_NO_ACK); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterOOMEJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterOOMEJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterOOMEJUnitTest.java index 8e3b985..755c462 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterOOMEJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWriterOOMEJUnitTest.java @@ -16,19 +16,21 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.TXWriterOOMEJUnitTest; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Same tests as that of {@link TXWriterOOMEJUnitTest} after setting @@ -42,8 +44,8 @@ public class DistTXWriterOOMEJUnitTest extends TXWriterOOMEJUnitTest { protected void createCache() throws CacheException { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner - p.setProperty("distributed-transactions", "true"); + p.setProperty(MCAST_PORT, "0"); // loner + p.setProperty(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem .connect(p)); AttributesFactory<?, ?> af = new AttributesFactory<String, String>();
