http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java index 6863f92..b4743b3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java @@ -16,46 +16,25 @@ */ package com.gemstone.gemfire; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.cache.AttributesMutator; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.CacheListener; -import com.gemstone.gemfire.cache.CacheTransactionManager; -import com.gemstone.gemfire.cache.CommitConflictException; -import com.gemstone.gemfire.cache.EntryEvent; -import com.gemstone.gemfire.cache.ExpirationAction; -import com.gemstone.gemfire.cache.ExpirationAttributes; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionEvent; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; -import com.gemstone.gemfire.internal.cache.ExpiryTask; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.cache.ExpiryTask.ExpiryTaskListener; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.TXManagerImpl; -import com.gemstone.gemfire.internal.cache.TXStateProxy; import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; import com.gemstone.gemfire.test.junit.categories.FlakyTest; 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.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * Tests transaction expiration functionality @@ -70,7 +49,7 @@ public class TXExpiryJUnitTest { protected void createCache() throws CacheException { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner + p.setProperty(MCAST_PORT, "0"); // loner this.cache = (GemFireCacheImpl) (new CacheFactory(p)).create(); 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/TXJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/TXJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/TXJUnitTest.java index ec7a020..cd32c3a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/TXJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/TXJUnitTest.java @@ -16,90 +16,28 @@ */ package com.gemstone.gemfire; -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.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Properties; -import java.util.Set; - -import javax.transaction.Synchronization; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.AttributesMutator; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheEvent; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.CacheListener; -import com.gemstone.gemfire.cache.CacheLoader; -import com.gemstone.gemfire.cache.CacheLoaderException; -import com.gemstone.gemfire.cache.CacheTransactionManager; -import com.gemstone.gemfire.cache.CacheWriter; -import com.gemstone.gemfire.cache.CacheWriterException; -import com.gemstone.gemfire.cache.CommitConflictException; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.DiskStoreFactory; -import com.gemstone.gemfire.cache.EntryEvent; -import com.gemstone.gemfire.cache.EntryExistsException; -import com.gemstone.gemfire.cache.EntryNotFoundException; -import com.gemstone.gemfire.cache.EvictionAction; -import com.gemstone.gemfire.cache.EvictionAttributes; -import com.gemstone.gemfire.cache.FailedSynchronizationException; -import com.gemstone.gemfire.cache.LoaderHelper; -import com.gemstone.gemfire.cache.PartitionAttributes; -import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionEvent; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.TimeoutException; -import com.gemstone.gemfire.cache.TransactionEvent; -import com.gemstone.gemfire.cache.TransactionException; -import com.gemstone.gemfire.cache.TransactionId; -import com.gemstone.gemfire.cache.TransactionListener; -import com.gemstone.gemfire.cache.UnsupportedOperationInTransactionException; -import com.gemstone.gemfire.cache.query.Index; -import com.gemstone.gemfire.cache.query.IndexType; -import com.gemstone.gemfire.cache.query.Query; -import com.gemstone.gemfire.cache.query.QueryException; -import com.gemstone.gemfire.cache.query.QueryService; -import com.gemstone.gemfire.cache.query.SelectResults; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.cache.query.*; import com.gemstone.gemfire.cache.query.internal.index.IndexManager; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.cache.util.TransactionListenerAdapter; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.internal.NanoTimer; // With java 1.5, please replace with System.nanoTime() -import com.gemstone.gemfire.internal.cache.AbstractRegion; -import com.gemstone.gemfire.internal.cache.CachePerfStats; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.PartitionedRegion; -import com.gemstone.gemfire.internal.cache.TXManagerImpl; -import com.gemstone.gemfire.internal.cache.TXStateProxy; +import com.gemstone.gemfire.internal.NanoTimer; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.util.StopWatch; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.*; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import javax.transaction.Synchronization; +import java.util.*; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * Tests basic transaction functionality @@ -130,7 +68,7 @@ public class TXJUnitTest { protected void createCache() throws Exception { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner + p.setProperty(MCAST_PORT, "0"); // loner this.cache = (GemFireCacheImpl)CacheFactory.create(DistributedSystem.connect(p)); createRegion(); this.txMgr = this.cache.getCacheTransactionManager(); @@ -4433,7 +4371,7 @@ public class TXJUnitTest { void assertValid() { assertEquals(this.txRollbacks, this.stats.getTxRollbacks()); assertEquals(this.txRollbackChanges, this.stats.getTxRollbackChanges()); - if (Boolean.getBoolean("gemfire.cache.enable-time-statistics")) { + if (Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "cache.enable-time-statistics")) { assertTrue(this.txRollbackTime <= this.stats.getTxRollbackTime()); // assertTrue(this.txRollbackLifeTime+((SLEEP_MS-10)*1000000) <= this.stats.getTxRollbackLifeTime()); assertTrue("RollbackLifeTime " + this.txRollbackLifeTime @@ -4480,7 +4418,7 @@ public class TXJUnitTest { testRollbackLifeTime += beforeRollback - afterBegin; // bruce - time based stats are disabled by default String p = (String)cache.getDistributedSystem() - .getProperties().get("gemfire.enable-time-statistics"); + .getProperties().get(DistributionConfig.GEMFIRE_PREFIX + "enable-time-statistics"); if (p != null && Boolean.getBoolean(p)) { assertTrue("Local RollbackLifeTime assertion: " + testRollbackLifeTime @@ -4489,7 +4427,7 @@ public class TXJUnitTest { } testTotalTx += afterRollback - beforeBegin; final long totalTXMinusRollback = testTotalTx - stats.getTxRollbackTime(); - if (Boolean.getBoolean("gemfire.cache.enable-time-statistics")) { + if (Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "cache.enable-time-statistics")) { assertTrue("Total Tx Minus Rollback assertion: " + totalTXMinusRollback + " is not >= " + statsRollbackLifeTime, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/TXWriterTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/TXWriterTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/TXWriterTestCase.java index 1dff222..40633df 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/TXWriterTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/TXWriterTestCase.java @@ -16,30 +16,18 @@ */ package com.gemstone.gemfire; -import java.util.Properties; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.AttributesMutator; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.CacheTransactionManager; -import com.gemstone.gemfire.cache.CacheWriter; -import com.gemstone.gemfire.cache.CacheWriterException; -import com.gemstone.gemfire.cache.EntryEvent; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionEvent; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.TransactionEvent; -import com.gemstone.gemfire.cache.TransactionListener; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Extracted from TXWriterJUnitTest to share with TXWriterOOMEJUnitTest. @@ -59,7 +47,7 @@ public class TXWriterTestCase { protected void createCache() throws CacheException { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner + p.setProperty(MCAST_PORT, "0"); // loner 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/admin/internal/BindDistributedSystemJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/BindDistributedSystemJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/BindDistributedSystemJUnitTest.java index 407b075..dcefc2b 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/BindDistributedSystemJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/BindDistributedSystemJUnitTest.java @@ -16,27 +16,18 @@ */ package com.gemstone.gemfire.admin.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.net.InetAddress; -import java.net.Socket; -import java.util.Properties; - +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.internal.AvailablePortHelper; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.After; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.admin.AdminDistributedSystem; -import com.gemstone.gemfire.admin.AdminDistributedSystemFactory; -import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.internal.util.StopWatch; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.BIND_ADDRESS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.START_LOCATOR; +import static org.junit.Assert.assertEquals; /** * Tests {@link com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl}. @@ -78,8 +69,8 @@ public class BindDistributedSystemJUnitTest { assertEquals(true, InetAddressUtil.isLoopback(bindTo)); Properties props = new Properties(); - props.setProperty(DistributionConfig.BIND_ADDRESS_NAME, bindTo); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, + props.setProperty(BIND_ADDRESS, bindTo); + props.setProperty(START_LOCATOR, "localhost["+AvailablePortHelper.getRandomAvailableTCPPort()+"]"); this.system = com.gemstone.gemfire.distributed.DistributedSystem.connect( props); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/DistributedSystemTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/DistributedSystemTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/DistributedSystemTestCase.java index 8322959..de34b2b 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/DistributedSystemTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/DistributedSystemTestCase.java @@ -16,12 +16,15 @@ */ package com.gemstone.gemfire.admin.internal; -import java.util.Properties; - +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import org.junit.After; import org.junit.Before; -import com.gemstone.gemfire.distributed.DistributedSystem; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Provides common setUp and tearDown for testing the Admin API. @@ -58,9 +61,9 @@ public abstract class DistributedSystemTestCase { */ protected Properties defineProperties() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty("conserve-sockets", "true"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(DistributionConfig.CONSERVE_SOCKETS_NAME, "true"); return props; } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/HealthEvaluatorTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/HealthEvaluatorTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/HealthEvaluatorTestCase.java index 3e5a452..55f10a4 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/HealthEvaluatorTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/admin/internal/HealthEvaluatorTestCase.java @@ -17,12 +17,15 @@ package com.gemstone.gemfire.admin.internal; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; +import org.junit.After; +import org.junit.Before; import java.util.Properties; -import org.junit.After; -import org.junit.Before; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Superclass of tests for the {@linkplain @@ -65,9 +68,9 @@ public abstract class HealthEvaluatorTestCase { */ protected Properties getProperties() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty("statistic-sampling-enabled", "true"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); return props; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheListenerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheListenerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheListenerJUnitTest.java index 7d2d8ad..9b19053 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheListenerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheListenerJUnitTest.java @@ -16,19 +16,25 @@ */ package com.gemstone.gemfire.cache; -import static org.junit.Assert.*; - -import com.gemstone.gemfire.cache.util.*; -import com.gemstone.gemfire.distributed.*; +import com.gemstone.gemfire.cache.util.CacheListenerAdapter; +import com.gemstone.gemfire.cache.util.RegionMembershipListenerAdapter; +import com.gemstone.gemfire.cache.util.RegionRoleListenerAdapter; +import com.gemstone.gemfire.cache.util.TransactionListenerAdapter; +import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; - -import java.util.*; - import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import java.util.Arrays; +import java.util.Collections; +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.*; + /** * Unit test for basic CacheListener feature. * NOTE: these tests using a loner DistributedSystem and local scope regions @@ -47,8 +53,8 @@ public class CacheListenerJUnitTest { @Before public void setUp() throws Exception { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); - p.setProperty("locators", ""); + p.setProperty(MCAST_PORT, "0"); + p.setProperty(LOCATORS, ""); this.ds = DistributedSystem.connect(p); this.c = CacheFactory.create(this.ds); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java index 192b60e..53a6189 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java @@ -16,20 +16,18 @@ */ package com.gemstone.gemfire.cache; -import java.util.Properties; - 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.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.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.NetworkUtils; -import com.gemstone.gemfire.test.dunit.VM; +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; /** * verifies the count of clear operation * @@ -80,8 +78,8 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase { throws Exception { new CacheRegionClearStatsDUnitTest("temp"); Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); new CacheRegionClearStatsDUnitTest("temp").createCache(props); PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host, port1.intValue()).setSubscriptionEnabled(false) @@ -125,8 +123,8 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase { throws Exception { new CacheRegionClearStatsDUnitTest("temp"); Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); new CacheRegionClearStatsDUnitTest("temp").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/cache/ClientServerTimeSyncDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java index 12f5340..2e97707 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java @@ -16,11 +16,6 @@ */ package com.gemstone.gemfire.cache; -import java.io.IOException; -import java.util.Properties; - -import org.junit.Ignore; - import com.gemstone.gemfire.cache.client.ClientCache; import com.gemstone.gemfire.cache.client.ClientCacheFactory; import com.gemstone.gemfire.cache.client.ClientRegionShortcut; @@ -29,14 +24,13 @@ import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.internal.DSClock; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.test.dunit.Assert; -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.VM; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.*; +import org.junit.Ignore; + +import java.io.IOException; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; public class ClientServerTimeSyncDUnitTest extends CacheTestCase { @@ -87,7 +81,7 @@ public class ClientServerTimeSyncDUnitTest extends CacheTestCase { disconnectFromDS(); Properties props = new Properties(); - props.setProperty("locators", ""); + props.setProperty(LOCATORS, ""); props = getSystem(props).getProperties(); cache = new ClientCacheFactory(props).setPoolSubscriptionEnabled(true) .addPoolServer(hostName, serverPort) @@ -166,7 +160,7 @@ public class ClientServerTimeSyncDUnitTest extends CacheTestCase { disconnectFromDS(); Properties props = new Properties(); - props.setProperty("locators", ""); + props.setProperty(LOCATORS, ""); props = getSystem(props).getProperties(); cache = new ClientCacheFactory(props).setPoolSubscriptionEnabled(true) .addPoolServer(hostName, serverPort) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java index 7495328..ef09970 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java @@ -16,22 +16,20 @@ */ package com.gemstone.gemfire.cache; -import java.io.IOException; -import java.util.Properties; - -import junit.framework.Assert; - import com.gemstone.gemfire.cache.client.PoolFactory; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache.util.CacheWriterAdapter; import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.test.dunit.Host; -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 junit.framework.Assert; + +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 cases where we have both @@ -409,8 +407,8 @@ public class ConnectionPoolAndLoaderDUnitTest extends CacheTestCase { public Properties getDistributedSystemProperties() { Properties p = new Properties(); if(!useLocator) { - p.setProperty("locators", ""); - p.setProperty("mcast-port", "0"); + p.setProperty(LOCATORS, ""); + p.setProperty(MCAST_PORT, "0"); } return p; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolFactoryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolFactoryJUnitTest.java index 05e71f5..b5ea652 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolFactoryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolFactoryJUnitTest.java @@ -16,22 +16,24 @@ */ package com.gemstone.gemfire.cache; -import static org.junit.Assert.*; - -import java.util.Map; -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.cache.client.Pool; import com.gemstone.gemfire.cache.client.PoolFactory; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.PoolFactoryImpl; 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.util.Map; +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.*; @Category(IntegrationTest.class) public class ConnectionPoolFactoryJUnitTest { @@ -42,9 +44,9 @@ public class ConnectionPoolFactoryJUnitTest { @Before public void setUp() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty("log-level", "info"); // to keep diskPerf logs smaller + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info"); // to keep diskPerf logs smaller this.ds = DistributedSystem.connect(props); this.cache = CacheFactory.create(this.ds); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java index 7394f0e..dfbc54b 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java @@ -16,21 +16,23 @@ */ package com.gemstone.gemfire.cache; -import static org.junit.Assert.*; - -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.cache.client.Pool; import com.gemstone.gemfire.cache.client.PoolFactory; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.PoolFactoryImpl; 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.util.Properties; + +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; /** * Tests PoolManager @@ -44,8 +46,8 @@ public class PoolManagerJUnitTest { @Before public void setUp() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); ds = DistributedSystem.connect(props); assertEquals(0, PoolManager.getAll().size()); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/ProxyJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ProxyJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ProxyJUnitTest.java index ad5695d..9a3ab17 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ProxyJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ProxyJUnitTest.java @@ -16,25 +16,28 @@ */ package com.gemstone.gemfire.cache; -import static org.junit.Assert.*; - -import com.gemstone.gemfire.cache.query.*; -import com.gemstone.gemfire.cache.util.*; -import com.gemstone.gemfire.distributed.*; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +import com.gemstone.gemfire.cache.query.SelectResults; +import com.gemstone.gemfire.cache.util.CacheListenerAdapter; +import com.gemstone.gemfire.cache.util.TransactionListenerAdapter; +import com.gemstone.gemfire.distributed.DistributedMember; +import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.CachePerfStats; +import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.LocalRegion; import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID; import com.gemstone.gemfire.internal.util.StopWatch; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; - -import java.util.*; - 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.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; + /** * Unit test for basic DataPolicy.EMPTY feature. * NOTE: these tests using a loner DistributedSystem and local scope regions @@ -49,8 +52,8 @@ public class ProxyJUnitTest { @Before public void setUp() throws Exception { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); - p.setProperty("locators", ""); + p.setProperty(MCAST_PORT, "0"); + p.setProperty(LOCATORS, ""); this.ds = DistributedSystem.connect(p); this.c = CacheFactory.create(this.ds); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/RegionFactoryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/RegionFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/RegionFactoryJUnitTest.java index 4a31158..c870091 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/RegionFactoryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/RegionFactoryJUnitTest.java @@ -16,34 +16,31 @@ */ package com.gemstone.gemfire.cache; -import static com.gemstone.gemfire.cache.RegionShortcut.*; -import static org.junit.Assert.*; - -import java.io.File; -import java.io.FileWriter; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Properties; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - import com.gemstone.gemfire.CancelException; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.cache.util.CacheWriterAdapter; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.cache.LocalRegion; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import java.io.File; +import java.io.FileWriter; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Properties; + +import static com.gemstone.gemfire.cache.RegionShortcut.*; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; +import static org.junit.Assert.*; /** * Unit test for the RegionFactory class @@ -237,7 +234,7 @@ public class RegionFactoryJUnitTest { // Assert failure when a Distributed system exists but with different properties this.distSys = DistributedSystem.connect(createGemFireProperties()); // for teardown final Properties failed = new Properties(); - failed.put("mcast-ttl", "64"); + failed.put(MCAST_TTL, "64"); try { new RegionFactory(failed); @@ -346,11 +343,11 @@ public class RegionFactoryJUnitTest { @Test public void testRegionFactoryProperties() throws Exception { final Properties gemfireProperties = createGemFireProperties(); - gemfireProperties.put("mcast-ttl", "64"); + gemfireProperties.put(MCAST_TTL, "64"); RegionFactory factory = new RegionFactory(gemfireProperties); r1 = factory.create(this.r1Name); assertBasicRegionFunctionality(r1, r1Name); - assertEquals(gemfireProperties.get("mcast-ttl"), r1.getCache().getDistributedSystem().getProperties().get("mcast-ttl")); + assertEquals(gemfireProperties.get(MCAST_TTL), r1.getCache().getDistributedSystem().getProperties().get(MCAST_TTL)); } /** @@ -374,9 +371,9 @@ public class RegionFactoryJUnitTest { File xmlFile = null; try { final Properties gemfireProperties = createGemFireProperties(); - gemfireProperties.put("mcast-ttl", "64"); + gemfireProperties.put(MCAST_TTL, "64"); final String xmlFileName = getName() + "-cache.xml"; - gemfireProperties.put("cache-xml-file", xmlFileName); + gemfireProperties.put(DistributionConfig.CACHE_XML_FILE_NAME, xmlFileName); xmlFile = new File(xmlFileName); xmlFile.delete(); xmlFile.createNewFile(); @@ -402,8 +399,9 @@ public class RegionFactoryJUnitTest { RegionFactory factory = new RegionFactory(gemfireProperties, attrsId); r1 = factory.create(this.r1Name); assertBasicRegionFunctionality(r1, r1Name); - assertEquals(gemfireProperties.get("mcast-ttl"), r1.getCache().getDistributedSystem().getProperties().get("mcast-ttl")); - assertEquals(gemfireProperties.get("cache-xml-file"), r1.getCache().getDistributedSystem().getProperties().get("cache-xml-file")); + assertEquals(gemfireProperties.get(MCAST_TTL), r1.getCache().getDistributedSystem().getProperties().get(MCAST_TTL)); + assertEquals(gemfireProperties.get(DistributionConfig.CACHE_XML_FILE_NAME), + r1.getCache().getDistributedSystem().getProperties().get(DistributionConfig.CACHE_XML_FILE_NAME)); RegionAttributes ra = r1.getAttributes(); assertEquals(ra.getStatisticsEnabled(), true); assertEquals(ra.getScope().isDistributedAck(), true); @@ -1131,8 +1129,8 @@ public class RegionFactoryJUnitTest { private Properties createGemFireProperties() { Properties props = new Properties(); - props.put("mcast-port", "0"); - props.put("locators", ""); + props.put(MCAST_PORT, "0"); + props.put(LOCATORS, ""); return props; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java index 5efac05..e99af37 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java @@ -16,12 +16,10 @@ */ package com.gemstone.gemfire.cache.asyncqueue; -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import com.jayway.awaitility.Awaitility; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -29,20 +27,14 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.EvictionAction; -import com.gemstone.gemfire.cache.EvictionAttributes; -import com.gemstone.gemfire.cache.ExpirationAction; -import com.gemstone.gemfire.cache.ExpirationAttributes; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.RegionShortcut; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; -import com.jayway.awaitility.Awaitility; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; -import static org.mockito.Mockito.*; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; @Category(IntegrationTest.class) public class AsyncEventQueueEvictionAndExpirationJUnitTest { @@ -61,7 +53,7 @@ public class AsyncEventQueueEvictionAndExpirationJUnitTest { //ignore } if (null == cache) { - cache = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0").create(); + cache = (GemFireCacheImpl) new CacheFactory().set(MCAST_PORT, "0").create(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java index 5014676..aa8095a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java @@ -16,17 +16,17 @@ */ package com.gemstone.gemfire.cache.asyncqueue.internal; -import static org.junit.Assert.*; - +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes; +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 com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; @Category(IntegrationTest.class) public class SerialAsyncEventQueueImplJUnitTest { @@ -34,7 +34,7 @@ public class SerialAsyncEventQueueImplJUnitTest { private Cache cache; @Before public void setUp() { - CacheFactory cf = new CacheFactory().set("mcast-port", "0"); + CacheFactory cf = new CacheFactory().set(MCAST_PORT, "0"); cache = cf.create(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientCacheFactoryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientCacheFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientCacheFactoryJUnitTest.java index b17e69c..5abddf4 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientCacheFactoryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientCacheFactoryJUnitTest.java @@ -17,32 +17,13 @@ package com.gemstone.gemfire.cache.client; -import static org.junit.Assert.*; -import static org.junit.runners.MethodSorters.*; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.File; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Properties; - -import org.jgroups.util.UUID; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.cache.RegionService; import com.gemstone.gemfire.cache.client.internal.ProxyCache; import com.gemstone.gemfire.cache.client.internal.UserAttributes; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember; @@ -54,6 +35,28 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID; import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.jgroups.util.UUID; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +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.assertEquals; +import static org.junit.Assert.fail; +import static org.junit.runners.MethodSorters.NAME_ASCENDING; /** * Unit test for the ClientCacheFactory class @@ -90,8 +93,8 @@ public class ClientCacheFactoryJUnitTest { GemFireCacheImpl gfc = (GemFireCacheImpl)this.cc; assertEquals(true, gfc.isClient()); Properties dsProps = this.cc.getDistributedSystem().getProperties(); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); Pool defPool = gfc.getDefaultPool(); assertEquals("DEFAULT", defPool.getName()); assertEquals(new ArrayList(), defPool.getLocators()); @@ -103,7 +106,7 @@ public class ClientCacheFactoryJUnitTest { } try { - new ClientCacheFactory().set("log-level", "severe").create(); + new ClientCacheFactory().set(DistributionConfig.LOG_LEVEL_NAME, "severe").create(); fail("expected create to fail"); } catch (IllegalStateException expected) { } @@ -122,13 +125,13 @@ public class ClientCacheFactoryJUnitTest { URL url = ClientCacheFactoryJUnitTest.class.getResource("ClientCacheFactoryJUnitTest_single_pool.xml");; FileUtil.copy(url, this.tmpFile); this.cc = new ClientCacheFactory() - .set("cache-xml-file", this.tmpFile.getAbsolutePath()) + .set(DistributionConfig.CACHE_XML_FILE_NAME, this.tmpFile.getAbsolutePath()) .create(); GemFireCacheImpl gfc = (GemFireCacheImpl)this.cc; assertEquals(true, gfc.isClient()); Properties dsProps = this.cc.getDistributedSystem().getProperties(); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); Pool defPool = gfc.getDefaultPool(); assertEquals("my_pool_name", defPool.getName()); assertEquals(new ArrayList(), defPool.getLocators()); @@ -141,7 +144,7 @@ public class ClientCacheFactoryJUnitTest { @Test public void test002DPsinglePool() throws Exception { Properties dsProps = new Properties(); - dsProps.setProperty("mcast-port", "0"); + dsProps.setProperty(MCAST_PORT, "0"); DistributedSystem ds = DistributedSystem.connect(dsProps); Pool p = PoolManager.createFactory().addServer(InetAddress.getLocalHost().getHostName(), 7777).create("singlePool"); this.cc = new ClientCacheFactory().create(); @@ -179,7 +182,7 @@ public class ClientCacheFactoryJUnitTest { @Test public void test003DPmultiplePool() throws Exception { Properties dsProps = new Properties(); - dsProps.setProperty("mcast-port", "0"); + dsProps.setProperty(MCAST_PORT, "0"); DistributedSystem ds = DistributedSystem.connect(dsProps); PoolManager.createFactory().addServer(InetAddress.getLocalHost().getHostName(), 7777).create("p7"); PoolManager.createFactory().addServer(InetAddress.getLocalHost().getHostName(), 6666).create("p6"); @@ -214,13 +217,13 @@ public class ClientCacheFactoryJUnitTest { @Test public void test004SetMethod() throws Exception { - this.cc = new ClientCacheFactory().set("log-level", "severe").create(); + this.cc = new ClientCacheFactory().set(DistributionConfig.LOG_LEVEL_NAME, "severe").create(); GemFireCacheImpl gfc = (GemFireCacheImpl)this.cc; assertEquals(true, gfc.isClient()); Properties dsProps = this.cc.getDistributedSystem().getProperties(); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); - assertEquals("severe", dsProps.getProperty("log-level")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); + assertEquals("severe", dsProps.getProperty(DistributionConfig.LOG_LEVEL_NAME)); } @Test @@ -233,8 +236,8 @@ public class ClientCacheFactoryJUnitTest { assertEquals(true, gfc.isClient()); Properties dsProps = this.cc.getDistributedSystem().getProperties(); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); Pool defPool = gfc.getDefaultPool(); assertEquals("DEFAULT", defPool.getName()); assertEquals(new ArrayList(), defPool.getLocators()); @@ -244,8 +247,8 @@ public class ClientCacheFactoryJUnitTest { // make sure we can create another secure user cache RegionService cc2 = this.cc.createAuthenticatedView(suProps); assertEquals(true, gfc.isClient()); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); defPool = gfc.getDefaultPool(); assertEquals("DEFAULT", defPool.getName()); assertEquals(new ArrayList(), defPool.getLocators()); @@ -264,8 +267,8 @@ public class ClientCacheFactoryJUnitTest { GemFireCacheImpl gfc = (GemFireCacheImpl)this.cc; assertEquals(true, gfc.isClient()); Properties dsProps = this.cc.getDistributedSystem().getProperties(); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); Pool defPool = gfc.getDefaultPool(); assertEquals("DEFAULT", defPool.getName()); assertEquals(new ArrayList(), defPool.getLocators()); @@ -275,8 +278,8 @@ public class ClientCacheFactoryJUnitTest { gfc = (GemFireCacheImpl)this.cc; assertEquals(true, gfc.isClient()); dsProps = this.cc.getDistributedSystem().getProperties(); - assertEquals("0", dsProps.getProperty("mcast-port")); - assertEquals("", dsProps.getProperty("locators")); + assertEquals("0", dsProps.getProperty(MCAST_PORT)); + assertEquals("", dsProps.getProperty(LOCATORS)); defPool = gfc.getDefaultPool(); assertEquals("DEFAULT", defPool.getName()); assertEquals(new ArrayList(), defPool.getLocators()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientRegionFactoryJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientRegionFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientRegionFactoryJUnitTest.java index 91f6741..1435172 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientRegionFactoryJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientRegionFactoryJUnitTest.java @@ -16,33 +16,7 @@ */ package com.gemstone.gemfire.cache.client; -import static com.gemstone.gemfire.cache.client.ClientRegionShortcut.*; -import static org.junit.Assert.*; - -import java.net.InetAddress; -import java.util.Arrays; -import java.util.Properties; - -import org.junit.After; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheListener; -import com.gemstone.gemfire.cache.CustomExpiry; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.EvictionAction; -import com.gemstone.gemfire.cache.EvictionAttributes; -import com.gemstone.gemfire.cache.ExpirationAttributes; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.RegionDestroyedException; -import com.gemstone.gemfire.cache.RegionExistsException; -import com.gemstone.gemfire.cache.RegionService; -import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.internal.ProxyRegion; import com.gemstone.gemfire.cache.query.Query; import com.gemstone.gemfire.cache.query.QueryService; @@ -51,6 +25,20 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.cache.LocalRegion; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import java.net.InetAddress; +import java.util.Arrays; +import java.util.Properties; + +import static com.gemstone.gemfire.cache.client.ClientRegionShortcut.*; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * Unit test for the ClientRegionFactory class @@ -482,8 +470,8 @@ public class ClientRegionFactoryJUnitTest { private Properties createGemFireProperties() { Properties props = new Properties(); - props.put("mcast-port", "0"); - props.put("locators", ""); + props.put(MCAST_PORT, "0"); + props.put(LOCATORS, ""); return props; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java index f5513df..44d03ce 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java @@ -16,29 +16,21 @@ */ package com.gemstone.gemfire.cache.client; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.cache.server.CacheServer; +import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig; +import com.gemstone.gemfire.cache.util.CacheListenerAdapter; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.AvailablePortHelper; +import com.gemstone.gemfire.test.dunit.*; + import java.io.IOException; import java.net.UnknownHostException; import java.util.Stack; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.EntryEvent; -import com.gemstone.gemfire.cache.InterestResultPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.server.CacheServer; -import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig; -import com.gemstone.gemfire.cache.util.CacheListenerAdapter; -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.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * The ClientServerRegisterInterestsDUnitTest class is a test suite of test cases testing the interaction between a @@ -93,9 +85,9 @@ public class ClientServerRegisterInterestsDUnitTest extends DistributedTestCase try { Cache cache = new CacheFactory() .set("name", "ClientServerRegisterInterestsTestGemFireServer") - .set("mcast-port", "0") - .set("log-file", "clientServerRegisterInterestsTest.log") - .set("log-level", "config") + .set(MCAST_PORT, "0") + .set(DistributionConfig.LOG_FILE_NAME, "clientServerRegisterInterestsTest.log") + .set(DistributionConfig.LOG_LEVEL_NAME, "config") //.set("jmx-manager", "true") //.set("jmx-manager-http-port", "0") //.set("jmx-manager-port", "1199") @@ -148,7 +140,7 @@ public class ClientServerRegisterInterestsDUnitTest extends DistributedTestCase private ClientCache setupGemFireClientCache() { ClientCache clientCache = new ClientCacheFactory() - .set("durable-client-id", "TestDurableClientId") + .set(DistributionConfig.DURABLE_CLIENT_ID_NAME, "TestDurableClientId") .create(); PoolFactory poolFactory = PoolManager.createFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java index 667af89..72bed06 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java @@ -16,31 +16,8 @@ */ package com.gemstone.gemfire.cache.client.internal; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.net.ConnectException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.CancelCriterion; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.GemFireCache; -import com.gemstone.gemfire.cache.RegionService; -import com.gemstone.gemfire.cache.NoSubscriptionServersAvailableException; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.NoAvailableLocatorsException; import com.gemstone.gemfire.cache.client.SubscriptionNotEnabledException; import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest; @@ -48,7 +25,6 @@ import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRespon import com.gemstone.gemfire.cache.client.internal.locator.LocatorListResponse; import com.gemstone.gemfire.cache.query.QueryService; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.PoolStatHelper; import com.gemstone.gemfire.distributed.internal.ServerLocation; @@ -59,6 +35,27 @@ import com.gemstone.gemfire.distributed.internal.tcpserver.TcpServer; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.cache.PoolStats; 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.IOException; +import java.net.ConnectException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +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.fail; /** * @@ -79,8 +76,8 @@ public class AutoConnectionSourceImplJUnitTest { @Before public void setUp() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); DistributedSystem ds = DistributedSystem.connect(props); cache = CacheFactory.create(ds); @@ -94,8 +91,8 @@ public class AutoConnectionSourceImplJUnitTest { //very irritating, the SystemTimer requires having a distributed system Properties properties = new Properties(); - properties.put(DistributionConfig.MCAST_PORT_NAME, "0"); - properties.put(DistributionConfig.LOCATORS_NAME, ""); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); background = Executors.newSingleThreadScheduledExecutor(); List/*<InetSocketAddress>*/ locators = new ArrayList(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java index 15f5d52..4b61979 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java @@ -16,15 +16,7 @@ */ package com.gemstone.gemfire.cache.client.internal; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -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.RegionFactory; -import com.gemstone.gemfire.cache.RegionShortcut; +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.ClientRegionFactory; @@ -34,11 +26,19 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.security.AuthenticationRequiredException; import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.IgnoredException; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.IgnoredException; import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.util.test.TestUtil; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; + /** * Tests cacheserver ssl support added. See https://svn.gemstone.com/trac/gemfire/ticket/48995 for details */ @@ -71,8 +71,8 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase { public Cache createCache(Properties props) throws Exception { - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); cache = new CacheFactory(props).create(); if (cache == null) { throw new Exception("CacheFactory.create() returned null "); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/ConnectionPoolImplJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/ConnectionPoolImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/ConnectionPoolImplJUnitTest.java index 532f514..8f055d9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/ConnectionPoolImplJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/ConnectionPoolImplJUnitTest.java @@ -16,17 +16,6 @@ */ package com.gemstone.gemfire.cache.client.internal; -import static org.junit.Assert.*; - -import java.net.InetSocketAddress; -import java.net.SocketTimeoutException; -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.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.client.Pool; @@ -39,6 +28,18 @@ import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.internal.AvailablePort; 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 java.net.InetSocketAddress; +import java.net.SocketTimeoutException; +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.*; /** * @@ -55,8 +56,8 @@ public class ConnectionPoolImplJUnitTest { @Before public void setUp() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); cache = CacheFactory.create(DistributedSystem.connect(props)); port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java index 54c819e..ee17818 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java @@ -34,6 +34,8 @@ import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.util.*; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; + /** * */ @@ -94,8 +96,8 @@ public abstract class LocatorTestBase extends DistributedTestCase { final String testName = getUniqueName(); disconnectFromDS(); Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0)); - props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators); + props.setProperty(MCAST_PORT, String.valueOf(0)); + props.setProperty(LOCATORS, otherLocators); props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); try { @@ -185,8 +187,8 @@ public abstract class LocatorTestBase extends DistributedTestCase { protected int startBridgeServer(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException { Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, locators); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, locators); DistributedSystem ds = getSystem(props); Cache cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); @@ -211,9 +213,9 @@ public abstract class LocatorTestBase extends DistributedTestCase { protected int startBridgeServerWithEmbeddedLocator(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException { Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0)); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators); - props.setProperty(DistributionConfig.LOCATORS_NAME, locators); + props.setProperty(MCAST_PORT, String.valueOf(0)); + props.setProperty(START_LOCATOR, locators); + props.setProperty(LOCATORS, locators); DistributedSystem ds = getSystem(props); Cache cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); @@ -290,8 +292,8 @@ public abstract class LocatorTestBase extends DistributedTestCase { protected void startBridgeClient(final Pool pool, final String[] regions) throws Exception { Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0)); - props.setProperty(DistributionConfig.LOCATORS_NAME, ""); + props.setProperty(MCAST_PORT, String.valueOf(0)); + props.setProperty(LOCATORS, ""); DistributedSystem ds = getSystem(props); Cache cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/QueueManagerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/QueueManagerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/QueueManagerJUnitTest.java index c2872e7..6ea0bdf 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/QueueManagerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/QueueManagerJUnitTest.java @@ -16,35 +16,12 @@ */ package com.gemstone.gemfire.cache.client.internal; -import static org.junit.Assert.*; - -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.CancelCriterion; -import com.gemstone.gemfire.cache.RegionService; import com.gemstone.gemfire.cache.NoSubscriptionServersAvailableException; +import com.gemstone.gemfire.cache.RegionService; import com.gemstone.gemfire.cache.client.SubscriptionNotEnabledException; import com.gemstone.gemfire.cache.query.QueryService; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.cache.PoolStats; @@ -54,6 +31,23 @@ import com.gemstone.gemfire.internal.logging.InternalLogWriter; import com.gemstone.gemfire.internal.logging.LocalLogWriter; import com.gemstone.gemfire.internal.util.StopWatch; 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.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.net.UnknownHostException; +import java.nio.ByteBuffer; +import java.util.*; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * @@ -78,8 +72,8 @@ public class QueueManagerJUnitTest { public void setUp() { this.logger = new LocalLogWriter(InternalLogWriter.FINEST_LEVEL, System.out); Properties properties = new Properties(); - properties.put(DistributionConfig.MCAST_PORT_NAME, "0"); - properties.put(DistributionConfig.LOCATORS_NAME, ""); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); ds = DistributedSystem.connect(properties); stats = new PoolStats(ds, "QueueManagerJUnitTest"); pool = new DummyPool(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java index dd146a6..c9d5e84 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java @@ -16,15 +16,7 @@ */ package com.gemstone.gemfire.cache.client.internal; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -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.RegionFactory; -import com.gemstone.gemfire.cache.RegionShortcut; +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.ClientRegionFactory; @@ -32,12 +24,19 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePortHelper; -import com.gemstone.gemfire.security.AuthenticationRequiredException; import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.util.test.TestUtil; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; + /** * Test for GEODE-396 */ @@ -65,8 +64,8 @@ public class SSLNoClientAuthDUnitTest extends DistributedTestCase { public Cache createCache(Properties props) throws Exception { - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); cache = new CacheFactory(props).create(); if (cache == null) { throw new Exception("CacheFactory.create() returned null "); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java index fc06afd..6321c14 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java @@ -16,43 +16,12 @@ */ package com.gemstone.gemfire.cache.client.internal.pooling; -import static org.junit.Assert.fail; - -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.util.Collections; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -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.CancelCriterion; import com.gemstone.gemfire.cache.client.AllConnectionsInUseException; import com.gemstone.gemfire.cache.client.NoAvailableServersException; -import com.gemstone.gemfire.cache.client.internal.ClientUpdater; -import com.gemstone.gemfire.cache.client.internal.Connection; -import com.gemstone.gemfire.cache.client.internal.ConnectionFactory; -import com.gemstone.gemfire.cache.client.internal.ConnectionStats; -import com.gemstone.gemfire.cache.client.internal.Endpoint; -import com.gemstone.gemfire.cache.client.internal.EndpointManager; -import com.gemstone.gemfire.cache.client.internal.EndpointManagerImpl; -import com.gemstone.gemfire.cache.client.internal.Op; -import com.gemstone.gemfire.cache.client.internal.QueueManager; -import com.gemstone.gemfire.cache.client.internal.ServerBlackList; +import com.gemstone.gemfire.cache.client.internal.*; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.cache.PoolStats; @@ -64,6 +33,28 @@ import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; import com.gemstone.gemfire.test.junit.categories.FlakyTest; 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 java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.net.UnknownHostException; +import java.nio.ByteBuffer; +import java.util.Collections; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.fail; @Category(IntegrationTest.class) public class ConnectionManagerJUnitTest { @@ -87,8 +78,8 @@ public class ConnectionManagerJUnitTest { factory = new DummyFactory(); Properties properties = new Properties(); - properties.put(DistributionConfig.MCAST_PORT_NAME, "0"); - properties.put(DistributionConfig.LOCATORS_NAME, ""); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); ds = DistributedSystem.connect(properties); background = Executors.newSingleThreadScheduledExecutor(); poolStats = new PoolStats(ds, "connectionManagerJUnitTest"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MXMemoryPoolListenerExample.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MXMemoryPoolListenerExample.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MXMemoryPoolListenerExample.java index 0c0a4c0..af13c04 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MXMemoryPoolListenerExample.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MXMemoryPoolListenerExample.java @@ -16,6 +16,14 @@ */ package com.gemstone.gemfire.cache.management; +import com.gemstone.gemfire.LogWriter; +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; + +import javax.management.Notification; +import javax.management.NotificationEmitter; +import javax.management.NotificationListener; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; import java.lang.management.MemoryPoolMXBean; @@ -25,19 +33,7 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import javax.management.Notification; -import javax.management.NotificationEmitter; -import javax.management.NotificationListener; - -import com.gemstone.gemfire.LogWriter; -import com.gemstone.gemfire.admin.DistributedSystemConfig; -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.distributed.DistributedSystem; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * An test class for exploring the various notification listener behaviors @@ -105,11 +101,11 @@ public class MXMemoryPoolListenerExample implements NotificationListener { } Properties dsProps = new Properties(); - dsProps.setProperty(DistributedSystemConfig.MCAST_PORT_NAME, "0"); // Loner - dsProps.setProperty(DistributedSystemConfig.LOG_LEVEL_NAME, "info"); - dsProps.setProperty(DistributionConfig.STATISTIC_SAMPLE_RATE_NAME, "200"); - dsProps.setProperty(DistributionConfig.ENABLE_TIME_STATISTICS_NAME, "true"); - dsProps.setProperty(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); + dsProps.setProperty(MCAST_PORT, "0"); // Loner + dsProps.setProperty(SystemConfigurationProperties.LOG_LEVEL, "info"); + dsProps.setProperty(SystemConfigurationProperties.STATISTIC_SAMPLE_RATE, "200"); + dsProps.setProperty(SystemConfigurationProperties.ENABLE_TIME_STATISTICS, "true"); + dsProps.setProperty(SystemConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true"); DistributedSystem ds = DistributedSystem.connect(dsProps); final LogWriter logger = ds.getLogWriter();
