http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java index 8f80877..3e21a7a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java @@ -16,12 +16,18 @@ */ package com.gemstone.gemfire.management.internal.configuration; -import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*; -import static com.gemstone.gemfire.internal.AvailablePortHelper.*; -import static com.gemstone.gemfire.test.dunit.Host.*; -import static com.jayway.awaitility.Awaitility.*; -import static java.util.stream.Collectors.*; -import static org.junit.Assert.*; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.distributed.Locator; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +import com.gemstone.gemfire.distributed.internal.InternalLocator; +import com.gemstone.gemfire.distributed.internal.SharedConfiguration; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; +import com.gemstone.gemfire.test.junit.categories.FlakyTest; +import com.gemstone.gemfire.util.test.TestUtil; +import org.junit.Test; +import org.junit.experimental.categories.Category; import java.io.File; import java.io.FileInputStream; @@ -33,18 +39,13 @@ import java.util.Arrays; import java.util.Properties; import java.util.concurrent.TimeUnit; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.distributed.Locator; -import com.gemstone.gemfire.distributed.internal.InternalLocator; -import com.gemstone.gemfire.distributed.internal.SharedConfiguration; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; -import com.gemstone.gemfire.test.junit.categories.DistributedTest; -import com.gemstone.gemfire.test.junit.categories.FlakyTest; -import com.gemstone.gemfire.util.test.TestUtil; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static com.gemstone.gemfire.internal.AvailablePortHelper.getRandomAvailableTCPPorts; +import static com.gemstone.gemfire.test.dunit.Host.getHost; +import static com.jayway.awaitility.Awaitility.waitAtMost; +import static java.util.stream.Collectors.joining; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; @Category(DistributedTest.class) public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase { @@ -268,14 +269,14 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase { final String locatorName = "locator" + i; final File logFile = new File("locator-" + i + ".log"); final Properties props = new Properties(); - props.setProperty(NAME_NAME, locatorName); - props.setProperty(MCAST_PORT_NAME, "0"); - props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true"); - props.setProperty(LOAD_CLUSTER_CONFIG_FROM_DIR_NAME, "true"); + props.setProperty(NAME, locatorName); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true"); + props.setProperty(LOAD_CLUSTER_CONFIGURATION_FROM_DIR, "true"); if (locatorPorts.length > 1) { int otherLocatorPort = locatorPorts[(i + 1) % locatorPorts.length]; - props.setProperty(LOCATORS_NAME, "localhost[" + otherLocatorPort + "]"); + props.setProperty(LOCATORS, "localhost[" + otherLocatorPort + "]"); } Locator.startLocatorAndDS(locatorPorts[i], logFile, props); @@ -305,12 +306,12 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase { disconnectFromDS(); final Properties props = new Properties(); - props.setProperty(NAME_NAME, "member" + i); - props.setProperty(MCAST_PORT_NAME, "0"); - props.setProperty(LOCATORS_NAME, getLocatorStr(locatorPorts)); - props.setProperty(LOG_FILE_NAME, "server-" + i + ".log"); - props.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true"); - props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true"); + props.setProperty(SystemConfigurationProperties.NAME, "member" + i); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, getLocatorStr(locatorPorts)); + props.setProperty(LOG_FILE, "server-" + i + ".log"); + props.setProperty(USE_CLUSTER_CONFIGURATION, "true"); + props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true"); getSystem(props); getCache();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java index 340c637..d2a05fc 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java @@ -16,16 +16,14 @@ */ package com.gemstone.gemfire.management.internal.configuration.utils; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.internal.SharedConfiguration; +import com.gemstone.gemfire.internal.cache.extension.Extension; +import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; +import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity; +import com.gemstone.gemfire.management.internal.configuration.utils.XmlUtils.XPathContext; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -37,14 +35,15 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.distributed.internal.SharedConfiguration; -import com.gemstone.gemfire.internal.cache.extension.Extension; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; -import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity; -import com.gemstone.gemfire.management.internal.configuration.utils.XmlUtils.XPathContext; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPathExpressionException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; /** * Unit tests for {@link XmlUtils#addNewNode(Document, XmlEntity)} and @@ -68,7 +67,7 @@ public class XmlUtilsAddNewNodeJUnitTest { @BeforeClass public static void beforeClass() { - cache = new CacheFactory().set("mcast-port", "0").create(); + cache = new CacheFactory().set(MCAST_PORT, "0").create(); xPathContext.addNamespace(CacheXml.PREFIX, CacheXml.GEODE_NAMESPACE); xPathContext.addNamespace(TEST_PREFIX, TEST_NAMESPACE); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientIdsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientIdsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientIdsDUnitTest.java index b4a43b4..cbe7c69 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientIdsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientIdsDUnitTest.java @@ -16,37 +16,24 @@ */ package com.gemstone.gemfire.management.internal.pulse; -import java.util.Properties; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.internal.PoolImpl; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.management.CacheServerMXBean; import com.gemstone.gemfire.management.MBeanUtil; import com.gemstone.gemfire.management.ManagementTestBase; import com.gemstone.gemfire.management.internal.cli.CliUtil; -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.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.NetworkUtils; -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 java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * This is for testing client IDs @@ -175,8 +162,8 @@ public class TestClientIdsDUnitTest extends DistributedTestCase { public Cache createClientCache(String host, Integer port1) throws Exception { Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); Cache cache = createCache(props); PoolImpl p = (PoolImpl) PoolManager.createFactory() .addServer(host, port1.intValue()).setSubscriptionEnabled(false) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestSubscriptionsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestSubscriptionsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestSubscriptionsDUnitTest.java index 8567822..3f8d758 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestSubscriptionsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestSubscriptionsDUnitTest.java @@ -16,37 +16,23 @@ */ package com.gemstone.gemfire.management.internal.pulse; -import java.util.Properties; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.internal.PoolImpl; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.management.DistributedRegionMXBean; import com.gemstone.gemfire.management.DistributedSystemMXBean; import com.gemstone.gemfire.management.ManagementService; import com.gemstone.gemfire.management.ManagementTestBase; -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.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.NetworkUtils; -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 java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * This is for testing subscriptions @@ -176,8 +162,8 @@ public class TestSubscriptionsDUnitTest extends DistributedTestCase { public Cache createClientCache(String host, Integer port1) throws Exception { Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); Cache cache = createCache(props); PoolImpl p = (PoolImpl) PoolManager.createFactory() .addServer(host, port1.intValue()).setSubscriptionEnabled(true) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java index f34be0b..7227371 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java @@ -16,34 +16,28 @@ */ package com.gemstone.gemfire.management.internal.security; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.security.Principal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import javax.management.remote.JMXPrincipal; - import com.gemstone.gemfire.LogWriter; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.operations.OperationContext; import com.gemstone.gemfire.distributed.DistributedMember; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.logging.LogService; import com.gemstone.gemfire.security.AccessControl; import com.gemstone.gemfire.security.AuthenticationFailedException; import com.gemstone.gemfire.security.Authenticator; import com.gemstone.gemfire.security.NotAuthorizedException; - import org.apache.commons.io.IOUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import javax.management.remote.JMXPrincipal; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.security.Principal; +import java.util.*; + public class ExampleJSONAuthorization implements AccessControl, Authenticator { public static class Role { @@ -100,7 +94,7 @@ public class ExampleJSONAuthorization implements AccessControl, Authenticator { user.pwd = user.name; } - JSONArray ops = obj.getJSONArray("roles"); + JSONArray ops = obj.getJSONArray(DistributionConfig.ROLES_NAME); for (int j = 0; j < ops.length(); j++) { String roleName = ops.getString(j); user.roles.add(roleMap.get(roleName)); @@ -111,7 +105,7 @@ public class ExampleJSONAuthorization implements AccessControl, Authenticator { private static Map<String, Role> readRoles(JSONObject jsonBean) throws JSONException { Map<String, Role> roleMap = new HashMap<>(); - JSONArray array = jsonBean.getJSONArray("roles"); + JSONArray array = jsonBean.getJSONArray(DistributionConfig.ROLES_NAME); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); Role role = new Role(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java index 52f37e6..e56ab85 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java @@ -20,7 +20,6 @@ package com.gemstone.gemfire.management.internal.security; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.security.GeodeSecurityUtil; import com.gemstone.gemfire.test.junit.categories.UnitTest; - import org.junit.BeforeClass; import org.junit.experimental.categories.Category; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java index d8c20eb..8568b1a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java @@ -17,23 +17,22 @@ package com.gemstone.gemfire.management.internal.security; -import static org.assertj.core.api.Assertions.*; - -import java.util.Properties; - import com.gemstone.gemfire.cache.operations.OperationContext; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.security.GeodeSecurityUtil; import com.gemstone.gemfire.security.GemFireSecurityException; import com.gemstone.gemfire.test.junit.categories.SecurityTest; import com.gemstone.gemfire.test.junit.categories.UnitTest; - import org.apache.shiro.util.ThreadContext; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; +import java.util.Properties; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + /** * this test and ShiroUtilCustomRealmJUunitTest uses the same test body, but initialize the SecurityUtils differently. * If you change shiro.ini, remmber to change the shiro-ini.json to match the changes as well. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JSONAuthorization.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JSONAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JSONAuthorization.java index ac81c76..ebbf7d9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JSONAuthorization.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JSONAuthorization.java @@ -43,6 +43,27 @@ import java.util.Properties; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import com.gemstone.gemfire.LogWriter; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.operations.OperationContext; +import com.gemstone.gemfire.distributed.DistributedMember; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.logging.LogService; +import com.gemstone.gemfire.security.AccessControl; +import com.gemstone.gemfire.security.AuthenticationFailedException; +import com.gemstone.gemfire.security.Authenticator; +import com.gemstone.gemfire.security.NotAuthorizedException; +import com.gemstone.gemfire.util.test.TestUtil; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import javax.management.remote.JMXPrincipal; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.security.Principal; +import java.util.*; public class JSONAuthorization implements AccessControl, Authenticator { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java index e6654d5..f4a4e59 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java @@ -16,13 +16,17 @@ */ package com.gemstone.gemfire.management.internal.security; -import java.util.Properties; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import org.junit.rules.ExternalResource; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; + public class JsonAuthorizationCacheStartRule extends ExternalResource { private Cache cache; private int jmxManagerPort = 0; @@ -51,9 +55,9 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource { protected void before() throws Throwable { Properties properties = new Properties(); - properties.put(DistributionConfig.NAME_NAME, JsonAuthorizationCacheStartRule.class.getSimpleName()); - properties.put(DistributionConfig.LOCATORS_NAME, ""); - properties.put(DistributionConfig.MCAST_PORT_NAME, "0"); + properties.put(SystemConfigurationProperties.NAME, JsonAuthorizationCacheStartRule.class.getSimpleName()); + properties.put(LOCATORS, ""); + properties.put(MCAST_PORT, "0"); properties.put(DistributionConfig.JMX_MANAGER_NAME, "true"); properties.put(DistributionConfig.JMX_MANAGER_START_NAME, "true"); properties.put(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxManagerPort)); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java index d92f89e..6ec3c10 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java @@ -17,13 +17,7 @@ package com.gemstone.gemfire.management.internal.security; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.logging.LogService; import com.gemstone.gemfire.management.cli.Result.Status; @@ -39,18 +33,25 @@ import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.test.junit.categories.DistributedTest; import com.gemstone.gemfire.test.junit.categories.SecurityTest; import com.jayway.awaitility.Awaitility; - import org.json.JSONException; import org.junit.Test; import org.junit.experimental.categories.Category; +import java.io.IOException; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.*; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; + @Category({ DistributedTest.class, SecurityTest.class }) public class MultiUserDUnitTest extends CliCommandTestBase { @Test public void testMultiUser() throws IOException, JSONException, InterruptedException { Properties properties = new Properties(); - properties.put(DistributionConfig.NAME_NAME, MultiUserDUnitTest.class.getSimpleName()); + properties.put(NAME, MultiUserDUnitTest.class.getSimpleName()); properties.put(DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME, JSONAuthorization.class.getName() + ".create"); properties.put(DistributionConfig.SECURITY_CLIENT_ACCESSOR_NAME, JSONAuthorization.class.getName() + ".create"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java index f4c2e06..f7dd2eb 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java @@ -16,13 +16,17 @@ */ package com.gemstone.gemfire.management.internal.security; -import java.util.Properties; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import org.junit.rules.ExternalResource; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; + public class ShiroCacheStartRule extends ExternalResource { private Cache cache; private int jmxManagerPort; @@ -36,9 +40,9 @@ public class ShiroCacheStartRule extends ExternalResource { protected void before() throws Throwable { Properties properties = new Properties(); - properties.put(DistributionConfig.NAME_NAME, ShiroCacheStartRule.class.getSimpleName()); - properties.put(DistributionConfig.LOCATORS_NAME, ""); - properties.put(DistributionConfig.MCAST_PORT_NAME, "0"); + properties.put(SystemConfigurationProperties.NAME, ShiroCacheStartRule.class.getSimpleName()); + properties.put(LOCATORS, ""); + properties.put(MCAST_PORT, "0"); properties.put(DistributionConfig.JMX_MANAGER_NAME, "true"); properties.put(DistributionConfig.JMX_MANAGER_START_NAME, "true"); properties.put(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxManagerPort)); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/internal/unsafe/ReadOpFileAccessControllerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/unsafe/ReadOpFileAccessControllerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/unsafe/ReadOpFileAccessControllerJUnitTest.java index f6aac5e..7a463d6 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/unsafe/ReadOpFileAccessControllerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/unsafe/ReadOpFileAccessControllerJUnitTest.java @@ -16,10 +16,21 @@ */ package com.gemstone.gemfire.management.internal.unsafe; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.DistributedMember; +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +import com.gemstone.gemfire.management.ManagementService; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +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 javax.management.*; +import javax.management.remote.*; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; @@ -34,30 +45,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; -import javax.management.InstanceNotFoundException; -import javax.management.MBeanException; -import javax.management.MBeanServer; -import javax.management.MBeanServerConnection; -import javax.management.ReflectionException; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXConnectorServer; -import javax.management.remote.JMXConnectorServerFactory; -import javax.management.remote.JMXServiceURL; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.management.ManagementService; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; -import org.junit.rules.TemporaryFolder; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; /** * Test ReadOnly operations are accesible from RMI Connector with readOnly user @@ -99,8 +90,8 @@ public class ReadOpFileAccessControllerJUnitTest { private Properties getProperties() { Properties pr = new Properties(); - pr.put("mcast-port", "0"); - pr.put("locators", ""); + pr.put(MCAST_PORT, "0"); + pr.put(LOCATORS, ""); //pr.put("jmx-manager", "true"); //pr.put("jmx-manager-start", "true"); return pr; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/memcached/DomainObjectsAsValuesJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/memcached/DomainObjectsAsValuesJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/memcached/DomainObjectsAsValuesJUnitTest.java index 58daf7e..a9419cc 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/memcached/DomainObjectsAsValuesJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/memcached/DomainObjectsAsValuesJUnitTest.java @@ -16,31 +16,22 @@ */ package com.gemstone.gemfire.memcached; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.util.concurrent.Future; -import java.util.logging.Logger; -import java.util.logging.StreamHandler; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.AvailablePortHelper; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import net.spy.memcached.MemcachedClient; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.internal.SocketCreator; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.util.concurrent.Future; +import java.util.logging.Logger; -import net.spy.memcached.MemcachedClient; -import junit.framework.TestCase; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; @Category(IntegrationTest.class) public class DomainObjectsAsValuesJUnitTest { @@ -53,7 +44,7 @@ public class DomainObjectsAsValuesJUnitTest { @Before public void setUp() throws Exception { - System.setProperty("gemfire.mcast-port", "0"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0"); PORT = AvailablePortHelper.getRandomAvailableTCPPort(); this.server = new GemFireMemcachedServer(PORT); server.start(); @@ -62,7 +53,7 @@ public class DomainObjectsAsValuesJUnitTest { @After public void tearDown() throws Exception { this.server.shutdown(); - System.getProperties().remove("gemfire.mcast-port"); + System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT); } public static class Customer implements java.io.Serializable { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/memcached/GemcachedDevelopmentJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/memcached/GemcachedDevelopmentJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/memcached/GemcachedDevelopmentJUnitTest.java index 71bc653..d9f3077 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/memcached/GemcachedDevelopmentJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/memcached/GemcachedDevelopmentJUnitTest.java @@ -16,11 +16,18 @@ */ package com.gemstone.gemfire.memcached; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.AvailablePort; +import com.gemstone.gemfire.memcached.GemFireMemcachedServer.Protocol; +import com.gemstone.gemfire.test.junit.categories.FlakyTest; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import net.spy.memcached.CASResponse; +import net.spy.memcached.CASValue; +import net.spy.memcached.MemcachedClient; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; import java.io.IOException; import java.net.InetAddress; @@ -32,19 +39,8 @@ import java.util.concurrent.Future; import java.util.logging.Logger; import java.util.logging.StreamHandler; -import net.spy.memcached.CASResponse; -import net.spy.memcached.CASValue; -import net.spy.memcached.MemcachedClient; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.memcached.GemFireMemcachedServer.Protocol; -import com.gemstone.gemfire.test.junit.categories.FlakyTest; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; @Category(IntegrationTest.class) public class GemcachedDevelopmentJUnitTest { @@ -57,7 +53,7 @@ public class GemcachedDevelopmentJUnitTest { @Before public void setUp() throws Exception { - System.setProperty("gemfire.mcast-port", "0"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0"); PORT = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); this.server = new GemFireMemcachedServer("", PORT, getProtocol()); server.start(); @@ -66,7 +62,7 @@ public class GemcachedDevelopmentJUnitTest { @After public void tearDown() throws Exception { - System.getProperties().remove("gemfire.mcast-port"); + System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT); this.server.shutdown(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/memcached/IntegrationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/memcached/IntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/memcached/IntegrationJUnitTest.java index afd386b..5e135f9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/memcached/IntegrationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/memcached/IntegrationJUnitTest.java @@ -16,29 +16,22 @@ */ package com.gemstone.gemfire.memcached; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.util.Properties; -import java.util.concurrent.Future; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import net.spy.memcached.MemcachedClient; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import net.spy.memcached.MemcachedClient; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.util.Properties; +import java.util.concurrent.Future; -import junit.framework.TestCase; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * @@ -50,8 +43,8 @@ public class IntegrationJUnitTest { public void testGemFireProperty() throws Exception { Properties props = new Properties(); final int port = AvailablePortHelper.getRandomAvailableTCPPort(); - props.setProperty("memcached-port", port+""); - props.setProperty("mcast-port", "0"); + props.setProperty(DistributionConfig.MEMCACHED_PORT_NAME, port + ""); + props.setProperty(MCAST_PORT, "0"); CacheFactory cf = new CacheFactory(props); Cache cache = cf.create(); @@ -72,9 +65,9 @@ public class IntegrationJUnitTest { public void testMemcachedBindAddress() throws Exception { Properties props = new Properties(); final int port = AvailablePortHelper.getRandomAvailableTCPPort(); - props.setProperty("memcached-port", port+""); - props.setProperty("memcached-bind-address", "127.0.0.1"); - props.put(DistributionConfig.MCAST_PORT_NAME, "0"); + props.setProperty(DistributionConfig.MEMCACHED_PORT_NAME, port + ""); + props.setProperty(DistributionConfig.MEMCACHED_BIND_ADDRESS_NAME, "127.0.0.1"); + props.put(MCAST_PORT, "0"); CacheFactory cf = new CacheFactory(props); Cache cache = cf.create(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/AutoSerializableJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/AutoSerializableJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/AutoSerializableJUnitTest.java index 93d07de..37ab246 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/AutoSerializableJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/AutoSerializableJUnitTest.java @@ -16,44 +16,10 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.Externalizable; -import java.io.File; -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.lang.reflect.Field; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.TreeSet; -import java.util.concurrent.ConcurrentHashMap; - -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.DataSerializer; import com.gemstone.gemfire.SerializationException; import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.PdxSerializerObject; import com.gemstone.gemfire.internal.Version; @@ -62,6 +28,23 @@ import com.gemstone.gemfire.pdx.internal.AutoSerializableManager; import com.gemstone.gemfire.pdx.internal.PdxField; import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl; 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.*; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * TODO: fails (on Windows 7?) @@ -92,7 +75,7 @@ public class AutoSerializableJUnitTest { @Before public void setUp() throws Exception { - System.setProperty("gemfire.auto.serialization.no.hardcoded.excludes", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "auto.serialization.no.hardcoded.excludes", "true"); } @After @@ -114,7 +97,7 @@ public class AutoSerializableJUnitTest { this.serializer = s; this.manager = (AutoSerializableManager) s.getManager(); this.c = (GemFireCacheImpl) new CacheFactory(). - set("mcast-port", "0"). + set(MCAST_PORT, "0"). setPdxReadSerialized(readSerialized). setPdxSerializer(s). create(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/ClientsWithVersioningRetryDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/ClientsWithVersioningRetryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/ClientsWithVersioningRetryDUnitTest.java index e64c821..36012d4 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/ClientsWithVersioningRetryDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/ClientsWithVersioningRetryDUnitTest.java @@ -16,55 +16,27 @@ */ package com.gemstone.gemfire.pdx; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Operation; -import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.RegionShortcut; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.ClientCache; import com.gemstone.gemfire.cache.client.ClientCacheFactory; import com.gemstone.gemfire.cache.client.ClientRegionShortcut; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.DistributedMember; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.DistributionManager; import com.gemstone.gemfire.distributed.internal.DistributionMessage; import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver; import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.internal.cache.DistributedCacheOperation; -import com.gemstone.gemfire.internal.cache.DistributedPutAllOperation; -import com.gemstone.gemfire.internal.cache.DistributedRegion; -import com.gemstone.gemfire.internal.cache.EntryEventImpl; -import com.gemstone.gemfire.internal.cache.EventID; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.RegionEntry; -import com.gemstone.gemfire.internal.cache.VMCachedDeserializable; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand; import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID; import com.gemstone.gemfire.internal.cache.tier.sockets.command.Put70; import com.gemstone.gemfire.internal.cache.versions.VMVersionTag; import com.gemstone.gemfire.internal.cache.versions.VersionTag; -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.NetworkUtils; -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.*; + +import java.util.*; /** * @@ -84,7 +56,7 @@ public class ClientsWithVersioningRetryDUnitTest extends CacheTestCase { public void run() { //Disable endpoint shuffling, so that the client will always connect //to the first server we give it. - System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints", "true"); } }); @@ -95,7 +67,7 @@ public class ClientsWithVersioningRetryDUnitTest extends CacheTestCase { Invoke.invokeInEveryVM(new SerializableRunnable() { @Override public void run() { - System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "false"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints", "false"); } }); for (IgnoredException ex: expectedExceptions) { @@ -430,7 +402,7 @@ public class ClientsWithVersioningRetryDUnitTest extends CacheTestCase { public Properties getDistributedSystemProperties() { Properties p = super.getDistributedSystemProperties(); - p.put("conserve-sockets", "false"); + p.put(DistributionConfig.CONSERVE_SOCKETS_NAME, "false"); return p; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/DistributedSystemIdDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/DistributedSystemIdDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/DistributedSystemIdDUnitTest.java index 8c00ab3..f4a30d6 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/DistributedSystemIdDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/DistributedSystemIdDUnitTest.java @@ -16,20 +16,15 @@ */ package com.gemstone.gemfire.pdx; -import java.util.Properties; - -import org.junit.experimental.categories.Category; - 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.internal.AvailablePortHelper; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.IgnoredException; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.junit.categories.FlakyTest; +import com.gemstone.gemfire.test.dunit.*; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; public class DistributedSystemIdDUnitTest extends DistributedTestCase { @@ -113,7 +108,7 @@ public class DistributedSystemIdDUnitTest extends DistributedTestCase { public Object call() throws Exception { Properties props = new Properties(); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, dsId); - props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locatorPort + "]"); + props.setProperty(LOCATORS, "localhost[" + locatorPort + "]"); getSystem(props); return null; } @@ -127,9 +122,9 @@ public class DistributedSystemIdDUnitTest extends DistributedTestCase { int port = AvailablePortHelper.getRandomAvailableTCPPort(); Properties props = new Properties(); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, dsId); - props.setProperty("mcast-port", "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + port + "]"); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost[" + port + "]"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, "localhost[" + port + "]"); + props.setProperty(START_LOCATOR, "localhost[" + port + "]"); getSystem(props); // Locator locator = Locator.startLocatorAndDS(port, File.createTempFile("locator", ""), props); // system = (InternalDistributedSystem) locator.getDistributedSystem(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONFormatterJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONFormatterJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONFormatterJUnitTest.java index 458c020..35739ff 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONFormatterJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONFormatterJUnitTest.java @@ -16,30 +16,25 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.fail; - -import java.text.SimpleDateFormat; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.internal.Assert; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.json.JSONException; +import org.json.JSONObject; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.text.SimpleDateFormat; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.fail; @Category(IntegrationTest.class) public class JSONFormatterJUnitTest { @@ -53,7 +48,7 @@ public class JSONFormatterJUnitTest { @Before public void setUp() throws Exception { - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0").setPdxReadSerialized(true).create(); + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0").setPdxReadSerialized(true).create(); //start cache-server CacheServer server = c.addCacheServer(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONPdxClientServerDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONPdxClientServerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONPdxClientServerDUnitTest.java index d76b5bd..2f93cc3 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONPdxClientServerDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/JSONPdxClientServerDUnitTest.java @@ -16,21 +16,10 @@ */ package com.gemstone.gemfire.pdx; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Properties; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.ClientCache; import com.gemstone.gemfire.cache.client.ClientCacheFactory; import com.gemstone.gemfire.cache.client.ClientRegionShortcut; @@ -46,9 +35,16 @@ import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.util.test.TestUtil; - import org.json.JSONException; import org.json.JSONObject; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; /** * */ @@ -566,7 +562,7 @@ public class JSONPdxClientServerDUnitTest extends CacheTestCase { SerializableCallable createRegion = new SerializableCallable() { public Object call() throws Exception { Properties props = new Properties(); - props.setProperty("locators", ""); + props.setProperty(LOCATORS, ""); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, dsId); getSystem(props); AttributesFactory af = new AttributesFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxAttributesJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxAttributesJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxAttributesJUnitTest.java index ff6688c..4c0a2aa 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxAttributesJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxAttributesJUnitTest.java @@ -16,24 +16,9 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; - -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.ToDataException; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionShortcut; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.FileUtil; @@ -42,6 +27,17 @@ import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.pdx.internal.PeerTypeRegistration; 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.FilenameFilter; +import java.io.IOException; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; /** * @@ -81,7 +77,7 @@ public class PdxAttributesJUnitTest { public void testPdxPersistent() throws Exception { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); //define a type @@ -95,7 +91,7 @@ public class PdxAttributesJUnitTest { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); cf.setPdxPersistent(true); Cache cache = cf.create(); @@ -111,7 +107,7 @@ public class PdxAttributesJUnitTest { public void testPdxDiskStore() throws Exception { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); cf.setPdxPersistent(true); cf.setPdxDiskStore("diskstore1"); Cache cache = cf.create(); @@ -129,7 +125,7 @@ public class PdxAttributesJUnitTest { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); cf.setPdxPersistent(true); Cache cache = cf.create(); @@ -145,7 +141,7 @@ public class PdxAttributesJUnitTest { public void testNonPersistentRegistryWithOverflowRegion() throws Exception { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDir}).setMaxOplogSize(1).create("diskstore1"); cache.createRegionFactory(RegionShortcut.LOCAL_OVERFLOW).setDiskStoreName("diskstore1").create("region"); @@ -156,7 +152,7 @@ public class PdxAttributesJUnitTest { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); defineAType(); cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDir}).setMaxOplogSize(1).create("diskstore1"); @@ -168,7 +164,7 @@ public class PdxAttributesJUnitTest { public void testNonPersistentRegistryWithPersistentRegion() throws Exception { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDir}).setMaxOplogSize(1).create("diskstore1"); cache.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setDiskStoreName("diskstore1").create("region"); @@ -185,7 +181,7 @@ public class PdxAttributesJUnitTest { { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); defineATypeNoEnum(); cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDir}).setMaxOplogSize(1).create("diskstore1"); @@ -209,7 +205,7 @@ public class PdxAttributesJUnitTest { //Test that we can become a peer registry { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); //This should work, because this is a peer. defineAType(); @@ -220,7 +216,7 @@ public class PdxAttributesJUnitTest { //Test that we can become a client registry. { CacheFactory cf = new CacheFactory(); - cf.set("mcast-port", "0"); + cf.set(MCAST_PORT, "0"); Cache cache = cf.create(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); PoolManager.createFactory().addServer("localhost", port).create("pool"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxClientServerDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxClientServerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxClientServerDUnitTest.java index 6c41e86..129727b 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxClientServerDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxClientServerDUnitTest.java @@ -16,22 +16,9 @@ */ package com.gemstone.gemfire.pdx; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.util.Properties; - import com.gemstone.gemfire.DataSerializer; -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.client.ClientCache; -import com.gemstone.gemfire.cache.client.ClientCacheFactory; -import com.gemstone.gemfire.cache.client.ClientRegionShortcut; -import com.gemstone.gemfire.cache.client.PoolFactory; -import com.gemstone.gemfire.cache.client.PoolManager; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.cache.client.*; import com.gemstone.gemfire.cache.client.internal.PoolImpl; import com.gemstone.gemfire.cache.query.internal.DefaultQuery; import com.gemstone.gemfire.cache.server.CacheServer; @@ -41,13 +28,14 @@ import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.PdxSerializerObject; import com.gemstone.gemfire.internal.Version; -import com.gemstone.gemfire.pdx.internal.AutoSerializableManager; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.Invoke; -import com.gemstone.gemfire.test.dunit.NetworkUtils; -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.ByteArrayInputStream; +import java.io.DataInputStream; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * @@ -187,10 +175,10 @@ public class PdxClientServerDUnitTest extends CacheTestCase { VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); - System.setProperty("gemfire.auto.serialization.no.hardcoded.excludes", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "auto.serialization.no.hardcoded.excludes", "true"); Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { - System.setProperty("gemfire.auto.serialization.no.hardcoded.excludes", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "auto.serialization.no.hardcoded.excludes", "true"); } }); try { @@ -254,11 +242,11 @@ public class PdxClientServerDUnitTest extends CacheTestCase { return null; } }); - } finally { - System.setProperty("gemfire.auto.serialization.no.hardcoded.excludes", "false"); + } finally { + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "auto.serialization.no.hardcoded.excludes", "false"); Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { - System.setProperty("gemfire.auto.serialization.no.hardcoded.excludes", "false"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "auto.serialization.no.hardcoded.excludes", "false"); } }); } @@ -404,8 +392,8 @@ public class PdxClientServerDUnitTest extends CacheTestCase { SerializableCallable createRegion = new SerializableCallable() { public Object call() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); getSystem(props); Cache cache = getCache(); PoolFactory pf = PoolManager.createFactory(); @@ -509,8 +497,8 @@ public class PdxClientServerDUnitTest extends CacheTestCase { SerializableCallable createRegion = new SerializableCallable() { public Object call() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); getSystem(props); Cache cache = getCache(); PoolFactory pf = PoolManager.createFactory(); @@ -560,8 +548,8 @@ public class PdxClientServerDUnitTest extends CacheTestCase { SerializableCallable createRegion = new SerializableCallable() { public Object call() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); getSystem(props); Cache cache = getCache(); HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); @@ -683,7 +671,7 @@ public class PdxClientServerDUnitTest extends CacheTestCase { SerializableCallable createRegion = new SerializableCallable() { public Object call() throws Exception { Properties props = new Properties(); - props.setProperty("locators", ""); + props.setProperty(LOCATORS, ""); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, dsId); getSystem(props); AttributesFactory af = new AttributesFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceFactoryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceFactoryJUnitTest.java index b984c93..de3a3bf 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceFactoryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceFactoryJUnitTest.java @@ -16,34 +16,6 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInput; -import java.io.DataInputStream; -import java.io.DataOutput; -import java.io.File; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.LinkedHashSet; -import java.util.Vector; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.DataSerializable; import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.cache.CacheFactory; @@ -53,12 +25,18 @@ import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.tcp.ByteBufferInputStream.ByteSourceFactory; -import com.gemstone.gemfire.pdx.internal.PdxField; -import com.gemstone.gemfire.pdx.internal.PdxInstanceEnum; -import com.gemstone.gemfire.pdx.internal.PdxInstanceFactoryImpl; -import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl; -import com.gemstone.gemfire.pdx.internal.PdxType; +import com.gemstone.gemfire.pdx.internal.*; 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.*; +import java.util.*; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; @Category(IntegrationTest.class) public class PdxInstanceFactoryJUnitTest { @@ -68,7 +46,7 @@ public class PdxInstanceFactoryJUnitTest { public void setUp() { // make it a loner this.cache = (GemFireCacheImpl) new CacheFactory() - .set("mcast-port", "0") + .set(MCAST_PORT, "0") .setPdxReadSerialized(true) .create(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceJUnitTest.java index 8e2983d..561341d 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxInstanceJUnitTest.java @@ -16,38 +16,30 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; - -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.cache.CacheFactory; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.pdx.PdxInstanceFactory; import com.gemstone.gemfire.pdx.internal.EnumInfo.PdxInstanceEnumInfo; -import com.gemstone.gemfire.pdx.internal.PdxInstanceEnum; import com.gemstone.gemfire.pdx.internal.PdxInstanceFactoryImpl; 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.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.math.BigInteger; +import java.util.*; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * @@ -62,8 +54,8 @@ public class PdxInstanceJUnitTest { public void setUp() { // make it a loner this.c = (GemFireCacheImpl) new CacheFactory() - .set("mcast-port", "0") - .set("distributed-system-id", "255") + .set(MCAST_PORT, "0") + .set(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, "255") .setPdxReadSerialized(true) .create(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxSerializableJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxSerializableJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxSerializableJUnitTest.java index adde942..b56bb01 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxSerializableJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxSerializableJUnitTest.java @@ -16,64 +16,29 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInput; -import java.io.DataInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.NotSerializableException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import junit.framework.TestCase; - -import com.gemstone.gemfire.CopyHelper; -import com.gemstone.gemfire.DataSerializable; -import com.gemstone.gemfire.DataSerializer; -import com.gemstone.gemfire.DeltaTestImpl; -import com.gemstone.gemfire.ToDataException; +import com.gemstone.gemfire.*; import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DiskStore; import com.gemstone.gemfire.cache.DiskStoreFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.cache.query.internal.DefaultQuery; -import com.gemstone.gemfire.internal.DSCODE; -import com.gemstone.gemfire.internal.FileUtil; -import com.gemstone.gemfire.internal.HeapDataOutputStream; -import com.gemstone.gemfire.internal.PdxSerializerObject; -import com.gemstone.gemfire.internal.SystemAdmin; -import com.gemstone.gemfire.internal.Version; +import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator; import com.gemstone.gemfire.internal.tcp.ByteBufferInputStream.ByteSourceFactory; import com.gemstone.gemfire.internal.util.ArrayUtils; -import com.gemstone.gemfire.pdx.internal.DataSize; -import com.gemstone.gemfire.pdx.internal.PdxReaderImpl; -import com.gemstone.gemfire.pdx.internal.PdxType; -import com.gemstone.gemfire.pdx.internal.PdxWriterImpl; -import com.gemstone.gemfire.pdx.internal.TypeRegistry; +import com.gemstone.gemfire.pdx.internal.*; 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.*; +import java.nio.ByteBuffer; +import java.util.*; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; @Category(IntegrationTest.class) public class PdxSerializableJUnitTest { @@ -87,7 +52,7 @@ public class PdxSerializableJUnitTest { @Before public void setUp() { // make it a loner - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .create(); } @@ -103,7 +68,7 @@ public class PdxSerializableJUnitTest { @Test public void testNoDiskStore() throws Exception { this.c.close(); - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .setPdxPersistent(true) .setPdxDiskStore("doesNotExist") .create(); @@ -120,7 +85,7 @@ public class PdxSerializableJUnitTest { @Test public void testPdxPersistentKeys() throws Exception { this.c.close(); - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .setPdxPersistent(true) .setPdxDiskStore("pdxDS") .create(); @@ -136,7 +101,7 @@ public class PdxSerializableJUnitTest { r2.put(new SimpleClass(1, (byte) 1), new SimpleClass(1, (byte) 1)); r2.put(new SimpleClass(2, (byte) 2), new SimpleClass(2, (byte) 2)); this.c.close(); - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .setPdxPersistent(true) .setPdxDiskStore("pdxDS") .create(); @@ -153,7 +118,7 @@ public class PdxSerializableJUnitTest { assertEquals(new SimpleClass(2, (byte) 2), r2.get(new SimpleClass(2, (byte) 2))); this.c.close(); // use a cache.xml to recover - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .create(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(new OutputStreamWriter(baos), true); @@ -203,7 +168,7 @@ public class PdxSerializableJUnitTest { @Test public void testPdxPersistentKeysDefDS() throws Exception { this.c.close(); - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .setPdxPersistent(true) .create(); try { @@ -216,7 +181,7 @@ public class PdxSerializableJUnitTest { r2.put(new SimpleClass(1, (byte) 1), new SimpleClass(1, (byte) 1)); r2.put(new SimpleClass(2, (byte) 2), new SimpleClass(2, (byte) 2)); this.c.close(); - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .setPdxPersistent(true) .create(); this.c.createDiskStoreFactory().create("r2DS"); @@ -230,7 +195,7 @@ public class PdxSerializableJUnitTest { assertEquals(new SimpleClass(2, (byte) 2), r2.get(new SimpleClass(2, (byte) 2))); this.c.close(); // use a cache.xml to recover - this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") + this.c = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0") .create(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(new OutputStreamWriter(baos), true); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxStringJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxStringJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxStringJUnitTest.java index 5ff0db0..f847c19 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxStringJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/PdxStringJUnitTest.java @@ -16,29 +16,25 @@ */ package com.gemstone.gemfire.pdx; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -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.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.pdx.internal.PdxInstanceFactoryImpl; import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl; import com.gemstone.gemfire.pdx.internal.PdxString; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; -import junit.framework.TestCase; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @Category(IntegrationTest.class) public class PdxStringJUnitTest { @@ -48,7 +44,7 @@ public class PdxStringJUnitTest { public void setUp() { // make it a loner this.c = (GemFireCacheImpl) new CacheFactory() - .set("mcast-port", "0") + .set(MCAST_PORT, "0") .setPdxReadSerialized(true) .create(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java index 5e0e71a..b8349d3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java @@ -16,25 +16,27 @@ */ package com.gemstone.gemfire.redis; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.IOException; -import java.util.Random; - +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.GemFireCache; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; +import com.gemstone.gemfire.internal.AvailablePortHelper; +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 redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisDataException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.GemFireCache; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.io.IOException; +import java.util.Random; + +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.assertNotNull; @Category(IntegrationTest.class) public class AuthJUnitTest { @@ -62,10 +64,10 @@ public class AuthJUnitTest { } private void setupCacheWithPassword() { CacheFactory cf = new CacheFactory(); - cf.set("log-level", "error"); - cf.set("mcast-port", "0"); - cf.set("locators", ""); - cf.set("redis-password", PASSWORD); + cf.set(DistributionConfig.LOG_LEVEL_NAME, "error"); + cf.set(MCAST_PORT, "0"); + cf.set(LOCATORS, ""); + cf.set(SystemConfigurationProperties.REDIS_PASSWORD, PASSWORD); cache = cf.create(); server = new GemFireRedisServer("localhost", port); server.start(); @@ -96,9 +98,9 @@ public class AuthJUnitTest { @Test public void testAuthNoPwd() { CacheFactory cf = new CacheFactory(); - cf.set("log-level", "error"); - cf.set("mcast-port", "0"); - cf.set("locators", ""); + cf.set(DistributionConfig.LOG_LEVEL_NAME, "error"); + cf.set(MCAST_PORT, "0"); + cf.set(LOCATORS, ""); cache = cf.create(); server = new GemFireRedisServer("localhost", port); server.start();
