http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java index 3845587..ca5f6f7 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java @@ -16,36 +16,24 @@ */ package com.gemstone.gemfire.internal.jta.dunit; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.sql.DataSource; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.jta.CacheUtils; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.ThreadUtils; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; import com.gemstone.gemfire.util.test.TestUtil; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.sql.DataSource; +import java.io.*; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Properties; + public class MaxPoolSizeDUnitTest extends DistributedTestCase { static DistributedSystem ds; @@ -138,9 +126,9 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase { wr.write(modified_file_str); wr.flush(); wr.close(); - props.setProperty("cache-xml-file", path); + props.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, path); String tableName = ""; - // props.setProperty("mcast-port", "10339"); + // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "10339"); try { // ds = DistributedSystem.connect(props); ds = (new MaxPoolSizeDUnitTest("temp")).getSystem(props);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java index 07fa3df..710b7dc 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java @@ -16,40 +16,26 @@ */ package com.gemstone.gemfire.internal.jta.dunit; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.sql.DataSource; -import javax.transaction.UserTransaction; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.datasource.GemFireTransactionDataSource; import com.gemstone.gemfire.internal.jta.CacheUtils; import com.gemstone.gemfire.internal.jta.UserTransactionImpl; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.ThreadUtils; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; import com.gemstone.gemfire.util.test.TestUtil; +import javax.naming.Context; +import javax.sql.DataSource; +import javax.transaction.UserTransaction; +import java.io.*; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.Properties; + /** *This test tests TransactionTimeOut functionality */ @@ -75,8 +61,8 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase { wr.flush(); wr.close(); - props.setProperty("cache-xml-file", path); -// props.setProperty("mcast-port", "10321"); + props.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, path); + // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "10321"); try { // ds = DistributedSystem.connect(props); ds = (new TransactionTimeOutDUnitTest("temp")).getSystem(props); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java index f8542b3..109c316 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java @@ -16,40 +16,27 @@ */ package com.gemstone.gemfire.internal.jta.dunit; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import org.junit.FixMethodOrder; -import org.junit.runners.MethodSorters; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.jta.CacheUtils; import com.gemstone.gemfire.internal.jta.JTAUtils; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.ThreadUtils; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; import com.gemstone.gemfire.util.test.TestUtil; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.sql.DataSource; +import java.io.*; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Properties; /** * This test case is to test the following test scenarios: 1) Behaviour of @@ -197,9 +184,9 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase { wr.write(modified_file_str1); wr.flush(); wr.close(); - props.setProperty("cache-xml-file", path); + props.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, path); String tableName = ""; - // props.setProperty("mcast-port", "10339"); + // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "10339"); try { // ds = DistributedSystem.connect(props); ds = (new TxnManagerMultiThreadDUnitTest("temp")).getSystem(props); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java index 38edde0..fa835be 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java @@ -16,34 +16,22 @@ */ package com.gemstone.gemfire.internal.jta.dunit; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.sql.SQLException; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.transaction.UserTransaction; - import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.jta.CacheUtils; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.ThreadUtils; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.*; import com.gemstone.gemfire.util.test.TestUtil; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.transaction.UserTransaction; +import java.io.*; +import java.sql.SQLException; +import java.util.Properties; + /** *This test sees if the TransactionTimeOut works properly */ @@ -69,9 +57,9 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase { wr.write(modified_file_str); wr.flush(); wr.close(); - props.setProperty("cache-xml-file", path); -// props.setProperty("mcast-port", "10321"); - props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel()); + props.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, path); + // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "10321"); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); try { // ds = DistributedSystem.connect(props); ds = (new TxnTimeOutDUnitTest("temp")).getSystem(props); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java index 061ea97..d4ef01b 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java @@ -16,17 +16,14 @@ */ package com.gemstone.gemfire.internal.logging; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.Properties; -import java.util.Scanner; - +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.logging.log4j.FastLogger; +import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -38,14 +35,15 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; -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.logging.log4j.FastLogger; -import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.Properties; +import java.util.Scanner; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.*; /** * Connects DistributedSystem and tests logging behavior at a high level. @@ -83,13 +81,13 @@ public class DistributedSystemLogFileJUnitTest { final String logFileName = name.getMethodName() + "-system-0.log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "config"); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "config"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File logFile = new File(logFileName); @@ -471,13 +469,13 @@ public class DistributedSystemLogFileJUnitTest { final String logFileName = name.getMethodName() + "-system-"+ System.currentTimeMillis()+".log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "fine"); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File logFile = new File(logFileName); @@ -687,13 +685,13 @@ public class DistributedSystemLogFileJUnitTest { final String logFileName = name.getMethodName() + "-system-"+ System.currentTimeMillis()+".log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "debug"); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "debug"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File logFile = new File(logFileName); @@ -904,14 +902,14 @@ public class DistributedSystemLogFileJUnitTest { final String securityLogFileName = "security" + name.getMethodName() + "-system-"+ System.currentTimeMillis()+".log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "fine"); - properties.put("security-log-file", securityLogFileName); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); + properties.put(DistributionConfig.SECURITY_LOG_FILE_NAME, securityLogFileName); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File securityLogFile = new File(securityLogFileName); @@ -1022,15 +1020,15 @@ public class DistributedSystemLogFileJUnitTest { final String securityLogFileName = "security" + name.getMethodName() + "-system-"+ System.currentTimeMillis()+".log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "fine"); - properties.put("security-log-file", securityLogFileName); - properties.put("security-log-level", "fine"); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); + properties.put(DistributionConfig.SECURITY_LOG_FILE_NAME, securityLogFileName); + properties.put(DistributionConfig.SECURITY_LOG_LEVEL_NAME, "fine"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File securityLogFile = new File(securityLogFileName); @@ -1201,14 +1199,14 @@ public class DistributedSystemLogFileJUnitTest { final String logFileName = name.getMethodName() + "-system-"+ System.currentTimeMillis()+".log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "fine"); - properties.put("security-log-level", "info"); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "fine"); + properties.put(DistributionConfig.SECURITY_LOG_LEVEL_NAME, "info"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File logFile = new File(logFileName); @@ -1350,14 +1348,14 @@ public class DistributedSystemLogFileJUnitTest { final String logFileName = name.getMethodName() + "-system-"+ System.currentTimeMillis()+".log"; final Properties properties = new Properties(); - properties.put("log-file", logFileName); - properties.put("log-level", "info"); - properties.put("security-log-level", "fine"); - properties.put("mcast-port", "0"); - properties.put("locators", ""); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_FILE_NAME, logFileName); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "info"); + properties.put(DistributionConfig.SECURITY_LOG_LEVEL_NAME, "fine"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, ""); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File logFile = new File(logFileName); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java index df9e5b6..f5baa9c 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java @@ -16,20 +16,6 @@ */ package com.gemstone.gemfire.internal.logging; -import java.io.File; -import java.io.FileInputStream; -import java.util.Properties; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - -import static org.junit.Assert.*; -import junit.framework.TestCase; - import com.gemstone.gemfire.distributed.Locator; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; @@ -38,6 +24,19 @@ import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger; import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; 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.io.File; +import java.io.FileInputStream; +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.*; /** * Creates Locator and tests logging behavior at a high level. @@ -71,12 +70,12 @@ public class LocatorLogFileJUnitTest { final String locators = "localhost[" + port + "]"; final Properties properties = new Properties(); - properties.put("log-level", "config"); - properties.put("mcast-port", "0"); - properties.put("locators", locators); - properties.put("enable-network-partition-detection", "false"); - properties.put("disable-auto-reconnect", "true"); - properties.put("member-timeout", "2000"); + properties.put(DistributionConfig.LOG_LEVEL_NAME, "config"); + properties.put(MCAST_PORT, "0"); + properties.put(LOCATORS, locators); + properties.put(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "false"); + properties.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true"); + properties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "2000"); properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); final File logFile = new File(name.getMethodName() + "-locator-" + port + ".log"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java index 4498ca6..d767e98 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java @@ -16,19 +16,18 @@ */ package com.gemstone.gemfire.internal.logging; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Properties; - -import org.junit.Ignore; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.LogWriter; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; import com.gemstone.gemfire.internal.util.IOUtils; import com.gemstone.gemfire.test.junit.categories.PerformanceTest; +import org.junit.Ignore; +import org.junit.experimental.categories.Category; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; /** * Tests performance of logging when level is OFF. @@ -44,7 +43,7 @@ public class LogWriterPerformanceTest extends LoggingPerformanceTestCase { protected Properties createGemFireProperties() { final Properties props = new Properties(); - this.logFile = new File(this.configDirectory, "gemfire.log"); + this.logFile = new File(this.configDirectory, DistributionConfig.GEMFIRE_PREFIX + "log"); final String logFilePath = IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile); props.setProperty(DistributionConfig.LOG_FILE_NAME, logFilePath); props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java index c7f326f..bc7cf39 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java @@ -16,20 +16,20 @@ */ package com.gemstone.gemfire.internal.logging; -import java.io.File; -import java.io.IOException; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.util.StopWatch; - import junit.framework.TestCase; +import java.io.File; +import java.io.IOException; + /** * Tests performance of logging when level is OFF. * */ public abstract class LoggingPerformanceTestCase extends TestCase { - protected static final boolean TIME_BASED = Boolean.getBoolean("gemfire.test.LoggingPerformanceTestCase.TIME_BASED"); + protected static final boolean TIME_BASED = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "test.LoggingPerformanceTestCase.TIME_BASED"); protected static final long TIME_TO_RUN = 1000 * 60 * 10; // ten minutes protected static final int LOG_SETS = 1000; protected static final int LOG_REPETITIONS_PER_SET = 1000; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java index 786565a..9b587a6 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java @@ -16,14 +16,6 @@ */ package com.gemstone.gemfire.internal.logging; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; - -import junit.framework.Assert; - import com.gemstone.gemfire.GemFireIOException; import com.gemstone.gemfire.LogWriter; import com.gemstone.gemfire.distributed.internal.DistributionConfig; @@ -33,6 +25,9 @@ import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.process.ProcessLauncherContext; import com.gemstone.gemfire.internal.util.LogFileUtils; +import junit.framework.Assert; + +import java.io.*; /** * Creates LogWriter instances for testing. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java index 1ad30bd..f303d35 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java @@ -16,13 +16,11 @@ */ package com.gemstone.gemfire.internal.logging.log4j; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URL; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.FileUtil; +import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase; +import com.gemstone.gemfire.internal.util.IOUtils; +import com.gemstone.gemfire.test.junit.categories.PerformanceTest; import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -31,10 +29,8 @@ import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.junit.Ignore; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.internal.FileUtil; -import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase; -import com.gemstone.gemfire.internal.util.IOUtils; -import com.gemstone.gemfire.test.junit.categories.PerformanceTest; +import java.io.*; +import java.net.URL; @Category(PerformanceTest.class) @Ignore("Tests have no assertions") @@ -99,8 +95,8 @@ public class Log4J2PerformanceTest extends LoggingPerformanceTestCase { FileUtils.copyFileToDirectory(src, this.configDirectory); this.config = new File(this.configDirectory, "log4j2-test.xml"); assertTrue(this.config.exists()); - - this.logFile = new File(this.configDirectory, "gemfire.log"); + + this.logFile = new File(this.configDirectory, DistributionConfig.GEMFIRE_PREFIX + "log"); final String logFilePath = IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile); final String logFileName = FileUtil.stripOffExtension(logFilePath); setPropertySubstitutionValues(logFileName, DEFAULT_LOG_FILE_SIZE_LIMIT, DEFAULT_LOG_FILE_COUNT_LIMIT); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java index 3d8ee46..f186672 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java @@ -16,13 +16,11 @@ */ package com.gemstone.gemfire.internal.logging.log4j; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URL; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.FileUtil; +import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase; +import com.gemstone.gemfire.internal.util.IOUtils; +import com.gemstone.gemfire.test.junit.categories.PerformanceTest; import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; @@ -30,10 +28,8 @@ import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.junit.Ignore; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.internal.FileUtil; -import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase; -import com.gemstone.gemfire.internal.util.IOUtils; -import com.gemstone.gemfire.test.junit.categories.PerformanceTest; +import java.io.*; +import java.net.URL; @Category(PerformanceTest.class) @Ignore("Tests have no assertions") @@ -98,8 +94,8 @@ public class LogWriterLoggerPerformanceTest extends LoggingPerformanceTestCase { FileUtils.copyFileToDirectory(src, this.configDirectory); this.config = new File(this.configDirectory, "log4j2-test.xml"); assertTrue(this.config.exists()); - - this.logFile = new File(this.configDirectory, "gemfire.log"); + + this.logFile = new File(this.configDirectory, DistributionConfig.GEMFIRE_PREFIX + "log"); final String logFilePath = IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile); final String logFileName = FileUtil.stripOffExtension(logFilePath); setPropertySubstitutionValues(logFileName, DEFAULT_LOG_FILE_SIZE_LIMIT, DEFAULT_LOG_FILE_COUNT_LIMIT); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java index 632b69c..2e86404 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java @@ -16,12 +16,13 @@ */ package com.gemstone.gemfire.internal.logging.log4j.custom; -import static com.gemstone.gemfire.internal.logging.log4j.custom.CustomConfiguration.*; -import static org.assertj.core.api.Assertions.*; - -import java.io.File; -import java.util.Properties; - +import com.gemstone.gemfire.LogWriter; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.logging.LogService; +import com.gemstone.gemfire.internal.logging.log4j.Configurator; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.config.ConfigurationFactory; @@ -36,13 +37,13 @@ import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.junit.rules.TestName; -import com.gemstone.gemfire.LogWriter; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.internal.logging.log4j.Configurator; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import java.io.File; +import java.util.Properties; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOCATORS; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static com.gemstone.gemfire.internal.logging.log4j.custom.CustomConfiguration.*; +import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests with custom log4j2 configuration. @@ -81,8 +82,8 @@ public class CustomConfigWithCacheIntegrationTest { System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, this.customConfigFile.getAbsolutePath()); Properties gemfireProperties = new Properties(); - gemfireProperties.put(DistributionConfig.LOCATORS_NAME, ""); - gemfireProperties.put(DistributionConfig.MCAST_PORT_NAME, "0"); + gemfireProperties.put(LOCATORS, ""); + gemfireProperties.put(MCAST_PORT, "0"); gemfireProperties.put(DistributionConfig.LOG_LEVEL_NAME, "info"); this.cache = new CacheFactory(gemfireProperties).create(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java index 9c6a3db..2b376da 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java @@ -16,22 +16,23 @@ */ package com.gemstone.gemfire.internal.offheap; -import static com.googlecode.catchexception.CatchException.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicReferenceArray; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.test.junit.categories.UnitTest; import org.apache.logging.log4j.Logger; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReferenceArray; + +import static com.googlecode.catchexception.CatchException.catchException; +import static com.googlecode.catchexception.CatchException.caughtException; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.*; @Category(UnitTest.class) public class FreeListManagerTest { @@ -528,7 +529,7 @@ public class FreeListManagerTest { FreeListManager.verifyOffHeapFreeListCount(-1); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { - assertThat(expected.getMessage()).contains("gemfire.OFF_HEAP_FREE_LIST_COUNT must be >= 1."); + assertThat(expected.getMessage()).contains(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_FREE_LIST_COUNT must be >= 1."); } } @Test @@ -537,7 +538,7 @@ public class FreeListManagerTest { FreeListManager.verifyOffHeapFreeListCount(0); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { - assertThat(expected.getMessage()).contains("gemfire.OFF_HEAP_FREE_LIST_COUNT must be >= 1."); + assertThat(expected.getMessage()).contains(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_FREE_LIST_COUNT must be >= 1."); } } @Test @@ -550,7 +551,7 @@ public class FreeListManagerTest { FreeListManager.verifyOffHeapAlignment(-1); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { - assertThat(expected.getMessage()).contains("gemfire.OFF_HEAP_ALIGNMENT must be a multiple of 8"); + assertThat(expected.getMessage()).contains(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_ALIGNMENT must be a multiple of 8"); } } @Test @@ -559,7 +560,7 @@ public class FreeListManagerTest { FreeListManager.verifyOffHeapAlignment(9); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { - assertThat(expected.getMessage()).contains("gemfire.OFF_HEAP_ALIGNMENT must be a multiple of 8"); + assertThat(expected.getMessage()).contains(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_ALIGNMENT must be a multiple of 8"); } } @Test @@ -568,7 +569,7 @@ public class FreeListManagerTest { FreeListManager.verifyOffHeapAlignment(256+8); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { - assertThat(expected.getMessage()).contains("gemfire.OFF_HEAP_ALIGNMENT must be <= 256"); + assertThat(expected.getMessage()).contains(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_ALIGNMENT must be <= 256"); } } @Test http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListOffHeapRegionJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListOffHeapRegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListOffHeapRegionJUnitTest.java index 0272e38..74ddd13 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListOffHeapRegionJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListOffHeapRegionJUnitTest.java @@ -16,9 +16,9 @@ */ package com.gemstone.gemfire.internal.offheap; -import org.junit.experimental.categories.Category; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; @Category(IntegrationTest.class) public class FreeListOffHeapRegionJUnitTest extends OffHeapRegionBase { @@ -30,12 +30,12 @@ public class FreeListOffHeapRegionJUnitTest extends OffHeapRegionBase { @Override public void configureOffHeapStorage() { - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "1m"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "1m"); } @Override public void unconfigureOffHeapStorage() { - System.clearProperty("gemfire.OFF_HEAP_SLAB_SIZE"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE"); } @Override http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/InlineKeyJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/InlineKeyJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/InlineKeyJUnitTest.java index 9916b0a..b08c860 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/InlineKeyJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/InlineKeyJUnitTest.java @@ -16,36 +16,31 @@ */ package com.gemstone.gemfire.internal.offheap; -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.VMThinRegionEntryOffHeapIntKey; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryOffHeapLongKey; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryOffHeapObjectKey; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryOffHeapStringKey1; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryOffHeapStringKey2; -import com.gemstone.gemfire.internal.cache.VMThinRegionEntryOffHeapUUIDKey; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +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("off-heap-memory-size", "1m"); + props.setProperty(LOCATORS, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(SystemConfigurationProperties.OFF_HEAP_MEMORY_SIZE, "1m"); 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/offheap/MemoryAllocatorFillPatternIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternIntegrationTest.java index 2f202f8..5187c04 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternIntegrationTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternIntegrationTest.java @@ -16,7 +16,12 @@ */ package com.gemstone.gemfire.internal.offheap; -import static org.junit.Assert.*; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +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.Collections; import java.util.LinkedList; @@ -26,12 +31,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * Tests fill pattern validation for the {@link MemoryAllocatorImpl}. @@ -91,7 +92,7 @@ public class MemoryAllocatorFillPatternIntegrationTest { */ @Before public void setUp() throws Exception { - System.setProperty("gemfire.validateOffHeapWithFill", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "validateOffHeapWithFill", "true"); this.slab = new SlabImpl(SLAB_SIZE); this.allocator = MemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{this.slab}); } @@ -102,7 +103,7 @@ public class MemoryAllocatorFillPatternIntegrationTest { @After public void tearDown() throws Exception { MemoryAllocatorImpl.freeOffHeapMemory(); - System.clearProperty("gemfire.validateOffHeapWithFill"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "validateOffHeapWithFill"); } /** http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternJUnitTest.java index be1fcad..b90c3b8 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryAllocatorFillPatternJUnitTest.java @@ -16,15 +16,17 @@ */ package com.gemstone.gemfire.internal.offheap; -import static com.googlecode.catchexception.CatchException.*; -import static org.junit.Assert.*; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.test.junit.categories.UnitTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import static com.googlecode.catchexception.CatchException.catchException; +import static com.googlecode.catchexception.CatchException.caughtException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * Tests fill pattern validation for the {@link MemoryAllocatorImpl}. @@ -61,7 +63,7 @@ public class MemoryAllocatorFillPatternJUnitTest { */ @Before public void setUp() throws Exception { - System.setProperty("gemfire.validateOffHeapWithFill", "true"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "validateOffHeapWithFill", "true"); this.slab = new SlabImpl(SLAB_SIZE); this.allocator = MemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{this.slab}); } @@ -72,7 +74,7 @@ public class MemoryAllocatorFillPatternJUnitTest { @After public void tearDown() throws Exception { MemoryAllocatorImpl.freeOffHeapMemory(); - System.clearProperty("gemfire.validateOffHeapWithFill"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "validateOffHeapWithFill"); } /** http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java index 4e7c827..e41b61e 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/MemoryBlockNodeJUnitTest.java @@ -16,13 +16,12 @@ */ package com.gemstone.gemfire.internal.offheap; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import java.nio.ByteBuffer; - +import com.gemstone.gemfire.cache.CacheClosedException; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.DSCODE; +import com.gemstone.gemfire.internal.cache.EntryEventImpl; +import com.gemstone.gemfire.internal.offheap.MemoryBlock.State; +import com.gemstone.gemfire.test.junit.categories.UnitTest; import org.assertj.core.api.JUnitSoftAssertions; import org.junit.After; import org.junit.Before; @@ -33,11 +32,12 @@ import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.junit.experimental.categories.Category; import org.junit.rules.ExpectedException; -import com.gemstone.gemfire.cache.CacheClosedException; -import com.gemstone.gemfire.internal.DSCODE; -import com.gemstone.gemfire.internal.cache.EntryEventImpl; -import com.gemstone.gemfire.internal.offheap.MemoryBlock.State; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.nio.ByteBuffer; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.*; @Category(UnitTest.class) public class MemoryBlockNodeJUnitTest { @@ -52,7 +52,8 @@ public class MemoryBlockNodeJUnitTest { private StoredObject storedObject = null; @Rule - public final ProvideSystemProperty myPropertyHasMyValue = new ProvideSystemProperty("gemfire.OFF_HEAP_DO_EXPENSIVE_VALIDATION", "true"); + public final ProvideSystemProperty myPropertyHasMyValue = new ProvideSystemProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_DO_EXPENSIVE_VALIDATION", + "true"); @Rule public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapIndexJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapIndexJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapIndexJUnitTest.java index 2cc5f03..12f6d9b 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapIndexJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapIndexJUnitTest.java @@ -16,25 +16,23 @@ */ package com.gemstone.gemfire.internal.offheap; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.util.Properties; - +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.RegionFactory; +import com.gemstone.gemfire.cache.query.*; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +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.CacheFactory; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.query.IndexExistsException; -import com.gemstone.gemfire.cache.query.IndexInvalidException; -import com.gemstone.gemfire.cache.query.IndexNameConflictException; -import com.gemstone.gemfire.cache.query.QueryService; -import com.gemstone.gemfire.cache.query.RegionNotFoundException; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -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; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; /** * Test off-heap regions with indexes. @@ -48,9 +46,9 @@ public class OffHeapIndexJUnitTest { @Before public void setUp() { Properties props = new Properties(); - props.setProperty("locators", ""); - props.setProperty("mcast-port", "0"); - props.setProperty("off-heap-memory-size", "100m"); + props.setProperty(LOCATORS, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(SystemConfigurationProperties.OFF_HEAP_MEMORY_SIZE, "100m"); this.gfc = (GemFireCacheImpl) new CacheFactory(props).create(); } @After http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java index f3b0c33..70c709f 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java @@ -16,19 +16,6 @@ */ package com.gemstone.gemfire.internal.offheap; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import org.junit.Test; - import com.gemstone.gemfire.OutOfOffHeapMemoryException; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.EntryEvent; @@ -37,11 +24,8 @@ import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.compression.Compressor; import com.gemstone.gemfire.compression.SnappyCompressor; -import com.gemstone.gemfire.internal.cache.EntryEventImpl; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.OffHeapRegionEntry; -import com.gemstone.gemfire.internal.cache.RegionEntry; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.offheap.annotations.OffHeapIdentifier; import com.gemstone.gemfire.internal.offheap.annotations.Released; import com.gemstone.gemfire.internal.offheap.annotations.Retained; @@ -49,6 +33,16 @@ import com.gemstone.gemfire.pdx.PdxReader; import com.gemstone.gemfire.pdx.PdxSerializable; import com.gemstone.gemfire.pdx.PdxWriter; import com.gemstone.gemfire.test.dunit.WaitCriterion; +import org.junit.Test; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.List; +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.*; /** * Basic test of regions that use off heap storage. @@ -68,9 +62,9 @@ public abstract class OffHeapRegionBase { private GemFireCacheImpl createCache(boolean isPersistent) { configureOffHeapStorage(); Properties props = new Properties(); - props.setProperty("locators", ""); - props.setProperty("mcast-port", "0"); - props.setProperty("off-heap-memory-size", getOffHeapMemorySize()); + props.setProperty(LOCATORS, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(SystemConfigurationProperties.OFF_HEAP_MEMORY_SIZE, getOffHeapMemorySize()); GemFireCacheImpl result = (GemFireCacheImpl) new CacheFactory(props).setPdxPersistent(isPersistent).create(); unconfigureOffHeapStorage(); return result; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java index 2836a38..90ff3cf 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStorageJUnitTest.java @@ -16,22 +16,23 @@ */ package com.gemstone.gemfire.internal.offheap; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.contrib.java.lang.system.RestoreSystemProperties; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.OutOfOffHeapMemoryException; import com.gemstone.gemfire.StatisticsFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.DistributionStats; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.InternalLocator; import com.gemstone.gemfire.internal.LocalStatisticsFactory; import com.gemstone.gemfire.test.junit.categories.UnitTest; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.RestoreSystemProperties; +import org.junit.experimental.categories.Category; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; @Category(UnitTest.class) public class OffHeapStorageJUnitTest { @@ -90,28 +91,28 @@ public class OffHeapStorageJUnitTest { assertEquals(100, OffHeapStorage.calcMaxSlabSize(100L)); assertEquals(Integer.MAX_VALUE, OffHeapStorage.calcMaxSlabSize(Long.MAX_VALUE)); try { - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "99"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "99"); assertEquals(99 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(100L * 1024 * 1024)); assertEquals(88, OffHeapStorage.calcMaxSlabSize(88)); - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "88m"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "88m"); assertEquals(88 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(100L * 1024 * 1024)); - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "77M"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "77M"); assertEquals(77 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(100L * 1024 * 1024)); - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "1g"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "1g"); assertEquals(1 * 1024 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(2L * 1024 * 1024 * 1024)); - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "1G"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "1G"); assertEquals(1L * 1024 * 1024 * 1024, OffHeapStorage.calcMaxSlabSize(2L * 1024 * 1024 * 1024 + 1)); - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "foobarG"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "foobarG"); try { OffHeapStorage.calcMaxSlabSize(100); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", ""); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", ""); assertEquals(100, OffHeapStorage.calcMaxSlabSize(100L)); assertEquals(Integer.MAX_VALUE, OffHeapStorage.calcMaxSlabSize(Long.MAX_VALUE)); } finally { - System.clearProperty("gemfire.OFF_HEAP_SLAB_SIZE"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE"); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapValidationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapValidationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapValidationJUnitTest.java index ba030e8..e7fc8b7 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapValidationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapValidationJUnitTest.java @@ -16,52 +16,30 @@ */ package com.gemstone.gemfire.internal.offheap; -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.IOException; -import java.io.Serializable; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.IdentityHashMap; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Stack; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.UUID; -import java.util.Vector; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.compression.SnappyCompressor; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.LocalRegion; 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.io.Serializable; +import java.sql.Timestamp; +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.*; /** * Basic integration tests for validating the off-heap implementation. @@ -84,9 +62,9 @@ public class OffHeapValidationJUnitTest { protected GemFireCacheImpl createCache() { Properties props = new Properties(); - props.setProperty("locators", ""); - props.setProperty("mcast-port", "0"); - props.setProperty("off-heap-memory-size", getOffHeapMemorySize()); + props.setProperty(LOCATORS, ""); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(SystemConfigurationProperties.OFF_HEAP_MEMORY_SIZE, getOffHeapMemorySize()); 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/offheap/OldFreeListOffHeapRegionJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OldFreeListOffHeapRegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OldFreeListOffHeapRegionJUnitTest.java index e9ca59d..e8fa29b 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OldFreeListOffHeapRegionJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OldFreeListOffHeapRegionJUnitTest.java @@ -16,9 +16,9 @@ */ package com.gemstone.gemfire.internal.offheap; -import org.junit.experimental.categories.Category; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import org.junit.experimental.categories.Category; @Category(IntegrationTest.class) public class OldFreeListOffHeapRegionJUnitTest extends OffHeapRegionBase { @@ -30,13 +30,13 @@ public class OldFreeListOffHeapRegionJUnitTest extends OffHeapRegionBase { @Override public void configureOffHeapStorage() { - System.setProperty("gemfire.OFF_HEAP_SLAB_SIZE", "1m"); + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE", "1m"); } @Override public void unconfigureOffHeapStorage() { - System.clearProperty("gemfire.OFF_HEAP_TOTAL_SIZE"); - System.clearProperty("gemfire.OFF_HEAP_SLAB_SIZE"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_TOTAL_SIZE"); + System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "OFF_HEAP_SLAB_SIZE"); } @Override http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java index 99fadfc..3b57d7c 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java @@ -16,14 +16,6 @@ */ package com.gemstone.gemfire.internal.offheap; -import java.util.Properties; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -import org.apache.logging.log4j.Logger; - import com.gemstone.gemfire.OutOfOffHeapMemoryException; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.Region; @@ -43,10 +35,15 @@ import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.IgnoredException; import com.gemstone.gemfire.test.dunit.Invoke; import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; +import org.apache.logging.log4j.Logger; +import java.util.Properties; +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; import static com.jayway.awaitility.Awaitility.with; import static org.hamcrest.CoreMatchers.equalTo; @@ -118,7 +115,7 @@ public class OutOfOffHeapMemoryDUnitTest extends CacheTestCase { @Override public Properties getDistributedSystemProperties() { final Properties props = new Properties(); - props.put(DistributionConfig.MCAST_PORT_NAME, "0"); + props.put(MCAST_PORT, "0"); props.put(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); if (isSmallerVM.get()) { props.setProperty(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, getSmallerOffHeapMemorySize()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TxReleasesOffHeapOnCloseJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TxReleasesOffHeapOnCloseJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TxReleasesOffHeapOnCloseJUnitTest.java index d8999fe..fcd1448 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TxReleasesOffHeapOnCloseJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TxReleasesOffHeapOnCloseJUnitTest.java @@ -16,19 +16,17 @@ */ package com.gemstone.gemfire.internal.offheap; -import static org.junit.Assert.assertEquals; - -import java.util.Properties; - +import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.distributed.SystemConfigurationProperties; +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.CacheTransactionManager; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionFactory; -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; +import static org.junit.Assert.assertEquals; @Category(IntegrationTest.class) public class TxReleasesOffHeapOnCloseJUnitTest { @@ -37,9 +35,9 @@ public class TxReleasesOffHeapOnCloseJUnitTest { protected void createCache() { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - props.setProperty("off-heap-memory-size", "1m"); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + props.setProperty(SystemConfigurationProperties.OFF_HEAP_MEMORY_SIZE, "1m"); cache = new CacheFactory(props).create(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ObjectTraverserJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ObjectTraverserJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ObjectTraverserJUnitTest.java index 87ca34f..dbb8842 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ObjectTraverserJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ObjectTraverserJUnitTest.java @@ -16,19 +16,16 @@ */ package com.gemstone.gemfire.internal.size; -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.IdentityHashMap; -import java.util.Map; -import java.util.Set; - +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.test.junit.categories.UnitTest; import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import java.util.*; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; @Category(UnitTest.class) public class ObjectTraverserJUnitTest { @@ -100,8 +97,8 @@ public class ObjectTraverserJUnitTest { Object object3 = new Object(); set1.add(set2); set2.add(object3); - - System.setProperty("gemfire.ObjectSizer.SIZE_OF_CLASS", "com.gemstone.gemfire.internal.size.SizeOfUtil0"); + + System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "ObjectSizer.SIZE_OF_CLASS", "com.gemstone.gemfire.internal.size.SizeOfUtil0"); System.out.println(ObjectGraphSizer.histogram(set1, true)); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java index 830a73f..8aa78af 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java @@ -16,35 +16,8 @@ */ package com.gemstone.gemfire.internal.statistics; -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Random; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.atomic.AtomicReferenceArray; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.gemstone.gemfire.StatisticDescriptor; -import com.gemstone.gemfire.Statistics; -import com.gemstone.gemfire.StatisticsFactory; -import com.gemstone.gemfire.StatisticsType; -import com.gemstone.gemfire.StatisticsTypeFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.CacheListener; -import com.gemstone.gemfire.cache.EntryEvent; -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.*; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.cache.util.RegionMembershipListenerAdapter; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; @@ -53,21 +26,21 @@ import com.gemstone.gemfire.distributed.DistributedMember; 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.internal.GemFireStatSampler; -import com.gemstone.gemfire.internal.NanoTimer; -import com.gemstone.gemfire.internal.StatArchiveReader; +import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.StatArchiveReader.StatSpec; -import com.gemstone.gemfire.internal.StatSamplerStats; -import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl; import com.gemstone.gemfire.internal.StatArchiveReader.StatValue; import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.Invoke; -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 java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.atomic.AtomicReferenceArray; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Integration tests for Statistics. VM0 performs puts and VM1 receives http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/stats50/AtomicStatsJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/stats50/AtomicStatsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/stats50/AtomicStatsJUnitTest.java index 20e953d..ee59e8a 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/stats50/AtomicStatsJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/stats50/AtomicStatsJUnitTest.java @@ -16,23 +16,24 @@ */ package com.gemstone.gemfire.internal.stats50; -import static org.junit.Assert.assertEquals; - -import java.util.Properties; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.atomic.AtomicReference; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - import com.gemstone.gemfire.StatisticDescriptor; import com.gemstone.gemfire.Statistics; import com.gemstone.gemfire.StatisticsType; import com.gemstone.gemfire.StatisticsTypeFactory; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl; 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.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.atomic.AtomicReference; + +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; +import static org.junit.Assert.assertEquals; /** * @@ -49,9 +50,9 @@ public class AtomicStatsJUnitTest { public void testConcurrentGets() throws Throwable { Properties props = new Properties(); - props.setProperty("mcast-port", "0"); + props.setProperty(MCAST_PORT, "0"); // props.setProperty("statistic-sample-rate", "60000"); - props.setProperty("statistic-sampling-enabled", "false"); + props.setProperty(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "false"); DistributedSystem ds = DistributedSystem.connect(props); String statName = "TestStats"; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java index e4489d4..ea927cc 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java @@ -16,19 +16,15 @@ */ package com.gemstone.gemfire.internal.util.concurrent; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Properties; -import java.util.Random; -import java.util.concurrent.ConcurrentMap; - +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import junit.framework.TestCase; import org.junit.experimental.categories.Category; -import junit.framework.TestCase; +import java.util.*; +import java.util.concurrent.ConcurrentMap; -import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; +import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT; @SuppressWarnings({ "rawtypes", "unchecked" }) @Category(IntegrationTest.class) @@ -39,7 +35,7 @@ public class ConcurrentHashMapIteratorJUnitTest extends TestCase { //Apparently, we need a distributed system to create //this CHM, because it's locks use DS properties. Properties props = new Properties(); - props.setProperty("mcast-port", "0"); + props.setProperty(MCAST_PORT, "0"); DistributedSystem.connect(props); java.util.concurrent.ConcurrentHashMap baselineMap = new java.util.concurrent.ConcurrentHashMap(); CustomEntryConcurrentHashMap testMap = new CustomEntryConcurrentHashMap(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/70612010/geode-core/src/test/java/com/gemstone/gemfire/management/CacheManagementDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/CacheManagementDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/CacheManagementDUnitTest.java index 741fa2a..30a4255 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/CacheManagementDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/CacheManagementDUnitTest.java @@ -16,44 +16,24 @@ */ package com.gemstone.gemfire.management; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; - -import javax.management.InstanceNotFoundException; -import javax.management.JMException; -import javax.management.Notification; -import javax.management.NotificationListener; -import javax.management.ObjectName; - -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.FixedPartitionAttributes; -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.distributed.DistributedMember; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.management.internal.MBeanJMXAdapter; import com.gemstone.gemfire.management.internal.ManagementConstants; -import com.gemstone.gemfire.management.internal.SystemManagementService; import com.gemstone.gemfire.management.internal.NotificationHub.NotificationHubListener; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; - -import static com.jayway.awaitility.Awaitility.*; -import static org.hamcrest.Matchers.*; +import com.gemstone.gemfire.management.internal.SystemManagementService; +import com.gemstone.gemfire.test.dunit.*; + +import javax.management.*; +import java.util.*; +import java.util.concurrent.TimeUnit; + +import static com.jayway.awaitility.Awaitility.to; +import static com.jayway.awaitility.Awaitility.waitAtMost; +import static org.hamcrest.Matchers.equalTo; /** * This class checks and verifies various data and operations exposed through
