http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java index 33306d8..9b40e48 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java @@ -16,53 +16,25 @@ */ package com.gemstone.gemfire.disttx; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.CountDownLatch; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheTransactionManager; -import com.gemstone.gemfire.cache.CommitConflictException; -import com.gemstone.gemfire.cache.CommitIncompleteException; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.DiskStore; -import com.gemstone.gemfire.cache.InterestPolicy; -import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.SubscriptionAttributes; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.ReplyException; import com.gemstone.gemfire.i18n.LogWriterI18n; import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.cache.CacheServerImpl; -import com.gemstone.gemfire.internal.cache.BucketRegion; -import com.gemstone.gemfire.internal.cache.DistTXState; -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.RegionEntry; -import com.gemstone.gemfire.internal.cache.TXManagerImpl; -import com.gemstone.gemfire.internal.cache.TXState; -import com.gemstone.gemfire.internal.cache.TXStateInterface; -import com.gemstone.gemfire.internal.cache.TXStateProxyImpl; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.cache.execute.CustomerIDPartitionResolver; import com.gemstone.gemfire.internal.cache.execute.data.CustId; import com.gemstone.gemfire.internal.cache.execute.data.Customer; import com.gemstone.gemfire.internal.cache.execute.data.Order; import com.gemstone.gemfire.internal.cache.execute.data.OrderId; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.Invoke; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.CountDownLatch; /** * Port of GemFireXD's corresponding test for distributed transactions @@ -83,7 +55,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { - System.setProperty("gemfire.sync-commits", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "sync-commits", "true"); return null; } }); @@ -103,7 +75,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { - System.setProperty("gemfire.sync-commits", "false"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "sync-commits", "false"); return null; } });
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXDUnitTest.java index da9b511..7f75cae 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXDUnitTest.java @@ -16,11 +16,11 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.execute.PRTransactionDUnitTest; +import java.util.Properties; + public class PRDistTXDUnitTest extends PRTransactionDUnitTest { public PRDistTXDUnitTest(String name) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXJUnitTest.java index dc0830a..2e539e3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXJUnitTest.java @@ -16,19 +16,21 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.PRTXJUnitTest; import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; /** * Same tests as that of {@link PRTXJUnitTest} after setting @@ -44,9 +46,9 @@ public class PRDistTXJUnitTest extends PRTXJUnitTest { @Override protected void createCache() throws Exception { Properties p = new Properties(); - p.setProperty("mcast-port", "0"); // loner - p.setProperty("distributed-transactions", "true"); - // p.setProperty("log-level", "fine"); + p.setProperty(MCAST_PORT, "0"); // loner + p.setProperty(SystemConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true"); + // p.setProperty(DistributionConfig.LOG_LEVEL_NAME, "fine"); this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem .connect(p)); createRegion(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXWithVersionsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXWithVersionsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXWithVersionsDUnitTest.java index 424c0f6..f02ade9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXWithVersionsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PRDistTXWithVersionsDUnitTest.java @@ -16,11 +16,11 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.execute.PRTransactionWithVersionsDUnitTest; +import java.util.Properties; + public class PRDistTXWithVersionsDUnitTest extends PRTransactionWithVersionsDUnitTest { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/disttx/PersistentPartitionedRegionWithDistTXDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PersistentPartitionedRegionWithDistTXDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PersistentPartitionedRegionWithDistTXDUnitTest.java index 745ad60..d9b8ed7 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/PersistentPartitionedRegionWithDistTXDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/PersistentPartitionedRegionWithDistTXDUnitTest.java @@ -16,13 +16,11 @@ */ package com.gemstone.gemfire.disttx; -import java.util.Properties; - -import org.junit.Ignore; - import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.partitioned.PersistentPartitionedRegionWithTransactionDUnitTest; +import java.util.Properties; + /** * Same tests as that of http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java index 234d032..48fa764 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java @@ -16,15 +16,16 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.*; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; import java.lang.reflect.Method; import java.util.Map; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; @Category(UnitTest.class) public class AbstractConfigJUnitTest { @@ -35,12 +36,12 @@ public class AbstractConfigJUnitTest { Method method = actc.getClass().getSuperclass().getDeclaredMethod("okToDisplayPropertyValue", String.class); method.setAccessible(true); assertFalse((Boolean) method.invoke(actc, "password")); - assertFalse((Boolean) method.invoke(actc, "cluster-ssl-truststore-password")); - assertTrue((Boolean) method.invoke(actc, "cluster-ssl-enabled")); - assertFalse((Boolean) method.invoke(actc, "gateway-ssl-truststore-password")); - assertFalse((Boolean) method.invoke(actc, "server-ssl-keystore-password")); - assertTrue((Boolean) method.invoke(actc, "ssl-enabled")); - assertTrue((Boolean) method.invoke(actc, "conserve-sockets")); + assertFalse((Boolean) method.invoke(actc, DistributionConfig.CLUSTER_SSL_TRUSTSTORE_PASSWORD_NAME)); + assertTrue((Boolean) method.invoke(actc, DistributionConfig.CLUSTER_SSL_ENABLED_NAME)); + assertFalse((Boolean) method.invoke(actc, DistributionConfig.GATEWAY_SSL_TRUSTSTORE_PASSWORD_NAME)); + assertFalse((Boolean) method.invoke(actc, DistributionConfig.SERVER_SSL_KEYSTORE_PASSWORD_NAME)); + assertTrue((Boolean) method.invoke(actc, DistributionConfig.SSL_ENABLED_NAME)); + assertTrue((Boolean) method.invoke(actc, DistributionConfig.CONSERVE_SOCKETS_NAME)); assertFalse((Boolean) method.invoke(actc, "javax.net.ssl.keyStorePassword")); assertFalse((Boolean) method.invoke(actc, "javax.net.ssl.keyStoreType")); assertFalse((Boolean) method.invoke(actc, "sysprop-value")); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/AvailablePortJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/AvailablePortJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/AvailablePortJUnitTest.java index 706702d..dc1584f 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/AvailablePortJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/AvailablePortJUnitTest.java @@ -16,19 +16,20 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.*; +import com.gemstone.gemfire.admin.internal.InetAddressUtil; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Test; +import org.junit.experimental.categories.Category; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; -import org.junit.After; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.admin.internal.InetAddressUtil; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * multicast availability is tested in JGroupsMessengerJUnitTest @@ -64,7 +65,7 @@ public class AvailablePortJUnitTest { socket = new ServerSocket(); int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); socket.bind(new InetSocketAddress((InetAddress)null, port)); - System.out.println("bind addr="+System.getProperty("gemfire.bind-address")); + System.out.println("bind addr=" + System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "bind-address")); assertFalse(AvailablePort.isPortAvailable(port, AvailablePort.SOCKET)); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/Bug51616JUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/Bug51616JUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/Bug51616JUnitTest.java index ec5ba98..393d848 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/Bug51616JUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/Bug51616JUnitTest.java @@ -16,28 +16,23 @@ */ package com.gemstone.gemfire.internal; -import java.util.Properties; - +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; 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.FixedPartitionAttributes; -import com.gemstone.gemfire.cache.PartitionAttributes; -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.test.junit.categories.IntegrationTest; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; @Category(IntegrationTest.class) public class Bug51616JUnitTest { @Test public void testBug51616() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); final Cache cache = (new CacheFactory(props)).create(); try { RegionFactory<Integer, String> rf1 = cache.createRegionFactory(RegionShortcut.PARTITION); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireStatSamplerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireStatSamplerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireStatSamplerJUnitTest.java index 242775e..9d50cc5 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireStatSamplerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireStatSamplerJUnitTest.java @@ -16,33 +16,13 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.*; -import static org.junit.Assume.*; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.logging.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - import com.gemstone.gemfire.Statistics; import com.gemstone.gemfire.StatisticsType; 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.GemFireStatSampler.LocalStatListenerImpl; import com.gemstone.gemfire.internal.cache.control.HeapMemoryMonitor; -import com.gemstone.gemfire.internal.cache.control.InternalResourceManager; import com.gemstone.gemfire.internal.logging.LogService; import com.gemstone.gemfire.internal.statistics.SampleCollector; import com.gemstone.gemfire.internal.statistics.StatArchiveHandler; @@ -50,6 +30,23 @@ import com.gemstone.gemfire.internal.statistics.StatArchiveHandlerConfig; import com.gemstone.gemfire.internal.stats50.VMStats50; import com.gemstone.gemfire.internal.util.StopWatch; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.apache.logging.log4j.Logger; +import org.junit.*; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import java.io.File; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; +import static org.junit.Assume.assumeFalse; /** * Integration tests for GemFireStatSampler. @@ -184,7 +181,7 @@ public class GemFireStatSamplerJUnitTest extends StatSamplerTestCase { final File archiveFile1 = new File(dir + File.separator + this.testName + ".gfs"); Properties props = createGemFireProperties(); - props.setProperty("statistic-archive-file", archiveFileName); + props.setProperty(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME, archiveFileName); connect(props); GemFireStatSampler statSampler = getGemFireStatSampler(); @@ -363,9 +360,9 @@ public class GemFireStatSamplerJUnitTest extends StatSamplerTestCase { // set the system property to use KB instead of MB for file size System.setProperty(HostStatSampler.TEST_FILE_SIZE_LIMIT_IN_KB_PROPERTY, "true"); Properties props = createGemFireProperties(); - props.setProperty("archive-file-size-limit", "1"); - props.setProperty("archive-disk-space-limit", "0"); - props.setProperty("statistic-archive-file", archiveFileName); + props.setProperty(DistributionConfig.ARCHIVE_FILE_SIZE_LIMIT_NAME, "1"); + props.setProperty(DistributionConfig.ARCHIVE_DISK_SPACE_LIMIT_NAME, "0"); + props.setProperty(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME, archiveFileName); connect(props); assertTrue(getGemFireStatSampler().waitForInitialization(5000)); @@ -411,10 +408,10 @@ public class GemFireStatSamplerJUnitTest extends StatSamplerTestCase { // set the system property to use KB instead of MB for file size System.setProperty(HostStatSampler.TEST_FILE_SIZE_LIMIT_IN_KB_PROPERTY, "true"); Properties props = createGemFireProperties(); - props.setProperty("statistic-archive-file", archiveFileName); - props.setProperty("archive-file-size-limit", "1"); - props.setProperty("archive-disk-space-limit", "12"); - props.setProperty("statistic-sample-rate", String.valueOf(sampleRate)); + props.setProperty(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME, archiveFileName); + props.setProperty(DistributionConfig.ARCHIVE_FILE_SIZE_LIMIT_NAME, "1"); + props.setProperty(DistributionConfig.ARCHIVE_DISK_SPACE_LIMIT_NAME, "12"); + props.setProperty(DistributionConfig.STATISTIC_SAMPLE_RATE_NAME, String.valueOf(sampleRate)); connect(props); assertTrue(getGemFireStatSampler().waitForInitialization(5000)); @@ -537,13 +534,13 @@ public class GemFireStatSamplerJUnitTest extends StatSamplerTestCase { private Properties createGemFireProperties() { Properties props = new Properties(); - props.setProperty("statistic-sampling-enabled", "true"); // TODO: test true/false - props.setProperty("enable-time-statistics", "true"); // TODO: test true/false - props.setProperty("statistic-sample-rate", String.valueOf(STAT_SAMPLE_RATE)); - props.setProperty("archive-file-size-limit", "0"); - props.setProperty("archive-disk-space-limit", "0"); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); // TODO: test true/false + props.setProperty(DistributionConfig.ENABLE_TIME_STATISTICS_NAME, "true"); // TODO: test true/false + props.setProperty(DistributionConfig.STATISTIC_SAMPLE_RATE_NAME, String.valueOf(STAT_SAMPLE_RATE)); + props.setProperty(DistributionConfig.ARCHIVE_FILE_SIZE_LIMIT_NAME, "0"); + props.setProperty(DistributionConfig.ARCHIVE_DISK_SPACE_LIMIT_NAME, "0"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); return props; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireVersionIntegrationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireVersionIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireVersionIntegrationJUnitTest.java index f767cb7..7522211 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireVersionIntegrationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/GemFireVersionIntegrationJUnitTest.java @@ -16,20 +16,19 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.assertNotNull; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; -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.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertNotNull; @Category(IntegrationTest.class) public class GemFireVersionIntegrationJUnitTest { @@ -45,7 +44,7 @@ public class GemFireVersionIntegrationJUnitTest { DistributionConfigImpl.main(args); Properties props = new Properties(); props.load(new FileInputStream(args[0])); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + props.setProperty(MCAST_PORT, "0"); CacheFactory cacheFactory = new CacheFactory(props); Cache c = cacheFactory.create(); assertNotNull(c); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/InlineKeyJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/InlineKeyJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/InlineKeyJUnitTest.java index a4e3861..9cf0844 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/InlineKeyJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/InlineKeyJUnitTest.java @@ -16,35 +16,29 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.Properties; -import java.util.UUID; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.cache.util.ObjectSizer; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryHeapIntKey; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryHeapLongKey; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryHeapObjectKey; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryHeapStringKey1; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryHeapStringKey2; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryHeapUUIDKey; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.util.Properties; +import java.util.UUID; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @Category(IntegrationTest.class) public class InlineKeyJUnitTest { private GemFireCacheImpl createCache() { Properties props = new Properties(); - props.setProperty("locators", ""); - props.setProperty("mcast-port", "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(MCAST_PORT, "0"); GemFireCacheImpl result = (GemFireCacheImpl) new CacheFactory(props).create(); return result; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java index 63febc0..fc9fef5 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java @@ -16,21 +16,11 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.LineNumberReader; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.StringReader; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.Properties; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.logging.LogService; +import com.gemstone.gemfire.test.dunit.ThreadUtils; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import com.gemstone.gemfire.util.test.TestUtil; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.Appender; @@ -46,10 +36,15 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.util.test.TestUtil; -import com.gemstone.gemfire.test.dunit.ThreadUtils; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.io.*; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * Test creation of server sockets and client sockets with various JSSE @@ -57,179 +52,180 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest; */ @Category(IntegrationTest.class) public class JSSESocketJUnitTest { - public @Rule TestName name = new TestName(); - + public + @Rule + TestName name = new TestName(); + private static final org.apache.logging.log4j.Logger logger = LogService.getLogger(); ServerSocket acceptor; Socket server; - - static ByteArrayOutputStream baos = new ByteArrayOutputStream( ); - + + static ByteArrayOutputStream baos = new ByteArrayOutputStream(); + private int randport = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - + @Before - public void setUp( ) throws Exception { - System.out.println( "\n\n########## setup " + name.getMethodName() + " ############\n\n" ); + public void setUp() throws Exception { + System.out.println("\n\n########## setup " + name.getMethodName() + " ############\n\n"); server = null; acceptor = null; baos.reset(); } - + @After - public void tearDown( ) throws Exception { - System.out.println( "\n\n########## teardown " + name.getMethodName() + " ############\n\n" ); - - if ( server != null ) { + public void tearDown() throws Exception { + System.out.println("\n\n########## teardown " + name.getMethodName() + " ############\n\n"); + + if (server != null) { server.close(); } - if ( acceptor != null ) { + if (acceptor != null) { acceptor.close(); } - System.out.println( baos.toString() ); + System.out.println(baos.toString()); } - + //----- test methods ------ - + @Test - public void testSSLSocket( ) throws Exception { + public void testSSLSocket() throws Exception { final Object[] receiver = new Object[1]; - + TestAppender.create(); - + // Get original base log level Level originalBaseLevel = LogService.getBaseLogLevel(); try { - // Set base log level to debug to log the SSL messages - LogService.setBaseLogLevel(Level.DEBUG); - { - System.setProperty( "gemfire.mcast-port", "0"); - System.setProperty( "gemfire.ssl-enabled", "true" ); - System.setProperty( "gemfire.ssl-require-authentication", "true" ); - System.setProperty( "gemfire.ssl-ciphers", "any" ); - System.setProperty( "gemfire.ssl-protocols", "TLSv1.2" ); - - File jks = findTestJKS(); - System.setProperty( "javax.net.ssl.trustStore", jks.getCanonicalPath() ); - System.setProperty( "javax.net.ssl.trustStorePassword", "password" ); - System.setProperty( "javax.net.ssl.keyStore", jks.getCanonicalPath() ); - System.setProperty( "javax.net.ssl.keyStorePassword", "password" ); - } - - assertTrue(SocketCreator.getDefaultInstance().useSSL()); - - Thread serverThread = startServer( receiver ); - - Socket client = SocketCreator.getDefaultInstance().connectForServer( InetAddress.getByName("localhost"), randport ); - - ObjectOutputStream oos = new ObjectOutputStream( client.getOutputStream() ); - String expected = new String( "testing " + name.getMethodName() ); - oos.writeObject( expected ); - oos.flush(); - - ThreadUtils.join(serverThread, 30 * 1000); - - client.close(); - if ( expected.equals( receiver[0] ) ) { - System.out.println( "received " + receiver[0] + " as expected." ); - } else { - throw new Exception( "Expected \"" + expected + "\" but received \"" + receiver[0] + "\"" ); - } - - String logOutput = baos.toString(); - StringReader sreader = new StringReader( logOutput ); - LineNumberReader reader = new LineNumberReader( sreader ); - int peerLogCount = 0; - String line = null; - while( (line = reader.readLine()) != null ) { - - if (line.matches( ".*peer CN=.*" ) ) { - System.out.println( "Found peer log statement." ); - peerLogCount++; + // Set base log level to debug to log the SSL messages + LogService.setBaseLogLevel(Level.DEBUG); + { + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.SSL_ENABLED_NAME, "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.SSL_REQUIRE_AUTHENTICATION_NAME, "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.SSL_CIPHERS_NAME, "any"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.SSL_PROTOCOLS_NAME, "TLSv1.2"); + + File jks = findTestJKS(); + System.setProperty("javax.net.ssl.trustStore", jks.getCanonicalPath()); + System.setProperty("javax.net.ssl.trustStorePassword", "password"); + System.setProperty("javax.net.ssl.keyStore", jks.getCanonicalPath()); + System.setProperty("javax.net.ssl.keyStorePassword", "password"); + } + + assertTrue(SocketCreator.getDefaultInstance().useSSL()); + + Thread serverThread = startServer(receiver); + + Socket client = SocketCreator.getDefaultInstance().connectForServer(InetAddress.getByName("localhost"), randport); + + ObjectOutputStream oos = new ObjectOutputStream(client.getOutputStream()); + String expected = new String("testing " + name.getMethodName()); + oos.writeObject(expected); + oos.flush(); + + ThreadUtils.join(serverThread, 30 * 1000); + + client.close(); + if (expected.equals(receiver[0])) { + System.out.println("received " + receiver[0] + " as expected."); + } else { + throw new Exception("Expected \"" + expected + "\" but received \"" + receiver[0] + "\""); + } + + String logOutput = baos.toString(); + StringReader sreader = new StringReader(logOutput); + LineNumberReader reader = new LineNumberReader(sreader); + int peerLogCount = 0; + String line = null; + while ((line = reader.readLine()) != null) { + + if (line.matches(".*peer CN=.*")) { + System.out.println("Found peer log statement."); + peerLogCount++; + } + } + if (peerLogCount != 2) { + throw new Exception("Expected to find to peer identities logged."); } - } - if ( peerLogCount != 2 ) { - throw new Exception( "Expected to find to peer identities logged." ); - } } finally { // Reset original base log level LogService.setBaseLogLevel(originalBaseLevel); } } - - /** not actually related to this test class, but this is as good a place - as any for this little test of the client-side ability to tell gemfire - to use a given socket factory. We just test the connectForClient method - to see if it's used */ + + /** + * not actually related to this test class, but this is as good a place + * as any for this little test of the client-side ability to tell gemfire + * to use a given socket factory. We just test the connectForClient method + * to see if it's used + */ @Test public void testClientSocketFactory() { - System.getProperties().put("gemfire.clientSocketFactory", - TSocketFactory.class.getName()); - System.getProperties().remove( "gemfire.ssl-enabled"); + System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + "clientSocketFactory", + TSocketFactory.class.getName()); + System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.SSL_ENABLED_NAME); SocketCreator.getDefaultInstance(new Properties()); factoryInvoked = false; try { try { Socket sock = SocketCreator.getDefaultInstance().connectForClient("localhost", 12345, - 0); + 0); sock.close(); fail("socket factory was not invoked"); } catch (IOException e) { assertTrue("socket factory was not invoked: " + factoryInvoked, factoryInvoked); } } finally { - System.getProperties().remove("gemfire.clientSocketFactory"); + System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + "clientSocketFactory"); SocketCreator.getDefaultInstance().initializeClientSocketFactory(); } } - + static boolean factoryInvoked; - - public static class TSocketFactory implements com.gemstone.gemfire.distributed.ClientSocketFactory - { + + public static class TSocketFactory implements com.gemstone.gemfire.distributed.ClientSocketFactory { public TSocketFactory() { } - + public Socket createSocket(InetAddress address, int port) throws IOException { JSSESocketJUnitTest.factoryInvoked = true; throw new IOException("splort!"); } } - - + //------------- utilities ----- - + private File findTestJKS() { return new File(TestUtil.getResourcePath(getClass(), "/ssl/trusted.keystore")); } - - private Thread startServer( final Object[] receiver ) throws Exception { - final ServerSocket ss = SocketCreator.getDefaultInstance().createServerSocket( randport, 0, InetAddress.getByName( "localhost" ) ); - - - Thread t = new Thread( new Runnable() { - public void run( ) { + + private Thread startServer(final Object[] receiver) throws Exception { + final ServerSocket ss = SocketCreator.getDefaultInstance().createServerSocket(randport, 0, InetAddress.getByName("localhost")); + + Thread t = new Thread(new Runnable() { + public void run() { try { - Socket s = ss.accept(); - SocketCreator.getDefaultInstance().configureServerSSLSocket( s ); - ObjectInputStream ois = new ObjectInputStream( s.getInputStream() ); - receiver[0] = ois.readObject( ); - server = s; - acceptor = ss; - } catch ( Exception e ) { + Socket s = ss.accept(); + SocketCreator.getDefaultInstance().configureServerSSLSocket(s); + ObjectInputStream ois = new ObjectInputStream(s.getInputStream()); + receiver[0] = ois.readObject(); + server = s; + acceptor = ss; + } catch (Exception e) { e.printStackTrace(); receiver[0] = e; } } - }, name.getMethodName() + "-server" ); + }, name.getMethodName() + "-server"); t.start(); return t; } public static final class TestAppender extends AbstractAppender { private static final String APPENDER_NAME = TestAppender.class.getName(); - private final static String SOCKET_CREATOR_CLASSNAME= SocketCreator.class.getName(); - + private final static String SOCKET_CREATOR_CLASSNAME = SocketCreator.class.getName(); + private TestAppender() { super(APPENDER_NAME, null, PatternLayout.createDefaultLayout()); start(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/JarClassLoaderJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/JarClassLoaderJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/JarClassLoaderJUnitTest.java index 56b715f..ea3fd64 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/JarClassLoaderJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/JarClassLoaderJUnitTest.java @@ -16,21 +16,19 @@ */ package com.gemstone.gemfire.internal; -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 static org.junit.Assert.fail; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.RandomAccessFile; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.execute.Function; +import com.gemstone.gemfire.cache.execute.FunctionContext; +import com.gemstone.gemfire.cache.execute.FunctionService; +import com.gemstone.gemfire.cache.execute.ResultSender; +import com.gemstone.gemfire.internal.cache.InternalCache; +import com.gemstone.gemfire.internal.cache.execute.FunctionContextImpl; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.*; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; @@ -44,19 +42,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.regex.Pattern; -import org.junit.After; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.execute.Function; -import com.gemstone.gemfire.cache.execute.FunctionContext; -import com.gemstone.gemfire.cache.execute.FunctionService; -import com.gemstone.gemfire.cache.execute.ResultSender; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.cache.InternalCache; -import com.gemstone.gemfire.internal.cache.execute.FunctionContextImpl; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * TODO: Need to fix this testDeclarableFunctionsWithParms and testClassOnClasspath on Windows: @@ -258,7 +245,7 @@ public class JarClassLoaderJUnitTest { final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1"); Properties properties = new Properties(); - properties.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + properties.setProperty(MCAST_PORT, "0"); CacheFactory cacheFactory = new CacheFactory(properties); this.cache = (InternalCache) cacheFactory.create(); @@ -330,7 +317,7 @@ public class JarClassLoaderJUnitTest { final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2"); Properties properties = new Properties(); - properties.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + properties.setProperty(MCAST_PORT, "0"); CacheFactory cacheFactory = new CacheFactory(properties); this.cache = (InternalCache) cacheFactory.create(); @@ -406,7 +393,7 @@ public class JarClassLoaderJUnitTest { final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2"); Properties properties = new Properties(); - properties.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); + properties.setProperty(MCAST_PORT, "0"); CacheFactory cacheFactory = new CacheFactory(properties); this.cache = (InternalCache) cacheFactory.create(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java index e4c0faa..84a72b0 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java @@ -16,28 +16,6 @@ */ package com.gemstone.gemfire.internal; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.RandomAccessFile; -import java.nio.channels.FileLock; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.junit.Test; - import com.gemstone.gemfire.cache.execute.Execution; import com.gemstone.gemfire.cache.execute.FunctionService; import com.gemstone.gemfire.cache.execute.ResultCollector; @@ -49,6 +27,19 @@ import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; +import org.junit.Test; + +import java.io.*; +import java.nio.channels.FileLock; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.CyclicBarrier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Unit tests for the JarDeployer class http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java index f7b6529..5e179f2 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java @@ -16,19 +16,7 @@ */ package com.gemstone.gemfire.internal; -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.CopyOnWriteArrayList; - -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DiskStoreFactory; -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.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.DiskStoreImpl; @@ -43,6 +31,15 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.CopyOnWriteArrayList; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; + public class PdxDeleteFieldDUnitTest extends CacheTestCase{ final List<String> filesToBeDeleted = new CopyOnWriteArrayList<String>(); @@ -56,8 +53,8 @@ public class PdxDeleteFieldDUnitTest extends CacheTestCase{ final Properties props = new Properties(); final int[] locatorPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+locatorPorts[0]+"],localhost["+locatorPorts[1]+"]"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, "localhost[" + locatorPorts[0] + "],localhost[" + locatorPorts[1] + "]"); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File f = new File(DS_NAME); @@ -74,7 +71,7 @@ public class PdxDeleteFieldDUnitTest extends CacheTestCase{ vm1.invoke(new SerializableCallable() { public Object call() throws Exception { disconnectFromDS(); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[0]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[0] + "]"); final Cache cache = (new CacheFactory(props)).setPdxPersistent(true).setPdxDiskStore(DS_NAME).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(new File[]{f}); @@ -90,7 +87,7 @@ public class PdxDeleteFieldDUnitTest extends CacheTestCase{ vm2.invoke(new SerializableCallable() { public Object call() throws Exception { disconnectFromDS(); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[1]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[1] + "]"); final Cache cache = (new CacheFactory(props)).setPdxReadSerialized(true).setPdxPersistent(true).setPdxDiskStore(DS_NAME2).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(new File[]{f2}); @@ -128,7 +125,7 @@ public class PdxDeleteFieldDUnitTest extends CacheTestCase{ vm1.invoke(new SerializableCallable() { public Object call() throws Exception { - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[0]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[0] + "]"); final Cache cache = (new CacheFactory(props)).setPdxPersistent(true).setPdxDiskStore(DS_NAME).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(new File[]{f}); @@ -142,7 +139,7 @@ public class PdxDeleteFieldDUnitTest extends CacheTestCase{ vm2.invoke(new SerializableCallable() { public Object call() throws Exception { - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[1]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[1] + "]"); final Cache cache = (new CacheFactory(props)).setPdxReadSerialized(true).setPdxPersistent(true).setPdxDiskStore(DS_NAME2).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldJUnitTest.java index 17efa97..7b12de8 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldJUnitTest.java @@ -16,37 +16,25 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; - -import java.io.File; -import java.util.Collection; -import java.util.Properties; - -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.DiskStoreFactory; -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.query.internal.DefaultQuery; import com.gemstone.gemfire.internal.cache.DiskStoreImpl; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.util.BlobHelper; -import com.gemstone.gemfire.pdx.PdxInstance; -import com.gemstone.gemfire.pdx.PdxInstanceFactory; -import com.gemstone.gemfire.pdx.PdxReader; -import com.gemstone.gemfire.pdx.PdxSerializable; -import com.gemstone.gemfire.pdx.PdxWriter; -import com.gemstone.gemfire.pdx.internal.PdxField; -import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl; -import com.gemstone.gemfire.pdx.internal.PdxType; -import com.gemstone.gemfire.pdx.internal.PdxUnreadData; -import com.gemstone.gemfire.pdx.internal.TypeRegistry; +import com.gemstone.gemfire.pdx.*; +import com.gemstone.gemfire.pdx.internal.*; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.util.Collection; +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.assertSame; @Category(IntegrationTest.class) public class PdxDeleteFieldJUnitTest { @@ -55,8 +43,8 @@ public class PdxDeleteFieldJUnitTest { public void testPdxDeleteField() throws Exception { String DS_NAME = "PdxDeleteFieldJUnitTestDiskStore"; Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); File f = new File(DS_NAME); f.mkdir(); try { @@ -114,8 +102,8 @@ public class PdxDeleteFieldJUnitTest { @Test public void testPdxFieldDelete() throws Exception { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); try { Cache cache = (new CacheFactory(props)).create(); try { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java index f10d953..ede5e16 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java @@ -16,19 +16,7 @@ */ package com.gemstone.gemfire.internal; -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.CopyOnWriteArrayList; - -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DiskStoreFactory; -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.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.DiskStoreImpl; @@ -44,6 +32,15 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.CopyOnWriteArrayList; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.*; + public class PdxRenameDUnitTest extends CacheTestCase{ final List<String> filesToBeDeleted = new CopyOnWriteArrayList<String>(); @@ -63,8 +60,8 @@ public class PdxRenameDUnitTest extends CacheTestCase{ this.filesToBeDeleted.add(DS_NAME2); final Properties props = new Properties(); - props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+locatorPorts[0]+"],localhost["+locatorPorts[1]+"]"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, "localhost[" + locatorPorts[0] + "],localhost[" + locatorPorts[1] + "]"); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); Host host = Host.getHost(0); @@ -74,7 +71,7 @@ public class PdxRenameDUnitTest extends CacheTestCase{ vm1.invoke(new SerializableCallable() { public Object call() throws Exception { disconnectFromDS(); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[0]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[0] + "]"); final Cache cache = (new CacheFactory(props)).setPdxPersistent(true).setPdxDiskStore(DS_NAME).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(new File[]{f}); @@ -90,7 +87,7 @@ public class PdxRenameDUnitTest extends CacheTestCase{ vm2.invoke(new SerializableCallable() { public Object call() throws Exception { disconnectFromDS(); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[1]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[1] + "]"); final Cache cache = (new CacheFactory(props)).setPdxReadSerialized(true).setPdxPersistent(true).setPdxDiskStore(DS_NAME2).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(new File[]{f2}); @@ -135,7 +132,7 @@ public class PdxRenameDUnitTest extends CacheTestCase{ vm1.invoke(new SerializableCallable() { public Object call() throws Exception { - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[0]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[0] + "]"); final Cache cache = (new CacheFactory(props)).setPdxPersistent(true).setPdxDiskStore(DS_NAME).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(new File[]{f}); @@ -150,7 +147,7 @@ public class PdxRenameDUnitTest extends CacheTestCase{ vm2.invoke(new SerializableCallable() { public Object call() throws Exception { disconnectFromDS(); - props.setProperty(DistributionConfig.START_LOCATOR_NAME, "localhost["+locatorPorts[1]+"]"); + props.setProperty(START_LOCATOR, "localhost[" + locatorPorts[1] + "]"); final Cache cache = (new CacheFactory(props)).setPdxReadSerialized(true).setPdxPersistent(true).setPdxDiskStore(DS_NAME2).create(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameJUnitTest.java index 875a5cc..5f6aac5 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameJUnitTest.java @@ -16,22 +16,7 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.util.Collection; -import java.util.Properties; -import java.util.regex.Pattern; - -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.DiskStoreFactory; -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.internal.cache.DiskStoreImpl; import com.gemstone.gemfire.pdx.PdxReader; import com.gemstone.gemfire.pdx.PdxSerializable; @@ -39,6 +24,17 @@ import com.gemstone.gemfire.pdx.PdxWriter; import com.gemstone.gemfire.pdx.internal.EnumInfo; import com.gemstone.gemfire.pdx.internal.PdxType; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.util.Collection; +import java.util.Properties; +import java.util.regex.Pattern; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; @Category(IntegrationTest.class) public class PdxRenameJUnitTest { @@ -46,8 +42,8 @@ public class PdxRenameJUnitTest { public void testGetPdxTypes() throws Exception { String DS_NAME = "PdxRenameJUnitTestDiskStore"; Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); File f = new File(DS_NAME); f.mkdir(); try { @@ -79,8 +75,8 @@ public class PdxRenameJUnitTest { public void testPdxRename() throws Exception { String DS_NAME = "PdxRenameJUnitTestDiskStore"; Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); File f = new File(DS_NAME); f.mkdir(); try { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/RegionOperationsEqualityShouldUseArrayEqualsIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/RegionOperationsEqualityShouldUseArrayEqualsIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/RegionOperationsEqualityShouldUseArrayEqualsIntegrationTest.java index aaa6a3c..d2c9de9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/RegionOperationsEqualityShouldUseArrayEqualsIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/RegionOperationsEqualityShouldUseArrayEqualsIntegrationTest.java @@ -16,18 +16,19 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.fail; - -import java.util.Properties; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +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.fail; /** * See bug 52093. @@ -39,8 +40,8 @@ public class RegionOperationsEqualityShouldUseArrayEqualsIntegrationTest { private GemFireCacheImpl createCache() { Properties props = new Properties(); - props.setProperty("locators", ""); - props.setProperty("mcast-port", "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(MCAST_PORT, "0"); GemFireCacheImpl result = (GemFireCacheImpl) new CacheFactory(props).create(); return result; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigIntegrationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigIntegrationJUnitTest.java index c4d643d..a931fe8 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigIntegrationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigIntegrationJUnitTest.java @@ -16,17 +16,18 @@ */ package com.gemstone.gemfire.internal; -import static org.junit.Assert.assertTrue; - -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.distributed.internal.DistributionConfig; import com.gemstone.gemfire.management.GemFireProperties; import com.gemstone.gemfire.management.ManagementService; import com.gemstone.gemfire.management.MemberMXBean; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertTrue; /** * Test that DistributionConfigImpl handles SSL options correctly. @@ -37,7 +38,7 @@ public class SSLConfigIntegrationJUnitTest { @Test public void testIsClusterSSLRequireAuthentication() { - Cache mCache = new CacheFactory().set("mcast-port", "0").set("jmx-manager", "true").create(); + Cache mCache = new CacheFactory().set(MCAST_PORT, "0").set(DistributionConfig.JMX_MANAGER_NAME, "true").create(); ManagementService mService = ManagementService.getManagementService(mCache); MemberMXBean mMemberBean = mService.getMemberMXBean(); GemFireProperties mGemFireProperties = mMemberBean.listGemFireProperties();
