You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/05/06 21:40:32 UTC
[01/37] incubator-geode git commit: GEODE-1350: first turn off the
Parameteried runner to have the tests run in night/CI builds
Repository: incubator-geode
Updated Branches:
refs/heads/feature/GEODE-1276 d0f925cef -> 7ce7ddc04
GEODE-1350: first turn off the Parameteried runner to have the tests run in night/CI builds
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/676b2a78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/676b2a78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/676b2a78
Branch: refs/heads/feature/GEODE-1276
Commit: 676b2a781c5243b9a92b156fa2631d4c451d5bab
Parents: 5817cdb
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu May 5 15:20:47 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu May 5 15:20:47 2016 -0700
----------------------------------------------------------------------
.../cli/commands/CliCommandTestBase.java | 21 --------------------
.../cli/commands/ConfigCommandsDUnitTest.java | 8 +-------
...eateAlterDestroyRegionCommandsDUnitTest.java | 6 ------
.../cli/commands/DeployCommandsDUnitTest.java | 8 +-------
.../commands/DiskStoreCommandsDUnitTest.java | 5 -----
.../cli/commands/FunctionCommandsDUnitTest.java | 8 +-------
.../commands/GemfireDataCommandsDUnitTest.java | 5 -----
...WithCacheLoaderDuringCacheMissDUnitTest.java | 9 +--------
.../cli/commands/IndexCommandsDUnitTest.java | 8 +-------
...stAndDescribeDiskStoreCommandsDUnitTest.java | 8 +-------
.../ListAndDescribeRegionDUnitTest.java | 5 -----
.../cli/commands/ListIndexCommandDUnitTest.java | 8 +-------
.../MiscellaneousCommandsDUnitTest.java | 8 +-------
...laneousCommandsExportLogsPart1DUnitTest.java | 8 +-------
...laneousCommandsExportLogsPart2DUnitTest.java | 9 +--------
...laneousCommandsExportLogsPart3DUnitTest.java | 10 ++--------
...laneousCommandsExportLogsPart4DUnitTest.java | 8 +-------
.../cli/commands/QueueCommandsDUnitTest.java | 8 +-------
.../SharedConfigurationCommandsDUnitTest.java | 8 +-------
.../cli/commands/ShellCommandsDUnitTest.java | 8 +-------
.../cli/commands/ShowMetricsDUnitTest.java | 8 +-------
.../cli/commands/ShowStackTraceDUnitTest.java | 8 +-------
.../cli/commands/UserCommandsDUnitTest.java | 8 +-------
.../security/GfshCommandsSecurityTest.java | 17 ++--------------
24 files changed, 21 insertions(+), 186 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index f2dc80f..5c6239b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -23,8 +23,6 @@ import java.io.IOException;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Matcher;
@@ -45,8 +43,6 @@ import com.gemstone.gemfire.management.internal.security.JSONAuthorization;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.junit.runners.Parameterized;
-
/**
* Base class for all the CLI/gfsh command dunit tests.
*/
@@ -69,23 +65,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
protected String jmxHost;
- public CliCommandTestBase(){
- this(false);
- }
-
- // Junit will use the parameters to initialize the test class and run the tests with different parameters
- public CliCommandTestBase(boolean useHttpOnConnect){
- this.useHttpOnConnect = useHttpOnConnect;
- }
-
- @Parameterized.Parameters
- public static Collection parameters() {
- return Arrays.asList(new Object[][] {
- { false}, // useHttpOnConnect=false,
- { true } // useHttpOnConnect=true,
- });
- }
-
@Override
public final void preTearDownCacheTestCase() throws Exception {
preTearDownCliCommandTestBase();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConfigCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConfigCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConfigCommandsDUnitTest.java
index 2d5dec3..c342142 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConfigCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConfigCommandsDUnitTest.java
@@ -57,11 +57,10 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Dunit class for testing GemFire config commands : export config
@@ -69,7 +68,6 @@ import org.junit.runners.Parameterized;
* @since 7.0
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
@SuppressWarnings("serial")
public class ConfigCommandsDUnitTest extends CliCommandTestBase {
@@ -84,10 +82,6 @@ public class ConfigCommandsDUnitTest extends CliCommandTestBase {
File subDir = new File("ConfigCommandsDUnitTestSubDir");
File subManagerConfigFile = new File(subDir, managerConfigFile.getName());
- public ConfigCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
@Override
protected void preTearDownCliCommandTestBase() throws Exception {
deleteTestFiles();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
index 087e826..530428d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
@@ -72,7 +72,6 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -91,11 +90,6 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
String alterVm2Name;
final List<String> filesToBeDeleted = new CopyOnWriteArrayList<String>();
-
- public CreateAlterDestroyRegionCommandsDUnitTest(boolean useHttpOnConnect){
- super(useHttpOnConnect);
- }
-
/**
* Asserts that the "compressor" option for the "create region" command succeeds for a recognized compressor.
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
index e4b50b9..4bc92eb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
@@ -44,10 +44,9 @@ import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Unit tests for the DeployCommands class
@@ -56,7 +55,6 @@ import org.junit.runners.Parameterized;
*/
@Category(DistributedTest.class)
@SuppressWarnings("serial")
-@RunWith(Parameterized.class)
public class DeployCommandsDUnitTest extends CliCommandTestBase {
File newDeployableJarFile = new File("DeployCommandsDUnit1.jar");
@@ -64,10 +62,6 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
transient private ClassBuilder classBuilder = new ClassBuilder();
transient private CommandProcessor commandProcessor;
- public DeployCommandsDUnitTest(boolean useHttpOnConnect){
- super(useHttpOnConnect);
- }
-
@Override
public final void postSetUp() throws Exception {
this.commandProcessor = new CommandProcessor();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
index 731e07c..2502a4b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
@@ -83,15 +83,10 @@ import org.junit.runners.Parameterized;
*/
@Category(DistributedTest.class)
@SuppressWarnings("serial")
-@RunWith(Parameterized.class)
public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
final List<String> filesToBeDeleted = new CopyOnWriteArrayList<String>();
- public DiskStoreCommandsDUnitTest(boolean useHttpOnConnect){
- super(useHttpOnConnect);
- }
-
@Test
public void testMissingDiskStore() {
final String regionName = "testShowMissingDiskStoreRegion";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/FunctionCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/FunctionCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/FunctionCommandsDUnitTest.java
index bc92409..8d1252b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/FunctionCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/FunctionCommandsDUnitTest.java
@@ -44,16 +44,14 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Dunit class for testing gemfire function commands : execute function, destroy function, list function
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class FunctionCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -61,10 +59,6 @@ public class FunctionCommandsDUnitTest extends CliCommandTestBase {
private static final String REGION_ONE = "RegionOne";
private static final String REGION_TWO = "RegionTwo";
- public FunctionCommandsDUnitTest(boolean useHttpOnConnect){
- super(useHttpOnConnect);
- }
-
void setupWith2Regions() {
final VM vm1 = Host.getHost(0).getVM(1);
final VM vm2 = Host.getHost(0).getVM(2);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
index 2966072..7097918 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
@@ -89,7 +89,6 @@ import org.junit.runners.Parameterized;
*/
@Category(DistributedTest.class)
@SuppressWarnings("serial")
-@RunWith(Parameterized.class)
public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -122,10 +121,6 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final static int COUNT = 5;
- public GemfireDataCommandsDUnitTest(boolean useHttpOnConnect){
- super(useHttpOnConnect);
- }
-
public String getMemberId() {
Cache cache = getCache();
return cache.getDistributedSystem().getDistributedMember().getId();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
index 55ef25c..5674b83 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
@@ -49,10 +49,9 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* The GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest class is test suite of test cases testing the Gfsh
@@ -65,7 +64,6 @@ import org.junit.runners.Parameterized;
*/
@SuppressWarnings("unused")
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends CliCommandTestBase {
private static final String GEMFIRE_MANAGER_NAME = "GemManagerNode";
@@ -73,11 +71,6 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
private static final String GEMFIRE_LOG_LEVEL = System.getProperty("logLevel", "config");
private static final String USERS_REGION_NAME = "Users";
-
- public GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest(boolean useHttpOnConnect){
- super(useHttpOnConnect);
- }
-
protected static String getRegionPath(final String regionName) {
return (regionName.startsWith(Region.SEPARATOR) ? regionName : String.format("%1$s%2$s", Region.SEPARATOR,
regionName));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
index 529032c..3e6946a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
@@ -51,13 +51,11 @@ import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class IndexCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -67,10 +65,6 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
private static final String parRegPersName = "ParRegPers";
private static final String repRegPersName = "RepRegPer";
- public IndexCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
Region<?, ?> createParReg(String regionName, Cache cache, Class keyConstraint, Class valueConstraint) {
RegionFactory regionFactory = cache.createRegionFactory();
regionFactory.setDataPolicy(DataPolicy.PARTITION);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
index bb46b75..443c7c7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
@@ -36,10 +36,9 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* The ListAndDescribeDiskStoreCommandsDUnitTest class is a test suite of functional tests cases testing the proper
@@ -50,13 +49,8 @@ import org.junit.runners.Parameterized;
* @since 7.0
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBase {
- public ListAndDescribeDiskStoreCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
protected static String toString(final Result result) {
assert result != null : "The Result object from the command execution cannot be null!";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
index a422fc7..e747685 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
@@ -50,7 +50,6 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
private static final String REGION1 = "region1";
@@ -62,10 +61,6 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
private static final String PR1 = "PR1";
private static final String LOCALREGIONONMANAGER = "LocalRegionOnManager";
- public ListAndDescribeRegionDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
static class CacheListener2 extends CacheListenerAdapter {
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
index 97ca98a..e92d5bd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
@@ -52,10 +52,9 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* The ListIndexCommandDUnitTest class is distributed test suite of test cases for testing the index-based GemFire shell
@@ -67,17 +66,12 @@ import org.junit.runners.Parameterized;
*/
@SuppressWarnings("unused")
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class ListIndexCommandDUnitTest extends CliCommandTestBase {
protected static final int DEFAULT_REGION_INITIAL_CAPACITY = 10000;
private final AtomicLong idGenerator = new AtomicLong(0l);
- public ListIndexCommandDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
protected static String toString(final Result result) {
assert result != null : "The Result object from the command execution cannot be null!";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsDUnitTest.java
index ec0f020..5238765 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsDUnitTest.java
@@ -52,26 +52,20 @@ import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Dunit class for testing gemfire function commands : GC, Shutdown
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class MiscellaneousCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
private static String cachedLogLevel;
- public MiscellaneousCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
@Override
protected final void preTearDownCliCommandTestBase() throws Exception {
invokeInEveryVM(new SerializableRunnable("reset log level") {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart1DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart1DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart1DUnitTest.java
index 7660f79..c77ee63 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart1DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart1DUnitTest.java
@@ -36,24 +36,18 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Dunit class for testing gemfire function commands : export logs
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class MiscellaneousCommandsExportLogsPart1DUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public MiscellaneousCommandsExportLogsPart1DUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
void setupForExportLogs() {
final VM vm1 = Host.getHost(0).getVM(1);
setUpJmxManagerOnVm0ThenConnect(null);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart2DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart2DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart2DUnitTest.java
index ee263ae..2019667 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart2DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart2DUnitTest.java
@@ -36,25 +36,18 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Dunit class for testing gemfire function commands : export logs
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class MiscellaneousCommandsExportLogsPart2DUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public MiscellaneousCommandsExportLogsPart2DUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
-
void setupForExportLogs() {
final VM vm1 = Host.getHost(0).getVM(1);
setUpJmxManagerOnVm0ThenConnect(null);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart3DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart3DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart3DUnitTest.java
index 967dfb1..57b94db 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart3DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart3DUnitTest.java
@@ -38,25 +38,19 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
/**
* Dunit class for testing gemfire function commands : export logs
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class MiscellaneousCommandsExportLogsPart3DUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public MiscellaneousCommandsExportLogsPart3DUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
public String getMemberId() {
Cache cache = getCache();
return cache.getDistributedSystem().getDistributedMember().getId();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart4DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart4DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart4DUnitTest.java
index 3d837dc..c12b0a1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart4DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommandsExportLogsPart4DUnitTest.java
@@ -36,24 +36,18 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Dunit class for testing gemfire function commands : export logs
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class MiscellaneousCommandsExportLogsPart4DUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public MiscellaneousCommandsExportLogsPart4DUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
void setupForExportLogs() {
final VM vm1 = Host.getHost(0).getVM(1);
setUpJmxManagerOnVm0ThenConnect(null);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
index 691533d..db14fdc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
@@ -46,10 +46,9 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* A distributed test suite of test cases for testing the queue commands that are part of Gfsh.
@@ -57,17 +56,12 @@ import org.junit.runners.Parameterized;
* @since 8.0
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class QueueCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
final List<String> filesToBeDeleted = new CopyOnWriteArrayList<String>();
- public QueueCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
@Override
public final void preSetUp() throws Exception {
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
index d871062..4bb9b81 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
@@ -51,18 +51,16 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/***
* DUnit test to test export and import of shared configuration.
*/
@Category(DistributedTest.class)
@SuppressWarnings("unchecked")
-@RunWith(Parameterized.class)
public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -72,10 +70,6 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
File newDeployableJarFile = new File("DeployCommandsDUnit1.jar");
private transient ClassBuilder classBuilder = new ClassBuilder();
- public SharedConfigurationCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
@Test
public void testExportImportSharedConfiguration() {
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
index d4fe871..b60f78c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
@@ -36,21 +36,15 @@ import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class ShellCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public ShellCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
@Override
public final void postSetUp() throws Exception {
getDefaultShell();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowMetricsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowMetricsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowMetricsDUnitTest.java
index 5c2913c..2a20672 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowMetricsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowMetricsDUnitTest.java
@@ -51,21 +51,15 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class ShowMetricsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public ShowMetricsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
private void createLocalSetUp() {
Properties localProps = new Properties();
localProps.setProperty(DistributionConfig.NAME_NAME, "Controller");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowStackTraceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowStackTraceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowStackTraceDUnitTest.java
index eb79c48..2614091 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowStackTraceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShowStackTraceDUnitTest.java
@@ -32,24 +32,18 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/***
* DUnit test for 'show stack-trace' command
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class ShowStackTraceDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
- public ShowStackTraceDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
private void createCache(Properties props) {
getSystem(props);
getCache();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
index 9f44c14..9ca6036 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
@@ -33,10 +33,9 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Unit tests for configuring user commands.
@@ -44,7 +43,6 @@ import org.junit.runners.Parameterized;
* @since 8.0
*/
@Category(DistributedTest.class)
-@RunWith(Parameterized.class)
public class UserCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -54,10 +52,6 @@ public class UserCommandsDUnitTest extends CliCommandTestBase {
final File jarFile = new File(this.jarDirectory, "UserCommandsDUnit.jar");
boolean deleteJarDirectory = false;
- public UserCommandsDUnitTest(boolean useHttpOnConnect) {
- super(useHttpOnConnect);
- }
-
@Override
public final void postSetUp() throws Exception {
createUserCommandJarFile();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/676b2a78/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
index b5ef0a6..d96c96c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
@@ -19,8 +19,6 @@ package com.gemstone.gemfire.management.internal.security;
import static org.junit.Assert.*;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
import com.gemstone.gemfire.internal.AvailablePortHelper;
@@ -38,11 +36,8 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
@Category(IntegrationTest.class)
-@RunWith(Parameterized.class)
public class GfshCommandsSecurityTest {
private static int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
private static int jmxPort = ports[0];
@@ -57,16 +52,8 @@ public class GfshCommandsSecurityTest {
@Rule
public GfshShellConnectionRule gfshConnection = null;
- public GfshCommandsSecurityTest(boolean useHttp){
- gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, useHttp);
- }
-
- @Parameterized.Parameters
- public static Collection parameters() {
- return Arrays.asList(new Object[][] {
- { false}, // useHttp=false,
- { true } // useHttp=true,
- });
+ public GfshCommandsSecurityTest(){
+ gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, false);
}
@Before
[25/37] incubator-geode git commit: Revert "GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
new file mode 100755
index 0000000..c34c91a
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
@@ -0,0 +1,2399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.i18n;
+
+import com.gemstone.gemfire.i18n.StringId;
+
+/**
+ * Added as parent class of LocalizedStrings because Eclipse is complaining
+ * about the implicit static initializer for all these static final constants
+ * being greater than 65535.
+ *
+ * @since 7.0
+ */
+class ParentLocalizedStrings {
+ /** reserved space for commonly used strings, messageId 0-1024 **/
+ public static final StringId EMPTY = new StringId(0, "");
+ public static final StringId ONE_ARG = StringId.LITERAL;
+ //alias for use in temporarily adding debugging to the product
+ public static final StringId DEBUG = ONE_ARG;
+
+ public static final StringId DONT_RELEASE = ONE_ARG;
+
+ //alias for use in the test tree
+ public static final StringId TESTING = ONE_ARG;
+ public static final StringId TWO_ARG = new StringId(2, "{0} {1}");
+ public static final StringId TWO_ARG_COLON = new StringId(3, "{0} : {1}");
+ public static final StringId ERROR = new StringId(4, "ERROR");
+ public static final StringId CACHE_IS_CLOSING = new StringId(1021, "Cache is closing");
+ public static final StringId NOT_A_REAL_GEMFIREVM = new StringId(1022, "Not a real GemFireVM");
+ public static final StringId SHOULDNT_INVOKE = new StringId(1023, "Should not be invoked");
+ public static final StringId UNSUPPORTED_AT_THIS_TIME = new StringId(1024, "Unsupported at this time");
+
+ /**Gemfire strings, messageId 1025-15000 **/
+ public static final StringId AbstractHealthEvaluator_OKAY_HEALTH__0 = new StringId(1025, "OKAY_HEALTH: {0}");
+ public static final StringId AbstractHealthEvaluator_POOR_HEALTH__0 = new StringId(1026, "POOR_HEALTH: {0}");
+ public static final StringId AbstractRegion_CACHECALLBACK_CLOSE_EXCEPTION = new StringId(1027, "CacheCallback close exception");
+ public static final StringId PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS = new StringId(1028, "A pool named \"{0}\" already exists");
+ public static final StringId AcceptorImpl_CACHE_SERVER_CONNECTION_LISTENER_BOUND_TO_ADDRESS_0_WITH_BACKLOG_1 = new StringId(1029, "Cache server connection listener bound to address {0} with backlog {1}.");
+ public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT = new StringId(1030, "Cache server: failed accepting client connection due to socket timeout.");
+ public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0 = new StringId(1031, "Cache server: failed accepting client connection {0}");
+ public static final StringId AcceptorImpl_CACHE_SERVER_ON_PORT_0_IS_SHUTTING_DOWN = new StringId(1032, "Cache server on port {0} is shutting down.");
+ public static final StringId AcceptorImpl_CACHE_SERVER_TIMED_OUT_WAITING_FOR_HANDSHAKE_FROM__0 = new StringId(1033, "Cache server: timed out waiting for handshake from {0}");
+ public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_EXCEPTION = new StringId(1034, "Cache server: Unexpected Exception");
+ public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_IOEXCEPTION_FROM_ACCEPT = new StringId(1035, "Cache server: Unexpected IOException from accept");
+ public static final StringId AcceptorImpl_EXCEEDED_MAX_CONNECTIONS_0 = new StringId(1036, "exceeded max-connections {0}");
+ public static final StringId AcceptorImpl_IGNORING = new StringId(1037, "ignoring");
+ public static final StringId AcceptorImpl_IGNORING_EVENT_ON_SELECTOR_KEY__0 = new StringId(1038, "ignoring event on selector key {0}");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_A_PREVIOUS_CONNECTION_ATTEMPT_FROM_THIS_CLIENT_IS_STILL_BEING_PROCESSED__0 = new StringId(1039, "A previous connection attempt from this client is still being processed: {0}");
+ public static final StringId AcceptorImpl_REJECTED_CONNECTION_FROM_0_BECAUSE_CURRENT_CONNECTION_COUNT_OF_1_IS_GREATER_THAN_OR_EQUAL_TO_THE_CONFIGURED_MAX_OF_2 = new StringId(1040, "Rejected connection from {0} because current connection count of {1} is greater than or equal to the configured max of {2}");
+ public static final StringId AcceptorImpl_SELECTOR_ENABLED = new StringId(1041, "SELECTOR enabled");
+ public static final StringId AcceptorImpl_UNEXPECTED = new StringId(1042, "unexpected");
+ public static final StringId AdminDistributedSystem_COULD_NOT_SET_THE_GEMFIRE_VM = new StringId(1043, "Could not set the GemFire VM.");
+ public static final StringId AdminDistributedSystemImpl_ADDING_NEW_APPLICATION_FOR__0 = new StringId(1044, "Adding new Application for {0}");
+ public static final StringId AdminDistributedSystemImpl_ADDING_NEW_CACHESERVER_FOR__0 = new StringId(1045, "Adding new CacheServer for {0}");
+ public static final StringId AdminDistributedSystemImpl_WHILE_GETTING_CANONICAL_FILE = new StringId(1046, "While getting canonical file");
+ public static final StringId AdminRequest_RESPONSE_TO__0__WAS_CANCELLED = new StringId(1047, "Response to {0} was cancelled.");
+ public static final StringId AdminWaiters_COULD_NOT_SEND_REQUEST_0 = new StringId(1048, "Could not send request.{0}");
+ public static final StringId AdminWaiters_REQUEST_SEND_TO_0_WAS_CANCELLED_1 = new StringId(1049, "Request sent to {0} was cancelled. {1}");
+ public static final StringId AdminWaiters_REQUEST_SENT_TO_0_FAILED_SINCE_MEMBER_DEPARTED_1 = new StringId(1050, "Request sent to {0} failed since member departed.{1}");
+ public static final StringId AgentImpl_0__IS_ALREADY_REGISTERED = new StringId(1051, "{0} is already registered.");
+ public static final StringId AgentImpl_AGENT_HAS_STOPPED = new StringId(1052, "Agent has stopped");
+ public static final StringId AgentImpl_AUTO_CONNECT_FAILED__0 = new StringId(1053, "auto connect failed: {0}");
+ public static final StringId AgentImpl_FAILED_TO_START_HTTPADAPTOR__0 = new StringId(1054, "Failed to start HttpAdaptor: {0}");
+ public static final StringId AgentImpl_FAILED_TO_START_RMICONNECTORSERVER = new StringId(1055, "Failed to start RMIConnectorServer:");
+ public static final StringId AgentImpl_FAILED_TO_START_SNMPADAPTOR__0 = new StringId(1056, "Failed to start SnmpAdaptor: {0}");
+ public static final StringId AgentImpl_GEMFIRE_JMX_AGENT_IS_RUNNING = new StringId(1057, "GemFire JMX Agent is running...");
+ public static final StringId AgentImpl_HTTPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1058, "HttpAdaptor already registered as {0}");
+ public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_ADDRESS__0 = new StringId(1059, "HTTP adaptor listening on address: {0}");
+ public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_PORT__0 = new StringId(1060, "HTTP adaptor listening on port: {0}");
+ public static final StringId AgentImpl_INCORRECT_NULL_HOSTNAME = new StringId(1061, "Incorrect null hostname");
+ public static final StringId AgentImpl_INCORRECT_PORT_VALUE__0 = new StringId(1062, "Incorrect port value {0}");
+ public static final StringId AgentImpl_RMICONNECTORSERVER_ALREADY_REGISTERED_AS__0 = new StringId(1063, "RMIConnectorServer already registered as {0}");
+ public static final StringId AgentImpl_SNMPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1064, "SnmpAdaptor already registered as {0}");
+ public static final StringId AgentImpl_STOPPING_JMX_AGENT = new StringId(1065, "Stopping JMX agent");
+ public static final StringId AgentImpl_XSLTPROCESSOR_ALREADY_REGISTERED_AS__0 = new StringId(1066, "XsltProcessor already registered as {0}");
+ public static final StringId AbstractRegion_THE_CONNECTION_POOL_0_HAS_NOT_BEEN_CREATED = new StringId(1067, "The connection pool \"{0}\" has not been created");
+ public static final StringId AttributesFactory_0_WAS_NOT_AN_EXISTING_DIRECTORY = new StringId(1068, "\"{0}\" was not an existing directory.");
+ public static final StringId AttributesFactory_ADDCACHELISTENER_PARAMETER_WAS_NULL = new StringId(1069, "addCacheListener parameter was null");
+ public static final StringId AttributesFactory_AN_EVICTION_CONTROLLER_WITH_LOCAL_DESTROY_EVICTION_ACTION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1070, "An Eviction Controller with local destroy eviction action is incompatible with distributed replication");
+ public static final StringId AttributesFactory_CAN_NOT_SET_DIFFERENT_CACHE_LOADER_IN_REGIONATTRIBUTES_AND_PARTITIONATTRIBUTES = new StringId(1071, "Can not set different cache loader in RegionAttributes and PartitionAttributes.");
+ public static final StringId AttributesFactory_CONCURRENCYLEVEL_MUST_BE_0 = new StringId(1072, "concurrencyLevel must be > 0");
+ public static final StringId AttributesFactory_DATAPOLICY_MUST_NOT_BE_NULL = new StringId(1073, "dataPolicy must not be null");
+ public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1074, "Data policies other than {0} are not allowed in partitioned regions.");
+ public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_SUPPORTED_FOR_PARTITIONED_REGIONS = new StringId(1075, "Data policies other than {0} are not supported for Partitioned Regions");
+ public static final StringId AttributesFactory_DATA_POLICY_0_IS_NOT_ALLOWED_FOR_A_PARTITIONED_REGION_DATAPOLICIES_OTHER_THAN_1_ARE_NOT_ALLOWED = new StringId(1076, "Data policy {0} is not allowed for a partitioned region. DataPolicies other than {1} are not allowed.");
+ public static final StringId AttributesFactory_DIR_SIZE_CANNOT_BE_NEGATIVE_0 = new StringId(1077, "Dir size cannot be negative : {0}");
+ public static final StringId AttributesFactory_EVICTION_IS_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1078, "Eviction is not allowed in partitioned regions.");
+ public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_DESTROY_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1079, "ExpirationAction.LOCAL_DESTROY on the entries is incompatible with distributed replication");
+ public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1080, "ExpirationAction.LOCAL_INVALIDATE on the entries is incompatible with distributed replication");
+ public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_REGION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1081, "ExpirationAction.LOCAL_INVALIDATE on the region is incompatible with distributed replication");
+ public static final StringId AttributesFactory_EXPIRATIONATTRIBUTES_FOR_REGIONIDLETIMEOUT_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1082, "ExpirationAttributes for regionIdleTimeout are not allowed in partitioned regions.");
+ public static final StringId AttributesFactory_EXPIRATIONATTRIBUTES_FOR_REGIONTIMETOLIVE_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1083, "ExpirationAttributes for regionTimeToLive are not allowed in partitioned regions.");
+ public static final StringId AttributesFactory_EXPIRATION_ATTRIBUTES_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1084, "Expiration Attributes are not allowed in partitioned regions.");
+ public static final StringId AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL = new StringId(1085, "idleTimeout must not be null");
+ public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_ENTRY_EXPIRATION_IS_NOT_ALLOWED = new StringId(1086, "If the data policy is {0} then entry expiration is not allowed.");
+ public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_EVICTION_IS_NOT_ALLOWED = new StringId(1087, "If the data policy is {0} then eviction is not allowed.");
+ public static final StringId AttributesFactory_IF_THE_MEMBERSHIP_ATTRIBUTES_HAS_REQUIRED_ROLES_THEN_SCOPE_MUST_NOT_BE_LOCAL = new StringId(1088, "If the membership attributes has required roles then scope must not be LOCAL.");
+ public static final StringId AttributesFactory_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT = new StringId(1089, "initCacheListeners parameter had a null element");
+ public static final StringId AttributesFactory_INITIALCAPACITY_MUST_BE_0 = new StringId(1090, "initialCapacity must be >= 0");
+ public static final StringId AttributesFactory_KEYCONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1091, "keyConstraint must not be a primitive type");
+ public static final StringId AttributesFactory_LOADFACTOR_MUST_BE_0_VALUE_IS_0 = new StringId(1092, "loadFactor must be > 0, value is {0}");
+ public static final StringId AttributesFactory_MIRRORTYPE_MUST_NOT_BE_NULL = new StringId(1093, "mirrorType must not be null");
+ public static final StringId AttributesFactory_MORE_THAN_ONE_CACHE_LISTENER_EXISTS = new StringId(1094, "More than one cache listener exists.");
+ public static final StringId AttributesFactory_NO_MIRROR_TYPE_CORRESPONDS_TO_DATA_POLICY_0 = new StringId(1095, "No mirror type corresponds to data policy \"{0}\".");
+ public static final StringId AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1 = new StringId(1096, " Number of diskSizes is {0} which is not equal to number of disk Dirs which is {1}");
+ public static final StringId AttributesFactory_PARTITIONATTRIBUTES_LOCALMAXMEMORY_MUST_NOT_BE_NEGATIVE = new StringId(1097, "PartitionAttributes localMaxMemory must not be negative.");
+ public static final StringId AttributesFactory_SCOPETYPE_MUST_NOT_BE_NULL = new StringId(1098, "scopeType must not be null");
+ public static final StringId AttributesFactory_SETLOCKGRANTERTRUE_IS_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1099, "setLockGranter(true) is not allowed in Partitioned Regions.");
+ public static final StringId AttributesFactory_SETTING_SCOPE_ON_A_PARTITIONED_REGIONS_IS_NOT_ALLOWED = new StringId(1100, "Setting Scope on a Partitioned Regions is not allowed.");
+ public static final StringId AttributesFactory_STATISTICS_MUST_BE_ENABLED_FOR_EXPIRATION = new StringId(1101, "Statistics must be enabled for expiration");
+ public static final StringId AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL = new StringId(1102, "timeToLive must not be null");
+ public static final StringId AttributesFactory_TOTAL_SIZE_OF_PARTITION_REGION_MUST_BE_0 = new StringId(1103, "Total size of partition region must be > 0.");
+ public static final StringId AttributesFactory_VALUECONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1104, "valueConstraint must not be a primitive type");
+ public static final StringId BaseCommand_0_CONNECTION_DISCONNECT_DETECTED_BY_EOF = new StringId(1105, "{0}: connection disconnect detected by EOF.");
+ public static final StringId BaseCommand_0_EOFEXCEPTION_DURING_A_WRITE_OPERATION_ON_REGION__1_KEY_2_MESSAGEID_3 = new StringId(1106, "{0}: EOFException during a write operation on region : {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_0_QUERYSTRING_IS_1 = new StringId(1107, "{0} : QueryString is: {1}.");
+ public static final StringId BaseCommand_0_UNEXPECTED_ERROR_ON_SERVER = new StringId(1108, "{0} : Unexpected Error on server");
+ public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION = new StringId(1109, "{0}: Unexpected Exception");
+ public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1110, "{0}: Unexpected Exception during operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION = new StringId(1111, "{0}: Unexpected IOException: ");
+ public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION_DURING_OPERATION_FOR_REGION_1_KEY_2_MESSID_3 = new StringId(1112, "{0}: Unexpected IOException during operation for region: {1} key: {2} messId: {3}");
+ public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION = new StringId(1113, "{0}: Unexpected ShutdownException: ");
+ public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1114, "{0}: Unexpected ShutdownException during operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION = new StringId(1115, "{0}: Unexpected ThreadInterruptedException: ");
+ public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1116, "{0}: Unexpected ThreadInterruptedException during operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_UNKNOWN_QUERY_EXCEPTION = new StringId(1117, "Uknown query Exception.");
+ public static final StringId BaseCommand_SEVERE_CACHE_EXCEPTION_0 = new StringId(1118, "Severe cache exception : {0}");
+ public static final StringId BaseCommand_UNEXPECTED_QUERYINVALIDEXCEPTION_WHILE_PROCESSING_QUERY_0 = new StringId(1119, "Unexpected QueryInvalidException while processing query {0}");
+ public static final StringId LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED = new StringId(1120, "The region {0} was configured to use off heap memory but no off heap memory was configured");
+ // ok to reuse 1121
+ public static final StringId CacheServerImpl_CACHESERVER_CONFIGURATION___0 = new StringId(1122, "CacheServer Configuration: {0}");
+ public static final StringId CacheServerImpl_FORCING_NOTIFYBYSUBSCRIPTION_TO_SUPPORT_DYNAMIC_REGIONS = new StringId(1123, "Forcing notifyBySubscription to support dynamic regions");
+ // ok to reuse 1124..1130
+ public static final StringId BucketAdvisor_ATTEMPTED_TO_CLOSE_BUCKETADVISOR_THAT_IS_ALREADY_CLOSED = new StringId(1131, "Attempted to close BucketAdvisor that is already CLOSED");
+ public static final StringId AgentImpl_COULD_NOT_TAIL_0_BECAUSE_1 = new StringId(1132, "Could not tail \"{0}\" because: {1}");
+ public static final StringId SystemAdmin_USED_TO_SPECIFY_A_HOST_NAME_OR_IP_ADDRESS_TO_GIVE_TO_CLIENTS_SO_THEY_CAN_CONNECT_TO_A_LOCATOR = new StringId(1133, "Used to specify a host name or IP address to give to clients so they can connect to a locator.");
+ public static final StringId BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY = new StringId(1134, "BucketAdvisor was not closed properly.");
+ public static final StringId BucketBackupMessage_BUCKETBACKUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1135, "BucketBackupMessage: data store not configured for this member");
+ public static final StringId BucketCleanupMessage_BUCKETCLEANUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1136, "BucketCleanupMessage: data store not configured for this member");
+ public static final StringId BucketRegion_FAILED_TO_SEND_OLD_VALUE_TO_THE_FOLLOWING_MEMBERS_0 = new StringId(1137, "Failed to send old value to the following members: {0}");
+ // ok to reuse 1138
+ public static final StringId CFactory_COULD_NOT_CREATE_CF5IMPL = new StringId(1139, "Could not create CF5Impl");
+ public static final StringId CacheClientNotifier_0_REGISTERCLIENT_EXCEPTION_ENCOUNTERED_IN_REGISTRATION_1 = new StringId(1140, "{0} :registerClient: Exception encountered in registration {1}");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_KEEPING_PROXY_FOR_DURABLE_CLIENT_NAMED_0_FOR_1_SECONDS_2 = new StringId(1141, "CacheClientNotifier: Keeping proxy for durable client named {0} for {1} seconds {2}.");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_THE_REQUESTED_DURABLE_CLIENT_HAS_THE_SAME_IDENTIFIER__0__AS_AN_EXISTING_DURABLE_CLIENT__1__DUPLICATE_DURABLE_CLIENTS_ARE_NOT_ALLOWED = new StringId(1142, "CacheClientNotifier: The requested durable client has the same identifier ( {0} ) as an existing durable client ( {1} ). Duplicate durable clients are not allowed.");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_UNSUCCESSFULLY_REGISTERED_CLIENT_WITH_IDENTIFIER__0 = new StringId(1143, "CacheClientNotifier: Unsuccessfully registered client with identifier {0}");
+ public static final StringId CacheClientNotifier_CANNOT_NOTIFY_CLIENTS_TO_PERFORM_OPERATION_0_ON_EVENT_1 = new StringId(1144, "CacheClientNotifier: Cannot notify clients to perform operation {0} on event {1}");
+ public static final StringId CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_PROCESSING_CQS = new StringId(1145, "Exception occurred while processing CQs");
+ public static final StringId CacheClientNotifier_NOTIFYING_CLIENTS_BY_SUBSCRIPTION_0 = new StringId(1146, "Notifying clients by subscription: {0}");
+ public static final StringId CacheClientNotifier_UNABLE_TO_CLOSE_CQS_FOR_THE_CLIENT__0 = new StringId(1147, "Unable to close CQs for the client: {0}");
+ public static final StringId CacheClientNotifier_UNABLE_TO_GET_THE_CQSERVICE_WHILE_CLOSING_THE_DEAD_PROXIES = new StringId(1148, "Unable to get the CqService while closing the dead proxies");
+ public static final StringId CacheClientProxy_0_AN_UNEXPECTED_IOEXCEPTION_OCCURRED_SO_THE_PROXY_WILL_BE_CLOSED = new StringId(1149, "{0}: An unexpected IOException occurred so the proxy will be closed.");
+ public static final StringId CacheClientProxy_0_CANCELLING_EXPIRATION_TASK_SINCE_THE_CLIENT_HAS_RECONNECTED = new StringId(1150, "{0}: Cancelling expiration task since the client has reconnected.");
+ public static final StringId CacheClientProxy_0_COULD_NOT_STOP_MESSAGE_DISPATCHER_THREAD = new StringId(1151, "{0}: Could not stop message dispatcher thread.");
+ public static final StringId CacheClientProxy_0_EXCEPTION_IN_CLOSING_THE_UNDERLYING_HAREGION_OF_THE_HAREGIONQUEUE = new StringId(1152, "{0}: Exception in closing the underlying HARegion of the HARegionQueue");
+ public static final StringId CacheClientProxy_0_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1153, "{0}: Exception occurred while attempting to add message to queue");
+ public static final StringId CacheClientProxy_0_POSSIBILITY_OF_NOT_BEING_ABLE_TO_SEND_SOME_OR_ALL_THE_MESSAGES_TO_CLIENTS_TOTAL_MESSAGES_CURRENTLY_PRESENT_IN_THE_LIST_1 = new StringId(1154, "{0} Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list {1}.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_SOCKET_BEING_CLOSED_LOCALLY = new StringId(1155, "{0}: Proxy closing due to socket being closed locally.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_BROKEN_PIPE_ON_SOCKET_CONNECTION = new StringId(1156, "{0}: Proxy closing due to unexpected broken pipe on socket connection.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_BY_PEER_ON_SOCKET_CONNECTION = new StringId(1157, "{0}: Proxy closing due to unexpected reset by peer on socket connection.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_ON_SOCKET_CONNECTION = new StringId(1158, "{0}: Proxy closing due to unexpected reset on socket connection.");
+ public static final StringId CacheClientProxy_0__AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1159, "{0} : An unexpected Exception occurred");
+ public static final StringId CacheClientProxy_0__EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1160, "{0} : Exception occurred while attempting to add message to queue");
+ public static final StringId CacheClientProxy_0__PAUSING_PROCESSING = new StringId(1161, "{0} : Pausing processing");
+ public static final StringId CacheClientProxy_0__RESUMING_PROCESSING = new StringId(1162, "{0} : Resuming processing");
+ public static final StringId CacheClientProxy_0__THE_EXPIRATION_TASK_HAS_FIRED_SO_THIS_PROXY_IS_BEING_TERMINATED = new StringId(1163, "{0} : The expiration task has fired, so this proxy is being terminated.");
+ public static final StringId CacheClientProxy_CONNECTIONPROXYIMPL_COULD_NOT_RECOVER_INSTANTIATORS_WITH_0 = new StringId(1164, "ConnectionProxyImpl: Could not recover instantiators with {0}.");
+ public static final StringId CacheClientProxy_CONNECTIONPROXYIMPL_COULD_NOT_RECOVER_INSTANTIATORS_WITH_0_BECAUSE_1 = new StringId(1165, "ConnectionProxyImpl: Could not recover instantiators with {0} because {1}");
+ public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_BROKEN_PIPE_ON_SOCKET = new StringId(1166, "Problem caused by broken pipe on socket.");
+ public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_MESSAGE_QUEUE_BEING_CLOSED = new StringId(1167, "Problem caused by message queue being closed.");
+ public static final StringId CacheClientUpdater_0_CAUGHT_FOLLOWING_EXECPTION_WHILE_ATTEMPTING_TO_CREATE_A_SERVER_TO_CLIENT_COMMUNICATION_SOCKET_AND_WILL_EXIT_1 = new StringId(1168, "{0}: Caught following exception while attempting to create a server-to-client communication socket and will exit: {1}");
+ public static final StringId CacheClientUpdater_0_CONNECTION_WAS_REFUSED = new StringId(1169, "{0} connection was refused");
+ public static final StringId CacheClientUpdater_SSL_NEGOTIATION_FAILED_WITH_ENDPOINT_0 = new StringId(1170, "SSL negotiation failed with endpoint: {0}");
+ public static final StringId CacheClientUpdater_0_EXITING_WITHOUT_READING_SERVER_MESSAGES_BECAUSE_OF_1_REGISTERINTEREST_CALLS_BEING_IN_PROGRESS = new StringId(1171, "{0}: exiting without reading server messages because of {1} registerInterest calls being in progress.");
+ public static final StringId CacheClientUpdater_0_RECEIVED_AN_UNSUPPORTED_MESSAGE_TYPE_1 = new StringId(1172, "{0}: Received an unsupported message (type={1})");
+ public static final StringId CacheClientUpdater_0__1__2 = new StringId(1173, "{0} : {1} : {2}");
+ public static final StringId CacheClientUpdater_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_DESTROY_ENTRY_REGION_0_KEY_1 = new StringId(1174, "The following exception occurred while attempting to destroy entry (region: {0} key: {1})");
+ public static final StringId CacheClientUpdater_CACHE_UPDATE_THREAD_FINISHED_WAITING_FOR_REGISTERINTEREST_TO_COMPLETE = new StringId(1175, "Cache update thread finished waiting for registerInterest to complete");
+ public static final StringId CacheClientUpdater_CACHE_UPDATE_THREAD_WAITED_MORE_THAN_0_SEC_FOR_REGISTERINTEREST_TO_COMPLETE = new StringId(1176, "Cache update thread waited more than {0} sec for registerInterest to complete");
+ public static final StringId CacheClientUpdater_FAILED_TO_INVOKE_CQ_DISPATCHER_ERROR___0 = new StringId(1177, "Failed to invoke CQ Dispatcher. Error : {0}");
+ public static final StringId CacheDistributionAdvisor_WAITING_FOR_CURRENT_OPERATIONS_TO_FINISH_0_ = new StringId(1178, "Waiting for current operations to finish( {0} )");
+ public static final StringId CacheFactory_0_AN_OPEN_CACHE_ALREADY_EXISTS = new StringId(1179, "{0}: An open cache already exists.");
+ public static final StringId InternalDistributedSystem_shutdownHook_shuttingdown = new StringId(1180, "VM is exiting - shutting down distributed system");
+ public static final StringId GroupMembershipService_entered_into_membership_in_group_0_with_id_1 = new StringId(1181, "Finished joining (took {0}ms).");
+ public static final StringId CacheServerLauncher_CACHE_SERVER_ERROR = new StringId(1182, "Cache server error");
+ public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_APPENDED_CHARACTER_DATA_0 = new StringId(1183, "XML Parser characters, appended character data: {0}");
+ public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_NEW_CHARACTER_DATA_0 = new StringId(1184, "XML Parser characters, new character data: {0}");
+ public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_CLASS_NAME_0 = new StringId(1185, "XML Parser createDeclarable class name: {0}");
+ public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_PROPERTIES__0 = new StringId(1186, "XML Parser createDeclarable properties: {0}");
+ public static final StringId ClearRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1187, "{0}: The input region name for the clear region request is null");
+ public static final StringId ClearRegion_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1188, " The input region name for the clear region request is null");
+ public static final StringId ClearRegion_WAS_NOT_FOUND_DURING_CLEAR_REGION_REGUEST = new StringId(1189, " was not found during clear region request");
+ public static final StringId ClientHealtMonitor_0_IS_BEING_TERMINATED_BECAUSE_ITS_CLIENT_TIMEOUT_OF_1_HAS_EXPIRED = new StringId(1190, "{0} is being terminated because its client timeout of {1} has expired.");
+ public static final StringId ClientHealthMonitor_0_AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1191, "{0}: An unexpected Exception occurred");
+ public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITORTHREAD_MAXIMUM_ALLOWED_TIME_BETWEEN_PINGS_0 = new StringId(1192, "ClientHealthMonitorThread maximum allowed time between pings: {0}");
+ public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_REGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1193, "ClientHealthMonitor: Registering client with member id {0}");
+ public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_UNREGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1194, "ClientHealthMonitor: Unregistering client with member id {0}");
+ public static final StringId ClientHealthMonitor_CLIENT_HEALTH_MONITOR_THREAD_DISABLED_DUE_TO_MAXIMUMTIMEBETWEENPINGS_SETTING__0 = new StringId(1195, "Client health monitor thread disabled due to maximumTimeBetweenPings setting: {0}");
+ public static final StringId ClientHealthMonitor_MONITORING_CLIENT_WITH_MEMBER_ID_0_IT_HAD_BEEN_1_MS_SINCE_THE_LATEST_HEARTBEAT_MAX_INTERVAL_IS_2_TERMINATED_CLIENT = new StringId(1196, "Monitoring client with member id {0}. It had been {1} ms since the latest heartbeat. Max interval is {2}. Terminated client.");
+ public static final StringId ClientHealthMonitor_UNEXPECTED_INTERRUPT_EXITING = new StringId(1197, "Unexpected interrupt, exiting");
+ public static final StringId ClientProxyMembershipID_UNABLE_TO_DESERIALIZE_MEMBERSHIP_ID = new StringId(1198, "Unable to deserialize membership id");
+ public static final StringId DiskStore_IS_USED_IN_NONPERSISTENT_REGION = new StringId(1199, "Only regions with persistence or overflow to disk can specify DiskStore");
+ public static final StringId DiskRegion_COMPLEXDISKREGIONGETNEXTDIR_MAX_DIRECTORY_SIZE_WILL_GET_VIOLATED__GOING_AHEAD_WITH_THE_SWITCHING_OF_OPLOG_ANY_WAYS_CURRENTLY_AVAILABLE_SPACE_IN_THE_DIRECTORY_IS__0__THE_CAPACITY_OF_DIRECTORY_IS___1 = new StringId(1200, "Even though the configured directory size limit has been exceeded a new oplog will be created because compaction is enabled. The configured limit is {1}. The current space used in the directory by this disk store is {0}.");
+ public static final StringId DiskRegion_PROBLEM_IN_COMPACTOR_THREAD_IT_WILL_TERMINATE = new StringId(1201, "Problem in Compactor thread. It will terminate.");
+ public static final StringId DiskRegion_THE_ENTRY_IN_QUESTION_IS_HAVING_DISKID_AS_0 = new StringId(1202, "The entry in question is having DiskId = {0}");
+ public static final StringId ConnectionImpl_0_INTERRUPTED_READING_PING_RESPONSE_FOR_TRANSACTION_1 = new StringId(1203, "{0}: Interrupted reading ping response for transaction {1}");
+ public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_BATCH_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1204, "{0}: SocketTimeoutException during batch operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_CQ_OPERATION = new StringId(1205, "{0}: SocketTimeoutException during cq operation.");
+ public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_DESTROY_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1206, "{0}: SocketTimeoutException during destroy operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_PUT_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1207, "{0}: SocketTimeoutException during put operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId ConnectionImpl_0_TIMED_OUT_READING_PING_RESPONSE_FOR_TRANSACTION_1 = new StringId(1208, "{0}: Timed out reading ping response for transaction {1}");
+ public static final StringId ConnectionImpl_AN_INCORRECT_CONNECTION_HAS_BEEN_ASSIGNED_THIS_CONNECTION_IS_ALREADY_PROCESSING_A_REQUEST = new StringId(1209, "An incorrect connection has been assigned. This connection is already processing a request.");
+ public static final StringId ConnectionImpl_CONNECTION_0_WHILE_PERFORMING_A_REMOTE_CLIENTREADYTORECEIVEUPDATES = new StringId(1210, "Connection ({0}): While performing a remote clientReadyToReceiveUpdates");
+ public static final StringId ConnectionImpl_THE_CACHESERVER_ON_0_HAS_DIED_UNEXPECTEDLY = new StringId(1211, "The CacheServer on {0} has died unexpectedly");
+ public static final StringId ConnectionImpl_UNEXPECTED_MESSAGE_TYPE_0 = new StringId(1212, "Unexpected message type {0}");
+ public static final StringId AttributesFactory_CLONENOTSUPPORTEDEXCEPTION_THROWN_IN_CLASS_THAT_IMPLEMENTS_CLONEABLE = new StringId(1213, "CloneNotSupportedException thrown in class that implements cloneable.");
+ public static final StringId ConnectionProxyImpl_0_FAILED_TO_SET_PRIMARY_ENDPOINT_TO_1_2 = new StringId(1214, "{0}: Failed to set primary endpoint to <{1}>: {2}");
+ public static final StringId CqQueryImpl_CQ_IS_CLOSED_CQNAME_0 = new StringId(1215, "CQ is closed, CqName : {0}");
+ public static final StringId ConnectionProxyImpl_0__ADDING__1 = new StringId(1216, "{0} : Adding {1}");
+ public static final StringId ConnectionProxyImpl_0__ATTEMPTING_TO_REMOVE_ENDPOINT__1__2__3 = new StringId(1217, "{0} : Attempting to remove endpoint {1} -> {2} : {3}");
+ public static final StringId ConnectionProxyImpl_0__CONFIGURATION__1 = new StringId(1218, "{0} : configuration: {1}");
+ public static final StringId ConnectionProxyImpl_0__INITIALIZED_USING__1 = new StringId(1219, "{0} : initialized using: {1}");
+ public static final StringId ConnectionProxyImpl_0__LIVE__1__CANNOT_BE_REMOVED_BECAUSE_IT_HAS_CONNECTIONS = new StringId(1220, "{0} : Live {1} cannot be removed because it has connections.");
+ public static final StringId ConnectionProxyImpl_0__LIVE__1__HAS_BEEN_REMOVED = new StringId(1221, "{0} : Live {1} has been removed.");
+ public static final StringId ConnectionProxyImpl_0__NO_EXISTING_LIVE_ENDPOINT_WAS_FOUND_FOR_ENDPOINT__1__2__3__NO_ENDPOINT_WAS_REMOVED = new StringId(1222, "{0} : No existing live endpoint was found for endpoint {1} -> {2} : {3} . No endpoint was removed.");
+ public static final StringId ConnectionProxyImpl_0__SUCCESSFULLY_SENT_CLIENT_READY_MESSAGE_AFTER_FAILOVER_TO__1 = new StringId(1223, "{0} : Successfully sent client ready message after failover to {1}");
+ public static final StringId ConnectionProxyImpl_0__SUCCESSFULLY_SENT_CLIENT_READY_MESSAGE_TO__1 = new StringId(1224, "{0} : Successfully sent client ready message to {1}");
+ public static final StringId ConnectionProxyImpl_0__THE_EXISTING_LIVE_ENDPOINT_NAMED__1__COULD_NOT_BE_REMOVED_BECAUSE_ITS_HOST_AND_PORT__2__3__DOES_NOT_MATCH_THE_REQUESTED_HOST_AND_PORT__4__5_ = new StringId(1225, "{0} : The existing live endpoint named {1} could not be removed because its host and port ( {2} : {3} ) does not match the requested host and port ( {4} : {5} ).");
+ public static final StringId Connection_DISCONNECTED_AS_A_SLOWRECEIVER = new StringId(1226, "Disconnected as a slow-receiver");
+ public static final StringId ConnectionProxyImpl_CACHE_IS_CLOSED = new StringId(1227, "Cache is closed");
+ public static final StringId ConnectionProxyImpl_CONDITIONALLYRELEASECONNECTION_FAILED_ON_0_DUE_TO_UNKNOWN_POLICY_TYPE_1 = new StringId(1228, "conditionallyReleaseConnection: failed on <{0}> due to unknown policy type {1}");
+ public static final StringId ConnectionProxyImpl_CONNECTIONPROXYIMPL_0_FINISHED_INSTANTIATORS_RECOVERY = new StringId(1229, "ConnectionProxyImpl ({0}) finished instantiators recovery.");
+ public static final StringId ConnectionProxyImpl_CONNECTIONPROXYIMPL_0_STARTED_INSTANTIATORS_RECOVERY = new StringId(1230, "ConnectionProxyImpl ({0}) started instantiators recovery.");
+ public static final StringId ConnectionProxyImpl_CONNECTIONPROXYIMPL_COULD_NOT_RECOVER_INSTANTIATORS_WITH_0_1 = new StringId(1231, "ConnectionProxyImpl: Could not recover instantiators with {0}. {1}");
+ public static final StringId ConnectionProxyImpl_COULD_NOT_ACQUIRE_OR_CREATE_A_CONNECTION_NO_ACTIVE_SERVERS_WERE_FOUND_WHILE_REGISTERING_INSTANTIATORS = new StringId(1232, "Could not acquire or create a Connection. No active servers were found while registering instantiators.");
+ public static final StringId ConnectionProxyImpl_COULD_NOT_ACQUIRE_OR_CREATE_A_CONNECTION_NO_AVAILABLE_CONNECTION_WAS_FOUND_WHILE_REGISTERING_INSTANTIATORS_BUT_THE_FOLLOWING_ACTIVE_SERVERS_EXIST_0 = new StringId(1233, "Could not acquire or create a Connection. No available Connection was found while registering instantiators, but the following active servers exist: {0}");
+ public static final StringId ConnectionProxyImpl_ERROR_WHILE_REREGISTERING_THE_CQ_TO_THE_REDUNDANT_SERVER_CQNAME_0_ERROR_1 = new StringId(1234, "Error while re-registering the CQ to the redundant server. CqName : {0}, Error : {1}");
+ public static final StringId ConnectionProxyImpl_EXCEPTION_WHILE_SENDING_AN_ACK_TO_THE_PRIMARY_SERVER = new StringId(1235, "Exception while sending an ack to the primary server");
+ public static final StringId ConnectionProxyImpl_PROBLEM_REMOVING_ALL_INTEREST_ON_REGION_0_INTERESTTYPE_1 = new StringId(1236, "Problem removing all interest on region={0} interestType={1}");
+ public static final StringId ConnectionProxyImpl_PROXY_NOT_PROPERLY_INITIALIZED_0 = new StringId(1237, "Proxy not properly initialized: {0}");
+ public static final StringId ConnectionProxyImpl_THREADIDTOSEQUENCEIDEXPIRYTHREADUNEXPECTED_INTRREUPT_HENCE_CONTINUE_RUNNING = new StringId(1238, "ThreadIdToSequenceIdExpiryThread::Unexpected interrupt, hence continue running");
+ public static final StringId ConnectionProxyImpl_UNEXPECTED_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_NOTIFY_PRIMARY_SERVER__0__OF_CLIENT_READINESS = new StringId(1239, "Unexpected exception occurred while attempting to notify primary server {0} of client readiness");
+ public static final StringId ConnectionTable_FAILED_TO_ACCEPT_CONNECTION_FROM_0_BECAUSE_1 = new StringId(1240, "Failed to accept connection from {0} because: {1}");
+ public static final StringId ConnectionTable_KEY_0___VALUE_HASH_1__DESCR_2 = new StringId(1241, "key= {0} value hash= {1} descr= {2}");
+ public static final StringId ConnectionTable_P2P_CONNECTION_TABLE_CONTENTS = new StringId(1242, "P2P connection table contents-----------");
+ public static final StringId Connection_0_ASYNC_CONFIGURATION_RECEIVED_1 = new StringId(1243, "{0} async configuration received {1}.");
+ public static final StringId Connection_0_ERROR_READING_MESSAGE = new StringId(1244, "{0} Error reading message");
+ public static final StringId Connection_0_EXCEPTION_IN_CHANNEL_READ = new StringId(1245, "{0} exception in channel read");
+ public static final StringId Connection_0_EXCEPTION_RECEIVED = new StringId(1246, "{0} exception received");
+ public static final StringId Connection_0_STRAY_INTERRUPT_READING_MESSAGE = new StringId(1247, "{0} Stray interrupt reading message");
+ public static final StringId Connection_0_SUCCESSFULLY_REESTABLISHED_CONNECTION_TO_PEER_1 = new StringId(1248, "{0}: Successfully reestablished connection to peer {1}");
+ public static final StringId Connection_ACK_READ_EXCEPTION = new StringId(1249, "ack read exception");
+ public static final StringId Connection_ACK_READ_EXCEPTION_0 = new StringId(1250, "ack read exception: {0}");
+ public static final StringId Connection_ACK_WAIT_THRESHOLD_EXCEEDED_WAITING_FOR_ACK_FROM_0 = new StringId(1251, "Ack wait threshold exceeded waiting for ack from {0}");
+ public static final StringId Connection_ACK_WRITE_EXCEPTION = new StringId(1252, "ack write exception");
+ public static final StringId Connection_ACK_WRITE_EXCEPTION_0 = new StringId(1253, "ack write exception: {0}");
+ public static final StringId Connection_ALLOCATING_LARGER_NETWORK_READ_BUFFER_NEW_SIZE_IS_0_OLD_SIZE_WAS_1 = new StringId(1254, "Allocating larger network read buffer, new size is {0} old size was {1}.");
+ public static final StringId Connection_BLOCKED_FOR_0_MS_WHICH_IS_LONGER_THAN_THE_MAX_OF_1_MS_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1255, "Blocked for {0}ms which is longer than the max of {1}ms, asking slow receiver {2} to disconnect.");
+ public static final StringId Connection_CLASSNOTFOUND_DESERIALIZING_MESSAGE_0 = new StringId(1256, "ClassNotFound deserializing message: {0}");
+ public static final StringId Connection_CONNECTION_ATTEMPTING_RECONNECT_TO_PEER__0 = new StringId(1257, "Connection: Attempting reconnect to peer {0}");
+ public static final StringId Connection_CONNECTION_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1258, "Connection: shared={0} ordered={1} failed to connect to peer {2} because: {3}");
+ public static final StringId Connection_CONNECTION_HANDSHAKE_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1259, "Connection: shared={0} ordered={1} handshake failed to connect to peer {2} because: {3}");
+ public static final StringId Connection_DETECTED_OLD_VERSION_PRE_5_0_1_OF_GEMFIRE_OR_NONGEMFIRE_DURING_HANDSHAKE_DUE_TO_INITIAL_BYTE_BEING_0 = new StringId(1260, "Detected old version (pre 5.0.1) of GemFire or non-GemFire during handshake due to initial byte being {0}");
+ public static final StringId Connection_END_OF_FILE_ON_ACK_STREAM = new StringId(1261, "end of file on ack stream");
+ public static final StringId Connection_ERROR_DESERIALIZING_MESSAGE = new StringId(1262, "Error deserializing message");
+ public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_MESSAGE = new StringId(1263, "Error deserializing P2P handshake message");
+ public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1264, "Error deserializing P2P handshake reply");
+ public static final StringId Connection_ERROR_DISPATCHING_MESSAGE = new StringId(1265, "Error dispatching message");
+ public static final StringId Connection_EXCEPTION_FLUSHING_BATCH_SEND_BUFFER_0 = new StringId(1266, "Exception flushing batch send buffer: {0}");
+ public static final StringId Connection_FAILED_HANDLING_CHUNK_MESSAGE = new StringId(1267, "Failed handling chunk message");
+ public static final StringId Connection_FAILED_HANDLING_END_CHUNK_MESSAGE = new StringId(1268, "Failed handling end chunk message");
+ public static final StringId Connection_FAILED_SETTING_CHANNEL_TO_BLOCKING_MODE_0 = new StringId(1269, "Failed setting channel to blocking mode {0}");
+ public static final StringId Connection_FINISHED_WAITING_FOR_REPLY_FROM_0 = new StringId(1270, "Finished waiting for reply from {0}");
+ public static final StringId Connection_IOEXCEPTION_DESERIALIZING_MESSAGE = new StringId(1271, "IOException deserializing message");
+ public static final StringId Connection_OWNER_SHOULD_NOT_BE_NULL = new StringId(1272, "\"owner\" should not be null");
+ public static final StringId Connection_P2P_PUSHER_EXCEPTION_0 = new StringId(1273, "P2P pusher exception: {0}");
+ public static final StringId Connection_QUEUED_BYTES_0_EXCEEDS_MAX_OF_1_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1274, "Queued bytes {0} exceeds max of {1}, asking slow receiver {2} to disconnect.");
+ public static final StringId Connection_SOCKET_0_IS_1_INSTEAD_OF_THE_REQUESTED_2 = new StringId(1275, "Socket {0} is {1} instead of the requested {2}.");
+ public static final StringId Connection_THROWABLE_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1276, "Throwable deserializing P2P handshake reply");
+ public static final StringId Connection_THROWABLE_DISPATCHING_MESSAGE = new StringId(1277, "Throwable dispatching message");
+ public static final StringId Connection_TIMED_OUT_WAITING_FOR_READERTHREAD_ON_0_TO_FINISH = new StringId(1278, "Timed out waiting for readerThread on {0} to finish.");
+ public static final StringId Connection_UNABLE_TO_GET_INPUT_STREAM = new StringId(1279, "Unable to get input stream");
+ public static final StringId Connection_UNABLE_TO_GET_P2P_CONNECTION_STREAMS = new StringId(1280, "Unable to get P2P connection streams");
+ public static final StringId Connection_UNEXPECTED_FAILURE_DESERIALIZING_MESSAGE = new StringId(1281, "Unexpected failure deserializing message");
+ public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0 = new StringId(1282, "Unknown handshake reply code: {0}");
+ public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0_NIOMESSAGELENGTH_1_PROCESSORTYPE_2 = new StringId(1283, "Unknown handshake reply code: {0} nioMessageLength={1} processorType={2}");
+ public static final StringId Connection_UNKNOWN_P2P_MESSAGE_TYPE_0 = new StringId(1284, "Unknown P2P message type: {0}");
+ public static final StringId Connection_UNKNOWN_PROCESSOR_TYPE_0 = new StringId(1285, "Unknown processor type: {0}");
+ public static final StringId ContainsKeyValueMess_PARTITIONED_REGION_0_IS_NOT_CONFIGURED_TO_STORE_DATA = new StringId(1286, "Partitioned Region {0} is not configured to store data");
+ // ok to reuse 1287
+ public static final StringId ContainsKey_0_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1288, "{0}: The input key for the containsKey request is null");
+ public static final StringId ContainsKey_0_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1289, "{0}: The input region name for the containsKey request is null");
+ public static final StringId ContainsKey_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1290, " The input key for the containsKey request is null");
+ public static final StringId ContainsKey_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1291, " The input region name for the containsKey request is null");
+ public static final StringId ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST = new StringId(1292, " was not found during containsKey request");
+ public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_CREATING_USERTRANSACTION_OBJECT = new StringId(1293, "ContextImpl::lookup::Error while creating UserTransaction object");
+ public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_LOOKING_UP_0 = new StringId(1294, "ContextImpl::lookup::Error while looking up {0}");
+ public static final StringId CqAttributesFactory_EXCEPTION_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1295, "Exception closing CQ Listener Error: {0}");
+ public static final StringId CqAttributesFactory_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1296, "Exception occurred while closing CQ Listener Error: {0}");
+ public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1297, "Runtime Exception occurred closing CQ Listener Error: {0}");
+ public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1298, "Runtime Exception occurred while closing CQ Listener Error: {0}");
+ public static final StringId CqQueryImpl_FAILED_TO_STORE_CONTINUOUS_QUERY_IN_THE_REPOSITORY_CQNAME_0_1 = new StringId(1299, "Failed to store Continuous Query in the repository. CqName: {0} {1}");
+ public static final StringId CqQueryImpl_0_REQUEST_TO_SERVER_FOR_CQ_1_ON_ENDPOINT_2 = new StringId(1300, "{0} request to server for cq: {1} on endpoint: {2}");
+ public static final StringId PRHARRedundancyProvider_0_IN_THE_PARTITIONED_REGION_REGION_NAME_1 = new StringId(1301, "{0} Region name = {1}");
+ public static final StringId CqQueryImpl_CLASS_NOT_FOUND_EXCEPTION_THE_ANTLRJAR_OR_THE_SPCIFIED_CLASS_MAY_BE_MISSING_FROM_SERVER_SIDE_CLASSPATH_ERROR_0 = new StringId(1302, "Class not found exception. The antlr.jar or the spcified class may be missing from server side classpath. Error : {0}");
+ public static final StringId CqQueryImpl_CQ_IS_NOT_IN_RUNNING_STATE_STOP_CQ_DOES_NOT_APPLY_CQNAME_0 = new StringId(1303, "CQ is not in running state, stop CQ does not apply, CqName : {0}");
+ public static final StringId CqQueryImpl_CQ_QUERIES_CANNOT_HAVE_MORE_THAN_ONE_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1304, "CQ queries cannot have more than one iterator in the FROM clause");
+ public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_ORDER_BY = new StringId(1305, "CQ queries do not support ORDER BY");
+ public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_PROJECTIONS = new StringId(1306, "CQ queries do not support projections");
+ public static final StringId CqQueryImpl_CQ_QUERIES_MUST_BE_A_SELECT_STATEMENT_ONLY = new StringId(1307, "CQ queries must be a select statement only");
+ public static final StringId CqQueryImpl_CQ_QUERIES_MUST_HAVE_A_REGION_PATH_ONLY_AS_THE_FIRST_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1308, "CQ queries must have a region path only as the first iterator in the FROM clause");
+ public static final StringId CqQueryImpl_CQ_QUERIES_MUST_REFERENCE_ONE_AND_ONLY_ONE_REGION = new StringId(1309, "CQ queries must reference one and only one region");
+ public static final StringId CqQueryImpl_ERROR_WHILE_PARSING_THE_QUERY_ERROR_0 = new StringId(1310, "Error while parsing the query. Error : {0}");
+ public static final StringId PRHARRedundancyProvider_UNABLE_TO_FIND_ANY_MEMBERS_TO_HOST_A_BUCKET_IN_THE_PARTITIONED_REGION_0 = new StringId(1311, "Unable to find any members to host a bucket in the partitioned region. {0}.{1}");
+ public static final StringId CqQueryImpl_EXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1312, "Exception occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
+ public static final StringId CqQueryImpl_EXCEPTION_WHILE_REREGISTERING_CQ_CQNAME_0_ERROR_1 = new StringId(1313, "Exception while re-registering CQ. CqName: {0} Error : {1}");
+ public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_ERROR_FROM_LAST_ENDPOINT_1 = new StringId(1314, "Failed to close the cq. CqName: {0}. Error from last endpoint: {1}");
+ public static final StringId CqQueryImpl_FAILED_TO_REMOVE_CQ_FROM_THE_BASE_REGION_CQNAME__0 = new StringId(1315, "Failed to remove CQ from the base region. CqName : {0}");
+ public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_ERROR_FROM_LAST_SERVER_1 = new StringId(1316, "Failed to stop the cq. CqName :{0} Error from last server: {1}");
+ public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0 = new StringId(1317, "Failed to stop the cq. CqName :{0}.");
+ public static final StringId CqQueryImpl_REGION_ON_WHICH_QUERY_IS_SPECIFIED_NOT_FOUND_LOCALLY_REGIONNAME_0 = new StringId(1318, "Region on which query is specified not found locally, regionName: {0}");
+ public static final StringId CqQueryImpl_REGION__0_SPECIFIED_WITH_CQ_NOT_FOUND_CQNAME_1 = new StringId(1319, "Region : {0} specified with cq not found. CqName: {1}");
+ public static final StringId CqQueryImpl_RUNTIMEEXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1320, "RuntimeException occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
+ public static final StringId CqQueryImpl_SELECT_DISTINCT_QUERIES_NOT_SUPPORTED_IN_CQ = new StringId(1321, "select DISTINCT queries not supported in CQ");
+ // ok to reuse 1322
+ public static final StringId CqQueryImpl_THE_WHERE_CLAUSE_IN_CQ_QUERIES_CANNOT_REFER_TO_A_REGION = new StringId(1323, "The WHERE clause in CQ queries cannot refer to a region");
+ public static final StringId CqQueryImpl_UNABLE_TO_CREATE_CQ_0_ERROR__1 = new StringId(1324, "Unable to create cq {0} Error : {1}");
+ // ok to reuse 1325
+ public static final StringId CqQueryImpl_UNSUPPORTED_SEND_REQUEST_TO_SERVER = new StringId(1326, "Unsupported send request to Server.");
+ public static final StringId CqQueryImpl_CQ_IS_IN_RUNNING_STATE_CQNAME_0 = new StringId(1327, "CQ is in running state, CqName : {0}");
+ public static final StringId CqService_0_FAILED_TO_GET_THE_SPECIFIED_CQ_1 = new StringId(1328, "{0}: Failed to get the specified CQ: {1}");
+ public static final StringId CqService_CLIENT_SIDE_NEWCQ_METHOD_INVOCATION_ON_SERVER = new StringId(1329, "client side newCq() method invocation on server.");
+ public static final StringId CqService_CQ_NOT_FOUND_FAILED_TO_CLOSE_THE_SPECIFIED_CQ_0 = new StringId(1330, "CQ Not found, Failed to close the specified CQ {0}");
+ public static final StringId CqService_CQ_NOT_FOUND_FAILED_TO_STOP_THE_SPECIFIED_CQ_0 = new StringId(1331, "CQ Not found, Failed to stop the specified CQ {0}");
+ public static final StringId CqService_CQ_NOT_FOUND_IN_THE_CQ_META_REGION_CQNAME_0 = new StringId(1332, "CQ not found in the cq meta region, CqName: {0}");
+ public static final StringId CqService_CQ_WITH_THE_GIVEN_NAME_ALREADY_EXISTS_CQNAME_0 = new StringId(1333, "CQ with the given name already exists. CqName : {0}");
+ public static final StringId CqService_ERROR_SENDING_CQ_MONITOROP_REQUEST = new StringId(1334, "Error sending CQ MonitorOp request.");
+ public static final StringId RemoteGfManagerAgent_LISTENER_THREW_AN_EXCEPTION = new StringId(1335, "Listener threw an exception.");
+ public static final StringId PRHARRedundancyProvider_FOUND_A_MEMBER_TO_HOST_A_BUCKET = new StringId(1336, "Found a member to host a bucket.");
+ public static final StringId CqService_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1337, "Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
+ public static final StringId CqService_EXCEPTION_WHILE_REGISTERING_CQ_ON_SERVER_CQNAME___0 = new StringId(1338, "Exception while registering CQ on server. CqName : {0}");
+ public static final StringId CqService_FAILED_TO_CLOSE_CQ__0___1 = new StringId(1339, "Failed to close CQ {0} {1}");
+ public static final StringId CqService_FAILED_TO_CREATE_CQ_META_REGION_0_1 = new StringId(1340, "Failed to create CQ Meta region. {0}: {1}");
+ public static final StringId CqService_FAILED_TO_CREATE_CQ_META_REGION_TIMEDOUT_0_1 = new StringId(1341, "Failed to create CQ Meta region (TimedOut). {0}: {1}");
+ public static final StringId CqService_FAILED_TO_INITIALIZE_CQ_META_REGION_TIMEDOUT_OR_SERVER_CONNECTION_0_1 = new StringId(1342, "Failed to Initialize: CQ Meta region (TimedOut) Or Server Connection. {0}: {1}");
+ public static final StringId CqService_INITIALIZED_CQSERVICE_SUCCESSFULLY = new StringId(1343, "Initialized CqService Successfully.");
+ public static final StringId CqService_INITIALIZING_CQ_SERVICE = new StringId(1344, "Initializing CQ Service.");
+ public static final StringId CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED = new StringId(1345, "Invalid CQ Monitor request received.");
+ public static final StringId CqService_MONITOR_CQ_REQUEST_TO_SERVER_OP_IS_0_1_2 = new StringId(1346, "Monitor CQ request to server. OP is: {0} {1} {2}");
+ public static final StringId CqService_NO_ACTIVE_ENDPOINTS_FOUND_WITH_REGISTERED_CQS = new StringId(1347, "No Active endpoints found with Registered CQs.");
+ public static final StringId CqService_NULL_ARGUMENT_0 = new StringId(1348, "Null argument \"{0}\"");
+ public static final StringId CqService_RUNTIME_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1349, "Runtime Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
+ public static final StringId CqService_SERVER_SIDE_EXECUTECQ_METHOD_IS_CALLED_ON_CLIENT_CQNAME_0 = new StringId(1350, "Server side executeCq method is called on client. CqName : {0}");
+ public static final StringId Oplog_EXCEPTION_IN_ACQURING_READ_LOCK_WHILE_CHECKING_THE_ASYNCH_MAPS_FOR_THE_PRESENCE_OF_AN_ENTRY_ATTEMPTING_TO_SEE_IF_IT_IS_PRESENT_IN_THE_OPLOG = new StringId(1351, "Exception in acquiring read lock, while checking the asynch maps for the presence of an entry. Attempting to see if it is present in the opLog.");
+ public static final StringId CqService_THERE_WAS_NO_ACTIVE_CQS = new StringId(1352, "There was no active Cqs.");
+ public static final StringId CqService_THERE_WAS_NO_ACTIVE_ENDPOINTS_ON_THE_CQS = new StringId(1353, "There was no active endpoints on the Cqs.");
+ public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_THE_SERVER_ENDPOINTS_ON_WHICH_THIS_CQ_WAS_REGISTERED_WERE_NOT_FOUND = new StringId(1354, "Failed to close the cq. CqName: {0}. The server endpoints on which this cq was registered were not found.");
+ public static final StringId CqService_UNABLE_TO_FIND_CQQUERY_FOR_THE_CQ___0 = new StringId(1355, "Unable to find CqQuery for the CQ : {0}");
+ public static final StringId CreateRegionProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1356, "More than one exception thrown in {0}");
+ public static final StringId CreateRegion_0_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1357, "{0}: The input parent region name for the create region request is null");
+ public static final StringId CreateRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1358, "{0}: The input region name for the create region request is null");
+ public static final StringId CreateRegion_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1359, " The input parent region name for the create region request is null");
+ public static final StringId CreateRegion_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1360, " The input region name for the create region request is null");
+ public static final StringId DLockGrantor_DEBUGHANDLESUSPENDTIMEOUTS_SLEEPING_FOR__0 = new StringId(1361, "debugHandleSuspendTimeouts sleeping for {0}");
+ public static final StringId DLockGrantor_DLOCKGRANTORTHREAD_CAUGHT_EXCEPTION = new StringId(1362, "DLockGrantorThread caught exception...");
+ public static final StringId DLockGrantor_DLOCKGRANTORTHREAD_WAS_UNEXPECTEDLY_INTERRUPTED = new StringId(1363, "DLockGrantorThread was unexpectedly interrupted");
+ public static final StringId DLockGrantor_FAILED_TO_SCHEDULE_HELD_LOCK_0_FOR_1_BECAUSE_2_ALREADY_EXISTS = new StringId(1364, "Failed to schedule held lock {0} for {1} because {2} already exists.");
+ public static final StringId DLockGrantor_GRANTOR_DESTROYANDREMOVE_RESULTED_IN_UNCAUGHT_THROWABLE = new StringId(1365, "Grantor destroyAndRemove resulted in uncaught Throwable");
+ public static final StringId DLockGrantor_GRANTOR_FORWARDTONEWGRANTOR_RESULTED_IN_UNCAUGHT_THROWABLE = new StringId(1366, "Grantor forwardToNewGrantor resulted in uncaught Throwable");
+ public static final StringId DLockGrantor_PROCESSING_OF_POSTREMOTERELEASELOCK_THREW_UNEXPECTED_RUNTIMEEXCEPTION = new StringId(1367, "Processing of postRemoteReleaseLock threw unexpected RuntimeException");
+ public static final StringId DLockGrantor_PROCESSING_OF__0__THREW_UNEXPECTED_THROWABLE = new StringId(1368, "Processing of {0} threw unexpected Throwable");
+ public static final StringId DLockGrantor_RELEASED_REGULAR_LOCK_WITH_WAITING_READ_LOCK_0 = new StringId(1369, "Released regular lock with waiting read lock: {0}");
+ public static final StringId DLockGrantor_UNABLE_TO_RESPOND_TO__0 = new StringId(1370, "Unable to respond to {0}");
+ public static final StringId DLockRecoverGrantorProcessor_DLOCKRECOVERGRANTORMESSAGEPROCESS_THROWABLE = new StringId(1371, "[DLockRecoverGrantorMessage.process] throwable:");
+ public static final StringId DLockRecoverGrantorProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1372, "More than one exception thrown in {0}");
+ public static final StringId DLockRequestProcessor_DLOCKREQUESTMESSAGEPROCESS_CAUGHT_THROWABLE = new StringId(1373, "[DLockRequestMessage.process] Caught throwable:");
+ public static final StringId DLockRequestProcessor_FAILED_TO_FIND_PROCESSOR_FOR__0 = new StringId(1374, "Failed to find processor for {0}");
+ public static final StringId DLockRequestProcessor_HANDLED_LOCAL_ORPHANED_GRANT = new StringId(1375, "Handled local orphaned grant.");
+ public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITHOUT_RELEASE = new StringId(1376, "Handled orphaned grant without release.");
+ public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITH_RELEASE = new StringId(1377, "Handled orphaned grant with release.");
+ public static final StringId DLockRequestProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1378, "More than one exception thrown in {0}");
+ public static final StringId DLockRequestProcessor_NO_PROCESSOR_FOUND_FOR_DLOCKRESPONSEMESSAGE__0 = new StringId(1379, "No processor found for DLockResponseMessage: {0}");
+ public static final StringId DLockRequestProcessor_RELEASING_LOCAL_ORPHANED_GRANT_FOR_0 = new StringId(1380, "Releasing local orphaned grant for {0}.");
+ public static final StringId DLockRequestProcessor_RELEASING_ORPHANED_GRANT_FOR__0 = new StringId(1381, "Releasing orphaned grant for {0}");
+ public static final StringId DLockRequestProcessor_WAITING_TO_PROCESS_DLOCKRESPONSEMESSAGE = new StringId(1382, "Waiting to process DLockResponseMessage");
+ public static final StringId DLockService_DEBUG_GRANTOR_REPORTS_NOT_HOLDER_FOR_0 = new StringId(1383, "DEBUG: Grantor reports NOT_HOLDER for {0}");
+ public static final StringId DLockService_DEBUG_LOCKINTERRUPTIBLY_HAS_GONE_HOT_AND_LOOPED_0_TIMES = new StringId(1384, "DEBUG: lockInterruptibly has gone hot and looped [0] times");
+ public static final StringId DLockService_DESTROYANDREMOVE_OF_0_MAY_HAVE_FAILED = new StringId(1385, "destroyAndRemove of {0} may have failed.");
+ public static final StringId DLockService_FAILED_TO_NOTIFY_GRANTOR_OF_DESTRUCTION_WITHIN_0_ATTEMPTS = new StringId(1386, "Failed to notify grantor of destruction within {0} attempts.");
+ public static final StringId DLockService_GRANTOR_CREATION_WAS_ABORTED_BUT_GRANTOR_WAS_NOT_DESTROYED = new StringId(1387, "Grantor creation was aborted but grantor was not destroyed");
+ public static final StringId DLockService_GRANTOR_IS_STILL_INITIALIZING = new StringId(1388, "Grantor is still initializing");
+ public static final StringId DLockService_GRANTOR_REPORTS_REENTRANT_LOCK_NOT_HELD_0 = new StringId(1389, "Grantor reports reentrant lock not held: {0}");
+ public static final StringId DLockService_LOCK_WAS_INTERRUPTED = new StringId(1390, "lock() was interrupted");
+ public static final StringId DLockToken_ATTEMPTED_CLIENTSIDE_GRANTING_WITH_0_ON_1_FOR_2_IN_3 = new StringId(1391, "Attempted client-side granting with {0} on {1} for {2} in {3}.");
+ public static final StringId DLockToken_ATTEMPTING_TO_USE_DESTROYED_TOKEN_0 = new StringId(1392, "Attempting to use destroyed token: {0}");
+ public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR = new StringId(1393, "Class {0} does not have a zero-argument constructor.");
+ public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR_IT_IS_AN_INNER_CLASS_OF_1_SHOULD_IT_BE_A_STATIC_INNER_CLASS = new StringId(1394, "Class {0} does not have a zero-argument constructor. It is an inner class of {1}. Should it be a static inner class?");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCEMANAGED_CONNECTION_FACTORY_CLASS_IS_NOT_AVAILABLE = new StringId(1395, "DataSourceFactory::getManagedDataSource:Managed Connection factory class is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCE_EXCEPTION_IN_CREATING_MANAGED_CONNECTION_FACTORY_EXCEPTION_STRING_0 = new StringId(1396, "DataSourceFactory::getManagedDataSource: Exception in creating managed connection factory. Exception string = {0}");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETPOOLEDDATASOURCECONNECTIONPOOLDATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1397, "DataSourceFactory::getPooledDataSource:ConnectionPoolDataSource class name for the ResourceManager is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEJDBC_DRIVER_IS_NOT_AVAILABLE = new StringId(1398, "DataSourceFactory::getSimpleDataSource:JDBC Driver is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEURL_STRING_TO_DATABASE_IS_NULL = new StringId(1399, "DataSourceFactory::getSimpleDataSource:URL String to Database is null");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETTRANXDATASOURCEXADATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1400, "DataSourceFactory::getTranxDataSource:XADataSource class name for the ResourceManager is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETPOOLEDDATASOURCE_EXCEPTION_CREATING_CONNECTIONPOOLDATASOURCE_EXCEPTION_STRING_0 = new StringId(1401, "DataSourceFactory::getPooledDataSource:Exception creating ConnectionPoolDataSource.Exception string={0}");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETSIMPLEDATASOURCE_EXCEPTION_WHILE_CREATING_GEMFIREBASICDATASOURCE_EXCEPTION_STRING_0 = new StringId(1402, "DataSourceFactory::getSimpleDataSource:Exception while creating GemfireBasicDataSource.Exception String={0}");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETTRANXDATASOURCE_EXCEPTION_IN_CREATING_GEMFIRETRANSACTIONDATASOURCE__EXCEPTION_STRING_0 = new StringId(1403, "DataSourceFactory::getTranxDataSource:Exception in creating GemFireTransactionDataSource. Exception string={0}");
+ public static final StringId DebugLogWriter_STARTED_USING_CLASS_LOGGER_FOR__0 = new StringId(1404, "Started using class logger for {0}");
+ public static final StringId DebuggerSupport_DEBUGGER_CONTINUING = new StringId(1405, "DEBUGGER: Continuing");
+ public static final StringId DebuggerSupport_WAITING_FOR_DEBUGGER_TO_ATTACH_0 = new StringId(1406, "DEBUGGER: Waiting for Java debugger to attach... {0}");
+ public static final StringId DefaultQueryService_ENDING_LIST_CONTENTS_ = new StringId(1407, "ending list contents :");
+ public static final StringId DefaultQueryService_EXCEPTION_REMOVING_INDEX___0 = new StringId(1408, "Exception removing index : {0}");
+ public static final StringId DefaultQueryService_EXCEPTION_WHILE_CREATING_INDEX_ON_PR_DEFAULT_QUERY_PROCESSOR = new StringId(1409, "Exception while creating index on pr default query processor.");
+ public static final StringId DefaultQueryService_LIST_ELEMENT___0___AND_ITS_NAME___1 = new StringId(1410, "List element : {0} and its name : {1}");
+ public static final StringId DefaultQueryService_PRINTING_LIST_CONTENTS_ = new StringId(1411, "printing list contents :");
+ public static final StringId Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3 = new StringId(1412, "{0}: Unknown message type ({1}) with tx: {2} from {3}");
+ public static final StringId DestroEntryMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_ENTRY_0_1_FROM_CONSOLE_AT_2 = new StringId(1413, "Failed attempt to destroy or invalidate entry {0} {1} from console at {2}");
+ public static final StringId DestroRegionMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_REGION_0_FROM_CONSOLE_AT_1 = new StringId(1414, "Failed attempt to destroy or invalidate region {0} from console at {1}");
+ public static final StringId DestroyRegionOperation_CACHEWRITER_SHOULD_NOT_HAVE_BEEN_CALLED = new StringId(1415, "CacheWriter should not have been called");
+ public static final StringId DestroyRegionOperation_DISTRIBUTEDLOCK_SHOULD_NOT_HAVE_BEEN_ACQUIRED = new StringId(1416, "DistributedLock should not have been acquired");
+ public static final StringId DestroyRegionOperation_EXCEPTION_WHILE_PROCESSING__0_ = new StringId(1417, "Exception while processing [ {0} ]");
+ public static final StringId DestroyRegionOperation_GOT_TIMEOUT_WHEN_TRYING_TO_RECREATE_REGION_DURING_REINITIALIZATION_1 = new StringId(1418, "Got timeout when trying to recreate region during re-initialization: {1}");
+ public static final StringId DestroyRegionOperation_REGION_DESTRUCTION_MESSAGE_IMPLEMENTATION_IS_IN_BASICPROCESS__NOT_THIS_METHOD = new StringId(1419, "Region Destruction message implementation is in basicProcess, not this method");
+ public static final StringId DestroyRegion_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL = new StringId(1420, "{0}: The input region name for the destroy region request is null");
+ public static final StringId Destroy_0_DURING_ENTRY_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1 = new StringId(1421, "{0}: during entry destroy no entry was found for key {1}");
+ public static final StringId Destroy_0_THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1422, "{0}: The input key for the destroy request is null");
+ public static final StringId Destroy_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1423, "{0}: The input region name for the destroy request is null");
+ public static final StringId Destroy_0_UNEXPECTED_EXCEPTION = new StringId(1424, "{0}: Unexpected Exception");
+ public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_JROCKIT_NIO_BUG = new StringId(1425, "Ignoring max-threads setting and using zero instead due to JRockit NIO bugs. See GemFire bug #40198");
+ public static final StringId AbstractDistributionConfig_BIND_ADDRESS_0_INVALID_MUST_BE_IN_1 = new StringId(1426, "The bind-address \"{0}\" is not a valid address for this machine. These are the valid addresses for this machine: {1}");
+ public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_WINDOWS_IPV6_BUG = new StringId(1427, "Ignoring max-threads setting and using zero instead due to Java bug 6230761: NIO does not work with IPv6 on Windows. See GemFire bug #40472");
+ public static final StringId ExecuteFunction_AFTER_RE_EXEUCTION_NUM_OF_NODES_NOT_MATCHING = new StringId(1428, "After re-execution no of nodes do not match");
+ public static final StringId AbstractRegionEntry_0_UNABLE_TO_NOTIFY_WAITING_EVENTS_AFTER_PROCESSING_1 = new StringId(1429, "{0}: Unable to notify waiting events after processing. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6699669 and GemFire bug #39130 {1}");
+ public static final StringId DirectChannel_0_SECONDS_HAVE_ELAPSED_WHILE_WAITING_FOR_REPLY_FROM_1_ON_2_WHOSE_CURRENT_MEMBERSHIP_LIST_IS_3 = new StringId(1430, "{0} seconds have elapsed while waiting for reply from {1} on {2} whose current membership list is: [{3}]");
+ public static final StringId DirectChannel_FINISHED_WAITING_FOR_REPLY_FROM_0_ON_1 = new StringId(1431, "Finished waiting for reply from {0} on {1}.");
+ public static final StringId DirectChannel_GEMFIRE_P2P_LISTENER_STARTED_ON__0 = new StringId(1432, "GemFire P2P Listener started on {0}");
+ public static final StringId DirectChannel_INTERRUPTED_OBTAINING_PERMISSION_TO_SEND_TO_MULTIPLE_PEERS = new StringId(1433, "Interrupted obtaining permission to send to multiple peers");
+ public static final StringId DirectChannel_UNABLE_TO_INITIALIZE_DIRECT_CHANNEL_BECAUSE__0 = new StringId(1434, "Unable to initialize direct channel because: {0}");
+ public static final StringId DirectChannel_UNEXPECTED_TIMEOUT_WHILE_WAITING_FOR_ACK_FROM__0 = new StringId(1435, "Unexpected timeout while waiting for ack from {0}");
+ public static final StringId DirectChannel_VIEW_NO_LONGER_HAS_0_AS_AN_ACTIVE_MEMBER_SO_WE_WILL_NO_LONGER_WAIT_FOR_IT = new StringId(1436, "View no longer has {0} as an active member, so we will no longer wait for it.");
+ public static final StringId DirectChannel_WHILE_PULLING_A_MESSAGE = new StringId(1437, "While pulling a message");
+ public static final StringId TXState_CANNOT_COMMIT_REMOTED_TRANSACTION = new StringId(1438, "Cannot commit a transaction being run on behalf of a remote thread");
+ public static final StringId CreateRegionProcessor_ERROR_TRANSFERRING_EVENT_STATE = new StringId(1439, "Encountered an error in transferring event state during region creation for {0}");
+ public static final StringId DiskRegion_DISKREGIONGETBYTESANDBITSWITHOUTLOCKOPLOG_WITH_ID__0__COULD_NOT_BE_OBTAINED_A_CLEAR_OPERATION_MAY_HAVE_DELETED_THE_OPLOG_CURRENT_OPLOGID_1 = new StringId(1440, "DiskRegion::getBytesAndBitsWithoutLock:Oplog with ID = {0} could not be obtained. A clear operation may have deleted the Oplog. Current OplogID= {1}");
+ public static final StringId DistributedCacheOperation_EXCEPTION_OCCURRED_WHILE_PROCESSING__0 = new StringId(1441, "Exception occurred while processing {0}");
+ // ok to reuse 1442
+ public static final StringId DistributedCacheOperation_WAITFORACKIFNEEDED_EXCEPTION = new StringId(1443, "waitForAckIfNeeded: exception");
+ public static final StringId DistributedRegion_ATTEMPT_TO_ACQUIRE_DISTRIBUTED_LOCK_FOR_0_FAILED_AFTER_WAITING_1_SECONDS = new StringId(1444, "Attempt to acquire distributed lock for {0} failed after waiting {1} seconds.");
+ public static final StringId DistributedRegion_DLS_DESTROY_MAY_HAVE_FAILED_FOR_0 = new StringId(1445, "DLS destroy may have failed for {0}");
+ public static final StringId DistributedRegion_EXCEPTION_OCCURRED_IN_REGIONMEMBERSHIPLISTENER = new StringId(1446, "Exception occurred in RegionMembershipListener");
+ public static final StringId DistributedRegion_NO_REPLICATED_REGION_FOUND_FOR_EXECUTING_FUNCTION_0 = new StringId(1447, "No Replicated Region found for executing function : {0}.");
+ public static final StringId DistributedRegion_TIMED_OUT_AFTER_WAITING_0_SECONDS_FOR_THE_DISTRIBUTED_LOCK_FOR_1 = new StringId(1448, "Timed out after waiting {0} seconds for the distributed lock for {1}.");
+ public static final StringId DistributedRegion_UNEXPECTED_EXCEPTION = new StringId(1449, "Unexpected exception:");
+ public static final StringId DistributedSystemConfigImpl_COULD_NOT_OPEN_LOG_FILE_0 = new StringId(1450, "Could not open log file \"{0}\"");
+ public static final StringId DistributedSystemConfigImpl_COULD_NOT_RENAME_0_TO_1 = new StringId(1451, "Could not rename \"{0}\" to \"{1}\".");
+ public static final StringId DistributedSystemConfigImpl_LOG_FILE_0_IS_NOT_A_FILE = new StringId(1452, "Log file \"{0}\" is not a file");
+ public static final StringId DistributedSystemConfigImpl_RENAMED_OLD_LOG_FILE_TO_0 = new StringId(1453, "Renamed old log file to \"{0}\".");
+ public static final StringId DistributedSystemConfigImpl_STARTUP_CONFIGURATIONN_0 = new StringId(1454, "Startup Configuration:\n {0}");
+ public static final StringId HARegionQueue_QUEUEREMOVALTHREAD_IS_EXITING_WITH_DUE_TO_A_VRITUALMACHINEERROR = new StringId(1455, "QueueRemovalThread is exiting with due to a VritualMachineError.");
+ public static final StringId DistributionAdvisor_UNEXPECTED_EXCEPTION = new StringId(1456, "Unexpected exception:");
+ public static final StringId DistributionChannel_ATTEMPTING_A_SEND_TO_A_DISCONNECTED_DISTRIBUTIONMANAGER = new StringId(1457, "Attempting a send to a disconnected DistributionManager");
+ public static final StringId DistributionLocatorImpl_DONE_WAITING_FOR_LOCATOR = new StringId(1458, "Done waiting for locator");
+ public static final StringId DistributionLocator_COULD_NOT_BIND_LOCATOR_TO__0__1 = new StringId(1459, "Could not bind locator to {0}[{1}]");
+ public static final StringId DistributionLocator_COULD_NOT_START_LOCATOR = new StringId(1460, "Could not start locator");
+ public static final StringId DistributionLocator_LOCATOR_STOPPED = new StringId(1461, "Locator stopped");
+ public static final StringId DistributionManager_0_IS_THE_ELDER_AND_THE_ONLY_MEMBER = new StringId(1462, "{0} is the elder and the only member.");
+ public static final StringId DistributionManager_0_IS_THE_ELDER_IN_A_GROUP_OF_1_MEMBERS = new StringId(1463, "{0} is the elder in a group of {1} members.");
+ public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CLOSED_1 = new StringId(1464, "Administration member at {0} closed: {1}");
+ public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CRASHED_1 = new StringId(1465, "Administration member at {0} crashed: {1}");
+ public static final StringId DistributionManager_ADMITTING_MEMBER_0_NOW_THERE_ARE_1_NONADMIN_MEMBERS = new StringId(1466, "Admitting member <{0}>. Now there are {1} non-admin member(s).");
+ public static final StringId DistributionManager_AT_LEAST_ONE_EXCEPTION_OCCURRED = new StringId(1467, "At least one Exception occurred.");
+ public static final StringId DistributionManager_CHANGING_ELDER_FROM_0_TO_1 = new StringId(1468, "Changing Elder from {0} to {1}.");
+ public static final StringId DistributionManager_CLOBBERTHREAD_THREAD_REFUSED_TO_DIE__0 = new StringId(1469, "clobberThread: Thread refused to die: {0}");
+ public static final StringId DistributionManager_DAEMON_THREADS_ARE_SLOW_TO_STOP_CULPRITS_INCLUDE_0 = new StringId(1470, "Daemon threads are slow to stop; culprits include: {0}");
+ public static final StringId DistributionManager_DIDNT_HEAR_BACK_FROM_ANY_OTHER_SYSTEM_I_AM_THE_FIRST_ONE = new StringId(1471, "Did not hear back from any other system. I am the first one.");
+ public static final StringId DistributionManager_DISTRIBUTIONMANAGER_0_STARTED_ON_1_THERE_WERE_2_OTHER_DMS_3_4_5 = new StringId(1472, "DistributionManager {0} started on {1}. There were {2} other DMs. others: {3} {4} {5}");
+ public static final StringId DistributionManager_DISTRIBUTIONMANAGER_STOPPED_IN_0_MS = new StringId(1473, "DistributionManager stopped in {0}ms.");
+ public static final StringId DistributionManager_DMMEMBERSHIP_ADMITTING_NEW_ADMINISTRATION_MEMBER__0_ = new StringId(1474, "DMMembership: Admitting new administration member < {0} >.");
+ public static final StringId DistributionManager_DMMEMBERSHIP_SERVICE_FAILURE__0 = new StringId(1475, "DMMembership: service failure: {0}");
+ public static final StringId DistributionManager_ELDER__0__IS_NOT_CURRENTLY_AN_ACTIVE_MEMBER_SELECTING_NEW_ELDER = new StringId(1476, "Elder < {0} > is not currently an active member; selecting new elder.");
+ public static final StringId DistributionManager_EXCEPTION_WHILE_CALLING_MEMBERSHIP_LISTENER_FOR_EVENT__0 = new StringId(1477, "Exception while calling membership listener for event: {0}");
+ public static final StringId DistributionManager_FAILED_SENDING_SHUTDOWN_MESSAGE_TO_PEERS_TIMEOUT = new StringId(1478, "Failed sending shutdown message to peers (timeout)");
+ public static final StringId DistributionManager_FORCING_AN_ELDER_JOIN_EVENT_SINCE_A_STARTUP_RESPONSE_WAS_NOT_RECEIVED_FROM_ELDER__0_ = new StringId(1479, "Forcing an elder join event since a startup response was not received from elder {0} .");
+ public static final StringId DistributionManager_FORCING_THREAD_STOP_ON__0_ = new StringId(1480, "Forcing thread stop on < {0} >");
+ public static final StringId DistributionManager_IGNORED_INTERRUPT_DURING_ELDERCHANGEWAIT = new StringId(1481, "Ignored interrupt during elderChangeWait");
+ public static final StringId DistributionManager_INITIAL_MEMBERSHIPMANAGER_VIEW___0 = new StringId(1482, "Initial (distribution manager) view = {0}");
+ public static final StringId DistributionManager_MARKING_DISTRIBUTIONMANAGER_0_AS_CLOSED = new StringId(1483, "Marking DistributionManager {0} as closed.");
+ public static final StringId DistributionManager_MARKING_THE_SERIALQUEUEDEXECUTOR_WITH_ID__0__USED_BY_THE_MEMBER__1__TO_BE_UNUSED = new StringId(1484, "Marking the SerialQueuedExecutor with id : {0} used by the member {1} to be unused.");
+ public static final StringId DistributionManager_MEMBER_AT_0_GRACEFULLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1485, "Member at {0} gracefully left the distributed cache: {1}");
+ public static final StringId DistributionManager_MEMBER_AT_0_UNEXPECTEDLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1486, "Member at {0} unexpectedly left the distributed cache: {1}");
+ public static final StringId DistributionManager_NEWLY_SELECTED_ELDER_IS_NOW__0_ = new StringId(1487, "Newly selected elder is now < {0} >");
+ public static final StringId DistributionManager_NEW_ADMINISTRATION_MEMBER_DETECTED_AT_0 = new StringId(1488, "New administration member detected at {0}.");
+ public static final StringId DistributionManager_NOW_CLOSING_DISTRIBUTION_FOR__0 = new StringId(1489, "Now closing distribution for {0}");
+ public static final StringId DistributionManager_SHUTTING_DOWN_DISTRIBUTIONMANAGER_0_1 = new StringId(1490, "Shutting down DistributionManager {0}. {1}");
+ public static final StringId DistributionManager_STARTING_DISTRIBUTIONMANAGER_0_1 = new StringId(1491, "Starting DistributionManager {0}. {1}");
+ public static final StringId DistributionManager_STILL_AWAITING_0_RESPONSES_FROM_1 = new StringId(1492, "Still awaiting {0} response(s) from: {1}.");
+ public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_PEER_DEPARTED_THE_VIEW = new StringId(1493, "Stopped waiting for startup reply from <{0}> because the peer departed the view.");
+ public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_REPLY_WAS_FINALLY_RECEIVED = new StringId(1494, "Stopped waiting for startup reply from <{0}> because the reply was finally received.");
+ public static final StringId DistributionManager_TASK_FAILED_WITH_EXCEPTION = new StringId(1495, "Task failed with exception");
+ public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_CALLING_READYFORMESSAGES = new StringId(1496, "Uncaught exception calling readyForMessages");
+ public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_PROCESSING_MEMBER_EVENT = new StringId(1497, "Uncaught exception processing member event");
+ public static final StringId DistributionManager_UNEXPECTED_INTERRUPTEDEXCEPTION = new StringId(1498, "Unexpected InterruptedException");
+ public static final StringId DistributionManager_UNEXPECTED_THREADINTERRUPTEDEXCEPTION = new StringId(1499, "Unexpected ThreadInterruptedException");
+ public static final StringId DistributionManager_WHILE_PUSHING_MESSAGE_0_TO_1 = new StringId(1500, "While pushing message <{0}> to {1}");
+ public static final StringId DistributionManager_WHILE_SENDING_SHUTDOWN_MESSAGE = new StringId(1501, "While sending shutdown message");
+ public static final StringId DistributionMessage_0__SCHEDULE_REJECTED = new StringId(1502, "{0} schedule() rejected");
+ public static final StringId DistributionMessage_UNCAUGHT_EXCEPTION_PROCESSING__0 = new StringId(1503, "Uncaught exception processing {0}");
+ public static final StringId DistributionMessage_UNEXPECTED_THREADINTERRUPTEDEXCEPTION_PROCESSING__0 = new StringId(1504, "Unexpected ThreadInterruptedException processing {0}");
+ // ok to reuse 1505
+ public static final StringId DumpB2NRegion_PARTITIONEDREGION_WITH_ID_0_IS_DESTROYED = new StringId(1506, "PartitionedRegion with id {0} is destroyed");
+ public static final StringId DumpB2NRegion_PARTITIONEDREGION_WITH_ID_0_IS_LOCALLY_DESTROYED = new StringId(1507, "PartitionedRegion with id {0} is locally destroyed");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONCREATED = new StringId(1508, "DynamicRegionListener {0} threw exception on afterRegionCreated");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONDESTROYED = new StringId(1509, "DynamicRegionListener {0} threw exception on afterRegionDestroyed");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONCREATED = new StringId(1510, "DynamicRegionListener {0} threw exception on beforeRegionCreated");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONDESTROYED = new StringId(1511, "DynamicRegionListener {0} threw exception on beforeRegionDestroyed");
+ public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_CREATE_DYNAMIC_REGION__0 = new StringId(1512, "Error attempting to locally create Dynamic Region: {0}");
+ public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_DESTROY_DYNAMIC_REGION__0 = new StringId(1513, "Error attempting to locally destroy Dynamic Region: {0}");
+ public static final StringId DynamicRegionFactory_ERROR_DESTROYING_DYNAMIC_REGION__0 = new StringId(1514, "Error destroying Dynamic Region ''{0}''");
+ public static final StringId DynamicRegionFactory_ERROR_INITIALIZING_DYNAMICREGIONFACTORY = new StringId(1515, "Error initializing DynamicRegionFactory");
+ public static final StringId DynamicRegionFactory_ERROR__COULD_NOT_FIND_A_REGION_NAMED___0_ = new StringId(1516, "Error -- Could not find a region named: ''{0}''");
+ public static final StringId ElderState_ELDERSTATE_PROBLEM_DM_0_BUT_SYSTEM_DISTRIBUTIONMANAGER_1 = new StringId(1517, "ElderState problem: dm={0}, but system DistributionManager={1}");
+ public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_0 = new StringId(1518, "ElderState problem: system={0}");
+ public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_DISTRIBUTIONMANAGER_0 = new StringId(1519, "ElderState problem: system DistributionManager={0}");
+ public static final StringId EndPointImpl_0_1_FAILED_INTEREST_LIST_RECOVERY_BECAUSE_2 = new StringId(1520, "{0}: {1} failed interest list recovery because: {2}");
+ public static final StringId EndPointImpl_0_1_FINISHED_INTEREST_LIST_RECOVERY = new StringId(1521, "{0}: {1} finished interest list recovery.");
+ public static final StringId EndPointImpl_0_1_STARTING_INTEREST_LIST_RECOVERY = new StringId(1522, "{0}: {1} starting interest list recovery.");
+ public static final StringId EndPointImpl_0_CANNOT_CREATE_REGION_1_BECAUSE_THE_SERVER_IS_NOT_AVAILABLE = new StringId(1523, "{0}: Cannot create region {1} because the server is not available.");
+ public static final StringId EndPointImpl_0_CANNOT_MAKE_PRIMARY_BECAUSE_THE_SERVER_IS_NOT_AVAILABLE = new StringId(1524, "{0}: Cannot make primary because the server is not available.");
+ public static final StringId EndPointImpl_0_CANNOT_SEND_MESSAGE_BECAUSE_PRIMARY_SERVER_IS_NOT_AVAILABLE = new StringId(1525, "{0}: Cannot send message because primary server is not available.");
+ public static final StringId EndPointImpl_0_UNEXPECTED_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_UPDATE_1 = new StringId(1526, "{0}: Unexpected Exception occurred while attempting to update {1}");
+ public static final StringId EndPointImpl_CONNECTIONPROXYIMPL_0_FINISHED_INSTANTIATORS_RECOVERY = new StringId(1527, "ConnectionProxyImpl ({0}) finished instantiators recovery.");
+ public static final StringId EndPointImpl_CONNECTIONPROXYIMPL_0_STARTING_INSTANTIATORS_RECOVERY = new StringId(1528, "ConnectionProxyImpl ({0}) starting instantiators recovery.");
+ public static final StringId EndPointImpl_UNABLE_TO_CONNECT_TO_0_AFTER_CREATING_1_CONNECTIONS = new StringId(1529, "Unable to connect to {0} after creating {1} connections");
+ public static final StringId EndPointImpl_UNABLE_TO_MAKE_0_AS_PRIMARY_DUE_TO_EXCEPTION_1 = new StringId(1530, "Unable to make {0} as primary due to exception: {1}");
+ publ
<TRUNCATED>
[27/37] incubator-geode git commit: Revert "GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
Posted by kl...@apache.org.
Revert "GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
This reverts commit 3d73bf5ca7e9e1d682710706d2dd3a51c2c59c4d.
After discussion with Bruce, reverting these changes to fix the build
for now.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a35cca36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a35cca36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a35cca36
Branch: refs/heads/feature/GEODE-1276
Commit: a35cca368ebbe0bfaf313b9604b32195f8736777
Parents: 3d73bf5
Author: Dan Smith <up...@apache.org>
Authored: Thu May 5 16:38:03 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 5 16:38:27 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 6 +-
.../membership/InternalDistributedMember.java | 40 -
.../internal/membership/gms/GMSMember.java | 16 -
.../internal/cache/PartitionedRegion.java | 6 +-
.../gemfire/internal/i18n/LocalizedStrings.java | 2456 +++---------------
.../internal/i18n/ParentLocalizedStrings.java | 2399 +++++++++++++++++
.../gemfire/distributed/LocatorDUnitTest.java | 34 -
.../internal/i18n/BasicI18nJUnitTest.java | 4 +-
.../codeAnalysis/sanctionedSerializables.txt | 2 +-
9 files changed, 2820 insertions(+), 2143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
old mode 100755
new mode 100644
index c5a4a7a..a077779
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
@@ -29,7 +29,7 @@ public class EmptyRegionFunctionException extends FunctionException {
private static final long serialVersionUID = 1L;
/**
- * Construct an instance of EmptyRegionFunctionException
+ * Construct an instance of EmtpyRegionFunctionException
*
* @param cause
* a Throwable cause of this exception
@@ -39,7 +39,7 @@ public class EmptyRegionFunctionException extends FunctionException {
}
/**
- * Construct an instance of EmptyRegionFunctionException
+ * Construct an instance of EmtpyRegionFunctionException
*
* @param msg
* Exception message
@@ -49,7 +49,7 @@ public class EmptyRegionFunctionException extends FunctionException {
}
/**
- * Construct an instance of EmptyRegionFunctionException
+ * Construct an instance of EmtpyRegionFunctionException
*
* @param msg
* the error message
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
index 2ccbd89..f7572af 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
@@ -863,19 +863,9 @@ public class InternalDistributedMember
DataSerializer.writeString(this.hostName, out);
int flags = 0;
-<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
if (this.isPartial) flags |= PARTIAL_ID_BIT;
-||||||| merged common ancestors
- if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- if (this.isPartial) flags |= PARTIAL_ID_MASK;
-=======
- if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- if (this.isPartial) flags |= PARTIAL_ID_MASK;
->>>>>>> Stashed changes
// always write product version but enable reading from older versions
// that do not have it
flags |= VERSION_BIT;
@@ -965,19 +955,9 @@ public class InternalDistributedMember
DataSerializer.writeString(this.hostName, out);
int flags = 0;
-<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
if (this.isPartial) flags |= PARTIAL_ID_BIT;
-||||||| merged common ancestors
- if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- if (this.isPartial) flags |= PARTIAL_ID_MASK;
-=======
- if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- if (this.isPartial) flags |= PARTIAL_ID_MASK;
->>>>>>> Stashed changes
// always write product version but enable reading from older versions
// that do not have it
flags |= VERSION_BIT;
@@ -1017,19 +997,9 @@ public class InternalDistributedMember
DataSerializer.writeString(this.hostName, out);
int flags = 0;
-<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
if (this.isPartial) flags |= PARTIAL_ID_BIT;
-||||||| merged common ancestors
- if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- if (this.isPartial) flags |= PARTIAL_ID_MASK;
-=======
- if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- if (this.isPartial) flags |= PARTIAL_ID_MASK;
->>>>>>> Stashed changes
out.writeByte((byte)(flags & 0xff));
out.writeInt(dcPort);
@@ -1200,19 +1170,9 @@ public class InternalDistributedMember
out.writeInt(getPort());
int flags = 0;
-<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
flags |= PARTIAL_ID_BIT;
-||||||| merged common ancestors
- if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- flags |= PARTIAL_ID_MASK;
-=======
- if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
- if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
- flags |= PARTIAL_ID_MASK;
->>>>>>> Stashed changes
out.writeByte((byte)(flags & 0xff));
// out.writeInt(dcPort);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
index 8af5e0d..6089eb8 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
@@ -399,16 +399,8 @@ public class GMSMember implements NetMember, DataSerializableFixedID {
Version.writeOrdinal(out, this.versionOrdinal, true);
int flags = 0;
-<<<<<<< Updated upstream
if (networkPartitionDetectionEnabled) flags |= NPD_ENABLED_BIT;
if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD_BIT;
-||||||| merged common ancestors
- if (splitBrainEnabled) flags |= SB_ENABLED;
- if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD;
-=======
- if (networkPartitionDetectionEnabled) flags |= SB_ENABLED;
- if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD;
->>>>>>> Stashed changes
out.writeShort(flags);
DataSerializer.writeInetAddress(inetAddr, out);
@@ -429,16 +421,8 @@ public class GMSMember implements NetMember, DataSerializableFixedID {
this.versionOrdinal = Version.readOrdinal(in);
int flags = in.readShort();
-<<<<<<< Updated upstream
this.networkPartitionDetectionEnabled = (flags & NPD_ENABLED_BIT) != 0;
this.preferredForCoordinator = (flags & PREFERRED_FOR_COORD_BIT) != 0;
-||||||| merged common ancestors
- this.splitBrainEnabled = (flags & SB_ENABLED) != 0;
- this.preferredForCoordinator = (flags & PREFERRED_FOR_COORD) != 0;
-=======
- this.networkPartitionDetectionEnabled = (flags & SB_ENABLED) != 0;
- this.preferredForCoordinator = (flags & PREFERRED_FOR_COORD) != 0;
->>>>>>> Stashed changes
this.inetAddr = DataSerializer.readInetAddress(in);
this.udpPort = in.readInt();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
index 4460a8a..328c196 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
@@ -92,7 +92,7 @@ import com.gemstone.gemfire.cache.TransactionDataNotColocatedException;
import com.gemstone.gemfire.cache.TransactionDataRebalancedException;
import com.gemstone.gemfire.cache.TransactionException;
import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import com.gemstone.gemfire.cache.execute.EmptyRegionFunctionException;
+import com.gemstone.gemfire.cache.execute.EmtpyRegionFunctionException;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.execute.FunctionContext;
import com.gemstone.gemfire.cache.execute.FunctionException;
@@ -3879,7 +3879,7 @@ public class PartitionedRegion extends LocalRegion implements
logger.debug("Executing on bucketset : {} executeOnBucketSet Member to buckets map is : {} bucketSet is empty",
bucketSet, memberToBuckets);
}
- throw new EmptyRegionFunctionException(
+ throw new EmtpyRegionFunctionException(
LocalizedStrings.PartitionedRegion_FUNCTION_NOT_EXECUTED_AS_REGION_IS_EMPTY
.toLocalizedString());
}
@@ -4023,7 +4023,7 @@ public class PartitionedRegion extends LocalRegion implements
.groupByMemberToBuckets(this, bucketSet, function.optimizeForWrite());
if (memberToBuckets.isEmpty()) {
- throw new EmptyRegionFunctionException(LocalizedStrings.PartitionedRegion_FUNCTION_NOT_EXECUTED_AS_REGION_IS_EMPTY.toLocalizedString()
+ throw new EmtpyRegionFunctionException(LocalizedStrings.PartitionedRegion_FUNCTION_NOT_EXECUTED_AS_REGION_IS_EMPTY.toLocalizedString()
);
}
[07/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
new file mode 100644
index 0000000..2e0897d
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli.commands;
+
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.util.test.TestUtil.*;
+
+import java.io.File;
+import java.util.Properties;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+/**
+ * @since 8.1
+ */
+@Category({ DistributedTest.class, SecurityTest.class })
+public class ConnectCommandWithHttpAndSSLDUnitTest extends CliCommandTestBase {
+
+ private static final ThreadLocal<Properties> sslInfoHolder = new ThreadLocal<>();
+
+ private File jks;
+
+ // TODO: should this test use @RunWith(Parameterized.class)?
+
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ this.jks = new File(getResourcePath(getClass(), "/ssl/trusted.keystore"));
+ }
+
+ @Override
+ protected final void preTearDownCliCommandTestBase() throws Exception {
+ destroyDefaultSetup();
+ }
+
+ @Override
+ public final void postTearDownCacheTestCase() throws Exception {
+ sslInfoHolder.set(null);
+ }
+
+ @Test
+ public void testMutualAuthentication() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
+ localProps.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__KEY_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__KEY_STORE_PASSWORD, "password");
+ clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "SSL");
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testSimpleSSL() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testSSLWithoutKeyStoreType() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testSSLWithSSLProtocol() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testSSLWithTLSProtocol() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLS");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testSSLWithTLSv11Protocol() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.1");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testSSLWithTLSv12Protocol() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Test
+ public void testWithMultipleProtocol() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL,TLSv1.2");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Ignore("disabled for unknown reason")
+ @Test
+ public void testSSLWithCipherSuite() throws Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+
+ //Its bad to hard code here. But using SocketFactory.getDefaultCiphers() somehow is not working with the option
+ //"https.cipherSuites" which is required to restrict cipher suite with HttpsURLConnection
+ //Keeping the below code for further investigation on different Java versions ( 7 & 8) @TODO
+
+ /*SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
+
+ sslContext.init(null, null, new java.security.SecureRandom());
+ String[] cipherSuites = sslContext.getSocketFactory().getSupportedCipherSuites();*/
+
+ localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS_NAME,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+ clientProps.setProperty(CONNECT__SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
+ clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Ignore("disabled for unknown reason")
+ @Test
+ public void testSSLWithMultipleCipherSuite() throws Exception {
+ System.setProperty("javax.net.debug", "ssl,handshake,failure");
+
+ Properties localProps = new Properties();
+ localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+ localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+ localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS_NAME,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_EMPTY_RENEGOTIATION_INFO_SCSV");
+
+ Properties clientProps = new Properties();
+ clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+ clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+ clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
+
+ sslInfoHolder.set(clientProps);
+ setUpJmxManagerOnVm0ThenConnect(localProps);
+ }
+
+ @Override
+ protected void shellConnect(final String host, final int jmxPort, final int httpPort, final HeadlessGfsh shell) {
+ assertNotNull(host);
+ assertNotNull(shell);
+
+ final CommandStringBuilder command = new CommandStringBuilder(CONNECT);
+ String endpoint;
+
+ // This is for testing purpose only. If we remove this piece of code we will
+ // get a java.security.cert.CertificateException
+ // as matching hostname can not be obtained in all test environment.
+ HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify(String string, SSLSession ssls) {
+ return true;
+ }
+ });
+
+ endpoint = "https://" + host + ":" + httpPort + "/gemfire/v1";
+
+ command.addOption(CONNECT__USE_HTTP, Boolean.TRUE.toString());
+ command.addOption(CONNECT__URL, endpoint);
+ command.addOption(CONNECT__USE_SSL,Boolean.TRUE.toString());
+
+ if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE) != null){
+ command.addOption(CONNECT__KEY_STORE, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE));
+ }
+ if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD) != null){
+ command.addOption(CONNECT__KEY_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD));
+ }
+ if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE) != null){
+ command.addOption(CONNECT__TRUST_STORE, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE));
+ }
+ if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD) != null){
+ command.addOption(CONNECT__TRUST_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD));
+ }
+ if(sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS) != null){
+ command.addOption(CONNECT__SSL_PROTOCOLS, sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS));
+ }
+ if(sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS) != null){
+ command.addOption(CONNECT__SSL_CIPHERS, sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS));
+ }
+
+ CommandResult result = executeCommand(shell, command.toString());
+
+ if (!shell.isConnectedAndReady()) {
+ fail("Connect command failed to connect to manager " + endpoint + " result=" + commandResultToString(result));
+ }
+
+ info("Successfully connected to managing node using HTTPS");
+ assertEquals(true, shell.isConnectedAndReady());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
index 4bc92eb..88e7b30 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
@@ -24,6 +24,8 @@ import java.io.IOException;
import java.util.Properties;
import java.util.regex.Pattern;
+import org.junit.Test;
+
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
@@ -43,27 +45,24 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
/**
* Unit tests for the DeployCommands class
*
* @since 7.0
*/
-@Category(DistributedTest.class)
@SuppressWarnings("serial")
public class DeployCommandsDUnitTest extends CliCommandTestBase {
- File newDeployableJarFile = new File("DeployCommandsDUnit1.jar");
-
- transient private ClassBuilder classBuilder = new ClassBuilder();
- transient private CommandProcessor commandProcessor;
+ private final Pattern pattern = Pattern.compile("^" + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit.*#\\d++$");
+ private File newDeployableJarFile;
+ private transient ClassBuilder classBuilder;
+ private transient CommandProcessor commandProcessor;
@Override
- public final void postSetUp() throws Exception {
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ this.newDeployableJarFile = new File(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "DeployCommandsDUnit1.jar");
+ this.classBuilder = new ClassBuilder();
this.commandProcessor = new CommandProcessor();
assertFalse(this.commandProcessor.isStopped());
@@ -93,7 +92,7 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
}
@Test
- public void testDeploy() throws IOException {
+ public void testDeploy() throws Exception {
final Properties props = new Properties();
final Host host = Host.getHost(0);
final VM vm = host.getVM(0);
@@ -179,7 +178,7 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
}
@Test
- public void testUndeploy() throws IOException {
+ public void testUndeploy() throws Exception {
final Properties props = new Properties();
final Host host = Host.getHost(0);
final VM vm = host.getVM(0);
@@ -256,7 +255,7 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
}
@Test
- public void testListDeployed() throws IOException {
+ public void testListDeployed() throws Exception {
final Properties props = new Properties();
final Host host = Host.getHost(0);
final VM vm = host.getVM(0);
@@ -325,24 +324,27 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
* Does an end-to-end test using the complete CLI framework while ensuring that the shared configuration is updated.
*/
@Test
- public void testEndToEnd() throws IOException {
- final String groupName = "testDeployEndToEndGroup";
+ public void testEndToEnd() throws Exception {
+ final String groupName = getName();
// Start the Locator and wait for shared configuration to be available
final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locatorPort + ".log";
+
Host.getHost(0).getVM(3).invoke(new SerializableRunnable() {
@Override
public void run() {
- final File locatorLogFile = new File("locator-" + locatorPort + ".log");
+ final File locatorLogFile = new File(locatorLogPath);
+
final Properties locatorProps = new Properties();
locatorProps.setProperty(DistributionConfig.NAME_NAME, "Locator");
locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "fine");
locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+
try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locatorPort, locatorLogFile, null,
- locatorProps);
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locatorPort, locatorLogFile, null, locatorProps);
WaitCriterion wc = new WaitCriterion() {
@Override
@@ -356,8 +358,9 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
}
};
Wait.waitForCriterion(wc, 5000, 500, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
+
+ } catch (IOException e) {
+ fail("Unable to create a locator with a shared configuration", e);
}
}
});
@@ -373,7 +376,7 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
this.classBuilder.writeJarFromName("DeployCommandsDUnitA", this.newDeployableJarFile);
// Deploy the JAR
- CommandResult cmdResult = executeCommand("deploy --jar=DeployCommandsDUnit1.jar");
+ CommandResult cmdResult = executeCommand("deploy --jar=" + this.newDeployableJarFile.getCanonicalPath());
assertEquals(Result.Status.OK, cmdResult.getStatus());
String stringResult = commandResultToString(cmdResult);
@@ -393,7 +396,7 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
"Manager.*DeployCommandsDUnit1.jar.*" + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit1.jar#1"));
// Deploy the JAR to a group
- cmdResult = executeCommand("deploy --jar=DeployCommandsDUnit1.jar --group=" + groupName);
+ cmdResult = executeCommand("deploy --jar=" + this.newDeployableJarFile.getCanonicalPath() + " --group=" + groupName);
assertEquals(Result.Status.OK, cmdResult.getStatus());
stringResult = commandResultToString(cmdResult);
@@ -454,12 +457,11 @@ public class DeployCommandsDUnitTest extends CliCommandTestBase {
assertTrue(commandResultToString(cmdResult).contains(CliStrings.LIST_DEPLOYED__NO_JARS_FOUND_MESSAGE));
}
- final Pattern pattern = Pattern.compile("^" + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit.*#\\d++$");
-
- void deleteSavedJarFiles() {
+ private void deleteSavedJarFiles() {
this.newDeployableJarFile.delete();
File dirFile = new File(".");
+
// Find all deployed JAR files
File[] oldJarFiles = dirFile.listFiles(new FilenameFilter() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
index 5674b83..2182301 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
@@ -16,7 +16,9 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import static com.gemstone.gemfire.test.dunit.Wait.*;
@@ -32,7 +34,6 @@ import com.gemstone.gemfire.cache.LoaderHelper;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.management.DistributedRegionMXBean;
import com.gemstone.gemfire.management.ManagementService;
import com.gemstone.gemfire.management.ManagerMXBean;
@@ -43,7 +44,6 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
import com.gemstone.gemfire.management.internal.cli.result.ResultData;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
@@ -56,7 +56,6 @@ import org.junit.experimental.categories.Category;
/**
* The GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest class is test suite of test cases testing the Gfsh
* 'get' data command when a cache miss occurs on data in a Region with a CacheLoader defined.
- * <p>
*
* @see com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase
* @see com.gemstone.gemfire.management.internal.cli.commands.DataCommands
@@ -71,12 +70,63 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
private static final String GEMFIRE_LOG_LEVEL = System.getProperty("logLevel", "config");
private static final String USERS_REGION_NAME = "Users";
- protected static String getRegionPath(final String regionName) {
- return (regionName.startsWith(Region.SEPARATOR) ? regionName : String.format("%1$s%2$s", Region.SEPARATOR,
- regionName));
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ Properties managerDistributedSystemProperties = createDistributedSystemProperties(GEMFIRE_MANAGER_NAME);
+ HeadlessGfsh gfsh = setUpJmxManagerOnVm0ThenConnect(managerDistributedSystemProperties);
+
+ assertNotNull(gfsh);
+ assertTrue(gfsh.isConnectedAndReady());
+
+ setupGemFire();
+ verifyGemFireSetup(createPeer(getHost(0).getVM(0), managerDistributedSystemProperties));
+ }
+
+ @Test
+ public void testGetOnCacheMiss() {
+ doHousekeeping();
+
+ CommandStringBuilder command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "jonbloom");
+
+ assertResult(true, runCommand(command.toString()));
+
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "jondoe");
+ command.addOption(CliStrings.GET__LOAD, "false");
+
+ assertResult(false, runCommand(command.toString()));
+
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "jondoe");
+ command.addOption(CliStrings.GET__LOAD, "true");
+
+ assertResult(true, runCommand(command.toString()));
+
+ // NOTE test the unspecified default value for the --load-on-cache-miss
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "janedoe");
+
+ assertResult(true, runCommand(command.toString()));
+
+ // NOTE now test an absolute cache miss both for in the Region as well as the CacheLoader
+ command = new CommandStringBuilder(CliStrings.GET);
+ command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
+ command.addOption(CliStrings.GET__KEY, "nonexistinguser");
+ command.addOption(CliStrings.GET__LOAD, "true");
+
+ assertResult(false, runCommand(command.toString()));
+ }
+
+ private static String getRegionPath(final String regionName) {
+ return (regionName.startsWith(Region.SEPARATOR) ? regionName : String.format("%1$s%2$s", Region.SEPARATOR, regionName));
}
- protected static String toString(final Result result) {
+ private static String toString(final Result result) {
assert result != null : "The Result object from the command execution was null!";
StringBuilder buffer = new StringBuilder(System.getProperty("line.separator"));
@@ -89,39 +139,25 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
return buffer.toString();
}
- @Override
- public final void postSetUp() throws Exception {
- Properties managerDistributedSystemProperties = createDistributedSystemProperties(GEMFIRE_MANAGER_NAME);
- HeadlessGfsh gfsh = setUpJmxManagerOnVm0ThenConnect(managerDistributedSystemProperties);
-
- assertNotNull(gfsh);
- assertTrue(gfsh.isConnectedAndReady());
-
- setupGemFire();
- verifyGemFireSetup(createPeer(Host.getHost(0).getVM(0), managerDistributedSystemProperties));
- }
-
private void setupGemFire() throws Exception {
- initializePeer(createPeer(Host.getHost(0).getVM(1), createDistributedSystemProperties(GEMFIRE_SERVER_NAME)));
+ initializePeer(createPeer(getHost(0).getVM(1), createDistributedSystemProperties(GEMFIRE_SERVER_NAME)));
}
- protected Properties createDistributedSystemProperties(final String gemfireName) {
+ private Properties createDistributedSystemProperties(final String gemfireName) {
Properties distributedSystemProperties = new Properties();
- distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, GEMFIRE_LOG_LEVEL);
- distributedSystemProperties.setProperty(DistributionConfig.NAME_NAME, gemfireName);
+ distributedSystemProperties.setProperty(LOG_LEVEL_NAME, GEMFIRE_LOG_LEVEL);
+ distributedSystemProperties.setProperty(NAME_NAME, gemfireName);
return distributedSystemProperties;
}
- protected Peer createPeer(final VM vm, final Properties distributedSystemProperties) {
+ private Peer createPeer(final VM vm, final Properties distributedSystemProperties) {
return new Peer(vm, distributedSystemProperties);
}
- protected void initializePeer(final Peer peer) throws Exception {
- peer.run(new SerializableRunnable(
- String.format("Initializes the '%1$s' with the '%2$s' Region having a CacheLoader.", GEMFIRE_SERVER_NAME,
- USERS_REGION_NAME)) {
+ private void initializePeer(final Peer peer) throws Exception {
+ peer.run(new SerializableRunnable(String.format("Initializes the '%1$s' with the '%2$s' Region having a CacheLoader.", GEMFIRE_SERVER_NAME, USERS_REGION_NAME)) {
@Override
public void run() {
// create the GemFire Distributed System with custom distribution configuration properties and settings
@@ -161,16 +197,14 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
@Override
public boolean done() {
ManagerMXBean managerBean = managementService.getManagerMXBean();
- DistributedRegionMXBean usersRegionBean = managementService.getDistributedRegionMXBean(
- getRegionPath(USERS_REGION_NAME));
+ DistributedRegionMXBean usersRegionBean = managementService.getDistributedRegionMXBean(getRegionPath(USERS_REGION_NAME));
return !(managerBean == null || usersRegionBean == null);
}
@Override
public String description() {
- return String.format("Probing for the GemFire Manager '%1$s' and '%2$s' Region MXBeans...",
- manager.getName(), USERS_REGION_NAME);
+ return String.format("Probing for the GemFire Manager '%1$s' and '%2$s' Region MXBeans...", manager.getName(), USERS_REGION_NAME);
}
};
@@ -179,7 +213,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
});
}
- protected void doHousekeeping() {
+ private void doHousekeeping() {
runCommand(CliStrings.LIST_MEMBER);
runCommand(new CommandStringBuilder(CliStrings.DESCRIBE_MEMBER).addOption(CliStrings.DESCRIBE_MEMBER__IDENTIFIER,
@@ -191,16 +225,16 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
USERS_REGION_NAME).toString());
}
- protected void log(final Result result) {
+ private void log(final Result result) {
log("Result", toString(result));
}
- protected void log(final String tag, final String message) {
+ private void log(final String tag, final String message) {
//System.out.printf("%1$s (%2$s)%n", tag, message);
getLogWriter().info(String.format("%1$s (%2$s)%n", tag, message));
}
- protected CommandResult runCommand(final String command) {
+ private CommandResult runCommand(final String command) {
CommandResult result = executeCommand(command);
assertNotNull(result);
@@ -211,57 +245,16 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
return result;
}
- protected void assertResult(final boolean expectedResult, final CommandResult commandResult) {
+ private void assertResult(final boolean expectedResult, final CommandResult commandResult) {
if (ResultData.TYPE_COMPOSITE.equals(commandResult.getType())) {
- boolean actualResult = (Boolean) ((CompositeResultData) commandResult.getResultData()).retrieveSectionByIndex(
- 0).retrieveObject("Result");
+ boolean actualResult = (Boolean) ((CompositeResultData) commandResult.getResultData()).retrieveSectionByIndex(0).retrieveObject("Result");
assertEquals(expectedResult, actualResult);
} else {
fail(String.format("Expected composite result data; but was '%1$s'!%n", commandResult.getType()));
}
}
- @Test
- public void testGetOnCacheMiss() {
- doHousekeeping();
-
- CommandStringBuilder command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "jonbloom");
-
- assertResult(true, runCommand(command.toString()));
-
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "jondoe");
- command.addOption(CliStrings.GET__LOAD, "false");
-
- assertResult(false, runCommand(command.toString()));
-
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "jondoe");
- command.addOption(CliStrings.GET__LOAD, "true");
-
- assertResult(true, runCommand(command.toString()));
-
- // NOTE test the unspecified default value for the --load-on-cache-miss
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "janedoe");
-
- assertResult(true, runCommand(command.toString()));
-
- // NOTE now test an absolute cache miss both for in the Region as well as the CacheLoader
- command = new CommandStringBuilder(CliStrings.GET);
- command.addOption(CliStrings.GET__REGIONNAME, USERS_REGION_NAME);
- command.addOption(CliStrings.GET__KEY, "nonexistinguser");
- command.addOption(CliStrings.GET__LOAD, "true");
-
- assertResult(false, runCommand(command.toString()));
- }
-
- protected static final class Peer implements Serializable {
+ private static final class Peer implements Serializable {
private final Properties distributedSystemProperties;
private final VM vm;
@@ -277,7 +270,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
public String getName() {
- return getConfiguration().getProperty(DistributionConfig.NAME_NAME);
+ return getConfiguration().getProperty(NAME_NAME);
}
public VM getVm() {
@@ -305,7 +298,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
}
- protected static class User implements Serializable {
+ private static class User implements Serializable {
private final String username;
@@ -346,7 +339,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
}
- protected static class UserDataStoreCacheLoader implements CacheLoader<String, User>, Serializable {
+ private static class UserDataStoreCacheLoader implements CacheLoader<String, User>, Serializable {
private static final Map<String, User> userDataStore = new HashMap<String, User>(5);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
index 443c7c7..a61c717 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
@@ -16,7 +16,9 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import java.io.Serializable;
@@ -28,10 +30,8 @@ import com.gemstone.gemfire.cache.DiskStore;
import com.gemstone.gemfire.cache.DiskStoreFactory;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
@@ -51,7 +51,49 @@ import org.junit.experimental.categories.Category;
@Category(DistributedTest.class)
public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBase {
- protected static String toString(final Result result) {
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ setUpJmxManagerOnVm0ThenConnect(null);
+ setupGemFire();
+ }
+
+ @Test
+ public void testListDiskStore() throws Exception {
+ final Result result = executeCommand(CliStrings.LIST_DISK_STORE);
+
+ assertNotNull(result);
+ getLogWriter().info(toString(result));
+ assertEquals(Result.Status.OK, result.getStatus());
+ }
+
+ @Test
+ public void testDescribeDiskStore() throws Exception {
+ final Result result = executeCommand(CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=producerData");
+
+ assertNotNull(result);
+ getLogWriter().info(toString(result));
+ assertEquals(Result.Status.OK, result.getStatus());
+ }
+
+ @Test
+ public void testDescribeDiskStoreWithInvalidMemberName() throws Exception {
+ final Result commandResult = executeCommand(CliStrings.DESCRIBE_DISK_STORE + " --member=badMemberName --name=producerData");
+
+ assertNotNull(commandResult);
+ assertEquals(Result.Status.ERROR, commandResult.getStatus());
+ assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "badMemberName"), toString(commandResult));
+ }
+
+ @Test
+ public void testDescribeDiskStoreWithInvalidDiskStoreName() {
+ final Result commandResult = executeCommand(CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=badDiskStoreName");
+
+ assertNotNull(commandResult);
+ assertEquals(Result.Status.ERROR, commandResult.getStatus());
+ assertEquals("A disk store with name (badDiskStoreName) was not found on member (producerServer).", toString(commandResult));
+ }
+
+ private static String toString(final Result result) {
assert result != null : "The Result object from the command execution cannot be null!";
final StringBuilder buffer = new StringBuilder(System.getProperty("line.separator"));
@@ -64,21 +106,13 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
return buffer.toString().trim();
}
- @Override
- public final void postSetUp() throws Exception {
- setUpJmxManagerOnVm0ThenConnect(null);
- setupGemFire();
- }
-
- protected Peer createPeer(final Properties distributedSystemConfiguration, final VM vm) {
+ private Peer createPeer(final Properties distributedSystemConfiguration, final VM vm) {
return new Peer(distributedSystemConfiguration, vm);
}
- protected void setupGemFire() throws Exception {
- final Host host = Host.getHost(0);
-
- final VM vm1 = host.getVM(1);
- final VM vm2 = host.getVM(2);
+ private void setupGemFire() throws Exception {
+ final VM vm1 = getHost(0).getVM(1);
+ final VM vm2 = getHost(0).getVM(2);
final Peer peer1 = createPeer(createDistributedSystemProperties("consumerServer"), vm1);
final Peer peer2 = createPeer(createDistributedSystemProperties("producerServer"), vm2);
@@ -89,16 +123,16 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
createPersistentRegion(peer2, "producer-factory", "producerData");
}
- protected Properties createDistributedSystemProperties(final String gemfireName) {
+ private Properties createDistributedSystemProperties(final String gemfireName) {
final Properties distributedSystemProperties = new Properties();
- distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
- distributedSystemProperties.setProperty(DistributionConfig.NAME_NAME, gemfireName);
+ distributedSystemProperties.setProperty(LOG_LEVEL_NAME, getDUnitLogLevel());
+ distributedSystemProperties.setProperty(NAME_NAME, gemfireName);
return distributedSystemProperties;
}
- protected void createPersistentRegion(final Peer peer, final String regionName, final String diskStoreName) throws Exception {
+ private void createPersistentRegion(final Peer peer, final String regionName, final String diskStoreName) throws Exception {
peer.run(new SerializableRunnable("Creating Persistent Region for Member " + peer.getName()) {
@Override
public void run() {
@@ -124,48 +158,7 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
});
}
- @Test
- public void testListDiskStore() throws Exception {
- final Result result = executeCommand(CliStrings.LIST_DISK_STORE);
-
- assertNotNull(result);
- getLogWriter().info(toString(result));
- assertEquals(Result.Status.OK, result.getStatus());
- }
-
- @Test
- public void testDescribeDiskStore() throws Exception {
- final Result result = executeCommand(
- CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=producerData");
-
- assertNotNull(result);
- getLogWriter().info(toString(result));
- assertEquals(Result.Status.OK, result.getStatus());
- }
-
- @Test
- public void testDescribeDiskStoreWithInvalidMemberName() throws Exception {
- final Result commandResult = executeCommand(
- CliStrings.DESCRIBE_DISK_STORE + " --member=badMemberName --name=producerData");
-
- assertNotNull(commandResult);
- assertEquals(Result.Status.ERROR, commandResult.getStatus());
- assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "badMemberName"),
- toString(commandResult));
- }
-
- @Test
- public void testDescribeDiskStoreWithInvalidDiskStoreName() {
- final Result commandResult = executeCommand(
- CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=badDiskStoreName");
-
- assertNotNull(commandResult);
- assertEquals(Result.Status.ERROR, commandResult.getStatus());
- assertEquals("A disk store with name (badDiskStoreName) was not found on member (producerServer).",
- toString(commandResult));
- }
-
- protected static class Peer implements Serializable {
+ private static class Peer implements Serializable {
private final Properties distributedSystemConfiguration;
private final VM vm;
@@ -181,7 +174,7 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
}
public String getName() {
- return getDistributedSystemConfiguration().getProperty(DistributionConfig.NAME_NAME);
+ return getDistributedSystemConfiguration().getProperty(NAME_NAME);
}
public VM getVm() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
index e92d5bd..8947c22 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
@@ -31,6 +31,9 @@ import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.Region;
@@ -53,12 +56,9 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
/**
* The ListIndexCommandDUnitTest class is distributed test suite of test cases for testing the index-based GemFire shell
- * (Gfsh) commands. </p>
+ * (Gfsh) commands.
*
* @see com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase
* @see com.gemstone.gemfire.management.internal.cli.commands.IndexCommands
@@ -68,11 +68,17 @@ import org.junit.experimental.categories.Category;
@Category(DistributedTest.class)
public class ListIndexCommandDUnitTest extends CliCommandTestBase {
- protected static final int DEFAULT_REGION_INITIAL_CAPACITY = 10000;
+ private static final int DEFAULT_REGION_INITIAL_CAPACITY = 10000;
private final AtomicLong idGenerator = new AtomicLong(0l);
- protected static String toString(final Result result) {
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ setUpJmxManagerOnVm0ThenConnect(null);
+ setupGemFire();
+ }
+
+ private static String toString(final Result result) {
assert result != null : "The Result object from the command execution cannot be null!";
final StringBuilder buffer = new StringBuilder(System.getProperty("line.separator"));
@@ -85,48 +91,41 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
return buffer.toString();
}
- @Override
- public final void postSetUp() throws Exception {
- setUpJmxManagerOnVm0ThenConnect(null);
- setupGemFire();
- }
-
- protected Index createIndex(final String name, final String indexedExpression, final String fromClause) {
+ private Index createIndex(final String name, final String indexedExpression, final String fromClause) {
return createIndex(name, IndexType.FUNCTIONAL, indexedExpression, fromClause);
}
- protected Index createIndex(final String name, final IndexType type, final String indexedExpression,
- final String fromClause) {
+ private Index createIndex(final String name, final IndexType type, final String indexedExpression, final String fromClause) {
return new IndexAdapter(name, type, indexedExpression, fromClause);
}
- protected Peer createPeer(final VM vm, final Properties distributedSystemProperties,
- final RegionDefinition... regions) {
+ private Peer createPeer(final VM vm, final Properties distributedSystemProperties, final RegionDefinition... regions) {
final Peer peer = new Peer(vm, distributedSystemProperties);
peer.add(regions);
return peer;
}
- protected RegionDefinition createRegionDefinition(final String regionName, final Class<?> keyConstraint,
- final Class<?> valueConstraint, final Index... indexes) {
+ private RegionDefinition createRegionDefinition(final String regionName, final Class<?> keyConstraint, final Class<?> valueConstraint, final Index... indexes) {
final RegionDefinition regionDefinition = new RegionDefinition(regionName, keyConstraint, valueConstraint);
regionDefinition.add(indexes);
return regionDefinition;
}
- protected void setupGemFire() throws Exception {
+ private void setupGemFire() throws Exception {
final Host host = Host.getHost(0);
final VM vm1 = host.getVM(1);
final VM vm2 = host.getVM(2);
- final Peer peer1 = createPeer(vm1, createDistributedSystemProperties("consumerServer"),
- createRegionDefinition("consumers", Long.class, Consumer.class,
- createIndex("cidIdx", IndexType.PRIMARY_KEY, "id", "/consumers"),
- createIndex("cnameIdx", "name", "/consumers")));
+ final Peer peer1 = createPeer(vm1,
+ createDistributedSystemProperties("consumerServer"),
+ createRegionDefinition("consumers", Long.class, Consumer.class,
+ createIndex("cidIdx", IndexType.PRIMARY_KEY, "id", "/consumers"),
+ createIndex("cnameIdx", "name", "/consumers")));
- final Peer peer2 = createPeer(vm2, createDistributedSystemProperties("producerServer"),
- createRegionDefinition("producers", Long.class, Producer.class, createIndex("pidIdx", "id", "/producers")));
+ final Peer peer2 = createPeer(vm2,
+ createDistributedSystemProperties("producerServer"),
+ createRegionDefinition("producers", Long.class, Producer.class, createIndex("pidIdx", "id", "/producers")));
createRegionWithIndexes(peer1);
createRegionWithIndexes(peer2);
@@ -135,7 +134,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
loadProducerData(peer2, 10000);
}
- protected Properties createDistributedSystemProperties(final String gemfireName) {
+ private Properties createDistributedSystemProperties(final String gemfireName) {
final Properties distributedSystemProperties = new Properties();
distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
@@ -144,9 +143,8 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
return distributedSystemProperties;
}
- protected void createRegionWithIndexes(final Peer peer) throws Exception {
- peer.run(new SerializableRunnable(
- String.format("Creating Regions with Indexes on GemFire peer (%1$s).", peer.getName())) {
+ private void createRegionWithIndexes(final Peer peer) throws Exception {
+ peer.run(new SerializableRunnable(String.format("Creating Regions with Indexes on GemFire peer (%1$s).", peer.getName())) {
public void run() {
// create the GemFire distributed system with custom configuration properties...
getSystem(peer.getConfiguration());
@@ -176,16 +174,14 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
} catch (Exception e) {
- getLogWriter().error(
- String.format("Error occurred creating Index (%1$s) on Region (%2$s) - (%3$s)", indexName,
- region.getFullPath(), e.getMessage()));
+ getLogWriter().error(String.format("Error occurred creating Index (%1$s) on Region (%2$s) - (%3$s)", indexName, region.getFullPath(), e.getMessage()));
}
}
}
});
}
- protected void loadConsumerData(final Peer peer, final int operationsTotal) throws Exception {
+ private void loadConsumerData(final Peer peer, final int operationsTotal) throws Exception {
peer.run(new SerializableRunnable("Load /consumers Region with data") {
public void run() {
final Cache cache = getCache();
@@ -231,7 +227,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
});
}
- protected void loadProducerData(final Peer peer, final int operationsTotal) throws Exception {
+ private void loadProducerData(final Peer peer, final int operationsTotal) throws Exception {
peer.run(new SerializableRunnable("Load /producers Region with data") {
public void run() {
final Cache cache = getCache();
@@ -276,14 +272,13 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
@SuppressWarnings("unchecked")
- protected <T extends Comparable<T>, B extends AbstractBean<T>> B query(final Cache cache, final String queryString) {
+ private <T extends Comparable<T>, B extends AbstractBean<T>> B query(final Cache cache, final String queryString) {
try {
getLogWriter().info(String.format("Running Query (%1$s) in GemFire...", queryString));
final SelectResults<B> results = (SelectResults<B>) cache.getQueryService().newQuery(queryString).execute();
- getLogWriter().info(
- String.format("Running Query (%1$s) in GemFire returned (%2$d) result(s).", queryString, results.size()));
+ getLogWriter().info(String.format("Running Query (%1$s) in GemFire returned (%2$d) result(s).", queryString, results.size()));
return (results.iterator().hasNext() ? results.iterator().next() : null);
} catch (Exception e) {
@@ -291,23 +286,17 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- protected <T extends Comparable<T>, B extends AbstractBean<T>> B query(final Region<T, B> region,
- final String queryPredicate) {
+ private <T extends Comparable<T>, B extends AbstractBean<T>> B query(final Region<T, B> region, final String queryPredicate) {
try {
- getLogWriter().info(
- String.format("Running Query (%1$s) on Region (%2$s)...", queryPredicate, region.getFullPath()));
+ getLogWriter().info(String.format("Running Query (%1$s) on Region (%2$s)...", queryPredicate, region.getFullPath()));
final SelectResults<B> results = region.query(queryPredicate);
- getLogWriter().info(
- String.format("Running Query (%1$s) on Region (%2$s) returned (%3$d) result(s).", queryPredicate,
- region.getFullPath(), results.size()));
+ getLogWriter().info(String.format("Running Query (%1$s) on Region (%2$s) returned (%3$d) result(s).", queryPredicate, region.getFullPath(), results.size()));
return (results.iterator().hasNext() ? results.iterator().next() : null);
} catch (Exception e) {
- throw new RuntimeException(
- String.format("An error occurred running Query (%1$s) on Region (%2$s)!", queryPredicate,
- region.getFullPath()), e);
+ throw new RuntimeException(String.format("An error occurred running Query (%1$s) on Region (%2$s)!", queryPredicate, region.getFullPath()), e);
}
}
@@ -320,7 +309,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
assertEquals(Result.Status.OK, result.getStatus());
}
- protected static class Peer implements Iterable<RegionDefinition>, Serializable {
+ private static class Peer implements Iterable<RegionDefinition>, Serializable {
private final Properties distributedSystemProperties;
@@ -350,6 +339,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
return (regionDefinitions != null && regions.addAll(Arrays.asList(regionDefinitions)));
}
+ @Override
public Iterator<RegionDefinition> iterator() {
return Collections.unmodifiableSet(regions).iterator();
}
@@ -377,7 +367,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- protected static class IndexAdapter implements Index, Serializable {
+ private static class IndexAdapter implements Index, Serializable {
private final IndexDetails.IndexType type;
@@ -389,11 +379,9 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
this(name, IndexType.FUNCTIONAL, indexedExpression, fromClause);
}
- protected IndexAdapter(final String name, final IndexType type, final String indexedExpression,
- final String fromClause) {
+ protected IndexAdapter(final String name, final IndexType type, final String indexedExpression, final String fromClause) {
assert name != null : "The name of the Index cannot be null!";
- assert indexedExpression != null : String.format("The expression to index for Index (%1$s) cannot be null!",
- name);
+ assert indexedExpression != null : String.format("The expression to index for Index (%1$s) cannot be null!", name);
assert fromClause != null : String.format("The from clause for Index (%1$s) cannot be null!", name);
this.type = ObjectUtils.defaultIfNull(IndexDetails.IndexType.valueOf(type), IndexDetails.IndexType.FUNCTIONAL);
@@ -402,42 +390,52 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
this.fromClause = fromClause;
}
+ @Override
public String getName() {
return this.name;
}
+ @Override
public String getFromClause() {
return this.fromClause;
}
+ @Override
public String getCanonicalizedFromClause() {
return this.fromClause;
}
+ @Override
public String getIndexedExpression() {
return this.indexedExpression;
}
+ @Override
public String getCanonicalizedIndexedExpression() {
return this.indexedExpression;
}
+ @Override
public String getProjectionAttributes() {
throw new UnsupportedOperationException("Not Implemented!");
}
+ @Override
public String getCanonicalizedProjectionAttributes() {
throw new UnsupportedOperationException("Not Implemented!");
}
+ @Override
public Region<?, ?> getRegion() {
throw new UnsupportedOperationException("Not Implemented!");
}
+ @Override
public IndexStatistics getStatistics() {
throw new UnsupportedOperationException("Not Implemented!");
}
+ @Override
public IndexType getType() {
return type.getType();
}
@@ -454,7 +452,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- protected static class RegionDefinition implements Iterable<Index>, Serializable {
+ private static class RegionDefinition implements Iterable<Index>, Serializable {
private final Class<?> keyConstraint;
private final Class<?> valueConstraint;
@@ -487,6 +485,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
return (indexes != null && this.indexes.addAll(Arrays.asList(indexes)));
}
+ @Override
public Iterator<Index> iterator() {
return Collections.unmodifiableSet(indexes).iterator();
}
@@ -528,7 +527,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- protected static abstract class AbstractBean<T extends Comparable<T>> implements MutableIdentifiable<T>, Serializable {
+ private static abstract class AbstractBean<T extends Comparable<T>> implements MutableIdentifiable<T>, Serializable {
private T id;
private String name;
@@ -540,10 +539,12 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
this.id = id;
}
+ @Override
public T getId() {
return id;
}
+ @Override
public void setId(final T id) {
this.id = id;
}
@@ -588,7 +589,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- public static class Consumer extends AbstractBean<Long> {
+ private static class Consumer extends AbstractBean<Long> {
private volatile int units;
@@ -608,7 +609,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- public static class Producer extends AbstractBean<Long> {
+ private static class Producer extends AbstractBean<Long> {
private volatile int units;
@@ -628,7 +629,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- public static class Proxy extends AbstractBean<Long> {
+ private static class Proxy extends AbstractBean<Long> {
private final AbstractBean<Long> bean;
private int unitsSnapshot;
@@ -661,7 +662,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
- protected static enum CrudOperation {
+ private static enum CrudOperation {
CREATE,
RETRIEVE,
UPDATE,
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
index b60f78c..fec6c5e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommandsDUnitTest.java
@@ -46,7 +46,7 @@ public class ShellCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@Override
- public final void postSetUp() throws Exception {
+ public final void postSetUpCliCommandTestBase() throws Exception {
getDefaultShell();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
index 9ca6036..a234edb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/UserCommandsDUnitTest.java
@@ -53,7 +53,7 @@ public class UserCommandsDUnitTest extends CliCommandTestBase {
boolean deleteJarDirectory = false;
@Override
- public final void postSetUp() throws Exception {
+ public final void postSetUpCliCommandTestBase() throws Exception {
createUserCommandJarFile();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationDUnitTest.java
index 92fe1bc..c07eab7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationDUnitTest.java
@@ -16,10 +16,15 @@
*/
package com.gemstone.gemfire.management.internal.configuration;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -27,117 +32,104 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.DiskStoreFactory;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DM;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.management.internal.configuration.domain.Configuration;
import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity.XmlEntityBuilder;
import com.gemstone.gemfire.management.internal.configuration.handlers.ConfigurationRequestHandler;
import com.gemstone.gemfire.management.internal.configuration.messages.ConfigurationRequest;
import com.gemstone.gemfire.management.internal.configuration.messages.ConfigurationResponse;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-/***
+/**
* Tests the starting up of shared configuration, installation of {@link ConfigurationRequestHandler}
- *
- *
*/
-public class SharedConfigurationDUnitTest extends CacheTestCase {
- private static final long serialVersionUID = 1L;
+@Category(DistributedTest.class)
+public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase {
+
private static final String REGION1 = "region1";
private static final int TIMEOUT = 10000;
private static final int INTERVAL = 500;
private static final String DISKSTORENAME = "diskStore1";
-// private static final VM locator1Vm = Host.getHost(0).getVM(1);
-// private static final VM locator2Vm = Host.getHost(0).getVM(2);
-// private static final VM dataMemberVm = Host.getHost(0).getVM(3);
+ @Override
+ public final void postSetUp() throws Exception {
+ disconnectAllFromDS();
+ }
- public static final SerializableRunnable locatorCleanup = new SerializableRunnable() {
- @Override
- public void run() {
- InternalLocator locator = InternalLocator.getLocator();
- if (locator != null) {
- SharedConfiguration sharedConfig = locator.getSharedConfiguration();
- if (sharedConfig != null) {
- sharedConfig.destroySharedConfiguration();
- }
- locator.stop();
- }
- disconnectAllFromDS();
+ @Override
+ public final void postTearDownCacheTestCase() throws Exception {
+ for (int i=0; i<4; i++) {
+ getHost(0).getVM(i).invoke(SharedConfigurationTestUtils.cleanupLocator);
}
- };
-
-
- public SharedConfigurationDUnitTest(String name) {
- super(name);
}
+
+ @Test
+ public void testGetHostedLocatorsWithSharedConfiguration() throws Exception {
+ final VM locator1Vm = getHost(0).getVM(1);
+ final VM locator2Vm = getHost(0).getVM(2);
- public void testGetHostedLocatorsWithSharedConfiguration() {
- disconnectAllFromDS();
- final VM locator1Vm = Host.getHost(0).getVM(1);
- final VM locator2Vm = Host.getHost(0).getVM(2);
-
- final String testName = "testGetHostedLocatorsWithSharedConfiguration";
-// final VM locator3Vm = Host.getHost(0).getVM(3);
-
- final int []ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+ final String testName = getName();
+
+ final int[] ports = getRandomAvailableTCPPorts(3);
- //final int locator1Port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final int locator1Port = ports[0];
final String locator1Name = "locator1" + locator1Port;
+
locator1Vm.invoke(new SerializableCallable() {
@Override
public Object call() {
final File locatorLogFile = new File(testName + "-locator-" + locator1Port + ".log");
+
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator1Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "fine");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(NAME_NAME, locator1Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "fine");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+
try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null,
- locatorProps);
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return locator.isSharedConfigurationRunning();
}
-
@Override
public String description() {
return "Waiting for shared configuration to be started";
}
};
- Wait.waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
+ waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+ } catch (IOException e) {
+ fail("Unable to create a locator with a shared configuration", e);
}
+
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
InternalDistributedMember me = cache.getMyId();
DM dm = cache.getDistributionManager();
+
Map<InternalDistributedMember, Collection<String>> hostedLocators = dm.getAllHostedLocators();
assertFalse(hostedLocators.isEmpty());
+
Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration = dm.getAllHostedLocatorsWithSharedConfiguration();
assertFalse(hostedLocatorsWithSharedConfiguration.isEmpty());
@@ -147,7 +139,6 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
}
});
- //final int locator2Port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final int locator2Port = ports[1];
final String locator2Name = "locator2" + locator2Port;
@@ -155,20 +146,23 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
@Override
public Object call() throws IOException {
final File locatorLogFile = new File(testName + "-locator-" + locator2Port + ".log");
+
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator2Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "fine");
- locatorProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port, locatorLogFile, null,
- locatorProps);
+ locatorProps.setProperty(NAME_NAME, locator2Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "fine");
+ locatorProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port, locatorLogFile, null, locatorProps);
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
InternalDistributedMember me = cache.getMyId();
DM dm = cache.getDistributionManager();
+
Map<InternalDistributedMember, Collection<String>> hostedLocators = dm.getAllHostedLocators();
assertFalse(hostedLocators.isEmpty());
+
Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration = dm.getAllHostedLocatorsWithSharedConfiguration();
assertFalse(hostedLocatorsWithSharedConfiguration.isEmpty());
assertNotNull(hostedLocators.get(me));
@@ -193,7 +187,7 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
public Object call() {
InternalLocator locator = (InternalLocator) Locator.getLocator();
SharedConfiguration sharedConfig = locator.getSharedConfiguration();
- sharedConfig.destroySharedConfiguration();
+ sharedConfig.destroySharedConfiguration_forTestsOnly();
locator.stop();
return null;
}
@@ -216,60 +210,52 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
return null;
}
});
-
-// locator2Vm.invoke(new SerializableCallable() {
-// public Object call() {
-// InternalLocator locator = (InternalLocator) Locator.getLocator();
-// SharedConfiguration sharedConfig = locator.getSharedConfiguration();
-// if (sharedConfig != null) {
-// sharedConfig.destroySharedConfiguration();
-// }
-// locator.stop();
-// return null;
-// }
-// });
}
-
- public void testSharedConfigurationService() {
- disconnectAllFromDS();
+
+ @Test
+ public void testSharedConfigurationService() throws Exception {
// Start the Locator and wait for shared configuration to be available
final String testGroup = "G1";
final String clusterLogLevel = "error";
final String groupLogLevel = "fine";
- final String testName = "testSharedConfigurationService";
+
+ final String testName = getName();
- final VM locator1Vm = Host.getHost(0).getVM(1);
- final VM locator2Vm = Host.getHost(0).getVM(3);
- final VM dataMemberVm = Host.getHost(0).getVM(2);
- final int [] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+ final VM locator1Vm = getHost(0).getVM(1);
+ final VM locator2Vm = getHost(0).getVM(3);
+ final VM dataMemberVm = getHost(0).getVM(2);
+
+ final int [] ports = getRandomAvailableTCPPorts(3);
final int locator1Port = ports[0];
locator1Vm.invoke(new SerializableCallable() {
@Override
public Object call() {
final File locatorLogFile = new File(testName + "-locator-" + locator1Port + ".log");
+
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, "Locator1");
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(NAME_NAME, "Locator1");
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "info");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+
try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null,
- locatorProps);
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return locator.isSharedConfigurationRunning();
}
-
@Override
public String description() {
return "Waiting for shared configuration to be started";
}
};
- Wait.waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
+ waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+ } catch (IOException e) {
+ fail("Unable to create a locator with a shared configuration", e);
}
return null;
@@ -280,12 +266,14 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
@Override
public Object call() {
Properties localProps = new Properties();
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
- localProps.setProperty(DistributionConfig.GROUPS_NAME, testGroup);
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
+ localProps.setProperty(GROUPS_NAME, testGroup);
+
getSystem(localProps);
Cache cache = getCache();
assertNotNull(cache);
+
DiskStoreFactory dsFactory = cache.createDiskStoreFactory();
File dsDir = new File("dsDir");
if (!dsDir.exists()) {
@@ -305,15 +293,15 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
//Modify property and cache attributes
Properties clusterProperties = new Properties();
- clusterProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, clusterLogLevel);
+ clusterProperties.setProperty(LOG_LEVEL_NAME, clusterLogLevel);
XmlEntity cacheEntity = XmlEntity.builder().withType(CacheXml.CACHE).build();
Map<String, String> cacheAttributes = new HashMap<String, String>();
cacheAttributes.put(CacheXml.COPY_ON_READ, "true");
- //assertTrue(scw.modifyProperties(clusterProperties, null));
+ //assertTrue(scw.modifyProperties(clusterProperties, null)); // TODO: why is this commented out?
assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity, null));
- clusterProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, groupLogLevel);
+ clusterProperties.setProperty(LOG_LEVEL_NAME, groupLogLevel);
assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity, new String[]{testGroup}));
//Add a jar
@@ -335,32 +323,32 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
locator2Vm.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
-
final File locatorLogFile = new File(testName + "-locator-" + locator2Port + ".log");
+
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, "Locator2");
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- locatorProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
+ locatorProps.setProperty(NAME_NAME, "Locator2");
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "info");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
+
try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port, locatorLogFile, null,
- locatorProps);
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port, locatorLogFile, null, locatorProps);
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return locator.isSharedConfigurationRunning();
}
-
@Override
public String description() {
return "Waiting for shared configuration to be started";
}
};
- Wait.waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
+ waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+ } catch (IOException e) {
+ fail("Unable to create a locator with a shared configuration", e);
}
InternalLocator locator = (InternalLocator) Locator.getLocator();
@@ -370,14 +358,14 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
assertNotNull(clusterConfig);
assertNotNull(clusterConfig.getJarNames());
assertTrue(clusterConfig.getJarNames().contains("foo.jar"));
- assertTrue(clusterConfig.getGemfireProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME).equals(clusterLogLevel));
+ assertTrue(clusterConfig.getGemfireProperties().getProperty(LOG_LEVEL_NAME).equals(clusterLogLevel));
assertNotNull(clusterConfig.getCacheXmlContent());
Configuration testGroupConfiguration = entireConfiguration.get(testGroup);
assertNotNull(testGroupConfiguration);
assertNotNull(testGroupConfiguration.getJarNames());
assertTrue(testGroupConfiguration.getJarNames().contains("bar.jar"));
- assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME).equals(groupLogLevel));
+ assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(LOG_LEVEL_NAME).equals(groupLogLevel));
assertNotNull(testGroupConfiguration.getCacheXmlContent());
assertTrue(testGroupConfiguration.getCacheXmlContent().contains(REGION1));
@@ -394,7 +382,7 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
dataMemberVm.invoke(new SerializableCallable() {
@Override
- public Object call() throws UnknownHostException, IOException, ClassNotFoundException {
+ public Object call() throws IOException, ClassNotFoundException {
SharedConfigurationWriter scw = new SharedConfigurationWriter();
scw.deleteXmlEntity(new XmlEntity(CacheXml.REGION, "name", REGION1), new String[]{testGroup});
scw.deleteJars(new String []{"foo.jar"}, null);
@@ -412,13 +400,13 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
assertNull(configResponse.getJarNames());
assertNull(configResponse.getJars());
assertTrue(clusterConfiguration.getJarNames().isEmpty());
- assertTrue(clusterConfiguration.getGemfireProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME).equals(clusterLogLevel));
+ assertTrue(clusterConfiguration.getGemfireProperties().getProperty(LOG_LEVEL_NAME).equals(clusterLogLevel));
Configuration testGroupConfiguration = requestedConfiguration.get(testGroup);
assertNotNull(testGroupConfiguration);
assertFalse(testGroupConfiguration.getCacheXmlContent().contains(REGION1));
assertTrue(testGroupConfiguration.getJarNames().isEmpty());
- assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME).equals(groupLogLevel));
+ assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(LOG_LEVEL_NAME).equals(groupLogLevel));
GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
Map<InternalDistributedMember, Collection<String>> locatorsWithSharedConfiguration = cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration();
@@ -432,11 +420,4 @@ public class SharedConfigurationDUnitTest extends CacheTestCase {
}
});
}
-
- @Override
- public final void postTearDownCacheTestCase() throws Exception {
- for (int i=0; i<4; i++) {
- Host.getHost(0).getVM(i).invoke(SharedConfigurationDUnitTest.locatorCleanup);
- }
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationTestUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationTestUtils.java
new file mode 100644
index 0000000..235f02e
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationTestUtils.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.configuration;
+
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.internal.JUnit3DistributedTestCase;
+
+public class SharedConfigurationTestUtils {
+
+ public static final SerializableRunnable cleanupLocator = new SerializableRunnable() {
+ @Override
+ public void run() {
+ InternalLocator locator = InternalLocator.getLocator();
+ if (locator != null) {
+ SharedConfiguration sharedConfig = locator.getSharedConfiguration();
+ if (sharedConfig != null) {
+ sharedConfig.destroySharedConfiguration_forTestsOnly();
+ }
+ locator.stop();
+ }
+ JUnit3DistributedTestCase.disconnectAllFromDS();
+ }
+ };
+}
[14/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
new file mode 100755
index 0000000..8550a35
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
@@ -0,0 +1,977 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.DistributionLocator;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+import com.gemstone.gemfire.internal.logging.LocalLogWriter;
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for launching a Locator in a forked process.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLauncherRemoteIntegrationTestCase {
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
+ public void testRunningLocatorOutlivesForkingProcess() throws Exception {
+ }/*
+ // TODO: fix up this test
+
+ this.temporaryFolder.getRoot() = new File(getUniqueName());
+ this.temporaryFolder.getRoot().mkdir();
+ assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
+
+ // launch LocatorLauncherForkingProcess which then launches the GemFire Locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncherRemoteDUnitTest.class.getName().concat("$").concat(LocatorLauncherForkingProcess.class.getSimpleName()));
+ command.add(String.valueOf(this.locatorPort));
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ Thread waiting = new Thread(new Runnable() {
+ public void run() {
+ try {
+ assertEquals(0, process.waitFor());
+ }
+ catch (InterruptedException ignore) {
+ logger.error("Interrupted while waiting for process!", ignore);
+ }
+ }
+ });
+
+ try {
+ waiting.start();
+ waiting.join(TIMEOUT_MILLISECONDS);
+ assertFalse("Process took too long and timed out!", waiting.isAlive());
+ }
+ finally {
+ if (waiting.isAlive()) {
+ waiting.interrupt();
+ }
+ }
+
+ LocatorLauncher locatorLauncher = new Builder().setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()).build();
+
+ assertEquals(Status.ONLINE, locatorLauncher.status().getStatus());
+ assertEquals(Status.STOPPED, locatorLauncher.stop().getStatus());
+ }
+ */
+
+ @Category(FlakyTest.class) // GEODE-473: random ports, BindException, forks JVM, uses ErrorCollector
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // check the status
+ final LocatorState locatorState = this.launcher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.ONLINE, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-530: BindException, random ports
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate stale control files were deleted
+ waitForFileToDelete(this.stopRequestFile);
+ waitForFileToDelete(this.statusRequestFile);
+ waitForFileToDelete(this.statusFile);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-1229: BindException
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertFalse(pid == Integer.MAX_VALUE);
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-764: BindException
+ @Test
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ final int otherPid = getPid();
+ assertTrue("Pid " + otherPid + " should be alive", ProcessUtils.isProcessAlive(otherPid));
+ writePid(this.pidFile, otherPid);
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+ command.add("--force");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertTrue(pid != otherPid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartUsingPortInUseFails() throws Throwable {
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
+
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--port=" + this.locatorPort);
+
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for locator to start and fail
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = process.waitFor();
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final LocatorState locatorState = dirLauncher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning())));
+ }
+
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
+
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+ assertTrue(this.socket.isBound());
+ assertFalse(this.socket.isClosed());
+
+ // launch locator
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.locatorPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for locator to start up
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = process.waitFor(); // TODO: create flavor with timeout in ProcessUtils
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final LocatorState locatorState = dirLauncher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning())));
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ this.temporaryFolder.getRoot() = new File(getUniqueName());
+ this.temporaryFolder.getRoot().mkdir();
+ assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
+
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher, 10*1000, false);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ // check the status
+ final LocatorState locatorState = dirLauncher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ try {
+ final LocatorState status = dirLauncher.stop();
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ LocatorLauncher pidLauncher = null;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final LocatorState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-569: BindException, random ports
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // validate the status
+ final LocatorState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusWithEmptyPidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile());
+
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final LocatorState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStatusWithNoPidFile() throws Exception {
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ LocatorState locatorState = dirLauncher.status();
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+ }
+
+ @Test
+ public void testStatusWithStalePidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ final int pid = 0;
+ assertFalse(ProcessUtils.isProcessAlive(pid));
+ writePid(this.pidFile, pid);
+
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final LocatorState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ LocatorLauncher pidLauncher = null;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final LocatorState status = pidLauncher.status();
+ assertNotNull(status);
+ assertEquals(Status.ONLINE, status.getStatus());
+ assertEquals(pid, status.getPid().intValue());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-847: random ports, BindException, forks JVM, uses ErrorCollector
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // stop the locator
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ assertFalse("PID file still exists!", this.pidFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Used only by {@link LocatorLauncherRemoteIntegrationTest#testRunningLocatorOutlivesForkingProcess}
+ */
+ public static class LocatorLauncherForkingProcess {
+
+ public static void main(final String... args) throws FileNotFoundException {
+ File file = new File(System.getProperty("user.dir"), LocatorLauncherForkingProcess.class.getSimpleName().concat(".log"));
+
+ LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
+
+ try {
+ final int port = Integer.parseInt(args[0]);
+
+ // launch LocatorLauncher
+ List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getAbsolutePath());
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add("-Dgemfire.mcast-port=0");
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(LocatorLauncherForkingProcess.class.getSimpleName() + "_Locator");
+ command.add("--port=" + port);
+ command.add("--redirect-output");
+
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main starting...");
+
+ Process forkedProcess = new ProcessBuilder(command).start();
+
+ @SuppressWarnings("unused")
+ ProcessStreamReader processOutReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getInputStream()).build().start();
+ @SuppressWarnings("unused")
+ ProcessStreamReader processErrReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getErrorStream()).build().start();
+
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main waiting for locator to start...");
+
+ waitForLocatorToStart(port, TIMEOUT_MILLISECONDS, 10, true);
+
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
+
+ System.exit(0);
+ }
+ catch (Throwable t) {
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t);
+ System.exit(-1);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
deleted file mode 100755
index 63c7c74..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.DistributionLocator;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.internal.logging.InternalLogWriter;
-import com.gemstone.gemfire.internal.logging.LocalLogWriter;
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.internal.process.ProcessStreamReader;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Integration tests for launching a Locator in a forked process.
- *
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnitTestCase {
-
- protected volatile Process process;
- protected volatile ProcessStreamReader processOutReader;
- protected volatile ProcessStreamReader processErrReader;
-
- @Before
- public final void setUpLocatorLauncherRemoteTest() throws Exception {
- }
-
- @After
- public final void tearDownLocatorLauncherRemoteTest() throws Exception {
- if (this.process != null) {
- this.process.destroy();
- this.process = null;
- }
- if (this.processOutReader != null && this.processOutReader.isRunning()) {
- this.processOutReader.stop();
- }
- if (this.processErrReader != null && this.processErrReader.isRunning()) {
- this.processErrReader.stop();
- }
- }
-
- protected Status getExpectedStopStatusForNotRunning() {
- return Status.NOT_RESPONDING;
- }
-
- @Test
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertTrue(factory.isAttachAPIFound());
- }
-
- @Test
- @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
- public void testRunningLocatorOutlivesForkingProcess() throws Exception {
- }/*
- // TODO: fix up this test
-
- this.temporaryFolder.getRoot() = new File(getUniqueName());
- this.temporaryFolder.getRoot().mkdir();
- assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
-
- // launch LocatorLauncherForkingProcess which then launches the GemFire Locator
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncherRemoteDUnitTest.class.getName().concat("$").concat(LocatorLauncherForkingProcess.class.getSimpleName()));
- command.add(String.valueOf(this.locatorPort));
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- Thread waiting = new Thread(new Runnable() {
- public void run() {
- try {
- assertEquals(0, process.waitFor());
- }
- catch (InterruptedException ignore) {
- logger.error("Interrupted while waiting for process!", ignore);
- }
- }
- });
-
- try {
- waiting.start();
- waiting.join(TIMEOUT_MILLISECONDS);
- assertFalse("Process took too long and timed out!", waiting.isAlive());
- }
- finally {
- if (waiting.isAlive()) {
- waiting.interrupt();
- }
- }
-
- LocatorLauncher locatorLauncher = new Builder().setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()).build();
-
- assertEquals(Status.ONLINE, locatorLauncher.status().getStatus());
- assertEquals(Status.STOPPED, locatorLauncher.stop().getStatus());
- }
- */
-
- @Category(FlakyTest.class) // GEODE-473: random ports, BindException, forks JVM, uses ErrorCollector
- @Test
- public void testStartCreatesPidFile() throws Throwable {
- // build and start the locator
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- int pid = 0;
- this.launcher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // check the status
- final LocatorState locatorState = this.launcher.status();
- assertNotNull(locatorState);
- assertEquals(Status.ONLINE, locatorState.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-530: BindException, random ports
- @Test
- public void testStartDeletesStaleControlFiles() throws Throwable {
- // create existing control files
- this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
- this.stopRequestFile.createNewFile();
- assertTrue(this.stopRequestFile.exists());
-
- this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
- this.statusRequestFile.createNewFile();
- assertTrue(this.statusRequestFile.exists());
-
- this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
- this.statusFile.createNewFile();
- assertTrue(this.statusFile.exists());
-
- // build and start the locator
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for locator to start
- int pid = 0;
- this.launcher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate stale control files were deleted
- waitForFileToDelete(this.stopRequestFile);
- waitForFileToDelete(this.statusRequestFile);
- waitForFileToDelete(this.statusFile);
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-1229: BindException
- @Test
- public void testStartOverwritesStalePidFile() throws Throwable {
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- writePid(this.pidFile, Integer.MAX_VALUE);
-
- // build and start the locator
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- int pid = 0;
- this.launcher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertFalse(pid == Integer.MAX_VALUE);
-
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-764: BindException
- @Test
- public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- final int otherPid = getPid();
- assertTrue("Pid " + otherPid + " should be alive", ProcessUtils.isProcessAlive(otherPid));
- writePid(this.pidFile, otherPid);
-
- // build and start the locator
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
- command.add("--force");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for locator to start
- int pid = 0;
- this.launcher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertTrue(pid != otherPid);
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartUsingPortInUseFails() throws Throwable {
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
-
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--redirect-output");
- command.add("--port=" + this.locatorPort);
-
- String expectedString = "java.net.BindException";
- AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
-
- // wait for locator to start and fail
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- int code = process.waitFor();
- assertEquals("Expected exit code 1 but was " + code, 1, code);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // check the status
- final LocatorState locatorState = dirLauncher.status();
- assertNotNull(locatorState);
- assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
-
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines
- // or this test needs to use MainLauncher in ProcessWrapper
-
- // validate that output contained BindException
- this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
-
- // just in case the launcher started...
- LocatorState status = null;
- try {
- status = dirLauncher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning())));
- }
-
- @Test
- public void testStartWithDefaultPortInUseFails() throws Throwable {
- String expectedString = "java.net.BindException";
- AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
-
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
-
- assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
- assertTrue(this.socket.isBound());
- assertFalse(this.socket.isClosed());
-
- // launch locator
- final List<String> jvmArguments = getJvmArguments();
- jvmArguments.add("-D" + DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.locatorPort);
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
-
- // wait for locator to start up
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- int code = process.waitFor(); // TODO: create flavor with timeout in ProcessUtils
- assertEquals("Expected exit code 1 but was " + code, 1, code);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // check the status
- final LocatorState locatorState = dirLauncher.status();
- assertNotNull(locatorState);
- assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
-
- // creation of log file seems to be random -- look into why sometime
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines
- // or this test needs to use MainLauncher in ProcessWrapper
-
- // validate that output contained BindException
- this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
-
- // just in case the launcher started...
- LocatorState status = null;
- try {
- status = dirLauncher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning())));
- }
-
- @Test
- @Ignore("Need to rewrite this without using dunit.Host")
- public void testStartWithExistingPidFileFails() throws Throwable {
- }/*
- this.temporaryFolder.getRoot() = new File(getUniqueName());
- this.temporaryFolder.getRoot().mkdir();
- assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
-
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
- assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
- writePid(this.pidFile, realPid);
-
- // build and start the locator
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // collect and throw the FIRST failure
- Throwable failure = null;
-
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher, 10*1000, false);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- try {
- // check the status
- final LocatorState locatorState = dirLauncher.status();
- assertNotNull(locatorState);
- assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
-
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- // just in case the launcher started...
- try {
- final LocatorState status = dirLauncher.stop();
- final Status theStatus = status.getStatus();
- assertFalse(theStatus == Status.STARTING);
- assertFalse(theStatus == Status.ONLINE);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- if (failure != null) {
- throw failure;
- }
- } // testStartWithExistingPidFileFails
- */
-
- @Test
- public void testStatusUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for locator to start
- int pid = 0;
- LocatorLauncher pidLauncher = null;
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // validate the status
- final LocatorState actualStatus = pidLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
- assertEquals(jvmArguments, actualStatus.getJvmArguments());
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- if (pidLauncher == null) {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- } else {
- assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
- }
- waitForPidToStop(pid);
- waitForFileToDelete(this.pidFile);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-569: BindException, random ports
- @Test
- public void testStatusUsingWorkingDirectory() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for locator to start
- int pid = 0;
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- assertNotNull(dirLauncher);
- assertFalse(dirLauncher.isRunning());
-
- // validate the status
- final LocatorState actualStatus = dirLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
- assertEquals(jvmArguments, actualStatus.getJvmArguments());
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStatusWithEmptyPidFile() throws Exception {
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile());
-
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- final LocatorState actualStatus = dirLauncher.status();
- assertThat(actualStatus, is(notNullValue()));
- assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
- assertThat(actualStatus.getPid(), is(nullValue()));
- assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
- assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
- assertThat(actualStatus.getClasspath(), is(nullValue()));
- assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
- assertThat(actualStatus.getJavaVersion(), is(nullValue()));
- assertThat(actualStatus.getLogFile(), is(nullValue()));
- assertThat(actualStatus.getHost(), is(nullValue()));
- assertThat(actualStatus.getMemberName(), is(nullValue()));
- }
-
- @Test
- public void testStatusWithNoPidFile() throws Exception {
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- LocatorState locatorState = dirLauncher.status();
- assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
- }
-
- @Test
- public void testStatusWithStalePidFile() throws Exception {
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- final int pid = 0;
- assertFalse(ProcessUtils.isProcessAlive(pid));
- writePid(this.pidFile, pid);
-
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- final LocatorState actualStatus = dirLauncher.status();
- assertThat(actualStatus, is(notNullValue()));
- assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
- assertThat(actualStatus.getPid(), is(nullValue()));
- assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
- assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
- assertThat(actualStatus.getClasspath(), is(nullValue()));
- assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
- assertThat(actualStatus.getJavaVersion(), is(nullValue()));
- assertThat(actualStatus.getLogFile(), is(nullValue()));
- assertThat(actualStatus.getHost(), is(nullValue()));
- assertThat(actualStatus.getMemberName(), is(nullValue()));
- }
-
- @Test
- public void testStopUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
-
- // wait for locator to start
- int pid = 0;
- LocatorLauncher pidLauncher = null;
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // validate the status
- final LocatorState status = pidLauncher.status();
- assertNotNull(status);
- assertEquals(Status.ONLINE, status.getStatus());
- assertEquals(pid, status.getPid().intValue());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- if (pidLauncher == null) {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- } else {
- assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
- }
- waitForPidToStop(pid);
- waitForFileToDelete(pidFile);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-847: random ports, BindException, forks JVM, uses ErrorCollector
- @Test
- public void testStopUsingWorkingDirectory() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for locator to start
- int pid = 0;
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // stop the locator
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForPidToStop(pid);
- assertFalse("PID file still exists!", this.pidFile.exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- public static List<String> getJvmArguments() {
- final List<String> jvmArguments = new ArrayList<String>();
- jvmArguments.add("-Dgemfire.log-level=config");
- return jvmArguments;
- }
-
- /**
- * Used only by {@link LocatorLauncherRemoteJUnitTest#testRunningLocatorOutlivesForkingProcess}
- */
- public static class LocatorLauncherForkingProcess {
-
- public static void main(final String... args) throws FileNotFoundException {
- File file = new File(System.getProperty("user.dir"), LocatorLauncherForkingProcess.class.getSimpleName().concat(".log"));
-
- LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
-
- try {
- final int port = Integer.parseInt(args[0]);
-
- // launch LocatorLauncher
- List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getAbsolutePath());
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add("-Dgemfire.mcast-port=0");
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(LocatorLauncherForkingProcess.class.getSimpleName() + "_Locator");
- command.add("--port=" + port);
- command.add("--redirect-output");
-
- logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
- logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main starting...");
-
- Process forkedProcess = new ProcessBuilder(command).start();
-
- @SuppressWarnings("unused")
- ProcessStreamReader processOutReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getInputStream()).build().start();
- @SuppressWarnings("unused")
- ProcessStreamReader processErrReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getErrorStream()).build().start();
-
- logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main waiting for locator to start...");
-
- waitForLocatorToStart(port, TIMEOUT_MILLISECONDS, 10, true);
-
- logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
-
- System.exit(0);
- }
- catch (Throwable t) {
- logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t);
- System.exit(-1);
- }
- }
- }
-}
[04/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
Posted by kl...@apache.org.
GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
I've removed useless threads and timing loop from the test. It will no longer
time out.
GEODE-1346 Typo "Emtpy" affects Exception name and some help strings
This also removes all unreferenced strings from LocalizedStrings and
removes the no-longer-needed ParentLocalizedStrings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/024cd224
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/024cd224
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/024cd224
Branch: refs/heads/feature/GEODE-1276
Commit: 024cd224ed547e9f59eeaa68f2b5495b05a2665b
Parents: 2da99e7
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Thu May 5 15:15:58 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Thu May 5 15:39:51 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 63 +++++++++++++++++++
.../execute/EmtpyRegionFunctionException.java | 63 -------------------
.../internal/LocatorLoadSnapshotJUnitTest.java | 65 +++-----------------
3 files changed, 73 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/024cd224/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
new file mode 100644
index 0000000..a077779
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+
+/**
+ * Exception to indicate that Region is empty for data aware functions.
+ *
+ * @since 6.5
+ *
+ */
+public class EmptyRegionFunctionException extends FunctionException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmptyRegionFunctionException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * Exception message
+ */
+ public EmptyRegionFunctionException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * the error message
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmptyRegionFunctionException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/024cd224/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
deleted file mode 100644
index 6aff9eb..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.execute;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-
-/**
- * Exception to indicate that Region is empty for data aware functions.
- *
- * @since 6.5
- *
- */
-public class EmtpyRegionFunctionException extends FunctionException {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param cause
- * a Throwable cause of this exception
- */
- public EmtpyRegionFunctionException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * Exception message
- */
- public EmtpyRegionFunctionException(String msg) {
- super(msg);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * the error message
- * @param cause
- * a Throwable cause of this exception
- */
- public EmtpyRegionFunctionException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/024cd224/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
old mode 100644
new mode 100755
index 34ac767..d8a1290
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -257,21 +257,19 @@ public class LocatorLoadSnapshotJUnitTest {
assertEquals(Arrays.asList(new ServerLocation[] {} ), sn.getServersForQueue(null, excludeAll, 3));
}
-
+
/**
- * A basic test of concurrent functionality. Starts a number of
+ * A basic test of concurrent functionality. Simulate a number of
* threads making requests and expects the load to be balanced between
* three servers.
* @throws InterruptedException
*/
- @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
@Test
public void testConcurrentBalancing() throws InterruptedException {
int NUM_THREADS = 50;
final int NUM_REQUESTS = 10000;
int ALLOWED_THRESHOLD = 50; //We should never be off by more than
- //the number of concurrent threads.
-
+
final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
final ServerLocation l1 = new ServerLocation("localhost", 1);
final ServerLocation l2 = new ServerLocation("localhost", 2);
@@ -290,47 +288,18 @@ public class LocatorLoadSnapshotJUnitTest {
loadCounts.put(l2, new AtomicInteger(initialLoad2));
loadCounts.put(l3, new AtomicInteger(initialLoad3));
- Thread[] threads = new Thread[NUM_THREADS];
-// final Object lock = new Object();
for(int i =0; i < NUM_THREADS; i++) {
- threads[i] = new Thread("Thread-" + i) {
- public void run() {
- for(int ii = 0; ii < NUM_REQUESTS; ii++) {
- ServerLocation location;
-// synchronized(lock) {
- location = sn.getServerForConnection(null, Collections.EMPTY_SET);
-// }
- AtomicInteger count = (AtomicInteger) loadCounts.get(location);
- count.incrementAndGet();
- }
- }
- };
- }
-
- for(int i =0; i < NUM_THREADS; i++) {
- threads[i].start();
- }
-
- for(int i =0; i < NUM_THREADS; i++) {
- Thread t = threads[i];
- long ms = 30 * 1000;
- t.join(30 * 1000);
- if (t.isAlive()) {
- for(int j =0; j < NUM_THREADS; j++) {
- threads[j].interrupt();
- }
- fail("Thread did not terminate after " + ms + " ms: " + t);
+ for(int ii = 0; ii < NUM_REQUESTS; ii++) {
+ ServerLocation location;
+ location = sn.getServerForConnection(null, Collections.EMPTY_SET);
+ AtomicInteger count = (AtomicInteger) loadCounts.get(location);
+ count.incrementAndGet();
}
}
- double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
+ double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
NUM_REQUESTS * NUM_THREADS) / (double) loadCounts.size();
-// for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
-// Map.Entry entry = (Entry) itr.next();
-// ServerLocation location = (ServerLocation) entry.getKey();
-// AI count= (AI) entry.getValue();
-// }
-
+
for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Entry) itr.next();
ServerLocation location = (ServerLocation) entry.getKey();
@@ -368,18 +337,4 @@ public class LocatorLoadSnapshotJUnitTest {
assertFalse(sn.hasBalancedConnections("b"));
}
- public void _test2() { // delete this method?
- final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
- sn.addServer(new ServerLocation("hs20h.gemstone.com",28543), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20l.gemstone.com",22385), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20n.gemstone.com",23482), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20m.gemstone.com",23429), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20e.gemstone.com",20154), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20j.gemstone.com",24273), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20g.gemstone.com",27125), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20i.gemstone.com",25201), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20k.gemstone.com",23711), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20f.gemstone.com",21025), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- }
-
}
[35/37] incubator-geode git commit: Merge remote-tracking branch
'origin/develop' into feature/GEODE-1276
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
index 0000000,911bfab..85bfe0a
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
@@@ -1,0 -1,1073 +1,1073 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.hamcrest.CoreMatchers.*;
+ import static org.junit.Assert.*;
+
+ import java.io.File;
+ import java.io.FileWriter;
+ import java.io.PrintWriter;
+ import java.lang.management.ManagementFactory;
+ import java.net.BindException;
+ import java.net.InetAddress;
+
+ import org.junit.After;
+ import org.junit.Before;
+ import org.junit.Ignore;
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
+ import com.gemstone.gemfire.cache.Cache;
+ import com.gemstone.gemfire.cache.DataPolicy;
+ import com.gemstone.gemfire.cache.Scope;
+ import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+ import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+ import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
+ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+ import com.gemstone.gemfire.internal.AvailablePort;
+ import com.gemstone.gemfire.internal.AvailablePortHelper;
+ import com.gemstone.gemfire.internal.GemFireVersion;
+ import com.gemstone.gemfire.internal.SocketCreator;
+ import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
+ import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+ import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+ import com.gemstone.gemfire.internal.process.ProcessType;
+ import com.gemstone.gemfire.internal.process.ProcessUtils;
+ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+ /**
+ * Integration tests for ServerLauncher as a local API in the local JVM.
+ *
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.ServerState
+ * @see com.gemstone.gemfire.internal.AvailablePortHelper
+ * @since 8.0
+ */
+ @Category(IntegrationTest.class)
+ public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpServerLauncherLocalTest() throws Exception {
+ disconnectFromDS();
+ System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
+ }
+
+ @After
+ public final void tearDownServerLauncherLocalTest() throws Exception {
+ disconnectFromDS();
+ }
+
+ protected Status getExpectedStopStatusForNotRunning() {
+ return Status.NOT_RESPONDING;
+ }
+
+ @Test
+ public void testBuilderSetProperties() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ this.launcher = new Builder()
+ .setDisableDefaultServer(true)
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0")
+ .build();
+
+ assertNotNull(this.launcher);
+
+ try {
+ assertEquals(Status.ONLINE, this.launcher.start().getStatus());
+ waitForServerToStart(this.launcher);
+
+ final Cache cache = this.launcher.getCache();
+
+ assertNotNull(cache);
+
+ final DistributedSystem distributedSystem = cache.getDistributedSystem();
+
+ assertNotNull(distributedSystem);
+ assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME));
+ assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME));
+ assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME));
+ assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME));
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ assertNull(this.launcher.getCache());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the Server locally
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+ assertNotNull(this.launcher);
+
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForServerToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // validate stale control files were deleted
+ assertFalse(this.stopRequestFile.exists());
+ assertFalse(this.statusRequestFile.exists());
+ assertFalse(this.statusFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForServerToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47778.
+ */
+ @Test
+ public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ // wait for server to start
+ try {
+ // if start succeeds without throwing exception then #47778 is fixed
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify server did not a port
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47778.
+ */
+ @Test
+ public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ // wait for server to start
+ try {
+ // if start succeeds without throwing exception then #47778 is fixed
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // verify port is still in use
+ this.errorCollector.checkThat(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET), is(equalTo(false)));
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ }/*
+ assertTrue(getUniqueName() + " is broken if PID == Integer.MAX_VALUE", ProcessUtils.identifyPid() != Integer.MAX_VALUE);
+
+ // create existing pid file
+ this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse(realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertTrue(builder.getForce());
+ this.launcher = builder.build();
+ assertTrue(this.launcher.isForcing());
+ this.launcher.start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ try {
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
++ assertIndexDetailsEquals(getPid(), pid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
++ assertIndexDetailsEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartUsingForceOverwritesExistingPidFile
+ */
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
+ // verifies part of the fix for #47664
+
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate two free ports
+ final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
+
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer().setPort(freeTCPPorts[0]);
+
+ File cacheXmlFile = this.temporaryFolder.newFile(getUniqueName() + ".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ System.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlFile.getCanonicalPath());
+
+ // start server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setServerPort(freeTCPPorts[1])
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+ this.launcher.start();
+
+ // wait for server to start up
+ try {
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify server used --server-port instead of default or port in cache.xml
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
+ assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ final int port = Integer.valueOf(portString);
+ assertEquals("Port should be " + freeTCPPorts[1] + " instead of " + port, freeTCPPorts[1], port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ assertFalse("PID file still exists!", pidFile.exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer();
+
+ File cacheXmlFile = this.temporaryFolder.newFile(getUniqueName() + ".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ System.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlFile.getCanonicalPath());
+
+ // start server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setServerPort(this.serverPort)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+ this.launcher.start();
+
+ // wait for server to start up
+ try {
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify server used --server-port instead of default
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final int port = Integer.valueOf( this.launcher.status().getPort());
+ assertEquals("Port should be " + this.serverPort + " instead of " + port, this.serverPort, port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+
+ // why did it not fail like it's supposed to?
+ final String property = System.getProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY);
+ assertNotNull(property);
+ assertEquals(this.serverPort, Integer.valueOf(property).intValue());
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ fail("Server port is " + this.launcher.getCache().getCacheServers().get(0).getPort());
+ fail("ServerLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException text varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ // create existing pid file
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+
+ this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+ writePid(this.pidFile, realPid);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+ RuntimeException expected = null;
+
+ try {
+ this.launcher.start();
+ fail("ServerLauncher start should have thrown RuntimeException caused by FileAlreadyExistsException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ assertTrue(expected.getMessage().contains("A PID file already exists and a Server may be running in"));
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof FileAlreadyExistsException);
+ assertTrue(cause.getMessage().contains("Pid file already exists: "));
+ assertTrue(cause.getMessage().contains("vf.gf.server.pid for process " + realPid));
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ delete(this.pidFile);
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ /**
+ * Confirms fix for #47665.
+ */
+ @Test
+ public void testStartUsingServerPortInUseFails() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
+ final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setServerPort(freeTCPPort)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+ fail("ServerLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher pidLauncher = null;
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ final ServerState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (pidLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ final ServerState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (dirLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher pidLauncher = null;
+
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // stop the server
+ final ServerState serverState = pidLauncher.stop();
+ assertNotNull(serverState);
+ assertEquals(Status.STOPPED, serverState.getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // stop the server
+ final ServerState serverState = dirLauncher.stop();
+ assertNotNull(serverState);
+ assertEquals(Status.STOPPED, serverState.getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
[28/37] incubator-geode git commit: Revert "GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
Posted by kl...@apache.org.
Revert "GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
This reverts commit 024cd224ed547e9f59eeaa68f2b5495b05a2665b.
After discussion with Bruce, reverting these changes to fix the build
for now.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/96661291
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/96661291
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/96661291
Branch: refs/heads/feature/GEODE-1276
Commit: 966612915e6e68359fae7cf5f78c8addaadf435f
Parents: a35cca3
Author: Dan Smith <up...@apache.org>
Authored: Thu May 5 16:38:12 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 5 16:38:46 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 63 -------------------
.../execute/EmtpyRegionFunctionException.java | 63 +++++++++++++++++++
.../internal/LocatorLoadSnapshotJUnitTest.java | 65 +++++++++++++++++---
3 files changed, 118 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/96661291/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
deleted file mode 100644
index a077779..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.execute;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-
-/**
- * Exception to indicate that Region is empty for data aware functions.
- *
- * @since 6.5
- *
- */
-public class EmptyRegionFunctionException extends FunctionException {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param cause
- * a Throwable cause of this exception
- */
- public EmptyRegionFunctionException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * Exception message
- */
- public EmptyRegionFunctionException(String msg) {
- super(msg);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * the error message
- * @param cause
- * a Throwable cause of this exception
- */
- public EmptyRegionFunctionException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/96661291/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
new file mode 100644
index 0000000..6aff9eb
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+
+/**
+ * Exception to indicate that Region is empty for data aware functions.
+ *
+ * @since 6.5
+ *
+ */
+public class EmtpyRegionFunctionException extends FunctionException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmtpyRegionFunctionException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * Exception message
+ */
+ public EmtpyRegionFunctionException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * the error message
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmtpyRegionFunctionException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/96661291/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
old mode 100755
new mode 100644
index d8a1290..34ac767
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -257,19 +257,21 @@ public class LocatorLoadSnapshotJUnitTest {
assertEquals(Arrays.asList(new ServerLocation[] {} ), sn.getServersForQueue(null, excludeAll, 3));
}
-
+
/**
- * A basic test of concurrent functionality. Simulate a number of
+ * A basic test of concurrent functionality. Starts a number of
* threads making requests and expects the load to be balanced between
* three servers.
* @throws InterruptedException
*/
+ @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
@Test
public void testConcurrentBalancing() throws InterruptedException {
int NUM_THREADS = 50;
final int NUM_REQUESTS = 10000;
int ALLOWED_THRESHOLD = 50; //We should never be off by more than
-
+ //the number of concurrent threads.
+
final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
final ServerLocation l1 = new ServerLocation("localhost", 1);
final ServerLocation l2 = new ServerLocation("localhost", 2);
@@ -288,18 +290,47 @@ public class LocatorLoadSnapshotJUnitTest {
loadCounts.put(l2, new AtomicInteger(initialLoad2));
loadCounts.put(l3, new AtomicInteger(initialLoad3));
+ Thread[] threads = new Thread[NUM_THREADS];
+// final Object lock = new Object();
for(int i =0; i < NUM_THREADS; i++) {
- for(int ii = 0; ii < NUM_REQUESTS; ii++) {
- ServerLocation location;
- location = sn.getServerForConnection(null, Collections.EMPTY_SET);
- AtomicInteger count = (AtomicInteger) loadCounts.get(location);
- count.incrementAndGet();
+ threads[i] = new Thread("Thread-" + i) {
+ public void run() {
+ for(int ii = 0; ii < NUM_REQUESTS; ii++) {
+ ServerLocation location;
+// synchronized(lock) {
+ location = sn.getServerForConnection(null, Collections.EMPTY_SET);
+// }
+ AtomicInteger count = (AtomicInteger) loadCounts.get(location);
+ count.incrementAndGet();
+ }
+ }
+ };
+ }
+
+ for(int i =0; i < NUM_THREADS; i++) {
+ threads[i].start();
+ }
+
+ for(int i =0; i < NUM_THREADS; i++) {
+ Thread t = threads[i];
+ long ms = 30 * 1000;
+ t.join(30 * 1000);
+ if (t.isAlive()) {
+ for(int j =0; j < NUM_THREADS; j++) {
+ threads[j].interrupt();
+ }
+ fail("Thread did not terminate after " + ms + " ms: " + t);
}
}
- double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
+ double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
NUM_REQUESTS * NUM_THREADS) / (double) loadCounts.size();
-
+// for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
+// Map.Entry entry = (Entry) itr.next();
+// ServerLocation location = (ServerLocation) entry.getKey();
+// AI count= (AI) entry.getValue();
+// }
+
for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Entry) itr.next();
ServerLocation location = (ServerLocation) entry.getKey();
@@ -337,4 +368,18 @@ public class LocatorLoadSnapshotJUnitTest {
assertFalse(sn.hasBalancedConnections("b"));
}
+ public void _test2() { // delete this method?
+ final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
+ sn.addServer(new ServerLocation("hs20h.gemstone.com",28543), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20l.gemstone.com",22385), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20n.gemstone.com",23482), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20m.gemstone.com",23429), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20e.gemstone.com",20154), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20j.gemstone.com",24273), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20g.gemstone.com",27125), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20i.gemstone.com",25201), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20k.gemstone.com",23711), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20f.gemstone.com",21025), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ }
+
}
[37/37] incubator-geode git commit: Merge remote-tracking branch
'origin/develop' into feature/GEODE-1276
Posted by kl...@apache.org.
Merge remote-tracking branch 'origin/develop' into feature/GEODE-1276
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7ce7ddc0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7ce7ddc0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7ce7ddc0
Branch: refs/heads/feature/GEODE-1276
Commit: 7ce7ddc0401a4c53eefde7cc3236dd4a248ad1f2
Parents: d0f925c 4ad4d63
Author: Kirk Lund <kl...@pivotal.io>
Authored: Fri May 6 11:30:09 2016 -0700
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Fri May 6 11:30:09 2016 -0700
----------------------------------------------------------------------
.../LocatorLauncherAssemblyIntegrationTest.java | 155 ++
.../LocatorLauncherAssemblyJUnitTest.java | 156 --
.../SharedConfigurationEndToEndDUnitTest.java | 311 ++--
.../gemfire/cache/execute/Function.java | 17 +-
.../gemfire/cache/execute/FunctionAdapter.java | 87 +-
.../cache/operations/OperationContext.java | 4 -
.../internal/SharedConfiguration.java | 532 +++----
.../cache/execute/FunctionAdapterJUnitTest.java | 65 +
.../AbstractLauncherIntegrationJUnitTest.java | 71 -
.../AbstractLauncherIntegrationTest.java | 71 +
.../AbstractLauncherIntegrationTestCase.java | 254 ++++
.../distributed/AbstractLauncherJUnitTest.java | 298 ----
.../AbstractLauncherJUnitTestCase.java | 254 ----
.../AbstractLauncherServiceStatusJUnitTest.java | 259 ----
.../AbstractLauncherServiceStatusTest.java | 259 ++++
.../distributed/AbstractLauncherTest.java | 298 ++++
...tractLocatorLauncherIntegrationTestCase.java | 117 ++
.../AbstractLocatorLauncherJUnitTestCase.java | 105 --
...ocatorLauncherRemoteIntegrationTestCase.java | 67 +
...stractServerLauncherIntegrationTestCase.java | 95 ++
.../AbstractServerLauncherJUnitTestCase.java | 93 --
...ServerLauncherRemoteIntegrationTestCase.java | 95 ++
.../distributed/DistributedTestSuite.java | 35 -
.../distributed/HostedLocatorsDUnitTest.java | 30 +-
.../LauncherMemberMXBeanIntegrationTest.java | 151 ++
.../LauncherMemberMXBeanJUnitTest.java | 152 --
.../gemfire/distributed/LauncherTestSuite.java | 47 -
.../gemfire/distributed/LocatorJUnitTest.java | 67 +-
.../LocatorLauncherIntegrationJUnitTest.java | 248 ---
.../LocatorLauncherIntegrationTest.java | 248 +++
.../distributed/LocatorLauncherJUnitTest.java | 340 -----
...LocatorLauncherLocalFileIntegrationTest.java | 54 +
.../LocatorLauncherLocalFileJUnitTest.java | 51 -
.../LocatorLauncherLocalIntegrationTest.java | 827 ++++++++++
.../LocatorLauncherLocalJUnitTest.java | 842 -----------
...ocatorLauncherRemoteFileIntegrationTest.java | 218 +++
.../LocatorLauncherRemoteFileJUnitTest.java | 218 ---
.../LocatorLauncherRemoteIntegrationTest.java | 977 ++++++++++++
.../LocatorLauncherRemoteJUnitTest.java | 1011 -------------
...rRemoteWithCustomLoggingIntegrationTest.java | 124 ++
.../distributed/LocatorLauncherTest.java | 340 +++++
.../distributed/LocatorStateJUnitTest.java | 222 ---
.../gemfire/distributed/LocatorStateTest.java | 222 +++
.../MockServerLauncherCacheProvider.java | 8 +-
.../ServerLauncherIntegrationJUnitTest.java | 312 ----
.../ServerLauncherIntegrationTest.java | 311 ++++
.../distributed/ServerLauncherJUnitTest.java | 894 -----------
.../ServerLauncherLocalFileIntegrationTest.java | 54 +
.../ServerLauncherLocalFileJUnitTest.java | 54 -
.../ServerLauncherLocalIntegrationTest.java | 1073 +++++++++++++
.../ServerLauncherLocalJUnitTest.java | 1073 -------------
...ServerLauncherRemoteFileIntegrationTest.java | 222 +++
.../ServerLauncherRemoteFileJUnitTest.java | 222 ---
.../ServerLauncherRemoteIntegrationTest.java | 1380 +++++++++++++++++
.../ServerLauncherRemoteJUnitTest.java | 1430 ------------------
...rRemoteWithCustomLoggingIntegrationTest.java | 122 ++
.../gemfire/distributed/ServerLauncherTest.java | 894 +++++++++++
...rverLauncherWithProviderIntegrationTest.java | 89 ++
.../ServerLauncherWithProviderJUnitTest.java | 90 --
.../gemstone/gemfire/internal/ClassBuilder.java | 2 +-
.../cache/execute/FunctionServiceBase.java | 287 ++++
.../FunctionServiceLocalPRDUnitTest.java | 54 +
.../FunctionServiceLocalRRDUnitTest.java | 52 +
...unctionServiceMultipleOnMemberDUnitTest.java | 57 +
.../FunctionServicePeerAccessorPRDUnitTest.java | 73 +
.../FunctionServicePeerAccessorRRDUnitTest.java | 63 +
.../FunctionServiceSingleOnMemberDUnitTest.java | 49 +
.../logging/log4j/custom/BasicAppender.java | 76 +
.../CustomConfigWithCacheIntegrationTest.java | 148 ++
...stomConfigWithLogServiceIntegrationTest.java | 119 ++
.../log4j/custom/CustomConfiguration.java | 64 +
...leProcessControllerIntegrationJUnitTest.java | 13 +-
.../management/internal/cli/HeadlessGfsh.java | 23 +-
.../cli/HeadlessGfshIntegrationTest.java | 90 ++
.../internal/cli/HeadlessGfshJUnitTest.java | 85 --
.../cli/commands/CliCommandTestBase.java | 36 +-
.../cli/commands/ConfigCommandsDUnitTest.java | 8 +-
.../ConnectCommandWithHttpAndSSLDUnitTest.java | 305 ++++
...eateAlterDestroyRegionCommandsDUnitTest.java | 6 -
.../cli/commands/DeployCommandsDUnitTest.java | 59 +-
.../commands/DiskStoreCommandsDUnitTest.java | 5 -
.../cli/commands/FunctionCommandsDUnitTest.java | 8 +-
.../commands/GemfireDataCommandsDUnitTest.java | 5 -
...WithCacheLoaderDuringCacheMissDUnitTest.java | 162 +-
.../cli/commands/IndexCommandsDUnitTest.java | 8 +-
...stAndDescribeDiskStoreCommandsDUnitTest.java | 121 +-
.../ListAndDescribeRegionDUnitTest.java | 5 -
.../cli/commands/ListIndexCommandDUnitTest.java | 123 +-
.../MiscellaneousCommandsDUnitTest.java | 8 +-
...laneousCommandsExportLogsPart1DUnitTest.java | 8 +-
...laneousCommandsExportLogsPart2DUnitTest.java | 9 +-
...laneousCommandsExportLogsPart3DUnitTest.java | 10 +-
...laneousCommandsExportLogsPart4DUnitTest.java | 8 +-
.../cli/commands/QueueCommandsDUnitTest.java | 8 +-
.../SharedConfigurationCommandsDUnitTest.java | 288 ++--
.../cli/commands/ShellCommandsDUnitTest.java | 10 +-
.../cli/commands/ShowMetricsDUnitTest.java | 8 +-
.../cli/commands/ShowStackTraceDUnitTest.java | 8 +-
.../cli/commands/UserCommandsDUnitTest.java | 10 +-
.../SharedConfigurationDUnitTest.java | 227 ++-
.../SharedConfigurationTestUtils.java | 40 +
.../SharedConfigurationUsingDirDUnitTest.java | 128 +-
.../security/GfshCommandsSecurityTest.java | 17 +-
.../security/GfshShellConnectionRule.java | 8 +-
.../logging/log4j/custom/log4j2-custom.xml | 27 +
.../pulse/internal/data/JMXDataUpdater.java | 3 -
.../cache/wan/Simple2CacheServerDUnitTest.java | 24 +-
.../wan/wancommand/WANCommandTestBase.java | 2 +-
.../ClusterConfigurationDUnitTest.java | 1236 ++++++++-------
gradle/dependency-versions.properties | 8 +-
110 files changed, 11939 insertions(+), 10577 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
index 0000000,c741def..940802f
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
@@@ -1,0 -1,264 +1,259 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.junit.Assert.*;
+
+ import java.io.File;
+ import java.io.IOException;
+ import java.lang.management.ManagementFactory;
+ import java.net.InetAddress;
-import java.net.UnknownHostException;
+ import java.util.Arrays;
+ import java.util.List;
+
++import org.junit.After;
+ import org.junit.Before;
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
-import com.gemstone.gemfire.distributed.AbstractLauncherServiceStatusTest.TestLauncher.TestState;
+ import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.process.PidUnavailableException;
+ import com.gemstone.gemfire.internal.process.ProcessUtils;
+ import com.gemstone.gemfire.management.internal.cli.json.GfJsonArray;
+ import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
+ import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
+ import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+ /**
+ * Tests marshaling of ServiceStatus to and from JSON.
+ *
+ * @since 7.0
+ */
+ @Category(UnitTest.class)
+ public class AbstractLauncherServiceStatusTest {
+
- private static final String SERVICE_NAME = "Test";
- private static final InetAddress HOST = getLocalHost();
- private static final int PORT = 12345;
- private static final String NAME = AbstractLauncherServiceStatusTest.class.getSimpleName();
- private static final int PID = identifyPid();
- private static final long UPTIME = 123456789;
- private static final String WORKING_DIRECTORY = identifyWorkingDirectory();
- private static final List<String> JVM_ARGUMENTS = ManagementFactory.getRuntimeMXBean().getInputArguments();
- private static final String CLASSPATH = ManagementFactory.getRuntimeMXBean().getClassPath();
- private static final String GEMFIRE_VERSION = GemFireVersion.getGemFireVersion();
- private static final String JAVA_VERSION = System.getProperty("java.version");
++ private static String serviceName;
++ private static InetAddress host;
++ private static int port;
++ private static String name;
++ private static int pid;
++ private static long uptime;
++ private static String workingDirectory;
++ private static List<String> jvmArguments;
++ private static String classpath;
++ private static String gemfireVersion;
++ private static String javaVersion;
+
+ private TestLauncher launcher;
+
+ @Before
- public void setUp() {
- this.launcher = new TestLauncher(HOST, PORT, NAME);
++ public void setUp() throws Exception {
++ serviceName = "Test";
++ port = 12345;
++ host = InetAddress.getLocalHost();
++ pid = ProcessUtils.identifyPid();
++ uptime = 123456789;
++ name = AbstractLauncherServiceStatusTest.class.getSimpleName();
++ workingDirectory = new File(System.getProperty("user.dir")).getAbsolutePath();
++ jvmArguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
++ classpath = ManagementFactory.getRuntimeMXBean().getClassPath();
++ gemfireVersion = GemFireVersion.getGemFireVersion();
++ javaVersion = System.getProperty("java.version");
++
++ this.launcher = new TestLauncher(host, port, name);
++ }
++
++ @After
++ public void tearDown() throws Exception {
++ serviceName = null;
++ host = null;
++ name = null;
++ workingDirectory = null;
++ jvmArguments = null;
++ classpath = null;
++ gemfireVersion = null;
++ javaVersion = null;
+ }
+
+ @Test
+ public void testMarshallingTestStatusToAndFromJson() {
- final TestState status = this.launcher.status();
++ final TestLauncher.TestState status = this.launcher.status();
+ final String json = status.toJson();
+ validateJson(status, json);
- validateStatus(status, TestState.fromJson(json));
++ validateStatus(status, TestLauncher.TestState.fromJson(json));
+ }
+
- private void validateStatus(final TestState expected, final TestState actual) {
++ private void validateStatus(final TestLauncher.TestState expected, final TestLauncher.TestState actual) {
+ assertEquals(expected.getClasspath(), actual.getClasspath());
+ assertEquals(expected.getGemFireVersion(), actual.getGemFireVersion());
+ assertEquals(expected.getJavaVersion(), actual.getJavaVersion());
+ assertEquals(expected.getJvmArguments(), actual.getJvmArguments());
+ assertEquals(expected.getPid(), actual.getPid());
+ assertEquals(expected.getStatus(), actual.getStatus());
+ assertEquals(expected.getTimestamp(), actual.getTimestamp());
+ assertEquals(expected.getUptime(), actual.getUptime());
+ assertEquals(expected.getWorkingDirectory(), actual.getWorkingDirectory());
+ assertEquals(expected.getHost(), actual.getHost());
+ assertEquals(expected.getPort(), actual.getPort());
+ assertEquals(expected.getMemberName(), actual.getMemberName());
+ }
+
- private void validateJson(final TestState expected, final String json) {
- final TestState actual = TestState.fromJson(json);
++ private void validateJson(final TestLauncher.TestState expected, final String json) {
++ final TestLauncher.TestState actual = TestLauncher.TestState.fromJson(json);
+ validateStatus(expected, actual);
+ }
+
- private static int identifyPid() {
- try {
- return ProcessUtils.identifyPid();
- }
- catch (PidUnavailableException e) {
- return 0;
- }
- }
-
- private static String identifyWorkingDirectory() {
- try {
- return new File(System.getProperty("user.dir")).getCanonicalPath();
- }
- catch (IOException e) {
- return new File(System.getProperty("user.dir")).getAbsolutePath();
- }
- }
-
- private static InetAddress getLocalHost() {
- try {
- return InetAddress.getLocalHost();
- }
- catch (UnknownHostException e) {
- return null;
- }
- }
-
- static class TestLauncher extends AbstractLauncher<String> {
++ private static class TestLauncher extends AbstractLauncher<String> {
+
+ private final InetAddress bindAddress;
+ private final int port;
+ private final String memberName;
+ private final File logFile;
+
+ TestLauncher(InetAddress bindAddress,
+ int port,
+ String memberName) {
+ this.bindAddress = bindAddress;
+ this.port = port;
+ this.memberName = memberName;
+ this.logFile = new File(memberName + ".log");
+ }
+
+ public TestState status() {
+ return new TestState(Status.ONLINE,
+ null,
+ System.currentTimeMillis(),
+ getId(),
- PID,
- UPTIME,
- WORKING_DIRECTORY,
- JVM_ARGUMENTS,
- CLASSPATH,
- GEMFIRE_VERSION,
- JAVA_VERSION,
++ pid,
++ uptime,
++ workingDirectory,
++ jvmArguments,
++ classpath,
++ gemfireVersion,
++ javaVersion,
+ getLogFileName(),
+ getBindAddressAsString(),
+ getPortAsString(),
- NAME);
++ name);
+ }
+
+ @Override
+ public void run() {
+ }
+
+ public String getId() {
+ return getServiceName() + "@" + getBindAddress() + "[" + getPort() + "]";
+ }
+
+ @Override
+ public String getLogFileName() {
+ try {
+ return this.logFile.getCanonicalPath();
+ }
+ catch (IOException e) {
+ return this.logFile.getAbsolutePath();
+ }
+ }
+
+ @Override
+ public String getMemberName() {
+ return this.memberName;
+ }
+
+ @Override
+ public Integer getPid() {
+ return null;
+ }
+
+ @Override
+ public String getServiceName() {
- return SERVICE_NAME;
++ return serviceName;
+ }
+
+ InetAddress getBindAddress() {
+ return this.bindAddress;
+ }
+
+ String getBindAddressAsString() {
+ return this.bindAddress.getCanonicalHostName();
+ }
+
+ int getPort() {
+ return this.port;
+ }
+
+ String getPortAsString() {
+ return String.valueOf(getPort());
+ }
+
- public static class TestState extends ServiceState<String> {
++ private static class TestState extends ServiceState<String> {
+
+ protected static TestState fromJson(final String json) {
+ try {
+ final GfJsonObject gfJsonObject = new GfJsonObject(json);
+
+ final Status status = Status.valueOfDescription(gfJsonObject.getString(JSON_STATUS));
+ final List<String> jvmArguments =
+ Arrays.asList(GfJsonArray.toStringArray(gfJsonObject.getJSONArray(JSON_JVMARGUMENTS)));
+
+ return new TestState(status,
+ gfJsonObject.getString(JSON_STATUSMESSAGE),
+ gfJsonObject.getLong(JSON_TIMESTAMP),
+ gfJsonObject.getString(JSON_LOCATION),
+ gfJsonObject.getInt(JSON_PID),
+ gfJsonObject.getLong(JSON_UPTIME),
+ gfJsonObject.getString(JSON_WORKINGDIRECTORY),
+ jvmArguments,
+ gfJsonObject.getString(JSON_CLASSPATH),
+ gfJsonObject.getString(JSON_GEMFIREVERSION),
+ gfJsonObject.getString(JSON_JAVAVERSION),
+ gfJsonObject.getString(JSON_LOGFILE),
+ gfJsonObject.getString(JSON_HOST),
+ gfJsonObject.getString(JSON_PORT),
+ gfJsonObject.getString(JSON_MEMBERNAME));
+ }
+ catch (GfJsonException e) {
+ throw new IllegalArgumentException("Unable to create TestState from JSON: " + json);
+ }
+ }
+
+ protected TestState(final Status status,
+ final String statusMessage,
+ final long timestamp,
+ final String location,
+ final Integer pid,
+ final Long uptime,
+ final String workingDirectory,
+ final List<String> jvmArguments,
+ final String classpath,
+ final String gemfireVersion,
+ final String javaVersion,
+ final String logFile,
+ final String host,
+ final String port,
+ final String name) {
+ super(status, statusMessage, timestamp, location, pid, uptime, workingDirectory, jvmArguments, classpath,
+ gemfireVersion, javaVersion, logFile, host, port, name);
+ }
+
+ @Override
+ protected String getServiceName() {
- return SERVICE_NAME;
++ return serviceName;
+ }
+ }
+ }
+
+ }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
index 0000000,cabb5ff..0ebd4b6
mode 000000,100644..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
@@@ -1,0 -1,298 +1,298 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.junit.Assert.*;
+
+ import java.net.MalformedURLException;
+ import java.net.URL;
+ import java.util.Properties;
+ import java.util.concurrent.TimeUnit;
+
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
+ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+ import com.gemstone.gemfire.internal.lang.StringUtils;
+ import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+ /**
+ * The AbstractLauncherTest class is a test suite of unit tests testing the contract and functionality
+ * of the AbstractLauncher class.
+ * <p/>
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since 7.0
+ */
+ @Category(UnitTest.class)
+ public class AbstractLauncherTest {
+
- protected AbstractLauncher<?> createAbstractLauncher(final String memberName, final String memberId) {
++ private AbstractLauncher<?> createAbstractLauncher(final String memberName, final String memberId) {
+ return new FakeServiceLauncher(memberName, memberId);
+ }
+
+ @Test
+ public void testIsAttachAPINotFound() {
+ final AbstractLauncher<?> launcher = createAbstractLauncher("012", "TestMember");
+
+ assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+ "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException")));
+ assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
+ "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
+ assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+ "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/tools/attach/AgentNotSupportedException")));
+ assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
+ "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
+ assertFalse(launcher.isAttachAPINotFound(new IllegalArgumentException(
+ "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
+ assertFalse(launcher.isAttachAPINotFound(new IllegalStateException(
+ "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
+ assertFalse(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+ "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/companyx/app/service/MyServiceClass")));
+ assertFalse(launcher.isAttachAPINotFound(new ClassNotFoundException(
+ "Caused by: java.lang.ClassNotFoundException: com.companyx.app.attach.NutsNotAttachedException")));
+ }
+
+ @Test
+ public void testIsSet() {
+ final Properties properties = new Properties();
+
+ assertFalse(properties.containsKey(DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+ properties.setProperty(DistributionConfig.NAME_NAME, "");
+
+ assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+ properties.setProperty(DistributionConfig.NAME_NAME, " ");
+
+ assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+ properties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
+
+ assertTrue(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, "NaMe"));
+ }
+
+ @Test
+ public void testLoadGemFirePropertiesWithNullURL() {
+ final Properties properties = AbstractLauncher.loadGemFireProperties(null);
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ }
+
+ @Test
+ public void testLoadGemFirePropertiesWithNonExistingURL() throws MalformedURLException {
+ final Properties properties = AbstractLauncher.loadGemFireProperties(new URL("file:///path/to/non_existing/gemfire.properties"));
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ }
+
+ @Test
+ public void testGetDistributedSystemProperties() {
+ AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "1");
+
+ assertNotNull(launcher);
+ assertEquals("1", launcher.getMemberId());
+ assertEquals("memberOne", launcher.getMemberName());
+
+ Properties distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertTrue(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+ assertEquals("memberOne", distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
+
+ launcher = createAbstractLauncher(null, "22");
+
+ assertNotNull(launcher);
+ assertEquals("22", launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+
+ distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+
+ launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
+
+ assertNotNull(launcher);
+ assertEquals("333", launcher.getMemberId());
+ assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+
+ distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+
+ launcher = createAbstractLauncher(" ", "4444");
+
+ assertNotNull(launcher);
+ assertEquals("4444", launcher.getMemberId());
+ assertEquals(" ", launcher.getMemberName());
+
+ distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+ }
+
+ @Test
+ public void testGetDistributedSystemPropertiesWithDefaults() {
+ AbstractLauncher<?> launcher = createAbstractLauncher("TestMember", "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals("TestMember", launcher.getMemberName());
+
+ Properties defaults = new Properties();
+
+ defaults.setProperty("testKey", "testValue");
+
+ Properties distributedSystemProperties = launcher.getDistributedSystemProperties(defaults);
+
+ assertNotNull(distributedSystemProperties);
+ assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
+ assertEquals("testValue", distributedSystemProperties.getProperty("testKey"));
+ }
+
+ @Test
+ public void testGetMember() {
+ AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals("memberOne", launcher.getMemberName());
+ assertEquals("memberOne", launcher.getMember());
+
+ launcher = createAbstractLauncher(null, "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+ assertEquals("123", launcher.getMember());
+
+ launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+ assertEquals("123", launcher.getMember());
+
+ launcher = createAbstractLauncher(" ", "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals(" ", launcher.getMemberName());
+ assertEquals("123", launcher.getMember());
+
+ launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
+
+ assertNotNull(launcher);
+ assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+ assertNull(launcher.getMember());
+
+ launcher = createAbstractLauncher(null, " ");
+
+ assertNotNull(launcher);
+ assertEquals(" ", launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+ assertNull(launcher.getMember());
+ }
+
+ @Test
+ public void testAbstractLauncherServiceStateToDaysHoursMinutesSeconds() {
+ assertEquals("", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(null));
+ assertEquals("0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(0l));
+ assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1000l));
+ assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1999l));
+ assertEquals("2 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(2001l));
+ assertEquals("45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(45000l));
+ assertEquals("1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 1000l));
+ assertEquals("1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(61 * 1000l));
+ assertEquals("1 minute 30 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(90 * 1000l));
+ assertEquals("2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(120 * 1000l));
+ assertEquals("2 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(121 * 1000l));
+ assertEquals("2 minutes 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(135 * 1000l));
+ assertEquals("1 hour 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l));
+ assertEquals("1 hour 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 1000l));
+ assertEquals("1 hour 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 15000l));
+ assertEquals("1 hour 1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l));
+ assertEquals("1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 1000l));
+ assertEquals("1 hour 1 minute 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 45000l));
+ assertEquals("1 hour 2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 62 * 1000l));
+ assertEquals("1 hour 5 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 1000l));
+ assertEquals("1 hour 5 minutes 10 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 10000l));
+ assertEquals("1 hour 59 minutes 11 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 119 * 1000l + 11000l));
+ assertEquals("1 day 1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+ TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(1) + TimeUnit.SECONDS.toMillis(1)));
+ assertEquals("1 day 5 hours 15 minutes 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+ TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(5) + TimeUnit.MINUTES.toMillis(15) + TimeUnit.SECONDS.toMillis(45)));
+ assertEquals("2 days 1 hour 30 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+ TimeUnit.DAYS.toMillis(2) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(30) + TimeUnit.SECONDS.toMillis(1)));
+ }
+
- protected static final class FakeServiceLauncher extends AbstractLauncher<String> {
++ private static final class FakeServiceLauncher extends AbstractLauncher<String> {
+
+ private final String memberId;
+ private final String memberName;
+
+ public FakeServiceLauncher(final String memberName, final String memberId) {
+ this.memberId = memberId;
+ this.memberName = memberName;
+ }
+
+ @Override
+ boolean isAttachAPIOnClasspath() {
+ return false;
+ }
+
+ @Override
+ public String getLogFileName() {
+ throw new UnsupportedOperationException("Not Implemented!");
+ }
+
+ @Override
+ public String getMemberId() {
+ return memberId;
+ }
+
+ @Override
+ public String getMemberName() {
+ return memberName;
+ }
+
+ @Override
+ public Integer getPid() {
+ throw new UnsupportedOperationException("Not Implemented!");
+ }
+
+ @Override
+ public String getServiceName() {
+ return "TestService";
+ }
+
+ @Override
+ public void run() {
+ throw new UnsupportedOperationException("Not Implemented!");
+ }
+ }
+
+ }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
index 0000000,252b5aa..897d0fa
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
@@@ -1,0 -1,827 +1,827 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.junit.Assert.*;
+
+ import java.io.File;
+ import java.lang.management.ManagementFactory;
+ import java.net.BindException;
+ import java.net.InetAddress;
+
+ import org.junit.After;
+ import org.junit.Before;
+ import org.junit.Ignore;
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
+ import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+ import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+ import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+ import com.gemstone.gemfire.distributed.internal.InternalLocator;
+ import com.gemstone.gemfire.internal.AvailablePort;
+ import com.gemstone.gemfire.internal.AvailablePortHelper;
+ import com.gemstone.gemfire.internal.DistributionLocator;
+ import com.gemstone.gemfire.internal.GemFireVersion;
+ import com.gemstone.gemfire.internal.SocketCreator;
+ import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+ import com.gemstone.gemfire.internal.process.ProcessType;
+ import com.gemstone.gemfire.internal.process.ProcessUtils;
+ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+ /**
+ * Tests usage of LocatorLauncher as a local API in existing JVM.
+ *
+ * @since 8.0
+ */
+ @Category(IntegrationTest.class)
+ public class LocatorLauncherLocalIntegrationTest extends AbstractLocatorLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpLocatorLauncherLocalIntegrationTest() throws Exception {
+ disconnectFromDS();
+ System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
+ }
+
+ @After
+ public final void tearDownLocatorLauncherLocalIntegrationTest() throws Exception {
+ disconnectFromDS();
+ }
+
+ @Test
+ public void testBuilderSetProperties() throws Throwable {
+ this.launcher = new Builder()
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0")
+ .build();
+
+ try {
+ assertEquals(Status.ONLINE, this.launcher.start().getStatus());
+ waitForLocatorToStart(this.launcher, true);
+
+ final InternalLocator locator = this.launcher.getLocator();
+ assertNotNull(locator);
+
+ final DistributedSystem distributedSystem = locator.getDistributedSystem();
+
+ assertNotNull(distributedSystem);
+ assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME));
+ assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME));
+ assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME));
+ assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME));
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ assertNull(this.launcher.getLocator());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForLocatorToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // validate stale control files were deleted
+ assertFalse(stopRequestFile.exists());
+ assertFalse(statusRequestFile.exists());
+ assertFalse(statusFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForLocatorToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ }/*
+ assertTrue(getUniqueName() + " is broken if PID == Integer.MAX_VALUE", ProcessUtils.identifyPid() != Integer.MAX_VALUE);
+
+ // create existing pid file
+ this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse(realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertTrue(builder.getForce());
+ this.launcher = builder.build();
+ assertTrue(this.launcher.isForcing());
+ this.launcher.start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
++ assertIndexDetailsEquals(getPid(), pid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
++ assertIndexDetailsEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartUsingForceOverwritesExistingPidFile
+ */
+
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
+ assertTrue(this.socket.isBound());
+ assertFalse(this.socket.isClosed());
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+
+ assertNotNull(System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY));
+ assertEquals(this.locatorPort, Integer.valueOf(System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY)).intValue());
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ assertEquals(this.locatorPort, this.launcher.getPort().intValue());
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+
+ // why did it not fail like it's supposed to?
+ final String property = System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY);
+ assertNotNull(property);
+ assertEquals(this.locatorPort, Integer.valueOf(property).intValue());
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+ assertEquals(this.locatorPort, this.launcher.getPort().intValue());
+ assertEquals(this.locatorPort, this.socket.getLocalPort());
+ assertTrue(this.socket.isBound());
+ assertFalse(this.socket.isClosed());
+
+ fail("LocatorLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException text varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ // create existing pid file
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+
+ this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+ writePid(this.pidFile, realPid);
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+ RuntimeException expected = null;
+
+ try {
+ this.launcher.start();
+ fail("LocatorLauncher start should have thrown RuntimeException caused by FileAlreadyExistsException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ assertTrue(expected.getMessage(), expected.getMessage().contains("A PID file already exists and a Locator may be running in"));
- assertEquals(RuntimeException.class, expected.getClass());
++ assertIndexDetailsEquals(RuntimeException.class, expected.getClass());
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof FileAlreadyExistsException);
+ assertTrue(cause.getMessage().contains("Pid file already exists: "));
+ assertTrue(cause.getMessage().contains("vf.gf.locator.pid for process " + realPid));
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ delete(this.pidFile);
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ @Test
+ public void testStartUsingPort() throws Throwable {
+ // generate one free port and then use it instead of default
+ final int freeTCPPort = AvailablePortHelper.getRandomAvailableTCPPort();
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPort, AvailablePort.SOCKET));
+
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(freeTCPPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ int pid = 0;
+ try {
+ // if start succeeds without throwing exception then #47778 is fixed
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(pidFile.exists());
+ pid = readPid(pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify locator did not use default port
+ assertTrue(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+
+ final LocatorState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"" + freeTCPPort + "\" instead of " + portString, String.valueOf(freeTCPPort), portString);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartUsingPortInUseFails() throws Throwable {
+ // generate one free port and then use it instead of default
+ final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
+
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(freeTCPPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+ fail("LocatorLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher pidLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ final LocatorState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.workingDirectory + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (pidLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(this.workingDirectory).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ final LocatorState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.workingDirectory + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (dirLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher pidLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // stop the locator
+ final LocatorState locatorState = pidLauncher.stop();
+ assertNotNull(locatorState);
+ assertEquals(Status.STOPPED, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(this.workingDirectory).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // stop the locator
+ final LocatorState locatorState = dirLauncher.stop();
+ assertNotNull(locatorState);
+ assertEquals(Status.STOPPED, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
[05/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index b3e004e..640b175 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -17,14 +17,14 @@
activation.version = 1.1.1
annotations.version = 3.0.0
antlr.version = 2.7.7
-asm.version = 5.0.3
-assertj-core.version = 3.2.0
+asm.version = 5.1
+assertj-core.version = 3.4.1
awaitility.version = 1.7.0
bcel.version = 5.2
catch-exception.version = 1.4.4
catch-throwable.version = 1.4.4
cdi-api.version = 1.2
-cglib.version = 3.1
+cglib.version = 3.2.2
classmate.version = 0.9.0
commons-collections.version = 3.2.2
commons-configuration.version = 1.6
@@ -39,6 +39,7 @@ commons-exec.version=1.3
derby.version = 10.2.2.0
dom4j.version = 1.6.1
fastutil.version = 7.0.2
+google-gson.version=2.3.1
guava.version = 15.0
hadoop.version = 2.4.1
hamcrest-all.version = 1.3
@@ -63,17 +64,18 @@ javax.transaction-api.version = 1.2
jedis.version = 2.7.2
jetty.version = 9.3.6.v20151106
jline.version = 2.12
-jmock.version = 2.8.1
+jmock.version = 2.8.2
jna.version = 4.0.0
json-path.version = 1.2.0
json4s.version = 3.2.4
jsr305.version = 3.0.1
junit.version = 4.12
-JUnitParams.version = 1.0.4
+JUnitParams.version = 1.0.5
log4j.version = 2.5
lucene.version = 6.0.0
mockito-core.version = 1.10.19
mockrunner.version = 1.0.8
+mortbay-jetty-servlet-api.version=2.5-20081211
multithreadedtc.version = 1.01
mx4j.version = 3.0.1
mx4j-remote.version = 3.0.1
@@ -83,6 +85,8 @@ paranamer.version = 2.3
powermock.version = 1.6.4
quartz.version = 2.2.1
scala.version = 2.10.0
+selenium.version=2.53.0
+shiro.version=1.2.4
slf4j-api.version = 1.7.7
snappy-java.version = 1.1.1.6
spring-hateos.version = 0.16.0.RELEASE
@@ -95,11 +99,7 @@ stephenc-findbugs.version = 1.3.9-1
spymemcached.version = 2.9.0
swagger.version = 1.3.2
swagger-springmvc.version = 0.8.2
-system-rules.version = 1.15.0
+system-rules.version = 1.16.0
tempus-fugit.version = 1.1
tomcat6.version = 6.0.37
tomcat7.version = 7.0.30
-mortbay-jetty-servlet-api.version=2.5-20081211
-selenium.version=2.52.0
-google-gson.version=2.3.1
-shiro.version=1.2.4
[19/37] incubator-geode git commit: GEODE-1255: fix error introduced
by conflict
Posted by kl...@apache.org.
GEODE-1255: fix error introduced by conflict
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f74d04b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f74d04b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f74d04b6
Branch: refs/heads/feature/GEODE-1276
Commit: f74d04b6eb592a87622c42ae47ab494fc7383aec
Parents: 566fce9
Author: Kirk Lund <kl...@apache.org>
Authored: Thu May 5 15:54:48 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu May 5 15:54:48 2016 -0700
----------------------------------------------------------------------
.../SharedConfigurationCommandsDUnitTest.java | 284 +++++++++----------
1 file changed, 137 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f74d04b6/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
index 4bb9b81..781ed98 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
@@ -16,201 +16,210 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+import static com.gemstone.gemfire.management.internal.cli.CliUtil.*;
+import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
import static com.gemstone.gemfire.test.dunit.Wait.*;
import java.io.File;
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Set;
+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.DistributedMember;
import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.ClassBuilder;
import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.cli.Result.Status;
-import com.gemstone.gemfire.management.internal.cli.CliUtil;
import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.management.internal.configuration.SharedConfigurationDUnitTest;
+import com.gemstone.gemfire.management.internal.configuration.SharedConfigurationTestUtils;
import com.gemstone.gemfire.management.internal.configuration.domain.Configuration;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/***
+/**
* DUnit test to test export and import of shared configuration.
*/
@Category(DistributedTest.class)
@SuppressWarnings("unchecked")
public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
- private static final long serialVersionUID = 1L;
private static final int TIMEOUT = 10000;
private static final int INTERVAL = 500;
- File newDeployableJarFile = new File("DeployCommandsDUnit1.jar");
- private transient ClassBuilder classBuilder = new ClassBuilder();
+ private final String region1Name = "r1";
+ private final String region2Name = "r2";
+ private final String logLevel = "info";
- @Test
- public void testExportImportSharedConfiguration() {
+ private String groupName;
+
+ private String deployedJarName;
+ private File newDeployableJarFile;
+ private ClassBuilder classBuilder;
+
+ private String sharedConfigZipFileName;
+ private String startArchiveFileName;
+ private int[] ports;
+
+ private int locator1Port;
+ private String locator1Name;
+ private String locator1LogFilePath;
+
+ private int locator2Port;
+ private String locator2Name;
+ private String locator2LogFilePath;
+
+ private int locator1HttpPort;
+ private int locator1JmxPort;
+ private String locator1JmxHost;
+
+ @Override
+ protected final void postSetUpCliCommandTestBase() throws Exception {
disconnectAllFromDS();
- final String region1Name = "r1";
- final String region2Name = "r2";
- final String groupName = "testRegionSharedConfigGroup";
- final String sharedConfigZipFileName = "sharedConfig.zip";
- final String deployedJarName = "DeployCommandsDUnit1.jar";
- final String logLevel = "info";
- final String startArchiveFileName = "stats.gfs";
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
-
- // TODO Sourabh - the code below is similar to CliCommandTestBase.setUpJmxManagerOnVm0ThenConnect(..); we may want to consider
- // refactoring this and combine the duplicate code blocks using either the Template Method and/or Strategy design
- // patterns. We can talk about this.
- // Start the Locator and wait for shared configuration to be available
- final int locator1Port = ports[0];
- final String locator1Name = "locator1-" + locator1Port;
- VM locatorAndMgr = Host.getHost(0).getVM(3);
- Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
- @Override
- public Object call() {
- int httpPort;
- int jmxPort;
- String jmxHost;
+ this.groupName = getName();
+ this.deployedJarName = "DeployCommandsDUnit1.jar";
+ this.newDeployableJarFile = new File(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + deployedJarName);
+ this.classBuilder = new ClassBuilder();
- try {
- jmxHost = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException ignore) {
- jmxHost = "localhost";
- }
+ this.sharedConfigZipFileName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "sharedConfig.zip";
+ this.startArchiveFileName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "stats.gfs";
+ this.ports = getRandomAvailableTCPPorts(4);
+
+ this.locator1Port = this.ports[0];
+ this.locator1Name = "locator1-" + this.locator1Port;
+ this.locator1LogFilePath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + this.locator1Port + ".log";
+
+ this.locator2Port = this.ports[1];
+ this.locator2Name = "Locator2-" + this.locator2Port;
+ this.locator2LogFilePath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + this.locator2Port + ".log";
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ this.locator1HttpPort = ports[2];
+ this.locator1JmxPort = ports[3];
+ this.locator1JmxHost = getIPLiteral();
+ }
- jmxPort = ports[0];
- httpPort = ports[1];
+ @Override
+ public final void postTearDownCacheTestCase() throws Exception {
+ for (int i = 0; i < 4; i++) {
+ getHost(0).getVM(i).invoke(SharedConfigurationTestUtils.cleanupLocator);
+ }
+ }
- final File locatorLogFile = new File("locator-" + locator1Port + ".log");
+ @Test
+ public void testExportImportSharedConfiguration() throws IOException {
+ // Start the Locator and wait for shared configuration to be available
+ VM locatorAndMgr = getHost(0).getVM(3);
+ Set<DistributedMember> normalMembers1 = (Set<DistributedMember>) locatorAndMgr.invoke(new SerializableCallable() {
+ @Override
+ public Object call() {
+ final File locatorLogFile = new File(locator1LogFilePath);
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator1Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "config");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
- locatorProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+ locatorProps.setProperty(NAME_NAME, locator1Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "config");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_START_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(locator1JmxHost));
+ locatorProps.setProperty(JMX_MANAGER_PORT_NAME, String.valueOf(locator1JmxPort));
+ locatorProps.setProperty(HTTP_SERVICE_PORT_NAME, String.valueOf(locator1HttpPort));
try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile,
- null, locatorProps);
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return locator.isSharedConfigurationRunning();
}
-
@Override
public String description() {
return "Waiting for shared configuration to be started";
}
};
waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
- }
- final Object[] result = new Object[4];
- result[0] = jmxHost;
- result[1] = jmxPort;
- result[2] = httpPort;
- result[3] = CliUtil.getAllNormalMembers(CacheFactory.getAnyInstance());
+ } catch (IOException e) {
+ fail("Unable to create a locator with a shared configuration", e);
+ }
- return result;
+ return getAllNormalMembers(CacheFactory.getAnyInstance());
}
});
HeadlessGfsh gfsh = getDefaultShell();
- String jmxHost = (String) result[0];
- int jmxPort = (Integer) result[1];
- int httpPort = (Integer) result[2];
- Set<DistributedMember> normalMembers1 = (Set<DistributedMember>) result[3];
+ shellConnect(locator1JmxHost, locator1JmxPort, locator1HttpPort, gfsh);
- shellConnect(jmxHost, jmxPort, httpPort, gfsh);
// Create a cache in VM 1
- VM dataMember = Host.getHost(0).getVM(1);
+ VM dataMember = getHost(0).getVM(1);
normalMembers1 = (Set<DistributedMember>) dataMember.invoke(new SerializableCallable() {
@Override
public Object call() {
Properties localProps = new Properties();
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
- localProps.setProperty(DistributionConfig.GROUPS_NAME, groupName);
- localProps.setProperty(DistributionConfig.NAME_NAME, "DataMember");
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
+ localProps.setProperty(GROUPS_NAME, groupName);
+ localProps.setProperty(NAME_NAME, "DataMember");
getSystem(localProps);
Cache cache = getCache();
assertNotNull(cache);
- return CliUtil.getAllNormalMembers(cache);
+ return getAllNormalMembers(cache);
}
});
+
// Create a JAR file
- try {
- this.classBuilder.writeJarFromName("DeployCommandsDUnitA", this.newDeployableJarFile);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ this.classBuilder.writeJarFromName("DeployCommandsDUnitA", this.newDeployableJarFile);
// Deploy the JAR
- CommandResult cmdResult = executeCommand("deploy --jar=" + deployedJarName);
+ CommandResult cmdResult = executeCommand("deploy --jar=" + this.newDeployableJarFile.getCanonicalPath());
assertEquals(Result.Status.OK, cmdResult.getStatus());
+
//Create the region1 on the group
- CommandStringBuilder commandStringBuilder = new CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION, region1Name);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, "REPLICATE");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__STATISTICSENABLED, "true");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__GROUP, groupName);
+ CommandStringBuilder commandStringBuilder = new CommandStringBuilder(CREATE_REGION);
+ commandStringBuilder.addOption(CREATE_REGION__REGION, region1Name);
+ commandStringBuilder.addOption(CREATE_REGION__REGIONSHORTCUT, "REPLICATE");
+ commandStringBuilder.addOption(CREATE_REGION__STATISTICSENABLED, "true");
+ commandStringBuilder.addOption(CREATE_REGION__GROUP, groupName);
cmdResult = executeCommand(commandStringBuilder.toString());
assertEquals(Result.Status.OK, cmdResult.getStatus());
- commandStringBuilder = new CommandStringBuilder(CliStrings.CREATE_REGION);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGION, region2Name);
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, "PARTITION");
- commandStringBuilder.addOption(CliStrings.CREATE_REGION__STATISTICSENABLED, "true");
+ commandStringBuilder = new CommandStringBuilder(CREATE_REGION);
+ commandStringBuilder.addOption(CREATE_REGION__REGION, region2Name);
+ commandStringBuilder.addOption(CREATE_REGION__REGIONSHORTCUT, "PARTITION");
+ commandStringBuilder.addOption(CREATE_REGION__STATISTICSENABLED, "true");
cmdResult = executeCommand(commandStringBuilder.toString());
assertEquals(Result.Status.OK, cmdResult.getStatus());
- //Alter runtime configuration
- commandStringBuilder = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__LEVEL, logLevel);
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT, "50");
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT, "32");
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT, "49");
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE, "120");
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE, startArchiveFileName);
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED, "true");
- commandStringBuilder.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT, "10");
+ //Alter runtime configuration
+ commandStringBuilder = new CommandStringBuilder(ALTER_RUNTIME_CONFIG);
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__LOG__LEVEL, logLevel);
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT, "50");
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT, "32");
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT, "49");
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE, "120");
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE, this.startArchiveFileName);
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED, "true");
+ commandStringBuilder.addOption(ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT, "10");
cmdResult = executeCommand(commandStringBuilder.getCommandString());
String resultString = commandResultToString(cmdResult);
@@ -218,15 +227,15 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
getLogWriter().info(resultString);
assertEquals(true, cmdResult.getStatus().equals(Status.OK));
- commandStringBuilder = new CommandStringBuilder(CliStrings.STATUS_SHARED_CONFIG);
+ commandStringBuilder = new CommandStringBuilder(STATUS_SHARED_CONFIG);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
resultString = commandResultToString(cmdResult);
getLogWriter().info("#SB Result\n");
getLogWriter().info(resultString);
assertEquals(Status.OK, cmdResult.getStatus());
- commandStringBuilder = new CommandStringBuilder(CliStrings.EXPORT_SHARED_CONFIG);
- commandStringBuilder.addOption(CliStrings.EXPORT_SHARED_CONFIG__FILE, sharedConfigZipFileName);
+ commandStringBuilder = new CommandStringBuilder(EXPORT_SHARED_CONFIG);
+ commandStringBuilder.addOption(EXPORT_SHARED_CONFIG__FILE, this.sharedConfigZipFileName);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
resultString = commandResultToString(cmdResult);
getLogWriter().info("#SB Result\n");
@@ -234,8 +243,8 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
assertEquals(Status.OK, cmdResult.getStatus());
//Import into a running system should fail
- commandStringBuilder = new CommandStringBuilder(CliStrings.IMPORT_SHARED_CONFIG);
- commandStringBuilder.addOption(CliStrings.IMPORT_SHARED_CONFIG__ZIP, sharedConfigZipFileName);
+ commandStringBuilder = new CommandStringBuilder(IMPORT_SHARED_CONFIG);
+ commandStringBuilder.addOption(IMPORT_SHARED_CONFIG__ZIP, this.sharedConfigZipFileName);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
assertEquals(Status.ERROR, cmdResult.getStatus());
@@ -263,39 +272,34 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
}
});
- //Now execute import shared configuration
+ //Now execute import shared configuration
//Now import the shared configuration and it should succeed.
- commandStringBuilder = new CommandStringBuilder(CliStrings.IMPORT_SHARED_CONFIG);
- commandStringBuilder.addOption(CliStrings.IMPORT_SHARED_CONFIG__ZIP, sharedConfigZipFileName);
+ commandStringBuilder = new CommandStringBuilder(IMPORT_SHARED_CONFIG);
+ commandStringBuilder.addOption(IMPORT_SHARED_CONFIG__ZIP, this.sharedConfigZipFileName);
cmdResult = executeCommand(commandStringBuilder.getCommandString());
assertEquals(Status.OK, cmdResult.getStatus());
//Start a new locator , test if it has all the imported shared configuration artifacts
- VM newLocator = Host.getHost(0).getVM(2);
- final int locator2Port = ports[1];
- final String locator2Name = "Locator2-" + locator2Port;
-
+ VM newLocator = getHost(0).getVM(2);
newLocator.invoke(new SerializableRunnable() {
@Override
public void run() {
- final File locatorLogFile = new File("locator-" + locator2Port + ".log");
+ final File locatorLogFile = new File(locator2LogFilePath);
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator2Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "fine");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- locatorProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
+ locatorProps.setProperty(NAME_NAME, locator2Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "fine");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port, locatorLogFile,
- null, locatorProps);
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port, locatorLogFile, null, locatorProps);
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return locator.isSharedConfigurationRunning();
}
-
@Override
public String description() {
return "Waiting for shared configuration to be started";
@@ -313,29 +317,15 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
assertNotNull(clusterConfig);
assertTrue(clusterConfig.getCacheXmlContent().contains(region2Name));
assertTrue(clusterConfig.getJarNames().contains(deployedJarName));
- assertTrue(
- clusterConfig.getGemfireProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME).equals(logLevel));
- assertTrue(
- clusterConfig.getGemfireProperties().getProperty(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME).equals(
- startArchiveFileName));
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
+ assertTrue(clusterConfig.getGemfireProperties().getProperty(LOG_LEVEL_NAME).equals(logLevel));
+ assertTrue(clusterConfig.getGemfireProperties().getProperty(STATISTIC_ARCHIVE_FILE_NAME).equals(startArchiveFileName));
+
+ } catch (IOException e) {
+ fail("Unable to create a locator with a shared configuration", e);
} catch (Exception e) {
fail("Error occurred in cluster configuration service", e);
}
}
});
-
- //Clean up
- File sharedConfigZipFile = new File(sharedConfigZipFileName);
- FileUtils.deleteQuietly(sharedConfigZipFile);
- FileUtils.deleteQuietly(newDeployableJarFile);
- }
-
- @Override
- public final void postTearDownCacheTestCase() throws Exception {
- for (int i = 0; i < 4; i++) {
- Host.getHost(0).getVM(i).invoke(SharedConfigurationDUnitTest.locatorCleanup);
- }
}
}
[26/37] incubator-geode git commit: Revert "GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
old mode 100755
new mode 100644
index d3d232e..a6bbb86
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
@@ -40,2024 +40,13 @@ import com.gemstone.gemfire.i18n.StringId;
* @since 6.0
*
*/
-public class LocalizedStrings {
- /** reserved space for commonly used strings, messageId 0-1024 **/
- public static final StringId EMPTY = new StringId(0, "");
- public static final StringId ONE_ARG = StringId.LITERAL;
- //alias for use in temporarily adding debugging to the product
- public static final StringId DEBUG = ONE_ARG;
-
- public static final StringId DONT_RELEASE = ONE_ARG;
-
- //alias for use in the test tree
- public static final StringId TESTING = ONE_ARG;
- public static final StringId TWO_ARG = new StringId(2, "{0} {1}");
- public static final StringId TWO_ARG_COLON = new StringId(3, "{0} : {1}");
- public static final StringId ERROR = new StringId(4, "ERROR");
- public static final StringId CACHE_IS_CLOSING = new StringId(1021, "Cache is closing");
- public static final StringId NOT_A_REAL_GEMFIREVM = new StringId(1022, "Not a real GemFireVM");
- public static final StringId SHOULDNT_INVOKE = new StringId(1023, "Should not be invoked");
- public static final StringId UNSUPPORTED_AT_THIS_TIME = new StringId(1024, "Unsupported at this time");
-
- /**Gemfire strings, messageId 1025-15000 **/
- public static final StringId AbstractHealthEvaluator_OKAY_HEALTH__0 = new StringId(1025, "OKAY_HEALTH: {0}");
- public static final StringId AbstractHealthEvaluator_POOR_HEALTH__0 = new StringId(1026, "POOR_HEALTH: {0}");
- public static final StringId AbstractRegion_CACHECALLBACK_CLOSE_EXCEPTION = new StringId(1027, "CacheCallback close exception");
- public static final StringId PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS = new StringId(1028, "A pool named \"{0}\" already exists");
- public static final StringId AcceptorImpl_CACHE_SERVER_CONNECTION_LISTENER_BOUND_TO_ADDRESS_0_WITH_BACKLOG_1 = new StringId(1029, "Cache server connection listener bound to address {0} with backlog {1}.");
- public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT = new StringId(1030, "Cache server: failed accepting client connection due to socket timeout.");
- public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0 = new StringId(1031, "Cache server: failed accepting client connection {0}");
- public static final StringId AcceptorImpl_CACHE_SERVER_ON_PORT_0_IS_SHUTTING_DOWN = new StringId(1032, "Cache server on port {0} is shutting down.");
- public static final StringId AcceptorImpl_CACHE_SERVER_TIMED_OUT_WAITING_FOR_HANDSHAKE_FROM__0 = new StringId(1033, "Cache server: timed out waiting for handshake from {0}");
- public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_EXCEPTION = new StringId(1034, "Cache server: Unexpected Exception");
- public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_IOEXCEPTION_FROM_ACCEPT = new StringId(1035, "Cache server: Unexpected IOException from accept");
- public static final StringId AcceptorImpl_EXCEEDED_MAX_CONNECTIONS_0 = new StringId(1036, "exceeded max-connections {0}");
- public static final StringId AcceptorImpl_IGNORING = new StringId(1037, "ignoring");
- public static final StringId AcceptorImpl_IGNORING_EVENT_ON_SELECTOR_KEY__0 = new StringId(1038, "ignoring event on selector key {0}");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_A_PREVIOUS_CONNECTION_ATTEMPT_FROM_THIS_CLIENT_IS_STILL_BEING_PROCESSED__0 = new StringId(1039, "A previous connection attempt from this client is still being processed: {0}");
- public static final StringId AcceptorImpl_REJECTED_CONNECTION_FROM_0_BECAUSE_CURRENT_CONNECTION_COUNT_OF_1_IS_GREATER_THAN_OR_EQUAL_TO_THE_CONFIGURED_MAX_OF_2 = new StringId(1040, "Rejected connection from {0} because current connection count of {1} is greater than or equal to the configured max of {2}");
- public static final StringId AcceptorImpl_SELECTOR_ENABLED = new StringId(1041, "SELECTOR enabled");
- public static final StringId AcceptorImpl_UNEXPECTED = new StringId(1042, "unexpected");
- public static final StringId AdminDistributedSystem_COULD_NOT_SET_THE_GEMFIRE_VM = new StringId(1043, "Could not set the GemFire VM.");
- public static final StringId AdminDistributedSystemImpl_ADDING_NEW_APPLICATION_FOR__0 = new StringId(1044, "Adding new Application for {0}");
- public static final StringId AdminDistributedSystemImpl_ADDING_NEW_CACHESERVER_FOR__0 = new StringId(1045, "Adding new CacheServer for {0}");
- public static final StringId AdminDistributedSystemImpl_WHILE_GETTING_CANONICAL_FILE = new StringId(1046, "While getting canonical file");
- public static final StringId AdminRequest_RESPONSE_TO__0__WAS_CANCELLED = new StringId(1047, "Response to {0} was cancelled.");
- public static final StringId AdminWaiters_COULD_NOT_SEND_REQUEST_0 = new StringId(1048, "Could not send request.{0}");
- public static final StringId AdminWaiters_REQUEST_SEND_TO_0_WAS_CANCELLED_1 = new StringId(1049, "Request sent to {0} was cancelled. {1}");
- public static final StringId AdminWaiters_REQUEST_SENT_TO_0_FAILED_SINCE_MEMBER_DEPARTED_1 = new StringId(1050, "Request sent to {0} failed since member departed.{1}");
- public static final StringId AgentImpl_0__IS_ALREADY_REGISTERED = new StringId(1051, "{0} is already registered.");
- public static final StringId AgentImpl_AGENT_HAS_STOPPED = new StringId(1052, "Agent has stopped");
- public static final StringId AgentImpl_AUTO_CONNECT_FAILED__0 = new StringId(1053, "auto connect failed: {0}");
- public static final StringId AgentImpl_FAILED_TO_START_HTTPADAPTOR__0 = new StringId(1054, "Failed to start HttpAdaptor: {0}");
- public static final StringId AgentImpl_FAILED_TO_START_RMICONNECTORSERVER = new StringId(1055, "Failed to start RMIConnectorServer:");
- public static final StringId AgentImpl_FAILED_TO_START_SNMPADAPTOR__0 = new StringId(1056, "Failed to start SnmpAdaptor: {0}");
- public static final StringId AgentImpl_GEMFIRE_JMX_AGENT_IS_RUNNING = new StringId(1057, "GemFire JMX Agent is running...");
- public static final StringId AgentImpl_HTTPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1058, "HttpAdaptor already registered as {0}");
- public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_ADDRESS__0 = new StringId(1059, "HTTP adaptor listening on address: {0}");
- public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_PORT__0 = new StringId(1060, "HTTP adaptor listening on port: {0}");
- public static final StringId AgentImpl_INCORRECT_NULL_HOSTNAME = new StringId(1061, "Incorrect null hostname");
- public static final StringId AgentImpl_INCORRECT_PORT_VALUE__0 = new StringId(1062, "Incorrect port value {0}");
- public static final StringId AgentImpl_RMICONNECTORSERVER_ALREADY_REGISTERED_AS__0 = new StringId(1063, "RMIConnectorServer already registered as {0}");
- public static final StringId AgentImpl_SNMPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1064, "SnmpAdaptor already registered as {0}");
- public static final StringId AgentImpl_STOPPING_JMX_AGENT = new StringId(1065, "Stopping JMX agent");
- public static final StringId AgentImpl_XSLTPROCESSOR_ALREADY_REGISTERED_AS__0 = new StringId(1066, "XsltProcessor already registered as {0}");
- public static final StringId AbstractRegion_THE_CONNECTION_POOL_0_HAS_NOT_BEEN_CREATED = new StringId(1067, "The connection pool \"{0}\" has not been created");
-
- public static final StringId AttributesFactory_ADDCACHELISTENER_PARAMETER_WAS_NULL = new StringId(1069, "addCacheListener parameter was null");
- public static final StringId AttributesFactory_AN_EVICTION_CONTROLLER_WITH_LOCAL_DESTROY_EVICTION_ACTION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1070, "An Eviction Controller with local destroy eviction action is incompatible with distributed replication");
-
- public static final StringId AttributesFactory_CONCURRENCYLEVEL_MUST_BE_0 = new StringId(1072, "concurrencyLevel must be > 0");
- public static final StringId AttributesFactory_DATAPOLICY_MUST_NOT_BE_NULL = new StringId(1073, "dataPolicy must not be null");
- public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1074, "Data policies other than {0} are not allowed in partitioned regions.");
- public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_SUPPORTED_FOR_PARTITIONED_REGIONS = new StringId(1075, "Data policies other than {0} are not supported for Partitioned Regions");
- public static final StringId AttributesFactory_DATA_POLICY_0_IS_NOT_ALLOWED_FOR_A_PARTITIONED_REGION_DATAPOLICIES_OTHER_THAN_1_ARE_NOT_ALLOWED = new StringId(1076, "Data policy {0} is not allowed for a partitioned region. DataPolicies other than {1} are not allowed.");
- public static final StringId AttributesFactory_DIR_SIZE_CANNOT_BE_NEGATIVE_0 = new StringId(1077, "Dir size cannot be negative : {0}");
-
- public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_DESTROY_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1079, "ExpirationAction.LOCAL_DESTROY on the entries is incompatible with distributed replication");
- public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1080, "ExpirationAction.LOCAL_INVALIDATE on the entries is incompatible with distributed replication");
- public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_REGION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1081, "ExpirationAction.LOCAL_INVALIDATE on the region is incompatible with distributed replication");
-
- public static final StringId AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL = new StringId(1085, "idleTimeout must not be null");
- public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_ENTRY_EXPIRATION_IS_NOT_ALLOWED = new StringId(1086, "If the data policy is {0} then entry expiration is not allowed.");
- public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_EVICTION_IS_NOT_ALLOWED = new StringId(1087, "If the data policy is {0} then eviction is not allowed.");
- public static final StringId AttributesFactory_IF_THE_MEMBERSHIP_ATTRIBUTES_HAS_REQUIRED_ROLES_THEN_SCOPE_MUST_NOT_BE_LOCAL = new StringId(1088, "If the membership attributes has required roles then scope must not be LOCAL.");
- public static final StringId AttributesFactory_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT = new StringId(1089, "initCacheListeners parameter had a null element");
- public static final StringId AttributesFactory_INITIALCAPACITY_MUST_BE_0 = new StringId(1090, "initialCapacity must be >= 0");
- public static final StringId AttributesFactory_KEYCONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1091, "keyConstraint must not be a primitive type");
- public static final StringId AttributesFactory_LOADFACTOR_MUST_BE_0_VALUE_IS_0 = new StringId(1092, "loadFactor must be > 0, value is {0}");
- public static final StringId AttributesFactory_MIRRORTYPE_MUST_NOT_BE_NULL = new StringId(1093, "mirrorType must not be null");
- public static final StringId AttributesFactory_MORE_THAN_ONE_CACHE_LISTENER_EXISTS = new StringId(1094, "More than one cache listener exists.");
- public static final StringId AttributesFactory_NO_MIRROR_TYPE_CORRESPONDS_TO_DATA_POLICY_0 = new StringId(1095, "No mirror type corresponds to data policy \"{0}\".");
- public static final StringId AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1 = new StringId(1096, " Number of diskSizes is {0} which is not equal to number of disk Dirs which is {1}");
- public static final StringId AttributesFactory_PARTITIONATTRIBUTES_LOCALMAXMEMORY_MUST_NOT_BE_NEGATIVE = new StringId(1097, "PartitionAttributes localMaxMemory must not be negative.");
- public static final StringId AttributesFactory_SCOPETYPE_MUST_NOT_BE_NULL = new StringId(1098, "scopeType must not be null");
- public static final StringId AttributesFactory_SETLOCKGRANTERTRUE_IS_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1099, "setLockGranter(true) is not allowed in Partitioned Regions.");
- public static final StringId AttributesFactory_SETTING_SCOPE_ON_A_PARTITIONED_REGIONS_IS_NOT_ALLOWED = new StringId(1100, "Setting Scope on a Partitioned Regions is not allowed.");
- public static final StringId AttributesFactory_STATISTICS_MUST_BE_ENABLED_FOR_EXPIRATION = new StringId(1101, "Statistics must be enabled for expiration");
- public static final StringId AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL = new StringId(1102, "timeToLive must not be null");
- public static final StringId AttributesFactory_TOTAL_SIZE_OF_PARTITION_REGION_MUST_BE_0 = new StringId(1103, "Total size of partition region must be > 0.");
- public static final StringId AttributesFactory_VALUECONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1104, "valueConstraint must not be a primitive type");
- public static final StringId BaseCommand_0_CONNECTION_DISCONNECT_DETECTED_BY_EOF = new StringId(1105, "{0}: connection disconnect detected by EOF.");
- public static final StringId BaseCommand_0_EOFEXCEPTION_DURING_A_WRITE_OPERATION_ON_REGION__1_KEY_2_MESSAGEID_3 = new StringId(1106, "{0}: EOFException during a write operation on region : {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_0_QUERYSTRING_IS_1 = new StringId(1107, "{0} : QueryString is: {1}.");
- public static final StringId BaseCommand_0_UNEXPECTED_ERROR_ON_SERVER = new StringId(1108, "{0} : Unexpected Error on server");
- public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION = new StringId(1109, "{0}: Unexpected Exception");
- public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1110, "{0}: Unexpected Exception during operation on region: {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION = new StringId(1111, "{0}: Unexpected IOException: ");
- public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION_DURING_OPERATION_FOR_REGION_1_KEY_2_MESSID_3 = new StringId(1112, "{0}: Unexpected IOException during operation for region: {1} key: {2} messId: {3}");
- public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION = new StringId(1113, "{0}: Unexpected ShutdownException: ");
- public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1114, "{0}: Unexpected ShutdownException during operation on region: {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION = new StringId(1115, "{0}: Unexpected ThreadInterruptedException: ");
- public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1116, "{0}: Unexpected ThreadInterruptedException during operation on region: {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_UNKNOWN_QUERY_EXCEPTION = new StringId(1117, "Uknown query Exception.");
- public static final StringId BaseCommand_SEVERE_CACHE_EXCEPTION_0 = new StringId(1118, "Severe cache exception : {0}");
- public static final StringId BaseCommand_UNEXPECTED_QUERYINVALIDEXCEPTION_WHILE_PROCESSING_QUERY_0 = new StringId(1119, "Unexpected QueryInvalidException while processing query {0}");
- public static final StringId LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED = new StringId(1120, "The region {0} was configured to use off heap memory but no off heap memory was configured");
-
- public static final StringId CacheServerImpl_CACHESERVER_CONFIGURATION___0 = new StringId(1122, "CacheServer Configuration: {0}");
- public static final StringId CacheServerImpl_FORCING_NOTIFYBYSUBSCRIPTION_TO_SUPPORT_DYNAMIC_REGIONS = new StringId(1123, "Forcing notifyBySubscription to support dynamic regions");
-
- public static final StringId BucketAdvisor_ATTEMPTED_TO_CLOSE_BUCKETADVISOR_THAT_IS_ALREADY_CLOSED = new StringId(1131, "Attempted to close BucketAdvisor that is already CLOSED");
- public static final StringId AgentImpl_COULD_NOT_TAIL_0_BECAUSE_1 = new StringId(1132, "Could not tail \"{0}\" because: {1}");
- public static final StringId SystemAdmin_USED_TO_SPECIFY_A_HOST_NAME_OR_IP_ADDRESS_TO_GIVE_TO_CLIENTS_SO_THEY_CAN_CONNECT_TO_A_LOCATOR = new StringId(1133, "Used to specify a host name or IP address to give to clients so they can connect to a locator.");
- public static final StringId BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY = new StringId(1134, "BucketAdvisor was not closed properly.");
- public static final StringId BucketBackupMessage_BUCKETBACKUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1135, "BucketBackupMessage: data store not configured for this member");
-
- public static final StringId CacheClientNotifier_0_REGISTERCLIENT_EXCEPTION_ENCOUNTERED_IN_REGISTRATION_1 = new StringId(1140, "{0} :registerClient: Exception encountered in registration {1}");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_KEEPING_PROXY_FOR_DURABLE_CLIENT_NAMED_0_FOR_1_SECONDS_2 = new StringId(1141, "CacheClientNotifier: Keeping proxy for durable client named {0} for {1} seconds {2}.");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_THE_REQUESTED_DURABLE_CLIENT_HAS_THE_SAME_IDENTIFIER__0__AS_AN_EXISTING_DURABLE_CLIENT__1__DUPLICATE_DURABLE_CLIENTS_ARE_NOT_ALLOWED = new StringId(1142, "CacheClientNotifier: The requested durable client has the same identifier ( {0} ) as an existing durable client ( {1} ). Duplicate durable clients are not allowed.");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_UNSUCCESSFULLY_REGISTERED_CLIENT_WITH_IDENTIFIER__0 = new StringId(1143, "CacheClientNotifier: Unsuccessfully registered client with identifier {0}");
- public static final StringId CacheClientNotifier_CANNOT_NOTIFY_CLIENTS_TO_PERFORM_OPERATION_0_ON_EVENT_1 = new StringId(1144, "CacheClientNotifier: Cannot notify clients to perform operation {0} on event {1}");
- public static final StringId CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_PROCESSING_CQS = new StringId(1145, "Exception occurred while processing CQs");
-
- public static final StringId CacheClientNotifier_UNABLE_TO_CLOSE_CQS_FOR_THE_CLIENT__0 = new StringId(1147, "Unable to close CQs for the client: {0}");
- public static final StringId CacheClientNotifier_UNABLE_TO_GET_THE_CQSERVICE_WHILE_CLOSING_THE_DEAD_PROXIES = new StringId(1148, "Unable to get the CqService while closing the dead proxies");
- public static final StringId CacheClientProxy_0_AN_UNEXPECTED_IOEXCEPTION_OCCURRED_SO_THE_PROXY_WILL_BE_CLOSED = new StringId(1149, "{0}: An unexpected IOException occurred so the proxy will be closed.");
- public static final StringId CacheClientProxy_0_CANCELLING_EXPIRATION_TASK_SINCE_THE_CLIENT_HAS_RECONNECTED = new StringId(1150, "{0}: Cancelling expiration task since the client has reconnected.");
- public static final StringId CacheClientProxy_0_COULD_NOT_STOP_MESSAGE_DISPATCHER_THREAD = new StringId(1151, "{0}: Could not stop message dispatcher thread.");
- public static final StringId CacheClientProxy_0_EXCEPTION_IN_CLOSING_THE_UNDERLYING_HAREGION_OF_THE_HAREGIONQUEUE = new StringId(1152, "{0}: Exception in closing the underlying HARegion of the HARegionQueue");
- public static final StringId CacheClientProxy_0_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1153, "{0}: Exception occurred while attempting to add message to queue");
- public static final StringId CacheClientProxy_0_POSSIBILITY_OF_NOT_BEING_ABLE_TO_SEND_SOME_OR_ALL_THE_MESSAGES_TO_CLIENTS_TOTAL_MESSAGES_CURRENTLY_PRESENT_IN_THE_LIST_1 = new StringId(1154, "{0} Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list {1}.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_SOCKET_BEING_CLOSED_LOCALLY = new StringId(1155, "{0}: Proxy closing due to socket being closed locally.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_BROKEN_PIPE_ON_SOCKET_CONNECTION = new StringId(1156, "{0}: Proxy closing due to unexpected broken pipe on socket connection.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_BY_PEER_ON_SOCKET_CONNECTION = new StringId(1157, "{0}: Proxy closing due to unexpected reset by peer on socket connection.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_ON_SOCKET_CONNECTION = new StringId(1158, "{0}: Proxy closing due to unexpected reset on socket connection.");
- public static final StringId CacheClientProxy_0__AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1159, "{0} : An unexpected Exception occurred");
- public static final StringId CacheClientProxy_0__EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1160, "{0} : Exception occurred while attempting to add message to queue");
- public static final StringId CacheClientProxy_0__PAUSING_PROCESSING = new StringId(1161, "{0} : Pausing processing");
- public static final StringId CacheClientProxy_0__RESUMING_PROCESSING = new StringId(1162, "{0} : Resuming processing");
- public static final StringId CacheClientProxy_0__THE_EXPIRATION_TASK_HAS_FIRED_SO_THIS_PROXY_IS_BEING_TERMINATED = new StringId(1163, "{0} : The expiration task has fired, so this proxy is being terminated.");
-
- public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_BROKEN_PIPE_ON_SOCKET = new StringId(1166, "Problem caused by broken pipe on socket.");
- public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_MESSAGE_QUEUE_BEING_CLOSED = new StringId(1167, "Problem caused by message queue being closed.");
- public static final StringId CacheClientUpdater_0_CAUGHT_FOLLOWING_EXECPTION_WHILE_ATTEMPTING_TO_CREATE_A_SERVER_TO_CLIENT_COMMUNICATION_SOCKET_AND_WILL_EXIT_1 = new StringId(1168, "{0}: Caught following exception while attempting to create a server-to-client communication socket and will exit: {1}");
- public static final StringId CacheClientUpdater_0_CONNECTION_WAS_REFUSED = new StringId(1169, "{0} connection was refused");
- public static final StringId CacheClientUpdater_SSL_NEGOTIATION_FAILED_WITH_ENDPOINT_0 = new StringId(1170, "SSL negotiation failed with endpoint: {0}");
-
- public static final StringId CacheClientUpdater_0_RECEIVED_AN_UNSUPPORTED_MESSAGE_TYPE_1 = new StringId(1172, "{0}: Received an unsupported message (type={1})");
- public static final StringId CacheClientUpdater_0__1__2 = new StringId(1173, "{0} : {1} : {2}");
- public static final StringId CacheClientUpdater_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_DESTROY_ENTRY_REGION_0_KEY_1 = new StringId(1174, "The following exception occurred while attempting to destroy entry (region: {0} key: {1})");
-
- public static final StringId CacheClientUpdater_FAILED_TO_INVOKE_CQ_DISPATCHER_ERROR___0 = new StringId(1177, "Failed to invoke CQ Dispatcher. Error : {0}");
-
- public static final StringId CacheFactory_0_AN_OPEN_CACHE_ALREADY_EXISTS = new StringId(1179, "{0}: An open cache already exists.");
- public static final StringId InternalDistributedSystem_shutdownHook_shuttingdown = new StringId(1180, "VM is exiting - shutting down distributed system");
- public static final StringId GroupMembershipService_entered_into_membership_in_group_0_with_id_1 = new StringId(1181, "Finished joining (took {0}ms).");
- public static final StringId CacheServerLauncher_CACHE_SERVER_ERROR = new StringId(1182, "Cache server error");
- public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_APPENDED_CHARACTER_DATA_0 = new StringId(1183, "XML Parser characters, appended character data: {0}");
- public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_NEW_CHARACTER_DATA_0 = new StringId(1184, "XML Parser characters, new character data: {0}");
- public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_CLASS_NAME_0 = new StringId(1185, "XML Parser createDeclarable class name: {0}");
- public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_PROPERTIES__0 = new StringId(1186, "XML Parser createDeclarable properties: {0}");
- public static final StringId ClearRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1187, "{0}: The input region name for the clear region request is null");
- public static final StringId ClearRegion_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1188, " The input region name for the clear region request is null");
- public static final StringId ClearRegion_WAS_NOT_FOUND_DURING_CLEAR_REGION_REGUEST = new StringId(1189, " was not found during clear region request");
- public static final StringId ClientHealtMonitor_0_IS_BEING_TERMINATED_BECAUSE_ITS_CLIENT_TIMEOUT_OF_1_HAS_EXPIRED = new StringId(1190, "{0} is being terminated because its client timeout of {1} has expired.");
- public static final StringId ClientHealthMonitor_0_AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1191, "{0}: An unexpected Exception occurred");
- public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITORTHREAD_MAXIMUM_ALLOWED_TIME_BETWEEN_PINGS_0 = new StringId(1192, "ClientHealthMonitorThread maximum allowed time between pings: {0}");
- public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_REGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1193, "ClientHealthMonitor: Registering client with member id {0}");
- public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_UNREGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1194, "ClientHealthMonitor: Unregistering client with member id {0}");
- public static final StringId ClientHealthMonitor_CLIENT_HEALTH_MONITOR_THREAD_DISABLED_DUE_TO_MAXIMUMTIMEBETWEENPINGS_SETTING__0 = new StringId(1195, "Client health monitor thread disabled due to maximumTimeBetweenPings setting: {0}");
- public static final StringId ClientHealthMonitor_MONITORING_CLIENT_WITH_MEMBER_ID_0_IT_HAD_BEEN_1_MS_SINCE_THE_LATEST_HEARTBEAT_MAX_INTERVAL_IS_2_TERMINATED_CLIENT = new StringId(1196, "Monitoring client with member id {0}. It had been {1} ms since the latest heartbeat. Max interval is {2}. Terminated client.");
- public static final StringId ClientHealthMonitor_UNEXPECTED_INTERRUPT_EXITING = new StringId(1197, "Unexpected interrupt, exiting");
- public static final StringId ClientProxyMembershipID_UNABLE_TO_DESERIALIZE_MEMBERSHIP_ID = new StringId(1198, "Unable to deserialize membership id");
- public static final StringId DiskStore_IS_USED_IN_NONPERSISTENT_REGION = new StringId(1199, "Only regions with persistence or overflow to disk can specify DiskStore");
- public static final StringId DiskRegion_COMPLEXDISKREGIONGETNEXTDIR_MAX_DIRECTORY_SIZE_WILL_GET_VIOLATED__GOING_AHEAD_WITH_THE_SWITCHING_OF_OPLOG_ANY_WAYS_CURRENTLY_AVAILABLE_SPACE_IN_THE_DIRECTORY_IS__0__THE_CAPACITY_OF_DIRECTORY_IS___1 = new StringId(1200, "Even though the configured directory size limit has been exceeded a new oplog will be created because compaction is enabled. The configured limit is {1}. The current space used in the directory by this disk store is {0}.");
-
- public static final StringId AttributesFactory_CLONENOTSUPPORTEDEXCEPTION_THROWN_IN_CLASS_THAT_IMPLEMENTS_CLONEABLE = new StringId(1213, "CloneNotSupportedException thrown in class that implements cloneable.");
-
- public static final StringId CqQueryImpl_CQ_IS_CLOSED_CQNAME_0 = new StringId(1215, "CQ is closed, CqName : {0}");
-
- public static final StringId Connection_DISCONNECTED_AS_A_SLOWRECEIVER = new StringId(1226, "Disconnected as a slow-receiver");
-
- public static final StringId ConnectionTable_FAILED_TO_ACCEPT_CONNECTION_FROM_0_BECAUSE_1 = new StringId(1240, "Failed to accept connection from {0} because: {1}");
-
- public static final StringId Connection_0_ASYNC_CONFIGURATION_RECEIVED_1 = new StringId(1243, "{0} async configuration received {1}.");
- public static final StringId Connection_0_ERROR_READING_MESSAGE = new StringId(1244, "{0} Error reading message");
- public static final StringId Connection_0_EXCEPTION_IN_CHANNEL_READ = new StringId(1245, "{0} exception in channel read");
- public static final StringId Connection_0_EXCEPTION_RECEIVED = new StringId(1246, "{0} exception received");
- public static final StringId Connection_0_STRAY_INTERRUPT_READING_MESSAGE = new StringId(1247, "{0} Stray interrupt reading message");
- public static final StringId Connection_0_SUCCESSFULLY_REESTABLISHED_CONNECTION_TO_PEER_1 = new StringId(1248, "{0}: Successfully reestablished connection to peer {1}");
- public static final StringId Connection_ACK_READ_EXCEPTION = new StringId(1249, "ack read exception");
- public static final StringId Connection_ACK_READ_EXCEPTION_0 = new StringId(1250, "ack read exception: {0}");
-
- public static final StringId Connection_ALLOCATING_LARGER_NETWORK_READ_BUFFER_NEW_SIZE_IS_0_OLD_SIZE_WAS_1 = new StringId(1254, "Allocating larger network read buffer, new size is {0} old size was {1}.");
- public static final StringId Connection_BLOCKED_FOR_0_MS_WHICH_IS_LONGER_THAN_THE_MAX_OF_1_MS_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1255, "Blocked for {0}ms which is longer than the max of {1}ms, asking slow receiver {2} to disconnect.");
- public static final StringId Connection_CLASSNOTFOUND_DESERIALIZING_MESSAGE_0 = new StringId(1256, "ClassNotFound deserializing message: {0}");
- public static final StringId Connection_CONNECTION_ATTEMPTING_RECONNECT_TO_PEER__0 = new StringId(1257, "Connection: Attempting reconnect to peer {0}");
- public static final StringId Connection_CONNECTION_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1258, "Connection: shared={0} ordered={1} failed to connect to peer {2} because: {3}");
- public static final StringId Connection_CONNECTION_HANDSHAKE_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1259, "Connection: shared={0} ordered={1} handshake failed to connect to peer {2} because: {3}");
- public static final StringId Connection_DETECTED_OLD_VERSION_PRE_5_0_1_OF_GEMFIRE_OR_NONGEMFIRE_DURING_HANDSHAKE_DUE_TO_INITIAL_BYTE_BEING_0 = new StringId(1260, "Detected old version (pre 5.0.1) of GemFire or non-GemFire during handshake due to initial byte being {0}");
- public static final StringId Connection_END_OF_FILE_ON_ACK_STREAM = new StringId(1261, "end of file on ack stream");
- public static final StringId Connection_ERROR_DESERIALIZING_MESSAGE = new StringId(1262, "Error deserializing message");
- public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_MESSAGE = new StringId(1263, "Error deserializing P2P handshake message");
- public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1264, "Error deserializing P2P handshake reply");
- public static final StringId Connection_ERROR_DISPATCHING_MESSAGE = new StringId(1265, "Error dispatching message");
- public static final StringId Connection_EXCEPTION_FLUSHING_BATCH_SEND_BUFFER_0 = new StringId(1266, "Exception flushing batch send buffer: {0}");
- public static final StringId Connection_FAILED_HANDLING_CHUNK_MESSAGE = new StringId(1267, "Failed handling chunk message");
- public static final StringId Connection_FAILED_HANDLING_END_CHUNK_MESSAGE = new StringId(1268, "Failed handling end chunk message");
- public static final StringId Connection_FAILED_SETTING_CHANNEL_TO_BLOCKING_MODE_0 = new StringId(1269, "Failed setting channel to blocking mode {0}");
- public static final StringId Connection_FINISHED_WAITING_FOR_REPLY_FROM_0 = new StringId(1270, "Finished waiting for reply from {0}");
- public static final StringId Connection_IOEXCEPTION_DESERIALIZING_MESSAGE = new StringId(1271, "IOException deserializing message");
- public static final StringId Connection_OWNER_SHOULD_NOT_BE_NULL = new StringId(1272, "\"owner\" should not be null");
- public static final StringId Connection_P2P_PUSHER_EXCEPTION_0 = new StringId(1273, "P2P pusher exception: {0}");
- public static final StringId Connection_QUEUED_BYTES_0_EXCEEDS_MAX_OF_1_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1274, "Queued bytes {0} exceeds max of {1}, asking slow receiver {2} to disconnect.");
- public static final StringId Connection_SOCKET_0_IS_1_INSTEAD_OF_THE_REQUESTED_2 = new StringId(1275, "Socket {0} is {1} instead of the requested {2}.");
- public static final StringId Connection_THROWABLE_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1276, "Throwable deserializing P2P handshake reply");
- public static final StringId Connection_THROWABLE_DISPATCHING_MESSAGE = new StringId(1277, "Throwable dispatching message");
- public static final StringId Connection_TIMED_OUT_WAITING_FOR_READERTHREAD_ON_0_TO_FINISH = new StringId(1278, "Timed out waiting for readerThread on {0} to finish.");
- public static final StringId Connection_UNABLE_TO_GET_INPUT_STREAM = new StringId(1279, "Unable to get input stream");
- public static final StringId Connection_UNABLE_TO_GET_P2P_CONNECTION_STREAMS = new StringId(1280, "Unable to get P2P connection streams");
- public static final StringId Connection_UNEXPECTED_FAILURE_DESERIALIZING_MESSAGE = new StringId(1281, "Unexpected failure deserializing message");
- public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0 = new StringId(1282, "Unknown handshake reply code: {0}");
- public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0_NIOMESSAGELENGTH_1_PROCESSORTYPE_2 = new StringId(1283, "Unknown handshake reply code: {0} nioMessageLength={1} processorType={2}");
- public static final StringId Connection_UNKNOWN_P2P_MESSAGE_TYPE_0 = new StringId(1284, "Unknown P2P message type: {0}");
- public static final StringId Connection_UNKNOWN_PROCESSOR_TYPE_0 = new StringId(1285, "Unknown processor type: {0}");
- public static final StringId ContainsKeyValueMess_PARTITIONED_REGION_0_IS_NOT_CONFIGURED_TO_STORE_DATA = new StringId(1286, "Partitioned Region {0} is not configured to store data");
- // ok to reuse 1287
- public static final StringId ContainsKey_0_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1288, "{0}: The input key for the containsKey request is null");
- public static final StringId ContainsKey_0_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1289, "{0}: The input region name for the containsKey request is null");
- public static final StringId ContainsKey_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1290, " The input key for the containsKey request is null");
- public static final StringId ContainsKey_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1291, " The input region name for the containsKey request is null");
- public static final StringId ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST = new StringId(1292, " was not found during containsKey request");
- public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_CREATING_USERTRANSACTION_OBJECT = new StringId(1293, "ContextImpl::lookup::Error while creating UserTransaction object");
- public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_LOOKING_UP_0 = new StringId(1294, "ContextImpl::lookup::Error while looking up {0}");
- public static final StringId CqAttributesFactory_EXCEPTION_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1295, "Exception closing CQ Listener Error: {0}");
- public static final StringId CqAttributesFactory_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1296, "Exception occurred while closing CQ Listener Error: {0}");
- public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1297, "Runtime Exception occurred closing CQ Listener Error: {0}");
- public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1298, "Runtime Exception occurred while closing CQ Listener Error: {0}");
- public static final StringId CqQueryImpl_FAILED_TO_STORE_CONTINUOUS_QUERY_IN_THE_REPOSITORY_CQNAME_0_1 = new StringId(1299, "Failed to store Continuous Query in the repository. CqName: {0} {1}");
-
- public static final StringId PRHARRedundancyProvider_0_IN_THE_PARTITIONED_REGION_REGION_NAME_1 = new StringId(1301, "{0} Region name = {1}");
- public static final StringId CqQueryImpl_CLASS_NOT_FOUND_EXCEPTION_THE_ANTLRJAR_OR_THE_SPCIFIED_CLASS_MAY_BE_MISSING_FROM_SERVER_SIDE_CLASSPATH_ERROR_0 = new StringId(1302, "Class not found exception. The antlr.jar or the spcified class may be missing from server side classpath. Error : {0}");
- public static final StringId CqQueryImpl_CQ_IS_NOT_IN_RUNNING_STATE_STOP_CQ_DOES_NOT_APPLY_CQNAME_0 = new StringId(1303, "CQ is not in running state, stop CQ does not apply, CqName : {0}");
- public static final StringId CqQueryImpl_CQ_QUERIES_CANNOT_HAVE_MORE_THAN_ONE_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1304, "CQ queries cannot have more than one iterator in the FROM clause");
- public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_ORDER_BY = new StringId(1305, "CQ queries do not support ORDER BY");
- public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_PROJECTIONS = new StringId(1306, "CQ queries do not support projections");
- public static final StringId CqQueryImpl_CQ_QUERIES_MUST_BE_A_SELECT_STATEMENT_ONLY = new StringId(1307, "CQ queries must be a select statement only");
- public static final StringId CqQueryImpl_CQ_QUERIES_MUST_HAVE_A_REGION_PATH_ONLY_AS_THE_FIRST_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1308, "CQ queries must have a region path only as the first iterator in the FROM clause");
- public static final StringId CqQueryImpl_CQ_QUERIES_MUST_REFERENCE_ONE_AND_ONLY_ONE_REGION = new StringId(1309, "CQ queries must reference one and only one region");
- public static final StringId CqQueryImpl_ERROR_WHILE_PARSING_THE_QUERY_ERROR_0 = new StringId(1310, "Error while parsing the query. Error : {0}");
- public static final StringId PRHARRedundancyProvider_UNABLE_TO_FIND_ANY_MEMBERS_TO_HOST_A_BUCKET_IN_THE_PARTITIONED_REGION_0 = new StringId(1311, "Unable to find any members to host a bucket in the partitioned region. {0}.{1}");
- public static final StringId CqQueryImpl_EXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1312, "Exception occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
-
- public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_ERROR_FROM_LAST_ENDPOINT_1 = new StringId(1314, "Failed to close the cq. CqName: {0}. Error from last endpoint: {1}");
-
- public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_ERROR_FROM_LAST_SERVER_1 = new StringId(1316, "Failed to stop the cq. CqName :{0} Error from last server: {1}");
-
- public static final StringId CqQueryImpl_REGION_ON_WHICH_QUERY_IS_SPECIFIED_NOT_FOUND_LOCALLY_REGIONNAME_0 = new StringId(1318, "Region on which query is specified not found locally, regionName: {0}");
- public static final StringId CqQueryImpl_REGION__0_SPECIFIED_WITH_CQ_NOT_FOUND_CQNAME_1 = new StringId(1319, "Region : {0} specified with cq not found. CqName: {1}");
- public static final StringId CqQueryImpl_RUNTIMEEXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1320, "RuntimeException occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
- public static final StringId CqQueryImpl_SELECT_DISTINCT_QUERIES_NOT_SUPPORTED_IN_CQ = new StringId(1321, "select DISTINCT queries not supported in CQ");
-
- public static final StringId CqQueryImpl_THE_WHERE_CLAUSE_IN_CQ_QUERIES_CANNOT_REFER_TO_A_REGION = new StringId(1323, "The WHERE clause in CQ queries cannot refer to a region");
- public static final StringId CqQueryImpl_UNABLE_TO_CREATE_CQ_0_ERROR__1 = new StringId(1324, "Unable to create cq {0} Error : {1}");
-
- public static final StringId CqQueryImpl_CQ_IS_IN_RUNNING_STATE_CQNAME_0 = new StringId(1327, "CQ is in running state, CqName : {0}");
-
- public static final StringId CqService_CLIENT_SIDE_NEWCQ_METHOD_INVOCATION_ON_SERVER = new StringId(1329, "client side newCq() method invocation on server.");
- public static final StringId CqService_CQ_NOT_FOUND_FAILED_TO_CLOSE_THE_SPECIFIED_CQ_0 = new StringId(1330, "CQ Not found, Failed to close the specified CQ {0}");
-
- public static final StringId CqService_CQ_NOT_FOUND_IN_THE_CQ_META_REGION_CQNAME_0 = new StringId(1332, "CQ not found in the cq meta region, CqName: {0}");
- public static final StringId CqService_CQ_WITH_THE_GIVEN_NAME_ALREADY_EXISTS_CQNAME_0 = new StringId(1333, "CQ with the given name already exists. CqName : {0}");
-
- public static final StringId RemoteGfManagerAgent_LISTENER_THREW_AN_EXCEPTION = new StringId(1335, "Listener threw an exception.");
- public static final StringId PRHARRedundancyProvider_FOUND_A_MEMBER_TO_HOST_A_BUCKET = new StringId(1336, "Found a member to host a bucket.");
- public static final StringId CqService_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1337, "Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
- public static final StringId CqService_EXCEPTION_WHILE_REGISTERING_CQ_ON_SERVER_CQNAME___0 = new StringId(1338, "Exception while registering CQ on server. CqName : {0}");
- public static final StringId CqService_FAILED_TO_CLOSE_CQ__0___1 = new StringId(1339, "Failed to close CQ {0} {1}");
-
- public static final StringId CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED = new StringId(1345, "Invalid CQ Monitor request received.");
-
- public static final StringId CqService_NULL_ARGUMENT_0 = new StringId(1348, "Null argument \"{0}\"");
- public static final StringId CqService_RUNTIME_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1349, "Runtime Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
- public static final StringId CqService_SERVER_SIDE_EXECUTECQ_METHOD_IS_CALLED_ON_CLIENT_CQNAME_0 = new StringId(1350, "Server side executeCq method is called on client. CqName : {0}");
-
- public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_THE_SERVER_ENDPOINTS_ON_WHICH_THIS_CQ_WAS_REGISTERED_WERE_NOT_FOUND = new StringId(1354, "Failed to close the cq. CqName: {0}. The server endpoints on which this cq was registered were not found.");
-
- public static final StringId CreateRegionProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1356, "More than one exception thrown in {0}");
- public static final StringId CreateRegion_0_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1357, "{0}: The input parent region name for the create region request is null");
- public static final StringId CreateRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1358, "{0}: The input region name for the create region request is null");
- public static final StringId CreateRegion_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1359, " The input parent region name for the create region request is null");
- public static final StringId CreateRegion_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1360, " The input region name for the create region request is null");
- public static final StringId DLockGrantor_DEBUGHANDLESUSPENDTIMEOUTS_SLEEPING_FOR__0 = new StringId(1361, "debugHandleSuspendTimeouts sleeping for {0}");
-
- public static final StringId DLockGrantor_DLOCKGRANTORTHREAD_WAS_UNEXPECTEDLY_INTERRUPTED = new StringId(1363, "DLockGrantorThread was unexpectedly interrupted");
-
- public static final StringId DLockGrantor_PROCESSING_OF_POSTREMOTERELEASELOCK_THREW_UNEXPECTED_RUNTIMEEXCEPTION = new StringId(1367, "Processing of postRemoteReleaseLock threw unexpected RuntimeException");
-
- public static final StringId DLockGrantor_RELEASED_REGULAR_LOCK_WITH_WAITING_READ_LOCK_0 = new StringId(1369, "Released regular lock with waiting read lock: {0}");
-
- public static final StringId DLockRequestProcessor_DLOCKREQUESTMESSAGEPROCESS_CAUGHT_THROWABLE = new StringId(1373, "[DLockRequestMessage.process] Caught throwable:");
- public static final StringId DLockRequestProcessor_FAILED_TO_FIND_PROCESSOR_FOR__0 = new StringId(1374, "Failed to find processor for {0}");
- public static final StringId DLockRequestProcessor_HANDLED_LOCAL_ORPHANED_GRANT = new StringId(1375, "Handled local orphaned grant.");
- public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITHOUT_RELEASE = new StringId(1376, "Handled orphaned grant without release.");
- public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITH_RELEASE = new StringId(1377, "Handled orphaned grant with release.");
- public static final StringId DLockRequestProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1378, "More than one exception thrown in {0}");
- public static final StringId DLockRequestProcessor_NO_PROCESSOR_FOUND_FOR_DLOCKRESPONSEMESSAGE__0 = new StringId(1379, "No processor found for DLockResponseMessage: {0}");
- public static final StringId DLockRequestProcessor_RELEASING_LOCAL_ORPHANED_GRANT_FOR_0 = new StringId(1380, "Releasing local orphaned grant for {0}.");
- public static final StringId DLockRequestProcessor_RELEASING_ORPHANED_GRANT_FOR__0 = new StringId(1381, "Releasing orphaned grant for {0}");
- public static final StringId DLockRequestProcessor_WAITING_TO_PROCESS_DLOCKRESPONSEMESSAGE = new StringId(1382, "Waiting to process DLockResponseMessage");
- public static final StringId DLockService_DEBUG_GRANTOR_REPORTS_NOT_HOLDER_FOR_0 = new StringId(1383, "DEBUG: Grantor reports NOT_HOLDER for {0}");
- public static final StringId DLockService_DEBUG_LOCKINTERRUPTIBLY_HAS_GONE_HOT_AND_LOOPED_0_TIMES = new StringId(1384, "DEBUG: lockInterruptibly has gone hot and looped [0] times");
-
- public static final StringId DLockService_FAILED_TO_NOTIFY_GRANTOR_OF_DESTRUCTION_WITHIN_0_ATTEMPTS = new StringId(1386, "Failed to notify grantor of destruction within {0} attempts.");
- public static final StringId DLockService_GRANTOR_CREATION_WAS_ABORTED_BUT_GRANTOR_WAS_NOT_DESTROYED = new StringId(1387, "Grantor creation was aborted but grantor was not destroyed");
- public static final StringId DLockService_GRANTOR_IS_STILL_INITIALIZING = new StringId(1388, "Grantor is still initializing");
- public static final StringId DLockService_GRANTOR_REPORTS_REENTRANT_LOCK_NOT_HELD_0 = new StringId(1389, "Grantor reports reentrant lock not held: {0}");
- public static final StringId DLockService_LOCK_WAS_INTERRUPTED = new StringId(1390, "lock() was interrupted");
-
- public static final StringId DLockToken_ATTEMPTING_TO_USE_DESTROYED_TOKEN_0 = new StringId(1392, "Attempting to use destroyed token: {0}");
- public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR = new StringId(1393, "Class {0} does not have a zero-argument constructor.");
- public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR_IT_IS_AN_INNER_CLASS_OF_1_SHOULD_IT_BE_A_STATIC_INNER_CLASS = new StringId(1394, "Class {0} does not have a zero-argument constructor. It is an inner class of {1}. Should it be a static inner class?");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCEMANAGED_CONNECTION_FACTORY_CLASS_IS_NOT_AVAILABLE = new StringId(1395, "DataSourceFactory::getManagedDataSource:Managed Connection factory class is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCE_EXCEPTION_IN_CREATING_MANAGED_CONNECTION_FACTORY_EXCEPTION_STRING_0 = new StringId(1396, "DataSourceFactory::getManagedDataSource: Exception in creating managed connection factory. Exception string = {0}");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETPOOLEDDATASOURCECONNECTIONPOOLDATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1397, "DataSourceFactory::getPooledDataSource:ConnectionPoolDataSource class name for the ResourceManager is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEJDBC_DRIVER_IS_NOT_AVAILABLE = new StringId(1398, "DataSourceFactory::getSimpleDataSource:JDBC Driver is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEURL_STRING_TO_DATABASE_IS_NULL = new StringId(1399, "DataSourceFactory::getSimpleDataSource:URL String to Database is null");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETTRANXDATASOURCEXADATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1400, "DataSourceFactory::getTranxDataSource:XADataSource class name for the ResourceManager is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETPOOLEDDATASOURCE_EXCEPTION_CREATING_CONNECTIONPOOLDATASOURCE_EXCEPTION_STRING_0 = new StringId(1401, "DataSourceFactory::getPooledDataSource:Exception creating ConnectionPoolDataSource.Exception string={0}");
- public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETSIMPLEDATASOURCE_EXCEPTION_WHILE_CREATING_GEMFIREBASICDATASOURCE_EXCEPTION_STRING_0 = new StringId(1402, "DataSourceFactory::getSimpleDataSource:Exception while creating GemfireBasicDataSource.Exception String={0}");
- public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETTRANXDATASOURCE_EXCEPTION_IN_CREATING_GEMFIRETRANSACTIONDATASOURCE__EXCEPTION_STRING_0 = new StringId(1403, "DataSourceFactory::getTranxDataSource:Exception in creating GemFireTransactionDataSource. Exception string={0}");
-
- public static final StringId DebuggerSupport_DEBUGGER_CONTINUING = new StringId(1405, "DEBUGGER: Continuing");
- public static final StringId DebuggerSupport_WAITING_FOR_DEBUGGER_TO_ATTACH_0 = new StringId(1406, "DEBUGGER: Waiting for Java debugger to attach... {0}");
-
- public static final StringId DefaultQueryService_EXCEPTION_REMOVING_INDEX___0 = new StringId(1408, "Exception removing index : {0}");
- public static final StringId DefaultQueryService_EXCEPTION_WHILE_CREATING_INDEX_ON_PR_DEFAULT_QUERY_PROCESSOR = new StringId(1409, "Exception while creating index on pr default query processor.");
-
- public static final StringId Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3 = new StringId(1412, "{0}: Unknown message type ({1}) with tx: {2} from {3}");
- public static final StringId DestroEntryMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_ENTRY_0_1_FROM_CONSOLE_AT_2 = new StringId(1413, "Failed attempt to destroy or invalidate entry {0} {1} from console at {2}");
- public static final StringId DestroRegionMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_REGION_0_FROM_CONSOLE_AT_1 = new StringId(1414, "Failed attempt to destroy or invalidate region {0} from console at {1}");
- public static final StringId DestroyRegionOperation_CACHEWRITER_SHOULD_NOT_HAVE_BEEN_CALLED = new StringId(1415, "CacheWriter should not have been called");
- public static final StringId DestroyRegionOperation_DISTRIBUTEDLOCK_SHOULD_NOT_HAVE_BEEN_ACQUIRED = new StringId(1416, "DistributedLock should not have been acquired");
- public static final StringId DestroyRegionOperation_EXCEPTION_WHILE_PROCESSING__0_ = new StringId(1417, "Exception while processing [ {0} ]");
- public static final StringId DestroyRegionOperation_GOT_TIMEOUT_WHEN_TRYING_TO_RECREATE_REGION_DURING_REINITIALIZATION_1 = new StringId(1418, "Got timeout when trying to recreate region during re-initialization: {1}");
- public static final StringId DestroyRegionOperation_REGION_DESTRUCTION_MESSAGE_IMPLEMENTATION_IS_IN_BASICPROCESS__NOT_THIS_METHOD = new StringId(1419, "Region Destruction message implementation is in basicProcess, not this method");
- public static final StringId DestroyRegion_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL = new StringId(1420, "{0}: The input region name for the destroy region request is null");
- public static final StringId Destroy_0_DURING_ENTRY_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1 = new StringId(1421, "{0}: during entry destroy no entry was found for key {1}");
- public static final StringId Destroy_0_THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1422, "{0}: The input key for the destroy request is null");
- public static final StringId Destroy_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1423, "{0}: The input region name for the destroy request is null");
- public static final StringId Destroy_0_UNEXPECTED_EXCEPTION = new StringId(1424, "{0}: Unexpected Exception");
- public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_JROCKIT_NIO_BUG = new StringId(1425, "Ignoring max-threads setting and using zero instead due to JRockit NIO bugs. See GemFire bug #40198");
- public static final StringId AbstractDistributionConfig_BIND_ADDRESS_0_INVALID_MUST_BE_IN_1 = new StringId(1426, "The bind-address \"{0}\" is not a valid address for this machine. These are the valid addresses for this machine: {1}");
- public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_WINDOWS_IPV6_BUG = new StringId(1427, "Ignoring max-threads setting and using zero instead due to Java bug 6230761: NIO does not work with IPv6 on Windows. See GemFire bug #40472");
-
- public static final StringId DirectChannel_0_SECONDS_HAVE_ELAPSED_WHILE_WAITING_FOR_REPLY_FROM_1_ON_2_WHOSE_CURRENT_MEMBERSHIP_LIST_IS_3 = new StringId(1430, "{0} seconds have elapsed while waiting for reply from {1} on {2} whose current membership list is: [{3}]");
-
- public static final StringId DirectChannel_GEMFIRE_P2P_LISTENER_STARTED_ON__0 = new StringId(1432, "GemFire P2P Listener started on {0}");
-
- public static final StringId DirectChannel_UNABLE_TO_INITIALIZE_DIRECT_CHANNEL_BECAUSE__0 = new StringId(1434, "Unable to initialize direct channel because: {0}");
- public static final StringId DirectChannel_UNEXPECTED_TIMEOUT_WHILE_WAITING_FOR_ACK_FROM__0 = new StringId(1435, "Unexpected timeout while waiting for ack from {0}");
- public static final StringId DirectChannel_VIEW_NO_LONGER_HAS_0_AS_AN_ACTIVE_MEMBER_SO_WE_WILL_NO_LONGER_WAIT_FOR_IT = new StringId(1436, "View no longer has {0} as an active member, so we will no longer wait for it.");
- public static final StringId DirectChannel_WHILE_PULLING_A_MESSAGE = new StringId(1437, "While pulling a message");
- public static final StringId TXState_CANNOT_COMMIT_REMOTED_TRANSACTION = new StringId(1438, "Cannot commit a transaction being run on behalf of a remote thread");
-
- public static final StringId DistributedCacheOperation_EXCEPTION_OCCURRED_WHILE_PROCESSING__0 = new StringId(1441, "Exception occurred while processing {0}");
-
- public static final StringId DistributedCacheOperation_WAITFORACKIFNEEDED_EXCEPTION = new StringId(1443, "waitForAckIfNeeded: exception");
- public static final StringId DistributedRegion_ATTEMPT_TO_ACQUIRE_DISTRIBUTED_LOCK_FOR_0_FAILED_AFTER_WAITING_1_SECONDS = new StringId(1444, "Attempt to acquire distributed lock for {0} failed after waiting {1} seconds.");
- public static final StringId DistributedRegion_DLS_DESTROY_MAY_HAVE_FAILED_FOR_0 = new StringId(1445, "DLS destroy may have failed for {0}");
- public static final StringId DistributedRegion_EXCEPTION_OCCURRED_IN_REGIONMEMBERSHIPLISTENER = new StringId(1446, "Exception occurred in RegionMembershipListener");
- public static final StringId DistributedRegion_NO_REPLICATED_REGION_FOUND_FOR_EXECUTING_FUNCTION_0 = new StringId(1447, "No Replicated Region found for executing function : {0}.");
- public static final StringId DistributedRegion_TIMED_OUT_AFTER_WAITING_0_SECONDS_FOR_THE_DISTRIBUTED_LOCK_FOR_1 = new StringId(1448, "Timed out after waiting {0} seconds for the distributed lock for {1}.");
- public static final StringId DistributedRegion_UNEXPECTED_EXCEPTION = new StringId(1449, "Unexpected exception:");
-
- public static final StringId DistributionAdvisor_UNEXPECTED_EXCEPTION = new StringId(1456, "Unexpected exception:");
- public static final StringId DistributionChannel_ATTEMPTING_A_SEND_TO_A_DISCONNECTED_DISTRIBUTIONMANAGER = new StringId(1457, "Attempting a send to a disconnected DistributionManager");
- public static final StringId DistributionLocatorImpl_DONE_WAITING_FOR_LOCATOR = new StringId(1458, "Done waiting for locator");
- public static final StringId DistributionLocator_COULD_NOT_BIND_LOCATOR_TO__0__1 = new StringId(1459, "Could not bind locator to {0}[{1}]");
- public static final StringId DistributionLocator_COULD_NOT_START_LOCATOR = new StringId(1460, "Could not start locator");
- public static final StringId DistributionLocator_LOCATOR_STOPPED = new StringId(1461, "Locator stopped");
- public static final StringId DistributionManager_0_IS_THE_ELDER_AND_THE_ONLY_MEMBER = new StringId(1462, "{0} is the elder and the only member.");
-
- public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CLOSED_1 = new StringId(1464, "Administration member at {0} closed: {1}");
- public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CRASHED_1 = new StringId(1465, "Administration member at {0} crashed: {1}");
- public static final StringId DistributionManager_ADMITTING_MEMBER_0_NOW_THERE_ARE_1_NONADMIN_MEMBERS = new StringId(1466, "Admitting member <{0}>. Now there are {1} non-admin member(s).");
- public static final StringId DistributionManager_AT_LEAST_ONE_EXCEPTION_OCCURRED = new StringId(1467, "At least one Exception occurred.");
- public static final StringId DistributionManager_CHANGING_ELDER_FROM_0_TO_1 = new StringId(1468, "Changing Elder from {0} to {1}.");
- public static final StringId DistributionManager_CLOBBERTHREAD_THREAD_REFUSED_TO_DIE__0 = new StringId(1469, "clobberThread: Thread refused to die: {0}");
- public static final StringId DistributionManager_DAEMON_THREADS_ARE_SLOW_TO_STOP_CULPRITS_INCLUDE_0 = new StringId(1470, "Daemon threads are slow to stop; culprits include: {0}");
- public static final StringId DistributionManager_DIDNT_HEAR_BACK_FROM_ANY_OTHER_SYSTEM_I_AM_THE_FIRST_ONE = new StringId(1471, "Did not hear back from any other system. I am the first one.");
- public static final StringId DistributionManager_DISTRIBUTIONMANAGER_0_STARTED_ON_1_THERE_WERE_2_OTHER_DMS_3_4_5 = new StringId(1472, "DistributionManager {0} started on {1}. There were {2} other DMs. others: {3} {4} {5}");
- public static final StringId DistributionManager_DISTRIBUTIONMANAGER_STOPPED_IN_0_MS = new StringId(1473, "DistributionManager stopped in {0}ms.");
- public static final StringId DistributionManager_DMMEMBERSHIP_ADMITTING_NEW_ADMINISTRATION_MEMBER__0_ = new StringId(1474, "DMMembership: Admitting new administration member < {0} >.");
-
- public static final StringId DistributionManager_ELDER__0__IS_NOT_CURRENTLY_AN_ACTIVE_MEMBER_SELECTING_NEW_ELDER = new StringId(1476, "Elder < {0} > is not currently an active member; selecting new elder.");
- public static final StringId DistributionManager_EXCEPTION_WHILE_CALLING_MEMBERSHIP_LISTENER_FOR_EVENT__0 = new StringId(1477, "Exception while calling membership listener for event: {0}");
- public static final StringId DistributionManager_FAILED_SENDING_SHUTDOWN_MESSAGE_TO_PEERS_TIMEOUT = new StringId(1478, "Failed sending shutdown message to peers (timeout)");
- public static final StringId DistributionManager_FORCING_AN_ELDER_JOIN_EVENT_SINCE_A_STARTUP_RESPONSE_WAS_NOT_RECEIVED_FROM_ELDER__0_ = new StringId(1479, "Forcing an elder join event since a startup response was not received from elder {0} .");
- public static final StringId DistributionManager_FORCING_THREAD_STOP_ON__0_ = new StringId(1480, "Forcing thread stop on < {0} >");
-
- public static final StringId DistributionManager_INITIAL_MEMBERSHIPMANAGER_VIEW___0 = new StringId(1482, "Initial (distribution manager) view = {0}");
- public static final StringId DistributionManager_MARKING_DISTRIBUTIONMANAGER_0_AS_CLOSED = new StringId(1483, "Marking DistributionManager {0} as closed.");
- public static final StringId DistributionManager_MARKING_THE_SERIALQUEUEDEXECUTOR_WITH_ID__0__USED_BY_THE_MEMBER__1__TO_BE_UNUSED = new StringId(1484, "Marking the SerialQueuedExecutor with id : {0} used by the member {1} to be unused.");
- public static final StringId DistributionManager_MEMBER_AT_0_GRACEFULLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1485, "Member at {0} gracefully left the distributed cache: {1}");
- public static final StringId DistributionManager_MEMBER_AT_0_UNEXPECTEDLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1486, "Member at {0} unexpectedly left the distributed cache: {1}");
- public static final StringId DistributionManager_NEWLY_SELECTED_ELDER_IS_NOW__0_ = new StringId(1487, "Newly selected elder is now < {0} >");
- public static final StringId DistributionManager_NEW_ADMINISTRATION_MEMBER_DETECTED_AT_0 = new StringId(1488, "New administration member detected at {0}.");
- public static final StringId DistributionManager_NOW_CLOSING_DISTRIBUTION_FOR__0 = new StringId(1489, "Now closing distribution for {0}");
- public static final StringId DistributionManager_SHUTTING_DOWN_DISTRIBUTIONMANAGER_0_1 = new StringId(1490, "Shutting down DistributionManager {0}. {1}");
- public static final StringId DistributionManager_STARTING_DISTRIBUTIONMANAGER_0_1 = new StringId(1491, "Starting DistributionManager {0}. {1}");
- public static final StringId DistributionManager_STILL_AWAITING_0_RESPONSES_FROM_1 = new StringId(1492, "Still awaiting {0} response(s) from: {1}.");
- public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_PEER_DEPARTED_THE_VIEW = new StringId(1493, "Stopped waiting for startup reply from <{0}> because the peer departed the view.");
- public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_REPLY_WAS_FINALLY_RECEIVED = new StringId(1494, "Stopped waiting for startup reply from <{0}> because the reply was finally received.");
- public static final StringId DistributionManager_TASK_FAILED_WITH_EXCEPTION = new StringId(1495, "Task failed with exception");
- public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_CALLING_READYFORMESSAGES = new StringId(1496, "Uncaught exception calling readyForMessages");
- public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_PROCESSING_MEMBER_EVENT = new StringId(1497, "Uncaught exception processing member event");
- public static final StringId DistributionManager_UNEXPECTED_INTERRUPTEDEXCEPTION = new StringId(1498, "Unexpected InterruptedException");
-
- public static final StringId DistributionManager_WHILE_PUSHING_MESSAGE_0_TO_1 = new StringId(1500, "While pushing message <{0}> to {1}");
- public static final StringId DistributionManager_WHILE_SENDING_SHUTDOWN_MESSAGE = new StringId(1501, "While sending shutdown message");
- public static final StringId DistributionMessage_0__SCHEDULE_REJECTED = new StringId(1502, "{0} schedule() rejected");
- public static final StringId DistributionMessage_UNCAUGHT_EXCEPTION_PROCESSING__0 = new StringId(1503, "Uncaught exception processing {0}");
-
-
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONCREATED = new StringId(1508, "DynamicRegionListener {0} threw exception on afterRegionCreated");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONDESTROYED = new StringId(1509, "DynamicRegionListener {0} threw exception on afterRegionDestroyed");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONCREATED = new StringId(1510, "DynamicRegionListener {0} threw exception on beforeRegionCreated");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONDESTROYED = new StringId(1511, "DynamicRegionListener {0} threw exception on beforeRegionDestroyed");
- public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_CREATE_DYNAMIC_REGION__0 = new StringId(1512, "Error attempting to locally create Dynamic Region: {0}");
- public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_DESTROY_DYNAMIC_REGION__0 = new StringId(1513, "Error attempting to locally destroy Dynamic Region: {0}");
- public static final StringId DynamicRegionFactory_ERROR_DESTROYING_DYNAMIC_REGION__0 = new StringId(1514, "Error destroying Dynamic Region ''{0}''");
- public static final StringId DynamicRegionFactory_ERROR_INITIALIZING_DYNAMICREGIONFACTORY = new StringId(1515, "Error initializing DynamicRegionFactory");
- public static final StringId DynamicRegionFactory_ERROR__COULD_NOT_FIND_A_REGION_NAMED___0_ = new StringId(1516, "Error -- Could not find a region named: ''{0}''");
- public static final StringId ElderState_ELDERSTATE_PROBLEM_DM_0_BUT_SYSTEM_DISTRIBUTIONMANAGER_1 = new StringId(1517, "ElderState problem: dm={0}, but system DistributionManager={1}");
- public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_0 = new StringId(1518, "ElderState problem: system={0}");
- public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_DISTRIBUTIONMANAGER_0 = new StringId(1519, "ElderState problem: system DistributionManager={0}");
-
- public static final StringId EntryEventImpl_DATASTORE_FAILED_TO_CALCULATE_SIZE_OF_NEW_VALUE = new StringId(1540, "DataStore failed to calculate size of new value");
- public static final StringId EntryEventImpl_DATASTORE_FAILED_TO_CALCULATE_SIZE_OF_OLD_VALUE = new StringId(1541, "DataStore failed to calculate size of old value");
- public static final StringId ExpirationScheduler_SCHEDULING__0__TO_FIRE_IN__1__MS = new StringId(1542, "Scheduling {0} to fire in {1} ms");
- public static final StringId ExpiryTask_EXCEPTION_IN_EXPIRATION_TASK = new StringId(1543, "Exception in expiration task");
-
- public static final StringId FetchEntriesMessage_FETCHKEYSMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1545, "FetchKeysMessage: data store not configured for this member");
-
- public static final StringId FetchKeysMessage_FETCHKEYSMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1547, "FetchKeysMessage: data store not configured for this member");
- public static final StringId ForceDisconnectOperation_DISCONNECT_FORCED_BY__0__BECAUSE_WE_WERE_TOO_SLOW = new StringId(1548, "Disconnect forced by {0} because we were too slow.");
- public static final StringId GLOBALTRANSACTION__ENLISTRESOURCE__ERROR_WHILE_ENLISTING_XARESOURCE_0_1 = new StringId(1549, "GlobalTransaction::enlistResource::error while enlisting XAResource {0} {1}");
-
- public static final StringId GatewayEventRemoteDispatcher_0_USING_1 = new StringId(1552, "{0}: Using {1}");
- public static final StringId GatewayEventRemoteDispatcher_0_USING_1_AFTER_2_FAILED_CONNECT_ATTEMPTS = new StringId(1553, "{0}: Using {1} after {2} failed connect attempts");
-
- public static final StringId GatewayEventRemoteDispatcher_A_BATCHEXCEPTION_OCCURRED_PROCESSING_EVENT__0 = new StringId(1556, "A BatchException occurred processing events. Index of Array of Exception : {0}");
- public static final StringId GatewayEventRemoteDispatcher_NO_AVAILABLE_CONNECTION_WAS_FOUND_BUT_THE_FOLLOWING_ACTIVE_SERVERS_EXIST_0 = new StringId(1557, "No available connection was found, but the following active servers exist: {0}");
- public static final StringId GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH = new StringId(1558, "Stopping the processor because the following exception occurred while processing a batch:");
-
- public static final StringId GatewayEventRemoteDispatcher_THERE_ARE_NO_ACTIVE_SERVERS = new StringId(1560, "There are no active servers.");
- public static final StringId GatewayEventRemoteDispatcher_THE_EVENT_BEING_PROCESSED_WHEN_THE_BATCHEXCEPTION_OCCURRED_WAS__0 = new StringId(1561, "The event being processed when the BatchException occurred was: {0}");
-
- public static final StringId GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT = new StringId(1564, "{0}: Could not connect.");
-
- public static final StringId GatewaySender_0_IS_BECOMING_PRIMARY_GATEWAY_Sender = new StringId(1566, "{0} is becoming primary gateway Sender.");
-
- public static final StringId GatewaySenderAdvisor_0_THE_THREAD_TO_OBTAIN_THE_FAILOVER_LOCK_WAS_INTERRUPTED__THIS_GATEWAY_SENDER_WILL_NEVER_BECOME_THE_PRIMARY = new StringId(1568, "{0}: The thread to obtain the failover lock was interrupted. This gateway sender will never become the primary.");
-
- public static final StringId SerialGatewaySenderImpl_0__STARTING_AS_PRIMARY = new StringId(1570, "{0} : Starting as primary");
-
- public static final StringId GatewaySender_COULD_NOT_STOP_LOCK_OBTAINING_THREAD_DURING_GATEWAY_SENDER_STOP = new StringId(1573, "Could not stop lock obtaining thread during gateway sender stop");
-
- public static final StringId GatewayImpl_0__MARKING__1__EVENTS_AS_POSSIBLE_DUPLICATES = new StringId(1578, "{0} : Marking {1} events as possible duplicates");
-
- public static final StringId GatewayImpl_0__WAITING_FOR_FAILOVER_COMPLETION = new StringId(1580, "{0} : Waiting for failover completion");
- public static final StringId GatewayImpl_0__WAITING_TO_BECOME_PRIMARY_GATEWAY = new StringId(1581, "{0} : Waiting to become primary gateway");
- public static final StringId GatewayImpl_ABOUT_TO_PROCESS_THE_MESSAGE_QUEUE_BUT_NOT_THE_PRIMARY = new StringId(1582, "About to process the message queue but not the primary.");
-
- public static final StringId GatewayImpl_DESTROYING_GATEWAYEVENTDISPATCHER_WITH_ACTIVELY_QUEUED_DATA = new StringId(1584, "Destroying GatewayEventDispatcher with actively queued data.");
-
- public static final StringId SerialGatewaySenderImpl_STARTED__0 = new StringId(1586, "Started {0}");
- public static final StringId GatewayImpl_STOPPED__0 = new StringId(1587, "Stopped {0}");
- public static final StringId SerialGatewaySenderImpl_0__STARTING_AS_SECONDARY_BECAUSE_PRIMARY_GATEWAY_SENDER_IS_AVAIALABLE_ON_MEMBER_2 = new StringId(1588, "{0} starting as secondary because primary gateway sender is available on member :{1}");
- public static final StringId GemFireBasicDataSource_AN_EXCEPTION_WAS_CAUGHT_WHILE_TRYING_TO_LOAD_THE_DRIVER = new StringId(1589, "An Exception was caught while trying to load the driver. {0}");
- public static final StringId GemFireBasicDataSource_GEMFIREBASICDATASOURCE_GETCONNECTION_URL_FOR_THE_DATASOURCE_NOT_AVAILABLE = new StringId(1590, "GemFireBasicDataSource::getConnection:Url for the DataSource not available");
- public static final StringId GemFireCache_0__NOW_CLOSING = new StringId(1591, "{0} : Now closing.");
- public static final StringId GemFireCache_INITIALIZING_CACHE_USING__0__1 = new StringId(1592, "Initializing cache using \"{0}\":{1}");
- public static final StringId GemFireCache_FAILED_TO_GET_THE_CQSERVICE_TO_CLOSE_DURING_CACHE_CLOSE_1 = new StringId(1593, "Failed to get the CqService, to close during cache close (1).");
- public static final StringId GemFireCache_FAILED_TO_GET_THE_CQSERVICE_TO_CLOSE_DURING_CACHE_CLOSE_2 = new StringId(1594, "Failed to get the CqService, to close during cache close (2).");
- public static final StringId GemFireCache_WHILE_READING_CACHE_XML_0_1 = new StringId(1595, "While reading Cache XML {0}. {1}");
-
- public static final StringId GemFireConnPooledDataSource_EXCEPTION_CREATING_GEMFIRECONNECTIONPOOLMANAGER = new StringId(1620, "An exception was caught while creating a GemFireConnectionPoolManager. {0}");
- public static final StringId CqQueryImpl_FAILED_TO_REMOVE_CONTINUOUS_QUERY_FROM_THE_REPOSITORY_CQNAME_0_ERROR_1 = new StringId( 1621, "Failed to remove Continuous Query From the repository. CqName: {0} Error : {1}");
-
- public static final StringId GemFireStatSampler_ARCHIVING_STATISTICS_TO__0_ = new StringId(1633, "Archiving statistics to \"{0}\".");
- public static final StringId GemFireStatSampler_COULD_NOT_OPEN_STATISTIC_ARCHIVE_0_CAUSE_1 = new StringId(1634, "Could not open statistic archive {0}. Cause: {1}");
- public static final StringId GemFireStatSampler_COULD_NOT_RENAME_0_TO_1 = new StringId(1635, "Could not rename \"{0}\" to \"{1}\".");
- public static final StringId GemFireStatSampler_DISABLING_STATISTIC_ARCHIVAL = new StringId(1636, "Disabling statistic archival.");
- public static final StringId GemFireStatSampler_RENAMED_OLD_EXISTING_ARCHIVE_TO__0_ = new StringId(1637, "Renamed old existing archive to \"{0}\".");
- public static final StringId GemFireStatSampler_STATISTIC_ARCHIVE_CLOSE_FAILED_BECAUSE__0 = new StringId(1638, "Statistic archive close failed because: {0}");
-
- public static final StringId GlobalTransaction_GLOBALTRANSACTIONENLISTRESOURCEONLY_ONE_RESOUCE_MANAGER_SUPPORTED = new StringId(1644, "GlobalTransaction::enlistResource::Only one Resouce Manager supported");
- public static final StringId GlobalTransaction_GLOBALTRANSACTION_CONSTRUCTOR_ERROR_WHILE_TRYING_TO_CREATE_XID_DUE_TO_0 = new StringId(1645, "GlobalTransaction::Constructor::Error while trying to create Xid due to {0}");
- public static final StringId GlobalTransaction_GLOBATRANSACTION_EXPIREGTX_ERROR_OCCURED_WHILE_REMOVING_TRANSACTIONAL_MAPPINGS_0 = new StringId(1646, "GlobaTransaction::expireGTX:Error occurred while removing transactional mappings {0}");
- public static final StringId GlobalTransaction_TRANSACTION_0_HAS_TIMED_OUT = new StringId(1647, "Transaction {0} has timed out.");
- public static final StringId GrantorRequestProcessor_GRANTORREQUESTPROCESSOR_ELDERSYNCWAIT_THE_CURRENT_ELDER_0_IS_WAITING_FOR_THE_NEW_ELDER_1 = new StringId(1648, "GrantorRequestProcessor.elderSyncWait: The current Elder {0} is waiting for the new Elder {1}.");
- public static final StringId HARegionQueue_DACEREMOVEEVENTANDSETSEQUENCEID_SINCE_THE_EVENT_WAS_SUCCESSULY_REMOVED_BY_TAKE_OPERATION_IT_SHOULD_HAVE_EXISTED_IN_THE_REGION = new StringId(1649, "DACE::removeEventAndSetSequenceID: Since the event was successuly removed by a take operation, it should have existed in the region");
- public static final StringId HARegionQueue_DISPATCHEDANDCURRENTEVENTSEXPIREORUPDATE_UNEXPECTEDLY_ENCOUNTERED_EXCEPTION_WHILE_REMOVING_EXPIRY_ENTRY_FOR_THREADIDENTIFIER_0_AND_EXPIRY_VALUE_1 = new StringId(1650, "DispatchedAndCurrentEvents::expireOrUpdate: Unexpectedly encountered exception while removing expiry entry for ThreadIdentifier={0} and expiry value={1}");
- public static final StringId HARegionQueue_DISPATCHEDANDCURRENTEVENTSEXPIREORUPDATE_UNEXPECTEDLY_ENCOUNTERED_EXCEPTION_WHILE_UPDATING_EXPIRY_ID_FOR_THREADIDENTIFIER_0 = new StringId(1651, "DispatchedAndCurrentEvents::expireOrUpdate: Unexpectedly encountered exception while updating expiry ID for ThreadIdentifier={0}");
- public static final StringId HARegionQueue_EXCEPTION_OCCURED_WHILE_TRYING_TO_SET_THE_LAST_DISPATCHED_ID = new StringId(1652, "Exception occurred while trying to set the last dispatched id");
- public static final StringId HARegionQueue_HAREGIONQUEUECREATECACHELISTNEREXCEPTION_IN_THE_EXPIRY_THREAD = new StringId(1653, "HAREgionQueue::createCacheListner::Exception in the expiry thread");
-
- public static final StringId HARegionQueue_HAREGIONQUEUE_AND_ITS_DERIVED_CLASS_DO_NOT_SUPPORT_THIS_OPERATION = new StringId(1655, "HARegionQueue and its derived class do not support this operation ");
- public static final StringId ConnectionTable_THE_DISTRIBUTED_SYSTEM_IS_SHUTTING_DOWN = new StringId(1656, "The distributed system is shutting down");
- public static final StringId HARegionQueue_INTERRUPTEDEXCEPTION_OCCURED_IN_QUEUEREMOVALTHREAD_WHILE_WAITING = new StringId(1657, "InterruptedException occurred in QueueRemovalThread while waiting ");
- public static final StringId HealthMonitorImpl_UNEXPECTED_STOP_OF_HEALTH_MONITOR = new StringId(1658, "Unexpected stop of health monitor");
-
- public static final StringId HARegionQueue_THE_QUEUEREMOVALTHREAD_IS_DONE = new StringId(1660, "The QueueRemovalThread is done.");
- public static final StringId HighPriorityAckedMessage_0_THERE_ARE_STILL_1_OTHER_THREADS_ACTIVE_IN_THE_HIGH_PRIORITY_THREAD_POOL = new StringId(1661, "{0}: There are still {1} other threads active in the high priority thread pool.");
- public static final StringId HostStatSampler_HOSTSTATSAMPLER_THREAD_COULD_NOT_BE_STOPPED = new StringId(1662, "HostStatSampler thread could not be stopped during shutdown.");
- public static final StringId HostStatSampler_STATISIC_ARCHIVER_SHUTDOWN_FAILED_BECAUSE__0 = new StringId(1663, "Statistic archiver shutdown failed because: {0}");
- public static final StringId HostStatSampler_STATISTIC_ARCHIVER_SHUTDOWN_FAILED_BECAUSE__0 = new StringId(1664, "Statistic archiver shutdown failed because: {0}");
- public static final StringId HostStatSampler_STATISTIC_ARCHIVER_SHUTTING_DOWN_BECAUSE__0 = new StringId(1665, "Statistic archiver shutting down because: {0}");
-
- public static final StringId IndexCreationMsg_REGION_IS_LOCALLY_DESTROYED_THROWING_REGIONDESTROYEDEXCEPTION_FOR__0 = new StringId(1673, "Region is locally destroyed, throwing RegionDestroyedException for {0}");
- public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_THE_SERVER_ENDPOINTS_ON_WHICH_THIS_CQ_WAS_REGISTERED_WERE_NOT_FOUND = new StringId(1676, "Failed to stop the cq. CqName: {0}. The server endpoints on which this cq was registered were not found.");
-
- public static final StringId InternalDataSerializer_COULD_NOT_LOAD_DATASERIALIZER_CLASS_0 = new StringId(1679, "Could not load DataSerializer class: {0}");
- public static final StringId InternalDataSerializer_REGISTER_DATASERIALIZER_0_OF_CLASS_1 = new StringId(1680, "Register DataSerializer {0} of class {1}");
- public static final StringId InternalDistributedSystem_CONNECTLISTENER_THREW = new StringId(1681, "ConnectListener threw...");
- public static final StringId InternalDistributedSystem_DISCONNECTLISTENERSHUTDOWN_THREW = new StringId(1682, "DisconnectListener/Shutdown threw...");
- public static final StringId InternalDistributedSystem_DISCONNECT_LISTENER_IGNORED_ITS_INTERRUPT__0 = new StringId(1683, "Disconnect listener ignored its interrupt: {0}");
-
- public static final StringId InternalDistributedSystem_DISCONNECT_LISTENER_STILL_RUNNING__0 = new StringId(1685, "Disconnect listener still running: {0}");
- public static final StringId InternalDistributedSystem_EXCEPTION_OCCURED_WHILE_TRYING_TO_CONNECT_THE_SYSTEM_DURING_RECONNECT = new StringId(1686, "Exception occurred while trying to connect the system during reconnect");
- public static final StringId InternalDistributedSystem_EXCEPTION_OCCURED_WHILE_TRYING_TO_CREATE_THE_CACHE_DURING_RECONNECT = new StringId(1687, "Exception occurred while trying to create the cache during reconnect");
- public static final StringId InternalDistributedSystem_INTERRUPTED_WHILE_PROCESSING_DISCONNECT_LISTENER = new StringId(1688, "Interrupted while processing disconnect listener");
-
- public static final StringId GemFireCacheImpl_RUNNING_IN_LOCAL_MODE = new StringId(1690, "Running in local mode since no locators were specified.");
- public static final StringId InternalDistributedSystem_SHUTDOWNLISTENER__0__THREW = new StringId(1691, "ShutdownListener < {0} > threw...");
- public static final StringId InternalDistributedSystem_STARTUP_CONFIGURATIONN_0 = new StringId(1692, "Startup Configuration:\n {0}");
-
- public static final StringId InternalInstantiator_CLASS_0_DOES_NOT_HAVE_A_TWOARGUMENT_CLASS_INT_CONSTRUCTOR = new StringId(1694, "Class {0} does not have a two-argument (Class, int) constructor.");
- public static final StringId InternalInstantiator_CLASS_0_DOES_NOT_HAVE_A_TWOARGUMENT_CLASS_INT_CONSTRUCTOR_IT_IS_AN_INNER_CLASS_OF_1_SHOULD_IT_BE_A_STATIC_INNER_CLASS = new StringId(1695, "Class {0} does not have a two-argument (Class, int) constructor. It is an inner class of {1}. Should it be a static inner class?");
- public static final StringId InternalInstantiator_COULD_NOT_LOAD_INSTANTIATED_CLASS_0 = new StringId(1696, "Could not load instantiated class: {0}");
- public static final StringId InternalInstantiator_COULD_NOT_LOAD_INSTANTIATOR_CLASS_0 = new StringId(1697, "Could not load instantiator class: {0}");
- public static final StringId InternalLocator_0__IS_STOPPED = new StringId(1698, "{0} is stopped");
- public static final StringId InternalLocator_COULD_NOT_STOP__0__IN_60_SECONDS = new StringId(1699, "Could not stop {0} in 60 seconds");
-
- public static final StringId InternalLocator_INTERRUPTED_WHILE_STOPPING__0 = new StringId(1701, "Interrupted while stopping {0}");
- public static final StringId InternalLocator_LOCATOR_STARTED_ON__0 = new StringId(1702, "Locator started on {0}");
- public static final StringId StartupMessage_REJECTED_NEW_SYSTEM_NODE_0_BECAUSE_MCAST_PORT_1_DOES_NOT_MATCH_THE_DISTRIBUTED_SYSTEM_2_IT_IS_ATTEMPTING_TO_JOIN = new StringId(1703, "Rejected new system node {0} because its mcast-port {1} does not match the mcast-port {2} of the distributed system it is attempting to join. To fix this make sure the \"mcast-port\" gemfire property is set the same on all members of the same distributed system.");
- public static final StringId StartupMessage_REJECTED_NEW_SYSTEM_NODE_0_BECAUSE_MCAST_ADDRESS_1_DOES_NOT_MATCH_THE_DISTRIBUTED_SYSTEM_2_IT_IS_ATTEMPTING_TO_JOIN = new StringId(1704, "Rejected new system node {0} because its mcast-address {1} does not match the mcast-address {2} of the distributed system it is attempting to join. To fix this make sure the \"mcast-address\" gemfire property is set the same on all members of the same distributed system.");
- public static final StringId ReplyProcessor21_UNKNOWN_DSFID_ERROR = new StringId(1705,
- "Exception received due to missing DSFID {0} on remote node \"{1}\" "
- + "running version \"{2}\".");
-
- public static final StringId InternalLocator_STARTING_DISTRIBUTED_SYSTEM = new StringId(1707, "Starting distributed system");
-
- public static final StringId InternalLocator_STOPPING__0 = new StringId(1709, "Stopping {0}");
- public static final StringId InternalLocator_USING_EXISTING_DISTRIBUTED_SYSTEM__0 = new StringId(1710, "Using existing distributed system: {0}");
- public static final StringId Invalid_0_INVALID_MESSAGE_TYPE_WITH_TX_1_FROM_2 = new StringId(1711, "{0}: INVALID message type with tx: {1} from {2}");
-
- public static final StringId JCAConnectionManagerImpl_EXCEPTION_CAUGHT_WHILE_INITIALIZING = new StringId(1713, "JCAConnectionManagerImpl::Constructor: An exception was caught while initialising due to {0}" );
- public static final StringId GroupMembershipService_JOINED_TOOK__0__MS = new StringId(1714, "Joined the distributed system (took {0} ms)");
- public static final StringId GroupMembershipService_FAILED_TO_SEND_MESSAGE_0_TO_MEMBER_1_VIEW_2 = new StringId(1715, "Failed to send message <{0}> to member <{1}> view = {2}");
-
-
- public static final StringId GroupMembershipService_MEMBERSHIP_ERROR_HANDLING_STARTUP_EVENT = new StringId(1720, "Membership: Error handling startup event");
- public static final StringId GroupMembershipService_MEMBERSHIP_FAULT_WHILE_PROCESSING_VIEW_ADDITION_OF__0 = new StringId(1721, "Membership: Fault while processing view addition of {0}");
- public static final StringId GroupMembershipService_MEMBERSHIP_FAULT_WHILE_PROCESSING_VIEW_REMOVAL_OF__0 = new StringId(1722, "Membership: Fault while processing view removal of {0}");
-
- public static final StringId GroupMembershipService_MEMBERSHIP_IGNORING_SURPRISE_CONNECT_FROM_SHUNNED_MEMBER_0 = new StringId(1726, "Membership: Ignoring surprise connect from shunned member <{0}>");
-
- public static final StringId GroupMembershipService_MEMBERSHIP_PROCESSING_ADDITION__0_ = new StringId(1730, "Membership: Processing addition < {0} >");
-
- public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSNAMINGEXCEPTION_WHILE_BINDING_TRANSACTIONMANAGERUSERTRANSACTION_TO_APPLICATION_SERVER_JNDI_TREE = new StringId(1737, "JNDIInvoker::mapTransactions::NamingException while binding TransactionManager/UserTransaction to Application Server JNDI Tree");
- public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSNAMINGEXCEPTION_WHILE_BINDING_TRANSACTIONMANAGERUSERTRANSACTION_TO_GEMFIRE_JNDI_TREE = new StringId(1738, "JNDIInvoker::mapTransactions::NamingException while binding TransactionManager/UserTransaction to GemFire JNDI Tree");
- public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSSYSTEMEXCEPTION_WHILE_BINDING_TRANSACTIONMANAGERUSERTRANSACTION_TO_APPLICATION_SERVER_JNDI_TREE = new StringId(1739, "JNDIInvoker::mapTransactions::SystemException while binding TransactionManager/UserTransaction to Application Server JNDI Tree");
- public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSSYSTEMEXCEPTION_WHILE_BINDING_USERTRANSACTION_TO_GEMFIRE_JNDI_TREE = new StringId(1740, "JNDIInvoker::mapTransactions::SystemException while binding UserTransaction to GemFire JNDI Tree");
- public static final StringId JNDIInvoker_JNDIINVOKER_DOTRANSACTIONLOOKUP_FOUND_WEBSPHERE_TRANSACTIONMANAGER_FACTORY_CLASS_0_BUT_COULDNT_INVOKE_ITS_STATIC_GETTRANSACTIONMANAGER_METHOD = new StringId(1741, "JNDIInvoker::doTransactionLookup::Found WebSphere TransactionManager factory class [{0}], but could not invoke its static ''getTransactionManager'' method");
- public static final StringId JNDIInvoker_JNDIINVOKER_MAPDATASOURCE_0_WHILE_BINDING_1_TO_JNDI_CONTEXT = new StringId(1742, "JNDIInvoker::mapDataSource::{0} while binding {1} to JNDI Context");
- public static final StringId GemFireStatSampler_OS_STATISTICS_FAILED_TO_INITIALIZE_PROPERLY_SOME_STATS_MAY_BE_MISSING_SEE_BUGNOTE_37160 = new StringId(1743, "OS statistics failed to initialize properly, some stats may be missing. See bugnote #37160.");
- public static final StringId GemFireStatSampler_OS_STATISTIC_COLLECTION_DISABLED_BY_OSSTATSDISABLED_SYSTEM_PROPERTY = new StringId(1744, "OS statistic collection disabled by setting the \"osStatsDisabled\" system property to true.");
- public static final StringId KeySet_0_THE_INPUT_REGION_NAME_FOR_THE_KEY_SET_REQUEST_IS_NULL = new StringId(1745, "{0}: The input region name for the key set request is null");
- public static final StringId DataSerializer_ENUM_TO_SERIALIZE_IS_NULL = new StringId(1746, "The enum constant to serialize is null");
- public static final StringId DataSerializer_ENUM_CLASS_TO_DESERIALIZE_IS_NULL = new StringId(1747, "the enum class to deserialize is null");
-
- public static final StringId LocalRegion_0_EVENT_NOT_DISPATCHED_DUE_TO_REJECTED_EXECUTION = new StringId(1766, "{0} Event not dispatched due to rejected execution");
- public static final StringId LocalRegion_0_OPERATIONS_ARE_NOT_ALLOWED_BECAUSE_THIS_THREAD_HAS_AN_ACTIVE_TRANSACTION = new StringId(1767, "{0} operations are not allowed because this thread has an active transaction");
- public static final StringId LocalRegion_EXCEPTION_IN_EXPIRATION_TASK = new StringId(1768, "Exception in expiration task");
- public static final StringId LocalRegion_EXCEPTION_OCCURRED_IN_CACHELISTENER = new StringId(1769, "Exception occurred in CacheListener");
- public static final StringId LocalRegion_EXCEPTION_OCCURRED_WHILE_CLOSING_CQS_ON_REGION_DESTORY = new StringId(1770, "Exception occurred while closing CQs on region destroy.");
- public static final StringId LocalRegion_REGIONENTRY_SHOULD_NOT_BE_NULL = new StringId(1771, "regionEntry should not be null");
- public static final StringId LocalRegion_REGIONENTRY_WAS_CREATED_WITH_TRANSACTION_THAT_IS_NO_LONGER_ACTIVE = new StringId(1772, "Region.Entry was created with transaction that is no longer active.");
- public static final StringId LocalRegion_REGION_COLLECTION_WAS_CREATED_WITH_TRANSACTION_0_THAT_IS_NO_LONGER_ACTIVE
<TRUNCATED>
[16/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
new file mode 100644
index 0000000..ec7a23b
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import org.junit.After;
+import org.junit.Before;
+
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+
+public abstract class AbstractServerLauncherRemoteIntegrationTestCase extends AbstractServerLauncherIntegrationTestCase {
+
+ protected volatile Process process;
+ protected volatile ProcessStreamReader processOutReader;
+ protected volatile ProcessStreamReader processErrReader;
+
+ @Before
+ public final void setUpAbstractServerLauncherRemoteIntegrationTestCase() throws Exception {
+ }
+
+ @After
+ public final void tearDownAbstractServerLauncherRemoteIntegrationTestCase() throws Exception {
+ if (this.process != null) {
+ this.process.destroy();
+ this.process = null;
+ }
+ if (this.processOutReader != null && this.processOutReader.isRunning()) {
+ this.processOutReader.stop();
+ }
+ if (this.processErrReader != null && this.processErrReader.isRunning()) {
+ this.processErrReader.stop();
+ }
+ }
+
+ /**
+ * Override as needed.
+ */
+ protected List<String> getJvmArguments() {
+ final List<String> jvmArguments = new ArrayList<String>();
+ jvmArguments.add("-Dgemfire.log-level=config");
+ return jvmArguments;
+ }
+
+ /**
+ * Remove final if a test needs to override.
+ */
+ protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ return AbstractLauncher.Status.NOT_RESPONDING;
+ }
+
+ protected void waitForServerToStart() throws Exception {
+ assertEventuallyTrue("waiting for local Server to start: " + launcher.status(), new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ try {
+ assertNotNull(process);
+ try {
+ final int value = process.exitValue();
+ fail("Process has died with exit value " + value + " while waiting for it to start.");
+ } catch (IllegalThreadStateException e) {
+ // expected
+ }
+ final ServerLauncher.ServerState serverState = launcher.status();
+ assertNotNull(serverState);
+ logger.info("serverState: "+serverState);
+ return AbstractLauncher.Status.ONLINE.equals(serverState.getStatus());
+ }
+ catch (RuntimeException e) {
+ logger.error(e, e);
+ return false;
+ }
+ }
+ }, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedTestSuite.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedTestSuite.java
deleted file mode 100755
index 58b8d2a..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedTestSuite.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- DistributedMemberDUnitTest.class,
- DistributedSystemDUnitTest.class,
- LocatorDUnitTest.class,
- RoleDUnitTest.class,
- SystemAdminDUnitTest.class
-})
-/**
- * Suite of tests for distributed membership dunit tests.
- *
- */
-public class DistributedTestSuite {
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
index a5b07ee..1e5c8b0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
@@ -16,6 +16,10 @@
*/
package com.gemstone.gemfire.distributed;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+
import java.io.File;
import java.util.Collection;
import java.util.HashSet;
@@ -23,6 +27,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
+import org.junit.Test;
+
import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
@@ -30,20 +36,18 @@ import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.SocketCreator;
import com.gemstone.gemfire.internal.util.StopWatch;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
/**
- * Extracted from LocatorLauncherLocalJUnitTest.
+ * Extracted from LocatorLauncherLocalIntegrationTest.
*
* @since 8.0
*/
-public class HostedLocatorsDUnitTest extends DistributedTestCase {
+public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase {
protected static final int TIMEOUT_MILLISECONDS = 5 * 60 * 1000; // 5 minutes
@@ -59,23 +63,20 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
public final void preTearDown() throws Exception {
disconnectAllFromDS();
}
-
- public HostedLocatorsDUnitTest(String name) {
- super(name);
- }
+ @Test
public void testGetAllHostedLocators() throws Exception {
final InternalDistributedSystem system = getSystem();
final String dunitLocator = system.getConfig().getLocators();
assertNotNull(dunitLocator);
assertFalse(dunitLocator.isEmpty());
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(4);
+ final int[] ports = getRandomAvailableTCPPorts(4);
final String uniqueName = getUniqueName();
for (int i = 0 ; i < 4; i++) {
final int whichvm = i;
- Host.getHost(0).getVM(whichvm).invoke(new SerializableCallable() {
+ getHost(0).getVM(whichvm).invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
try {
@@ -131,7 +132,7 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
// validate fix for #46324
for (int whichvm = 0 ; whichvm < 4; whichvm++) {
- Host.getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
+ getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
@Override
public void run() {
final DistributionManager dm = (DistributionManager)InternalDistributedSystem.getAnyInstance().getDistributionManager();
@@ -148,7 +149,7 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
// validation with locators
for (int whichvm = 0 ; whichvm < 4; whichvm++) {
- Host.getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
+ getHost(0).getVM(whichvm).invoke(new SerializableRunnable() {
@Override
public void run() {
final DistributionManager dm = (DistributionManager)InternalDistributedSystem.getAnyInstance().getDistributionManager();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java
new file mode 100755
index 0000000..1a2e2d7
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanIntegrationTest.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.lang.management.ManagementFactory;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+
+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.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.management.MemberMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Tests querying of MemberMXBean which is used by MBeanProcessController to
+ * control GemFire ControllableProcesses.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class LauncherMemberMXBeanIntegrationTest extends AbstractLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpLauncherMemberMXBeanIntegrationTest() throws Exception {
+ }
+
+ @After
+ public final void tearDownLauncherMemberMXBeanIntegrationTest() throws Exception {
+ InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
+ if (ids != null) {
+ ids.disconnect();
+ }
+ }
+
+ @Test
+ public void testQueryForMemberMXBean() throws Exception {
+ final Properties props = new Properties();
+ props.setProperty("mcast-port", "0");
+ props.setProperty("locators", "");
+ props.setProperty("name", getUniqueName());
+ new CacheFactory(props).create();
+
+ final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
+ final ObjectName pattern = ObjectName.getInstance("GemFire:type=Member,*");
+
+ waitForMemberMXBean(mbeanServer, pattern);
+
+ final Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, null);
+ assertFalse(mbeanNames.isEmpty());
+ assertEquals("mbeanNames=" + mbeanNames, 1, mbeanNames.size());
+
+ final ObjectName objectName = mbeanNames.iterator().next();
+ final MemberMXBean mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName,
+ MemberMXBean.class, false);
+
+ assertNotNull(mbean);
+ assertEquals(ProcessUtils.identifyPid(), mbean.getProcessId());
+ assertEquals(getUniqueName(), mbean.getName());
+ assertEquals(getUniqueName(), mbean.getMember());
+ }
+
+ @Test
+ public void testQueryForMemberMXBeanWithProcessId() throws Exception {
+ final Properties props = new Properties();
+ props.setProperty("mcast-port", "0");
+ props.setProperty("locators", "");
+ props.setProperty("name", getUniqueName());
+ new CacheFactory(props).create();
+
+ final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
+ final ObjectName pattern = ObjectName.getInstance("GemFire:type=Member,*");
+ final QueryExp constraint = Query.eq(Query.attr("ProcessId"),Query.value(ProcessUtils.identifyPid()));
+
+ waitForMemberMXBean(mbeanServer, pattern);
+
+ final Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, constraint);
+ assertFalse(mbeanNames.isEmpty());
+ assertEquals(1, mbeanNames.size());
+
+ final ObjectName objectName = mbeanNames.iterator().next();
+ final MemberMXBean mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, MemberMXBean.class, false);
+
+ assertNotNull(mbean);
+ assertEquals(ProcessUtils.identifyPid(), mbean.getProcessId());
+ assertEquals(getUniqueName(), mbean.getName());
+ assertEquals(getUniqueName(), mbean.getMember());
+ }
+
+ @Test
+ public void testQueryForMemberMXBeanWithMemberName() throws Exception {
+ final Properties props = new Properties();
+ props.setProperty("mcast-port", "0");
+ props.setProperty("locators", "");
+ props.setProperty("name", getUniqueName());
+ new CacheFactory(props).create();
+
+ final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
+ final ObjectName pattern = ObjectName.getInstance("GemFire:type=Member,*");
+ final QueryExp constraint = Query.eq(Query.attr("Name"), Query.value(getUniqueName()));
+
+ waitForMemberMXBean(mbeanServer, pattern);
+
+ final Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, constraint);
+ assertFalse(mbeanNames.isEmpty());
+ assertEquals(1, mbeanNames.size());
+
+ final ObjectName objectName = mbeanNames.iterator().next();
+ final MemberMXBean mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, MemberMXBean.class, false);
+
+ assertNotNull(mbean);
+ assertEquals(getUniqueName(), mbean.getMember());
+ }
+
+ private void waitForMemberMXBean(final MBeanServer mbeanServer, final ObjectName pattern) throws Exception {
+ assertEventuallyTrue("waiting for MemberMXBean to be registered", new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, null);
+ return !mbeanNames.isEmpty();
+ }
+ }, WAIT_FOR_MBEAN_TIMEOUT, INTERVAL);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanJUnitTest.java
deleted file mode 100755
index 30e21e1..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherMemberMXBeanJUnitTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.lang.management.ManagementFactory;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-
-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.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.management.MemberMXBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Tests querying of MemberMXBean which is used by MBeanProcessController to
- * control GemFire ControllableProcesses.
- *
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class LauncherMemberMXBeanJUnitTest extends AbstractLauncherJUnitTestCase {
-
- @Before
- public final void setUpLauncherMemberMXBeanTest() throws Exception {
- }
-
- @After
- public final void tearDownLauncherMemberMXBeanTest() throws Exception {
- InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
- if (ids != null) {
- ids.disconnect();
- }
- }
-
- @Test
- public void testQueryForMemberMXBean() throws Exception {
- final Properties props = new Properties();
- props.setProperty("mcast-port", "0");
- props.setProperty("locators", "");
- props.setProperty("name", getUniqueName());
- new CacheFactory(props).create();
-
- final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
- final ObjectName pattern = ObjectName.getInstance("GemFire:type=Member,*");
-
- waitForMemberMXBean(mbeanServer, pattern);
-
- final Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, null);
- assertFalse(mbeanNames.isEmpty());
- assertEquals("mbeanNames=" + mbeanNames, 1, mbeanNames.size());
-
- final ObjectName objectName = mbeanNames.iterator().next();
- final MemberMXBean mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName,
- MemberMXBean.class, false);
-
- assertNotNull(mbean);
- assertEquals(ProcessUtils.identifyPid(), mbean.getProcessId());
- assertEquals(getUniqueName(), mbean.getName());
- assertEquals(getUniqueName(), mbean.getMember());
- }
-
- @Test
- public void testQueryForMemberMXBeanWithProcessId() throws Exception {
- final Properties props = new Properties();
- props.setProperty("mcast-port", "0");
- props.setProperty("locators", "");
- props.setProperty("name", getUniqueName());
- new CacheFactory(props).create();
-
- final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
- final ObjectName pattern = ObjectName.getInstance("GemFire:type=Member,*");
- final QueryExp constraint = Query.eq(Query.attr("ProcessId"),Query.value(ProcessUtils.identifyPid()));
-
- waitForMemberMXBean(mbeanServer, pattern);
-
- final Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, constraint);
- assertFalse(mbeanNames.isEmpty());
- assertEquals(1, mbeanNames.size());
-
- final ObjectName objectName = mbeanNames.iterator().next();
- final MemberMXBean mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, MemberMXBean.class, false);
-
- assertNotNull(mbean);
- assertEquals(ProcessUtils.identifyPid(), mbean.getProcessId());
- assertEquals(getUniqueName(), mbean.getName());
- assertEquals(getUniqueName(), mbean.getMember());
- }
-
- @Test
- public void testQueryForMemberMXBeanWithMemberName() throws Exception {
- final Properties props = new Properties();
- props.setProperty("mcast-port", "0");
- props.setProperty("locators", "");
- props.setProperty("name", getUniqueName());
- new CacheFactory(props).create();
-
- final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
- final ObjectName pattern = ObjectName.getInstance("GemFire:type=Member,*");
- final QueryExp constraint = Query.eq(Query.attr("Name"), Query.value(getUniqueName()));
-
- waitForMemberMXBean(mbeanServer, pattern);
-
- final Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, constraint);
- assertFalse(mbeanNames.isEmpty());
- assertEquals(1, mbeanNames.size());
-
- final ObjectName objectName = mbeanNames.iterator().next();
- final MemberMXBean mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, MemberMXBean.class, false);
-
- assertNotNull(mbean);
- assertEquals(getUniqueName(), mbean.getMember());
- }
-
- private void waitForMemberMXBean(final MBeanServer mbeanServer, final ObjectName pattern) throws Exception {
- assertEventuallyTrue("waiting for MemberMXBean to be registered", new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- Set<ObjectName> mbeanNames = mbeanServer.queryNames(pattern, null);
- return !mbeanNames.isEmpty();
- }
- }, WAIT_FOR_MBEAN_TIMEOUT, INTERVAL);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherTestSuite.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherTestSuite.java
deleted file mode 100644
index b5e787a..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherTestSuite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- AbstractLauncherJUnitTest.class,
- AbstractLauncherServiceStatusJUnitTest.class,
-
- LauncherMemberMXBeanJUnitTest.class,
-
- LocatorLauncherJUnitTest.class,
- LocatorLauncherLocalJUnitTest.class,
- LocatorLauncherLocalFileJUnitTest.class,
- LocatorLauncherRemoteJUnitTest.class,
- LocatorLauncherRemoteFileJUnitTest.class,
-
- ServerLauncherJUnitTest.class,
- ServerLauncherLocalJUnitTest.class,
- ServerLauncherLocalFileJUnitTest.class,
- ServerLauncherRemoteJUnitTest.class,
- ServerLauncherRemoteFileJUnitTest.class,
- ServerLauncherWithProviderJUnitTest.class,
-})
-/**
- * Suite of tests for the Launcher classes.
- *
- */
-public class LauncherTestSuite {
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
index 3c80d9a..7ee4694 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
@@ -16,8 +16,9 @@
*/
package com.gemstone.gemfire.distributed;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePort.*;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
@@ -26,48 +27,46 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
-import java.util.Vector;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
import com.gemstone.gemfire.SystemConnectException;
import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest;
import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionResponse;
import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionRequest;
import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionResponse;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.distributed.internal.ServerLocation;
import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger;
import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
-import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
import com.gemstone.gemfire.management.internal.JmxManagerAdvisor.JmxManagerProfile;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@Category(IntegrationTest.class)
public class LocatorJUnitTest {
- /**
- *
- */
private static final int REQUEST_TIMEOUT = 5 * 1000;
+
private Locator locator;
private int port;
private File tmpFile;
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
@Before
public void setUp() throws IOException {
tmpFile = File.createTempFile("locator", ".log");
- port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ port = getRandomAvailablePort(SOCKET);
File locatorFile = new File("locator"+port+".dat");
if (locatorFile.exists()) {
locatorFile.delete();
@@ -79,19 +78,22 @@ public class LocatorJUnitTest {
if(locator != null) {
locator.stop();
}
- Assert.assertEquals(false, Locator.hasLocator());
+ assertEquals(false, Locator.hasLocator());
}
+ /**
+ * TRAC #45804: if jmx-manager-start is true in a locator then gfsh connect will fail
+ */
@Test
- public void testBug45804() throws Exception {
+ public void testGfshConnectShouldSucceedIfJmxManagerStartIsTrueInLocator() throws Exception {
Properties dsprops = new Properties();
- int jmxPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ int jmxPort = getRandomAvailablePort(SOCKET);
dsprops.setProperty("mcast-port", "0");
dsprops.setProperty("locators", "localhost[" + port + "]");
dsprops.setProperty("jmx-manager-port", ""+jmxPort);
dsprops.setProperty("jmx-manager-start", "true");
dsprops.setProperty("jmx-manager-http-port", "0");
- dsprops.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+ dsprops.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
System.setProperty("gemfire.disableManagement", "false"); // not needed
try {
locator = Locator.startLocatorAndDS(port, new File("testJmxManager.log"), dsprops);
@@ -106,11 +108,11 @@ public class LocatorJUnitTest {
@Test
public void testBasicInfo() throws Exception {
locator = Locator.startLocator(port, tmpFile);
- Assert.assertTrue(locator.isPeerLocator());
- Assert.assertFalse(locator.isServerLocator());
+ assertTrue(locator.isPeerLocator());
+ assertFalse(locator.isServerLocator());
String[] info = InternalLocator.getLocatorInfo(InetAddress.getLocalHost(), port);
- Assert.assertNotNull(info);
- Assert.assertTrue(info.length > 1);
+ assertNotNull(info);
+ assertTrue(info.length > 1);
}
@Test
@@ -119,7 +121,7 @@ public class LocatorJUnitTest {
dsprops.setProperty("mcast-port", "0");
dsprops.setProperty("locators", "localhost[" + port + "]");
dsprops.setProperty("jmx-manager-start", "false");
- dsprops.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+ dsprops.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
JGroupsMessenger.THROW_EXCEPTION_ON_START_HOOK = true;
int threadCount = Thread.activeCount();
@@ -127,7 +129,7 @@ public class LocatorJUnitTest {
locator = Locator.startLocatorAndDS(port, new File(""), dsprops);
locator.stop();
fail("expected an exception");
- } catch (SystemConnectException e) {
+ } catch (SystemConnectException expected) {
for (int i=0; i<10; i++) {
if (threadCount < Thread.activeCount()) {
@@ -146,10 +148,10 @@ public class LocatorJUnitTest {
public void testServerOnly() throws Exception {
Properties props = new Properties();
props.setProperty("mcast-port", "0");
- props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+ props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
locator = Locator.startLocatorAndDS(port, tmpFile, null, props, false, true, null);
- Assert.assertFalse(locator.isPeerLocator());
- Assert.assertTrue(locator.isServerLocator());
+ assertFalse(locator.isPeerLocator());
+ assertTrue(locator.isServerLocator());
Thread.sleep(1000);
doServerLocation();
}
@@ -158,12 +160,11 @@ public class LocatorJUnitTest {
public void testBothPeerAndServer() throws Exception {
Properties props = new Properties();
props.setProperty("mcast-port", "0");
-// props.setProperty(DistributionConfig.LOG_LEVEL_NAME , getGemFireLogLevel());
- props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+ props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
locator = Locator.startLocatorAndDS(port, tmpFile, null, props);
- Assert.assertTrue(locator.isPeerLocator());
- Assert.assertTrue(locator.isServerLocator());
+ assertTrue(locator.isPeerLocator());
+ assertTrue(locator.isServerLocator());
Thread.sleep(1000);
doServerLocation();
locator.stop();
@@ -172,9 +173,11 @@ public class LocatorJUnitTest {
/**
* Make sure two ServerLocation objects on different hosts but with the same port
* are not equal
+ * <p/>
+ * TRAC #42040: LoadBalancing directs all traffic to a single cache server if all servers are started on the same port
*/
@Test
- public void testBug42040() {
+ public void testServerLocationOnDifferentHostsShouldNotTestEqual() {
ServerLocation sl1 = new ServerLocation("host1", 777);
ServerLocation sl2 = new ServerLocation("host2", 777);
if (sl1.equals(sl2)) {
@@ -186,14 +189,14 @@ public class LocatorJUnitTest {
{
ClientConnectionRequest request = new ClientConnectionRequest(Collections.EMPTY_SET, "group1");
ClientConnectionResponse response = (ClientConnectionResponse) TcpClient.requestToServer(InetAddress.getLocalHost(), port, request, REQUEST_TIMEOUT);
- Assert.assertEquals(null, response.getServer());
+ assertEquals(null, response.getServer());
}
{
QueueConnectionRequest request = new QueueConnectionRequest(ClientProxyMembershipID.getNewProxyMembership(InternalDistributedSystem.getAnyInstance()), 3, Collections.EMPTY_SET, "group1",true);
QueueConnectionResponse response = (QueueConnectionResponse) TcpClient.requestToServer(InetAddress.getLocalHost(), port, request, REQUEST_TIMEOUT);
- Assert.assertEquals(new ArrayList(), response.getServers());
- Assert.assertFalse(response.isDurableQueueFound());
+ assertEquals(new ArrayList(), response.getServers());
+ assertFalse(response.isDurableQueueFound());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationJUnitTest.java
deleted file mode 100755
index 3b56554..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationJUnitTest.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static com.googlecode.catchexception.apis.BDDCatchException.when;
-import static org.assertj.core.api.BDDAssertions.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.Properties;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Command;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Integration tests for LocatorLauncher. These tests require file system I/O.
- */
-@Category(IntegrationTest.class)
-public class LocatorLauncherIntegrationJUnitTest {
-
- @Rule
- public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Rule
- public final TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Rule
- public final TestName testName = new TestName();
-
- @Test
- public void testBuilderParseArgumentsWithValuesSeparatedWithCommas() throws Exception {
- // given: a new builder and working directory
- String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
- Builder builder = new Builder();
-
- // when: parsing many arguments
- builder.parseArguments(
- "start",
- "memberOne",
- "--bind-address", InetAddress.getLocalHost().getHostAddress(),
- "--dir", expectedWorkingDirectory,
- "--hostname-for-clients", "Tucows",
- "--pid", "1234",
- "--port", "11235",
- "--redirect-output",
- "--force",
- "--debug");
-
- // then: the getters should return properly parsed values
- assertThat(builder.getCommand()).isEqualTo(Command.START);
- assertThat(builder.getBindAddress()).isEqualTo(InetAddress.getLocalHost());
- assertThat(builder.getWorkingDirectory()).isEqualTo(expectedWorkingDirectory);
- assertThat(builder.getHostnameForClients()).isEqualTo("Tucows");
- assertThat(builder.getPid().intValue()).isEqualTo(1234);
- assertThat(builder.getPort().intValue()).isEqualTo(11235);
- assertThat(builder.getRedirectOutput()).isTrue();
- assertThat(builder.getForce()).isTrue();
- assertThat(builder.getDebug()).isTrue();
- }
-
- @Test
- public void testBuilderParseArgumentsWithValuesSeparatedWithEquals() throws Exception {
- // given: a new builder and a directory
- String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
- Builder builder = new Builder();
-
- // when: parsing arguments with values separated by equals
- builder.parseArguments(
- "start",
- "--dir=" + expectedWorkingDirectory,
- "--port=" + "12345",
- "memberOne");
-
- // then: the getters should return properly parsed values
- assertThat(builder.getCommand()).isEqualTo(Command.START);
- assertThat(builder.getDebug()).isFalse();
- assertThat(builder.getForce()).isFalse();
- assertThat(builder.getHelp()).isFalse();
- assertThat(builder.getBindAddress()).isNull();
- assertThat(builder.getHostnameForClients()).isNull();
- assertThat(builder.getMemberName()).isEqualTo("memberOne");
- assertThat(builder.getPid()).isNull();
- assertThat(builder.getWorkingDirectory()).isEqualTo(expectedWorkingDirectory);
- assertThat(builder.getPort().intValue()).isEqualTo(12345);
- }
-
- @Test
- public void testBuildWithMemberNameSetInGemFirePropertiesOnStart() throws Exception {
- // given: gemfire.properties with a name
- Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty(DistributionConfig.NAME_NAME, "locator123");
- useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", gemfireProperties);
-
- // when: starting with null MemberName
- LocatorLauncher launcher = new Builder()
- .setCommand(Command.START)
- .setMemberName(null)
- .build();
-
- // then: name in gemfire.properties file should be used for MemberName
- assertThat(launcher).isNotNull();
- assertThat(launcher.getCommand()).isEqualTo(Command.START);
- assertThat(launcher.getMemberName()).isNull();
- }
-
- @Test
- public void testBuildWithNoMemberNameOnStart() throws Exception {
- // given: gemfire.properties with no name
- useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", new Properties());
-
- // when: no MemberName is specified
- when(new Builder()
- .setCommand(Command.START))
- .build();
-
- // then: throw IllegalStateException
- then(caughtException())
- .isExactlyInstanceOf(IllegalStateException.class)
- .hasMessage(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Locator"));
- }
-
- @Test
- public void testBuilderSetAndGetWorkingDirectory() throws Exception {
- // given: a new builder and a directory
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
- Builder builder = new Builder();
-
- // when: not setting WorkingDirectory
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to null
- assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to empty string
- assertThat(builder.setWorkingDirectory("")).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to white space
- assertThat(builder.setWorkingDirectory(" ")).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to a directory
- assertThat(builder.setWorkingDirectory(rootFolder)).isSameAs(builder);
- // then: getWorkingDirectory returns that directory
- assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
-
- // when: setting WorkingDirectory to null (again)
- assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
- }
-
- @Test
- public void testBuilderSetWorkingDirectoryToFile() throws IOException {
- // given: a file instead of a directory
- File tmpFile = this.temporaryFolder.newFile();
-
- // when: setting WorkingDirectory to that file
- when(new Builder())
- .setWorkingDirectory(tmpFile.getCanonicalPath());
-
- // then: throw IllegalArgumentException
- then(caughtException())
- .isExactlyInstanceOf(IllegalArgumentException.class)
- .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Locator"))
- .hasCause(new FileNotFoundException(tmpFile.getCanonicalPath()));
- }
-
- @Test
- public void testBuildSetWorkingDirectoryToNonCurrentDirectoryOnStart() throws Exception {
- // given: using LocatorLauncher in-process
-
- // when: setting WorkingDirectory to non-current directory
- when(new Builder()
- .setCommand(Command.START)
- .setMemberName("memberOne")
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()))
- .build();
-
- // then: throw IllegalStateException
- then(caughtException())
- .isExactlyInstanceOf(IllegalStateException.class)
- .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE.toLocalizedString("Locator"));
- }
-
- @Test
- public void testBuilderSetWorkingDirectoryToNonExistingDirectory() {
- // when: setting WorkingDirectory to non-existing directory
- when(new Builder())
- .setWorkingDirectory("/path/to/non_existing/directory");
-
- // then: throw IllegalArgumentException
- then(caughtException())
- .isExactlyInstanceOf(IllegalArgumentException.class)
- .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Locator"))
- .hasCause(new FileNotFoundException("/path/to/non_existing/directory"));
- }
-
- /**
- * Creates a gemfire properties file in temporaryFolder:
- * <ol>
- * <li>creates <code>fileName</code> in <code>temporaryFolder</code></li>
- * <li>sets "gemfirePropertyFile" system property</li>
- * <li>writes <code>gemfireProperties</code> to the file</li>
- * </ol>
- */
- private void useGemFirePropertiesFileInTemporaryFolder(final String fileName, final Properties gemfireProperties) throws Exception {
- File propertiesFile = new File(this.temporaryFolder.getRoot().getCanonicalPath(), fileName);
- System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, propertiesFile.getCanonicalPath());
-
- gemfireProperties.store(new FileWriter(propertiesFile, false), this.testName.getMethodName());
- assertThat(propertiesFile.isFile()).isTrue();
- assertThat(propertiesFile.exists()).isTrue();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java
new file mode 100755
index 0000000..5f442a2
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherIntegrationTest.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static com.googlecode.catchexception.apis.BDDCatchException.*;
+import static org.assertj.core.api.BDDAssertions.*;
+import static org.assertj.core.api.BDDAssertions.then;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Properties;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Command;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for LocatorLauncher. These tests require file system I/O.
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherIntegrationTest {
+
+ @Rule
+ public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Rule
+ public final TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ @Test
+ public void testBuilderParseArgumentsWithValuesSeparatedWithCommas() throws Exception {
+ // given: a new builder and working directory
+ String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+ Builder builder = new Builder();
+
+ // when: parsing many arguments
+ builder.parseArguments(
+ "start",
+ "memberOne",
+ "--bind-address", InetAddress.getLocalHost().getHostAddress(),
+ "--dir", expectedWorkingDirectory,
+ "--hostname-for-clients", "Tucows",
+ "--pid", "1234",
+ "--port", "11235",
+ "--redirect-output",
+ "--force",
+ "--debug");
+
+ // then: the getters should return properly parsed values
+ assertThat(builder.getCommand()).isEqualTo(Command.START);
+ assertThat(builder.getBindAddress()).isEqualTo(InetAddress.getLocalHost());
+ assertThat(builder.getWorkingDirectory()).isEqualTo(expectedWorkingDirectory);
+ assertThat(builder.getHostnameForClients()).isEqualTo("Tucows");
+ assertThat(builder.getPid().intValue()).isEqualTo(1234);
+ assertThat(builder.getPort().intValue()).isEqualTo(11235);
+ assertThat(builder.getRedirectOutput()).isTrue();
+ assertThat(builder.getForce()).isTrue();
+ assertThat(builder.getDebug()).isTrue();
+ }
+
+ @Test
+ public void testBuilderParseArgumentsWithValuesSeparatedWithEquals() throws Exception {
+ // given: a new builder and a directory
+ String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+ Builder builder = new Builder();
+
+ // when: parsing arguments with values separated by equals
+ builder.parseArguments(
+ "start",
+ "--dir=" + expectedWorkingDirectory,
+ "--port=" + "12345",
+ "memberOne");
+
+ // then: the getters should return properly parsed values
+ assertThat(builder.getCommand()).isEqualTo(Command.START);
+ assertThat(builder.getDebug()).isFalse();
+ assertThat(builder.getForce()).isFalse();
+ assertThat(builder.getHelp()).isFalse();
+ assertThat(builder.getBindAddress()).isNull();
+ assertThat(builder.getHostnameForClients()).isNull();
+ assertThat(builder.getMemberName()).isEqualTo("memberOne");
+ assertThat(builder.getPid()).isNull();
+ assertThat(builder.getWorkingDirectory()).isEqualTo(expectedWorkingDirectory);
+ assertThat(builder.getPort().intValue()).isEqualTo(12345);
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInGemFirePropertiesOnStart() throws Exception {
+ // given: gemfire.properties with a name
+ Properties gemfireProperties = new Properties();
+ gemfireProperties.setProperty(DistributionConfig.NAME_NAME, "locator123");
+ useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", gemfireProperties);
+
+ // when: starting with null MemberName
+ LocatorLauncher launcher = new Builder()
+ .setCommand(Command.START)
+ .setMemberName(null)
+ .build();
+
+ // then: name in gemfire.properties file should be used for MemberName
+ assertThat(launcher).isNotNull();
+ assertThat(launcher.getCommand()).isEqualTo(Command.START);
+ assertThat(launcher.getMemberName()).isNull();
+ }
+
+ @Test
+ public void testBuildWithNoMemberNameOnStart() throws Exception {
+ // given: gemfire.properties with no name
+ useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", new Properties());
+
+ // when: no MemberName is specified
+ when(new Builder()
+ .setCommand(Command.START))
+ .build();
+
+ // then: throw IllegalStateException
+ then(caughtException())
+ .isExactlyInstanceOf(IllegalStateException.class)
+ .hasMessage(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Locator"));
+ }
+
+ @Test
+ public void testBuilderSetAndGetWorkingDirectory() throws Exception {
+ // given: a new builder and a directory
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+ Builder builder = new Builder();
+
+ // when: not setting WorkingDirectory
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to null
+ assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to empty string
+ assertThat(builder.setWorkingDirectory("")).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to white space
+ assertThat(builder.setWorkingDirectory(" ")).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to a directory
+ assertThat(builder.setWorkingDirectory(rootFolder)).isSameAs(builder);
+ // then: getWorkingDirectory returns that directory
+ assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
+
+ // when: setting WorkingDirectory to null (again)
+ assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+ }
+
+ @Test
+ public void testBuilderSetWorkingDirectoryToFile() throws IOException {
+ // given: a file instead of a directory
+ File tmpFile = this.temporaryFolder.newFile();
+
+ // when: setting WorkingDirectory to that file
+ when(new Builder())
+ .setWorkingDirectory(tmpFile.getCanonicalPath());
+
+ // then: throw IllegalArgumentException
+ then(caughtException())
+ .isExactlyInstanceOf(IllegalArgumentException.class)
+ .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Locator"))
+ .hasCause(new FileNotFoundException(tmpFile.getCanonicalPath()));
+ }
+
+ @Test
+ public void testBuildSetWorkingDirectoryToNonCurrentDirectoryOnStart() throws Exception {
+ // given: using LocatorLauncher in-process
+
+ // when: setting WorkingDirectory to non-current directory
+ when(new Builder()
+ .setCommand(Command.START)
+ .setMemberName("memberOne")
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()))
+ .build();
+
+ // then: throw IllegalStateException
+ then(caughtException())
+ .isExactlyInstanceOf(IllegalStateException.class)
+ .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE.toLocalizedString("Locator"));
+ }
+
+ @Test
+ public void testBuilderSetWorkingDirectoryToNonExistingDirectory() {
+ // when: setting WorkingDirectory to non-existing directory
+ when(new Builder())
+ .setWorkingDirectory("/path/to/non_existing/directory");
+
+ // then: throw IllegalArgumentException
+ then(caughtException())
+ .isExactlyInstanceOf(IllegalArgumentException.class)
+ .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Locator"))
+ .hasCause(new FileNotFoundException("/path/to/non_existing/directory"));
+ }
+
+ /**
+ * Creates a gemfire properties file in temporaryFolder:
+ * <ol>
+ * <li>creates <code>fileName</code> in <code>temporaryFolder</code></li>
+ * <li>sets "gemfirePropertyFile" system property</li>
+ * <li>writes <code>gemfireProperties</code> to the file</li>
+ * </ol>
+ */
+ private void useGemFirePropertiesFileInTemporaryFolder(final String fileName, final Properties gemfireProperties) throws Exception {
+ File propertiesFile = new File(this.temporaryFolder.getRoot().getCanonicalPath(), fileName);
+ System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, propertiesFile.getCanonicalPath());
+
+ gemfireProperties.store(new FileWriter(propertiesFile, false), this.testName.getMethodName());
+ assertThat(propertiesFile.isFile()).isTrue();
+ assertThat(propertiesFile.exists()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
deleted file mode 100644
index a8ddd6a..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Command;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import joptsimple.OptionException;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-/**
- * The LocatorLauncherJUnitTest class is a test suite of test cases for testing the contract and functionality of
- * launching a GemFire Locator.
- *
- * @see com.gemstone.gemfire.distributed.LocatorLauncher
- * @see com.gemstone.gemfire.distributed.LocatorLauncher.Builder
- * @see com.gemstone.gemfire.distributed.LocatorLauncher.Command
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since 7.0
- */
-@Category(UnitTest.class)
-public class LocatorLauncherJUnitTest {
-
- @Rule
- public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Rule
- public final TestName testName = new TestName();
-
- @Test(expected = IllegalArgumentException.class)
- public void testBuilderParseArgumentsWithNonNumericPort() {
- try {
- new Builder().parseArguments("start", "locator1", "--port", "oneTwoThree");
- }
- catch (IllegalArgumentException expected) {
- assertTrue(expected.getCause() instanceof OptionException);
- assertTrue(expected.getMessage(), expected.getMessage().contains(
- LocalizedStrings.Launcher_Builder_PARSE_COMMAND_LINE_ARGUMENT_ERROR_MESSAGE.toLocalizedString(
- "Locator", expected.getCause().getMessage())));
- throw expected;
- }
- }
-
- @Test
- public void testForceDefaultsToFalse() {
- assertFalse(new Builder().getForce());
- }
-
- @Test
- public void testForceSetToTrue() {
- Builder builder = new Builder();
-
- builder.parseArguments("start", "--force");
-
- assertTrue(Boolean.TRUE.equals(builder.getForce()));
- }
-
- @Test
- public void testSetAndGetCommand() {
- final Builder builder = new Builder();
-
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
- assertSame(builder, builder.setCommand(Command.START));
- assertEquals(Command.START, builder.getCommand());
- assertSame(builder, builder.setCommand(Command.STATUS));
- assertEquals(Command.STATUS, builder.getCommand());
- assertSame(builder, builder.setCommand(Command.STOP));
- assertEquals(Command.STOP, builder.getCommand());
- assertSame(builder, builder.setCommand(null));
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
- }
-
- @Test
- public void testSetAndGetBindAddress() throws UnknownHostException {
- final Builder builder = new Builder();
-
- assertNull(builder.getBindAddress());
- assertSame(builder, builder.setBindAddress(null));
- assertNull(builder.getBindAddress());
- assertSame(builder, builder.setBindAddress(""));
- assertNull(builder.getBindAddress());
- assertSame(builder, builder.setBindAddress(" "));
- assertNull(builder.getBindAddress());
- assertSame(builder, builder.setBindAddress(InetAddress.getLocalHost().getCanonicalHostName()));
- assertEquals(InetAddress.getLocalHost(), builder.getBindAddress());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetBindAddressToUnknownHost() {
- try {
- new Builder().setBindAddress("badhostname.badcompany.bad");
- }
- catch (IllegalArgumentException expected) {
- final String expectedMessage1 = LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString("Locator");
- final String expectedMessage2 = "badhostname.badcompany.bad is not an address for this machine.";
- assertTrue(expected.getMessage().equals(expectedMessage1) || expected.getMessage().equals(expectedMessage2));
- if (expected.getMessage().equals(expectedMessage1)) {
- assertTrue(expected.getCause() instanceof UnknownHostException);
- }
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetBindAddressToNonLocalHost() {
- try {
- new Builder().setBindAddress("yahoo.com");
- }
- catch (IllegalArgumentException expected) {
- final String expectedMessage = "yahoo.com is not an address for this machine.";
- assertEquals(expectedMessage, expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetBindAddressToLocalHost() throws Exception {
- String host = InetAddress.getLocalHost().getHostName();
- new Builder().setBindAddress(host);
- }
-
- @Test
- public void testSetAndGetHostnameForClients() {
- final Builder builder = new Builder();
-
- assertNull(builder.getHostnameForClients());
- assertSame(builder, builder.setHostnameForClients("Pegasus"));
- assertEquals("Pegasus", builder.getHostnameForClients());
- assertSame(builder, builder.setHostnameForClients(null));
- assertNull(builder.getHostnameForClients());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetHostnameForClientsWithBlankString() {
- try {
- new Builder().setHostnameForClients(" ");
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
- .toLocalizedString(), expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetHostnameForClientsWithEmptyString() {
- try {
- new Builder().setHostnameForClients("");
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
- .toLocalizedString(), expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetMemberName() {
- Builder builder = new Builder();
-
- assertNull(builder.getMemberName());
- assertSame(builder, builder.setMemberName("locatorOne"));
- assertEquals("locatorOne", builder.getMemberName());
- assertSame(builder, builder.setMemberName(null));
- assertNull(builder.getMemberName());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMemberNameWithBlankString() {
- try {
- new Builder().setMemberName(" ");
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Locator"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMemberNameWithEmptyString() {
- try {
- new Builder().setMemberName("");
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Locator"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetPid() {
- Builder builder = new Builder();
-
- assertNull(builder.getPid());
- assertSame(builder, builder.setPid(0));
- assertEquals(0, builder.getPid().intValue());
- assertSame(builder, builder.setPid(1));
- assertEquals(1, builder.getPid().intValue());
- assertSame(builder, builder.setPid(1024));
- assertEquals(1024, builder.getPid().intValue());
- assertSame(builder, builder.setPid(12345));
- assertEquals(12345, builder.getPid().intValue());
- assertSame(builder, builder.setPid(null));
- assertNull(builder.getPid());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetPidToInvalidValue() {
- try {
- new Builder().setPid(-1);
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_PID_ERROR_MESSAGE.toLocalizedString(), expected.getMessage());
- throw expected;
- }
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testSetAndGetPort() {
- Builder builder = new Builder();
-
- assertEquals(LocatorLauncher.DEFAULT_LOCATOR_PORT, builder.getPort());
- assertSame(builder, builder.setPort(65535));
- assertEquals(65535, builder.getPort().intValue());
- assertSame(builder, builder.setPort(1024));
- assertEquals(1024, builder.getPort().intValue());
- assertSame(builder, builder.setPort(80));
- assertEquals(80, builder.getPort().intValue());
- assertSame(builder, builder.setPort(1));
- assertEquals(1, builder.getPort().intValue());
- assertSame(builder, builder.setPort(0));
- assertEquals(0, builder.getPort().intValue());
- assertSame(builder, builder.setPort(null));
- assertEquals(LocatorLauncher.DEFAULT_LOCATOR_PORT, builder.getPort());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetPortToOverflow() {
- try {
- new Builder().setPort(65536);
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Locator"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetPortToUnderflow() {
- try {
- new Builder().setPort(-1);
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Locator"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testBuild() throws Exception {
- Builder builder = new Builder();
-
- LocatorLauncher launcher = builder.setCommand(Command.START)
- .setDebug(true)
- .setHostnameForClients("beanstock.vmware.com")
- .setMemberName("Beanstock")
- .setPort(8192)
- .build();
-
- assertNotNull(launcher);
- assertEquals(builder.getCommand(), launcher.getCommand());
- assertTrue(launcher.isDebugging());
- assertEquals(builder.getHostnameForClients(), launcher.getHostnameForClients());
- assertEquals(builder.getMemberName(), launcher.getMemberName());
- assertEquals(builder.getPort(), launcher.getPort());
- assertEquals(builder.getWorkingDirectory(), launcher.getWorkingDirectory());
- assertFalse(launcher.isHelping());
- assertFalse(launcher.isRunning());
- }
-
- @Test
- public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
- LocatorLauncher launcher = new Builder()
- .setCommand(LocatorLauncher.Command.START)
- .setMemberName(null)
- .set(DistributionConfig.NAME_NAME, "locatorABC")
- .build();
-
- assertNotNull(launcher);
- assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
- assertNull(launcher.getMemberName());
- assertEquals("locatorABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME));
- }
-
- @Test
- public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
- System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "locatorXYZ");
-
- LocatorLauncher launcher = new Builder()
- .setCommand(LocatorLauncher.Command.START)
- .setMemberName(null)
- .build();
-
- assertNotNull(launcher);
- assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
- assertNull(launcher.getMemberName());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileIntegrationTest.java
new file mode 100755
index 0000000..c695b07
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileIntegrationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Subclass of LocatorLauncherLocalDUnitTest which forces the code to not find
+ * the Attach API which is in the JDK tools.jar. As a result LocatorLauncher
+ * ends up using the FileProcessController implementation.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherLocalFileIntegrationTest extends LocatorLauncherLocalIntegrationTest {
+
+ @Before
+ public final void setUpLocatorLauncherLocalFileIntegrationTest() throws Exception {
+ System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
+ }
+
+ @After
+ public final void tearDownLocatorLauncherLocalFileIntegrationTest() throws Exception {
+ }
+
+ @Override
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertFalse(factory.isAttachAPIFound());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileJUnitTest.java
deleted file mode 100755
index 7dc5452..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalFileJUnitTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-
-/**
- * Subclass of LocatorLauncherLocalDUnitTest which forces the code to not find
- * the Attach API which is in the JDK tools.jar. As a result LocatorLauncher
- * ends up using the FileProcessController implementation.
- *
- * @since 8.0
- */
-public class LocatorLauncherLocalFileJUnitTest extends LocatorLauncherLocalJUnitTest {
-
- @Before
- public final void setUpLocatorLauncherLocalFileTest() throws Exception {
- System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
- }
-
- @After
- public final void tearDownLocatorLauncherLocalFileTest() throws Exception {
- }
-
- @Override
- @Test
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertFalse(factory.isAttachAPIFound());
- }
-}
[11/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
deleted file mode 100755
index fd7d806..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
+++ /dev/null
@@ -1,1073 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.lang.management.ManagementFactory;
-import java.net.BindException;
-import java.net.InetAddress;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
-import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Integration tests for ServerLauncher as a local API in the local JVM.
- *
- * @see com.gemstone.gemfire.distributed.AbstractLauncher
- * @see com.gemstone.gemfire.distributed.ServerLauncher
- * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
- * @see com.gemstone.gemfire.distributed.ServerLauncher.ServerState
- * @see com.gemstone.gemfire.internal.AvailablePortHelper
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTestCase {
-
- @Before
- public final void setUpServerLauncherLocalTest() throws Exception {
- disconnectFromDS();
- System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
- }
-
- @After
- public final void tearDownServerLauncherLocalTest() throws Exception {
- disconnectFromDS();
- }
-
- protected Status getExpectedStopStatusForNotRunning() {
- return Status.NOT_RESPONDING;
- }
-
- @Test
- public void testBuilderSetProperties() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- this.launcher = new Builder()
- .setDisableDefaultServer(true)
- .setForce(true)
- .setMemberName(getUniqueName())
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0")
- .build();
-
- assertNotNull(this.launcher);
-
- try {
- assertEquals(Status.ONLINE, this.launcher.start().getStatus());
- waitForServerToStart(this.launcher);
-
- final Cache cache = this.launcher.getCache();
-
- assertNotNull(cache);
-
- final DistributedSystem distributedSystem = cache.getDistributedSystem();
-
- assertNotNull(distributedSystem);
- assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME));
- assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME));
- assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME));
- assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME));
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- assertNull(this.launcher.getCache());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertTrue(factory.isAttachAPIFound());
- }
-
- @Test
- public void testStartCreatesPidFile() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the Server locally
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
- assertNotNull(this.launcher);
-
- try {
- this.launcher.start();
- waitForServerToStart(this.launcher);
- assertEquals(Status.ONLINE, this.launcher.status().getStatus());
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- assertEquals(Status.ONLINE, this.launcher.status().getStatus());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartDeletesStaleControlFiles() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // create existing control files
- this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
- this.stopRequestFile.createNewFile();
- assertTrue(this.stopRequestFile.exists());
-
- this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
- this.statusRequestFile.createNewFile();
- assertTrue(this.statusRequestFile.exists());
-
- this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
- this.statusFile.createNewFile();
- assertTrue(this.statusFile.exists());
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
- this.launcher.start();
-
- try {
- waitForServerToStart(this.launcher);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // validate stale control files were deleted
- assertFalse(this.stopRequestFile.exists());
- assertFalse(this.statusRequestFile.exists());
- assertFalse(this.statusFile.exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartOverwritesStalePidFile() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
- writePid(this.pidFile, Integer.MAX_VALUE);
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
- this.launcher.start();
-
- try {
- waitForServerToStart(this.launcher);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms fix for #47778.
- */
- @Test
- public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the server
- assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
-
- // wait for server to start
- try {
- // if start succeeds without throwing exception then #47778 is fixed
- this.launcher.start();
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // verify server did not a port
- assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- final ServerState status = this.launcher.status();
- final String portString = status.getPort();
- assertEquals("Port should be \"\" instead of " + portString, "", portString);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms fix for #47778.
- */
- @Test
- public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
-
- // wait for server to start
- try {
- // if start succeeds without throwing exception then #47778 is fixed
- this.launcher.start();
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- final ServerState status = this.launcher.status();
- final String portString = status.getPort();
- assertEquals("Port should be \"\" instead of " + portString, "", portString);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // verify port is still in use
- this.errorCollector.checkThat(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET), is(equalTo(false)));
- }
-
- @Test
- @Ignore("Need to rewrite this without using dunit.Host")
- public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
- }/*
- assertTrue(getUniqueName() + " is broken if PID == Integer.MAX_VALUE", ProcessUtils.identifyPid() != Integer.MAX_VALUE);
-
- // create existing pid file
- this.pidFile = new File(ProcessType.SERVER.getPidFileName());
- final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
- assertFalse(realPid == ProcessUtils.identifyPid());
- writePid(this.pidFile, realPid);
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setForce(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertTrue(builder.getForce());
- this.launcher = builder.build();
- assertTrue(this.launcher.isForcing());
- this.launcher.start();
-
- // collect and throw the FIRST failure
- Throwable failure = null;
-
- try {
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- if (failure != null) {
- throw failure;
- }
- } // testStartUsingForceOverwritesExistingPidFile
- */
-
- /**
- * Confirms part of fix for #47664
- */
- @Test
- public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
- // verifies part of the fix for #47664
-
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // generate two free ports
- final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
- assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
- assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
-
- // write out cache.xml with one port
- final CacheCreation creation = new CacheCreation();
- final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
- attrs.setScope(Scope.DISTRIBUTED_ACK);
- attrs.setDataPolicy(DataPolicy.REPLICATE);
- creation.createRegion(getUniqueName(), attrs);
- creation.addCacheServer().setPort(freeTCPPorts[0]);
-
- File cacheXmlFile = this.temporaryFolder.newFile(getUniqueName() + ".xml");
- final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
- CacheXmlGenerator.generate(creation, pw);
- pw.close();
-
- System.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlFile.getCanonicalPath());
-
- // start server
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setServerPort(freeTCPPorts[1])
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
- this.launcher.start();
-
- // wait for server to start up
- try {
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // verify server used --server-port instead of default or port in cache.xml
- assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
- assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
-
- final ServerState status = this.launcher.status();
- final String portString = status.getPort();
- final int port = Integer.valueOf(portString);
- assertEquals("Port should be " + freeTCPPorts[1] + " instead of " + port, freeTCPPorts[1], port);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- assertFalse("PID file still exists!", pidFile.exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms part of fix for #47664
- */
- @Test
- public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // write out cache.xml with one port
- final CacheCreation creation = new CacheCreation();
- final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
- attrs.setScope(Scope.DISTRIBUTED_ACK);
- attrs.setDataPolicy(DataPolicy.REPLICATE);
- creation.createRegion(getUniqueName(), attrs);
- creation.addCacheServer();
-
- File cacheXmlFile = this.temporaryFolder.newFile(getUniqueName() + ".xml");
- final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
- CacheXmlGenerator.generate(creation, pw);
- pw.close();
-
- System.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlFile.getCanonicalPath());
-
- // start server
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setServerPort(this.serverPort)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
- this.launcher.start();
-
- // wait for server to start up
- try {
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // verify server used --server-port instead of default
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- final int port = Integer.valueOf( this.launcher.status().getPort());
- assertEquals("Port should be " + this.serverPort + " instead of " + port, this.serverPort, port);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartWithDefaultPortInUseFails() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- // build and start the server
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
-
- RuntimeException expected = null;
- try {
- this.launcher.start();
-
- // why did it not fail like it's supposed to?
- final String property = System.getProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY);
- assertNotNull(property);
- assertEquals(this.serverPort, Integer.valueOf(property).intValue());
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- fail("Server port is " + this.launcher.getCache().getCacheServers().get(0).getPort());
- fail("ServerLauncher start should have thrown RuntimeException caused by BindException");
- } catch (RuntimeException e) {
- expected = e;
- assertNotNull(expected.getMessage());
- // BindException text varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertNotNull(expected);
- final Throwable cause = expected.getCause();
- assertNotNull(cause);
- assertTrue(cause instanceof BindException);
- // BindException string varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
-
- // creation of log file seems to be random -- look into why sometime
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // just in case the launcher started...
- ServerState status = null;
- try {
- status = this.launcher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- waitForFileToDelete(this.pidFile);
- assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- @Ignore("Need to rewrite this without using dunit.Host")
- public void testStartWithExistingPidFileFails() throws Throwable {
- }/*
- // create existing pid file
- final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
- assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
-
- this.pidFile = new File(ProcessType.SERVER.getPidFileName());
- writePid(this.pidFile, realPid);
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- // collect and throw the FIRST failure
- Throwable failure = null;
- RuntimeException expected = null;
-
- try {
- this.launcher.start();
- fail("ServerLauncher start should have thrown RuntimeException caused by FileAlreadyExistsException");
- } catch (RuntimeException e) {
- expected = e;
- assertNotNull(expected.getMessage());
- assertTrue(expected.getMessage().contains("A PID file already exists and a Server may be running in"));
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- // just in case the launcher started...
- ServerState status = null;
- try {
- status = this.launcher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- assertNotNull(expected);
- final Throwable cause = expected.getCause();
- assertNotNull(cause);
- assertTrue(cause instanceof FileAlreadyExistsException);
- assertTrue(cause.getMessage().contains("Pid file already exists: "));
- assertTrue(cause.getMessage().contains("vf.gf.server.pid for process " + realPid));
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- try {
- delete(this.pidFile);
- final Status theStatus = status.getStatus();
- assertFalse(theStatus == Status.STARTING);
- assertFalse(theStatus == Status.ONLINE);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- if (failure != null) {
- throw failure;
- }
- } // testStartWithExistingPidFileFails
- */
-
- /**
- * Confirms fix for #47665.
- */
- @Test
- public void testStartUsingServerPortInUseFails() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
- final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
-
- // build and start the server
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setServerPort(freeTCPPort)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- this.launcher = builder.build();
-
- RuntimeException expected = null;
- try {
- this.launcher.start();
- fail("ServerLauncher start should have thrown RuntimeException caused by BindException");
- } catch (RuntimeException e) {
- expected = e;
- assertNotNull(expected.getMessage());
- // BindException string varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertNotNull(expected);
- final Throwable cause = expected.getCause();
- assertNotNull(cause);
- assertTrue(cause instanceof BindException);
- // BindException string varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // just in case the launcher started...
- ServerState status = null;
- try {
- status = this.launcher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- waitForFileToDelete(this.pidFile);
- assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStatusUsingPid() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- ServerLauncher pidLauncher = null;
- try {
- this.launcher.start();
- waitForServerToStart(this.launcher);
-
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- pidLauncher = new Builder().setPid(pid).build();
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- final ServerState actualStatus = pidLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- if (pidLauncher == null) {
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- } else {
- try {
- assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
- }
-
- @Test
- public void testStatusUsingWorkingDirectory() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- ServerLauncher dirLauncher = null;
- try {
- this.launcher.start();
- waitForServerToStart(this.launcher);
-
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
- assertNotNull(dirLauncher);
- assertFalse(dirLauncher.isRunning());
-
- final ServerState actualStatus = dirLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- if (dirLauncher == null) {
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- } else {
- try {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
- }
-
- @Test
- public void testStopUsingPid() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- ServerLauncher pidLauncher = null;
-
- try {
- this.launcher.start();
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- pidLauncher = new Builder().setPid(pid).build();
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // stop the server
- final ServerState serverState = pidLauncher.stop();
- assertNotNull(serverState);
- assertEquals(Status.STOPPED, serverState.getStatus());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.launcher.stop();
- } catch (Throwable e) {
- // ignore
- }
-
- try {
- // verify the PID file was deleted
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStopUsingWorkingDirectory() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the server
- final Builder builder = new Builder()
- .setDisableDefaultServer(true)
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- ServerLauncher dirLauncher = null;
- try {
- this.launcher.start();
- waitForServerToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
- assertNotNull(dirLauncher);
- assertFalse(dirLauncher.isRunning());
-
- // stop the server
- final ServerState serverState = dirLauncher.stop();
- assertNotNull(serverState);
- assertEquals(Status.STOPPED, serverState.getStatus());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.launcher.stop();
- } catch (Throwable e) {
- // ignore
- }
-
- try {
- // verify the PID file was deleted
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileIntegrationTest.java
new file mode 100755
index 0000000..3b5884c
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileIntegrationTest.java
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.lang.AttachAPINotFoundException;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Subclass of ServerLauncherRemoteDUnitTest which forces the code to not find
+ * the Attach API which is in the JDK tools.jar. As a result ServerLauncher
+ * ends up using the FileProcessController implementation.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherRemoteFileIntegrationTest extends ServerLauncherRemoteIntegrationTest {
+
+ @Before
+ public void setUpServerLauncherRemoteFileTest() throws Exception {
+ System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
+ }
+
+ @After
+ public void tearDownServerLauncherRemoteFileTest() throws Exception {
+ }
+
+ @Override
+ @Test
+ /**
+ * Override and assert Attach API is NOT found
+ */
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertFalse(factory.isAttachAPIFound());
+ }
+
+ @Override
+ @Test
+ /**
+ * Override because FileProcessController cannot request status with PID
+ */
+ public void testStatusUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ ServerLauncher pidLauncher = null;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // status with pid only should throw AttachAPINotFoundException
+ try {
+ pidLauncher.status();
+ fail("FileProcessController should have thrown AttachAPINotFoundException");
+ } catch (AttachAPINotFoundException e) {
+ // passed
+ }
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid, true);
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ } finally {
+ new File(ProcessType.SERVER.getStatusRequestFileName()).delete(); // TODO: delete
+ }
+ }
+
+ @Override
+ @Test
+ /**
+ * Override because FileProcessController cannot request stop with PID
+ */
+ public void testStopUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ ServerLauncher pidLauncher = null;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // stop with pid only should throw AttachAPINotFoundException
+ try {
+ pidLauncher.stop();
+ fail("FileProcessController should have thrown AttachAPINotFoundException");
+ } catch (AttachAPINotFoundException e) {
+ // passed
+ }
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // stop the server
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ } finally {
+ new File(ProcessType.SERVER.getStopRequestFileName()).delete(); // TODO: delete
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileJUnitTest.java
deleted file mode 100755
index d8e318f..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteFileJUnitTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.internal.process.ProcessStreamReader;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.lang.AttachAPINotFoundException;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Subclass of ServerLauncherRemoteDUnitTest which forces the code to not find
- * the Attach API which is in the JDK tools.jar. As a result ServerLauncher
- * ends up using the FileProcessController implementation.
- *
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class ServerLauncherRemoteFileJUnitTest extends ServerLauncherRemoteJUnitTest {
-
- @Before
- public void setUpServerLauncherRemoteFileTest() throws Exception {
- System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
- }
-
- @After
- public void tearDownServerLauncherRemoteFileTest() throws Exception {
- }
-
- @Override
- @Test
- /**
- * Override and assert Attach API is NOT found
- */
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertFalse(factory.isAttachAPIFound());
- }
-
- @Override
- @Test
- /**
- * Override because FileProcessController cannot request status with PID
- */
- public void testStatusUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- ServerLauncher pidLauncher = null;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // status with pid only should throw AttachAPINotFoundException
- try {
- pidLauncher.status();
- fail("FileProcessController should have thrown AttachAPINotFoundException");
- } catch (AttachAPINotFoundException e) {
- // passed
- }
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid, true);
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- } finally {
- new File(ProcessType.SERVER.getStatusRequestFileName()).delete(); // TODO: delete
- }
- }
-
- @Override
- @Test
- /**
- * Override because FileProcessController cannot request stop with PID
- */
- public void testStopUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
-
- // wait for server to start
- int pid = 0;
- ServerLauncher pidLauncher = null;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // stop with pid only should throw AttachAPINotFoundException
- try {
- pidLauncher.stop();
- fail("FileProcessController should have thrown AttachAPINotFoundException");
- } catch (AttachAPINotFoundException e) {
- // passed
- }
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // stop the server
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- waitForFileToDelete(this.pidFile);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- } finally {
- new File(ProcessType.SERVER.getStopRequestFileName()).delete(); // TODO: delete
- }
- }
-}
[36/37] incubator-geode git commit: Merge remote-tracking branch
'origin/develop' into feature/GEODE-1276
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
index 0000000,8550a35..a5b8831
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteIntegrationTest.java
@@@ -1,0 -1,977 +1,977 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.hamcrest.CoreMatchers.*;
+ import static org.junit.Assert.*;
+
+ import java.io.File;
+ import java.io.FileNotFoundException;
+ import java.io.FileOutputStream;
+ import java.io.PrintStream;
+ import java.lang.management.ManagementFactory;
+ import java.net.InetAddress;
+ import java.util.ArrayList;
+ import java.util.List;
+ import java.util.concurrent.atomic.AtomicBoolean;
+
+ import org.junit.Ignore;
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
+ import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+ import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+ import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+ import com.gemstone.gemfire.internal.AvailablePort;
+ import com.gemstone.gemfire.internal.DistributionLocator;
+ import com.gemstone.gemfire.internal.GemFireVersion;
+ import com.gemstone.gemfire.internal.SocketCreator;
+ import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+ import com.gemstone.gemfire.internal.logging.LocalLogWriter;
+ import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+ import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+ import com.gemstone.gemfire.internal.process.ProcessType;
+ import com.gemstone.gemfire.internal.process.ProcessUtils;
+ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+ /**
+ * Integration tests for launching a Locator in a forked process.
+ *
+ * @since 8.0
+ */
+ @Category(IntegrationTest.class)
+ public class LocatorLauncherRemoteIntegrationTest extends AbstractLocatorLauncherRemoteIntegrationTestCase {
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
+ public void testRunningLocatorOutlivesForkingProcess() throws Exception {
+ }/*
+ // TODO: fix up this test
+
+ this.temporaryFolder.getRoot() = new File(getUniqueName());
+ this.temporaryFolder.getRoot().mkdir();
+ assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
+
+ // launch LocatorLauncherForkingProcess which then launches the GemFire Locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncherRemoteDUnitTest.class.getName().concat("$").concat(LocatorLauncherForkingProcess.class.getSimpleName()));
+ command.add(String.valueOf(this.locatorPort));
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ Thread waiting = new Thread(new Runnable() {
+ public void run() {
+ try {
- assertEquals(0, process.waitFor());
++ assertIndexDetailsEquals(0, process.waitFor());
+ }
+ catch (InterruptedException ignore) {
+ logger.error("Interrupted while waiting for process!", ignore);
+ }
+ }
+ });
+
+ try {
+ waiting.start();
+ waiting.join(TIMEOUT_MILLISECONDS);
+ assertFalse("Process took too long and timed out!", waiting.isAlive());
+ }
+ finally {
+ if (waiting.isAlive()) {
+ waiting.interrupt();
+ }
+ }
+
+ LocatorLauncher locatorLauncher = new Builder().setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()).build();
+
- assertEquals(Status.ONLINE, locatorLauncher.status().getStatus());
- assertEquals(Status.STOPPED, locatorLauncher.stop().getStatus());
++ assertIndexDetailsEquals(Status.ONLINE, locatorLauncher.status().getStatus());
++ assertIndexDetailsEquals(Status.STOPPED, locatorLauncher.stop().getStatus());
+ }
+ */
+
+ @Category(FlakyTest.class) // GEODE-473: random ports, BindException, forks JVM, uses ErrorCollector
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // check the status
+ final LocatorState locatorState = this.launcher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.ONLINE, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-530: BindException, random ports
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate stale control files were deleted
+ waitForFileToDelete(this.stopRequestFile);
+ waitForFileToDelete(this.statusRequestFile);
+ waitForFileToDelete(this.statusFile);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-1229: BindException
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertFalse(pid == Integer.MAX_VALUE);
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-764: BindException
+ @Test
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ final int otherPid = getPid();
+ assertTrue("Pid " + otherPid + " should be alive", ProcessUtils.isProcessAlive(otherPid));
+ writePid(this.pidFile, otherPid);
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+ command.add("--force");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertTrue(pid != otherPid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartUsingPortInUseFails() throws Throwable {
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
+
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--port=" + this.locatorPort);
+
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for locator to start and fail
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = process.waitFor();
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final LocatorState locatorState = dirLauncher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning())));
+ }
+
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
+
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+ assertTrue(this.socket.isBound());
+ assertFalse(this.socket.isClosed());
+
+ // launch locator
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.locatorPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for locator to start up
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = process.waitFor(); // TODO: create flavor with timeout in ProcessUtils
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final LocatorState locatorState = dirLauncher.status();
+ assertNotNull(locatorState);
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ this.errorCollector.checkThat(status.getStatus(), is(equalTo(getExpectedStopStatusForNotRunning())));
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ this.temporaryFolder.getRoot() = new File(getUniqueName());
+ this.temporaryFolder.getRoot().mkdir();
+ assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
+
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher, 10*1000, false);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ // check the status
+ final LocatorState locatorState = dirLauncher.status();
+ assertNotNull(locatorState);
- assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
++ assertIndexDetailsEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ try {
+ final LocatorState status = dirLauncher.stop();
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ LocatorLauncher pidLauncher = null;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final LocatorState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-569: BindException, random ports
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // validate the status
+ final LocatorState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusWithEmptyPidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile());
+
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final LocatorState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStatusWithNoPidFile() throws Exception {
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ LocatorState locatorState = dirLauncher.status();
+ assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+ }
+
+ @Test
+ public void testStatusWithStalePidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ final int pid = 0;
+ assertFalse(ProcessUtils.isProcessAlive(pid));
+ writePid(this.pidFile, pid);
+
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final LocatorState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ LocatorLauncher pidLauncher = null;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final LocatorState status = pidLauncher.status();
+ assertNotNull(status);
+ assertEquals(Status.ONLINE, status.getStatus());
+ assertEquals(pid, status.getPid().intValue());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-847: random ports, BindException, forks JVM, uses ErrorCollector
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // stop the locator
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ assertFalse("PID file still exists!", this.pidFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Used only by {@link LocatorLauncherRemoteIntegrationTest#testRunningLocatorOutlivesForkingProcess}
+ */
+ public static class LocatorLauncherForkingProcess {
+
+ public static void main(final String... args) throws FileNotFoundException {
+ File file = new File(System.getProperty("user.dir"), LocatorLauncherForkingProcess.class.getSimpleName().concat(".log"));
+
+ LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
+
+ try {
+ final int port = Integer.parseInt(args[0]);
+
+ // launch LocatorLauncher
+ List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getAbsolutePath());
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add("-Dgemfire.mcast-port=0");
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(LocatorLauncherForkingProcess.class.getSimpleName() + "_Locator");
+ command.add("--port=" + port);
+ command.add("--redirect-output");
+
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main starting...");
+
+ Process forkedProcess = new ProcessBuilder(command).start();
+
+ @SuppressWarnings("unused")
+ ProcessStreamReader processOutReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getInputStream()).build().start();
+ @SuppressWarnings("unused")
+ ProcessStreamReader processErrReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getErrorStream()).build().start();
+
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main waiting for locator to start...");
+
+ waitForLocatorToStart(port, TIMEOUT_MILLISECONDS, 10, true);
+
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
+
+ System.exit(0);
+ }
+ catch (Throwable t) {
+ logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t);
+ System.exit(-1);
+ }
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
index 0000000,55d7d6a..5693460
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
@@@ -1,0 -1,208 +1,222 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static com.googlecode.catchexception.CatchException.*;
+ import static org.assertj.core.api.Assertions.*;
+
+ import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.List;
+ import java.util.Map;
+
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
+ import com.gemstone.gemfire.distributed.AbstractLauncher.ServiceState;
+ import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+ import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+ import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
+ import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
+ import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+ /**
+ * Unit tests for LocatorLauncher.LocatorState
+ */
+ @Category(UnitTest.class)
+ public class LocatorStateTest {
+
++ private String classpath = "test_classpath";
++ private String gemFireVersion = "test_gemfireversion";
++ private String host = "test_host";
++ private String javaVersion = "test_javaversion";
++ private String jvmArguments = "test_jvmarguments";
++ private String serviceLocation = "test_location";
++ private String logFile = "test_logfile";
++ private String memberName = "test_membername";
++ private Integer pid = 6396;
++ private String port = "test_port";
++ private String statusDescription = Status.NOT_RESPONDING.getDescription();
++ private String statusMessage = "test_statusmessage";
++ private Long timestampTime = 1450728233024L;
++ private Long uptime = 1629L;
++ private String workingDirectory = "test_workingdirectory";
++
+ @Test
+ public void fromJsonWithEmptyStringThrowsIllegalArgumentException() throws Exception {
+ // given: empty string
+ String emptyString = "";
+
+ // when: passed to fromJson
+ verifyException(this).fromJson(emptyString);
+
+ // then: throws IllegalArgumentException with cause of GfJsonException
+ assertThat((Exception)caughtException())
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasCauseInstanceOf(GfJsonException.class);
+
+ assertThat(caughtException().getCause())
+ .isInstanceOf(GfJsonException.class)
+ .hasNoCause();
+ }
+
+ @Test
+ public void fromJsonWithWhiteSpaceStringThrowsIllegalArgumentException() throws Exception {
+ // given: white space string
+ String whiteSpaceString = " ";
+
+ // when: passed to fromJson
+ verifyException(this).fromJson(whiteSpaceString);
+
+ // then: throws IllegalArgumentException with cause of GfJsonException
+ assertThat((Exception)caughtException())
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasCauseInstanceOf(GfJsonException.class);
+
+ assertThat(caughtException().getCause())
+ .isInstanceOf(GfJsonException.class)
+ .hasNoCause();
+ }
+
+ @Test
+ public void fromJsonWithNullStringThrowsNullPointerException() throws Exception {
+ // given: null string
+ String nullString = null;
+
+ // when: passed to fromJson
+ verifyException(this).fromJson(nullString);
+
+ // then: throws NullPointerException
+ assertThat((Exception)caughtException())
+ .isInstanceOf(NullPointerException.class)
+ .hasNoCause();
+ }
+
+ @Test
+ public void fromJsonWithValidJsonStringReturnsLocatorState() throws Exception {
+ // given: valid json string
+ String jsonString = createStatusJson();
+
+ // when: passed to fromJson
+ LocatorState value = fromJson(jsonString);
+
+ // then: return valid instance of LocatorState
+ assertThat(value).isInstanceOf(LocatorState.class);
+
+ assertThat(value.getClasspath()).isEqualTo(getClasspath());
+ assertThat(value.getGemFireVersion()).isEqualTo(getGemFireVersion());
+ assertThat(value.getHost()).isEqualTo(getHost());
+ assertThat(value.getJavaVersion()).isEqualTo(getJavaVersion());
+ assertThat(value.getJvmArguments()).isEqualTo(getJvmArguments());
+ assertThat(value.getServiceLocation()).isEqualTo(getServiceLocation());
+ assertThat(value.getLogFile()).isEqualTo(getLogFile());
+ assertThat(value.getMemberName()).isEqualTo(getMemberName());
+ assertThat(value.getPid()).isEqualTo(getPid());
+ assertThat(value.getPort()).isEqualTo(getPort());
+ assertThat(value.getStatus().getDescription()).isEqualTo(getStatusDescription());
+ assertThat(value.getStatusMessage()).isEqualTo(getStatusMessage());
+ assertThat(value.getTimestamp().getTime()).isEqualTo(getTimestampTime());
+ assertThat(value.getUptime()).isEqualTo(getUptime());
+ assertThat(value.getWorkingDirectory()).isEqualTo(getWorkingDirectory());
+ }
+
+ protected LocatorState fromJson(final String value) {
+ return LocatorState.fromJson(value);
+ }
+
- private String classpath = "test_classpath";
- private String gemFireVersion = "test_gemfireversion";
- private String host = "test_host";
- private String javaVersion = "test_javaversion";
- private String jvmArguments = "test_jvmarguments";
- private String serviceLocation = "test_location";
- private String logFile = "test_logfile";
- private String memberName = "test_membername";
- private Integer pid = 6396;
- private String port = "test_port";
- private String statusDescription = Status.NOT_RESPONDING.getDescription();
- private String statusMessage = "test_statusmessage";
- private Long timestampTime = 1450728233024L;
- private Long uptime = 1629L;
- private String workingDirectory = "test_workingdirectory";
-
+ private String getClasspath() {
+ return this.classpath;
+ }
++
+ private String getGemFireVersion() {
+ return this.gemFireVersion;
+ }
++
+ private String getHost() {
+ return this.host;
+ }
++
+ private String getJavaVersion() {
+ return this.javaVersion;
+ }
++
+ private List<String> getJvmArguments() {
+ List<String> list = new ArrayList<String>();
+ list.add(this.jvmArguments);
+ return list;
+ }
++
+ private String getServiceLocation() {
+ return this.serviceLocation;
+ }
++
+ private String getLogFile() {
+ return this.logFile;
+ }
++
+ private String getMemberName() {
+ return this.memberName;
+ }
++
+ private Integer getPid() {
+ return this.pid;
+ }
++
+ private String getPort() {
+ return this.port;
+ }
++
+ private String getStatusDescription() {
+ return this.statusDescription;
+ }
++
+ private String getStatusMessage() {
+ return this.statusMessage;
+ }
++
+ private Long getTimestampTime() {
+ return this.timestampTime;
+ }
++
+ private Long getUptime() {
+ return this.uptime;
+ }
++
+ private String getWorkingDirectory() {
+ return this.workingDirectory;
+ }
+
+ private String createStatusJson() {
+ final Map<String, Object> map = new HashMap<String, Object>();
+ map.put(ServiceState.JSON_CLASSPATH, getClasspath());
+ map.put(ServiceState.JSON_GEMFIREVERSION, getGemFireVersion());
+ map.put(ServiceState.JSON_HOST, getHost());
+ map.put(ServiceState.JSON_JAVAVERSION, getJavaVersion());
+ map.put(ServiceState.JSON_JVMARGUMENTS, getJvmArguments());
+ map.put(ServiceState.JSON_LOCATION, getServiceLocation());
+ map.put(ServiceState.JSON_LOGFILE, getLogFile());
+ map.put(ServiceState.JSON_MEMBERNAME, getMemberName());
+ map.put(ServiceState.JSON_PID, getPid());
+ map.put(ServiceState.JSON_PORT, getPort());
+ map.put(ServiceState.JSON_STATUS, getStatusDescription());
+ map.put(ServiceState.JSON_STATUSMESSAGE, getStatusMessage());
+ map.put(ServiceState.JSON_TIMESTAMP, getTimestampTime());
+ map.put(ServiceState.JSON_UPTIME, getUptime());
+ map.put(ServiceState.JSON_WORKINGDIRECTORY, getWorkingDirectory());
+ return new GfJsonObject(map).toString();
+ }
+ }
[32/37] incubator-geode git commit: GEODE-1183: enhance the test case
Posted by kl...@apache.org.
GEODE-1183: enhance the test case
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/4ad4d63c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/4ad4d63c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/4ad4d63c
Branch: refs/heads/feature/GEODE-1276
Commit: 4ad4d63ca7b40c1450df1253ece0912f8529220f
Parents: aca7b28
Author: zhouxh <gz...@pivotal.io>
Authored: Thu May 5 21:18:54 2016 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Thu May 5 21:19:50 2016 -0700
----------------------------------------------------------------------
.../cache/wan/Simple2CacheServerDUnitTest.java | 24 ++++----------------
1 file changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4ad4d63c/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
index 684660b..4fdd88d 100755
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
@@ -17,6 +17,7 @@
package com.gemstone.gemfire.internal.cache.wan;
import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
import org.junit.experimental.categories.Category;
@@ -33,6 +34,7 @@ import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.jayway.awaitility.Awaitility;
public class Simple2CacheServerDUnitTest extends WANTestBase {
private static final int NUM_KEYS = 10;
@@ -75,17 +77,11 @@ public class Simple2CacheServerDUnitTest extends WANTestBase {
} else {
vm2.invoke(() -> checkResultAndUnsetClientServerObserver());
}
-
- boolean vm0_proxy = checkProxyIsPrimary(vm0);
- boolean vm1_proxy = checkProxyIsPrimary(vm1);
- assertTrue(vm1_proxy || vm0_proxy);
+ Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
// close the current primary cache server, then re-test
vm1.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPort2));
- vm0_proxy = checkProxyIsPrimary(vm0);
- vm1_proxy = checkProxyIsPrimary(vm1);
- assertTrue(vm1_proxy || vm0_proxy);
-
+ Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
disconnectAllFromDS();
}
@@ -135,19 +131,9 @@ public class Simple2CacheServerDUnitTest extends WANTestBase {
@Override
public Object call() throws Exception {
final CacheClientNotifier ccn = CacheClientNotifier.getInstance();
+ Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return (ccn.getClientProxies().size() == 1); });
- Wait.waitForCriterion(new WaitCriterion() {
- public boolean done() {
- return ccn.getClientProxies().size() == 1;
- }
- public String description() {
- return null;
- }
- }, 20000, 100, false);
- assertEquals(1, ccn.getClientProxies().size());
-
Iterator iter_prox = ccn.getClientProxies().iterator();
- assertEquals(1, ccn.getClientProxies().size());
CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
return proxy.isPrimary();
}
[17/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java
new file mode 100755
index 0000000..043b5ae
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.FileUtil;
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.process.PidUnavailableException;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader.InputListener;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.internal.util.StopWatch;
+
+/**
+ * @since 8.0
+ */
+public abstract class AbstractLauncherIntegrationTestCase {
+ protected static final Logger logger = LogService.getLogger();
+
+ protected static final int WAIT_FOR_PROCESS_TO_DIE_TIMEOUT = 5 * 60 * 1000; // 5 minutes
+ protected static final int TIMEOUT_MILLISECONDS = WAIT_FOR_PROCESS_TO_DIE_TIMEOUT;
+ protected static final int WAIT_FOR_FILE_CREATION_TIMEOUT = 10*1000;
+ protected static final int WAIT_FOR_FILE_DELETION_TIMEOUT = 10*1000;
+ protected static final int WAIT_FOR_MBEAN_TIMEOUT = 10*1000;
+ protected static final int INTERVAL = 100;
+ protected static final int INTERVAL_MILLISECONDS = INTERVAL;
+
+ private static final String EXPECTED_EXCEPTION_ADD = "<ExpectedException action=add>{}</ExpectedException>";
+ private static final String EXPECTED_EXCEPTION_REMOVE = "<ExpectedException action=remove>{}</ExpectedException>";
+ private static final String EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED = "MBean Not Registered In GemFire Domain";
+
+ protected volatile ServerSocket socket;
+
+ protected volatile File pidFile;
+ protected volatile File stopRequestFile;
+ protected volatile File statusRequestFile;
+ protected volatile File statusFile;
+
+ @Rule
+ public TestName testName= new TestName();
+
+ @Rule
+ public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Before
+ public final void setUpAbstractLauncherIntegrationTestCase() throws Exception {
+ System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
+ logger.info(EXPECTED_EXCEPTION_ADD, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
+ }
+
+ @After
+ public final void tearDownAbstractLauncherIntegrationTestCase() throws Exception {
+ logger.info(EXPECTED_EXCEPTION_REMOVE, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
+ if (this.socket != null) {
+ this.socket.close();
+ this.socket = null;
+ }
+ delete(this.pidFile); this.pidFile = null;
+ delete(this.stopRequestFile); this.stopRequestFile = null;
+ delete(this.statusRequestFile); this.statusRequestFile = null;
+ delete(this.statusFile); this.statusFile = null;
+ }
+
+ protected void delete(final File file) throws Exception {
+ assertEventuallyTrue("deleting " + file, new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ if (file == null) {
+ return true;
+ }
+ try {
+ FileUtil.delete(file);
+ } catch (IOException e) {
+ }
+ return !file.exists();
+ }
+ }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
+ }
+
+ protected void waitForPidToStop(final int pid, boolean throwOnTimeout) throws Exception {
+ assertEventuallyFalse("Process never died", new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ return ProcessUtils.isProcessAlive(pid);
+ }
+ }, WAIT_FOR_PROCESS_TO_DIE_TIMEOUT, INTERVAL);
+ }
+
+ protected void waitForPidToStop(final int pid) throws Exception {
+ waitForPidToStop(pid, true);
+ }
+
+ protected void waitForFileToDelete(final File file, boolean throwOnTimeout) throws Exception {
+ if (file == null) {
+ return;
+ }
+ assertEventuallyTrue("waiting for file " + file + " to delete", new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ return !file.exists();
+ }
+ }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
+ }
+
+ protected void waitForFileToDelete(final File file) throws Exception {
+ waitForFileToDelete(file, true);
+ }
+
+ protected static int getPid() throws PidUnavailableException {
+ return ProcessUtils.identifyPid();
+ }
+
+ protected InputListener createLoggingListener(final String name, final String header) {
+ return new InputListener() {
+ @Override
+ public void notifyInputLine(String line) {
+ logger.info(new StringBuilder("[").append(header).append("]").append(line).toString());
+ }
+ @Override
+ public String toString() {
+ return name;
+ }
+ };
+ }
+
+ protected InputListener createCollectionListener(final String name, final String header, final List<String> lines) {
+ return new InputListener() {
+ @Override
+ public void notifyInputLine(String line) {
+ lines.add(line);
+ }
+ @Override
+ public String toString() {
+ return name;
+ }
+ };
+ }
+
+ protected InputListener createExpectedListener(final String name, final String header, final String expected, final AtomicBoolean atomic) {
+ return new InputListener() {
+ @Override
+ public void notifyInputLine(String line) {
+ if (line.contains(expected)) {
+ atomic.set(true);
+ }
+ }
+ @Override
+ public String toString() {
+ return name;
+ }
+ };
+ }
+
+ protected void writeGemfireProperties(final Properties gemfireProperties, final File gemfirePropertiesFile) throws IOException {
+ if (!gemfirePropertiesFile.exists()) {
+ gemfireProperties.store(new FileWriter(gemfirePropertiesFile), "Configuration settings for the GemFire Server");
+ }
+ }
+
+ protected int readPid(final File pidFile) throws IOException {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(pidFile));
+ return Integer.parseInt(StringUtils.trim(reader.readLine()));
+ }
+ finally {
+ IOUtils.close(reader);
+ }
+ }
+
+ protected void writePid(final File pidFile, final int pid) throws IOException {
+ FileWriter writer = new FileWriter(pidFile);
+ writer.write(String.valueOf(pid));
+ writer.write("\n");
+ writer.flush();
+ writer.close();
+ }
+
+ protected void waitForFileToExist(final File file, boolean throwOnTimeout) throws Exception {
+ assertEventuallyTrue("waiting for file " + file + " to exist", new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ return file.exists();
+ }
+ }, WAIT_FOR_FILE_CREATION_TIMEOUT, INTERVAL);
+ }
+
+ protected void waitForFileToExist(final File file) throws Exception {
+ waitForFileToExist(file, true);
+ }
+
+ protected String getUniqueName() {
+ return getClass().getSimpleName() + "_" + testName.getMethodName();
+ }
+
+ protected static void assertEventuallyTrue(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
+ boolean done = false;
+ for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (callable.call())) {
+ Thread.sleep(interval);
+ }
+ assertTrue(message, done);
+ }
+
+ protected static void assertEventuallyFalse(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
+ boolean done = false;
+ for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (!callable.call())) {
+ Thread.sleep(interval);
+ }
+ assertTrue(message, done);
+ }
+
+ protected static void disconnectFromDS() {
+ InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
+ if (ids != null) {
+ ids.disconnect();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java
deleted file mode 100644
index f5867d4..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * The AbstractLauncherJUnitTest class is a test suite of unit tests testing the contract and functionality
- * of the AbstractLauncher class.
- * <p/>
- * @see com.gemstone.gemfire.distributed.AbstractLauncher
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since 7.0
- */
-@Category(UnitTest.class)
-public class AbstractLauncherJUnitTest {
-
- protected AbstractLauncher<?> createAbstractLauncher(final String memberName, final String memberId) {
- return new FakeServiceLauncher(memberName, memberId);
- }
-
- @Test
- public void testIsAttachAPINotFound() {
- final AbstractLauncher<?> launcher = createAbstractLauncher("012", "TestMember");
-
- assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
- "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException")));
- assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
- "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
- assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
- "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/tools/attach/AgentNotSupportedException")));
- assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
- "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
- assertFalse(launcher.isAttachAPINotFound(new IllegalArgumentException(
- "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
- assertFalse(launcher.isAttachAPINotFound(new IllegalStateException(
- "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
- assertFalse(launcher.isAttachAPINotFound(new NoClassDefFoundError(
- "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/companyx/app/service/MyServiceClass")));
- assertFalse(launcher.isAttachAPINotFound(new ClassNotFoundException(
- "Caused by: java.lang.ClassNotFoundException: com.companyx.app.attach.NutsNotAttachedException")));
- }
-
- @Test
- public void testIsSet() {
- final Properties properties = new Properties();
-
- assertFalse(properties.containsKey(DistributionConfig.NAME_NAME));
- assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-
- properties.setProperty(DistributionConfig.NAME_NAME, "");
-
- assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
- assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-
- properties.setProperty(DistributionConfig.NAME_NAME, " ");
-
- assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
- assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-
- properties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
-
- assertTrue(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
- assertFalse(AbstractLauncher.isSet(properties, "NaMe"));
- }
-
- @Test
- public void testLoadGemFirePropertiesWithNullURL() {
- final Properties properties = AbstractLauncher.loadGemFireProperties(null);
- assertNotNull(properties);
- assertTrue(properties.isEmpty());
- }
-
- @Test
- public void testLoadGemFirePropertiesWithNonExistingURL() throws MalformedURLException {
- final Properties properties = AbstractLauncher.loadGemFireProperties(new URL("file:///path/to/non_existing/gemfire.properties"));
- assertNotNull(properties);
- assertTrue(properties.isEmpty());
- }
-
- @Test
- public void testGetDistributedSystemProperties() {
- AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "1");
-
- assertNotNull(launcher);
- assertEquals("1", launcher.getMemberId());
- assertEquals("memberOne", launcher.getMemberName());
-
- Properties distributedSystemProperties = launcher.getDistributedSystemProperties();
-
- assertNotNull(distributedSystemProperties);
- assertTrue(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
- assertEquals("memberOne", distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
-
- launcher = createAbstractLauncher(null, "22");
-
- assertNotNull(launcher);
- assertEquals("22", launcher.getMemberId());
- assertNull(launcher.getMemberName());
-
- distributedSystemProperties = launcher.getDistributedSystemProperties();
-
- assertNotNull(distributedSystemProperties);
- assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
-
- launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
-
- assertNotNull(launcher);
- assertEquals("333", launcher.getMemberId());
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
-
- distributedSystemProperties = launcher.getDistributedSystemProperties();
-
- assertNotNull(distributedSystemProperties);
- assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
-
- launcher = createAbstractLauncher(" ", "4444");
-
- assertNotNull(launcher);
- assertEquals("4444", launcher.getMemberId());
- assertEquals(" ", launcher.getMemberName());
-
- distributedSystemProperties = launcher.getDistributedSystemProperties();
-
- assertNotNull(distributedSystemProperties);
- assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
- }
-
- @Test
- public void testGetDistributedSystemPropertiesWithDefaults() {
- AbstractLauncher<?> launcher = createAbstractLauncher("TestMember", "123");
-
- assertNotNull(launcher);
- assertEquals("123", launcher.getMemberId());
- assertEquals("TestMember", launcher.getMemberName());
-
- Properties defaults = new Properties();
-
- defaults.setProperty("testKey", "testValue");
-
- Properties distributedSystemProperties = launcher.getDistributedSystemProperties(defaults);
-
- assertNotNull(distributedSystemProperties);
- assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
- assertEquals("testValue", distributedSystemProperties.getProperty("testKey"));
- }
-
- @Test
- public void testGetMember() {
- AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "123");
-
- assertNotNull(launcher);
- assertEquals("123", launcher.getMemberId());
- assertEquals("memberOne", launcher.getMemberName());
- assertEquals("memberOne", launcher.getMember());
-
- launcher = createAbstractLauncher(null, "123");
-
- assertNotNull(launcher);
- assertEquals("123", launcher.getMemberId());
- assertNull(launcher.getMemberName());
- assertEquals("123", launcher.getMember());
-
- launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
-
- assertNotNull(launcher);
- assertEquals("123", launcher.getMemberId());
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
- assertEquals("123", launcher.getMember());
-
- launcher = createAbstractLauncher(" ", "123");
-
- assertNotNull(launcher);
- assertEquals("123", launcher.getMemberId());
- assertEquals(" ", launcher.getMemberName());
- assertEquals("123", launcher.getMember());
-
- launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
-
- assertNotNull(launcher);
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
- assertNull(launcher.getMemberName());
- assertNull(launcher.getMember());
-
- launcher = createAbstractLauncher(null, " ");
-
- assertNotNull(launcher);
- assertEquals(" ", launcher.getMemberId());
- assertNull(launcher.getMemberName());
- assertNull(launcher.getMember());
- }
-
- @Test
- public void testAbstractLauncherServiceStateToDaysHoursMinutesSeconds() {
- assertEquals("", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(null));
- assertEquals("0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(0l));
- assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1000l));
- assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1999l));
- assertEquals("2 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(2001l));
- assertEquals("45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(45000l));
- assertEquals("1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 1000l));
- assertEquals("1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(61 * 1000l));
- assertEquals("1 minute 30 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(90 * 1000l));
- assertEquals("2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(120 * 1000l));
- assertEquals("2 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(121 * 1000l));
- assertEquals("2 minutes 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(135 * 1000l));
- assertEquals("1 hour 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l));
- assertEquals("1 hour 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 1000l));
- assertEquals("1 hour 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 15000l));
- assertEquals("1 hour 1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l));
- assertEquals("1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 1000l));
- assertEquals("1 hour 1 minute 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 45000l));
- assertEquals("1 hour 2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 62 * 1000l));
- assertEquals("1 hour 5 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 1000l));
- assertEquals("1 hour 5 minutes 10 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 10000l));
- assertEquals("1 hour 59 minutes 11 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 119 * 1000l + 11000l));
- assertEquals("1 day 1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
- TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(1) + TimeUnit.SECONDS.toMillis(1)));
- assertEquals("1 day 5 hours 15 minutes 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
- TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(5) + TimeUnit.MINUTES.toMillis(15) + TimeUnit.SECONDS.toMillis(45)));
- assertEquals("2 days 1 hour 30 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
- TimeUnit.DAYS.toMillis(2) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(30) + TimeUnit.SECONDS.toMillis(1)));
- }
-
- protected static final class FakeServiceLauncher extends AbstractLauncher<String> {
-
- private final String memberId;
- private final String memberName;
-
- public FakeServiceLauncher(final String memberName, final String memberId) {
- this.memberId = memberId;
- this.memberName = memberName;
- }
-
- @Override
- boolean isAttachAPIOnClasspath() {
- return false;
- }
-
- @Override
- public String getLogFileName() {
- throw new UnsupportedOperationException("Not Implemented!");
- }
-
- @Override
- public String getMemberId() {
- return memberId;
- }
-
- @Override
- public String getMemberName() {
- return memberName;
- }
-
- @Override
- public Integer getPid() {
- throw new UnsupportedOperationException("Not Implemented!");
- }
-
- @Override
- public String getServiceName() {
- return "TestService";
- }
-
- @Override
- public void run() {
- throw new UnsupportedOperationException("Not Implemented!");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java
deleted file mode 100755
index 77961e0..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.logging.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.rules.TestName;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.FileUtil;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.process.PidUnavailableException;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.internal.process.ProcessStreamReader.InputListener;
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.internal.util.StopWatch;
-
-/**
- * @since 8.0
- */
-public abstract class AbstractLauncherJUnitTestCase {
- protected static final Logger logger = LogService.getLogger();
-
- protected static final int WAIT_FOR_PROCESS_TO_DIE_TIMEOUT = 5 * 60 * 1000; // 5 minutes
- protected static final int TIMEOUT_MILLISECONDS = WAIT_FOR_PROCESS_TO_DIE_TIMEOUT;
- protected static final int WAIT_FOR_FILE_CREATION_TIMEOUT = 10*1000;
- protected static final int WAIT_FOR_FILE_DELETION_TIMEOUT = 10*1000;
- protected static final int WAIT_FOR_MBEAN_TIMEOUT = 10*1000;
- protected static final int INTERVAL = 100;
- protected static final int INTERVAL_MILLISECONDS = INTERVAL;
-
- private static final String EXPECTED_EXCEPTION_ADD = "<ExpectedException action=add>{}</ExpectedException>";
- private static final String EXPECTED_EXCEPTION_REMOVE = "<ExpectedException action=remove>{}</ExpectedException>";
- private static final String EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED = "MBean Not Registered In GemFire Domain";
-
- protected volatile ServerSocket socket;
-
- protected volatile File pidFile;
- protected volatile File stopRequestFile;
- protected volatile File statusRequestFile;
- protected volatile File statusFile;
-
- @Rule
- public TestName testName= new TestName();
-
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Before
- public final void setUpLauncherTest() throws Exception {
- System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
- logger.info(EXPECTED_EXCEPTION_ADD, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
- }
-
- @After
- public final void tearDownLauncherTest() throws Exception {
- logger.info(EXPECTED_EXCEPTION_REMOVE, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
- if (this.socket != null) {
- this.socket.close();
- this.socket = null;
- }
- delete(this.pidFile); this.pidFile = null;
- delete(this.stopRequestFile); this.stopRequestFile = null;
- delete(this.statusRequestFile); this.statusRequestFile = null;
- delete(this.statusFile); this.statusFile = null;
- }
-
- protected void delete(final File file) throws Exception {
- assertEventuallyTrue("deleting " + file, new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- if (file == null) {
- return true;
- }
- try {
- FileUtil.delete(file);
- } catch (IOException e) {
- }
- return !file.exists();
- }
- }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
- }
-
- protected void waitForPidToStop(final int pid, boolean throwOnTimeout) throws Exception {
- assertEventuallyFalse("Process never died", new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- return ProcessUtils.isProcessAlive(pid);
- }
- }, WAIT_FOR_PROCESS_TO_DIE_TIMEOUT, INTERVAL);
- }
-
- protected void waitForPidToStop(final int pid) throws Exception {
- waitForPidToStop(pid, true);
- }
-
- protected void waitForFileToDelete(final File file, boolean throwOnTimeout) throws Exception {
- if (file == null) {
- return;
- }
- assertEventuallyTrue("waiting for file " + file + " to delete", new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- return !file.exists();
- }
- }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
- }
-
- protected void waitForFileToDelete(final File file) throws Exception {
- waitForFileToDelete(file, true);
- }
-
- protected static int getPid() throws PidUnavailableException {
- return ProcessUtils.identifyPid();
- }
-
- protected InputListener createLoggingListener(final String name, final String header) {
- return new InputListener() {
- @Override
- public void notifyInputLine(String line) {
- logger.info(new StringBuilder("[").append(header).append("]").append(line).toString());
- }
- @Override
- public String toString() {
- return name;
- }
- };
- }
-
- protected InputListener createCollectionListener(final String name, final String header, final List<String> lines) {
- return new InputListener() {
- @Override
- public void notifyInputLine(String line) {
- lines.add(line);
- }
- @Override
- public String toString() {
- return name;
- }
- };
- }
-
- protected InputListener createExpectedListener(final String name, final String header, final String expected, final AtomicBoolean atomic) {
- return new InputListener() {
- @Override
- public void notifyInputLine(String line) {
- if (line.contains(expected)) {
- atomic.set(true);
- }
- }
- @Override
- public String toString() {
- return name;
- }
- };
- }
-
- protected void writeGemfireProperties(final Properties gemfireProperties, final File gemfirePropertiesFile) throws IOException {
- if (!gemfirePropertiesFile.exists()) {
- gemfireProperties.store(new FileWriter(gemfirePropertiesFile), "Configuration settings for the GemFire Server");
- }
- }
-
- protected int readPid(final File pidFile) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(pidFile));
- return Integer.parseInt(StringUtils.trim(reader.readLine()));
- }
- finally {
- IOUtils.close(reader);
- }
- }
-
- protected void writePid(final File pidFile, final int pid) throws IOException {
- FileWriter writer = new FileWriter(pidFile);
- writer.write(String.valueOf(pid));
- writer.write("\n");
- writer.flush();
- writer.close();
- }
-
- protected void waitForFileToExist(final File file, boolean throwOnTimeout) throws Exception {
- assertEventuallyTrue("waiting for file " + file + " to exist", new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- return file.exists();
- }
- }, WAIT_FOR_FILE_CREATION_TIMEOUT, INTERVAL);
- }
-
- protected void waitForFileToExist(final File file) throws Exception {
- waitForFileToExist(file, true);
- }
-
- protected String getUniqueName() {
- return getClass().getSimpleName() + "_" + testName.getMethodName();
- }
-
- protected static void assertEventuallyTrue(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
- boolean done = false;
- for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (callable.call())) {
- Thread.sleep(interval);
- }
- assertTrue(message, done);
- }
-
- protected static void assertEventuallyFalse(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
- boolean done = false;
- for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (!callable.call())) {
- Thread.sleep(interval);
- }
- assertTrue(message, done);
- }
-
- protected static void disconnectFromDS() {
- InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
- if (ids != null) {
- ids.disconnect();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java
deleted file mode 100755
index ca24a4e..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.List;
-
-import com.gemstone.gemfire.distributed.AbstractLauncherServiceStatusJUnitTest.TestLauncher.TestState;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.process.PidUnavailableException;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonArray;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Tests marshaling of ServiceStatus to and from JSON.
- *
- * @since 7.0
- */
-@Category(UnitTest.class)
-public class AbstractLauncherServiceStatusJUnitTest {
-
- private static final String SERVICE_NAME = "Test";
- private static final InetAddress HOST = getLocalHost();
- private static final int PORT = 12345;
- private static final String NAME = AbstractLauncherServiceStatusJUnitTest.class.getSimpleName();
- private static final int PID = identifyPid();
- private static final long UPTIME = 123456789;
- private static final String WORKING_DIRECTORY = identifyWorkingDirectory();
- private static final List<String> JVM_ARGUMENTS = ManagementFactory.getRuntimeMXBean().getInputArguments();
- private static final String CLASSPATH = ManagementFactory.getRuntimeMXBean().getClassPath();
- private static final String GEMFIRE_VERSION = GemFireVersion.getGemFireVersion();
- private static final String JAVA_VERSION = System.getProperty("java.version");
-
- private TestLauncher launcher;
-
- @Before
- public void setUp() {
- this.launcher = new TestLauncher(HOST, PORT, NAME);
- }
-
- @Test
- public void testMarshallingTestStatusToAndFromJson() {
- final TestState status = this.launcher.status();
- final String json = status.toJson();
- validateJson(status, json);
- validateStatus(status, TestState.fromJson(json));
- }
-
- private void validateStatus(final TestState expected, final TestState actual) {
- assertEquals(expected.getClasspath(), actual.getClasspath());
- assertEquals(expected.getGemFireVersion(), actual.getGemFireVersion());
- assertEquals(expected.getJavaVersion(), actual.getJavaVersion());
- assertEquals(expected.getJvmArguments(), actual.getJvmArguments());
- assertEquals(expected.getPid(), actual.getPid());
- assertEquals(expected.getStatus(), actual.getStatus());
- assertEquals(expected.getTimestamp(), actual.getTimestamp());
- assertEquals(expected.getUptime(), actual.getUptime());
- assertEquals(expected.getWorkingDirectory(), actual.getWorkingDirectory());
- assertEquals(expected.getHost(), actual.getHost());
- assertEquals(expected.getPort(), actual.getPort());
- assertEquals(expected.getMemberName(), actual.getMemberName());
- }
-
- private void validateJson(final TestState expected, final String json) {
- final TestState actual = TestState.fromJson(json);
- validateStatus(expected, actual);
- }
-
- private static int identifyPid() {
- try {
- return ProcessUtils.identifyPid();
- }
- catch (PidUnavailableException e) {
- return 0;
- }
- }
-
- private static String identifyWorkingDirectory() {
- try {
- return new File(System.getProperty("user.dir")).getCanonicalPath();
- }
- catch (IOException e) {
- return new File(System.getProperty("user.dir")).getAbsolutePath();
- }
- }
-
- private static InetAddress getLocalHost() {
- try {
- return InetAddress.getLocalHost();
- }
- catch (UnknownHostException e) {
- return null;
- }
- }
-
- static class TestLauncher extends AbstractLauncher<String> {
-
- private final InetAddress bindAddress;
- private final int port;
- private final String memberName;
- private final File logFile;
-
- TestLauncher(InetAddress bindAddress,
- int port,
- String memberName) {
- this.bindAddress = bindAddress;
- this.port = port;
- this.memberName = memberName;
- this.logFile = new File(memberName + ".log");
- }
-
- public TestState status() {
- return new TestState(Status.ONLINE,
- null,
- System.currentTimeMillis(),
- getId(),
- PID,
- UPTIME,
- WORKING_DIRECTORY,
- JVM_ARGUMENTS,
- CLASSPATH,
- GEMFIRE_VERSION,
- JAVA_VERSION,
- getLogFileName(),
- getBindAddressAsString(),
- getPortAsString(),
- NAME);
- }
-
- @Override
- public void run() {
- }
-
- public String getId() {
- return getServiceName() + "@" + getBindAddress() + "[" + getPort() + "]";
- }
-
- @Override
- public String getLogFileName() {
- try {
- return this.logFile.getCanonicalPath();
- }
- catch (IOException e) {
- return this.logFile.getAbsolutePath();
- }
- }
-
- @Override
- public String getMemberName() {
- return this.memberName;
- }
-
- @Override
- public Integer getPid() {
- return null;
- }
-
- @Override
- public String getServiceName() {
- return SERVICE_NAME;
- }
-
- InetAddress getBindAddress() {
- return this.bindAddress;
- }
-
- String getBindAddressAsString() {
- return this.bindAddress.getCanonicalHostName();
- }
-
- int getPort() {
- return this.port;
- }
-
- String getPortAsString() {
- return String.valueOf(getPort());
- }
-
- public static class TestState extends ServiceState<String> {
-
- protected static TestState fromJson(final String json) {
- try {
- final GfJsonObject gfJsonObject = new GfJsonObject(json);
-
- final Status status = Status.valueOfDescription(gfJsonObject.getString(JSON_STATUS));
- final List<String> jvmArguments =
- Arrays.asList(GfJsonArray.toStringArray(gfJsonObject.getJSONArray(JSON_JVMARGUMENTS)));
-
- return new TestState(status,
- gfJsonObject.getString(JSON_STATUSMESSAGE),
- gfJsonObject.getLong(JSON_TIMESTAMP),
- gfJsonObject.getString(JSON_LOCATION),
- gfJsonObject.getInt(JSON_PID),
- gfJsonObject.getLong(JSON_UPTIME),
- gfJsonObject.getString(JSON_WORKINGDIRECTORY),
- jvmArguments,
- gfJsonObject.getString(JSON_CLASSPATH),
- gfJsonObject.getString(JSON_GEMFIREVERSION),
- gfJsonObject.getString(JSON_JAVAVERSION),
- gfJsonObject.getString(JSON_LOGFILE),
- gfJsonObject.getString(JSON_HOST),
- gfJsonObject.getString(JSON_PORT),
- gfJsonObject.getString(JSON_MEMBERNAME));
- }
- catch (GfJsonException e) {
- throw new IllegalArgumentException("Unable to create TestState from JSON: " + json);
- }
- }
-
- protected TestState(final Status status,
- final String statusMessage,
- final long timestamp,
- final String location,
- final Integer pid,
- final Long uptime,
- final String workingDirectory,
- final List<String> jvmArguments,
- final String classpath,
- final String gemfireVersion,
- final String javaVersion,
- final String logFile,
- final String host,
- final String port,
- final String name) {
- super(status, statusMessage, timestamp, location, pid, uptime, workingDirectory, jvmArguments, classpath,
- gemfireVersion, javaVersion, logFile, host, port, name);
- }
-
- @Override
- protected String getServiceName() {
- return SERVICE_NAME;
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
new file mode 100755
index 0000000..c741def
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncherServiceStatusTest.TestLauncher.TestState;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.process.PidUnavailableException;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonArray;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Tests marshaling of ServiceStatus to and from JSON.
+ *
+ * @since 7.0
+ */
+@Category(UnitTest.class)
+public class AbstractLauncherServiceStatusTest {
+
+ private static final String SERVICE_NAME = "Test";
+ private static final InetAddress HOST = getLocalHost();
+ private static final int PORT = 12345;
+ private static final String NAME = AbstractLauncherServiceStatusTest.class.getSimpleName();
+ private static final int PID = identifyPid();
+ private static final long UPTIME = 123456789;
+ private static final String WORKING_DIRECTORY = identifyWorkingDirectory();
+ private static final List<String> JVM_ARGUMENTS = ManagementFactory.getRuntimeMXBean().getInputArguments();
+ private static final String CLASSPATH = ManagementFactory.getRuntimeMXBean().getClassPath();
+ private static final String GEMFIRE_VERSION = GemFireVersion.getGemFireVersion();
+ private static final String JAVA_VERSION = System.getProperty("java.version");
+
+ private TestLauncher launcher;
+
+ @Before
+ public void setUp() {
+ this.launcher = new TestLauncher(HOST, PORT, NAME);
+ }
+
+ @Test
+ public void testMarshallingTestStatusToAndFromJson() {
+ final TestState status = this.launcher.status();
+ final String json = status.toJson();
+ validateJson(status, json);
+ validateStatus(status, TestState.fromJson(json));
+ }
+
+ private void validateStatus(final TestState expected, final TestState actual) {
+ assertEquals(expected.getClasspath(), actual.getClasspath());
+ assertEquals(expected.getGemFireVersion(), actual.getGemFireVersion());
+ assertEquals(expected.getJavaVersion(), actual.getJavaVersion());
+ assertEquals(expected.getJvmArguments(), actual.getJvmArguments());
+ assertEquals(expected.getPid(), actual.getPid());
+ assertEquals(expected.getStatus(), actual.getStatus());
+ assertEquals(expected.getTimestamp(), actual.getTimestamp());
+ assertEquals(expected.getUptime(), actual.getUptime());
+ assertEquals(expected.getWorkingDirectory(), actual.getWorkingDirectory());
+ assertEquals(expected.getHost(), actual.getHost());
+ assertEquals(expected.getPort(), actual.getPort());
+ assertEquals(expected.getMemberName(), actual.getMemberName());
+ }
+
+ private void validateJson(final TestState expected, final String json) {
+ final TestState actual = TestState.fromJson(json);
+ validateStatus(expected, actual);
+ }
+
+ private static int identifyPid() {
+ try {
+ return ProcessUtils.identifyPid();
+ }
+ catch (PidUnavailableException e) {
+ return 0;
+ }
+ }
+
+ private static String identifyWorkingDirectory() {
+ try {
+ return new File(System.getProperty("user.dir")).getCanonicalPath();
+ }
+ catch (IOException e) {
+ return new File(System.getProperty("user.dir")).getAbsolutePath();
+ }
+ }
+
+ private static InetAddress getLocalHost() {
+ try {
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException e) {
+ return null;
+ }
+ }
+
+ static class TestLauncher extends AbstractLauncher<String> {
+
+ private final InetAddress bindAddress;
+ private final int port;
+ private final String memberName;
+ private final File logFile;
+
+ TestLauncher(InetAddress bindAddress,
+ int port,
+ String memberName) {
+ this.bindAddress = bindAddress;
+ this.port = port;
+ this.memberName = memberName;
+ this.logFile = new File(memberName + ".log");
+ }
+
+ public TestState status() {
+ return new TestState(Status.ONLINE,
+ null,
+ System.currentTimeMillis(),
+ getId(),
+ PID,
+ UPTIME,
+ WORKING_DIRECTORY,
+ JVM_ARGUMENTS,
+ CLASSPATH,
+ GEMFIRE_VERSION,
+ JAVA_VERSION,
+ getLogFileName(),
+ getBindAddressAsString(),
+ getPortAsString(),
+ NAME);
+ }
+
+ @Override
+ public void run() {
+ }
+
+ public String getId() {
+ return getServiceName() + "@" + getBindAddress() + "[" + getPort() + "]";
+ }
+
+ @Override
+ public String getLogFileName() {
+ try {
+ return this.logFile.getCanonicalPath();
+ }
+ catch (IOException e) {
+ return this.logFile.getAbsolutePath();
+ }
+ }
+
+ @Override
+ public String getMemberName() {
+ return this.memberName;
+ }
+
+ @Override
+ public Integer getPid() {
+ return null;
+ }
+
+ @Override
+ public String getServiceName() {
+ return SERVICE_NAME;
+ }
+
+ InetAddress getBindAddress() {
+ return this.bindAddress;
+ }
+
+ String getBindAddressAsString() {
+ return this.bindAddress.getCanonicalHostName();
+ }
+
+ int getPort() {
+ return this.port;
+ }
+
+ String getPortAsString() {
+ return String.valueOf(getPort());
+ }
+
+ public static class TestState extends ServiceState<String> {
+
+ protected static TestState fromJson(final String json) {
+ try {
+ final GfJsonObject gfJsonObject = new GfJsonObject(json);
+
+ final Status status = Status.valueOfDescription(gfJsonObject.getString(JSON_STATUS));
+ final List<String> jvmArguments =
+ Arrays.asList(GfJsonArray.toStringArray(gfJsonObject.getJSONArray(JSON_JVMARGUMENTS)));
+
+ return new TestState(status,
+ gfJsonObject.getString(JSON_STATUSMESSAGE),
+ gfJsonObject.getLong(JSON_TIMESTAMP),
+ gfJsonObject.getString(JSON_LOCATION),
+ gfJsonObject.getInt(JSON_PID),
+ gfJsonObject.getLong(JSON_UPTIME),
+ gfJsonObject.getString(JSON_WORKINGDIRECTORY),
+ jvmArguments,
+ gfJsonObject.getString(JSON_CLASSPATH),
+ gfJsonObject.getString(JSON_GEMFIREVERSION),
+ gfJsonObject.getString(JSON_JAVAVERSION),
+ gfJsonObject.getString(JSON_LOGFILE),
+ gfJsonObject.getString(JSON_HOST),
+ gfJsonObject.getString(JSON_PORT),
+ gfJsonObject.getString(JSON_MEMBERNAME));
+ }
+ catch (GfJsonException e) {
+ throw new IllegalArgumentException("Unable to create TestState from JSON: " + json);
+ }
+ }
+
+ protected TestState(final Status status,
+ final String statusMessage,
+ final long timestamp,
+ final String location,
+ final Integer pid,
+ final Long uptime,
+ final String workingDirectory,
+ final List<String> jvmArguments,
+ final String classpath,
+ final String gemfireVersion,
+ final String javaVersion,
+ final String logFile,
+ final String host,
+ final String port,
+ final String name) {
+ super(status, statusMessage, timestamp, location, pid, uptime, workingDirectory, jvmArguments, classpath,
+ gemfireVersion, javaVersion, logFile, host, port, name);
+ }
+
+ @Override
+ protected String getServiceName() {
+ return SERVICE_NAME;
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
new file mode 100644
index 0000000..cabb5ff
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The AbstractLauncherTest class is a test suite of unit tests testing the contract and functionality
+ * of the AbstractLauncher class.
+ * <p/>
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since 7.0
+ */
+@Category(UnitTest.class)
+public class AbstractLauncherTest {
+
+ protected AbstractLauncher<?> createAbstractLauncher(final String memberName, final String memberId) {
+ return new FakeServiceLauncher(memberName, memberId);
+ }
+
+ @Test
+ public void testIsAttachAPINotFound() {
+ final AbstractLauncher<?> launcher = createAbstractLauncher("012", "TestMember");
+
+ assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+ "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException")));
+ assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
+ "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
+ assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+ "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/tools/attach/AgentNotSupportedException")));
+ assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
+ "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
+ assertFalse(launcher.isAttachAPINotFound(new IllegalArgumentException(
+ "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
+ assertFalse(launcher.isAttachAPINotFound(new IllegalStateException(
+ "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
+ assertFalse(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+ "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/companyx/app/service/MyServiceClass")));
+ assertFalse(launcher.isAttachAPINotFound(new ClassNotFoundException(
+ "Caused by: java.lang.ClassNotFoundException: com.companyx.app.attach.NutsNotAttachedException")));
+ }
+
+ @Test
+ public void testIsSet() {
+ final Properties properties = new Properties();
+
+ assertFalse(properties.containsKey(DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+ properties.setProperty(DistributionConfig.NAME_NAME, "");
+
+ assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+ properties.setProperty(DistributionConfig.NAME_NAME, " ");
+
+ assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+ properties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
+
+ assertTrue(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+ assertFalse(AbstractLauncher.isSet(properties, "NaMe"));
+ }
+
+ @Test
+ public void testLoadGemFirePropertiesWithNullURL() {
+ final Properties properties = AbstractLauncher.loadGemFireProperties(null);
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ }
+
+ @Test
+ public void testLoadGemFirePropertiesWithNonExistingURL() throws MalformedURLException {
+ final Properties properties = AbstractLauncher.loadGemFireProperties(new URL("file:///path/to/non_existing/gemfire.properties"));
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ }
+
+ @Test
+ public void testGetDistributedSystemProperties() {
+ AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "1");
+
+ assertNotNull(launcher);
+ assertEquals("1", launcher.getMemberId());
+ assertEquals("memberOne", launcher.getMemberName());
+
+ Properties distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertTrue(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+ assertEquals("memberOne", distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
+
+ launcher = createAbstractLauncher(null, "22");
+
+ assertNotNull(launcher);
+ assertEquals("22", launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+
+ distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+
+ launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
+
+ assertNotNull(launcher);
+ assertEquals("333", launcher.getMemberId());
+ assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+
+ distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+
+ launcher = createAbstractLauncher(" ", "4444");
+
+ assertNotNull(launcher);
+ assertEquals("4444", launcher.getMemberId());
+ assertEquals(" ", launcher.getMemberName());
+
+ distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+ assertNotNull(distributedSystemProperties);
+ assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+ }
+
+ @Test
+ public void testGetDistributedSystemPropertiesWithDefaults() {
+ AbstractLauncher<?> launcher = createAbstractLauncher("TestMember", "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals("TestMember", launcher.getMemberName());
+
+ Properties defaults = new Properties();
+
+ defaults.setProperty("testKey", "testValue");
+
+ Properties distributedSystemProperties = launcher.getDistributedSystemProperties(defaults);
+
+ assertNotNull(distributedSystemProperties);
+ assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
+ assertEquals("testValue", distributedSystemProperties.getProperty("testKey"));
+ }
+
+ @Test
+ public void testGetMember() {
+ AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals("memberOne", launcher.getMemberName());
+ assertEquals("memberOne", launcher.getMember());
+
+ launcher = createAbstractLauncher(null, "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+ assertEquals("123", launcher.getMember());
+
+ launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+ assertEquals("123", launcher.getMember());
+
+ launcher = createAbstractLauncher(" ", "123");
+
+ assertNotNull(launcher);
+ assertEquals("123", launcher.getMemberId());
+ assertEquals(" ", launcher.getMemberName());
+ assertEquals("123", launcher.getMember());
+
+ launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
+
+ assertNotNull(launcher);
+ assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+ assertNull(launcher.getMember());
+
+ launcher = createAbstractLauncher(null, " ");
+
+ assertNotNull(launcher);
+ assertEquals(" ", launcher.getMemberId());
+ assertNull(launcher.getMemberName());
+ assertNull(launcher.getMember());
+ }
+
+ @Test
+ public void testAbstractLauncherServiceStateToDaysHoursMinutesSeconds() {
+ assertEquals("", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(null));
+ assertEquals("0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(0l));
+ assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1000l));
+ assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1999l));
+ assertEquals("2 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(2001l));
+ assertEquals("45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(45000l));
+ assertEquals("1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 1000l));
+ assertEquals("1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(61 * 1000l));
+ assertEquals("1 minute 30 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(90 * 1000l));
+ assertEquals("2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(120 * 1000l));
+ assertEquals("2 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(121 * 1000l));
+ assertEquals("2 minutes 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(135 * 1000l));
+ assertEquals("1 hour 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l));
+ assertEquals("1 hour 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 1000l));
+ assertEquals("1 hour 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 15000l));
+ assertEquals("1 hour 1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l));
+ assertEquals("1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 1000l));
+ assertEquals("1 hour 1 minute 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 45000l));
+ assertEquals("1 hour 2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 62 * 1000l));
+ assertEquals("1 hour 5 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 1000l));
+ assertEquals("1 hour 5 minutes 10 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 10000l));
+ assertEquals("1 hour 59 minutes 11 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 119 * 1000l + 11000l));
+ assertEquals("1 day 1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+ TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(1) + TimeUnit.SECONDS.toMillis(1)));
+ assertEquals("1 day 5 hours 15 minutes 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+ TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(5) + TimeUnit.MINUTES.toMillis(15) + TimeUnit.SECONDS.toMillis(45)));
+ assertEquals("2 days 1 hour 30 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+ TimeUnit.DAYS.toMillis(2) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(30) + TimeUnit.SECONDS.toMillis(1)));
+ }
+
+ protected static final class FakeServiceLauncher extends AbstractLauncher<String> {
+
+ private final String memberId;
+ private final String memberName;
+
+ public FakeServiceLauncher(final String memberName, final String memberId) {
+ this.memberId = memberId;
+ this.memberName = memberName;
+ }
+
+ @Override
+ boolean isAttachAPIOnClasspath() {
+ return false;
+ }
+
+ @Override
+ public String getLogFileName() {
+ throw new UnsupportedOperationException("Not Implemented!");
+ }
+
+ @Override
+ public String getMemberId() {
+ return memberId;
+ }
+
+ @Override
+ public String getMemberName() {
+ return memberName;
+ }
+
+ @Override
+ public Integer getPid() {
+ throw new UnsupportedOperationException("Not Implemented!");
+ }
+
+ @Override
+ public String getServiceName() {
+ return "TestService";
+ }
+
+ @Override
+ public void run() {
+ throw new UnsupportedOperationException("Not Implemented!");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java
new file mode 100755
index 0000000..5434a01
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import java.util.concurrent.Callable;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.ErrorCollector;
+import org.junit.rules.TemporaryFolder;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.DistributionLocator;
+
+/**
+ * @since 8.0
+ */
+public abstract class AbstractLocatorLauncherIntegrationTestCase extends AbstractLauncherIntegrationTestCase {
+
+ protected volatile int locatorPort;
+ protected volatile LocatorLauncher launcher;
+ protected volatile String workingDirectory;
+ protected volatile String clusterConfigDirectory;
+
+ @Rule
+ public ErrorCollector errorCollector = new ErrorCollector();
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Before
+ public final void setUpAbstractLocatorLauncherIntegrationTestCase() throws Exception {
+ final int port = AvailablePortHelper.getRandomAvailableTCPPort();
+ System.setProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
+ this.locatorPort = port;
+ this.workingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+ this.clusterConfigDirectory = this.temporaryFolder.newFolder(SharedConfiguration.CLUSTER_CONFIG_DISK_DIR_PREFIX + getUniqueName()).getCanonicalPath();
+ }
+
+ @After
+ public final void tearDownAbstractLocatorLauncherIntegrationTestCase() throws Exception {
+ this.locatorPort = 0;
+ if (this.launcher != null) {
+ this.launcher.stop();
+ this.launcher = null;
+ }
+ }
+
+ /**
+ * Override if needed
+ */
+ protected Status getExpectedStopStatusForNotRunning() {
+ return Status.NOT_RESPONDING;
+ }
+
+ protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
+ assertEventuallyTrue("waiting for process to start: " + launcher.status(), new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ try {
+ final LocatorState LocatorState = launcher.status();
+ return (LocatorState != null && Status.ONLINE.equals(LocatorState.getStatus()));
+ }
+ catch (RuntimeException e) {
+ return false;
+ }
+ }
+ }, timeout, interval);
+ }
+
+ protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
+ waitForLocatorToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
+ }
+
+ protected void waitForLocatorToStart(final LocatorLauncher launcher, boolean throwOnTimeout) throws Exception {
+ waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
+ }
+
+ protected void waitForLocatorToStart(final LocatorLauncher launcher) throws Exception {
+ waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
+ }
+
+ protected static void waitForLocatorToStart(int port, int timeout, int interval, boolean throwOnTimeout) throws Exception {
+ final LocatorLauncher locatorLauncher = new Builder().setPort(port).build();
+ assertEventuallyTrue("Waiting for Locator in other process to start.", new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ try {
+ final LocatorState locatorState = locatorLauncher.status();
+ return (locatorState != null && Status.ONLINE.equals(locatorState.getStatus()));
+ }
+ catch (RuntimeException e) {
+ return false;
+ }
+ }
+ }, timeout, interval);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java
deleted file mode 100755
index 62c4d86..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import java.util.concurrent.Callable;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.ErrorCollector;
-import org.junit.rules.TemporaryFolder;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.DistributionLocator;
-
-/**
- * @since 8.0
- */
-public abstract class AbstractLocatorLauncherJUnitTestCase extends AbstractLauncherJUnitTestCase {
-
- protected volatile int locatorPort;
- protected volatile LocatorLauncher launcher;
-
- @Rule
- public ErrorCollector errorCollector = new ErrorCollector();
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
- public final void setUpLocatorLauncherTest() throws Exception {
- final int port = AvailablePortHelper.getRandomAvailableTCPPort();
- System.setProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
- this.locatorPort = port;
- }
-
- @After
- public final void tearDownLocatorLauncherTest() throws Exception {
- this.locatorPort = 0;
- if (this.launcher != null) {
- this.launcher.stop();
- this.launcher = null;
- }
- }
-
- protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
- assertEventuallyTrue("waiting for process to start: " + launcher.status(), new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- try {
- final LocatorState LocatorState = launcher.status();
- return (LocatorState != null && Status.ONLINE.equals(LocatorState.getStatus()));
- }
- catch (RuntimeException e) {
- return false;
- }
- }
- }, timeout, interval);
- }
-
- protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
- waitForLocatorToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
- }
-
- protected void waitForLocatorToStart(final LocatorLauncher launcher, boolean throwOnTimeout) throws Exception {
- waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
- }
-
- protected void waitForLocatorToStart(final LocatorLauncher launcher) throws Exception {
- waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
- }
-
- protected static void waitForLocatorToStart(int port, int timeout, int interval, boolean throwOnTimeout) throws Exception {
- final LocatorLauncher locatorLauncher = new Builder().setPort(port).build();
- assertEventuallyTrue("Waiting for Locator in other process to start.", new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- try {
- final LocatorState locatorState = locatorLauncher.status();
- return (locatorState != null && Status.ONLINE.equals(locatorState.getStatus()));
- }
- catch (RuntimeException e) {
- return false;
- }
- }
- }, timeout, interval);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
new file mode 100644
index 0000000..ecfb952
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+
+public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase extends AbstractLocatorLauncherIntegrationTestCase {
+
+ protected volatile Process process;
+ protected volatile ProcessStreamReader processOutReader;
+ protected volatile ProcessStreamReader processErrReader;
+
+ @Before
+ public final void setUpAbstractLocatorLauncherRemoteIntegrationTestCase() throws Exception {
+ }
+
+ @After
+ public final void tearDownAbstractLocatorLauncherRemoteIntegrationTestCase() throws Exception {
+ if (this.process != null) {
+ this.process.destroy();
+ this.process = null;
+ }
+ if (this.processOutReader != null && this.processOutReader.isRunning()) {
+ this.processOutReader.stop();
+ }
+ if (this.processErrReader != null && this.processErrReader.isRunning()) {
+ this.processErrReader.stop();
+ }
+ }
+
+ /**
+ * Override as needed.
+ */
+ protected List<String> getJvmArguments() {
+ final List<String> jvmArguments = new ArrayList<String>();
+ jvmArguments.add("-Dgemfire.log-level=config");
+ return jvmArguments;
+ }
+
+ /**
+ * Remove final if a test needs to override.
+ */
+ protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ return AbstractLauncher.Status.NOT_RESPONDING;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java
new file mode 100755
index 0000000..5f4fd6f
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.Callable;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.ErrorCollector;
+import org.junit.rules.TemporaryFolder;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
+
+/**
+ * @since 8.0
+ */
+public abstract class AbstractServerLauncherIntegrationTestCase extends AbstractLauncherIntegrationTestCase {
+
+ protected volatile int serverPort;
+ protected volatile ServerLauncher launcher;
+ protected volatile String workingDirectory;
+
+ @Rule
+ public ErrorCollector errorCollector= new ErrorCollector();
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Before
+ public final void setUpServerLauncherTest() throws Exception {
+ System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
+ final int port = AvailablePortHelper.getRandomAvailableTCPPort();
+ System.setProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
+ this.serverPort = port;
+ this.workingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+ }
+
+ @After
+ public final void tearDownServerLauncherTest() throws Exception {
+ this.serverPort = 0;
+ if (this.launcher != null) {
+ this.launcher.stop();
+ this.launcher = null;
+ }
+ }
+
+ protected void waitForServerToStart(final ServerLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
+ assertEventuallyTrue("waiting for local Server to start: " + launcher.status(), new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ try {
+ final ServerState serverState = launcher.status();
+ assertNotNull(serverState);
+ return Status.ONLINE.equals(serverState.getStatus());
+ }
+ catch (RuntimeException e) {
+ return false;
+ }
+ }
+ }, timeout, interval);
+ }
+
+ protected void waitForServerToStart(final ServerLauncher launcher, boolean throwOnTimeout) throws Exception {
+ waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
+ }
+
+ protected void waitForServerToStart(final ServerLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
+ waitForServerToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
+ }
+
+ protected void waitForServerToStart(final ServerLauncher launcher) throws Exception {
+ waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java
deleted file mode 100755
index 0ee3e7c..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.util.concurrent.Callable;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.ErrorCollector;
-import org.junit.rules.TemporaryFolder;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
-
-/**
- * @since 8.0
- */
-public abstract class AbstractServerLauncherJUnitTestCase extends AbstractLauncherJUnitTestCase {
-
- protected volatile int serverPort;
- protected volatile ServerLauncher launcher;
-
- @Rule
- public ErrorCollector errorCollector= new ErrorCollector();
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
- public final void setUpServerLauncherTest() throws Exception {
- System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
- final int port = AvailablePortHelper.getRandomAvailableTCPPort();
- System.setProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
- this.serverPort = port;
- }
-
- @After
- public final void tearDownServerLauncherTest() throws Exception {
- this.serverPort = 0;
- if (this.launcher != null) {
- this.launcher.stop();
- this.launcher = null;
- }
- }
-
- protected void waitForServerToStart(final ServerLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
- assertEventuallyTrue("waiting for local Server to start: " + launcher.status(), new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- try {
- final ServerState serverState = launcher.status();
- assertNotNull(serverState);
- return Status.ONLINE.equals(serverState.getStatus());
- }
- catch (RuntimeException e) {
- return false;
- }
- }
- }, timeout, interval);
- }
-
- protected void waitForServerToStart(final ServerLauncher launcher, boolean throwOnTimeout) throws Exception {
- waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
- }
-
- protected void waitForServerToStart(final ServerLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
- waitForServerToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
- }
-
- protected void waitForServerToStart(final ServerLauncher launcher) throws Exception {
- waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
- }
-}
[22/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
old mode 100644
new mode 100755
index a6bbb86..d3d232e
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/LocalizedStrings.java
@@ -40,13 +40,2024 @@ import com.gemstone.gemfire.i18n.StringId;
* @since 6.0
*
*/
-public class LocalizedStrings extends ParentLocalizedStrings {
+public class LocalizedStrings {
+ /** reserved space for commonly used strings, messageId 0-1024 **/
+ public static final StringId EMPTY = new StringId(0, "");
+ public static final StringId ONE_ARG = StringId.LITERAL;
+ //alias for use in temporarily adding debugging to the product
+ public static final StringId DEBUG = ONE_ARG;
+
+ public static final StringId DONT_RELEASE = ONE_ARG;
+
+ //alias for use in the test tree
+ public static final StringId TESTING = ONE_ARG;
+ public static final StringId TWO_ARG = new StringId(2, "{0} {1}");
+ public static final StringId TWO_ARG_COLON = new StringId(3, "{0} : {1}");
+ public static final StringId ERROR = new StringId(4, "ERROR");
+ public static final StringId CACHE_IS_CLOSING = new StringId(1021, "Cache is closing");
+ public static final StringId NOT_A_REAL_GEMFIREVM = new StringId(1022, "Not a real GemFireVM");
+ public static final StringId SHOULDNT_INVOKE = new StringId(1023, "Should not be invoked");
+ public static final StringId UNSUPPORTED_AT_THIS_TIME = new StringId(1024, "Unsupported at this time");
+
+ /**Gemfire strings, messageId 1025-15000 **/
+ public static final StringId AbstractHealthEvaluator_OKAY_HEALTH__0 = new StringId(1025, "OKAY_HEALTH: {0}");
+ public static final StringId AbstractHealthEvaluator_POOR_HEALTH__0 = new StringId(1026, "POOR_HEALTH: {0}");
+ public static final StringId AbstractRegion_CACHECALLBACK_CLOSE_EXCEPTION = new StringId(1027, "CacheCallback close exception");
+ public static final StringId PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS = new StringId(1028, "A pool named \"{0}\" already exists");
+ public static final StringId AcceptorImpl_CACHE_SERVER_CONNECTION_LISTENER_BOUND_TO_ADDRESS_0_WITH_BACKLOG_1 = new StringId(1029, "Cache server connection listener bound to address {0} with backlog {1}.");
+ public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT = new StringId(1030, "Cache server: failed accepting client connection due to socket timeout.");
+ public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0 = new StringId(1031, "Cache server: failed accepting client connection {0}");
+ public static final StringId AcceptorImpl_CACHE_SERVER_ON_PORT_0_IS_SHUTTING_DOWN = new StringId(1032, "Cache server on port {0} is shutting down.");
+ public static final StringId AcceptorImpl_CACHE_SERVER_TIMED_OUT_WAITING_FOR_HANDSHAKE_FROM__0 = new StringId(1033, "Cache server: timed out waiting for handshake from {0}");
+ public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_EXCEPTION = new StringId(1034, "Cache server: Unexpected Exception");
+ public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_IOEXCEPTION_FROM_ACCEPT = new StringId(1035, "Cache server: Unexpected IOException from accept");
+ public static final StringId AcceptorImpl_EXCEEDED_MAX_CONNECTIONS_0 = new StringId(1036, "exceeded max-connections {0}");
+ public static final StringId AcceptorImpl_IGNORING = new StringId(1037, "ignoring");
+ public static final StringId AcceptorImpl_IGNORING_EVENT_ON_SELECTOR_KEY__0 = new StringId(1038, "ignoring event on selector key {0}");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_A_PREVIOUS_CONNECTION_ATTEMPT_FROM_THIS_CLIENT_IS_STILL_BEING_PROCESSED__0 = new StringId(1039, "A previous connection attempt from this client is still being processed: {0}");
+ public static final StringId AcceptorImpl_REJECTED_CONNECTION_FROM_0_BECAUSE_CURRENT_CONNECTION_COUNT_OF_1_IS_GREATER_THAN_OR_EQUAL_TO_THE_CONFIGURED_MAX_OF_2 = new StringId(1040, "Rejected connection from {0} because current connection count of {1} is greater than or equal to the configured max of {2}");
+ public static final StringId AcceptorImpl_SELECTOR_ENABLED = new StringId(1041, "SELECTOR enabled");
+ public static final StringId AcceptorImpl_UNEXPECTED = new StringId(1042, "unexpected");
+ public static final StringId AdminDistributedSystem_COULD_NOT_SET_THE_GEMFIRE_VM = new StringId(1043, "Could not set the GemFire VM.");
+ public static final StringId AdminDistributedSystemImpl_ADDING_NEW_APPLICATION_FOR__0 = new StringId(1044, "Adding new Application for {0}");
+ public static final StringId AdminDistributedSystemImpl_ADDING_NEW_CACHESERVER_FOR__0 = new StringId(1045, "Adding new CacheServer for {0}");
+ public static final StringId AdminDistributedSystemImpl_WHILE_GETTING_CANONICAL_FILE = new StringId(1046, "While getting canonical file");
+ public static final StringId AdminRequest_RESPONSE_TO__0__WAS_CANCELLED = new StringId(1047, "Response to {0} was cancelled.");
+ public static final StringId AdminWaiters_COULD_NOT_SEND_REQUEST_0 = new StringId(1048, "Could not send request.{0}");
+ public static final StringId AdminWaiters_REQUEST_SEND_TO_0_WAS_CANCELLED_1 = new StringId(1049, "Request sent to {0} was cancelled. {1}");
+ public static final StringId AdminWaiters_REQUEST_SENT_TO_0_FAILED_SINCE_MEMBER_DEPARTED_1 = new StringId(1050, "Request sent to {0} failed since member departed.{1}");
+ public static final StringId AgentImpl_0__IS_ALREADY_REGISTERED = new StringId(1051, "{0} is already registered.");
+ public static final StringId AgentImpl_AGENT_HAS_STOPPED = new StringId(1052, "Agent has stopped");
+ public static final StringId AgentImpl_AUTO_CONNECT_FAILED__0 = new StringId(1053, "auto connect failed: {0}");
+ public static final StringId AgentImpl_FAILED_TO_START_HTTPADAPTOR__0 = new StringId(1054, "Failed to start HttpAdaptor: {0}");
+ public static final StringId AgentImpl_FAILED_TO_START_RMICONNECTORSERVER = new StringId(1055, "Failed to start RMIConnectorServer:");
+ public static final StringId AgentImpl_FAILED_TO_START_SNMPADAPTOR__0 = new StringId(1056, "Failed to start SnmpAdaptor: {0}");
+ public static final StringId AgentImpl_GEMFIRE_JMX_AGENT_IS_RUNNING = new StringId(1057, "GemFire JMX Agent is running...");
+ public static final StringId AgentImpl_HTTPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1058, "HttpAdaptor already registered as {0}");
+ public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_ADDRESS__0 = new StringId(1059, "HTTP adaptor listening on address: {0}");
+ public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_PORT__0 = new StringId(1060, "HTTP adaptor listening on port: {0}");
+ public static final StringId AgentImpl_INCORRECT_NULL_HOSTNAME = new StringId(1061, "Incorrect null hostname");
+ public static final StringId AgentImpl_INCORRECT_PORT_VALUE__0 = new StringId(1062, "Incorrect port value {0}");
+ public static final StringId AgentImpl_RMICONNECTORSERVER_ALREADY_REGISTERED_AS__0 = new StringId(1063, "RMIConnectorServer already registered as {0}");
+ public static final StringId AgentImpl_SNMPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1064, "SnmpAdaptor already registered as {0}");
+ public static final StringId AgentImpl_STOPPING_JMX_AGENT = new StringId(1065, "Stopping JMX agent");
+ public static final StringId AgentImpl_XSLTPROCESSOR_ALREADY_REGISTERED_AS__0 = new StringId(1066, "XsltProcessor already registered as {0}");
+ public static final StringId AbstractRegion_THE_CONNECTION_POOL_0_HAS_NOT_BEEN_CREATED = new StringId(1067, "The connection pool \"{0}\" has not been created");
+
+ public static final StringId AttributesFactory_ADDCACHELISTENER_PARAMETER_WAS_NULL = new StringId(1069, "addCacheListener parameter was null");
+ public static final StringId AttributesFactory_AN_EVICTION_CONTROLLER_WITH_LOCAL_DESTROY_EVICTION_ACTION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1070, "An Eviction Controller with local destroy eviction action is incompatible with distributed replication");
+
+ public static final StringId AttributesFactory_CONCURRENCYLEVEL_MUST_BE_0 = new StringId(1072, "concurrencyLevel must be > 0");
+ public static final StringId AttributesFactory_DATAPOLICY_MUST_NOT_BE_NULL = new StringId(1073, "dataPolicy must not be null");
+ public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1074, "Data policies other than {0} are not allowed in partitioned regions.");
+ public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_SUPPORTED_FOR_PARTITIONED_REGIONS = new StringId(1075, "Data policies other than {0} are not supported for Partitioned Regions");
+ public static final StringId AttributesFactory_DATA_POLICY_0_IS_NOT_ALLOWED_FOR_A_PARTITIONED_REGION_DATAPOLICIES_OTHER_THAN_1_ARE_NOT_ALLOWED = new StringId(1076, "Data policy {0} is not allowed for a partitioned region. DataPolicies other than {1} are not allowed.");
+ public static final StringId AttributesFactory_DIR_SIZE_CANNOT_BE_NEGATIVE_0 = new StringId(1077, "Dir size cannot be negative : {0}");
+
+ public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_DESTROY_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1079, "ExpirationAction.LOCAL_DESTROY on the entries is incompatible with distributed replication");
+ public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1080, "ExpirationAction.LOCAL_INVALIDATE on the entries is incompatible with distributed replication");
+ public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_REGION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1081, "ExpirationAction.LOCAL_INVALIDATE on the region is incompatible with distributed replication");
+
+ public static final StringId AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL = new StringId(1085, "idleTimeout must not be null");
+ public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_ENTRY_EXPIRATION_IS_NOT_ALLOWED = new StringId(1086, "If the data policy is {0} then entry expiration is not allowed.");
+ public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_EVICTION_IS_NOT_ALLOWED = new StringId(1087, "If the data policy is {0} then eviction is not allowed.");
+ public static final StringId AttributesFactory_IF_THE_MEMBERSHIP_ATTRIBUTES_HAS_REQUIRED_ROLES_THEN_SCOPE_MUST_NOT_BE_LOCAL = new StringId(1088, "If the membership attributes has required roles then scope must not be LOCAL.");
+ public static final StringId AttributesFactory_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT = new StringId(1089, "initCacheListeners parameter had a null element");
+ public static final StringId AttributesFactory_INITIALCAPACITY_MUST_BE_0 = new StringId(1090, "initialCapacity must be >= 0");
+ public static final StringId AttributesFactory_KEYCONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1091, "keyConstraint must not be a primitive type");
+ public static final StringId AttributesFactory_LOADFACTOR_MUST_BE_0_VALUE_IS_0 = new StringId(1092, "loadFactor must be > 0, value is {0}");
+ public static final StringId AttributesFactory_MIRRORTYPE_MUST_NOT_BE_NULL = new StringId(1093, "mirrorType must not be null");
+ public static final StringId AttributesFactory_MORE_THAN_ONE_CACHE_LISTENER_EXISTS = new StringId(1094, "More than one cache listener exists.");
+ public static final StringId AttributesFactory_NO_MIRROR_TYPE_CORRESPONDS_TO_DATA_POLICY_0 = new StringId(1095, "No mirror type corresponds to data policy \"{0}\".");
+ public static final StringId AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1 = new StringId(1096, " Number of diskSizes is {0} which is not equal to number of disk Dirs which is {1}");
+ public static final StringId AttributesFactory_PARTITIONATTRIBUTES_LOCALMAXMEMORY_MUST_NOT_BE_NEGATIVE = new StringId(1097, "PartitionAttributes localMaxMemory must not be negative.");
+ public static final StringId AttributesFactory_SCOPETYPE_MUST_NOT_BE_NULL = new StringId(1098, "scopeType must not be null");
+ public static final StringId AttributesFactory_SETLOCKGRANTERTRUE_IS_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1099, "setLockGranter(true) is not allowed in Partitioned Regions.");
+ public static final StringId AttributesFactory_SETTING_SCOPE_ON_A_PARTITIONED_REGIONS_IS_NOT_ALLOWED = new StringId(1100, "Setting Scope on a Partitioned Regions is not allowed.");
+ public static final StringId AttributesFactory_STATISTICS_MUST_BE_ENABLED_FOR_EXPIRATION = new StringId(1101, "Statistics must be enabled for expiration");
+ public static final StringId AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL = new StringId(1102, "timeToLive must not be null");
+ public static final StringId AttributesFactory_TOTAL_SIZE_OF_PARTITION_REGION_MUST_BE_0 = new StringId(1103, "Total size of partition region must be > 0.");
+ public static final StringId AttributesFactory_VALUECONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1104, "valueConstraint must not be a primitive type");
+ public static final StringId BaseCommand_0_CONNECTION_DISCONNECT_DETECTED_BY_EOF = new StringId(1105, "{0}: connection disconnect detected by EOF.");
+ public static final StringId BaseCommand_0_EOFEXCEPTION_DURING_A_WRITE_OPERATION_ON_REGION__1_KEY_2_MESSAGEID_3 = new StringId(1106, "{0}: EOFException during a write operation on region : {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_0_QUERYSTRING_IS_1 = new StringId(1107, "{0} : QueryString is: {1}.");
+ public static final StringId BaseCommand_0_UNEXPECTED_ERROR_ON_SERVER = new StringId(1108, "{0} : Unexpected Error on server");
+ public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION = new StringId(1109, "{0}: Unexpected Exception");
+ public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1110, "{0}: Unexpected Exception during operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION = new StringId(1111, "{0}: Unexpected IOException: ");
+ public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION_DURING_OPERATION_FOR_REGION_1_KEY_2_MESSID_3 = new StringId(1112, "{0}: Unexpected IOException during operation for region: {1} key: {2} messId: {3}");
+ public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION = new StringId(1113, "{0}: Unexpected ShutdownException: ");
+ public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1114, "{0}: Unexpected ShutdownException during operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION = new StringId(1115, "{0}: Unexpected ThreadInterruptedException: ");
+ public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1116, "{0}: Unexpected ThreadInterruptedException during operation on region: {1} key: {2} messageId: {3}");
+ public static final StringId BaseCommand_UNKNOWN_QUERY_EXCEPTION = new StringId(1117, "Uknown query Exception.");
+ public static final StringId BaseCommand_SEVERE_CACHE_EXCEPTION_0 = new StringId(1118, "Severe cache exception : {0}");
+ public static final StringId BaseCommand_UNEXPECTED_QUERYINVALIDEXCEPTION_WHILE_PROCESSING_QUERY_0 = new StringId(1119, "Unexpected QueryInvalidException while processing query {0}");
+ public static final StringId LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED = new StringId(1120, "The region {0} was configured to use off heap memory but no off heap memory was configured");
+
+ public static final StringId CacheServerImpl_CACHESERVER_CONFIGURATION___0 = new StringId(1122, "CacheServer Configuration: {0}");
+ public static final StringId CacheServerImpl_FORCING_NOTIFYBYSUBSCRIPTION_TO_SUPPORT_DYNAMIC_REGIONS = new StringId(1123, "Forcing notifyBySubscription to support dynamic regions");
+
+ public static final StringId BucketAdvisor_ATTEMPTED_TO_CLOSE_BUCKETADVISOR_THAT_IS_ALREADY_CLOSED = new StringId(1131, "Attempted to close BucketAdvisor that is already CLOSED");
+ public static final StringId AgentImpl_COULD_NOT_TAIL_0_BECAUSE_1 = new StringId(1132, "Could not tail \"{0}\" because: {1}");
+ public static final StringId SystemAdmin_USED_TO_SPECIFY_A_HOST_NAME_OR_IP_ADDRESS_TO_GIVE_TO_CLIENTS_SO_THEY_CAN_CONNECT_TO_A_LOCATOR = new StringId(1133, "Used to specify a host name or IP address to give to clients so they can connect to a locator.");
+ public static final StringId BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY = new StringId(1134, "BucketAdvisor was not closed properly.");
+ public static final StringId BucketBackupMessage_BUCKETBACKUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1135, "BucketBackupMessage: data store not configured for this member");
+
+ public static final StringId CacheClientNotifier_0_REGISTERCLIENT_EXCEPTION_ENCOUNTERED_IN_REGISTRATION_1 = new StringId(1140, "{0} :registerClient: Exception encountered in registration {1}");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_KEEPING_PROXY_FOR_DURABLE_CLIENT_NAMED_0_FOR_1_SECONDS_2 = new StringId(1141, "CacheClientNotifier: Keeping proxy for durable client named {0} for {1} seconds {2}.");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_THE_REQUESTED_DURABLE_CLIENT_HAS_THE_SAME_IDENTIFIER__0__AS_AN_EXISTING_DURABLE_CLIENT__1__DUPLICATE_DURABLE_CLIENTS_ARE_NOT_ALLOWED = new StringId(1142, "CacheClientNotifier: The requested durable client has the same identifier ( {0} ) as an existing durable client ( {1} ). Duplicate durable clients are not allowed.");
+ public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_UNSUCCESSFULLY_REGISTERED_CLIENT_WITH_IDENTIFIER__0 = new StringId(1143, "CacheClientNotifier: Unsuccessfully registered client with identifier {0}");
+ public static final StringId CacheClientNotifier_CANNOT_NOTIFY_CLIENTS_TO_PERFORM_OPERATION_0_ON_EVENT_1 = new StringId(1144, "CacheClientNotifier: Cannot notify clients to perform operation {0} on event {1}");
+ public static final StringId CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_PROCESSING_CQS = new StringId(1145, "Exception occurred while processing CQs");
+
+ public static final StringId CacheClientNotifier_UNABLE_TO_CLOSE_CQS_FOR_THE_CLIENT__0 = new StringId(1147, "Unable to close CQs for the client: {0}");
+ public static final StringId CacheClientNotifier_UNABLE_TO_GET_THE_CQSERVICE_WHILE_CLOSING_THE_DEAD_PROXIES = new StringId(1148, "Unable to get the CqService while closing the dead proxies");
+ public static final StringId CacheClientProxy_0_AN_UNEXPECTED_IOEXCEPTION_OCCURRED_SO_THE_PROXY_WILL_BE_CLOSED = new StringId(1149, "{0}: An unexpected IOException occurred so the proxy will be closed.");
+ public static final StringId CacheClientProxy_0_CANCELLING_EXPIRATION_TASK_SINCE_THE_CLIENT_HAS_RECONNECTED = new StringId(1150, "{0}: Cancelling expiration task since the client has reconnected.");
+ public static final StringId CacheClientProxy_0_COULD_NOT_STOP_MESSAGE_DISPATCHER_THREAD = new StringId(1151, "{0}: Could not stop message dispatcher thread.");
+ public static final StringId CacheClientProxy_0_EXCEPTION_IN_CLOSING_THE_UNDERLYING_HAREGION_OF_THE_HAREGIONQUEUE = new StringId(1152, "{0}: Exception in closing the underlying HARegion of the HARegionQueue");
+ public static final StringId CacheClientProxy_0_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1153, "{0}: Exception occurred while attempting to add message to queue");
+ public static final StringId CacheClientProxy_0_POSSIBILITY_OF_NOT_BEING_ABLE_TO_SEND_SOME_OR_ALL_THE_MESSAGES_TO_CLIENTS_TOTAL_MESSAGES_CURRENTLY_PRESENT_IN_THE_LIST_1 = new StringId(1154, "{0} Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list {1}.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_SOCKET_BEING_CLOSED_LOCALLY = new StringId(1155, "{0}: Proxy closing due to socket being closed locally.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_BROKEN_PIPE_ON_SOCKET_CONNECTION = new StringId(1156, "{0}: Proxy closing due to unexpected broken pipe on socket connection.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_BY_PEER_ON_SOCKET_CONNECTION = new StringId(1157, "{0}: Proxy closing due to unexpected reset by peer on socket connection.");
+ public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_ON_SOCKET_CONNECTION = new StringId(1158, "{0}: Proxy closing due to unexpected reset on socket connection.");
+ public static final StringId CacheClientProxy_0__AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1159, "{0} : An unexpected Exception occurred");
+ public static final StringId CacheClientProxy_0__EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1160, "{0} : Exception occurred while attempting to add message to queue");
+ public static final StringId CacheClientProxy_0__PAUSING_PROCESSING = new StringId(1161, "{0} : Pausing processing");
+ public static final StringId CacheClientProxy_0__RESUMING_PROCESSING = new StringId(1162, "{0} : Resuming processing");
+ public static final StringId CacheClientProxy_0__THE_EXPIRATION_TASK_HAS_FIRED_SO_THIS_PROXY_IS_BEING_TERMINATED = new StringId(1163, "{0} : The expiration task has fired, so this proxy is being terminated.");
+
+ public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_BROKEN_PIPE_ON_SOCKET = new StringId(1166, "Problem caused by broken pipe on socket.");
+ public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_MESSAGE_QUEUE_BEING_CLOSED = new StringId(1167, "Problem caused by message queue being closed.");
+ public static final StringId CacheClientUpdater_0_CAUGHT_FOLLOWING_EXECPTION_WHILE_ATTEMPTING_TO_CREATE_A_SERVER_TO_CLIENT_COMMUNICATION_SOCKET_AND_WILL_EXIT_1 = new StringId(1168, "{0}: Caught following exception while attempting to create a server-to-client communication socket and will exit: {1}");
+ public static final StringId CacheClientUpdater_0_CONNECTION_WAS_REFUSED = new StringId(1169, "{0} connection was refused");
+ public static final StringId CacheClientUpdater_SSL_NEGOTIATION_FAILED_WITH_ENDPOINT_0 = new StringId(1170, "SSL negotiation failed with endpoint: {0}");
+
+ public static final StringId CacheClientUpdater_0_RECEIVED_AN_UNSUPPORTED_MESSAGE_TYPE_1 = new StringId(1172, "{0}: Received an unsupported message (type={1})");
+ public static final StringId CacheClientUpdater_0__1__2 = new StringId(1173, "{0} : {1} : {2}");
+ public static final StringId CacheClientUpdater_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_DESTROY_ENTRY_REGION_0_KEY_1 = new StringId(1174, "The following exception occurred while attempting to destroy entry (region: {0} key: {1})");
+
+ public static final StringId CacheClientUpdater_FAILED_TO_INVOKE_CQ_DISPATCHER_ERROR___0 = new StringId(1177, "Failed to invoke CQ Dispatcher. Error : {0}");
+
+ public static final StringId CacheFactory_0_AN_OPEN_CACHE_ALREADY_EXISTS = new StringId(1179, "{0}: An open cache already exists.");
+ public static final StringId InternalDistributedSystem_shutdownHook_shuttingdown = new StringId(1180, "VM is exiting - shutting down distributed system");
+ public static final StringId GroupMembershipService_entered_into_membership_in_group_0_with_id_1 = new StringId(1181, "Finished joining (took {0}ms).");
+ public static final StringId CacheServerLauncher_CACHE_SERVER_ERROR = new StringId(1182, "Cache server error");
+ public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_APPENDED_CHARACTER_DATA_0 = new StringId(1183, "XML Parser characters, appended character data: {0}");
+ public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_NEW_CHARACTER_DATA_0 = new StringId(1184, "XML Parser characters, new character data: {0}");
+ public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_CLASS_NAME_0 = new StringId(1185, "XML Parser createDeclarable class name: {0}");
+ public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_PROPERTIES__0 = new StringId(1186, "XML Parser createDeclarable properties: {0}");
+ public static final StringId ClearRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1187, "{0}: The input region name for the clear region request is null");
+ public static final StringId ClearRegion_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1188, " The input region name for the clear region request is null");
+ public static final StringId ClearRegion_WAS_NOT_FOUND_DURING_CLEAR_REGION_REGUEST = new StringId(1189, " was not found during clear region request");
+ public static final StringId ClientHealtMonitor_0_IS_BEING_TERMINATED_BECAUSE_ITS_CLIENT_TIMEOUT_OF_1_HAS_EXPIRED = new StringId(1190, "{0} is being terminated because its client timeout of {1} has expired.");
+ public static final StringId ClientHealthMonitor_0_AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1191, "{0}: An unexpected Exception occurred");
+ public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITORTHREAD_MAXIMUM_ALLOWED_TIME_BETWEEN_PINGS_0 = new StringId(1192, "ClientHealthMonitorThread maximum allowed time between pings: {0}");
+ public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_REGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1193, "ClientHealthMonitor: Registering client with member id {0}");
+ public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_UNREGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1194, "ClientHealthMonitor: Unregistering client with member id {0}");
+ public static final StringId ClientHealthMonitor_CLIENT_HEALTH_MONITOR_THREAD_DISABLED_DUE_TO_MAXIMUMTIMEBETWEENPINGS_SETTING__0 = new StringId(1195, "Client health monitor thread disabled due to maximumTimeBetweenPings setting: {0}");
+ public static final StringId ClientHealthMonitor_MONITORING_CLIENT_WITH_MEMBER_ID_0_IT_HAD_BEEN_1_MS_SINCE_THE_LATEST_HEARTBEAT_MAX_INTERVAL_IS_2_TERMINATED_CLIENT = new StringId(1196, "Monitoring client with member id {0}. It had been {1} ms since the latest heartbeat. Max interval is {2}. Terminated client.");
+ public static final StringId ClientHealthMonitor_UNEXPECTED_INTERRUPT_EXITING = new StringId(1197, "Unexpected interrupt, exiting");
+ public static final StringId ClientProxyMembershipID_UNABLE_TO_DESERIALIZE_MEMBERSHIP_ID = new StringId(1198, "Unable to deserialize membership id");
+ public static final StringId DiskStore_IS_USED_IN_NONPERSISTENT_REGION = new StringId(1199, "Only regions with persistence or overflow to disk can specify DiskStore");
+ public static final StringId DiskRegion_COMPLEXDISKREGIONGETNEXTDIR_MAX_DIRECTORY_SIZE_WILL_GET_VIOLATED__GOING_AHEAD_WITH_THE_SWITCHING_OF_OPLOG_ANY_WAYS_CURRENTLY_AVAILABLE_SPACE_IN_THE_DIRECTORY_IS__0__THE_CAPACITY_OF_DIRECTORY_IS___1 = new StringId(1200, "Even though the configured directory size limit has been exceeded a new oplog will be created because compaction is enabled. The configured limit is {1}. The current space used in the directory by this disk store is {0}.");
+
+ public static final StringId AttributesFactory_CLONENOTSUPPORTEDEXCEPTION_THROWN_IN_CLASS_THAT_IMPLEMENTS_CLONEABLE = new StringId(1213, "CloneNotSupportedException thrown in class that implements cloneable.");
+
+ public static final StringId CqQueryImpl_CQ_IS_CLOSED_CQNAME_0 = new StringId(1215, "CQ is closed, CqName : {0}");
+
+ public static final StringId Connection_DISCONNECTED_AS_A_SLOWRECEIVER = new StringId(1226, "Disconnected as a slow-receiver");
+
+ public static final StringId ConnectionTable_FAILED_TO_ACCEPT_CONNECTION_FROM_0_BECAUSE_1 = new StringId(1240, "Failed to accept connection from {0} because: {1}");
+
+ public static final StringId Connection_0_ASYNC_CONFIGURATION_RECEIVED_1 = new StringId(1243, "{0} async configuration received {1}.");
+ public static final StringId Connection_0_ERROR_READING_MESSAGE = new StringId(1244, "{0} Error reading message");
+ public static final StringId Connection_0_EXCEPTION_IN_CHANNEL_READ = new StringId(1245, "{0} exception in channel read");
+ public static final StringId Connection_0_EXCEPTION_RECEIVED = new StringId(1246, "{0} exception received");
+ public static final StringId Connection_0_STRAY_INTERRUPT_READING_MESSAGE = new StringId(1247, "{0} Stray interrupt reading message");
+ public static final StringId Connection_0_SUCCESSFULLY_REESTABLISHED_CONNECTION_TO_PEER_1 = new StringId(1248, "{0}: Successfully reestablished connection to peer {1}");
+ public static final StringId Connection_ACK_READ_EXCEPTION = new StringId(1249, "ack read exception");
+ public static final StringId Connection_ACK_READ_EXCEPTION_0 = new StringId(1250, "ack read exception: {0}");
+
+ public static final StringId Connection_ALLOCATING_LARGER_NETWORK_READ_BUFFER_NEW_SIZE_IS_0_OLD_SIZE_WAS_1 = new StringId(1254, "Allocating larger network read buffer, new size is {0} old size was {1}.");
+ public static final StringId Connection_BLOCKED_FOR_0_MS_WHICH_IS_LONGER_THAN_THE_MAX_OF_1_MS_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1255, "Blocked for {0}ms which is longer than the max of {1}ms, asking slow receiver {2} to disconnect.");
+ public static final StringId Connection_CLASSNOTFOUND_DESERIALIZING_MESSAGE_0 = new StringId(1256, "ClassNotFound deserializing message: {0}");
+ public static final StringId Connection_CONNECTION_ATTEMPTING_RECONNECT_TO_PEER__0 = new StringId(1257, "Connection: Attempting reconnect to peer {0}");
+ public static final StringId Connection_CONNECTION_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1258, "Connection: shared={0} ordered={1} failed to connect to peer {2} because: {3}");
+ public static final StringId Connection_CONNECTION_HANDSHAKE_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1259, "Connection: shared={0} ordered={1} handshake failed to connect to peer {2} because: {3}");
+ public static final StringId Connection_DETECTED_OLD_VERSION_PRE_5_0_1_OF_GEMFIRE_OR_NONGEMFIRE_DURING_HANDSHAKE_DUE_TO_INITIAL_BYTE_BEING_0 = new StringId(1260, "Detected old version (pre 5.0.1) of GemFire or non-GemFire during handshake due to initial byte being {0}");
+ public static final StringId Connection_END_OF_FILE_ON_ACK_STREAM = new StringId(1261, "end of file on ack stream");
+ public static final StringId Connection_ERROR_DESERIALIZING_MESSAGE = new StringId(1262, "Error deserializing message");
+ public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_MESSAGE = new StringId(1263, "Error deserializing P2P handshake message");
+ public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1264, "Error deserializing P2P handshake reply");
+ public static final StringId Connection_ERROR_DISPATCHING_MESSAGE = new StringId(1265, "Error dispatching message");
+ public static final StringId Connection_EXCEPTION_FLUSHING_BATCH_SEND_BUFFER_0 = new StringId(1266, "Exception flushing batch send buffer: {0}");
+ public static final StringId Connection_FAILED_HANDLING_CHUNK_MESSAGE = new StringId(1267, "Failed handling chunk message");
+ public static final StringId Connection_FAILED_HANDLING_END_CHUNK_MESSAGE = new StringId(1268, "Failed handling end chunk message");
+ public static final StringId Connection_FAILED_SETTING_CHANNEL_TO_BLOCKING_MODE_0 = new StringId(1269, "Failed setting channel to blocking mode {0}");
+ public static final StringId Connection_FINISHED_WAITING_FOR_REPLY_FROM_0 = new StringId(1270, "Finished waiting for reply from {0}");
+ public static final StringId Connection_IOEXCEPTION_DESERIALIZING_MESSAGE = new StringId(1271, "IOException deserializing message");
+ public static final StringId Connection_OWNER_SHOULD_NOT_BE_NULL = new StringId(1272, "\"owner\" should not be null");
+ public static final StringId Connection_P2P_PUSHER_EXCEPTION_0 = new StringId(1273, "P2P pusher exception: {0}");
+ public static final StringId Connection_QUEUED_BYTES_0_EXCEEDS_MAX_OF_1_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1274, "Queued bytes {0} exceeds max of {1}, asking slow receiver {2} to disconnect.");
+ public static final StringId Connection_SOCKET_0_IS_1_INSTEAD_OF_THE_REQUESTED_2 = new StringId(1275, "Socket {0} is {1} instead of the requested {2}.");
+ public static final StringId Connection_THROWABLE_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1276, "Throwable deserializing P2P handshake reply");
+ public static final StringId Connection_THROWABLE_DISPATCHING_MESSAGE = new StringId(1277, "Throwable dispatching message");
+ public static final StringId Connection_TIMED_OUT_WAITING_FOR_READERTHREAD_ON_0_TO_FINISH = new StringId(1278, "Timed out waiting for readerThread on {0} to finish.");
+ public static final StringId Connection_UNABLE_TO_GET_INPUT_STREAM = new StringId(1279, "Unable to get input stream");
+ public static final StringId Connection_UNABLE_TO_GET_P2P_CONNECTION_STREAMS = new StringId(1280, "Unable to get P2P connection streams");
+ public static final StringId Connection_UNEXPECTED_FAILURE_DESERIALIZING_MESSAGE = new StringId(1281, "Unexpected failure deserializing message");
+ public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0 = new StringId(1282, "Unknown handshake reply code: {0}");
+ public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0_NIOMESSAGELENGTH_1_PROCESSORTYPE_2 = new StringId(1283, "Unknown handshake reply code: {0} nioMessageLength={1} processorType={2}");
+ public static final StringId Connection_UNKNOWN_P2P_MESSAGE_TYPE_0 = new StringId(1284, "Unknown P2P message type: {0}");
+ public static final StringId Connection_UNKNOWN_PROCESSOR_TYPE_0 = new StringId(1285, "Unknown processor type: {0}");
+ public static final StringId ContainsKeyValueMess_PARTITIONED_REGION_0_IS_NOT_CONFIGURED_TO_STORE_DATA = new StringId(1286, "Partitioned Region {0} is not configured to store data");
+ // ok to reuse 1287
+ public static final StringId ContainsKey_0_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1288, "{0}: The input key for the containsKey request is null");
+ public static final StringId ContainsKey_0_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1289, "{0}: The input region name for the containsKey request is null");
+ public static final StringId ContainsKey_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1290, " The input key for the containsKey request is null");
+ public static final StringId ContainsKey_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1291, " The input region name for the containsKey request is null");
+ public static final StringId ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST = new StringId(1292, " was not found during containsKey request");
+ public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_CREATING_USERTRANSACTION_OBJECT = new StringId(1293, "ContextImpl::lookup::Error while creating UserTransaction object");
+ public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_LOOKING_UP_0 = new StringId(1294, "ContextImpl::lookup::Error while looking up {0}");
+ public static final StringId CqAttributesFactory_EXCEPTION_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1295, "Exception closing CQ Listener Error: {0}");
+ public static final StringId CqAttributesFactory_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1296, "Exception occurred while closing CQ Listener Error: {0}");
+ public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1297, "Runtime Exception occurred closing CQ Listener Error: {0}");
+ public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1298, "Runtime Exception occurred while closing CQ Listener Error: {0}");
+ public static final StringId CqQueryImpl_FAILED_TO_STORE_CONTINUOUS_QUERY_IN_THE_REPOSITORY_CQNAME_0_1 = new StringId(1299, "Failed to store Continuous Query in the repository. CqName: {0} {1}");
+
+ public static final StringId PRHARRedundancyProvider_0_IN_THE_PARTITIONED_REGION_REGION_NAME_1 = new StringId(1301, "{0} Region name = {1}");
+ public static final StringId CqQueryImpl_CLASS_NOT_FOUND_EXCEPTION_THE_ANTLRJAR_OR_THE_SPCIFIED_CLASS_MAY_BE_MISSING_FROM_SERVER_SIDE_CLASSPATH_ERROR_0 = new StringId(1302, "Class not found exception. The antlr.jar or the spcified class may be missing from server side classpath. Error : {0}");
+ public static final StringId CqQueryImpl_CQ_IS_NOT_IN_RUNNING_STATE_STOP_CQ_DOES_NOT_APPLY_CQNAME_0 = new StringId(1303, "CQ is not in running state, stop CQ does not apply, CqName : {0}");
+ public static final StringId CqQueryImpl_CQ_QUERIES_CANNOT_HAVE_MORE_THAN_ONE_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1304, "CQ queries cannot have more than one iterator in the FROM clause");
+ public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_ORDER_BY = new StringId(1305, "CQ queries do not support ORDER BY");
+ public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_PROJECTIONS = new StringId(1306, "CQ queries do not support projections");
+ public static final StringId CqQueryImpl_CQ_QUERIES_MUST_BE_A_SELECT_STATEMENT_ONLY = new StringId(1307, "CQ queries must be a select statement only");
+ public static final StringId CqQueryImpl_CQ_QUERIES_MUST_HAVE_A_REGION_PATH_ONLY_AS_THE_FIRST_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1308, "CQ queries must have a region path only as the first iterator in the FROM clause");
+ public static final StringId CqQueryImpl_CQ_QUERIES_MUST_REFERENCE_ONE_AND_ONLY_ONE_REGION = new StringId(1309, "CQ queries must reference one and only one region");
+ public static final StringId CqQueryImpl_ERROR_WHILE_PARSING_THE_QUERY_ERROR_0 = new StringId(1310, "Error while parsing the query. Error : {0}");
+ public static final StringId PRHARRedundancyProvider_UNABLE_TO_FIND_ANY_MEMBERS_TO_HOST_A_BUCKET_IN_THE_PARTITIONED_REGION_0 = new StringId(1311, "Unable to find any members to host a bucket in the partitioned region. {0}.{1}");
+ public static final StringId CqQueryImpl_EXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1312, "Exception occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
+
+ public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_ERROR_FROM_LAST_ENDPOINT_1 = new StringId(1314, "Failed to close the cq. CqName: {0}. Error from last endpoint: {1}");
+
+ public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_ERROR_FROM_LAST_SERVER_1 = new StringId(1316, "Failed to stop the cq. CqName :{0} Error from last server: {1}");
+
+ public static final StringId CqQueryImpl_REGION_ON_WHICH_QUERY_IS_SPECIFIED_NOT_FOUND_LOCALLY_REGIONNAME_0 = new StringId(1318, "Region on which query is specified not found locally, regionName: {0}");
+ public static final StringId CqQueryImpl_REGION__0_SPECIFIED_WITH_CQ_NOT_FOUND_CQNAME_1 = new StringId(1319, "Region : {0} specified with cq not found. CqName: {1}");
+ public static final StringId CqQueryImpl_RUNTIMEEXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1320, "RuntimeException occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
+ public static final StringId CqQueryImpl_SELECT_DISTINCT_QUERIES_NOT_SUPPORTED_IN_CQ = new StringId(1321, "select DISTINCT queries not supported in CQ");
+
+ public static final StringId CqQueryImpl_THE_WHERE_CLAUSE_IN_CQ_QUERIES_CANNOT_REFER_TO_A_REGION = new StringId(1323, "The WHERE clause in CQ queries cannot refer to a region");
+ public static final StringId CqQueryImpl_UNABLE_TO_CREATE_CQ_0_ERROR__1 = new StringId(1324, "Unable to create cq {0} Error : {1}");
+
+ public static final StringId CqQueryImpl_CQ_IS_IN_RUNNING_STATE_CQNAME_0 = new StringId(1327, "CQ is in running state, CqName : {0}");
+
+ public static final StringId CqService_CLIENT_SIDE_NEWCQ_METHOD_INVOCATION_ON_SERVER = new StringId(1329, "client side newCq() method invocation on server.");
+ public static final StringId CqService_CQ_NOT_FOUND_FAILED_TO_CLOSE_THE_SPECIFIED_CQ_0 = new StringId(1330, "CQ Not found, Failed to close the specified CQ {0}");
+
+ public static final StringId CqService_CQ_NOT_FOUND_IN_THE_CQ_META_REGION_CQNAME_0 = new StringId(1332, "CQ not found in the cq meta region, CqName: {0}");
+ public static final StringId CqService_CQ_WITH_THE_GIVEN_NAME_ALREADY_EXISTS_CQNAME_0 = new StringId(1333, "CQ with the given name already exists. CqName : {0}");
+
+ public static final StringId RemoteGfManagerAgent_LISTENER_THREW_AN_EXCEPTION = new StringId(1335, "Listener threw an exception.");
+ public static final StringId PRHARRedundancyProvider_FOUND_A_MEMBER_TO_HOST_A_BUCKET = new StringId(1336, "Found a member to host a bucket.");
+ public static final StringId CqService_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1337, "Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
+ public static final StringId CqService_EXCEPTION_WHILE_REGISTERING_CQ_ON_SERVER_CQNAME___0 = new StringId(1338, "Exception while registering CQ on server. CqName : {0}");
+ public static final StringId CqService_FAILED_TO_CLOSE_CQ__0___1 = new StringId(1339, "Failed to close CQ {0} {1}");
+
+ public static final StringId CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED = new StringId(1345, "Invalid CQ Monitor request received.");
+
+ public static final StringId CqService_NULL_ARGUMENT_0 = new StringId(1348, "Null argument \"{0}\"");
+ public static final StringId CqService_RUNTIME_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1349, "Runtime Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
+ public static final StringId CqService_SERVER_SIDE_EXECUTECQ_METHOD_IS_CALLED_ON_CLIENT_CQNAME_0 = new StringId(1350, "Server side executeCq method is called on client. CqName : {0}");
+
+ public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_THE_SERVER_ENDPOINTS_ON_WHICH_THIS_CQ_WAS_REGISTERED_WERE_NOT_FOUND = new StringId(1354, "Failed to close the cq. CqName: {0}. The server endpoints on which this cq was registered were not found.");
+
+ public static final StringId CreateRegionProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1356, "More than one exception thrown in {0}");
+ public static final StringId CreateRegion_0_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1357, "{0}: The input parent region name for the create region request is null");
+ public static final StringId CreateRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1358, "{0}: The input region name for the create region request is null");
+ public static final StringId CreateRegion_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1359, " The input parent region name for the create region request is null");
+ public static final StringId CreateRegion_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1360, " The input region name for the create region request is null");
+ public static final StringId DLockGrantor_DEBUGHANDLESUSPENDTIMEOUTS_SLEEPING_FOR__0 = new StringId(1361, "debugHandleSuspendTimeouts sleeping for {0}");
+
+ public static final StringId DLockGrantor_DLOCKGRANTORTHREAD_WAS_UNEXPECTEDLY_INTERRUPTED = new StringId(1363, "DLockGrantorThread was unexpectedly interrupted");
+
+ public static final StringId DLockGrantor_PROCESSING_OF_POSTREMOTERELEASELOCK_THREW_UNEXPECTED_RUNTIMEEXCEPTION = new StringId(1367, "Processing of postRemoteReleaseLock threw unexpected RuntimeException");
+
+ public static final StringId DLockGrantor_RELEASED_REGULAR_LOCK_WITH_WAITING_READ_LOCK_0 = new StringId(1369, "Released regular lock with waiting read lock: {0}");
+
+ public static final StringId DLockRequestProcessor_DLOCKREQUESTMESSAGEPROCESS_CAUGHT_THROWABLE = new StringId(1373, "[DLockRequestMessage.process] Caught throwable:");
+ public static final StringId DLockRequestProcessor_FAILED_TO_FIND_PROCESSOR_FOR__0 = new StringId(1374, "Failed to find processor for {0}");
+ public static final StringId DLockRequestProcessor_HANDLED_LOCAL_ORPHANED_GRANT = new StringId(1375, "Handled local orphaned grant.");
+ public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITHOUT_RELEASE = new StringId(1376, "Handled orphaned grant without release.");
+ public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITH_RELEASE = new StringId(1377, "Handled orphaned grant with release.");
+ public static final StringId DLockRequestProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1378, "More than one exception thrown in {0}");
+ public static final StringId DLockRequestProcessor_NO_PROCESSOR_FOUND_FOR_DLOCKRESPONSEMESSAGE__0 = new StringId(1379, "No processor found for DLockResponseMessage: {0}");
+ public static final StringId DLockRequestProcessor_RELEASING_LOCAL_ORPHANED_GRANT_FOR_0 = new StringId(1380, "Releasing local orphaned grant for {0}.");
+ public static final StringId DLockRequestProcessor_RELEASING_ORPHANED_GRANT_FOR__0 = new StringId(1381, "Releasing orphaned grant for {0}");
+ public static final StringId DLockRequestProcessor_WAITING_TO_PROCESS_DLOCKRESPONSEMESSAGE = new StringId(1382, "Waiting to process DLockResponseMessage");
+ public static final StringId DLockService_DEBUG_GRANTOR_REPORTS_NOT_HOLDER_FOR_0 = new StringId(1383, "DEBUG: Grantor reports NOT_HOLDER for {0}");
+ public static final StringId DLockService_DEBUG_LOCKINTERRUPTIBLY_HAS_GONE_HOT_AND_LOOPED_0_TIMES = new StringId(1384, "DEBUG: lockInterruptibly has gone hot and looped [0] times");
+
+ public static final StringId DLockService_FAILED_TO_NOTIFY_GRANTOR_OF_DESTRUCTION_WITHIN_0_ATTEMPTS = new StringId(1386, "Failed to notify grantor of destruction within {0} attempts.");
+ public static final StringId DLockService_GRANTOR_CREATION_WAS_ABORTED_BUT_GRANTOR_WAS_NOT_DESTROYED = new StringId(1387, "Grantor creation was aborted but grantor was not destroyed");
+ public static final StringId DLockService_GRANTOR_IS_STILL_INITIALIZING = new StringId(1388, "Grantor is still initializing");
+ public static final StringId DLockService_GRANTOR_REPORTS_REENTRANT_LOCK_NOT_HELD_0 = new StringId(1389, "Grantor reports reentrant lock not held: {0}");
+ public static final StringId DLockService_LOCK_WAS_INTERRUPTED = new StringId(1390, "lock() was interrupted");
+
+ public static final StringId DLockToken_ATTEMPTING_TO_USE_DESTROYED_TOKEN_0 = new StringId(1392, "Attempting to use destroyed token: {0}");
+ public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR = new StringId(1393, "Class {0} does not have a zero-argument constructor.");
+ public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR_IT_IS_AN_INNER_CLASS_OF_1_SHOULD_IT_BE_A_STATIC_INNER_CLASS = new StringId(1394, "Class {0} does not have a zero-argument constructor. It is an inner class of {1}. Should it be a static inner class?");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCEMANAGED_CONNECTION_FACTORY_CLASS_IS_NOT_AVAILABLE = new StringId(1395, "DataSourceFactory::getManagedDataSource:Managed Connection factory class is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCE_EXCEPTION_IN_CREATING_MANAGED_CONNECTION_FACTORY_EXCEPTION_STRING_0 = new StringId(1396, "DataSourceFactory::getManagedDataSource: Exception in creating managed connection factory. Exception string = {0}");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETPOOLEDDATASOURCECONNECTIONPOOLDATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1397, "DataSourceFactory::getPooledDataSource:ConnectionPoolDataSource class name for the ResourceManager is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEJDBC_DRIVER_IS_NOT_AVAILABLE = new StringId(1398, "DataSourceFactory::getSimpleDataSource:JDBC Driver is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEURL_STRING_TO_DATABASE_IS_NULL = new StringId(1399, "DataSourceFactory::getSimpleDataSource:URL String to Database is null");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORYGETTRANXDATASOURCEXADATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1400, "DataSourceFactory::getTranxDataSource:XADataSource class name for the ResourceManager is not available");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETPOOLEDDATASOURCE_EXCEPTION_CREATING_CONNECTIONPOOLDATASOURCE_EXCEPTION_STRING_0 = new StringId(1401, "DataSourceFactory::getPooledDataSource:Exception creating ConnectionPoolDataSource.Exception string={0}");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETSIMPLEDATASOURCE_EXCEPTION_WHILE_CREATING_GEMFIREBASICDATASOURCE_EXCEPTION_STRING_0 = new StringId(1402, "DataSourceFactory::getSimpleDataSource:Exception while creating GemfireBasicDataSource.Exception String={0}");
+ public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETTRANXDATASOURCE_EXCEPTION_IN_CREATING_GEMFIRETRANSACTIONDATASOURCE__EXCEPTION_STRING_0 = new StringId(1403, "DataSourceFactory::getTranxDataSource:Exception in creating GemFireTransactionDataSource. Exception string={0}");
+
+ public static final StringId DebuggerSupport_DEBUGGER_CONTINUING = new StringId(1405, "DEBUGGER: Continuing");
+ public static final StringId DebuggerSupport_WAITING_FOR_DEBUGGER_TO_ATTACH_0 = new StringId(1406, "DEBUGGER: Waiting for Java debugger to attach... {0}");
+
+ public static final StringId DefaultQueryService_EXCEPTION_REMOVING_INDEX___0 = new StringId(1408, "Exception removing index : {0}");
+ public static final StringId DefaultQueryService_EXCEPTION_WHILE_CREATING_INDEX_ON_PR_DEFAULT_QUERY_PROCESSOR = new StringId(1409, "Exception while creating index on pr default query processor.");
+
+ public static final StringId Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3 = new StringId(1412, "{0}: Unknown message type ({1}) with tx: {2} from {3}");
+ public static final StringId DestroEntryMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_ENTRY_0_1_FROM_CONSOLE_AT_2 = new StringId(1413, "Failed attempt to destroy or invalidate entry {0} {1} from console at {2}");
+ public static final StringId DestroRegionMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_REGION_0_FROM_CONSOLE_AT_1 = new StringId(1414, "Failed attempt to destroy or invalidate region {0} from console at {1}");
+ public static final StringId DestroyRegionOperation_CACHEWRITER_SHOULD_NOT_HAVE_BEEN_CALLED = new StringId(1415, "CacheWriter should not have been called");
+ public static final StringId DestroyRegionOperation_DISTRIBUTEDLOCK_SHOULD_NOT_HAVE_BEEN_ACQUIRED = new StringId(1416, "DistributedLock should not have been acquired");
+ public static final StringId DestroyRegionOperation_EXCEPTION_WHILE_PROCESSING__0_ = new StringId(1417, "Exception while processing [ {0} ]");
+ public static final StringId DestroyRegionOperation_GOT_TIMEOUT_WHEN_TRYING_TO_RECREATE_REGION_DURING_REINITIALIZATION_1 = new StringId(1418, "Got timeout when trying to recreate region during re-initialization: {1}");
+ public static final StringId DestroyRegionOperation_REGION_DESTRUCTION_MESSAGE_IMPLEMENTATION_IS_IN_BASICPROCESS__NOT_THIS_METHOD = new StringId(1419, "Region Destruction message implementation is in basicProcess, not this method");
+ public static final StringId DestroyRegion_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL = new StringId(1420, "{0}: The input region name for the destroy region request is null");
+ public static final StringId Destroy_0_DURING_ENTRY_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1 = new StringId(1421, "{0}: during entry destroy no entry was found for key {1}");
+ public static final StringId Destroy_0_THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1422, "{0}: The input key for the destroy request is null");
+ public static final StringId Destroy_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1423, "{0}: The input region name for the destroy request is null");
+ public static final StringId Destroy_0_UNEXPECTED_EXCEPTION = new StringId(1424, "{0}: Unexpected Exception");
+ public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_JROCKIT_NIO_BUG = new StringId(1425, "Ignoring max-threads setting and using zero instead due to JRockit NIO bugs. See GemFire bug #40198");
+ public static final StringId AbstractDistributionConfig_BIND_ADDRESS_0_INVALID_MUST_BE_IN_1 = new StringId(1426, "The bind-address \"{0}\" is not a valid address for this machine. These are the valid addresses for this machine: {1}");
+ public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_WINDOWS_IPV6_BUG = new StringId(1427, "Ignoring max-threads setting and using zero instead due to Java bug 6230761: NIO does not work with IPv6 on Windows. See GemFire bug #40472");
+
+ public static final StringId DirectChannel_0_SECONDS_HAVE_ELAPSED_WHILE_WAITING_FOR_REPLY_FROM_1_ON_2_WHOSE_CURRENT_MEMBERSHIP_LIST_IS_3 = new StringId(1430, "{0} seconds have elapsed while waiting for reply from {1} on {2} whose current membership list is: [{3}]");
+
+ public static final StringId DirectChannel_GEMFIRE_P2P_LISTENER_STARTED_ON__0 = new StringId(1432, "GemFire P2P Listener started on {0}");
+
+ public static final StringId DirectChannel_UNABLE_TO_INITIALIZE_DIRECT_CHANNEL_BECAUSE__0 = new StringId(1434, "Unable to initialize direct channel because: {0}");
+ public static final StringId DirectChannel_UNEXPECTED_TIMEOUT_WHILE_WAITING_FOR_ACK_FROM__0 = new StringId(1435, "Unexpected timeout while waiting for ack from {0}");
+ public static final StringId DirectChannel_VIEW_NO_LONGER_HAS_0_AS_AN_ACTIVE_MEMBER_SO_WE_WILL_NO_LONGER_WAIT_FOR_IT = new StringId(1436, "View no longer has {0} as an active member, so we will no longer wait for it.");
+ public static final StringId DirectChannel_WHILE_PULLING_A_MESSAGE = new StringId(1437, "While pulling a message");
+ public static final StringId TXState_CANNOT_COMMIT_REMOTED_TRANSACTION = new StringId(1438, "Cannot commit a transaction being run on behalf of a remote thread");
+
+ public static final StringId DistributedCacheOperation_EXCEPTION_OCCURRED_WHILE_PROCESSING__0 = new StringId(1441, "Exception occurred while processing {0}");
+
+ public static final StringId DistributedCacheOperation_WAITFORACKIFNEEDED_EXCEPTION = new StringId(1443, "waitForAckIfNeeded: exception");
+ public static final StringId DistributedRegion_ATTEMPT_TO_ACQUIRE_DISTRIBUTED_LOCK_FOR_0_FAILED_AFTER_WAITING_1_SECONDS = new StringId(1444, "Attempt to acquire distributed lock for {0} failed after waiting {1} seconds.");
+ public static final StringId DistributedRegion_DLS_DESTROY_MAY_HAVE_FAILED_FOR_0 = new StringId(1445, "DLS destroy may have failed for {0}");
+ public static final StringId DistributedRegion_EXCEPTION_OCCURRED_IN_REGIONMEMBERSHIPLISTENER = new StringId(1446, "Exception occurred in RegionMembershipListener");
+ public static final StringId DistributedRegion_NO_REPLICATED_REGION_FOUND_FOR_EXECUTING_FUNCTION_0 = new StringId(1447, "No Replicated Region found for executing function : {0}.");
+ public static final StringId DistributedRegion_TIMED_OUT_AFTER_WAITING_0_SECONDS_FOR_THE_DISTRIBUTED_LOCK_FOR_1 = new StringId(1448, "Timed out after waiting {0} seconds for the distributed lock for {1}.");
+ public static final StringId DistributedRegion_UNEXPECTED_EXCEPTION = new StringId(1449, "Unexpected exception:");
+
+ public static final StringId DistributionAdvisor_UNEXPECTED_EXCEPTION = new StringId(1456, "Unexpected exception:");
+ public static final StringId DistributionChannel_ATTEMPTING_A_SEND_TO_A_DISCONNECTED_DISTRIBUTIONMANAGER = new StringId(1457, "Attempting a send to a disconnected DistributionManager");
+ public static final StringId DistributionLocatorImpl_DONE_WAITING_FOR_LOCATOR = new StringId(1458, "Done waiting for locator");
+ public static final StringId DistributionLocator_COULD_NOT_BIND_LOCATOR_TO__0__1 = new StringId(1459, "Could not bind locator to {0}[{1}]");
+ public static final StringId DistributionLocator_COULD_NOT_START_LOCATOR = new StringId(1460, "Could not start locator");
+ public static final StringId DistributionLocator_LOCATOR_STOPPED = new StringId(1461, "Locator stopped");
+ public static final StringId DistributionManager_0_IS_THE_ELDER_AND_THE_ONLY_MEMBER = new StringId(1462, "{0} is the elder and the only member.");
+
+ public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CLOSED_1 = new StringId(1464, "Administration member at {0} closed: {1}");
+ public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CRASHED_1 = new StringId(1465, "Administration member at {0} crashed: {1}");
+ public static final StringId DistributionManager_ADMITTING_MEMBER_0_NOW_THERE_ARE_1_NONADMIN_MEMBERS = new StringId(1466, "Admitting member <{0}>. Now there are {1} non-admin member(s).");
+ public static final StringId DistributionManager_AT_LEAST_ONE_EXCEPTION_OCCURRED = new StringId(1467, "At least one Exception occurred.");
+ public static final StringId DistributionManager_CHANGING_ELDER_FROM_0_TO_1 = new StringId(1468, "Changing Elder from {0} to {1}.");
+ public static final StringId DistributionManager_CLOBBERTHREAD_THREAD_REFUSED_TO_DIE__0 = new StringId(1469, "clobberThread: Thread refused to die: {0}");
+ public static final StringId DistributionManager_DAEMON_THREADS_ARE_SLOW_TO_STOP_CULPRITS_INCLUDE_0 = new StringId(1470, "Daemon threads are slow to stop; culprits include: {0}");
+ public static final StringId DistributionManager_DIDNT_HEAR_BACK_FROM_ANY_OTHER_SYSTEM_I_AM_THE_FIRST_ONE = new StringId(1471, "Did not hear back from any other system. I am the first one.");
+ public static final StringId DistributionManager_DISTRIBUTIONMANAGER_0_STARTED_ON_1_THERE_WERE_2_OTHER_DMS_3_4_5 = new StringId(1472, "DistributionManager {0} started on {1}. There were {2} other DMs. others: {3} {4} {5}");
+ public static final StringId DistributionManager_DISTRIBUTIONMANAGER_STOPPED_IN_0_MS = new StringId(1473, "DistributionManager stopped in {0}ms.");
+ public static final StringId DistributionManager_DMMEMBERSHIP_ADMITTING_NEW_ADMINISTRATION_MEMBER__0_ = new StringId(1474, "DMMembership: Admitting new administration member < {0} >.");
+
+ public static final StringId DistributionManager_ELDER__0__IS_NOT_CURRENTLY_AN_ACTIVE_MEMBER_SELECTING_NEW_ELDER = new StringId(1476, "Elder < {0} > is not currently an active member; selecting new elder.");
+ public static final StringId DistributionManager_EXCEPTION_WHILE_CALLING_MEMBERSHIP_LISTENER_FOR_EVENT__0 = new StringId(1477, "Exception while calling membership listener for event: {0}");
+ public static final StringId DistributionManager_FAILED_SENDING_SHUTDOWN_MESSAGE_TO_PEERS_TIMEOUT = new StringId(1478, "Failed sending shutdown message to peers (timeout)");
+ public static final StringId DistributionManager_FORCING_AN_ELDER_JOIN_EVENT_SINCE_A_STARTUP_RESPONSE_WAS_NOT_RECEIVED_FROM_ELDER__0_ = new StringId(1479, "Forcing an elder join event since a startup response was not received from elder {0} .");
+ public static final StringId DistributionManager_FORCING_THREAD_STOP_ON__0_ = new StringId(1480, "Forcing thread stop on < {0} >");
+
+ public static final StringId DistributionManager_INITIAL_MEMBERSHIPMANAGER_VIEW___0 = new StringId(1482, "Initial (distribution manager) view = {0}");
+ public static final StringId DistributionManager_MARKING_DISTRIBUTIONMANAGER_0_AS_CLOSED = new StringId(1483, "Marking DistributionManager {0} as closed.");
+ public static final StringId DistributionManager_MARKING_THE_SERIALQUEUEDEXECUTOR_WITH_ID__0__USED_BY_THE_MEMBER__1__TO_BE_UNUSED = new StringId(1484, "Marking the SerialQueuedExecutor with id : {0} used by the member {1} to be unused.");
+ public static final StringId DistributionManager_MEMBER_AT_0_GRACEFULLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1485, "Member at {0} gracefully left the distributed cache: {1}");
+ public static final StringId DistributionManager_MEMBER_AT_0_UNEXPECTEDLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1486, "Member at {0} unexpectedly left the distributed cache: {1}");
+ public static final StringId DistributionManager_NEWLY_SELECTED_ELDER_IS_NOW__0_ = new StringId(1487, "Newly selected elder is now < {0} >");
+ public static final StringId DistributionManager_NEW_ADMINISTRATION_MEMBER_DETECTED_AT_0 = new StringId(1488, "New administration member detected at {0}.");
+ public static final StringId DistributionManager_NOW_CLOSING_DISTRIBUTION_FOR__0 = new StringId(1489, "Now closing distribution for {0}");
+ public static final StringId DistributionManager_SHUTTING_DOWN_DISTRIBUTIONMANAGER_0_1 = new StringId(1490, "Shutting down DistributionManager {0}. {1}");
+ public static final StringId DistributionManager_STARTING_DISTRIBUTIONMANAGER_0_1 = new StringId(1491, "Starting DistributionManager {0}. {1}");
+ public static final StringId DistributionManager_STILL_AWAITING_0_RESPONSES_FROM_1 = new StringId(1492, "Still awaiting {0} response(s) from: {1}.");
+ public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_PEER_DEPARTED_THE_VIEW = new StringId(1493, "Stopped waiting for startup reply from <{0}> because the peer departed the view.");
+ public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_REPLY_WAS_FINALLY_RECEIVED = new StringId(1494, "Stopped waiting for startup reply from <{0}> because the reply was finally received.");
+ public static final StringId DistributionManager_TASK_FAILED_WITH_EXCEPTION = new StringId(1495, "Task failed with exception");
+ public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_CALLING_READYFORMESSAGES = new StringId(1496, "Uncaught exception calling readyForMessages");
+ public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_PROCESSING_MEMBER_EVENT = new StringId(1497, "Uncaught exception processing member event");
+ public static final StringId DistributionManager_UNEXPECTED_INTERRUPTEDEXCEPTION = new StringId(1498, "Unexpected InterruptedException");
+
+ public static final StringId DistributionManager_WHILE_PUSHING_MESSAGE_0_TO_1 = new StringId(1500, "While pushing message <{0}> to {1}");
+ public static final StringId DistributionManager_WHILE_SENDING_SHUTDOWN_MESSAGE = new StringId(1501, "While sending shutdown message");
+ public static final StringId DistributionMessage_0__SCHEDULE_REJECTED = new StringId(1502, "{0} schedule() rejected");
+ public static final StringId DistributionMessage_UNCAUGHT_EXCEPTION_PROCESSING__0 = new StringId(1503, "Uncaught exception processing {0}");
+
+
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONCREATED = new StringId(1508, "DynamicRegionListener {0} threw exception on afterRegionCreated");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONDESTROYED = new StringId(1509, "DynamicRegionListener {0} threw exception on afterRegionDestroyed");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONCREATED = new StringId(1510, "DynamicRegionListener {0} threw exception on beforeRegionCreated");
+ public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONDESTROYED = new StringId(1511, "DynamicRegionListener {0} threw exception on beforeRegionDestroyed");
+ public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_CREATE_DYNAMIC_REGION__0 = new StringId(1512, "Error attempting to locally create Dynamic Region: {0}");
+ public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_DESTROY_DYNAMIC_REGION__0 = new StringId(1513, "Error attempting to locally destroy Dynamic Region: {0}");
+ public static final StringId DynamicRegionFactory_ERROR_DESTROYING_DYNAMIC_REGION__0 = new StringId(1514, "Error destroying Dynamic Region ''{0}''");
+ public static final StringId DynamicRegionFactory_ERROR_INITIALIZING_DYNAMICREGIONFACTORY = new StringId(1515, "Error initializing DynamicRegionFactory");
+ public static final StringId DynamicRegionFactory_ERROR__COULD_NOT_FIND_A_REGION_NAMED___0_ = new StringId(1516, "Error -- Could not find a region named: ''{0}''");
+ public static final StringId ElderState_ELDERSTATE_PROBLEM_DM_0_BUT_SYSTEM_DISTRIBUTIONMANAGER_1 = new StringId(1517, "ElderState problem: dm={0}, but system DistributionManager={1}");
+ public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_0 = new StringId(1518, "ElderState problem: system={0}");
+ public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_DISTRIBUTIONMANAGER_0 = new StringId(1519, "ElderState problem: system DistributionManager={0}");
+
+ public static final StringId EntryEventImpl_DATASTORE_FAILED_TO_CALCULATE_SIZE_OF_NEW_VALUE = new StringId(1540, "DataStore failed to calculate size of new value");
+ public static final StringId EntryEventImpl_DATASTORE_FAILED_TO_CALCULATE_SIZE_OF_OLD_VALUE = new StringId(1541, "DataStore failed to calculate size of old value");
+ public static final StringId ExpirationScheduler_SCHEDULING__0__TO_FIRE_IN__1__MS = new StringId(1542, "Scheduling {0} to fire in {1} ms");
+ public static final StringId ExpiryTask_EXCEPTION_IN_EXPIRATION_TASK = new StringId(1543, "Exception in expiration task");
+
+ public static final StringId FetchEntriesMessage_FETCHKEYSMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1545, "FetchKeysMessage: data store not configured for this member");
+
+ public static final StringId FetchKeysMessage_FETCHKEYSMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1547, "FetchKeysMessage: data store not configured for this member");
+ public static final StringId ForceDisconnectOperation_DISCONNECT_FORCED_BY__0__BECAUSE_WE_WERE_TOO_SLOW = new StringId(1548, "Disconnect forced by {0} because we were too slow.");
+ public static final StringId GLOBALTRANSACTION__ENLISTRESOURCE__ERROR_WHILE_ENLISTING_XARESOURCE_0_1 = new StringId(1549, "GlobalTransaction::enlistResource::error while enlisting XAResource {0} {1}");
+
+ public static final StringId GatewayEventRemoteDispatcher_0_USING_1 = new StringId(1552, "{0}: Using {1}");
+ public static final StringId GatewayEventRemoteDispatcher_0_USING_1_AFTER_2_FAILED_CONNECT_ATTEMPTS = new StringId(1553, "{0}: Using {1} after {2} failed connect attempts");
+
+ public static final StringId GatewayEventRemoteDispatcher_A_BATCHEXCEPTION_OCCURRED_PROCESSING_EVENT__0 = new StringId(1556, "A BatchException occurred processing events. Index of Array of Exception : {0}");
+ public static final StringId GatewayEventRemoteDispatcher_NO_AVAILABLE_CONNECTION_WAS_FOUND_BUT_THE_FOLLOWING_ACTIVE_SERVERS_EXIST_0 = new StringId(1557, "No available connection was found, but the following active servers exist: {0}");
+ public static final StringId GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH = new StringId(1558, "Stopping the processor because the following exception occurred while processing a batch:");
+
+ public static final StringId GatewayEventRemoteDispatcher_THERE_ARE_NO_ACTIVE_SERVERS = new StringId(1560, "There are no active servers.");
+ public static final StringId GatewayEventRemoteDispatcher_THE_EVENT_BEING_PROCESSED_WHEN_THE_BATCHEXCEPTION_OCCURRED_WAS__0 = new StringId(1561, "The event being processed when the BatchException occurred was: {0}");
+
+ public static final StringId GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT = new StringId(1564, "{0}: Could not connect.");
+
+ public static final StringId GatewaySender_0_IS_BECOMING_PRIMARY_GATEWAY_Sender = new StringId(1566, "{0} is becoming primary gateway Sender.");
+
+ public static final StringId GatewaySenderAdvisor_0_THE_THREAD_TO_OBTAIN_THE_FAILOVER_LOCK_WAS_INTERRUPTED__THIS_GATEWAY_SENDER_WILL_NEVER_BECOME_THE_PRIMARY = new StringId(1568, "{0}: The thread to obtain the failover lock was interrupted. This gateway sender will never become the primary.");
+
+ public static final StringId SerialGatewaySenderImpl_0__STARTING_AS_PRIMARY = new StringId(1570, "{0} : Starting as primary");
+
+ public static final StringId GatewaySender_COULD_NOT_STOP_LOCK_OBTAINING_THREAD_DURING_GATEWAY_SENDER_STOP = new StringId(1573, "Could not stop lock obtaining thread during gateway sender stop");
+
+ public static final StringId GatewayImpl_0__MARKING__1__EVENTS_AS_POSSIBLE_DUPLICATES = new StringId(1578, "{0} : Marking {1} events as possible duplicates");
+
+ public static final StringId GatewayImpl_0__WAITING_FOR_FAILOVER_COMPLETION = new StringId(1580, "{0} : Waiting for failover completion");
+ public static final StringId GatewayImpl_0__WAITING_TO_BECOME_PRIMARY_GATEWAY = new StringId(1581, "{0} : Waiting to become primary gateway");
+ public static final StringId GatewayImpl_ABOUT_TO_PROCESS_THE_MESSAGE_QUEUE_BUT_NOT_THE_PRIMARY = new StringId(1582, "About to process the message queue but not the primary.");
+
+ public static final StringId GatewayImpl_DESTROYING_GATEWAYEVENTDISPATCHER_WITH_ACTIVELY_QUEUED_DATA = new StringId(1584, "Destroying GatewayEventDispatcher with actively queued data.");
+
+ public static final StringId SerialGatewaySenderImpl_STARTED__0 = new StringId(1586, "Started {0}");
+ public static final StringId GatewayImpl_STOPPED__0 = new StringId(1587, "Stopped {0}");
+ public static final StringId SerialGatewaySenderImpl_0__STARTING_AS_SECONDARY_BECAUSE_PRIMARY_GATEWAY_SENDER_IS_AVAIALABLE_ON_MEMBER_2 = new StringId(1588, "{0} starting as secondary because primary gateway sender is available on member :{1}");
+ public static final StringId GemFireBasicDataSource_AN_EXCEPTION_WAS_CAUGHT_WHILE_TRYING_TO_LOAD_THE_DRIVER = new StringId(1589, "An Exception was caught while trying to load the driver. {0}");
+ public static final StringId GemFireBasicDataSource_GEMFIREBASICDATASOURCE_GETCONNECTION_URL_FOR_THE_DATASOURCE_NOT_AVAILABLE = new StringId(1590, "GemFireBasicDataSource::getConnection:Url for the DataSource not available");
+ public static final StringId GemFireCache_0__NOW_CLOSING = new StringId(1591, "{0} : Now closing.");
+ public static final StringId GemFireCache_INITIALIZING_CACHE_USING__0__1 = new StringId(1592, "Initializing cache using \"{0}\":{1}");
+ public static final StringId GemFireCache_FAILED_TO_GET_THE_CQSERVICE_TO_CLOSE_DURING_CACHE_CLOSE_1 = new StringId(1593, "Failed to get the CqService, to close during cache close (1).");
+ public static final StringId GemFireCache_FAILED_TO_GET_THE_CQSERVICE_TO_CLOSE_DURING_CACHE_CLOSE_2 = new StringId(1594, "Failed to get the CqService, to close during cache close (2).");
+ public static final StringId GemFireCache_WHILE_READING_CACHE_XML_0_1 = new StringId(1595, "While reading Cache XML {0}. {1}");
+
+ public static final StringId GemFireConnPooledDataSource_EXCEPTION_CREATING_GEMFIRECONNECTIONPOOLMANAGER = new StringId(1620, "An exception was caught while creating a GemFireConnectionPoolManager. {0}");
+ public static final StringId CqQueryImpl_FAILED_TO_REMOVE_CONTINUOUS_QUERY_FROM_THE_REPOSITORY_CQNAME_0_ERROR_1 = new StringId( 1621, "Failed to remove Continuous Query From the repository. CqName: {0} Error : {1}");
+
+ public static final StringId GemFireStatSampler_ARCHIVING_STATISTICS_TO__0_ = new StringId(1633, "Archiving statistics to \"{0}\".");
+ public static final StringId GemFireStatSampler_COULD_NOT_OPEN_STATISTIC_ARCHIVE_0_CAUSE_1 = new StringId(1634, "Could not open statistic archive {0}. Cause: {1}");
+ public static final StringId GemFireStatSampler_COULD_NOT_RENAME_0_TO_1 = new StringId(1635, "Could not rename \"{0}\" to \"{1}\".");
+ public static final StringId GemFireStatSampler_DISABLING_STATISTIC_ARCHIVAL = new StringId(1636, "Disabling statistic archival.");
+ public static final StringId GemFireStatSampler_RENAMED_OLD_EXISTING_ARCHIVE_TO__0_ = new StringId(1637, "Renamed old existing archive to \"{0}\".");
+ public static final StringId GemFireStatSampler_STATISTIC_ARCHIVE_CLOSE_FAILED_BECAUSE__0 = new StringId(1638, "Statistic archive close failed because: {0}");
+
+ public static final StringId GlobalTransaction_GLOBALTRANSACTIONENLISTRESOURCEONLY_ONE_RESOUCE_MANAGER_SUPPORTED = new StringId(1644, "GlobalTransaction::enlistResource::Only one Resouce Manager supported");
+ public static final StringId GlobalTransaction_GLOBALTRANSACTION_CONSTRUCTOR_ERROR_WHILE_TRYING_TO_CREATE_XID_DUE_TO_0 = new StringId(1645, "GlobalTransaction::Constructor::Error while trying to create Xid due to {0}");
+ public static final StringId GlobalTransaction_GLOBATRANSACTION_EXPIREGTX_ERROR_OCCURED_WHILE_REMOVING_TRANSACTIONAL_MAPPINGS_0 = new StringId(1646, "GlobaTransaction::expireGTX:Error occurred while removing transactional mappings {0}");
+ public static final StringId GlobalTransaction_TRANSACTION_0_HAS_TIMED_OUT = new StringId(1647, "Transaction {0} has timed out.");
+ public static final StringId GrantorRequestProcessor_GRANTORREQUESTPROCESSOR_ELDERSYNCWAIT_THE_CURRENT_ELDER_0_IS_WAITING_FOR_THE_NEW_ELDER_1 = new StringId(1648, "GrantorRequestProcessor.elderSyncWait: The current Elder {0} is waiting for the new Elder {1}.");
+ public static final StringId HARegionQueue_DACEREMOVEEVENTANDSETSEQUENCEID_SINCE_THE_EVENT_WAS_SUCCESSULY_REMOVED_BY_TAKE_OPERATION_IT_SHOULD_HAVE_EXISTED_IN_THE_REGION = new StringId(1649, "DACE::removeEventAndSetSequenceID: Since the event was successuly removed by a take operation, it should have existed in the region");
+ public static final StringId HARegionQueue_DISPATCHEDANDCURRENTEVENTSEXPIREORUPDATE_UNEXPECTEDLY_ENCOUNTERED_EXCEPTION_WHILE_REMOVING_EXPIRY_ENTRY_FOR_THREADIDENTIFIER_0_AND_EXPIRY_VALUE_1 = new StringId(1650, "DispatchedAndCurrentEvents::expireOrUpdate: Unexpectedly encountered exception while removing expiry entry for ThreadIdentifier={0} and expiry value={1}");
+ public static final StringId HARegionQueue_DISPATCHEDANDCURRENTEVENTSEXPIREORUPDATE_UNEXPECTEDLY_ENCOUNTERED_EXCEPTION_WHILE_UPDATING_EXPIRY_ID_FOR_THREADIDENTIFIER_0 = new StringId(1651, "DispatchedAndCurrentEvents::expireOrUpdate: Unexpectedly encountered exception while updating expiry ID for ThreadIdentifier={0}");
+ public static final StringId HARegionQueue_EXCEPTION_OCCURED_WHILE_TRYING_TO_SET_THE_LAST_DISPATCHED_ID = new StringId(1652, "Exception occurred while trying to set the last dispatched id");
+ public static final StringId HARegionQueue_HAREGIONQUEUECREATECACHELISTNEREXCEPTION_IN_THE_EXPIRY_THREAD = new StringId(1653, "HAREgionQueue::createCacheListner::Exception in the expiry thread");
+
+ public static final StringId HARegionQueue_HAREGIONQUEUE_AND_ITS_DERIVED_CLASS_DO_NOT_SUPPORT_THIS_OPERATION = new StringId(1655, "HARegionQueue and its derived class do not support this operation ");
+ public static final StringId ConnectionTable_THE_DISTRIBUTED_SYSTEM_IS_SHUTTING_DOWN = new StringId(1656, "The distributed system is shutting down");
+ public static final StringId HARegionQueue_INTERRUPTEDEXCEPTION_OCCURED_IN_QUEUEREMOVALTHREAD_WHILE_WAITING = new StringId(1657, "InterruptedException occurred in QueueRemovalThread while waiting ");
+ public static final StringId HealthMonitorImpl_UNEXPECTED_STOP_OF_HEALTH_MONITOR = new StringId(1658, "Unexpected stop of health monitor");
+
+ public static final StringId HARegionQueue_THE_QUEUEREMOVALTHREAD_IS_DONE = new StringId(1660, "The QueueRemovalThread is done.");
+ public static final StringId HighPriorityAckedMessage_0_THERE_ARE_STILL_1_OTHER_THREADS_ACTIVE_IN_THE_HIGH_PRIORITY_THREAD_POOL = new StringId(1661, "{0}: There are still {1} other threads active in the high priority thread pool.");
+ public static final StringId HostStatSampler_HOSTSTATSAMPLER_THREAD_COULD_NOT_BE_STOPPED = new StringId(1662, "HostStatSampler thread could not be stopped during shutdown.");
+ public static final StringId HostStatSampler_STATISIC_ARCHIVER_SHUTDOWN_FAILED_BECAUSE__0 = new StringId(1663, "Statistic archiver shutdown failed because: {0}");
+ public static final StringId HostStatSampler_STATISTIC_ARCHIVER_SHUTDOWN_FAILED_BECAUSE__0 = new StringId(1664, "Statistic archiver shutdown failed because: {0}");
+ public static final StringId HostStatSampler_STATISTIC_ARCHIVER_SHUTTING_DOWN_BECAUSE__0 = new StringId(1665, "Statistic archiver shutting down because: {0}");
+
+ public static final StringId IndexCreationMsg_REGION_IS_LOCALLY_DESTROYED_THROWING_REGIONDESTROYEDEXCEPTION_FOR__0 = new StringId(1673, "Region is locally destroyed, throwing RegionDestroyedException for {0}");
+ public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_THE_SERVER_ENDPOINTS_ON_WHICH_THIS_CQ_WAS_REGISTERED_WERE_NOT_FOUND = new StringId(1676, "Failed to stop the cq. CqName: {0}. The server endpoints on which this cq was registered were not found.");
+
+ public static final StringId InternalDataSerializer_COULD_NOT_LOAD_DATASERIALIZER_CLASS_0 = new StringId(1679, "Could not load DataSerializer class: {0}");
+ public static final StringId InternalDataSerializer_REGISTER_DATASERIALIZER_0_OF_CLASS_1 = new StringId(1680, "Register DataSerializer {0} of class {1}");
+ public static final StringId InternalDistributedSystem_CONNECTLISTENER_THREW = new StringId(1681, "ConnectListener threw...");
+ public static final StringId InternalDistributedSystem_DISCONNECTLISTENERSHUTDOWN_THREW = new StringId(1682, "DisconnectListener/Shutdown threw...");
+ public static final StringId InternalDistributedSystem_DISCONNECT_LISTENER_IGNORED_ITS_INTERRUPT__0 = new StringId(1683, "Disconnect listener ignored its interrupt: {0}");
+
+ public static final StringId InternalDistributedSystem_DISCONNECT_LISTENER_STILL_RUNNING__0 = new StringId(1685, "Disconnect listener still running: {0}");
+ public static final StringId InternalDistributedSystem_EXCEPTION_OCCURED_WHILE_TRYING_TO_CONNECT_THE_SYSTEM_DURING_RECONNECT = new StringId(1686, "Exception occurred while trying to connect the system during reconnect");
+ public static final StringId InternalDistributedSystem_EXCEPTION_OCCURED_WHILE_TRYING_TO_CREATE_THE_CACHE_DURING_RECONNECT = new StringId(1687, "Exception occurred while trying to create the cache during reconnect");
+ public static final StringId InternalDistributedSystem_INTERRUPTED_WHILE_PROCESSING_DISCONNECT_LISTENER = new StringId(1688, "Interrupted while processing disconnect listener");
+
+ public static final StringId GemFireCacheImpl_RUNNING_IN_LOCAL_MODE = new StringId(1690, "Running in local mode since no locators were specified.");
+ public static final StringId InternalDistributedSystem_SHUTDOWNLISTENER__0__THREW = new StringId(1691, "ShutdownListener < {0} > threw...");
+ public static final StringId InternalDistributedSystem_STARTUP_CONFIGURATIONN_0 = new StringId(1692, "Startup Configuration:\n {0}");
+
+ public static final StringId InternalInstantiator_CLASS_0_DOES_NOT_HAVE_A_TWOARGUMENT_CLASS_INT_CONSTRUCTOR = new StringId(1694, "Class {0} does not have a two-argument (Class, int) constructor.");
+ public static final StringId InternalInstantiator_CLASS_0_DOES_NOT_HAVE_A_TWOARGUMENT_CLASS_INT_CONSTRUCTOR_IT_IS_AN_INNER_CLASS_OF_1_SHOULD_IT_BE_A_STATIC_INNER_CLASS = new StringId(1695, "Class {0} does not have a two-argument (Class, int) constructor. It is an inner class of {1}. Should it be a static inner class?");
+ public static final StringId InternalInstantiator_COULD_NOT_LOAD_INSTANTIATED_CLASS_0 = new StringId(1696, "Could not load instantiated class: {0}");
+ public static final StringId InternalInstantiator_COULD_NOT_LOAD_INSTANTIATOR_CLASS_0 = new StringId(1697, "Could not load instantiator class: {0}");
+ public static final StringId InternalLocator_0__IS_STOPPED = new StringId(1698, "{0} is stopped");
+ public static final StringId InternalLocator_COULD_NOT_STOP__0__IN_60_SECONDS = new StringId(1699, "Could not stop {0} in 60 seconds");
+
+ public static final StringId InternalLocator_INTERRUPTED_WHILE_STOPPING__0 = new StringId(1701, "Interrupted while stopping {0}");
+ public static final StringId InternalLocator_LOCATOR_STARTED_ON__0 = new StringId(1702, "Locator started on {0}");
+ public static final StringId StartupMessage_REJECTED_NEW_SYSTEM_NODE_0_BECAUSE_MCAST_PORT_1_DOES_NOT_MATCH_THE_DISTRIBUTED_SYSTEM_2_IT_IS_ATTEMPTING_TO_JOIN = new StringId(1703, "Rejected new system node {0} because its mcast-port {1} does not match the mcast-port {2} of the distributed system it is attempting to join. To fix this make sure the \"mcast-port\" gemfire property is set the same on all members of the same distributed system.");
+ public static final StringId StartupMessage_REJECTED_NEW_SYSTEM_NODE_0_BECAUSE_MCAST_ADDRESS_1_DOES_NOT_MATCH_THE_DISTRIBUTED_SYSTEM_2_IT_IS_ATTEMPTING_TO_JOIN = new StringId(1704, "Rejected new system node {0} because its mcast-address {1} does not match the mcast-address {2} of the distributed system it is attempting to join. To fix this make sure the \"mcast-address\" gemfire property is set the same on all members of the same distributed system.");
+ public static final StringId ReplyProcessor21_UNKNOWN_DSFID_ERROR = new StringId(1705,
+ "Exception received due to missing DSFID {0} on remote node \"{1}\" "
+ + "running version \"{2}\".");
+
+ public static final StringId InternalLocator_STARTING_DISTRIBUTED_SYSTEM = new StringId(1707, "Starting distributed system");
+
+ public static final StringId InternalLocator_STOPPING__0 = new StringId(1709, "Stopping {0}");
+ public static final StringId InternalLocator_USING_EXISTING_DISTRIBUTED_SYSTEM__0 = new StringId(1710, "Using existing distributed system: {0}");
+ public static final StringId Invalid_0_INVALID_MESSAGE_TYPE_WITH_TX_1_FROM_2 = new StringId(1711, "{0}: INVALID message type with tx: {1} from {2}");
+
+ public static final StringId JCAConnectionManagerImpl_EXCEPTION_CAUGHT_WHILE_INITIALIZING = new StringId(1713, "JCAConnectionManagerImpl::Constructor: An exception was caught while initialising due to {0}" );
+ public static final StringId GroupMembershipService_JOINED_TOOK__0__MS = new StringId(1714, "Joined the distributed system (took {0} ms)");
+ public static final StringId GroupMembershipService_FAILED_TO_SEND_MESSAGE_0_TO_MEMBER_1_VIEW_2 = new StringId(1715, "Failed to send message <{0}> to member <{1}> view = {2}");
+
+
+ public static final StringId GroupMembershipService_MEMBERSHIP_ERROR_HANDLING_STARTUP_EVENT = new StringId(1720, "Membership: Error handling startup event");
+ public static final StringId GroupMembershipService_MEMBERSHIP_FAULT_WHILE_PROCESSING_VIEW_ADDITION_OF__0 = new StringId(1721, "Membership: Fault while processing view addition of {0}");
+ public static final StringId GroupMembershipService_MEMBERSHIP_FAULT_WHILE_PROCESSING_VIEW_REMOVAL_OF__0 = new StringId(1722, "Membership: Fault while processing view removal of {0}");
+
+ public static final StringId GroupMembershipService_MEMBERSHIP_IGNORING_SURPRISE_CONNECT_FROM_SHUNNED_MEMBER_0 = new StringId(1726, "Membership: Ignoring surprise connect from shunned member <{0}>");
+
+ public static final StringId GroupMembershipService_MEMBERSHIP_PROCESSING_ADDITION__0_ = new StringId(1730, "Membership: Processing addition < {0} >");
+
+ public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSNAMINGEXCEPTION_WHILE_BINDING_TRANSACTIONMANAGERUSERTRANSACTION_TO_APPLICATION_SERVER_JNDI_TREE = new StringId(1737, "JNDIInvoker::mapTransactions::NamingException while binding TransactionManager/UserTransaction to Application Server JNDI Tree");
+ public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSNAMINGEXCEPTION_WHILE_BINDING_TRANSACTIONMANAGERUSERTRANSACTION_TO_GEMFIRE_JNDI_TREE = new StringId(1738, "JNDIInvoker::mapTransactions::NamingException while binding TransactionManager/UserTransaction to GemFire JNDI Tree");
+ public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSSYSTEMEXCEPTION_WHILE_BINDING_TRANSACTIONMANAGERUSERTRANSACTION_TO_APPLICATION_SERVER_JNDI_TREE = new StringId(1739, "JNDIInvoker::mapTransactions::SystemException while binding TransactionManager/UserTransaction to Application Server JNDI Tree");
+ public static final StringId JNDIInvoker_JNDIINVOKERMAPTRANSACTIONSSYSTEMEXCEPTION_WHILE_BINDING_USERTRANSACTION_TO_GEMFIRE_JNDI_TREE = new StringId(1740, "JNDIInvoker::mapTransactions::SystemException while binding UserTransaction to GemFire JNDI Tree");
+ public static final StringId JNDIInvoker_JNDIINVOKER_DOTRANSACTIONLOOKUP_FOUND_WEBSPHERE_TRANSACTIONMANAGER_FACTORY_CLASS_0_BUT_COULDNT_INVOKE_ITS_STATIC_GETTRANSACTIONMANAGER_METHOD = new StringId(1741, "JNDIInvoker::doTransactionLookup::Found WebSphere TransactionManager factory class [{0}], but could not invoke its static ''getTransactionManager'' method");
+ public static final StringId JNDIInvoker_JNDIINVOKER_MAPDATASOURCE_0_WHILE_BINDING_1_TO_JNDI_CONTEXT = new StringId(1742, "JNDIInvoker::mapDataSource::{0} while binding {1} to JNDI Context");
+ public static final StringId GemFireStatSampler_OS_STATISTICS_FAILED_TO_INITIALIZE_PROPERLY_SOME_STATS_MAY_BE_MISSING_SEE_BUGNOTE_37160 = new StringId(1743, "OS statistics failed to initialize properly, some stats may be missing. See bugnote #37160.");
+ public static final StringId GemFireStatSampler_OS_STATISTIC_COLLECTION_DISABLED_BY_OSSTATSDISABLED_SYSTEM_PROPERTY = new StringId(1744, "OS statistic collection disabled by setting the \"osStatsDisabled\" system property to true.");
+ public static final StringId KeySet_0_THE_INPUT_REGION_NAME_FOR_THE_KEY_SET_REQUEST_IS_NULL = new StringId(1745, "{0}: The input region name for the key set request is null");
+ public static final StringId DataSerializer_ENUM_TO_SERIALIZE_IS_NULL = new StringId(1746, "The enum constant to serialize is null");
+ public static final StringId DataSerializer_ENUM_CLASS_TO_DESERIALIZE_IS_NULL = new StringId(1747, "the enum class to deserialize is null");
+
+ public static final StringId LocalRegion_0_EVENT_NOT_DISPATCHED_DUE_TO_REJECTED_EXECUTION = new StringId(1766, "{0} Event not dispatched due to rejected execution");
+ public static final StringId LocalRegion_0_OPERATIONS_ARE_NOT_ALLOWED_BECAUSE_THIS_THREAD_HAS_AN_ACTIVE_TRANSACTION = new StringId(1767, "{0} operations are not allowed because this thread has an active transaction");
+ public static final StringId LocalRegion_EXCEPTION_IN_EXPIRATION_TASK = new StringId(1768, "Exception in expiration task");
+ public static final StringId LocalRegion_EXCEPTION_OCCURRED_IN_CACHELISTENER = new StringId(1769, "Exception occurred in CacheListener");
+ public static final StringId LocalRegion_EXCEPTION_OCCURRED_WHILE_CLOSING_CQS_ON_REGION_DESTORY = new StringId(1770, "Exception occurred while closing CQs on region destroy.");
+ public static final StringId LocalRegion_REGIONENTRY_SHOULD_NOT_BE_NULL = new StringId(1771, "regionEntry should not be null");
+ public static final StringId LocalRegion_REGIONENTRY_WAS_CREATED_WITH_TRANSACTION_THAT_IS_NO_LONGER_ACTIVE = new StringId(1772, "Region.Entry was created with transaction that is no longer active.");
+ public static final StringId LocalRegion_REGION_CO
<TRUNCATED>
[10/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
new file mode 100755
index 0000000..4cd21a2
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
@@ -0,0 +1,1380 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+import com.gemstone.gemfire.internal.logging.LocalLogWriter;
+import com.gemstone.gemfire.internal.process.PidUnavailableException;
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.process.ProcessWrapper;
+
+/**
+ * Integration tests for launching a Server in a forked process.
+ *
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.ServerState
+ * @see com.gemstone.gemfire.internal.AvailablePortHelper
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherRemoteIntegrationTest extends AbstractServerLauncherRemoteIntegrationTestCase {
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
+ public void testRunningServerOutlivesForkingProcess() throws Throwable {
+ // launch ServerLauncherForkingProcess which then launches server
+
+// final List<String> command = new ArrayList<String>();
+// command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+// command.add("-cp");
+// command.add(System.getProperty("java.class.path"));
+// command.add(ServerLauncherDUnitTest.class.getName().concat("$").concat(ServerLauncherForkingProcess.class.getSimpleName()));
+//
+// process = new ProcessBuilder(command).directory(temporaryFolder.getRoot()).start();
+// assertNotNull(process);
+// processOutReader = new ProcessStreamReader(process.getInputStream(), createListener("sysout", getUniqueName() + "#sysout")).start();
+// processErrReader = new ProcessStreamReader(process.getErrorStream(), createListener("syserr", getUniqueName() + "#syserr")).start();
+
+ @SuppressWarnings("unused")
+ File file = new File(this.temporaryFolder.getRoot(), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
+ //-logger.info("log file is " + file);
+
+ final ProcessWrapper pw = new ProcessWrapper.Builder().mainClass(ServerLauncherForkingProcess.class).build();
+ pw.execute(null, this.temporaryFolder.getRoot()).waitFor(true);
+ //logger.info("[testRunningServerOutlivesForkingProcess] ServerLauncherForkingProcess output is:\n\n"+pw.getOutput());
+
+// // create waiting thread since waitFor does not have a timeout
+// Thread waiting = new Thread(new Runnable() {
+// @Override
+// public void run() {
+// try {
+// assertEquals(0, process.waitFor());
+// } catch (InterruptedException e) {
+// logger.error("Interrupted while waiting for process", e);
+// }
+// }
+// });
+
+// // start waiting thread and join to it for timeout
+// try {
+// waiting.start();
+// waiting.join(TIMEOUT_MILLISECONDS);
+// assertFalse("ServerLauncherForkingProcess took too long and caused timeout", waiting.isAlive());
+//
+// } catch (Throwable e) {
+// logger.error(e);
+// if (failure == null) {
+// failure = e;
+// }
+// } finally {
+// if (waiting.isAlive()) {
+// waiting.interrupt();
+// }
+// }
+
+ // wait for server to start
+ int pid = 0;
+ final String serverName = ServerLauncherForkingProcess.class.getSimpleName()+"_server";
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = serverName+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // validate the status
+ final ServerState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(getJvmArguments(), actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + serverName + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(serverName, actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // check the status
+ final ServerState serverState = this.launcher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.ONLINE, serverState.getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate stale control files were deleted
+ waitForFileToDelete(this.stopRequestFile);
+ waitForFileToDelete(this.statusRequestFile);
+ waitForFileToDelete(this.statusFile);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-721: random ports (setup overriding default port), TemporaryFolder
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertFalse(pid == Integer.MAX_VALUE);
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47778.
+ */
+ @Test
+ public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // verify server did not a port
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
+ // make serverPort in use
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // verify port is still in use
+ this.errorCollector.checkThat(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET), is(equalTo(false)));
+ }
+
+ @Category(FlakyTest.class) // GEODE-764: random ports, BindException, forks JVM, uses ErrorCollector
+ @Test
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ final int otherPid = getPid();
+ assertTrue("Pid " + otherPid + " should be alive", ProcessUtils.isProcessAlive(otherPid));
+ writePid(this.pidFile, otherPid);
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+ command.add("--force");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertTrue(pid != otherPid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47665.
+ */
+ @Test
+ public void testStartUsingServerPortInUseFails() throws Throwable {
+ // make serverPort in use
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--server-port=" + this.serverPort);
+
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start and fail
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = this.process.waitFor();
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final ServerState serverState = dirLauncher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
+ // generate two free ports
+ final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer().setPort(freeTCPPorts[0]);
+
+ File cacheXmlFile = new File(this.temporaryFolder.getRoot(), getUniqueName()+".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ // launch server and specify a different port
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath());
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--server-port=" + freeTCPPorts[1]);
+
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start up
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // verify server used --server-port instead of default or port in cache.xml
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
+ assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
+
+ ServerState status = this.launcher.status();
+ String portString = status.getPort();
+ int port = Integer.valueOf(portString);
+ assertEquals("Port should be " + freeTCPPorts[1] + " instead of " + port, freeTCPPorts[1], port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer();
+
+ File cacheXmlFile = new File(this.temporaryFolder.getRoot(), getUniqueName()+".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ // launch server and specify a different port
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath());
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--server-port=" + this.serverPort);
+
+ final String expectedString = "java.net.BindException";
+ final AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start up
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // verify server used --server-port instead of default or port in cache.xml
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ int port = Integer.valueOf(portString);
+ assertEquals("Port should be " + this.serverPort + " instead of " + port, this.serverPort, port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-1135: random ports, BindException, fork JVM
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ // make serverPort in use
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // launch server
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start up
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = this.process.waitFor();
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final ServerState serverState = dirLauncher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ this.temporaryFolder.getRoot() = new File(getUniqueName());
+ this.temporaryFolder.getRoot().mkdir();
+ assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
+
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart(dirLauncher, 10*1000, false);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ // check the status
+ final ServerState serverState = dirLauncher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ @Category(FlakyTest.class) // GEODE-957: random ports, BindException, fork JVM
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ ServerLauncher pidLauncher = null;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final ServerState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ assertNotNull(this.launcher);
+ assertFalse(this.launcher.isRunning());
+
+ // validate the status
+ final ServerState actualStatus = this.launcher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusWithEmptyPidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile());
+
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final ServerState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStatusWithNoPidFile() throws Exception {
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ ServerState serverState = dirLauncher.status();
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+ }
+
+ @Test
+ public void testStatusWithStalePidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ final int pid = 0;
+ assertFalse(ProcessUtils.isProcessAlive(pid));
+ writePid(this.pidFile, pid);
+
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final ServerState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ ServerLauncher pidLauncher = null;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final ServerState status = pidLauncher.status();
+ assertNotNull(status);
+ assertEquals(Status.ONLINE, status.getStatus());
+ assertEquals(pid, status.getPid().intValue());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // stop the server
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ assertFalse("PID file still exists!", this.pidFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Override
+ protected List<String> getJvmArguments() {
+ final List<String> jvmArguments = new ArrayList<String>();
+ jvmArguments.add("-Dgemfire.log-level=config");
+ jvmArguments.add("-Dgemfire.mcast-port=0");
+ return jvmArguments;
+ }
+
+ /**
+ * Used only by {@link ServerLauncherRemoteIntegrationTest#testRunningServerOutlivesForkingProcess}
+ */
+ public static class ServerLauncherForkingProcess {
+
+ public static void main(final String... args) throws IOException, PidUnavailableException {
+ //-System.out.println("inside main");
+ File file = new File(System.getProperty("user.dir"), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
+ file.createNewFile();
+ LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
+ //LogWriter logWriter = new PureLogWriter(LogWriterImpl.ALL_LEVEL);
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main PID is " + getPid());
+
+ try {
+ // launch ServerLauncher
+ final List<String> jvmArguments = null;//getJvmArguments();
+ assertTrue(jvmArguments.size() == 2);
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(ServerLauncherForkingProcess.class.getSimpleName()+"_server");
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main starting...");
+
+ //-System.out.println("launching " + command);
+
+ @SuppressWarnings("unused")
+ Process forkedProcess = new ProcessBuilder(command).start();
+
+// processOutReader = new ProcessStreamReader(forkedProcess.getInputStream()).start();
+// processErrReader = new ProcessStreamReader(forkedProcess.getErrorStream()).start();
+
+// logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main waiting for Server to start...");
+//
+// File workingDir = new File(System.getProperty("user.dir"));
+// System.out.println("waiting for server to start in " + workingDir);
+// final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+// .setWorkingDirectory(workingDir.getCanonicalPath())
+// .build();
+// waitForServerToStart(dirLauncher, true);
+
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
+
+ //-System.out.println("exiting");
+ System.exit(0);
+ }
+ catch (Throwable t) {
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t);
+ System.exit(-1);
+ }
+ }
+ }
+}
[03/37] incubator-geode git commit: Revert "GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
Posted by kl...@apache.org.
Revert "GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
This reverts commit f788d698e877b15570052f89b9d0b5ab23023f81.
This commit accidentally included an unrelated change that broke the build.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/2da99e76
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/2da99e76
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/2da99e76
Branch: refs/heads/feature/GEODE-1276
Commit: 2da99e76593d5dd77ccb54d5763506642ccc9e41
Parents: f788d69
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Thu May 5 15:37:33 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Thu May 5 15:37:33 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 63 -------------------
.../execute/EmtpyRegionFunctionException.java | 63 +++++++++++++++++++
.../internal/LocatorLoadSnapshotJUnitTest.java | 65 +++++++++++++++++---
3 files changed, 118 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2da99e76/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
deleted file mode 100644
index a077779..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.execute;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-
-/**
- * Exception to indicate that Region is empty for data aware functions.
- *
- * @since 6.5
- *
- */
-public class EmptyRegionFunctionException extends FunctionException {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param cause
- * a Throwable cause of this exception
- */
- public EmptyRegionFunctionException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * Exception message
- */
- public EmptyRegionFunctionException(String msg) {
- super(msg);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * the error message
- * @param cause
- * a Throwable cause of this exception
- */
- public EmptyRegionFunctionException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2da99e76/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
new file mode 100644
index 0000000..6aff9eb
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+
+/**
+ * Exception to indicate that Region is empty for data aware functions.
+ *
+ * @since 6.5
+ *
+ */
+public class EmtpyRegionFunctionException extends FunctionException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmtpyRegionFunctionException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * Exception message
+ */
+ public EmtpyRegionFunctionException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * the error message
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmtpyRegionFunctionException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2da99e76/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
old mode 100755
new mode 100644
index d8a1290..34ac767
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -257,19 +257,21 @@ public class LocatorLoadSnapshotJUnitTest {
assertEquals(Arrays.asList(new ServerLocation[] {} ), sn.getServersForQueue(null, excludeAll, 3));
}
-
+
/**
- * A basic test of concurrent functionality. Simulate a number of
+ * A basic test of concurrent functionality. Starts a number of
* threads making requests and expects the load to be balanced between
* three servers.
* @throws InterruptedException
*/
+ @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
@Test
public void testConcurrentBalancing() throws InterruptedException {
int NUM_THREADS = 50;
final int NUM_REQUESTS = 10000;
int ALLOWED_THRESHOLD = 50; //We should never be off by more than
-
+ //the number of concurrent threads.
+
final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
final ServerLocation l1 = new ServerLocation("localhost", 1);
final ServerLocation l2 = new ServerLocation("localhost", 2);
@@ -288,18 +290,47 @@ public class LocatorLoadSnapshotJUnitTest {
loadCounts.put(l2, new AtomicInteger(initialLoad2));
loadCounts.put(l3, new AtomicInteger(initialLoad3));
+ Thread[] threads = new Thread[NUM_THREADS];
+// final Object lock = new Object();
for(int i =0; i < NUM_THREADS; i++) {
- for(int ii = 0; ii < NUM_REQUESTS; ii++) {
- ServerLocation location;
- location = sn.getServerForConnection(null, Collections.EMPTY_SET);
- AtomicInteger count = (AtomicInteger) loadCounts.get(location);
- count.incrementAndGet();
+ threads[i] = new Thread("Thread-" + i) {
+ public void run() {
+ for(int ii = 0; ii < NUM_REQUESTS; ii++) {
+ ServerLocation location;
+// synchronized(lock) {
+ location = sn.getServerForConnection(null, Collections.EMPTY_SET);
+// }
+ AtomicInteger count = (AtomicInteger) loadCounts.get(location);
+ count.incrementAndGet();
+ }
+ }
+ };
+ }
+
+ for(int i =0; i < NUM_THREADS; i++) {
+ threads[i].start();
+ }
+
+ for(int i =0; i < NUM_THREADS; i++) {
+ Thread t = threads[i];
+ long ms = 30 * 1000;
+ t.join(30 * 1000);
+ if (t.isAlive()) {
+ for(int j =0; j < NUM_THREADS; j++) {
+ threads[j].interrupt();
+ }
+ fail("Thread did not terminate after " + ms + " ms: " + t);
}
}
- double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
+ double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
NUM_REQUESTS * NUM_THREADS) / (double) loadCounts.size();
-
+// for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
+// Map.Entry entry = (Entry) itr.next();
+// ServerLocation location = (ServerLocation) entry.getKey();
+// AI count= (AI) entry.getValue();
+// }
+
for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Entry) itr.next();
ServerLocation location = (ServerLocation) entry.getKey();
@@ -337,4 +368,18 @@ public class LocatorLoadSnapshotJUnitTest {
assertFalse(sn.hasBalancedConnections("b"));
}
+ public void _test2() { // delete this method?
+ final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
+ sn.addServer(new ServerLocation("hs20h.gemstone.com",28543), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20l.gemstone.com",22385), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20n.gemstone.com",23482), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20m.gemstone.com",23429), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20e.gemstone.com",20154), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20j.gemstone.com",24273), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20g.gemstone.com",27125), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20i.gemstone.com",25201), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20k.gemstone.com",23711), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ sn.addServer(new ServerLocation("hs20f.gemstone.com",21025), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
+ }
+
}
[13/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteWithCustomLoggingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteWithCustomLoggingIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteWithCustomLoggingIntegrationTest.java
new file mode 100644
index 0000000..2e84905
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteWithCustomLoggingIntegrationTest.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static com.gemstone.gemfire.internal.logging.log4j.custom.CustomConfiguration.CONFIG_LAYOUT_PREFIX;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.logging.log4j.custom.CustomConfiguration;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for launching a Locator in a forked process with custom logging configuration
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherRemoteWithCustomLoggingIntegrationTest extends AbstractLocatorLauncherRemoteIntegrationTestCase {
+
+ private File customConfigFile;
+
+ @Rule
+ public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+ @Before
+ public void setUpLocatorLauncherRemoteWithCustomLoggingIntegrationTest() throws Exception {
+ this.customConfigFile = CustomConfiguration.createConfigFileIn(this.temporaryFolder.getRoot());
+ }
+
+ @Test
+ public void testStartUsesCustomLoggingConfiguration() throws Throwable {
+ // build and start the locator
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-D" + ConfigurationFactory.CONFIGURATION_FILE_PROPERTY + "=" + this.customConfigFile.getCanonicalPath());
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(new File(this.workingDirectory)).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(new ToSystemOut()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(new ToSystemOut()).build().start();
+
+ int pid = 0;
+ this.launcher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(workingDirectory)
+ .build();
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // check the status
+ final LocatorLauncher.LocatorState locatorState = this.launcher.status();
+ assertNotNull(locatorState);
+ assertEquals(AbstractLauncher.Status.ONLINE, locatorState.getStatus());
+
+ assertThat(systemOutRule.getLog()).contains("log4j.configurationFile = " + this.customConfigFile.getCanonicalPath());
+ assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(AbstractLauncher.Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ private static class ToSystemOut implements ProcessStreamReader.InputListener {
+ @Override
+ public void notifyInputLine(String line) {
+ System.out.println(line);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java
new file mode 100644
index 0000000..3799a64
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherTest.java
@@ -0,0 +1,340 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import joptsimple.OptionException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Command;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The LocatorLauncherTest class is a test suite of test cases for testing the contract and functionality of
+ * launching a GemFire Locator.
+ *
+ * @see com.gemstone.gemfire.distributed.LocatorLauncher
+ * @see com.gemstone.gemfire.distributed.LocatorLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.LocatorLauncher.Command
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since 7.0
+ */
+@Category(UnitTest.class)
+public class LocatorLauncherTest {
+
+ @Rule
+ public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testBuilderParseArgumentsWithNonNumericPort() {
+ try {
+ new Builder().parseArguments("start", "locator1", "--port", "oneTwoThree");
+ }
+ catch (IllegalArgumentException expected) {
+ assertTrue(expected.getCause() instanceof OptionException);
+ assertTrue(expected.getMessage(), expected.getMessage().contains(
+ LocalizedStrings.Launcher_Builder_PARSE_COMMAND_LINE_ARGUMENT_ERROR_MESSAGE.toLocalizedString(
+ "Locator", expected.getCause().getMessage())));
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testForceDefaultsToFalse() {
+ assertFalse(new Builder().getForce());
+ }
+
+ @Test
+ public void testForceSetToTrue() {
+ Builder builder = new Builder();
+
+ builder.parseArguments("start", "--force");
+
+ assertTrue(Boolean.TRUE.equals(builder.getForce()));
+ }
+
+ @Test
+ public void testSetAndGetCommand() {
+ final Builder builder = new Builder();
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ assertSame(builder, builder.setCommand(Command.START));
+ assertEquals(Command.START, builder.getCommand());
+ assertSame(builder, builder.setCommand(Command.STATUS));
+ assertEquals(Command.STATUS, builder.getCommand());
+ assertSame(builder, builder.setCommand(Command.STOP));
+ assertEquals(Command.STOP, builder.getCommand());
+ assertSame(builder, builder.setCommand(null));
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ }
+
+ @Test
+ public void testSetAndGetBindAddress() throws UnknownHostException {
+ final Builder builder = new Builder();
+
+ assertNull(builder.getBindAddress());
+ assertSame(builder, builder.setBindAddress(null));
+ assertNull(builder.getBindAddress());
+ assertSame(builder, builder.setBindAddress(""));
+ assertNull(builder.getBindAddress());
+ assertSame(builder, builder.setBindAddress(" "));
+ assertNull(builder.getBindAddress());
+ assertSame(builder, builder.setBindAddress(InetAddress.getLocalHost().getCanonicalHostName()));
+ assertEquals(InetAddress.getLocalHost(), builder.getBindAddress());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetBindAddressToUnknownHost() {
+ try {
+ new Builder().setBindAddress("badhostname.badcompany.bad");
+ }
+ catch (IllegalArgumentException expected) {
+ final String expectedMessage1 = LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString("Locator");
+ final String expectedMessage2 = "badhostname.badcompany.bad is not an address for this machine.";
+ assertTrue(expected.getMessage().equals(expectedMessage1) || expected.getMessage().equals(expectedMessage2));
+ if (expected.getMessage().equals(expectedMessage1)) {
+ assertTrue(expected.getCause() instanceof UnknownHostException);
+ }
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetBindAddressToNonLocalHost() {
+ try {
+ new Builder().setBindAddress("yahoo.com");
+ }
+ catch (IllegalArgumentException expected) {
+ final String expectedMessage = "yahoo.com is not an address for this machine.";
+ assertEquals(expectedMessage, expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetBindAddressToLocalHost() throws Exception {
+ String host = InetAddress.getLocalHost().getHostName();
+ new Builder().setBindAddress(host);
+ }
+
+ @Test
+ public void testSetAndGetHostnameForClients() {
+ final Builder builder = new Builder();
+
+ assertNull(builder.getHostnameForClients());
+ assertSame(builder, builder.setHostnameForClients("Pegasus"));
+ assertEquals("Pegasus", builder.getHostnameForClients());
+ assertSame(builder, builder.setHostnameForClients(null));
+ assertNull(builder.getHostnameForClients());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetHostnameForClientsWithBlankString() {
+ try {
+ new Builder().setHostnameForClients(" ");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
+ .toLocalizedString(), expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetHostnameForClientsWithEmptyString() {
+ try {
+ new Builder().setHostnameForClients("");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
+ .toLocalizedString(), expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMemberName() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMemberName());
+ assertSame(builder, builder.setMemberName("locatorOne"));
+ assertEquals("locatorOne", builder.getMemberName());
+ assertSame(builder, builder.setMemberName(null));
+ assertNull(builder.getMemberName());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameWithBlankString() {
+ try {
+ new Builder().setMemberName(" ");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Locator"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameWithEmptyString() {
+ try {
+ new Builder().setMemberName("");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Locator"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetPid() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getPid());
+ assertSame(builder, builder.setPid(0));
+ assertEquals(0, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(1));
+ assertEquals(1, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(1024));
+ assertEquals(1024, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(12345));
+ assertEquals(12345, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(null));
+ assertNull(builder.getPid());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetPidToInvalidValue() {
+ try {
+ new Builder().setPid(-1);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_PID_ERROR_MESSAGE.toLocalizedString(), expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void testSetAndGetPort() {
+ Builder builder = new Builder();
+
+ assertEquals(LocatorLauncher.DEFAULT_LOCATOR_PORT, builder.getPort());
+ assertSame(builder, builder.setPort(65535));
+ assertEquals(65535, builder.getPort().intValue());
+ assertSame(builder, builder.setPort(1024));
+ assertEquals(1024, builder.getPort().intValue());
+ assertSame(builder, builder.setPort(80));
+ assertEquals(80, builder.getPort().intValue());
+ assertSame(builder, builder.setPort(1));
+ assertEquals(1, builder.getPort().intValue());
+ assertSame(builder, builder.setPort(0));
+ assertEquals(0, builder.getPort().intValue());
+ assertSame(builder, builder.setPort(null));
+ assertEquals(LocatorLauncher.DEFAULT_LOCATOR_PORT, builder.getPort());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetPortToOverflow() {
+ try {
+ new Builder().setPort(65536);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Locator"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetPortToUnderflow() {
+ try {
+ new Builder().setPort(-1);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Locator"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testBuild() throws Exception {
+ Builder builder = new Builder();
+
+ LocatorLauncher launcher = builder.setCommand(Command.START)
+ .setDebug(true)
+ .setHostnameForClients("beanstock.vmware.com")
+ .setMemberName("Beanstock")
+ .setPort(8192)
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(builder.getCommand(), launcher.getCommand());
+ assertTrue(launcher.isDebugging());
+ assertEquals(builder.getHostnameForClients(), launcher.getHostnameForClients());
+ assertEquals(builder.getMemberName(), launcher.getMemberName());
+ assertEquals(builder.getPort(), launcher.getPort());
+ assertEquals(builder.getWorkingDirectory(), launcher.getWorkingDirectory());
+ assertFalse(launcher.isHelping());
+ assertFalse(launcher.isRunning());
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
+ LocatorLauncher launcher = new Builder()
+ .setCommand(LocatorLauncher.Command.START)
+ .setMemberName(null)
+ .set(DistributionConfig.NAME_NAME, "locatorABC")
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
+ assertNull(launcher.getMemberName());
+ assertEquals("locatorABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME));
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
+ System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "locatorXYZ");
+
+ LocatorLauncher launcher = new Builder()
+ .setCommand(LocatorLauncher.Command.START)
+ .setMemberName(null)
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
+ assertNull(launcher.getMemberName());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
deleted file mode 100755
index 248c39f..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static com.googlecode.catchexception.CatchException.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.ServiceState;
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * Unit tests for LocatorLauncher.LocatorState
- */
-@Category(UnitTest.class)
-public class LocatorStateJUnitTest {
-
- @Test
- public void fromJsonWithEmptyStringThrowsIllegalArgumentException() throws Exception {
- // given: empty string
- String emptyString = "";
-
- // when: passed to fromJson
- verifyException(this).fromJson(emptyString);
-
- // then: throws IllegalArgumentException with cause of GfJsonException
- assertThat((Exception)caughtException())
- .isInstanceOf(IllegalArgumentException.class)
- .hasCauseInstanceOf(GfJsonException.class);
-
- assertThat(caughtException().getCause())
- .isInstanceOf(GfJsonException.class)
- .hasNoCause();
- }
-
- @Test
- public void fromJsonWithWhiteSpaceStringThrowsIllegalArgumentException() throws Exception {
- // given: white space string
- String whiteSpaceString = " ";
-
- // when: passed to fromJson
- verifyException(this).fromJson(whiteSpaceString);
-
- // then: throws IllegalArgumentException with cause of GfJsonException
- assertThat((Exception)caughtException())
- .isInstanceOf(IllegalArgumentException.class)
- .hasCauseInstanceOf(GfJsonException.class);
-
- assertThat(caughtException().getCause())
- .isInstanceOf(GfJsonException.class)
- .hasNoCause();
- }
-
- @Test
- public void fromJsonWithNullStringThrowsNullPointerException() throws Exception {
- // given: null string
- String nullString = null;
-
- // when: passed to fromJson
- verifyException(this).fromJson(nullString);
-
- // then: throws NullPointerException
- assertThat((Exception)caughtException())
- .isInstanceOf(NullPointerException.class)
- .hasNoCause();
- }
-
- @Test
- public void fromJsonWithValidJsonStringReturnsLocatorState() throws Exception {
- // given: valid json string
- String jsonString = createStatusJson();
-
- // when: passed to fromJson
- LocatorState value = fromJson(jsonString);
-
- // then: return valid instance of LocatorState
- assertThat(value).isInstanceOf(LocatorState.class);
-
- assertThat(value.getClasspath()).isEqualTo(getClasspath());
- assertThat(value.getGemFireVersion()).isEqualTo(getGemFireVersion());
- assertThat(value.getHost()).isEqualTo(getHost());
- assertThat(value.getJavaVersion()).isEqualTo(getJavaVersion());
- assertThat(value.getJvmArguments()).isEqualTo(getJvmArguments());
- assertThat(value.getServiceLocation()).isEqualTo(getServiceLocation());
- assertThat(value.getLogFile()).isEqualTo(getLogFile());
- assertThat(value.getMemberName()).isEqualTo(getMemberName());
- assertThat(value.getPid()).isEqualTo(getPid());
- assertThat(value.getPort()).isEqualTo(getPort());
- assertThat(value.getStatus().getDescription()).isEqualTo(getStatusDescription());
- assertThat(value.getStatusMessage()).isEqualTo(getStatusMessage());
- assertThat(value.getTimestamp().getTime()).isEqualTo(getTimestampTime());
- assertThat(value.getUptime()).isEqualTo(getUptime());
- assertThat(value.getWorkingDirectory()).isEqualTo(getWorkingDirectory());
- }
-
- protected LocatorState fromJson(final String value) {
- return LocatorState.fromJson(value);
- }
-
- private String classpath = "test_classpath";
- private String gemFireVersion = "test_gemfireversion";
- private String host = "test_host";
- private String javaVersion = "test_javaversion";
- private String jvmArguments = "test_jvmarguments";
- private String serviceLocation = "test_location";
- private String logFile = "test_logfile";
- private String memberName = "test_membername";
- private Integer pid = 6396;
- private String port = "test_port";
- private String statusDescription = Status.NOT_RESPONDING.getDescription();
- private String statusMessage = "test_statusmessage";
- private Long timestampTime = 1450728233024L;
- private Long uptime = 1629L;
- private String workingDirectory = "test_workingdirectory";
-
- private String getClasspath() {
- return this.classpath;
- }
- private String getGemFireVersion() {
- return this.gemFireVersion;
- }
- private String getHost() {
- return this.host;
- }
- private String getJavaVersion() {
- return this.javaVersion;
- }
- private List<String> getJvmArguments() {
- List<String> list = new ArrayList<String>();
- list.add(this.jvmArguments);
- return list;
- }
- private String getServiceLocation() {
- return this.serviceLocation;
- }
- private String getLogFile() {
- return this.logFile;
- }
- private String getMemberName() {
- return this.memberName;
- }
- private Integer getPid() {
- return this.pid;
- }
- private String getPort() {
- return this.port;
- }
- private String getStatusDescription() {
- return this.statusDescription;
- }
- private String getStatusMessage() {
- return this.statusMessage;
- }
- private Long getTimestampTime() {
- return this.timestampTime;
- }
- private Long getUptime() {
- return this.uptime;
- }
- private String getWorkingDirectory() {
- return this.workingDirectory;
- }
-
- private String createStatusJson() {
- final Map<String, Object> map = new HashMap<String, Object>();
- map.put(ServiceState.JSON_CLASSPATH, getClasspath());
- map.put(ServiceState.JSON_GEMFIREVERSION, getGemFireVersion());
- map.put(ServiceState.JSON_HOST, getHost());
- map.put(ServiceState.JSON_JAVAVERSION, getJavaVersion());
- map.put(ServiceState.JSON_JVMARGUMENTS, getJvmArguments());
- map.put(ServiceState.JSON_LOCATION, getServiceLocation());
- map.put(ServiceState.JSON_LOGFILE, getLogFile());
- map.put(ServiceState.JSON_MEMBERNAME, getMemberName());
- map.put(ServiceState.JSON_PID, getPid());
- map.put(ServiceState.JSON_PORT, getPort());
- map.put(ServiceState.JSON_STATUS, getStatusDescription());
- map.put(ServiceState.JSON_STATUSMESSAGE, getStatusMessage());
- map.put(ServiceState.JSON_TIMESTAMP, getTimestampTime());
- map.put(ServiceState.JSON_UPTIME, getUptime());
- map.put(ServiceState.JSON_WORKINGDIRECTORY, getWorkingDirectory());
- return new GfJsonObject(map).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
new file mode 100755
index 0000000..55d7d6a
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateTest.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static com.googlecode.catchexception.CatchException.*;
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.ServiceState;
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for LocatorLauncher.LocatorState
+ */
+@Category(UnitTest.class)
+public class LocatorStateTest {
+
+ @Test
+ public void fromJsonWithEmptyStringThrowsIllegalArgumentException() throws Exception {
+ // given: empty string
+ String emptyString = "";
+
+ // when: passed to fromJson
+ verifyException(this).fromJson(emptyString);
+
+ // then: throws IllegalArgumentException with cause of GfJsonException
+ assertThat((Exception)caughtException())
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasCauseInstanceOf(GfJsonException.class);
+
+ assertThat(caughtException().getCause())
+ .isInstanceOf(GfJsonException.class)
+ .hasNoCause();
+ }
+
+ @Test
+ public void fromJsonWithWhiteSpaceStringThrowsIllegalArgumentException() throws Exception {
+ // given: white space string
+ String whiteSpaceString = " ";
+
+ // when: passed to fromJson
+ verifyException(this).fromJson(whiteSpaceString);
+
+ // then: throws IllegalArgumentException with cause of GfJsonException
+ assertThat((Exception)caughtException())
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasCauseInstanceOf(GfJsonException.class);
+
+ assertThat(caughtException().getCause())
+ .isInstanceOf(GfJsonException.class)
+ .hasNoCause();
+ }
+
+ @Test
+ public void fromJsonWithNullStringThrowsNullPointerException() throws Exception {
+ // given: null string
+ String nullString = null;
+
+ // when: passed to fromJson
+ verifyException(this).fromJson(nullString);
+
+ // then: throws NullPointerException
+ assertThat((Exception)caughtException())
+ .isInstanceOf(NullPointerException.class)
+ .hasNoCause();
+ }
+
+ @Test
+ public void fromJsonWithValidJsonStringReturnsLocatorState() throws Exception {
+ // given: valid json string
+ String jsonString = createStatusJson();
+
+ // when: passed to fromJson
+ LocatorState value = fromJson(jsonString);
+
+ // then: return valid instance of LocatorState
+ assertThat(value).isInstanceOf(LocatorState.class);
+
+ assertThat(value.getClasspath()).isEqualTo(getClasspath());
+ assertThat(value.getGemFireVersion()).isEqualTo(getGemFireVersion());
+ assertThat(value.getHost()).isEqualTo(getHost());
+ assertThat(value.getJavaVersion()).isEqualTo(getJavaVersion());
+ assertThat(value.getJvmArguments()).isEqualTo(getJvmArguments());
+ assertThat(value.getServiceLocation()).isEqualTo(getServiceLocation());
+ assertThat(value.getLogFile()).isEqualTo(getLogFile());
+ assertThat(value.getMemberName()).isEqualTo(getMemberName());
+ assertThat(value.getPid()).isEqualTo(getPid());
+ assertThat(value.getPort()).isEqualTo(getPort());
+ assertThat(value.getStatus().getDescription()).isEqualTo(getStatusDescription());
+ assertThat(value.getStatusMessage()).isEqualTo(getStatusMessage());
+ assertThat(value.getTimestamp().getTime()).isEqualTo(getTimestampTime());
+ assertThat(value.getUptime()).isEqualTo(getUptime());
+ assertThat(value.getWorkingDirectory()).isEqualTo(getWorkingDirectory());
+ }
+
+ protected LocatorState fromJson(final String value) {
+ return LocatorState.fromJson(value);
+ }
+
+ private String classpath = "test_classpath";
+ private String gemFireVersion = "test_gemfireversion";
+ private String host = "test_host";
+ private String javaVersion = "test_javaversion";
+ private String jvmArguments = "test_jvmarguments";
+ private String serviceLocation = "test_location";
+ private String logFile = "test_logfile";
+ private String memberName = "test_membername";
+ private Integer pid = 6396;
+ private String port = "test_port";
+ private String statusDescription = Status.NOT_RESPONDING.getDescription();
+ private String statusMessage = "test_statusmessage";
+ private Long timestampTime = 1450728233024L;
+ private Long uptime = 1629L;
+ private String workingDirectory = "test_workingdirectory";
+
+ private String getClasspath() {
+ return this.classpath;
+ }
+ private String getGemFireVersion() {
+ return this.gemFireVersion;
+ }
+ private String getHost() {
+ return this.host;
+ }
+ private String getJavaVersion() {
+ return this.javaVersion;
+ }
+ private List<String> getJvmArguments() {
+ List<String> list = new ArrayList<String>();
+ list.add(this.jvmArguments);
+ return list;
+ }
+ private String getServiceLocation() {
+ return this.serviceLocation;
+ }
+ private String getLogFile() {
+ return this.logFile;
+ }
+ private String getMemberName() {
+ return this.memberName;
+ }
+ private Integer getPid() {
+ return this.pid;
+ }
+ private String getPort() {
+ return this.port;
+ }
+ private String getStatusDescription() {
+ return this.statusDescription;
+ }
+ private String getStatusMessage() {
+ return this.statusMessage;
+ }
+ private Long getTimestampTime() {
+ return this.timestampTime;
+ }
+ private Long getUptime() {
+ return this.uptime;
+ }
+ private String getWorkingDirectory() {
+ return this.workingDirectory;
+ }
+
+ private String createStatusJson() {
+ final Map<String, Object> map = new HashMap<String, Object>();
+ map.put(ServiceState.JSON_CLASSPATH, getClasspath());
+ map.put(ServiceState.JSON_GEMFIREVERSION, getGemFireVersion());
+ map.put(ServiceState.JSON_HOST, getHost());
+ map.put(ServiceState.JSON_JAVAVERSION, getJavaVersion());
+ map.put(ServiceState.JSON_JVMARGUMENTS, getJvmArguments());
+ map.put(ServiceState.JSON_LOCATION, getServiceLocation());
+ map.put(ServiceState.JSON_LOGFILE, getLogFile());
+ map.put(ServiceState.JSON_MEMBERNAME, getMemberName());
+ map.put(ServiceState.JSON_PID, getPid());
+ map.put(ServiceState.JSON_PORT, getPort());
+ map.put(ServiceState.JSON_STATUS, getStatusDescription());
+ map.put(ServiceState.JSON_STATUSMESSAGE, getStatusMessage());
+ map.put(ServiceState.JSON_TIMESTAMP, getTimestampTime());
+ map.put(ServiceState.JSON_UPTIME, getUptime());
+ map.put(ServiceState.JSON_WORKINGDIRECTORY, getWorkingDirectory());
+ return new GfJsonObject(map).toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java
index c910832..aa7cd76 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java
@@ -20,11 +20,10 @@ import java.util.Properties;
import com.gemstone.gemfire.cache.Cache;
-public class MockServerLauncherCacheProvider
- implements ServerLauncherCacheProvider {
+public class MockServerLauncherCacheProvider implements ServerLauncherCacheProvider {
+
private static Cache cache;
-
public static Cache getCache() {
return cache;
}
@@ -34,8 +33,7 @@ public class MockServerLauncherCacheProvider
}
@Override
- public Cache createCache(Properties gemfireProperties,
- ServerLauncher serverLauncher) {
+ public Cache createCache(Properties gemfireProperties, ServerLauncher serverLauncher) {
return cache;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationJUnitTest.java
deleted file mode 100755
index b61f89d..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationJUnitTest.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static com.googlecode.catchexception.apis.BDDCatchException.when;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.BDDAssertions.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.net.InetAddress;
-import java.util.Properties;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-import com.gemstone.gemfire.distributed.ServerLauncher.Command;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Integration tests for ServerLauncher class. These tests may require file system and/or network I/O.
- */
-@Category(IntegrationTest.class)
-public class ServerLauncherIntegrationJUnitTest {
-
- @Rule
- public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Rule
- public final TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Rule
- public final TestName testName = new TestName();
-
- @Test
- public void testBuildWithManyArguments() throws Exception {
- // given
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // when
- ServerLauncher launcher = new Builder()
- .setCommand(Command.STOP)
- .setAssignBuckets(true)
- .setForce(true)
- .setMemberName("serverOne")
- .setRebalance(true)
- .setServerBindAddress(InetAddress.getLocalHost().getHostAddress())
- .setServerPort(11235)
- .setWorkingDirectory(rootFolder)
- .setCriticalHeapPercentage(90.0f)
- .setEvictionHeapPercentage(75.0f)
- .setMaxConnections(100)
- .setMaxMessageCount(512)
- .setMaxThreads(8)
- .setMessageTimeToLive(120000)
- .setSocketBufferSize(32768)
- .build();
-
- // then
- assertThat(launcher).isNotNull();
- assertThat(launcher.isAssignBuckets()).isTrue();
- assertThat(launcher.isDebugging()).isFalse();
- assertThat(launcher.isDisableDefaultServer()).isFalse();
- assertThat(launcher.isForcing()).isTrue();
- assertThat(launcher.isHelping()).isFalse();
- assertThat(launcher.isRebalancing()).isTrue();
- assertThat(launcher.isRunning()).isFalse();
- assertThat(launcher.getCommand()).isEqualTo(Command.STOP);
- assertThat(launcher.getMemberName()).isEqualTo("serverOne");
- assertThat(launcher.getServerBindAddress()).isEqualTo(InetAddress.getLocalHost());
- assertThat(launcher.getServerPort().intValue()).isEqualTo(11235);
- assertThat(launcher.getWorkingDirectory()).isEqualTo(rootFolder);
- assertThat(launcher.getCriticalHeapPercentage().floatValue()).isEqualTo(90.0f);
- assertThat(launcher.getEvictionHeapPercentage().floatValue()).isEqualTo(75.0f);
- assertThat(launcher.getMaxConnections().intValue()).isEqualTo(100);
- assertThat(launcher.getMaxMessageCount().intValue()).isEqualTo(512);
- assertThat(launcher.getMaxThreads().intValue()).isEqualTo(8);
- assertThat(launcher.getMessageTimeToLive().intValue()).isEqualTo(120000);
- assertThat(launcher.getSocketBufferSize().intValue()).isEqualTo(32768);
- }
-
- @Test
- public void testBuilderParseArgumentsWithValuesSeparatedWithCommas() throws Exception {
- // given a new builder and a directory
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
- Builder builder = new Builder();
-
- // when: parsing many arguments
- builder.parseArguments(
- "start",
- "serverOne",
- "--assign-buckets",
- "--disable-default-server",
- "--debug",
- "--force",
- "--rebalance",
- "--redirect-output",
- "--dir", rootFolder,
- "--pid", "1234",
- "--server-bind-address", InetAddress.getLocalHost().getHostAddress(),
- "--server-port", "11235",
- "--hostname-for-clients", "192.168.99.100");
-
- // then: the getters should return properly parsed values
- assertThat(builder.getCommand()).isEqualTo(Command.START);
- assertThat(builder.getMemberName()).isEqualTo("serverOne");
- assertThat(builder.getHostNameForClients()).isEqualTo("192.168.99.100");
- assertThat(builder.getAssignBuckets()).isTrue();
- assertThat(builder.getDisableDefaultServer()).isTrue();
- assertThat(builder.getDebug()).isTrue();
- assertThat(builder.getForce()).isTrue();
- assertThat(builder.getHelp()).isFalse();
- assertThat(builder.getRebalance()).isTrue();
- assertThat(builder.getRedirectOutput()).isTrue();
- assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
- assertThat(builder.getPid().intValue()).isEqualTo(1234);
- assertThat(builder.getServerBindAddress()).isEqualTo(InetAddress.getLocalHost());
- assertThat(builder.getServerPort().intValue()).isEqualTo(11235);
- }
-
- @Test
- public void testBuilderParseArgumentsWithValuesSeparatedWithEquals() throws Exception {
- // given a new builder and a directory
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
- Builder builder = new Builder();
-
- // when: parsing many arguments
- builder.parseArguments(
- "start",
- "serverOne",
- "--assign-buckets",
- "--disable-default-server",
- "--debug",
- "--force",
- "--rebalance",
- "--redirect-output",
- "--dir=" + rootFolder,
- "--pid=1234",
- "--server-bind-address=" + InetAddress.getLocalHost().getHostAddress(),
- "--server-port=11235",
- "--hostname-for-clients=192.168.99.100");
-
- // then: the getters should return properly parsed values
- assertThat(builder.getCommand()).isEqualTo(Command.START);
- assertThat(builder.getMemberName()).isEqualTo("serverOne");
- assertThat(builder.getHostNameForClients()).isEqualTo("192.168.99.100");
- assertThat(builder.getAssignBuckets()).isTrue();
- assertThat(builder.getDisableDefaultServer()).isTrue();
- assertThat(builder.getDebug()).isTrue();
- assertThat(builder.getForce()).isTrue();
- assertThat(builder.getHelp()).isFalse();
- assertThat(builder.getRebalance()).isTrue();
- assertThat(builder.getRedirectOutput()).isTrue();
- assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
- assertThat(builder.getPid().intValue()).isEqualTo(1234);
- assertThat(builder.getServerBindAddress()).isEqualTo(InetAddress.getLocalHost());
- assertThat(builder.getServerPort().intValue()).isEqualTo(11235);
- }
-
- @Test
- public void testBuildWithMemberNameSetInGemFirePropertiesOnStart() throws Exception {
- // given: gemfire.properties with a name
- Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty(DistributionConfig.NAME_NAME, "server123");
- useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", gemfireProperties);
-
- // when: starting with null MemberName
- ServerLauncher launcher = new Builder()
- .setCommand(Command.START)
- .setMemberName(null)
- .build();
-
- // then: name in gemfire.properties file should be used for MemberName
- assertThat(launcher).isNotNull();
- assertThat(launcher.getCommand()).isEqualTo(Command.START);
- assertThat(launcher.getMemberName()).isNull();
- }
-
- @Test
- public void testBuildWithNoMemberNameOnStart() throws Exception {
- // given: gemfire.properties with no name
- useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", new Properties());
-
- // when: no MemberName is specified
- when(new Builder()
- .setCommand(Command.START))
- .build();
-
- // then: throw IllegalStateException
- then(caughtException())
- .isExactlyInstanceOf(IllegalStateException.class)
- .hasMessage(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Server"));
- }
-
- @Test
- public void testBuilderSetAndGetWorkingDirectory() throws Exception {
- // given: a new builder and a directory
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
- Builder builder = new Builder();
-
- // when: not setting WorkingDirectory
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(ServerLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to null
- assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to empty string
- assertThat(builder.setWorkingDirectory("")).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to white space
- assertThat(builder.setWorkingDirectory(" ")).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
-
- // when: setting WorkingDirectory to a directory
- assertThat(builder.setWorkingDirectory(rootFolder)).isSameAs(builder);
- // then: getWorkingDirectory returns that directory
- assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
-
- // when: setting WorkingDirectory to null (again)
- assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
- // then: getWorkingDirectory returns default
- assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
- }
-
- @Test
- public void testBuilderSetWorkingDirectoryToFile() throws Exception {
- // given: a file instead of a directory
- File tmpFile = this.temporaryFolder.newFile();
-
- // when: setting WorkingDirectory to that file
- when(new Builder())
- .setWorkingDirectory(tmpFile.getAbsolutePath());
-
- // then: throw IllegalArgumentException
- then(caughtException())
- .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Server"))
- .hasCause(new FileNotFoundException(tmpFile.getAbsolutePath()));
- }
-
- @Test
- public void testBuildSetWorkingDirectoryToNonCurrentDirectoryOnStart() throws Exception {
- // given: using ServerLauncher in-process
-
- // when: setting WorkingDirectory to non-current directory
- when(new Builder()
- .setCommand(Command.START)
- .setMemberName("serverOne")
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()))
- .build();
-
- // then: throw IllegalStateException
- then(caughtException())
- .isExactlyInstanceOf(IllegalStateException.class)
- .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE.toLocalizedString("Server"));
- }
-
- @Test
- public void testBuilderSetWorkingDirectoryToNonExistingDirectory() {
- // when: setting WorkingDirectory to non-existing directory
- when(new Builder())
- .setWorkingDirectory("/path/to/non_existing/directory");
-
- // then: throw IllegalArgumentException
- then(caughtException())
- .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Server"))
- .hasCause(new FileNotFoundException("/path/to/non_existing/directory"));
- }
-
- /**
- * Creates a gemfire properties file in temporaryFolder:
- * <li>creates <code>fileName</code> in <code>temporaryFolder</code>
- * <li>sets "gemfirePropertyFile" system property
- * <li>writes <code>gemfireProperties</code> to the file
- */
- private void useGemFirePropertiesFileInTemporaryFolder(final String fileName, final Properties gemfireProperties) throws Exception {
- File propertiesFile = new File(this.temporaryFolder.getRoot().getCanonicalPath(), fileName);
- System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, propertiesFile.getCanonicalPath());
-
- gemfireProperties.store(new FileWriter(propertiesFile, false), this.testName.getMethodName());
- assertThat(propertiesFile.isFile()).isTrue();
- assertThat(propertiesFile.exists()).isTrue();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java
new file mode 100755
index 0000000..34d613d
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherIntegrationTest.java
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static com.googlecode.catchexception.apis.BDDCatchException.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.BDDAssertions.then;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.net.InetAddress;
+import java.util.Properties;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+import com.gemstone.gemfire.distributed.ServerLauncher.Command;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for ServerLauncher class. These tests may require file system and/or network I/O.
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherIntegrationTest {
+
+ @Rule
+ public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Rule
+ public final TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ @Test
+ public void testBuildWithManyArguments() throws Exception {
+ // given
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // when
+ ServerLauncher launcher = new Builder()
+ .setCommand(Command.STOP)
+ .setAssignBuckets(true)
+ .setForce(true)
+ .setMemberName("serverOne")
+ .setRebalance(true)
+ .setServerBindAddress(InetAddress.getLocalHost().getHostAddress())
+ .setServerPort(11235)
+ .setWorkingDirectory(rootFolder)
+ .setCriticalHeapPercentage(90.0f)
+ .setEvictionHeapPercentage(75.0f)
+ .setMaxConnections(100)
+ .setMaxMessageCount(512)
+ .setMaxThreads(8)
+ .setMessageTimeToLive(120000)
+ .setSocketBufferSize(32768)
+ .build();
+
+ // then
+ assertThat(launcher).isNotNull();
+ assertThat(launcher.isAssignBuckets()).isTrue();
+ assertThat(launcher.isDebugging()).isFalse();
+ assertThat(launcher.isDisableDefaultServer()).isFalse();
+ assertThat(launcher.isForcing()).isTrue();
+ assertThat(launcher.isHelping()).isFalse();
+ assertThat(launcher.isRebalancing()).isTrue();
+ assertThat(launcher.isRunning()).isFalse();
+ assertThat(launcher.getCommand()).isEqualTo(Command.STOP);
+ assertThat(launcher.getMemberName()).isEqualTo("serverOne");
+ assertThat(launcher.getServerBindAddress()).isEqualTo(InetAddress.getLocalHost());
+ assertThat(launcher.getServerPort().intValue()).isEqualTo(11235);
+ assertThat(launcher.getWorkingDirectory()).isEqualTo(rootFolder);
+ assertThat(launcher.getCriticalHeapPercentage().floatValue()).isEqualTo(90.0f);
+ assertThat(launcher.getEvictionHeapPercentage().floatValue()).isEqualTo(75.0f);
+ assertThat(launcher.getMaxConnections().intValue()).isEqualTo(100);
+ assertThat(launcher.getMaxMessageCount().intValue()).isEqualTo(512);
+ assertThat(launcher.getMaxThreads().intValue()).isEqualTo(8);
+ assertThat(launcher.getMessageTimeToLive().intValue()).isEqualTo(120000);
+ assertThat(launcher.getSocketBufferSize().intValue()).isEqualTo(32768);
+ }
+
+ @Test
+ public void testBuilderParseArgumentsWithValuesSeparatedWithCommas() throws Exception {
+ // given a new builder and a directory
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+ Builder builder = new Builder();
+
+ // when: parsing many arguments
+ builder.parseArguments(
+ "start",
+ "serverOne",
+ "--assign-buckets",
+ "--disable-default-server",
+ "--debug",
+ "--force",
+ "--rebalance",
+ "--redirect-output",
+ "--dir", rootFolder,
+ "--pid", "1234",
+ "--server-bind-address", InetAddress.getLocalHost().getHostAddress(),
+ "--server-port", "11235",
+ "--hostname-for-clients", "192.168.99.100");
+
+ // then: the getters should return properly parsed values
+ assertThat(builder.getCommand()).isEqualTo(Command.START);
+ assertThat(builder.getMemberName()).isEqualTo("serverOne");
+ assertThat(builder.getHostNameForClients()).isEqualTo("192.168.99.100");
+ assertThat(builder.getAssignBuckets()).isTrue();
+ assertThat(builder.getDisableDefaultServer()).isTrue();
+ assertThat(builder.getDebug()).isTrue();
+ assertThat(builder.getForce()).isTrue();
+ assertThat(builder.getHelp()).isFalse();
+ assertThat(builder.getRebalance()).isTrue();
+ assertThat(builder.getRedirectOutput()).isTrue();
+ assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
+ assertThat(builder.getPid().intValue()).isEqualTo(1234);
+ assertThat(builder.getServerBindAddress()).isEqualTo(InetAddress.getLocalHost());
+ assertThat(builder.getServerPort().intValue()).isEqualTo(11235);
+ }
+
+ @Test
+ public void testBuilderParseArgumentsWithValuesSeparatedWithEquals() throws Exception {
+ // given a new builder and a directory
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+ Builder builder = new Builder();
+
+ // when: parsing many arguments
+ builder.parseArguments(
+ "start",
+ "serverOne",
+ "--assign-buckets",
+ "--disable-default-server",
+ "--debug",
+ "--force",
+ "--rebalance",
+ "--redirect-output",
+ "--dir=" + rootFolder,
+ "--pid=1234",
+ "--server-bind-address=" + InetAddress.getLocalHost().getHostAddress(),
+ "--server-port=11235",
+ "--hostname-for-clients=192.168.99.100");
+
+ // then: the getters should return properly parsed values
+ assertThat(builder.getCommand()).isEqualTo(Command.START);
+ assertThat(builder.getMemberName()).isEqualTo("serverOne");
+ assertThat(builder.getHostNameForClients()).isEqualTo("192.168.99.100");
+ assertThat(builder.getAssignBuckets()).isTrue();
+ assertThat(builder.getDisableDefaultServer()).isTrue();
+ assertThat(builder.getDebug()).isTrue();
+ assertThat(builder.getForce()).isTrue();
+ assertThat(builder.getHelp()).isFalse();
+ assertThat(builder.getRebalance()).isTrue();
+ assertThat(builder.getRedirectOutput()).isTrue();
+ assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
+ assertThat(builder.getPid().intValue()).isEqualTo(1234);
+ assertThat(builder.getServerBindAddress()).isEqualTo(InetAddress.getLocalHost());
+ assertThat(builder.getServerPort().intValue()).isEqualTo(11235);
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInGemFirePropertiesOnStart() throws Exception {
+ // given: gemfire.properties with a name
+ Properties gemfireProperties = new Properties();
+ gemfireProperties.setProperty(DistributionConfig.NAME_NAME, "server123");
+ useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", gemfireProperties);
+
+ // when: starting with null MemberName
+ ServerLauncher launcher = new Builder()
+ .setCommand(Command.START)
+ .setMemberName(null)
+ .build();
+
+ // then: name in gemfire.properties file should be used for MemberName
+ assertThat(launcher).isNotNull();
+ assertThat(launcher.getCommand()).isEqualTo(Command.START);
+ assertThat(launcher.getMemberName()).isNull();
+ }
+
+ @Test
+ public void testBuildWithNoMemberNameOnStart() throws Exception {
+ // given: gemfire.properties with no name
+ useGemFirePropertiesFileInTemporaryFolder("gemfire.properties", new Properties());
+
+ // when: no MemberName is specified
+ when(new Builder()
+ .setCommand(Command.START))
+ .build();
+
+ // then: throw IllegalStateException
+ then(caughtException())
+ .isExactlyInstanceOf(IllegalStateException.class)
+ .hasMessage(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Server"));
+ }
+
+ @Test
+ public void testBuilderSetAndGetWorkingDirectory() throws Exception {
+ // given: a new builder and a directory
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+ Builder builder = new Builder();
+
+ // when: not setting WorkingDirectory
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(ServerLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to null
+ assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to empty string
+ assertThat(builder.setWorkingDirectory("")).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to white space
+ assertThat(builder.setWorkingDirectory(" ")).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+
+ // when: setting WorkingDirectory to a directory
+ assertThat(builder.setWorkingDirectory(rootFolder)).isSameAs(builder);
+ // then: getWorkingDirectory returns that directory
+ assertThat(builder.getWorkingDirectory()).isEqualTo(rootFolder);
+
+ // when: setting WorkingDirectory to null (again)
+ assertThat(builder.setWorkingDirectory(null)).isSameAs(builder);
+ // then: getWorkingDirectory returns default
+ assertThat(builder.getWorkingDirectory()).isEqualTo(AbstractLauncher.DEFAULT_WORKING_DIRECTORY);
+ }
+
+ @Test
+ public void testBuilderSetWorkingDirectoryToFile() throws Exception {
+ // given: a file instead of a directory
+ File tmpFile = this.temporaryFolder.newFile();
+
+ // when: setting WorkingDirectory to that file
+ when(new Builder())
+ .setWorkingDirectory(tmpFile.getAbsolutePath());
+
+ // then: throw IllegalArgumentException
+ then(caughtException())
+ .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Server"))
+ .hasCause(new FileNotFoundException(tmpFile.getAbsolutePath()));
+ }
+
+ @Test
+ public void testBuildSetWorkingDirectoryToNonCurrentDirectoryOnStart() throws Exception {
+ // given: using ServerLauncher in-process
+
+ // when: setting WorkingDirectory to non-current directory
+ when(new Builder()
+ .setCommand(Command.START)
+ .setMemberName("serverOne")
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()))
+ .build();
+
+ // then: throw IllegalStateException
+ then(caughtException())
+ .isExactlyInstanceOf(IllegalStateException.class)
+ .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE.toLocalizedString("Server"));
+ }
+
+ @Test
+ public void testBuilderSetWorkingDirectoryToNonExistingDirectory() {
+ // when: setting WorkingDirectory to non-existing directory
+ when(new Builder())
+ .setWorkingDirectory("/path/to/non_existing/directory");
+
+ // then: throw IllegalArgumentException
+ then(caughtException())
+ .hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Server"))
+ .hasCause(new FileNotFoundException("/path/to/non_existing/directory"));
+ }
+
+ /**
+ * Creates a gemfire properties file in temporaryFolder:
+ * <li>creates <code>fileName</code> in <code>temporaryFolder</code>
+ * <li>sets "gemfirePropertyFile" system property
+ * <li>writes <code>gemfireProperties</code> to the file
+ */
+ private void useGemFirePropertiesFileInTemporaryFolder(final String fileName, final Properties gemfireProperties) throws Exception {
+ File propertiesFile = new File(this.temporaryFolder.getRoot().getCanonicalPath(), fileName);
+ System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, propertiesFile.getCanonicalPath());
+
+ gemfireProperties.store(new FileWriter(propertiesFile, false), this.testName.getMethodName());
+ assertThat(propertiesFile.isFile()).isTrue();
+ assertThat(propertiesFile.exists()).isTrue();
+ }
+}
[33/37] incubator-geode git commit: Merge remote-tracking branch
'origin/develop' into feature/GEODE-1276
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
index 0000000,25e9528..ac331e2
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
@@@ -1,0 -1,898 +1,894 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.junit.Assert.*;
+
+ import java.io.IOException;
+ import java.net.InetAddress;
+ import java.net.UnknownHostException;
+ import java.util.Collections;
+ import java.util.concurrent.atomic.AtomicBoolean;
+
+ import edu.umd.cs.mtc.MultithreadedTestCase;
+ import edu.umd.cs.mtc.TestFramework;
+ import org.jmock.Expectations;
+ import org.jmock.Mockery;
+ import org.jmock.lib.concurrent.Synchroniser;
+ import org.jmock.lib.legacy.ClassImposteriser;
+ import org.junit.After;
+ import org.junit.Before;
+ import org.junit.Rule;
+ import org.junit.Test;
+ import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+ import org.junit.experimental.categories.Category;
+ import org.junit.rules.TestName;
+
+ import com.gemstone.gemfire.cache.Cache;
+ import com.gemstone.gemfire.cache.server.CacheServer;
+ import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+ import com.gemstone.gemfire.distributed.ServerLauncher.Command;
+ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+ import com.gemstone.gemfire.distributed.support.DistributedSystemAdapter;
+ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+ import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+ /**
+ * The ServerLauncherTest class is a test suite of unit tests testing the contract, functionality and invariants
+ * of the ServerLauncher class.
+ *
+ * @see com.gemstone.gemfire.distributed.ServerLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Command
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since 7.0
+ */
+ @SuppressWarnings({"deprecation", "unused"})
+ @Category(UnitTest.class)
+ public class ServerLauncherTest {
+
+ private Mockery mockContext;
+
+ @Rule
+ public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ @Before
+ public void setup() {
+ mockContext = new Mockery() {{
+ setImposteriser(ClassImposteriser.INSTANCE);
+ setThreadingPolicy(new Synchroniser());
+ }};
+ }
+
+ @After
+ public void tearDown() {
+ mockContext.assertIsSatisfied();
+ mockContext = null;
+ }
+
+ @Test
+ public void testParseCommand() {
+ Builder builder = new Builder();
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+
+ builder.parseCommand((String[]) null);
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+
+ builder.parseCommand(); // empty String array
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+
+ builder.parseCommand(Command.START.getName());
+
+ assertEquals(Command.START, builder.getCommand());
+
+ builder.parseCommand("Status");
+
+ assertEquals(Command.STATUS, builder.getCommand());
+
+ builder.parseCommand("sToP");
+
+ assertEquals(Command.STOP, builder.getCommand());
+
+ builder.parseCommand("--opt", "START", "-o", Command.STATUS.getName());
+
+ assertEquals(Command.START, builder.getCommand());
+
+ builder.setCommand(null);
+ builder.parseCommand("badCommandName", "--start", "stat");
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ }
+
+ @Test
+ public void testParseMemberName() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName((String[]) null);
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName(); // empty String array
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName(Command.START.getName(), "--opt", "-o");
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName("memberOne");
+
+ assertEquals("memberOne", builder.getMemberName());
+ }
+
+ @Test
+ public void testSetAndGetCommand() {
+ Builder builder = new Builder();
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ assertSame(builder, builder.setCommand(Command.STATUS));
+ assertEquals(Command.STATUS, builder.getCommand());
+ assertSame(builder, builder.setCommand(null));
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ }
+
+ @Test
+ public void testSetAndGetMemberName() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMemberName());
+ assertSame(builder, builder.setMemberName("serverOne"));
+ assertEquals("serverOne", builder.getMemberName());
+ assertSame(builder, builder.setMemberName(null));
+ assertNull(builder.getMemberName());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameToBlankString() {
+ try {
+ new Builder().setMemberName(" ");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameToEmptyString() {
+ try {
+ new Builder().setMemberName("");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetPid() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getPid());
+ assertSame(builder, builder.setPid(0));
+ assertEquals(0, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(1));
+ assertEquals(1, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(1024));
+ assertEquals(1024, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(12345));
+ assertEquals(12345, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(null));
+ assertNull(builder.getPid());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetPidToInvalidValue() {
+ try {
+ new Builder().setPid(-1);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_PID_ERROR_MESSAGE.toLocalizedString(), expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetServerBindAddress() throws Exception {
+ Builder builder = new Builder();
+
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(null));
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(""));
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(" "));
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(InetAddress.getLocalHost().getCanonicalHostName()));
+ assertEquals(InetAddress.getLocalHost(), builder.getServerBindAddress());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerBindAddressToUnknownHost() {
+ try {
+ new Builder().setServerBindAddress("badHostName.badCompany.com");
+ }
+ catch (IllegalArgumentException expected) {
+ final String expectedMessage1 = LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString("Server");
+ final String expectedMessage2 = "badHostName.badCompany.com is not an address for this machine.";
+ assertTrue(expected.getMessage().equals(expectedMessage1) || expected.getMessage().equals(expectedMessage2));
+ if (expected.getMessage().equals(expectedMessage1)) {
+ assertTrue(expected.getCause() instanceof UnknownHostException);
+ }
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerBindAddressToNonLocalHost() {
+ try {
+ new Builder().setServerBindAddress("yahoo.com");
+ }
+ catch (IllegalArgumentException expected) {
+ final String expectedMessage = "yahoo.com is not an address for this machine.";
+ assertEquals(expectedMessage, expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetServerBindAddressToLocalHost() throws Exception {
+ String host = InetAddress.getLocalHost().getHostName();
+ new Builder().setServerBindAddress(host);
+ }
+
+ @Test
+ public void testSetAndGetHostnameForClients() {
+ final Builder builder = new Builder();
+
+ assertNull(builder.getHostNameForClients());
+ assertSame(builder, builder.setHostNameForClients("Pegasus"));
+ assertEquals("Pegasus", builder.getHostNameForClients());
+ assertSame(builder, builder.setHostNameForClients(null));
+ assertNull(builder.getHostNameForClients());
+ }
+
+ @Test
+ public void testSetAndGetServerPort() {
+ Builder builder = new Builder();
+
+ assertEquals(ServerLauncher.DEFAULT_SERVER_PORT, builder.getServerPort());
+ assertSame(builder, builder.setServerPort(0));
+ assertEquals(0, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(1));
+ assertEquals(1, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(80));
+ assertEquals(80, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(1024));
+ assertEquals(1024, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(65535));
+ assertEquals(65535, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(null));
+ assertEquals(ServerLauncher.DEFAULT_SERVER_PORT, builder.getServerPort());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerPortToOverflow() {
+ try {
+ new Builder().setServerPort(65536);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerPortToUnderflow() {
+ try {
+ new Builder().setServerPort(-1);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetCriticalHeapPercentage() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getCriticalHeapPercentage());
+ assertSame(builder, builder.setCriticalHeapPercentage(55.5f));
+ assertEquals(55.5f, builder.getCriticalHeapPercentage().floatValue(), 0.0f);
+ assertSame(builder, builder.setCriticalHeapPercentage(null));
+ assertNull(builder.getCriticalHeapPercentage());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetCriticalHeapPercentageToOverflow() {
+ try {
+ new Builder().setCriticalHeapPercentage(100.01f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Critical heap percentage (100.01) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetCriticalHeapPercentageToUnderflow() {
+ try {
+ new Builder().setCriticalHeapPercentage(-0.01f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Critical heap percentage (-0.01) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetEvictionHeapPercentage() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getEvictionHeapPercentage());
+ assertSame(builder, builder.setEvictionHeapPercentage(55.55f));
+ assertEquals(55.55f, builder.getEvictionHeapPercentage().floatValue(), 0.0f);
+ assertSame(builder, builder.setEvictionHeapPercentage(null));
+ assertNull(builder.getEvictionHeapPercentage());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetEvictionHeapPercentageToOverflow() {
+ try {
+ new Builder().setEvictionHeapPercentage(101.0f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Eviction heap percentage (101.0) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetEvictionHeapPercentageToUnderflow() {
+ try {
+ new Builder().setEvictionHeapPercentage(-10.0f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Eviction heap percentage (-10.0) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMaxConnections() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMaxConnections());
+ assertSame(builder, builder.setMaxConnections(1000));
+ assertEquals(1000, builder.getMaxConnections().intValue());
+ assertSame(builder, builder.setMaxConnections(null));
+ assertNull(builder.getMaxConnections());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMaxConnectionsWithIllegalValue() {
+ try {
+ new Builder().setMaxConnections(-10);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Max Connections (-10) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMaxMessageCount() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMaxMessageCount());
+ assertSame(builder, builder.setMaxMessageCount(50));
+ assertEquals(50, builder.getMaxMessageCount().intValue());
+ assertSame(builder, builder.setMaxMessageCount(null));
+ assertNull(builder.getMaxMessageCount());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMaxMessageCountWithIllegalValue() {
+ try {
+ new Builder().setMaxMessageCount(0);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Max Message Count (0) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMaxThreads() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMaxThreads());
+ assertSame(builder, builder.setMaxThreads(16));
+ assertEquals(16, builder.getMaxThreads().intValue());
+ assertSame(builder, builder.setMaxThreads(null));
+ assertNull(builder.getMaxThreads());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMaxThreadsWithIllegalValue() {
+ try {
+ new Builder().setMaxThreads(-4);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Max Threads (-4) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMessageTimeToLive() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMessageTimeToLive());
+ assertSame(builder, builder.setMessageTimeToLive(30000));
+ assertEquals(30000, builder.getMessageTimeToLive().intValue());
+ assertSame(builder, builder.setMessageTimeToLive(null));
+ assertNull(builder.getMessageTimeToLive());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMessageTimeToLiveWithIllegalValue() {
+ try {
+ new Builder().setMessageTimeToLive(0);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Message Time To Live (0) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetSocketBufferSize() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getSocketBufferSize());
+ assertSame(builder, builder.setSocketBufferSize(32768));
+ assertEquals(32768, builder.getSocketBufferSize().intValue());
+ assertSame(builder, builder.setSocketBufferSize(null));
+ assertNull(builder.getSocketBufferSize());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetSocketBufferSizeWithIllegalValue() {
+ try {
+ new Builder().setSocketBufferSize(-8192);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("The Server's Socket Buffer Size (-8192) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
+ ServerLauncher launcher = new Builder()
+ .setCommand(ServerLauncher.Command.START)
+ .setMemberName(null)
+ .set(DistributionConfig.NAME_NAME, "serverABC")
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(ServerLauncher.Command.START, launcher.getCommand());
+ assertNull(launcher.getMemberName());
+ assertEquals("serverABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME));
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
+ System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "serverXYZ");
+
+ ServerLauncher launcher = new Builder()
+ .setCommand(ServerLauncher.Command.START)
+ .setMemberName(null)
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(ServerLauncher.Command.START, launcher.getCommand());
+ assertNull(launcher.getMemberName());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testBuildNoMemberNameOnStart() {
+ try {
+ new Builder().setCommand(Command.START).build();
+ }
+ catch (IllegalStateException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testIsServing() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.singletonList(mockCacheServer)));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertTrue(serverLauncher.isServing(mockCache));
+ }
+
+ @Test
+ public void testIsServingWhenNoCacheServersExist() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isServing(mockCache));
+ }
+
+ @Test
+ public void reconnectedCacheIsDiscovered() throws Exception {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final Cache mockReconnectedCache = mockContext.mock(Cache.class, "ReconnectedCache");
+
+ mockContext.checking(new Expectations() {{
+ exactly(2).of(mockCache).isReconnecting();
+ will(returnValue(Boolean.FALSE));
+
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+
+ oneOf(mockCache).isReconnecting();
+ will(returnValue(Boolean.TRUE));
+
+ oneOf(mockCache).getReconnectedCache();
+ will(returnValue(mockReconnectedCache));
+
+ oneOf(mockReconnectedCache).close();
+
+ }});
+
+ final ServerLauncher serverLauncher =
+ new Builder()
+ .setMemberName("serverOne")
+ .setCache(mockCache)
+ .build();
+
+ assertNotNull(serverLauncher);
+ serverLauncher.waitOnServer();
+ }
+
+ @Test
+ public void reconnectingDistributedSystemIsDisconnectedOnStop() throws Exception {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
+ final Cache mockReconnectedCache = mockContext.mock(Cache.class, "ReconnectedCache");
+
+ mockContext.checking(new Expectations() {{
+ exactly(1).of(mockCache).isReconnecting();
+ will(returnValue(Boolean.TRUE));
+
+ exactly(1).of(mockCache).getReconnectedCache();
+ will(returnValue(mockReconnectedCache));
+
+ exactly(2).of(mockReconnectedCache).isReconnecting();
+ will(returnValue(Boolean.TRUE));
+
+ exactly(1).of(mockReconnectedCache).getReconnectedCache();
+ will(returnValue(null));
+
+ oneOf(mockReconnectedCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+
+ oneOf(mockDistributedSystem).stopReconnecting();
+
+ oneOf(mockReconnectedCache).close();
+ }});
+
+ final ServerLauncher serverLauncher =
+ new Builder()
+ .setMemberName("serverOne")
+ .setCache(mockCache)
+ .build();
+
+ assertNotNull(serverLauncher);
+ serverLauncher.setIsRunningForTest();
+ serverLauncher.stop();
+ }
+
+ @Test
+ public void testIsWaiting() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+ oneOf(mockDistributedSystem).isConnected();
+ will(returnValue(true));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+
+ serverLauncher.running.set(true);
+
+ assertTrue(serverLauncher.isRunning());
+ assertTrue(serverLauncher.isWaiting(mockCache));
+ }
+
+ @Test
+ public void testIsWaitingWhenNotConnected() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+ oneOf(mockDistributedSystem).isConnected();
+ will(returnValue(false));
+ oneOf(mockCache).isReconnecting();
+ will(returnValue(Boolean.FALSE));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+
+ serverLauncher.running.set(true);
+
+ assertTrue(serverLauncher.isRunning());
+ assertFalse(serverLauncher.isWaiting(mockCache));
+ }
+
+ @Test
+ public void testIsWaitingWhenNotRunning() {
+ ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+
+ serverLauncher.running.set(false);
+
+ assertFalse(serverLauncher.isRunning());
+ assertFalse(serverLauncher.isWaiting(null));
+ }
+
+ @Test
+ public void testWaitOnServer() throws Throwable {
+ TestFramework.runOnce(new ServerWaitMultiThreadedTestCase());
+ }
+
+ @Test
+ public void testIsDefaultServerEnabled() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+ assertTrue(serverLauncher.isDefaultServerEnabled(mockCache));
+ }
+
+ @Test
+ public void testIsDefaultServerEnabledWhenCacheServersExist() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.singletonList(mockCacheServer)));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+ assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
+ }
++
+ @Test
+ public void testIsDefaultServerEnabledWhenNoCacheServersExistAndDefaultServerDisabled() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertTrue(serverLauncher.isDisableDefaultServer());
+ assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
+ }
+
+ @Test
+ public void testStartCacheServer() throws IOException {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ oneOf(mockCache).addCacheServer();
+ will(returnValue(mockCacheServer));
+ oneOf(mockCacheServer).setBindAddress(with(aNull(String.class)));
+ oneOf(mockCacheServer).setPort(with(equal(11235)));
+ oneOf(mockCacheServer).start();
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne")
+ .setServerBindAddress(null)
+ .setServerPort(11235)
+ .setDisableDefaultServer(false)
+ .build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+
+ serverLauncher.startCacheServer(mockCache);
+ }
+
+ @Test
+ public void testStartCacheServerWhenDefaultServerDisabled() throws IOException {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertTrue(serverLauncher.isDisableDefaultServer());
+
+ serverLauncher.startCacheServer(mockCache);
+ }
+
+ @Test
+ public void testStartCacheServerWithExistingCacheServer() throws IOException {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.singletonList(mockCacheServer)));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+
+ serverLauncher.startCacheServer(mockCache);
+ }
+
- public static void main(final String... args) {
- System.err.printf("Thread (%1$s) is daemon (%2$s)%n", Thread.currentThread().getName(),
- Thread.currentThread().isDaemon());
- new Builder(args).setCommand(Command.START).build().run();
- }
-
+ private final class ServerWaitMultiThreadedTestCase extends MultithreadedTestCase {
+
+ private final AtomicBoolean connectionStateHolder = new AtomicBoolean(true);
+
+ private ServerLauncher serverLauncher;
+
+ @Override
+ public void initialize() {
+ super.initialize();
+
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ final DistributedSystem mockDistributedSystem = new DistributedSystemAdapter() {
- @Override public boolean isConnected() {
++ @Override
++ public boolean isConnected() {
+ return connectionStateHolder.get();
+ }
+ };
+
+ mockContext.checking(new Expectations() {{
+ allowing(mockCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+ allowing(mockCache).isReconnecting();
+ will(returnValue(Boolean.FALSE));
+ allowing(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ oneOf(mockCache).close();
+ }});
+
+ this.serverLauncher = new Builder().setMemberName("dataMember").setDisableDefaultServer(true)
+ .setCache(mockCache).build();
+
+ assertNotNull(this.serverLauncher);
+ assertEquals("dataMember", this.serverLauncher.getMemberName());
+ assertTrue(this.serverLauncher.isDisableDefaultServer());
+ assertTrue(connectionStateHolder.get());
+ }
+
+ public void thread1() {
+ assertTick(0);
+
+ Thread.currentThread().setName("GemFire Data Member 'main' Thread");
+ this.serverLauncher.running.set(true);
+
+ assertTrue(this.serverLauncher.isRunning());
+ assertFalse(this.serverLauncher.isServing(this.serverLauncher.getCache()));
+ assertTrue(this.serverLauncher.isWaiting(this.serverLauncher.getCache()));
+
+ this.serverLauncher.waitOnServer();
+
+ assertTick(1); // NOTE the tick does not advance when the other Thread terminates
+ }
+
+ public void thread2() {
+ waitForTick(1);
+
+ Thread.currentThread().setName("GemFire 'shutdown' Thread");
+
+ assertTrue(this.serverLauncher.isRunning());
+
+ this.connectionStateHolder.set(false);
+ }
+
+ @Override
+ public void finish() {
+ super.finish();
+ assertFalse(this.serverLauncher.isRunning());
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
----------------------------------------------------------------------
[29/37] incubator-geode git commit: GEODE-1255: Adding missing
@Category annotations
Posted by kl...@apache.org.
GEODE-1255: Adding missing @Category annotations
DeployCommandsDUnitTest and HostedLocatorsDUnitTest were missing
categories.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8fcd9c0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8fcd9c0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8fcd9c0e
Branch: refs/heads/feature/GEODE-1276
Commit: 8fcd9c0e6beafe2b12ecfc0ca126179e5c77750d
Parents: 9666129
Author: Dan Smith <up...@apache.org>
Authored: Thu May 5 16:50:42 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 5 17:12:51 2016 -0700
----------------------------------------------------------------------
.../com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java | 3 +++
.../management/internal/cli/commands/DeployCommandsDUnitTest.java | 3 +++
2 files changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fcd9c0e/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
index 1e5c8b0..042e896 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
@@ -28,6 +28,7 @@ import java.util.Set;
import java.util.concurrent.Callable;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
@@ -41,12 +42,14 @@ import com.gemstone.gemfire.internal.util.StopWatch;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Extracted from LocatorLauncherLocalIntegrationTest.
*
* @since 8.0
*/
+@Category(DistributedTest.class)
public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase {
protected static final int TIMEOUT_MILLISECONDS = 5 * 60 * 1000; // 5 minutes
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fcd9c0e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
index 88e7b30..7d1a7ff 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DeployCommandsDUnitTest.java
@@ -25,6 +25,7 @@ import java.util.Properties;
import java.util.regex.Pattern;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -45,6 +46,7 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Unit tests for the DeployCommands class
@@ -52,6 +54,7 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
* @since 7.0
*/
@SuppressWarnings("serial")
+@Category(DistributedTest.class)
public class DeployCommandsDUnitTest extends CliCommandTestBase {
private final Pattern pattern = Pattern.compile("^" + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit.*#\\d++$");
[30/37] incubator-geode git commit: GEODE-641: Adding default methods
to the Function interface
Posted by kl...@apache.org.
GEODE-641: Adding default methods to the Function interface
Adding default methods to Function so that Function is now a functional
interface and lambda expressions can be used for functions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/15a2a29d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/15a2a29d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/15a2a29d
Branch: refs/heads/feature/GEODE-1276
Commit: 15a2a29d996c60831ec67bb8f565660950e67a29
Parents: 8fcd9c0
Author: Dan Smith <up...@apache.org>
Authored: Wed Apr 27 17:53:18 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 5 17:17:01 2016 -0700
----------------------------------------------------------------------
.../gemfire/cache/execute/Function.java | 17 +++-
.../gemfire/cache/execute/FunctionAdapter.java | 87 +-------------------
.../cache/execute/FunctionAdapterJUnitTest.java | 65 +++++++++++++++
3 files changed, 80 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/15a2a29d/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/Function.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/Function.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/Function.java
index 553248e..f32fcad 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/Function.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/Function.java
@@ -35,6 +35,7 @@ import com.gemstone.gemfire.lang.Identifiable;
*
* @since 6.0
*/
+@FunctionalInterface
public interface Function extends Identifiable<String> {
/**
@@ -53,7 +54,9 @@ public interface Function extends Identifiable<String> {
* @return whether this function returns a Result back to the caller.
* @since 6.0
*/
- public boolean hasResult();
+ public default boolean hasResult() {
+ return true;
+ }
/**
* The method which contains the logic to be executed. This method should be
@@ -75,7 +78,9 @@ public interface Function extends Identifiable<String> {
* @return string identifying this function
* @since 6.0
*/
- public String getId();
+ public default String getId() {
+ return getClass().getCanonicalName();
+ }
/**
* <p>Return true to indicate to GemFire the method
@@ -94,7 +99,9 @@ public interface Function extends Identifiable<String> {
* @since 6.0
* @see FunctionService
*/
- public boolean optimizeForWrite();
+ public default boolean optimizeForWrite() {
+ return false;
+ }
/**
* Specifies whether the function is eligible for re-execution (in case of
@@ -105,6 +112,8 @@ public interface Function extends Identifiable<String> {
*
* @since 6.5
*/
- public boolean isHA();
+ public default boolean isHA() {
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/15a2a29d/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionAdapter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionAdapter.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionAdapter.java
index c4cfeed..674120c 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionAdapter.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionAdapter.java
@@ -32,92 +32,9 @@ package com.gemstone.gemfire.cache.execute;
*
* @since 6.0
* @see Function
+ * @deprecated Use {@link Function} instead. Function has default
+ * methods that now mimic the behavior of FunctionAdapter.
*
*/
public abstract class FunctionAdapter implements Function {
- /**
- * The method which contains the logic to be executed. This method should be
- * thread safe and may be invoked more than once on a given member for a
- * single {@link Execution}. The context provided to this function is the one
- * which was built using {@linkplain Execution}. The contexts can be data
- * dependent or data-independent so user should check to see if the context
- * provided in parameter is instance of {@link RegionFunctionContext}.
- *
- * @param context
- * as created by {@link Execution}
- * @since 6.0
- */
- public abstract void execute(FunctionContext context);
-
- /**
- * Return a unique function identifier, used to register the function with
- * {@link FunctionService}
- *
- * @return string identifying this function
- * @since 6.0
- */
- public abstract String getId();
-
- /**
- * Specifies whether the function sends results while executing. The method
- * returns false if no result is expected.<br>
- * <p>
- * If {@link Function#hasResult()} returns false,
- * {@link ResultCollector#getResult()} throws {@link FunctionException}.
- * </p>
- * <p>
- * If {@link Function#hasResult()} returns true,
- * {@link ResultCollector#getResult()} blocks and waits for the result of
- * function execution
- * </p>
- *
- * @return whether this function returns a Result back to the caller.
- * @since 6.0
- */
- public boolean hasResult() {
- return true;
- }
-
- /**
- * <p>
- * Return true to indicate to GemFire the method requires optimization for
- * writing the targeted
- * {@link FunctionService#onRegion(com.gemstone.gemfire.cache.Region)} and any
- * associated {@linkplain Execution#withFilter(java.util.Set) routing objects}
- * .
- * </p>
- *
- * <p>
- * Returning false will optimize for read behavior on the targeted
- * {@link FunctionService#onRegion(com.gemstone.gemfire.cache.Region)} and any
- * associated {@linkplain Execution#withFilter(java.util.Set) routing objects}
- * .
- * </p>
- *
- * <p>
- * This method is only consulted when invoked as a
- * {@linkplain FunctionService#onRegion(com.gemstone.gemfire.cache.Region)
- * data dependent function}
- * </p>
- *
- * @return false if the function is read only, otherwise returns true
- * @since 6.0
- * @see FunctionService
- */
- public boolean optimizeForWrite() {
- return false;
- }
-
- /**
- * Specifies whether the function is eligible for re-execution (in case of
- * failure).
- *
- * @return whether the function is eligible for re-execution.
- * @see RegionFunctionContext#isPossibleDuplicate()
- *
- * @since 6.5
- */
- public boolean isHA() {
- return true;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/15a2a29d/geode-core/src/test/java/com/gemstone/gemfire/cache/execute/FunctionAdapterJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/execute/FunctionAdapterJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/execute/FunctionAdapterJUnitTest.java
new file mode 100644
index 0000000..6bb5aeb
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/execute/FunctionAdapterJUnitTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class FunctionAdapterJUnitTest {
+
+ private FunctionAdapter adapter;
+
+ @Before
+ public void createDefaultAdapter() {
+ adapter = new MyFunctionAdapter();
+ }
+
+ @Test
+ public void optimizeForWriteDefaultsFalse() {
+ assertFalse(adapter.optimizeForWrite());
+ }
+
+ @Test
+ public void idDefaultsToClassName() {
+ assertEquals(MyFunctionAdapter.class.getCanonicalName(), adapter.getId());
+ }
+
+ @Test
+ public void hasResultDefaultsTrue() {
+ assertTrue(adapter.hasResult());
+
+ }
+
+ @Test
+ public void isHADefaultsTrue() {
+ assertTrue(adapter.isHA());
+ }
+
+ private static class MyFunctionAdapter extends FunctionAdapter {
+
+ @Override
+ public void execute(final FunctionContext context) {
+ }
+
+ }
+}
[09/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
deleted file mode 100755
index 056e6ce..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
+++ /dev/null
@@ -1,1430 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
-import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
-import com.gemstone.gemfire.internal.logging.InternalLogWriter;
-import com.gemstone.gemfire.internal.logging.LocalLogWriter;
-import com.gemstone.gemfire.internal.process.PidUnavailableException;
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.internal.process.ProcessStreamReader;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.gemstone.gemfire.test.process.ProcessWrapper;
-
-/**
- * Integration tests for launching a Server in a forked process.
- *
- * @see com.gemstone.gemfire.distributed.AbstractLauncher
- * @see com.gemstone.gemfire.distributed.ServerLauncher
- * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
- * @see com.gemstone.gemfire.distributed.ServerLauncher.ServerState
- * @see com.gemstone.gemfire.internal.AvailablePortHelper
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTestCase {
-
- protected volatile Process process;
- protected volatile ProcessStreamReader processOutReader;
- protected volatile ProcessStreamReader processErrReader;
-
- @Before
- public final void setUpServerLauncherRemoteTest() throws Exception {
- }
-
- @After
- public final void tearDownServerLauncherRemoteTest() throws Exception {
- if (this.process != null) {
- this.process.destroy();
- this.process = null;
- }
- if (this.processOutReader != null && this.processOutReader.isRunning()) {
- this.processOutReader.stop();
- }
- if (this.processErrReader != null && this.processErrReader.isRunning()) {
- this.processErrReader.stop();
- }
- }
-
- protected Status getExpectedStopStatusForNotRunning() {
- return Status.NOT_RESPONDING;
- }
-
- @Test
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertTrue(factory.isAttachAPIFound());
- }
-
- @Test
- @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
- public void testRunningServerOutlivesForkingProcess() throws Throwable {
- // launch ServerLauncherForkingProcess which then launches server
-
-// final List<String> command = new ArrayList<String>();
-// command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
-// command.add("-cp");
-// command.add(System.getProperty("java.class.path"));
-// command.add(ServerLauncherDUnitTest.class.getName().concat("$").concat(ServerLauncherForkingProcess.class.getSimpleName()));
-//
-// process = new ProcessBuilder(command).directory(temporaryFolder.getRoot()).start();
-// assertNotNull(process);
-// processOutReader = new ProcessStreamReader(process.getInputStream(), createListener("sysout", getUniqueName() + "#sysout")).start();
-// processErrReader = new ProcessStreamReader(process.getErrorStream(), createListener("syserr", getUniqueName() + "#syserr")).start();
-
- @SuppressWarnings("unused")
- File file = new File(this.temporaryFolder.getRoot(), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
- //-logger.info("log file is " + file);
-
- final ProcessWrapper pw = new ProcessWrapper.Builder().mainClass(ServerLauncherForkingProcess.class).build();
- pw.execute(null, this.temporaryFolder.getRoot()).waitFor(true);
- //logger.info("[testRunningServerOutlivesForkingProcess] ServerLauncherForkingProcess output is:\n\n"+pw.getOutput());
-
-// // create waiting thread since waitFor does not have a timeout
-// Thread waiting = new Thread(new Runnable() {
-// @Override
-// public void run() {
-// try {
-// assertEquals(0, process.waitFor());
-// } catch (InterruptedException e) {
-// logger.error("Interrupted while waiting for process", e);
-// }
-// }
-// });
-
-// // start waiting thread and join to it for timeout
-// try {
-// waiting.start();
-// waiting.join(TIMEOUT_MILLISECONDS);
-// assertFalse("ServerLauncherForkingProcess took too long and caused timeout", waiting.isAlive());
-//
-// } catch (Throwable e) {
-// logger.error(e);
-// if (failure == null) {
-// failure = e;
-// }
-// } finally {
-// if (waiting.isAlive()) {
-// waiting.interrupt();
-// }
-// }
-
- // wait for server to start
- int pid = 0;
- final String serverName = ServerLauncherForkingProcess.class.getSimpleName()+"_server";
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart(dirLauncher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = serverName+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // validate the status
- final ServerState actualStatus = dirLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
- assertEquals(getJvmArguments(), actualStatus.getJvmArguments());
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + serverName + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(serverName, actualStatus.getMemberName());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartCreatesPidFile() throws Throwable {
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // check the status
- final ServerState serverState = this.launcher.status();
- assertNotNull(serverState);
- assertEquals(Status.ONLINE, serverState.getStatus());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartDeletesStaleControlFiles() throws Throwable {
- // create existing control files
- this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
- this.stopRequestFile.createNewFile();
- assertTrue(this.stopRequestFile.exists());
-
- this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
- this.statusRequestFile.createNewFile();
- assertTrue(this.statusRequestFile.exists());
-
- this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
- this.statusFile.createNewFile();
- assertTrue(this.statusFile.exists());
-
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate stale control files were deleted
- waitForFileToDelete(this.stopRequestFile);
- waitForFileToDelete(this.statusRequestFile);
- waitForFileToDelete(this.statusFile);
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-721: random ports (setup overriding default port), TemporaryFolder
- @Test
- public void testStartOverwritesStalePidFile() throws Throwable {
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- writePid(this.pidFile, Integer.MAX_VALUE);
-
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertFalse(pid == Integer.MAX_VALUE);
-
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms fix for #47778.
- */
- @Test
- public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
- assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
- jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // verify server did not a port
- assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- final ServerState status = this.launcher.status();
- final String portString = status.getPort();
- assertEquals("Port should be \"\" instead of " + portString, "", portString);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
- // make serverPort in use
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
- jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- final ServerState status = this.launcher.status();
- final String portString = status.getPort();
- assertEquals("Port should be \"\" instead of " + portString, "", portString);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // verify port is still in use
- this.errorCollector.checkThat(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET), is(equalTo(false)));
- }
-
- @Category(FlakyTest.class) // GEODE-764: random ports, BindException, forks JVM, uses ErrorCollector
- @Test
- public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- final int otherPid = getPid();
- assertTrue("Pid " + otherPid + " should be alive", ProcessUtils.isProcessAlive(otherPid));
- writePid(this.pidFile, otherPid);
-
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
- command.add("--force");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertTrue(pid != otherPid);
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms fix for #47665.
- */
- @Test
- public void testStartUsingServerPortInUseFails() throws Throwable {
- // make serverPort in use
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--redirect-output");
- command.add("--server-port=" + this.serverPort);
-
- String expectedString = "java.net.BindException";
- AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
-
- // wait for server to start and fail
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- int code = this.process.waitFor();
- assertEquals("Expected exit code 1 but was " + code, 1, code);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // check the status
- final ServerState serverState = dirLauncher.status();
- assertNotNull(serverState);
- assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
-
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines
- // or this test needs to use MainLauncher in ProcessWrapper
-
- // validate that output contained BindException
- this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
-
- // just in case the launcher started...
- ServerState status = null;
- try {
- status = dirLauncher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms part of fix for #47664
- */
- @Test
- public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
- // generate two free ports
- final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-
- // write out cache.xml with one port
- final CacheCreation creation = new CacheCreation();
- final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
- attrs.setScope(Scope.DISTRIBUTED_ACK);
- attrs.setDataPolicy(DataPolicy.REPLICATE);
- creation.createRegion(getUniqueName(), attrs);
- creation.addCacheServer().setPort(freeTCPPorts[0]);
-
- File cacheXmlFile = new File(this.temporaryFolder.getRoot(), getUniqueName()+".xml");
- final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
- CacheXmlGenerator.generate(creation, pw);
- pw.close();
-
- // launch server and specify a different port
- final List<String> jvmArguments = getJvmArguments();
- jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath());
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--redirect-output");
- command.add("--server-port=" + freeTCPPorts[1]);
-
- String expectedString = "java.net.BindException";
- AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
-
- // wait for server to start up
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // verify server used --server-port instead of default or port in cache.xml
- assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
- assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
-
- ServerState status = this.launcher.status();
- String portString = status.getPort();
- int port = Integer.valueOf(portString);
- assertEquals("Port should be " + freeTCPPorts[1] + " instead of " + port, freeTCPPorts[1], port);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- waitForFileToDelete(this.pidFile);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- /**
- * Confirms part of fix for #47664
- */
- @Test
- public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
- // write out cache.xml with one port
- final CacheCreation creation = new CacheCreation();
- final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
- attrs.setScope(Scope.DISTRIBUTED_ACK);
- attrs.setDataPolicy(DataPolicy.REPLICATE);
- creation.createRegion(getUniqueName(), attrs);
- creation.addCacheServer();
-
- File cacheXmlFile = new File(this.temporaryFolder.getRoot(), getUniqueName()+".xml");
- final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
- CacheXmlGenerator.generate(creation, pw);
- pw.close();
-
- // launch server and specify a different port
- final List<String> jvmArguments = getJvmArguments();
- jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath());
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--redirect-output");
- command.add("--server-port=" + this.serverPort);
-
- final String expectedString = "java.net.BindException";
- final AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
-
- // wait for server to start up
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // verify server used --server-port instead of default or port in cache.xml
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- final ServerState status = this.launcher.status();
- final String portString = status.getPort();
- int port = Integer.valueOf(portString);
- assertEquals("Port should be " + this.serverPort + " instead of " + port, this.serverPort, port);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Category(FlakyTest.class) // GEODE-1135: random ports, BindException, fork JVM
- @Test
- public void testStartWithDefaultPortInUseFails() throws Throwable {
- String expectedString = "java.net.BindException";
- AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
-
- // make serverPort in use
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
- assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
-
- // launch server
- final List<String> jvmArguments = getJvmArguments();
- jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
-
- // wait for server to start up
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- int code = this.process.waitFor();
- assertEquals("Expected exit code 1 but was " + code, 1, code);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // check the status
- final ServerState serverState = dirLauncher.status();
- assertNotNull(serverState);
- assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
-
- // creation of log file seems to be random -- look into why sometime
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines
- // or this test needs to use MainLauncher in ProcessWrapper
-
- // validate that output contained BindException
- this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
-
- // just in case the launcher started...
- ServerState status = null;
- try {
- status = dirLauncher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- @Ignore("Need to rewrite this without using dunit.Host")
- public void testStartWithExistingPidFileFails() throws Throwable {
- }/*
- this.temporaryFolder.getRoot() = new File(getUniqueName());
- this.temporaryFolder.getRoot().mkdir();
- assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
-
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
- assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
- writePid(this.pidFile, realPid);
-
- // build and start the server
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // collect and throw the FIRST failure
- Throwable failure = null;
-
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart(dirLauncher, 10*1000, false);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- try {
- // check the status
- final ServerState serverState = dirLauncher.status();
- assertNotNull(serverState);
- assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
-
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- // just in case the launcher started...
- ServerState status = null;
- try {
- status = dirLauncher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- final Status theStatus = status.getStatus();
- assertFalse(theStatus == Status.STARTING);
- assertFalse(theStatus == Status.ONLINE);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- if (failure != null) {
- throw failure;
- }
- } // testStartWithExistingPidFileFails
- */
-
- @Category(FlakyTest.class) // GEODE-957: random ports, BindException, fork JVM
- @Test
- public void testStatusUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- ServerLauncher pidLauncher = null;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // validate the status
- final ServerState actualStatus = pidLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
- assertEquals(jvmArguments, actualStatus.getJvmArguments());
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- if (pidLauncher == null) {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- } else {
- assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
- }
- waitForPidToStop(pid);
- waitForFileToDelete(this.pidFile);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStatusUsingWorkingDirectory() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- assertNotNull(this.launcher);
- assertFalse(this.launcher.isRunning());
-
- // validate the status
- final ServerState actualStatus = this.launcher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
- assertEquals(jvmArguments, actualStatus.getJvmArguments());
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStatusWithEmptyPidFile() throws Exception {
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile());
-
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- final ServerState actualStatus = dirLauncher.status();
- assertThat(actualStatus, is(notNullValue()));
- assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
- assertThat(actualStatus.getPid(), is(nullValue()));
- assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
- assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
- assertThat(actualStatus.getClasspath(), is(nullValue()));
- assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
- assertThat(actualStatus.getJavaVersion(), is(nullValue()));
- assertThat(actualStatus.getLogFile(), is(nullValue()));
- assertThat(actualStatus.getHost(), is(nullValue()));
- assertThat(actualStatus.getMemberName(), is(nullValue()));
- }
-
- @Test
- public void testStatusWithNoPidFile() throws Exception {
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- ServerState serverState = dirLauncher.status();
- assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
- }
-
- @Test
- public void testStatusWithStalePidFile() throws Exception {
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- final int pid = 0;
- assertFalse(ProcessUtils.isProcessAlive(pid));
- writePid(this.pidFile, pid);
-
- final ServerLauncher dirLauncher = new ServerLauncher.Builder()
- .setWorkingDirectory(temporaryFolder.getRoot().getCanonicalPath())
- .build();
- final ServerState actualStatus = dirLauncher.status();
- assertThat(actualStatus, is(notNullValue()));
- assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
- assertThat(actualStatus.getPid(), is(nullValue()));
- assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
- assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
- assertThat(actualStatus.getClasspath(), is(nullValue()));
- assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
- assertThat(actualStatus.getJavaVersion(), is(nullValue()));
- assertThat(actualStatus.getLogFile(), is(nullValue()));
- assertThat(actualStatus.getHost(), is(nullValue()));
- assertThat(actualStatus.getMemberName(), is(nullValue()));
- }
-
- @Test
- public void testStopUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
-
- // wait for server to start
- int pid = 0;
- ServerLauncher pidLauncher = null;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // validate the status
- final ServerState status = pidLauncher.status();
- assertNotNull(status);
- assertEquals(Status.ONLINE, status.getStatus());
- assertEquals(pid, status.getPid().intValue());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the server
- try {
- if (pidLauncher == null) {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- } else {
- assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
- }
- waitForPidToStop(pid);
- waitForFileToDelete(this.pidFile);
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStopUsingWorkingDirectory() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for server to start
- int pid = 0;
- this.launcher = new ServerLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForServerToStart();
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
- assertTrue(this.pidFile.exists());
- pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // stop the server
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForPidToStop(pid);
- assertFalse("PID file still exists!", this.pidFile.exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- protected void waitForServerToStart() throws Exception {
- assertEventuallyTrue("waiting for local Server to start: " + launcher.status(), new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- try {
- assertNotNull(process);
- try {
- final int value = process.exitValue();
- fail("Process has died with exit value " + value + " while waiting for it to start.");
- } catch (IllegalThreadStateException e) {
- // expected
- }
- final ServerState serverState = launcher.status();
- assertNotNull(serverState);
- logger.info("serverState: "+serverState);
- return Status.ONLINE.equals(serverState.getStatus());
- }
- catch (RuntimeException e) {
- logger.error(e, e);
- return false;
- }
- }
- }, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS);
- }
-
- protected static List<String> getJvmArguments() {
- final List<String> jvmArguments = new ArrayList<String>();
- jvmArguments.add("-Dgemfire.log-level=config");
- jvmArguments.add("-Dgemfire.mcast-port=0");
- return jvmArguments;
- }
-
- /**
- * Used only by {@link ServerLauncherRemoteJUnitTest#testRunningServerOutlivesForkingProcess}
- */
- public static class ServerLauncherForkingProcess {
-
- public static void main(final String... args) throws IOException, PidUnavailableException {
- //-System.out.println("inside main");
- File file = new File(System.getProperty("user.dir"), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
- file.createNewFile();
- LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
- //LogWriter logWriter = new PureLogWriter(LogWriterImpl.ALL_LEVEL);
- logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main PID is " + getPid());
-
- try {
- // launch ServerLauncher
- final List<String> jvmArguments = getJvmArguments();
- assertTrue(jvmArguments.size() == 2);
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(ServerLauncher.class.getName());
- command.add(ServerLauncher.Command.START.getName());
- command.add(ServerLauncherForkingProcess.class.getSimpleName()+"_server");
- command.add("--disable-default-server");
- command.add("--redirect-output");
-
- logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
- logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main starting...");
-
- //-System.out.println("launching " + command);
-
- @SuppressWarnings("unused")
- Process forkedProcess = new ProcessBuilder(command).start();
-
-// processOutReader = new ProcessStreamReader(forkedProcess.getInputStream()).start();
-// processErrReader = new ProcessStreamReader(forkedProcess.getErrorStream()).start();
-
-// logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main waiting for Server to start...");
-//
-// File workingDir = new File(System.getProperty("user.dir"));
-// System.out.println("waiting for server to start in " + workingDir);
-// final ServerLauncher dirLauncher = new ServerLauncher.Builder()
-// .setWorkingDirectory(workingDir.getCanonicalPath())
-// .build();
-// waitForServerToStart(dirLauncher, true);
-
- logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
-
- //-System.out.println("exiting");
- System.exit(0);
- }
- catch (Throwable t) {
- logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t);
- System.exit(-1);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteWithCustomLoggingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteWithCustomLoggingIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteWithCustomLoggingIntegrationTest.java
new file mode 100644
index 0000000..d6bfe82
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteWithCustomLoggingIntegrationTest.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static com.gemstone.gemfire.internal.logging.log4j.custom.CustomConfiguration.*;
+import static org.assertj.core.api.Assertions.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for launching a Server in a forked process with custom logging configuration
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherRemoteWithCustomLoggingIntegrationTest extends AbstractServerLauncherRemoteIntegrationTestCase {
+
+ private File customConfigFile;
+
+ @Rule
+ public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+ @Before
+ public void setUpLocatorLauncherRemoteWithCustomLoggingIntegrationTest() throws Exception {
+ this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());
+ }
+
+ @Test
+ public void testStartUsesCustomLoggingConfiguration() throws Throwable {
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-D" + ConfigurationFactory.CONFIGURATION_FILE_PROPERTY + "=" + this.customConfigFile.getCanonicalPath());
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(new File(this.workingDirectory)).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(new ToSystemOut()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(new ToSystemOut()).build().start();
+
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // check the status
+ final ServerLauncher.ServerState serverState = this.launcher.status();
+ assertNotNull(serverState);
+ assertEquals(AbstractLauncher.Status.ONLINE, serverState.getStatus());
+
+ assertThat(systemOutRule.getLog()).contains("log4j.configurationFile = " + this.customConfigFile.getCanonicalPath());
+ assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(AbstractLauncher.Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ private static class ToSystemOut implements ProcessStreamReader.InputListener {
+ @Override
+ public void notifyInputLine(String line) {
+ System.out.println(line);
+ }
+ }
+}
[08/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
new file mode 100755
index 0000000..25e9528
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherTest.java
@@ -0,0 +1,898 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import edu.umd.cs.mtc.MultithreadedTestCase;
+import edu.umd.cs.mtc.TestFramework;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.concurrent.Synchroniser;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+import com.gemstone.gemfire.distributed.ServerLauncher.Command;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.support.DistributedSystemAdapter;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The ServerLauncherTest class is a test suite of unit tests testing the contract, functionality and invariants
+ * of the ServerLauncher class.
+ *
+ * @see com.gemstone.gemfire.distributed.ServerLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Command
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since 7.0
+ */
+@SuppressWarnings({"deprecation", "unused"})
+@Category(UnitTest.class)
+public class ServerLauncherTest {
+
+ private Mockery mockContext;
+
+ @Rule
+ public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ @Before
+ public void setup() {
+ mockContext = new Mockery() {{
+ setImposteriser(ClassImposteriser.INSTANCE);
+ setThreadingPolicy(new Synchroniser());
+ }};
+ }
+
+ @After
+ public void tearDown() {
+ mockContext.assertIsSatisfied();
+ mockContext = null;
+ }
+
+ @Test
+ public void testParseCommand() {
+ Builder builder = new Builder();
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+
+ builder.parseCommand((String[]) null);
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+
+ builder.parseCommand(); // empty String array
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+
+ builder.parseCommand(Command.START.getName());
+
+ assertEquals(Command.START, builder.getCommand());
+
+ builder.parseCommand("Status");
+
+ assertEquals(Command.STATUS, builder.getCommand());
+
+ builder.parseCommand("sToP");
+
+ assertEquals(Command.STOP, builder.getCommand());
+
+ builder.parseCommand("--opt", "START", "-o", Command.STATUS.getName());
+
+ assertEquals(Command.START, builder.getCommand());
+
+ builder.setCommand(null);
+ builder.parseCommand("badCommandName", "--start", "stat");
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ }
+
+ @Test
+ public void testParseMemberName() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName((String[]) null);
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName(); // empty String array
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName(Command.START.getName(), "--opt", "-o");
+
+ assertNull(builder.getMemberName());
+
+ builder.parseMemberName("memberOne");
+
+ assertEquals("memberOne", builder.getMemberName());
+ }
+
+ @Test
+ public void testSetAndGetCommand() {
+ Builder builder = new Builder();
+
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ assertSame(builder, builder.setCommand(Command.STATUS));
+ assertEquals(Command.STATUS, builder.getCommand());
+ assertSame(builder, builder.setCommand(null));
+ assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
+ }
+
+ @Test
+ public void testSetAndGetMemberName() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMemberName());
+ assertSame(builder, builder.setMemberName("serverOne"));
+ assertEquals("serverOne", builder.getMemberName());
+ assertSame(builder, builder.setMemberName(null));
+ assertNull(builder.getMemberName());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameToBlankString() {
+ try {
+ new Builder().setMemberName(" ");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameToEmptyString() {
+ try {
+ new Builder().setMemberName("");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetPid() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getPid());
+ assertSame(builder, builder.setPid(0));
+ assertEquals(0, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(1));
+ assertEquals(1, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(1024));
+ assertEquals(1024, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(12345));
+ assertEquals(12345, builder.getPid().intValue());
+ assertSame(builder, builder.setPid(null));
+ assertNull(builder.getPid());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetPidToInvalidValue() {
+ try {
+ new Builder().setPid(-1);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_PID_ERROR_MESSAGE.toLocalizedString(), expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetServerBindAddress() throws Exception {
+ Builder builder = new Builder();
+
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(null));
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(""));
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(" "));
+ assertNull(builder.getServerBindAddress());
+ assertSame(builder, builder.setServerBindAddress(InetAddress.getLocalHost().getCanonicalHostName()));
+ assertEquals(InetAddress.getLocalHost(), builder.getServerBindAddress());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerBindAddressToUnknownHost() {
+ try {
+ new Builder().setServerBindAddress("badHostName.badCompany.com");
+ }
+ catch (IllegalArgumentException expected) {
+ final String expectedMessage1 = LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString("Server");
+ final String expectedMessage2 = "badHostName.badCompany.com is not an address for this machine.";
+ assertTrue(expected.getMessage().equals(expectedMessage1) || expected.getMessage().equals(expectedMessage2));
+ if (expected.getMessage().equals(expectedMessage1)) {
+ assertTrue(expected.getCause() instanceof UnknownHostException);
+ }
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerBindAddressToNonLocalHost() {
+ try {
+ new Builder().setServerBindAddress("yahoo.com");
+ }
+ catch (IllegalArgumentException expected) {
+ final String expectedMessage = "yahoo.com is not an address for this machine.";
+ assertEquals(expectedMessage, expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetServerBindAddressToLocalHost() throws Exception {
+ String host = InetAddress.getLocalHost().getHostName();
+ new Builder().setServerBindAddress(host);
+ }
+
+ @Test
+ public void testSetAndGetHostnameForClients() {
+ final Builder builder = new Builder();
+
+ assertNull(builder.getHostNameForClients());
+ assertSame(builder, builder.setHostNameForClients("Pegasus"));
+ assertEquals("Pegasus", builder.getHostNameForClients());
+ assertSame(builder, builder.setHostNameForClients(null));
+ assertNull(builder.getHostNameForClients());
+ }
+
+ @Test
+ public void testSetAndGetServerPort() {
+ Builder builder = new Builder();
+
+ assertEquals(ServerLauncher.DEFAULT_SERVER_PORT, builder.getServerPort());
+ assertSame(builder, builder.setServerPort(0));
+ assertEquals(0, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(1));
+ assertEquals(1, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(80));
+ assertEquals(80, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(1024));
+ assertEquals(1024, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(65535));
+ assertEquals(65535, builder.getServerPort().intValue());
+ assertSame(builder, builder.setServerPort(null));
+ assertEquals(ServerLauncher.DEFAULT_SERVER_PORT, builder.getServerPort());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerPortToOverflow() {
+ try {
+ new Builder().setServerPort(65536);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetServerPortToUnderflow() {
+ try {
+ new Builder().setServerPort(-1);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetCriticalHeapPercentage() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getCriticalHeapPercentage());
+ assertSame(builder, builder.setCriticalHeapPercentage(55.5f));
+ assertEquals(55.5f, builder.getCriticalHeapPercentage().floatValue(), 0.0f);
+ assertSame(builder, builder.setCriticalHeapPercentage(null));
+ assertNull(builder.getCriticalHeapPercentage());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetCriticalHeapPercentageToOverflow() {
+ try {
+ new Builder().setCriticalHeapPercentage(100.01f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Critical heap percentage (100.01) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetCriticalHeapPercentageToUnderflow() {
+ try {
+ new Builder().setCriticalHeapPercentage(-0.01f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Critical heap percentage (-0.01) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetEvictionHeapPercentage() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getEvictionHeapPercentage());
+ assertSame(builder, builder.setEvictionHeapPercentage(55.55f));
+ assertEquals(55.55f, builder.getEvictionHeapPercentage().floatValue(), 0.0f);
+ assertSame(builder, builder.setEvictionHeapPercentage(null));
+ assertNull(builder.getEvictionHeapPercentage());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetEvictionHeapPercentageToOverflow() {
+ try {
+ new Builder().setEvictionHeapPercentage(101.0f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Eviction heap percentage (101.0) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetEvictionHeapPercentageToUnderflow() {
+ try {
+ new Builder().setEvictionHeapPercentage(-10.0f);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Eviction heap percentage (-10.0) must be between 0 and 100!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMaxConnections() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMaxConnections());
+ assertSame(builder, builder.setMaxConnections(1000));
+ assertEquals(1000, builder.getMaxConnections().intValue());
+ assertSame(builder, builder.setMaxConnections(null));
+ assertNull(builder.getMaxConnections());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMaxConnectionsWithIllegalValue() {
+ try {
+ new Builder().setMaxConnections(-10);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Max Connections (-10) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMaxMessageCount() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMaxMessageCount());
+ assertSame(builder, builder.setMaxMessageCount(50));
+ assertEquals(50, builder.getMaxMessageCount().intValue());
+ assertSame(builder, builder.setMaxMessageCount(null));
+ assertNull(builder.getMaxMessageCount());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMaxMessageCountWithIllegalValue() {
+ try {
+ new Builder().setMaxMessageCount(0);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Max Message Count (0) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMaxThreads() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMaxThreads());
+ assertSame(builder, builder.setMaxThreads(16));
+ assertEquals(16, builder.getMaxThreads().intValue());
+ assertSame(builder, builder.setMaxThreads(null));
+ assertNull(builder.getMaxThreads());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMaxThreadsWithIllegalValue() {
+ try {
+ new Builder().setMaxThreads(-4);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Max Threads (-4) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetMessageTimeToLive() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getMessageTimeToLive());
+ assertSame(builder, builder.setMessageTimeToLive(30000));
+ assertEquals(30000, builder.getMessageTimeToLive().intValue());
+ assertSame(builder, builder.setMessageTimeToLive(null));
+ assertNull(builder.getMessageTimeToLive());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMessageTimeToLiveWithIllegalValue() {
+ try {
+ new Builder().setMessageTimeToLive(0);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("Message Time To Live (0) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testSetAndGetSocketBufferSize() {
+ Builder builder = new Builder();
+
+ assertNull(builder.getSocketBufferSize());
+ assertSame(builder, builder.setSocketBufferSize(32768));
+ assertEquals(32768, builder.getSocketBufferSize().intValue());
+ assertSame(builder, builder.setSocketBufferSize(null));
+ assertNull(builder.getSocketBufferSize());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetSocketBufferSizeWithIllegalValue() {
+ try {
+ new Builder().setSocketBufferSize(-8192);
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("The Server's Socket Buffer Size (-8192) must be greater than 0!", expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
+ ServerLauncher launcher = new Builder()
+ .setCommand(ServerLauncher.Command.START)
+ .setMemberName(null)
+ .set(DistributionConfig.NAME_NAME, "serverABC")
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(ServerLauncher.Command.START, launcher.getCommand());
+ assertNull(launcher.getMemberName());
+ assertEquals("serverABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME));
+ }
+
+ @Test
+ public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
+ System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "serverXYZ");
+
+ ServerLauncher launcher = new Builder()
+ .setCommand(ServerLauncher.Command.START)
+ .setMemberName(null)
+ .build();
+
+ assertNotNull(launcher);
+ assertEquals(ServerLauncher.Command.START, launcher.getCommand());
+ assertNull(launcher.getMemberName());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testBuildNoMemberNameOnStart() {
+ try {
+ new Builder().setCommand(Command.START).build();
+ }
+ catch (IllegalStateException expected) {
+ assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
+ @Test
+ public void testIsServing() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.singletonList(mockCacheServer)));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertTrue(serverLauncher.isServing(mockCache));
+ }
+
+ @Test
+ public void testIsServingWhenNoCacheServersExist() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isServing(mockCache));
+ }
+
+ @Test
+ public void reconnectedCacheIsDiscovered() throws Exception {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final Cache mockReconnectedCache = mockContext.mock(Cache.class, "ReconnectedCache");
+
+ mockContext.checking(new Expectations() {{
+ exactly(2).of(mockCache).isReconnecting();
+ will(returnValue(Boolean.FALSE));
+
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+
+ oneOf(mockCache).isReconnecting();
+ will(returnValue(Boolean.TRUE));
+
+ oneOf(mockCache).getReconnectedCache();
+ will(returnValue(mockReconnectedCache));
+
+ oneOf(mockReconnectedCache).close();
+
+ }});
+
+ final ServerLauncher serverLauncher =
+ new Builder()
+ .setMemberName("serverOne")
+ .setCache(mockCache)
+ .build();
+
+ assertNotNull(serverLauncher);
+ serverLauncher.waitOnServer();
+ }
+
+ @Test
+ public void reconnectingDistributedSystemIsDisconnectedOnStop() throws Exception {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
+ final Cache mockReconnectedCache = mockContext.mock(Cache.class, "ReconnectedCache");
+
+ mockContext.checking(new Expectations() {{
+ exactly(1).of(mockCache).isReconnecting();
+ will(returnValue(Boolean.TRUE));
+
+ exactly(1).of(mockCache).getReconnectedCache();
+ will(returnValue(mockReconnectedCache));
+
+ exactly(2).of(mockReconnectedCache).isReconnecting();
+ will(returnValue(Boolean.TRUE));
+
+ exactly(1).of(mockReconnectedCache).getReconnectedCache();
+ will(returnValue(null));
+
+ oneOf(mockReconnectedCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+
+ oneOf(mockDistributedSystem).stopReconnecting();
+
+ oneOf(mockReconnectedCache).close();
+ }});
+
+ final ServerLauncher serverLauncher =
+ new Builder()
+ .setMemberName("serverOne")
+ .setCache(mockCache)
+ .build();
+
+ assertNotNull(serverLauncher);
+ serverLauncher.setIsRunningForTest();
+ serverLauncher.stop();
+ }
+
+ @Test
+ public void testIsWaiting() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+ oneOf(mockDistributedSystem).isConnected();
+ will(returnValue(true));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+
+ serverLauncher.running.set(true);
+
+ assertTrue(serverLauncher.isRunning());
+ assertTrue(serverLauncher.isWaiting(mockCache));
+ }
+
+ @Test
+ public void testIsWaitingWhenNotConnected() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+ oneOf(mockDistributedSystem).isConnected();
+ will(returnValue(false));
+ oneOf(mockCache).isReconnecting();
+ will(returnValue(Boolean.FALSE));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+
+ serverLauncher.running.set(true);
+
+ assertTrue(serverLauncher.isRunning());
+ assertFalse(serverLauncher.isWaiting(mockCache));
+ }
+
+ @Test
+ public void testIsWaitingWhenNotRunning() {
+ ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+
+ serverLauncher.running.set(false);
+
+ assertFalse(serverLauncher.isRunning());
+ assertFalse(serverLauncher.isWaiting(null));
+ }
+
+ @Test
+ public void testWaitOnServer() throws Throwable {
+ TestFramework.runOnce(new ServerWaitMultiThreadedTestCase());
+ }
+
+ @Test
+ public void testIsDefaultServerEnabled() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+ assertTrue(serverLauncher.isDefaultServerEnabled(mockCache));
+ }
+
+ @Test
+ public void testIsDefaultServerEnabledWhenCacheServersExist() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.singletonList(mockCacheServer)));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+ assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
+ }
+ @Test
+ public void testIsDefaultServerEnabledWhenNoCacheServersExistAndDefaultServerDisabled() {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertTrue(serverLauncher.isDisableDefaultServer());
+ assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
+ }
+
+ @Test
+ public void testStartCacheServer() throws IOException {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ oneOf(mockCache).addCacheServer();
+ will(returnValue(mockCacheServer));
+ oneOf(mockCacheServer).setBindAddress(with(aNull(String.class)));
+ oneOf(mockCacheServer).setPort(with(equal(11235)));
+ oneOf(mockCacheServer).start();
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne")
+ .setServerBindAddress(null)
+ .setServerPort(11235)
+ .setDisableDefaultServer(false)
+ .build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+
+ serverLauncher.startCacheServer(mockCache);
+ }
+
+ @Test
+ public void testStartCacheServerWhenDefaultServerDisabled() throws IOException {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertTrue(serverLauncher.isDisableDefaultServer());
+
+ serverLauncher.startCacheServer(mockCache);
+ }
+
+ @Test
+ public void testStartCacheServerWithExistingCacheServer() throws IOException {
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
+
+ mockContext.checking(new Expectations() {{
+ oneOf(mockCache).getCacheServers();
+ will(returnValue(Collections.singletonList(mockCacheServer)));
+ }});
+
+ final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
+
+ assertNotNull(serverLauncher);
+ assertEquals("serverOne", serverLauncher.getMemberName());
+ assertFalse(serverLauncher.isDisableDefaultServer());
+
+ serverLauncher.startCacheServer(mockCache);
+ }
+
+ public static void main(final String... args) {
+ System.err.printf("Thread (%1$s) is daemon (%2$s)%n", Thread.currentThread().getName(),
+ Thread.currentThread().isDaemon());
+ new Builder(args).setCommand(Command.START).build().run();
+ }
+
+ private final class ServerWaitMultiThreadedTestCase extends MultithreadedTestCase {
+
+ private final AtomicBoolean connectionStateHolder = new AtomicBoolean(true);
+
+ private ServerLauncher serverLauncher;
+
+ @Override
+ public void initialize() {
+ super.initialize();
+
+ final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+
+ final DistributedSystem mockDistributedSystem = new DistributedSystemAdapter() {
+ @Override public boolean isConnected() {
+ return connectionStateHolder.get();
+ }
+ };
+
+ mockContext.checking(new Expectations() {{
+ allowing(mockCache).getDistributedSystem();
+ will(returnValue(mockDistributedSystem));
+ allowing(mockCache).isReconnecting();
+ will(returnValue(Boolean.FALSE));
+ allowing(mockCache).getCacheServers();
+ will(returnValue(Collections.emptyList()));
+ oneOf(mockCache).close();
+ }});
+
+ this.serverLauncher = new Builder().setMemberName("dataMember").setDisableDefaultServer(true)
+ .setCache(mockCache).build();
+
+ assertNotNull(this.serverLauncher);
+ assertEquals("dataMember", this.serverLauncher.getMemberName());
+ assertTrue(this.serverLauncher.isDisableDefaultServer());
+ assertTrue(connectionStateHolder.get());
+ }
+
+ public void thread1() {
+ assertTick(0);
+
+ Thread.currentThread().setName("GemFire Data Member 'main' Thread");
+ this.serverLauncher.running.set(true);
+
+ assertTrue(this.serverLauncher.isRunning());
+ assertFalse(this.serverLauncher.isServing(this.serverLauncher.getCache()));
+ assertTrue(this.serverLauncher.isWaiting(this.serverLauncher.getCache()));
+
+ this.serverLauncher.waitOnServer();
+
+ assertTick(1); // NOTE the tick does not advance when the other Thread terminates
+ }
+
+ public void thread2() {
+ waitForTick(1);
+
+ Thread.currentThread().setName("GemFire 'shutdown' Thread");
+
+ assertTrue(this.serverLauncher.isRunning());
+
+ this.connectionStateHolder.set(false);
+ }
+
+ @Override
+ public void finish() {
+ super.finish();
+ assertFalse(this.serverLauncher.isRunning());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java
new file mode 100644
index 0000000..f04c7cf
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderIntegrationTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.Mockito;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Extracted from ServerLauncherLocalIntegrationTest.
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherWithProviderIntegrationTest extends AbstractServerLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpServerLauncherWithSpringTest() throws Exception {
+ disconnectFromDS();
+ System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
+ }
+
+ @After
+ public final void tearDownServerLauncherWithSpringTest() throws Exception {
+ MockServerLauncherCacheProvider.setCache(null);
+ disconnectFromDS();
+
+ }
+
+ // NOTE make sure bugs like Trac #51201 never happen again!!!
+ @Test
+ public void testBootstrapGemFireServerWithProvider() throws Throwable {
+ Cache mockCache = Mockito.mock(Cache.class);
+ MockServerLauncherCacheProvider.setCache(mockCache);
+ this.launcher = new Builder()
+ .setDisableDefaultServer(true)
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setSpringXmlLocation("spring/spring-gemfire-context.xml")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0")
+ .build();
+
+ assertNotNull(this.launcher);
+
+ try {
+ assertEquals(Status.ONLINE, this.launcher.start().getStatus());
+
+ waitForServerToStart(this.launcher);
+
+ Cache cache = this.launcher.getCache();
+
+ assertEquals(mockCache, cache);
+ }
+ catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ assertNull(this.launcher.getCache());
+ }
+ catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderJUnitTest.java
deleted file mode 100644
index 9728485..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithProviderJUnitTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.mockito.Mockito;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Extracted from ServerLauncherLocalJUnitTest.
- *
- */
-@Category(IntegrationTest.class)
-public class ServerLauncherWithProviderJUnitTest extends AbstractServerLauncherJUnitTestCase {
-
- @Before
- public final void setUpServerLauncherWithSpringTest() throws Exception {
- disconnectFromDS();
- System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
- }
-
- @After
- public final void tearDownServerLauncherWithSpringTest() throws Exception {
- MockServerLauncherCacheProvider.setCache(null);
- disconnectFromDS();
-
- }
-
- // NOTE make sure bugs like Trac #51201 never happen again!!!
- @Test
- public void testBootstrapGemFireServerWithProvider() throws Throwable {
- Cache mockCache = Mockito.mock(Cache.class);
- MockServerLauncherCacheProvider.setCache(mockCache);
- this.launcher = new Builder()
- .setDisableDefaultServer(true)
- .setForce(true)
- .setMemberName(getUniqueName())
- .setSpringXmlLocation("spring/spring-gemfire-context.xml")
- .set(DistributionConfig.MCAST_PORT_NAME, "0")
- .build();
-
- assertNotNull(this.launcher);
-
- try {
- assertEquals(Status.ONLINE, this.launcher.start().getStatus());
-
- waitForServerToStart(this.launcher);
-
- Cache cache = this.launcher.getCache();
-
- assertEquals(mockCache, cache);
- }
- catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- assertNull(this.launcher.getCache());
- }
- catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/internal/ClassBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/ClassBuilder.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/ClassBuilder.java
index 780ed4f..97062e5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/ClassBuilder.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/ClassBuilder.java
@@ -40,7 +40,7 @@ import javax.tools.SimpleJavaFileObject;
import javax.tools.ToolProvider;
/**
- * Test framework utility class to programatically create classes, JARs and ClassLoaders that include the classes.
+ * Test framework utility class to programmatically create classes, JARs and ClassLoaders that include the classes.
*
* @since 7.0
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/BasicAppender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/BasicAppender.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/BasicAppender.java
new file mode 100644
index 0000000..0b04379
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/BasicAppender.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.logging.log4j.custom;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.layout.PatternLayout;
+
+@Plugin(name = "Basic", category = "Core", elementType = "appender", printObject = true)
+public class BasicAppender extends AbstractAppender {
+
+ private static volatile BasicAppender instance;
+
+ private final List<LogEvent> events = new ArrayList<>();
+
+ public BasicAppender(final String name, final Filter filter, final Layout<? extends Serializable> layout) {
+ super(name, filter, layout);
+ }
+
+ @PluginFactory
+ public static BasicAppender createAppender(@PluginAttribute("name") String name,
+ @PluginAttribute("ignoreExceptions") boolean ignoreExceptions,
+ @PluginElement("Layout") Layout layout,
+ @PluginElement("Filters") Filter filter) {
+ if (layout == null) {
+ layout = PatternLayout.createDefaultLayout();
+ }
+ instance = new BasicAppender(name, filter, layout);
+ return instance;
+ }
+
+ public static BasicAppender getInstance() {
+ return instance;
+ }
+
+ public static void clearInstance() {
+ instance = null;
+ }
+
+ public static void clearEvents() {
+ instance.events.clear();
+ }
+
+ @Override
+ public void append(final LogEvent event) {
+ this.events.add(event);
+ }
+
+ public List<LogEvent> events() {
+ return this.events;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/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
new file mode 100644
index 0000000..632b69c
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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 org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemErrRule;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+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;
+
+/**
+ * Integration tests with custom log4j2 configuration.
+ */
+@Category(IntegrationTest.class)
+public class CustomConfigWithCacheIntegrationTest {
+
+ private String beforeConfigFileProp;
+ private Level beforeLevel;
+
+ private File customConfigFile;
+ private Cache cache;
+
+ @Rule
+ public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
+
+ @Rule
+ public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Rule
+ public TestName testName = new TestName();
+
+ @Before
+ public void setUp() throws Exception {
+ Configurator.shutdown();
+ BasicAppender.clearInstance();
+
+ this.beforeConfigFileProp = System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+ this.beforeLevel = StatusLogger.getLogger().getLevel();
+
+ this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());
+
+ 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(DistributionConfig.LOG_LEVEL_NAME, "info");
+ this.cache = new CacheFactory(gemfireProperties).create();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (this.cache != null) {
+ this.cache.getDistributedSystem().disconnect();
+ }
+
+ Configurator.shutdown();
+
+ System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+ if (this.beforeConfigFileProp != null) {
+ System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, this.beforeConfigFileProp);
+ }
+ StatusLogger.getLogger().setLevel(this.beforeLevel);
+
+ LogService.reconfigure();
+ assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation()).isTrue();
+
+ BasicAppender.clearInstance();
+
+ assertThat(this.systemErrRule.getLog()).isEmpty();
+ }
+
+ @Test
+ public void cacheLogWriterMessageShouldMatchCustomConfig() throws Exception {
+ String logLogger = LogService.MAIN_LOGGER_NAME;
+ Level logLevel = Level.INFO;
+ String logMessage = "this is a log statement from " + testName.getMethodName();
+
+ LogWriter logger = this.cache.getLogger();
+ assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation()).isFalse();
+
+ BasicAppender.clearEvents();
+
+ logger.info(logMessage);
+
+ BasicAppender appender = BasicAppender.getInstance();
+ assertThat(appender).isNotNull();
+ assertThat(appender.events().size()).isGreaterThan(0);
+
+ LogEvent event = null;
+ for (LogEvent logEvent : appender.events()) {
+ if (logEvent.getMessage().getFormattedMessage().contains(logMessage)) {
+ event = logEvent;
+ break;
+ }
+ }
+
+ assertThat(event).isNotNull();
+
+ assertThat(event.getLoggerName()).isEqualTo(logLogger);
+ assertThat(event.getLevel()).isEqualTo(logLevel);
+ assertThat(event.getMessage().getFormattedMessage()).isEqualTo(logMessage);
+
+ assertThat(systemOutRule.getLog()).contains(logLevel.name());
+ assertThat(systemOutRule.getLog()).contains(logMessage);
+ assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
+ assertThat(systemOutRule.getLog()).containsPattern(defineLogStatementRegex(logLevel, logMessage));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java
new file mode 100644
index 0000000..631f232
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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 org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemErrRule;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.Configurator;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests with custom log4j2 configuration.
+ */
+@Category(IntegrationTest.class)
+public class CustomConfigWithLogServiceIntegrationTest {
+
+ private String beforeConfigFileProp;
+ private Level beforeLevel;
+
+ private File customConfigFile;
+
+ @Rule
+ public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
+
+ @Rule
+ public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Before
+ public void setUp() throws Exception {
+ Configurator.shutdown();
+ BasicAppender.clearInstance();
+
+ this.beforeConfigFileProp = System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+ this.beforeLevel = StatusLogger.getLogger().getLevel();
+
+ this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());
+
+ System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, this.customConfigFile.getAbsolutePath());
+ LogService.reconfigure();
+ assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation()).isFalse();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ Configurator.shutdown();
+
+ System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+ if (this.beforeConfigFileProp != null) {
+ System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, this.beforeConfigFileProp);
+ }
+ StatusLogger.getLogger().setLevel(this.beforeLevel);
+
+ LogService.reconfigure();
+ assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation()).isTrue();
+
+ BasicAppender.clearInstance();
+
+ assertThat(this.systemErrRule.getLog()).isEmpty();
+ }
+
+ @Test
+ public void logEventShouldMatchCustomConfig() throws Exception {
+ String logLogger = getClass().getName();
+ Level logLevel = Level.DEBUG;
+ String logMessage = "this is a log statement";
+
+ Logger logger = LogService.getLogger();
+ logger.debug(logMessage);
+
+ BasicAppender appender = BasicAppender.getInstance();
+ assertThat(appender).isNotNull();
+ assertThat(appender.events()).hasSize(1);
+
+ LogEvent event = appender.events().get(0);
+ assertThat(event.getLoggerName()).isEqualTo(logLogger);
+ assertThat(event.getLevel()).isEqualTo(logLevel);
+ assertThat(event.getMessage().getFormattedMessage()).isEqualTo(logMessage);
+
+ assertThat(systemOutRule.getLog()).contains(logLevel.name());
+ assertThat(systemOutRule.getLog()).contains(logMessage);
+ assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
+ assertThat(systemOutRule.getLog()).matches(defineLogStatementRegex(logLevel, logMessage));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfiguration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfiguration.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfiguration.java
new file mode 100644
index 0000000..05c72d6
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/custom/CustomConfiguration.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.logging.log4j.custom;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.logging.log4j.Level;
+
+public class CustomConfiguration {
+
+ public static final String CONFIG_FILE_NAME = "log4j2-custom.xml";
+ public static final String CONFIG_LAYOUT_PREFIX = "CUSTOM";
+
+ protected CustomConfiguration() {
+ }
+
+ public static URL openConfigResource() {
+ return new CustomConfiguration().getClass().getResource(CONFIG_FILE_NAME);
+ }
+
+ public static File createConfigFileIn(final File targetFolder) throws IOException, URISyntaxException {
+ URL resource = openConfigResource();
+ File targetFile = new File(targetFolder, CONFIG_FILE_NAME);
+ IOUtils.copy(resource.openStream(), new FileOutputStream(targetFile));
+ assertThat(targetFile).hasSameContentAs(new File(resource.toURI()));
+ return targetFile;
+ }
+
+ private static final String DATE = "((?:19|20)\\\\d\\\\d)/(0?[1-9]|1[012])/([12][0-9]|3[01]|0?[1-9])";
+
+ private static final String TIME = "\\b(?<!')([xXzZ])(?!')\\b";
+
+ public static String defineLogStatementRegex(final Level level, final String message) {
+ // CUSTOM: level=%level time=%date{yyyy/MM/dd HH:mm:ss.SSS z} message=%message%nthrowable=%throwable%n
+ return CONFIG_LAYOUT_PREFIX + ": level=" + level.toString() + " time=" + ".*" + " message=" + message + "\nthrowable=\n";
+ }
+
+ public static String defineLogStatementRegex(final Level level, final String message, final String throwable) {
+ // CUSTOM: level=%level time=%date{yyyy/MM/dd HH:mm:ss.SSS z} message=%message%nthrowable=%throwable%n
+ return CONFIG_LAYOUT_PREFIX + ": level=" + level.toString() + " time=" + ".*" + " message=" + message + "\nthrowable=" + throwable + "\n";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
index 6255af1..583f4d1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/process/FileProcessControllerIntegrationJUnitTest.java
@@ -40,7 +40,6 @@ import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import com.gemstone.gemfire.distributed.LocatorLauncher;
-import com.gemstone.gemfire.distributed.LocatorStateJUnitTest;
import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
@@ -51,16 +50,16 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
*/
@Category(IntegrationTest.class)
public class FileProcessControllerIntegrationJUnitTest {
-
+
+ private ProcessType processType;
+ private ExecutorService executor;
+
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Rule
public TestName testName = new TestName();
- private ProcessType processType;
- private ExecutorService executor;
-
@Before
public void setUp() throws Exception {
this.processType = ProcessType.LOCATOR;
@@ -114,8 +113,8 @@ public class FileProcessControllerIntegrationJUnitTest {
// when: status is called in one thread and json is written to the file
AtomicReference<String> status = new AtomicReference<String>();
AtomicReference<Exception> exception = new AtomicReference<Exception>();
- ExecutorService executor = Executors.newSingleThreadExecutor();
- executor.execute(new Runnable() {
+ this.executor = Executors.newSingleThreadExecutor();
+ this.executor.execute(new Runnable() {
@Override
public void run() {
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfsh.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfsh.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfsh.java
index 156a198..c21e0c4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfsh.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfsh.java
@@ -23,16 +23,12 @@ import jline.console.ConsoleReader;
import org.springframework.shell.core.ExitShellRequest;
import org.springframework.shell.event.ShellStatus.Status;
-import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
-import java.io.OutputStreamWriter;
import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.Writer;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
@@ -60,14 +56,14 @@ public class HeadlessGfsh implements ResultHandler {
private long timeout = 20;
public String outputString = null;
- public HeadlessGfsh(String name, int timeout) throws ClassNotFoundException, IOException {
- this(name, timeout, null);
+ public HeadlessGfsh(String name, int timeout, String parentDir) throws ClassNotFoundException, IOException {
+ this(name, timeout, null, parentDir);
}
- public HeadlessGfsh(String name, int timeout, Properties envProps) throws ClassNotFoundException, IOException {
+ public HeadlessGfsh(String name, int timeout, Properties envProps, String parentDir) throws ClassNotFoundException, IOException {
this.timeout = timeout;
System.setProperty("jline.terminal", GfshUnsupportedTerminal.class.getName());
- this.shell = new HeadlessGfshShell(name, this);
+ this.shell = new HeadlessGfshShell(name, this, parentDir);
this.shell.setEnvProperty(Gfsh.ENV_APP_RESULT_VIEWER, "non-basic");
if (envProps != null) {
@@ -175,8 +171,8 @@ public class HeadlessGfsh implements ResultHandler {
private boolean hasError = false;
boolean stopCalledThroughAPI = false;
- protected HeadlessGfshShell(String testName, ResultHandler handler) throws ClassNotFoundException, IOException {
- super(false, new String[]{}, new HeadlessGfshConfig(testName));
+ protected HeadlessGfshShell(String testName, ResultHandler handler, String parentDir) throws ClassNotFoundException, IOException {
+ super(false, new String[]{}, new HeadlessGfshConfig(testName, parentDir));
this.handler = handler;
}
@@ -297,7 +293,6 @@ public class HeadlessGfsh implements ResultHandler {
}
}
-
/**
* HeadlessGfshConfig for tests. Taken from TestableGfsh
*/
@@ -312,7 +307,7 @@ public class HeadlessGfsh implements ResultHandler {
private String name;
private String generatedHistoryFileName = null;
- public HeadlessGfshConfig(String name) {
+ public HeadlessGfshConfig(String name, String parentDir) {
this.name = name;
if (isDUnitTest(this.name)) {
@@ -321,8 +316,8 @@ public class HeadlessGfsh implements ResultHandler {
fileNamePrefix = "non-hydra-client";
}
- parentDir = new File("gfsh_files");
- parentDir.mkdirs();
+ this.parentDir = new File(parentDir);
+ this.parentDir.mkdirs();
}
private static boolean isDUnitTest(String name) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
new file mode 100644
index 0000000..7bfde5b
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshIntegrationTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli;
+
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePort.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * TODO : Add more tests for error-catch, different type of results etc
+ */
+@Category(IntegrationTest.class)
+public class HeadlessGfshIntegrationTest {
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Rule
+ public TestName testName = new TestName();
+
+ @SuppressWarnings({"deprecation"})
+ @Test
+ public void testHeadlessGfshTest() throws ClassNotFoundException, IOException, InterruptedException {
+ int port = getRandomAvailablePort(SOCKET);
+
+ Properties properties = new Properties();
+ properties.put(NAME_NAME, this.testName.getMethodName());
+ properties.put(JMX_MANAGER_NAME, "true");
+ properties.put(JMX_MANAGER_START_NAME, "true");
+ properties.put(JMX_MANAGER_PORT_NAME, String.valueOf(port));
+ properties.put(HTTP_SERVICE_PORT_NAME, "0");
+ properties.put(MCAST_PORT_NAME, "0");
+
+ DistributedSystem ds = DistributedSystem.connect(properties);
+ GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.create(ds);
+
+ HeadlessGfsh gfsh = new HeadlessGfsh("Test", 25, this.temporaryFolder.newFolder("gfsh_files").getCanonicalPath());
+ for (int i = 0; i < 5; i++) {
+ gfsh.executeCommand("connect --jmx-manager=localhost[" + port + "]");
+ Object result = gfsh.getResult();
+ assertTrue(gfsh.isConnectedAndReady());
+ assertNotNull(result);
+ gfsh.clear();
+ gfsh.executeCommand("list members");
+ result = gfsh.getResult();
+ assertNotNull(result);
+ gfsh.executeCommand("disconnect");
+ gfsh.getResult();
+ }
+
+ long l1 = System.currentTimeMillis();
+ gfsh.executeCommand("exit");
+ long l2 = System.currentTimeMillis();
+ gfsh.getResult();
+ long l3 = System.currentTimeMillis();
+ System.out.println("L3-l2=" + (l3 - l2) + " Total time= " + (l3 - l1) / 1000);
+ gfsh.terminate();
+ cache.close();
+ ds.disconnect();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java
deleted file mode 100644
index 86fe03e..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.management.internal.cli;
-
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import javax.management.ObjectName;
-import java.io.IOException;
-import java.util.Properties;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * TODO : Add more tests for error-catch, different type of results etc
- *
- */
-@Category(IntegrationTest.class)
-public class HeadlessGfshJUnitTest {
-
- @SuppressWarnings({"deprecation"})
- @Test
- public void testHeadlessGfshTest() throws ClassNotFoundException, IOException, InterruptedException {
- GemFireCacheImpl cache = null;
- DistributedSystem ds = null;
- Properties pr = new Properties();
- pr.put("name", "testHeadlessGfshTest");
- pr.put(DistributionConfig.JMX_MANAGER_NAME, "true");
- pr.put(DistributionConfig.JMX_MANAGER_START_NAME, "true");
- int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- pr.put(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(port));
- pr.put(DistributionConfig.HTTP_SERVICE_PORT_NAME, "0");
- pr.put(DistributionConfig.MCAST_PORT_NAME, "0");
-
- ds = DistributedSystem.connect(pr);
- cache = (GemFireCacheImpl) CacheFactory.create(ds);
-
- HeadlessGfsh gfsh = new HeadlessGfsh("Test", 25);
- for (int i = 0; i < 5; i++) {
- gfsh.executeCommand("connect --jmx-manager=localhost[" + port + "]");
- Object result = gfsh.getResult();
- assertTrue(gfsh.isConnectedAndReady());
- assertNotNull(result);
- gfsh.clear();
- gfsh.executeCommand("list members");
- result = gfsh.getResult();
- assertNotNull(result);
- gfsh.executeCommand("disconnect");
- gfsh.getResult();
- }
-
- long l1 = System.currentTimeMillis();
- gfsh.executeCommand("exit");
- long l2 = System.currentTimeMillis();
- gfsh.getResult();
- long l3 = System.currentTimeMillis();
- System.out.println("L3-l2=" + (l3 - l2) + " Total time= " + (l3 - l1) / 1000);
- gfsh.terminate();
- cache.close();
- ds.disconnect();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index 5c6239b..0486c5a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -43,6 +43,11 @@ import com.gemstone.gemfire.management.internal.security.JSONAuthorization;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.junit.runners.Parameterized;
+
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
/**
* Base class for all the CLI/gfsh command dunit tests.
*/
@@ -60,10 +65,26 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
protected String username = "super-user";
protected String password = "1234567";
- protected int httpPort;
- protected int jmxPort;
+ private transient int httpPort;
+ private transient int jmxPort;
+ private transient String jmxHost;
+ protected transient String gfshDir;
+
+ @Rule
+ public transient TemporaryFolder temporaryFolder = new TemporaryFolder();
- protected String jmxHost;
+ @Override
+ public final void postSetUp() throws Exception {
+ setUpCliCommandTestBase();
+ postSetUpCliCommandTestBase();
+ }
+
+ private void setUpCliCommandTestBase() throws Exception {
+ this.gfshDir = this.temporaryFolder.newFolder("gfsh_files").getCanonicalPath();
+ }
+
+ protected void postSetUpCliCommandTestBase() throws Exception {
+ }
@Override
public final void preTearDownCacheTestCase() throws Exception {
@@ -145,7 +166,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
/**
* Destroy all of the components created for the default setup.
*/
- protected final void destroyDefaultSetup() {
+ protected final void destroyDefaultSetup() {
if (this.shell != null) {
executeCommand(shell, "exit");
this.shell.terminate();
@@ -267,7 +288,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
try {
Gfsh.SUPPORT_MUTLIPLESHELL = true;
String shellId = getClass().getSimpleName() + "_" + getName();
- HeadlessGfsh shell = new HeadlessGfsh(shellId, 30);
+ HeadlessGfsh shell = new HeadlessGfsh(shellId, 30, this.gfshDir);
//Added to avoid trimming of the columns
info("Started testable shell: " + shell);
return shell;
[06/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
index 70f3e70..9cbb12c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
@@ -16,22 +16,12 @@
*/
package com.gemstone.gemfire.management.internal.configuration;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-import com.jayway.awaitility.Awaitility;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.jayway.awaitility.Awaitility.*;
+import static java.util.stream.Collectors.*;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
@@ -43,17 +33,27 @@ import java.util.Arrays;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
-import static java.util.stream.Collectors.joining;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.gemstone.gemfire.util.test.TestUtil;
@Category(DistributedTest.class)
public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
- @After
- public void teardown() throws Exception {
+ @Override
+ public final void preTearDownCacheTestCase() throws Exception {
for (int i = 0; i < 2; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
vm.invoke("Removing shared configuration", () -> {
InternalLocator locator = InternalLocator.getLocator();
if (locator == null) {
@@ -62,7 +62,7 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
SharedConfiguration sharedConfig = locator.getSharedConfiguration();
if (sharedConfig != null) {
- sharedConfig.destroySharedConfiguration();
+ sharedConfig.destroySharedConfiguration_forTestsOnly();
}
});
}
@@ -70,44 +70,44 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
@Test
public void basicClusterConfigDirWithOneLocator() throws Exception {
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1);
+ final int[] ports = getRandomAvailableTCPPorts(1);
final int locatorCount = ports.length;
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-region.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region presence", () -> {
- Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
+ waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
});
}
}
@Test
public void basicClusterConfigDirWithTwoLocators() throws Exception {
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
final int locatorCount = ports.length;
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-region.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region presence", () -> {
- Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
+ waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
});
}
}
@@ -115,18 +115,18 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
@Category(FlakyTest.class) // GEODE-1165: random ports, BindException, time sensitive, awaitility
@Test
public void updateClusterConfigDirWithTwoLocatorsNoRollingServerRestart() throws Exception {
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
final int locatorCount = ports.length;
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-empty.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region absence", () -> {
@@ -139,46 +139,46 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
// Unless we start them asynchronously, the older one will want to wait for a new diskstore
// to become available and will time out.
for (int i = locatorCount; i > 0; i--) {
- VM vm = Host.getHost(0).getVM(i - 1);
+ VM vm = getHost(0).getVM(i - 1);
stopLocator(vm);
}
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-region.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
vm.invoke(() -> disconnectFromDS());
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region presence", () -> {
- Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
+ waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
});
}
}
@Test
public void updateClusterConfigDirWithTwoLocatorsAndRollingServerRestart() throws Exception {
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
final int locatorCount = ports.length;
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-empty.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region absence", () -> {
@@ -191,41 +191,41 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
// Unless we start them asynchronously, the older one will want to wait for a new diskstore
// to become available and will time out.
for (int i = locatorCount; i > 0; i--) {
- VM vm = Host.getHost(0).getVM(i - 1);
+ VM vm = getHost(0).getVM(i - 1);
stopLocator(vm);
}
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-region.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region presence", () -> {
- Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
+ waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
});
}
}
@Test
public void updateClusterConfigDirWithTwoLocatorsRollingRestartAndRollingServerRestart() throws Exception {
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
final int locatorCount = ports.length;
for (int i = 0; i < locatorCount; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
copyClusterXml(vm, "cluster-empty.xml");
startLocator(vm, i, ports);
waitForSharedConfiguration(vm);
}
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region absence", () -> {
@@ -236,7 +236,7 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
// Roll the locators
for (int i = locatorCount - 1; i >= 0; i--) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
stopLocator(vm);
copyClusterXml(vm, "cluster-region.xml");
startLocator(vm, i, ports);
@@ -245,11 +245,11 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
// Roll the servers
for (int i = 2; i < 4; i++) {
- VM vm = Host.getHost(0).getVM(i);
+ VM vm = getHost(0).getVM(i);
restartCache(vm, i, ports);
vm.invoke("Checking for region presence", () -> {
- Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
+ waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion") != null);
});
}
}
@@ -269,14 +269,14 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
final String locatorName = "locator" + i;
final File logFile = new File("locator-" + i + ".log");
final Properties props = new Properties();
- props.setProperty(DistributionConfig.NAME_NAME, locatorName);
- props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- props.setProperty(DistributionConfig.LOAD_CLUSTER_CONFIG_FROM_DIR_NAME, "true");
+ props.setProperty(NAME_NAME, locatorName);
+ props.setProperty(MCAST_PORT_NAME, "0");
+ props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ props.setProperty(LOAD_CLUSTER_CONFIG_FROM_DIR_NAME, "true");
if (locatorPorts.length > 1) {
int otherLocatorPort = locatorPorts[(i + 1) % locatorPorts.length];
- props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + otherLocatorPort + "]");
+ props.setProperty(LOCATORS_NAME, "localhost[" + otherLocatorPort + "]");
}
Locator.startLocatorAndDS(locatorPorts[i], logFile, props);
@@ -286,7 +286,7 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
private void waitForSharedConfiguration(final VM vm) {
vm.invoke("Waiting for shared configuration", () -> {
final InternalLocator locator = InternalLocator.getLocator();
- Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(() -> {
+ waitAtMost(15, TimeUnit.SECONDS).until(() -> {
return locator.isSharedConfigurationRunning();
});
});
@@ -306,12 +306,12 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
disconnectFromDS();
final Properties props = new Properties();
- props.setProperty(DistributionConfig.NAME_NAME, "member" + i);
- props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, getLocatorStr(locatorPorts));
- props.setProperty(DistributionConfig.LOG_FILE_NAME, "server-" + i + ".log");
- props.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "true");
- props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ props.setProperty(NAME_NAME, "member" + i);
+ props.setProperty(MCAST_PORT_NAME, "0");
+ props.setProperty(LOCATORS_NAME, getLocatorStr(locatorPorts));
+ props.setProperty(LOG_FILE_NAME, "server-" + i + ".log");
+ props.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true");
+ props.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
getSystem(props);
getCache();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshShellConnectionRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshShellConnectionRule.java
index 17549d5..d0f33d9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshShellConnectionRule.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.management.internal.security;
+import org.junit.runner.Description;
+
import com.gemstone.gemfire.management.internal.cli.CliUtil;
import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
@@ -24,12 +26,10 @@ import com.gemstone.gemfire.management.internal.cli.result.ErrorResultData;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
import com.gemstone.gemfire.test.junit.rules.DescribedExternalResource;
-import org.junit.runner.Description;
/**
* Class which eases the creation of MBeans for security testing. When combined with {@link JMXConnectionConfiguration}
* it allows for the creation of per-test connections with different user/password combinations.
- *
*/
public class GfshShellConnectionRule extends DescribedExternalResource {
@@ -38,9 +38,9 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
private boolean useHttp = false;
private HeadlessGfsh gfsh;
private boolean authenticated;
+
/**
* Rule constructor
- *
*/
public GfshShellConnectionRule(int jmxPort, int httpPort, boolean useHttp) {
this.jmxPort = jmxPort;
@@ -55,7 +55,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
CliUtil.isGfshVM = true;
String shellId = getClass().getSimpleName() + "_" + description.getMethodName();
- gfsh = new HeadlessGfsh(shellId, 30);
+ gfsh = new HeadlessGfsh(shellId, 30, "gfsh_files"); // TODO: move to TemporaryFolder
final CommandStringBuilder connectCommand = new CommandStringBuilder(CliStrings.CONNECT);
connectCommand.addOption(CliStrings.CONNECT__USERNAME, config.user());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/resources/com/gemstone/gemfire/internal/logging/log4j/custom/log4j2-custom.xml
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/internal/logging/log4j/custom/log4j2-custom.xml b/geode-core/src/test/resources/com/gemstone/gemfire/internal/logging/log4j/custom/log4j2-custom.xml
new file mode 100644
index 0000000..dbdd402
--- /dev/null
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/internal/logging/log4j/custom/log4j2-custom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="FATAL" shutdownHook="disable" packages="com.gemstone.gemfire.internal.logging.log4j.custom">
+ <Properties>
+ <Property name="custom-pattern">CUSTOM: level=%level time=%date{yyyy/MM/dd HH:mm:ss.SSS z} message=%message%nthrowable=%throwable%n</Property>
+ </Properties>
+ <Appenders>
+ <Console name="STDOUT" target="SYSTEM_OUT">
+ <PatternLayout pattern="${custom-pattern}"/>
+ </Console>
+ <Basic name="CUSTOM">
+ <PatternLayout pattern="${custom-pattern}"/>
+ </Basic>
+ </Appenders>
+ <Loggers>
+ <Logger name="com.gemstone" level="INFO" additivity="true">
+ <filters>
+ <MarkerFilter marker="GEMFIRE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/>
+ </filters>
+ </Logger>
+ <Logger name="org.jgroups" level="FATAL" additivity="true"/>
+ <Logger name="com.gemstone.gemfire.internal.logging.log4j.custom" level="DEBUG" additivity="true"/>
+ <Root level="INFO">
+ <AppenderRef ref="CUSTOM"/>
+ <AppenderRef ref="STDOUT"/>
+ </Root>
+ </Loggers>
+</Configuration>
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
index 47ff69e..4a95c91 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
@@ -200,7 +200,6 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
/**
* Default connection is Pulse which uses configured userName and password
- * @return
*/
public JMXConnector getJMXConnection() {
return getJMXConnection(true);
@@ -209,8 +208,6 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
/**
* Get connection for given userName and password. This is used for DataBrowser
* queries which has to be fired using credentials provided at pulse login page
- *
- * @return
*/
public JMXConnector getJMXConnection(final boolean registerURL) {
JMXConnector connection = null;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
index 49a978c..71b5910 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
@@ -79,7 +79,7 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
static VM vm7;
@Override
- public final void postSetUp() throws Exception {
+ public final void postSetUpCliCommandTestBase() throws Exception {
final Host host = Host.getHost(0);
vm0 = host.getVM(0);
vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
index 4ff9a73..62bb793 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
@@ -16,8 +16,16 @@
*/
package com.gemstone.gemfire.management.internal.configuration;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+import static com.gemstone.gemfire.internal.FileUtil.*;
+import static com.gemstone.gemfire.internal.lang.StringUtils.*;
+import static com.gemstone.gemfire.management.internal.cli.CliUtil.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
import static com.gemstone.gemfire.test.dunit.Wait.*;
+import static org.apache.commons.io.FileUtils.*;
import java.io.File;
import java.io.IOException;
@@ -32,12 +40,10 @@ import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.io.FileUtils;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Region;
@@ -48,11 +54,8 @@ import com.gemstone.gemfire.cache.wan.GatewayReceiver;
import com.gemstone.gemfire.cache.wan.GatewaySender;
import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.ClassBuilder;
-import com.gemstone.gemfire.internal.FileUtil;
import com.gemstone.gemfire.internal.JarClassLoader;
import com.gemstone.gemfire.internal.JarDeployer;
import com.gemstone.gemfire.internal.admin.remote.ShutdownAllRequest;
@@ -65,17 +68,13 @@ import com.gemstone.gemfire.internal.cache.extension.mock.MockExtensionCommands;
import com.gemstone.gemfire.internal.cache.extension.mock.MockRegionExtension;
import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
import com.gemstone.gemfire.internal.cache.xmlcache.XmlParser;
-import com.gemstone.gemfire.internal.lang.StringUtils;
import com.gemstone.gemfire.management.cli.Result.Status;
-import com.gemstone.gemfire.management.internal.cli.CliUtil;
import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
@@ -83,8 +82,10 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
@Category(DistributedTest.class)
public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
+
private static final int TIMEOUT = 10000;
private static final int INTERVAL = 500;
+
private static final String REPLICATE_REGION = "ReplicateRegion1";
private static final String PARTITION_REGION = "PartitionRegion1";
private static final String DISK_REGION1 = "DR1";
@@ -96,225 +97,235 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
private static final String JAR2 = "D2.jar";
private static final String JAR3 = "D3.jar";
private static final String AsyncEventQueue1 = "Q1";
-
+
+ private static final String dataMember = "DataMember";
+ private static final String newMember = "NewMember";
+
+ private static Set<String> serverNames = new HashSet<>();
+ private static Set<String> jarFileNames = new HashSet<>();
+
private transient ClassBuilder classBuilder = new ClassBuilder();
-
- public static Set<String> serverNames = new HashSet<String>();
- public static Set<String> jarFileNames = new HashSet<String>();
-
- public static String dataMember = "DataMember";
- public static String newMember = "NewMember";
-
- private static final long serialVersionUID = 1L;
+
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ disconnectAllFromDS();
+ }
+
+ @Override
+ public final void preTearDownCliCommandTestBase() throws Exception {
+ shutdownAll();
+
+ serverNames.clear();
+ jarFileNames.clear();
+ }
@Test
- public void testConfigDistribution() throws IOException {
- IgnoredException.addIgnoredException("could not get remote locator");
- try {
- Object[] result = setup();
- IgnoredException.addIgnoredException("EntryDestroyedException");
- final int locatorPort = (Integer) result[0];
- final String jmxHost = (String) result[1];
- final int jmxPort = (Integer) result[2];
- final int httpPort = (Integer) result[3];
- final String locatorString = "localHost[" + locatorPort + "]";
-
- String gatewayRecieverStartPort = "10000";
- String gatewayRecieverEndPort = "20000";
- final String gsId = "GatewaySender1";
- final String batchSize = "1000";
- final String dispatcherThreads = "5";
- final String enableConflation = "false";
- final String manualStart = "false";
- final String receiverManualStart = "true";
- final String alertThreshold = "1000";
- final String batchTimeInterval = "20";
- final String maxQueueMemory = "100";
- final String orderPolicy = OrderPolicy.KEY.toString();
- final String parallel = "true";
- final String rmDsId = "250";
- final String socketBufferSize = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000);
- final String socketReadTimeout = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+200);
- final String DESTROY_REGION = "regionToBeDestroyed";
-
- createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
- createRegion(PARTITION_REGION, RegionShortcut.PARTITION, null);
- createRegion(DESTROY_REGION, RegionShortcut.REPLICATE, null);
- createIndex(INDEX1 , "AAPL", REPLICATE_REGION, null);
- createIndex(INDEX2, "VMW", PARTITION_REGION, null);
- createAndDeployJar(JAR1, null);
- createAndDeployJar(JAR2, null);
- createAndDeployJar(JAR3, null);
- createAsyncEventQueue(AsyncEventQueue1, "false", null, "1000", "1000", null);
- destroyRegion(DESTROY_REGION);
- destroyIndex(INDEX2, PARTITION_REGION, null);
- undeployJar(JAR3, null);
- alterRuntime("true", "", "", "");
- createGatewayReceiver(receiverManualStart, "", gatewayRecieverStartPort, gatewayRecieverEndPort, "20", "");
- createGatewaySender(gsId, batchSize, alertThreshold, batchTimeInterval, dispatcherThreads, enableConflation, manualStart, maxQueueMemory, orderPolicy, parallel, rmDsId, socketBufferSize, socketReadTimeout);
- //alterRegion(PARTITION_REGION, "false", AsyncEventQueue1, "", "", "", "", "", "", gsId);
- //Start a new member which receives the shared configuration
- //Verify the config creation on this member
- VM newMember = Host.getHost(0).getVM(2);
-
- newMember.invoke(new SerializableCallable() {
- @Override
- public Object call() throws IOException {
- Properties localProps = new Properties();
-
- File workingDir = new File(ClusterConfigurationDUnitTest.newMember);
- workingDir.mkdirs();
- workingDir.deleteOnExit();
-
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locatorPort);
- localProps.setProperty(DistributionConfig.NAME_NAME, ClusterConfigurationDUnitTest.newMember);
- localProps.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "true");
- localProps.setProperty(DistributionConfig.DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
- getSystem(localProps);
- Cache cache = getCache();
-
- assertNotNull(cache);
- assertTrue(cache.getCopyOnRead());
-
- Region region1 = cache.getRegion(REPLICATE_REGION);
- assertNotNull(region1);
- Region region2 = cache.getRegion(PARTITION_REGION);
- assertNotNull(region2);
-
- Region region3 = cache.getRegion(DESTROY_REGION);
- assertNull(region3);
-
- //Index verfication
- Index index1 = cache.getQueryService().getIndex(region1, INDEX1);
- assertNotNull(index1);
- assertNull(cache.getQueryService().getIndex(region2, INDEX2));
-
- LogWriter logger = cache.getLogger();
- final JarDeployer jarDeployer = new JarDeployer(((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
-
- final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
-
- Set<String> jarNames = new HashSet<String>();
-
- for (JarClassLoader jarClassLoader : jarClassLoaders) {
- jarNames.add(jarClassLoader.getJarName());
- }
-
- assertTrue(jarNames.contains(JAR1));
- assertTrue(jarNames.contains(JAR2));
- assertFalse(jarNames.contains(JAR3));
-
- //ASYNC-EVENT-QUEUE verification
- AsyncEventQueue aeq = cache.getAsyncEventQueue(AsyncEventQueue1);
- assertNotNull(aeq);
- assertFalse(aeq.isPersistent());
- assertTrue(aeq.getBatchSize() == 1000);
- assertTrue(aeq.getMaximumQueueMemory() == 1000);
-
- //GatewayReviever verification
- Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
- assertFalse(gatewayReceivers.isEmpty());
- assertTrue(gatewayReceivers.size() == 1);
-
- //Gateway Sender verfication
- GatewaySender gs = cache.getGatewaySender(gsId);
- assertNotNull(gs);
- assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
- assertTrue(batchSize.equals(Integer.toString(gs.getBatchSize())));
- assertTrue(dispatcherThreads.equals(Integer.toString(gs.getDispatcherThreads())));
- assertTrue(enableConflation.equals(Boolean.toString(gs.isBatchConflationEnabled())));
- assertTrue(manualStart.equals(Boolean.toString(gs.isManualStart())));
- assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
- assertTrue(batchTimeInterval.equals(Integer.toString(gs.getBatchTimeInterval())));
- assertTrue(maxQueueMemory.equals(Integer.toString(gs.getMaximumQueueMemory())));
- assertTrue(orderPolicy.equals(gs.getOrderPolicy().toString()));
- assertTrue(parallel.equals(Boolean.toString(gs.isParallel())));
- assertTrue(rmDsId.equals(Integer.toString(gs.getRemoteDSId())));
- assertTrue(socketBufferSize.equals(Integer.toString(gs.getSocketBufferSize())));
- assertTrue(socketReadTimeout.equals(Integer.toString(gs.getSocketReadTimeout())));
-
- return CliUtil.getAllNormalMembers(cache);
+ public void testConfigDistribution() throws Exception {
+ addIgnoredException("could not get remote locator");
+ addIgnoredException("EntryDestroyedException");
+
+ String workingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator;
+
+ Object[] result = setup();
+ final int locatorPort = (Integer) result[0];
+ final String jmxHost = (String) result[1];
+ final int jmxPort = (Integer) result[2];
+ final int httpPort = (Integer) result[3];
+ final String locatorString = "localHost[" + locatorPort + "]";
+
+ String gatewayReceiverStartPort = "10000";
+ String gatewayReceiverEndPort = "20000";
+ final String gsId = "GatewaySender1";
+ final String batchSize = "1000";
+ final String dispatcherThreads = "5";
+ final String enableConflation = "false";
+ final String manualStart = "false";
+ final String receiverManualStart = "true";
+ final String alertThreshold = "1000";
+ final String batchTimeInterval = "20";
+ final String maxQueueMemory = "100";
+ final String orderPolicy = OrderPolicy.KEY.toString();
+ final String parallel = "true";
+ final String rmDsId = "250";
+ final String socketBufferSize = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000);
+ final String socketReadTimeout = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+200);
+ final String DESTROY_REGION = "regionToBeDestroyed";
+
+ createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+ createRegion(PARTITION_REGION, RegionShortcut.PARTITION, null);
+ createRegion(DESTROY_REGION, RegionShortcut.REPLICATE, null);
+ createIndex(INDEX1, "AAPL", REPLICATE_REGION, null);
+ createIndex(INDEX2, "VMW", PARTITION_REGION, null);
+
+ createAndDeployJar(workingDir + JAR1, null);
+ createAndDeployJar(workingDir + JAR2, null);
+ createAndDeployJar(workingDir + JAR3, null);
+
+ createAsyncEventQueue(AsyncEventQueue1, "false", null, "1000", "1000", null);
+ destroyRegion(DESTROY_REGION);
+ destroyIndex(INDEX2, PARTITION_REGION, null);
+
+ undeployJar(JAR3, null);
+
+ alterRuntime("true", "", "", "");
+ createGatewayReceiver(receiverManualStart, "", gatewayReceiverStartPort, gatewayReceiverEndPort, "20", "");
+ createGatewaySender(gsId, batchSize, alertThreshold, batchTimeInterval, dispatcherThreads, enableConflation, manualStart, maxQueueMemory, orderPolicy, parallel, rmDsId, socketBufferSize, socketReadTimeout);
+
+ //alterRegion(PARTITION_REGION, "false", AsyncEventQueue1, "", "", "", "", "", "", gsId);
+ //Start a new member which receives the shared configuration
+ //Verify the config creation on this member
+
+ final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+ VM newMember = getHost(0).getVM(2);
+ newMember.invoke(new SerializableCallable() {
+ @Override
+ public Object call() throws IOException {
+ Properties localProps = new Properties();
+
+ File workingDir = new File(newMemberWorkingDir);
+ workingDir.mkdirs();
+
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locatorPort);
+ localProps.setProperty(NAME_NAME, ClusterConfigurationDUnitTest.newMember);
+ localProps.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true");
+ localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+ getSystem(localProps);
+ Cache cache = getCache();
+
+ assertNotNull(cache);
+ assertTrue(cache.getCopyOnRead());
+
+ Region region1 = cache.getRegion(REPLICATE_REGION);
+ assertNotNull(region1);
+ Region region2 = cache.getRegion(PARTITION_REGION);
+ assertNotNull(region2);
+
+ Region region3 = cache.getRegion(DESTROY_REGION);
+ assertNull(region3);
+
+ //Index verfication
+ Index index1 = cache.getQueryService().getIndex(region1, INDEX1);
+ assertNotNull(index1);
+ assertNull(cache.getQueryService().getIndex(region2, INDEX2));
+
+ final JarDeployer jarDeployer = new JarDeployer(((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
+
+ final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
+
+ Set<String> jarNames = new HashSet<String>();
+
+ for (JarClassLoader jarClassLoader : jarClassLoaders) {
+ jarNames.add(jarClassLoader.getJarName());
}
- });
- } finally {
- shutdownAll();
- }
+
+ assertTrue(jarNames.contains(JAR1));
+ assertTrue(jarNames.contains(JAR2));
+ assertFalse(jarNames.contains(JAR3));
+
+ //ASYNC-EVENT-QUEUE verification
+ AsyncEventQueue aeq = cache.getAsyncEventQueue(AsyncEventQueue1);
+ assertNotNull(aeq);
+ assertFalse(aeq.isPersistent());
+ assertTrue(aeq.getBatchSize() == 1000);
+ assertTrue(aeq.getMaximumQueueMemory() == 1000);
+
+ //GatewayReceiver verification
+ Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
+ assertFalse(gatewayReceivers.isEmpty());
+ assertTrue(gatewayReceivers.size() == 1);
+
+ //Gateway Sender verification
+ GatewaySender gs = cache.getGatewaySender(gsId);
+ assertNotNull(gs);
+ assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
+ assertTrue(batchSize.equals(Integer.toString(gs.getBatchSize())));
+ assertTrue(dispatcherThreads.equals(Integer.toString(gs.getDispatcherThreads())));
+ assertTrue(enableConflation.equals(Boolean.toString(gs.isBatchConflationEnabled())));
+ assertTrue(manualStart.equals(Boolean.toString(gs.isManualStart())));
+ assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
+ assertTrue(batchTimeInterval.equals(Integer.toString(gs.getBatchTimeInterval())));
+ assertTrue(maxQueueMemory.equals(Integer.toString(gs.getMaximumQueueMemory())));
+ assertTrue(orderPolicy.equals(gs.getOrderPolicy().toString()));
+ assertTrue(parallel.equals(Boolean.toString(gs.isParallel())));
+ assertTrue(rmDsId.equals(Integer.toString(gs.getRemoteDSId())));
+ assertTrue(socketBufferSize.equals(Integer.toString(gs.getSocketBufferSize())));
+ assertTrue(socketReadTimeout.equals(Integer.toString(gs.getSocketReadTimeout())));
+
+ return getAllNormalMembers(cache);
+ }
+ });
}
/**
* Tests for {@link Extension}, {@link Extensible}, {@link XmlParser},
* {@link XmlGenerator}, {@link XmlEntity} as it applies to Extensions.
- * Asserts that Mock Entension is created and altered on region and cache.
+ * Asserts that Mock Extension is created and altered on region and cache.
*
- * @throws IOException
* @since 8.1
*/
@Test
- public void testCreateExtensions() throws IOException {
-
- try {
- Object[] result = setup();
- final int locatorPort = (Integer) result[0];
-
- createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
- createMockRegionExtension(REPLICATE_REGION, "value1");
- alterMockRegionExtension(REPLICATE_REGION, "value2");
- createMockCacheExtension("value1");
- alterMockCacheExtension("value2");
-
- //Start a new member which receives the shared configuration
- //Verify the config creation on this member
- VM newMember = Host.getHost(0).getVM(2);
-
- newMember.invoke(new SerializableCallable() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public Object call() throws IOException {
- Properties localProps = new Properties();
-
- File workingDir = new File(ClusterConfigurationDUnitTest.newMember);
- workingDir.mkdirs();
- workingDir.deleteOnExit();
-
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locatorPort);
- localProps.setProperty(DistributionConfig.NAME_NAME, ClusterConfigurationDUnitTest.newMember);
- localProps.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "true");
- localProps.setProperty(DistributionConfig.DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
- getSystem(localProps);
- Cache cache = getCache();
-
- assertNotNull(cache);
-
- Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
- assertNotNull(region1);
-
- //MockRegionExtension verification
- @SuppressWarnings("unchecked")
- // should only be one region extension
- final MockRegionExtension mockRegionExtension = (MockRegionExtension) ((Extensible<Region<?,?>>) region1).getExtensionPoint().getExtensions().iterator().next();
- assertNotNull(mockRegionExtension);
- assertEquals(1, mockRegionExtension.onCreateCounter.get());
- assertEquals("value2", mockRegionExtension.getValue());
-
- //MockCacheExtension verification
- @SuppressWarnings("unchecked")
- // should only be one cache extension
- final MockCacheExtension mockCacheExtension = (MockCacheExtension) ((Extensible<Cache>) cache).getExtensionPoint().getExtensions().iterator().next();
- assertNotNull(mockCacheExtension);
- assertEquals(1, mockCacheExtension.onCreateCounter.get());
- assertEquals("value2", mockCacheExtension.getValue());
-
- return CliUtil.getAllNormalMembers(cache);
- }
- });
- } finally {
- shutdownAll();
- }
+ public void testCreateExtensions() throws Exception {
+ Object[] result = setup();
+ final int locatorPort = (Integer) result[0];
+
+ createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+ createMockRegionExtension(REPLICATE_REGION, "value1");
+ alterMockRegionExtension(REPLICATE_REGION, "value2");
+ createMockCacheExtension("value1");
+ alterMockCacheExtension("value2");
+
+ //Start a new member which receives the shared configuration
+ //Verify the config creation on this member
+
+ final String newMemberWorkDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+ VM newMember = getHost(0).getVM(2);
+ newMember.invoke(new SerializableCallable() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Object call() throws IOException {
+ Properties localProps = new Properties();
+
+ File workingDir = new File(newMemberWorkDir);
+ workingDir.mkdirs();
+
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locatorPort);
+ localProps.setProperty(NAME_NAME, ClusterConfigurationDUnitTest.newMember);
+ localProps.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true");
+ localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+ getSystem(localProps);
+ Cache cache = getCache();
+
+ assertNotNull(cache);
+
+ Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
+ assertNotNull(region1);
+
+ //MockRegionExtension verification
+ @SuppressWarnings("unchecked")
+ // should only be one region extension
+ final MockRegionExtension mockRegionExtension = (MockRegionExtension) ((Extensible<Region<?,?>>) region1).getExtensionPoint().getExtensions().iterator().next();
+ assertNotNull(mockRegionExtension);
+ assertEquals(1, mockRegionExtension.onCreateCounter.get());
+ assertEquals("value2", mockRegionExtension.getValue());
+
+ //MockCacheExtension verification
+ @SuppressWarnings("unchecked")
+ // should only be one cache extension
+ final MockCacheExtension mockCacheExtension = (MockCacheExtension) ((Extensible<Cache>) cache).getExtensionPoint().getExtensions().iterator().next();
+ assertNotNull(mockCacheExtension);
+ assertEquals(1, mockCacheExtension.onCreateCounter.get());
+ assertEquals("value2", mockCacheExtension.getValue());
+
+ return getAllNormalMembers(cache);
+ }
+ });
}
/**
@@ -322,246 +333,208 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
* {@link XmlGenerator}, {@link XmlEntity} as it applies to Extensions.
* Asserts that Mock Entension is created and destroyed on region and cache.
*
- * @throws IOException
* @since 8.1
*/
@Test
- public void testDestroyExtensions() throws IOException {
-
- try {
- Object[] result = setup();
- final int locatorPort = (Integer) result[0];
-
- createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
- createMockRegionExtension(REPLICATE_REGION, "value1");
- destroyMockRegionExtension(REPLICATE_REGION);
- createMockCacheExtension("value1");
- destroyMockCacheExtension();
-
- //Start a new member which receives the shared configuration
- //Verify the config creation on this member
- VM newMember = Host.getHost(0).getVM(2);
-
- newMember.invoke(new SerializableCallable() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public Object call() throws IOException {
- Properties localProps = new Properties();
-
- File workingDir = new File(ClusterConfigurationDUnitTest.newMember);
- workingDir.mkdirs();
- workingDir.deleteOnExit();
-
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locatorPort);
- localProps.setProperty(DistributionConfig.NAME_NAME, ClusterConfigurationDUnitTest.newMember);
- localProps.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "true");
- localProps.setProperty(DistributionConfig.DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
- getSystem(localProps);
- Cache cache = getCache();
-
- assertNotNull(cache);
-
- Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
- assertNotNull(region1);
-
- //MockRegionExtension verification
- @SuppressWarnings("unchecked")
- final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?,?>>) region1;
- // Should not be any region extensions
- assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
-
- //MockCacheExtension verification
- @SuppressWarnings("unchecked")
- final Extensible<Cache> extensibleCache = (Extensible<Cache>) cache;
- // Should not be any cache extensions
- assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
-
- return CliUtil.getAllNormalMembers(cache);
- }
- });
- } finally {
- shutdownAll();
- }
+ public void testDestroyExtensions() throws Exception {
+ Object[] result = setup();
+ final int locatorPort = (Integer) result[0];
+
+ createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+ createMockRegionExtension(REPLICATE_REGION, "value1");
+ destroyMockRegionExtension(REPLICATE_REGION);
+ createMockCacheExtension("value1");
+ destroyMockCacheExtension();
+
+ //Start a new member which receives the shared configuration
+ //Verify the config creation on this member
+
+ final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+ VM newMember = getHost(0).getVM(2);
+ newMember.invoke(new SerializableCallable() {
+
+ @Override
+ public Object call() throws IOException {
+ Properties localProps = new Properties();
+
+ File workingDir = new File(newMemberWorkingDir);
+ workingDir.mkdirs();
+
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locatorPort);
+ localProps.setProperty(NAME_NAME, ClusterConfigurationDUnitTest.newMember);
+ localProps.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true");
+ localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+ getSystem(localProps);
+ Cache cache = getCache();
+
+ assertNotNull(cache);
+
+ Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
+ assertNotNull(region1);
+
+ //MockRegionExtension verification
+ @SuppressWarnings("unchecked")
+ final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?,?>>) region1;
+ // Should not be any region extensions
+ assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
+
+ //MockCacheExtension verification
+ @SuppressWarnings("unchecked")
+ final Extensible<Cache> extensibleCache = (Extensible<Cache>) cache;
+ // Should not be any cache extensions
+ assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
+
+ return getAllNormalMembers(cache);
+ }
+ });
}
- @Ignore("disabled for unknown reason")
+ @Ignore("disabled for unknown reason") // this passes when @Ignore is removed
@Test
- public void testCreateDiskStore () throws IOException {
- try {
- Object[] result = setup();
- final int locatorPort = (Integer) result[0];
- final String jmxHost = (String) result[1];
- final int jmxPort = (Integer) result[2];
- final int httpPort = (Integer) result[3];
- final String locatorString = "localHost[" + locatorPort + "]";
-
- final String diskStoreName = "clusterConfigTestDiskStore";
- final String diskDirs = "dir1";
- //final String
- //createPersistentRegion(persRegion, RegionShortcut.PARTITION_PERSISTENT, "", diskStoreName);
- final String autoCompact = "true";
- final String allowForceCompaction = "true";
- final String compactionThreshold = "50";
- final String duCritical = "90";
- final String duWarning = "85";
- final String maxOplogSize = "1000";
- final String queueSize = "300";
- final String timeInterval = "10";
- final String writeBufferSize="100";
- createDiskStore(diskStoreName, diskDirs, autoCompact, allowForceCompaction, compactionThreshold, duCritical, duWarning, maxOplogSize, queueSize, timeInterval, writeBufferSize);
-
- //createAsyncEventQueue(id, persistent, diskStoreName, batchSize, maxQueueMemory, group)
- //Stop the existing data member
- VM dataMember = Host.getHost(0).getVM(1);
- dataMember.invoke(new SerializableCallable() {
- @Override
- public Object call() throws IOException {
-
- CacheFactory cf = new CacheFactory();
- GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
- File []diskDirs = null;
- Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
-
- assertFalse(diskStoreList.isEmpty());
- assertTrue(diskStoreList.size() == 1);
-
- for (DiskStoreImpl diskStore : diskStoreList) {
- diskDirs = diskStore.getDiskDirs();
- break;
- }
-
- assertNotNull(diskDirs);
- assertTrue(diskDirs.length > 0);
-
- //close the cache
- cache.close();
-
- //Delete the disk-store files
- for (File diskDir : diskDirs) {
- FileUtils.deleteDirectory(diskDir);
- }
- return CliUtil.getAllNormalMembers(cache);
+ public void testCreateDiskStore () throws Exception {
+ Object[] result = setup();
+ final int locatorPort = (Integer) result[0];
+ final String jmxHost = (String) result[1];
+ final int jmxPort = (Integer) result[2];
+ final int httpPort = (Integer) result[3];
+ final String locatorString = "localHost[" + locatorPort + "]";
+
+ final String diskStoreName = "clusterConfigTestDiskStore";
+ final String diskDirs = "dir1";
+
+ //final String
+ //createPersistentRegion(persRegion, RegionShortcut.PARTITION_PERSISTENT, "", diskStoreName);
+
+ final String autoCompact = "true";
+ final String allowForceCompaction = "true";
+ final String compactionThreshold = "50";
+ final String duCritical = "90";
+ final String duWarning = "85";
+ final String maxOplogSize = "1000";
+ final String queueSize = "300";
+ final String timeInterval = "10";
+ final String writeBufferSize="100";
+
+ createDiskStore(diskStoreName, diskDirs, autoCompact, allowForceCompaction, compactionThreshold, duCritical, duWarning, maxOplogSize, queueSize, timeInterval, writeBufferSize);
+
+ //createAsyncEventQueue(id, persistent, diskStoreName, batchSize, maxQueueMemory, group)
+
+ //Stop the existing data member
+ VM dataMember = getHost(0).getVM(1);
+ dataMember.invoke(new SerializableCallable() {
+ @Override
+ public Object call() throws IOException {
+
+ CacheFactory cf = new CacheFactory();
+ GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
+ File[] diskDirs = null;
+ Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
+
+ assertFalse(diskStoreList.isEmpty());
+ assertTrue(diskStoreList.size() == 1);
+
+ for (DiskStoreImpl diskStore : diskStoreList) {
+ diskDirs = diskStore.getDiskDirs();
+ break;
}
- });
-
-
- //Now start the new data member and it should create all the disk-store artifacts
- VM newMember = Host.getHost(0).getVM(2);
- newMember.invoke(new SerializableCallable() {
- @Override
- public Object call() throws IOException {
- Properties localProps = new Properties();
-
- File workingDir = new File(ClusterConfigurationDUnitTest.newMember);
- workingDir.mkdirs();
- workingDir.deleteOnExit();
-
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locatorPort);
- localProps.setProperty(DistributionConfig.NAME_NAME, ClusterConfigurationDUnitTest.newMember);
- localProps.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "true");
- localProps.setProperty(DistributionConfig.DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
- getSystem(localProps);
- GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
- assertNotNull(cache);
-
-
- Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
-
- assertFalse(diskStoreList.isEmpty());
- assertTrue(diskStoreList.size() == 1);
-
- for (DiskStoreImpl diskStore : diskStoreList) {
- assertTrue(diskStore.getName().equals(diskStoreName));
- assertTrue(Boolean.toString(diskStore.getAutoCompact()).equals(autoCompact));
- assertTrue(Boolean.toString(diskStore.getAllowForceCompaction()).equals(allowForceCompaction));
- assertTrue(Integer.toString(diskStore.getCompactionThreshold()).equals(compactionThreshold));
- assertTrue(Long.toString(diskStore.getMaxOplogSize()).equals(maxOplogSize));
- assertTrue(Integer.toString(diskStore.getQueueSize()).equals(queueSize));
- assertTrue(Integer.toString(diskStore.getWriteBufferSize()).equals(writeBufferSize));
- assertTrue(Long.toString(diskStore.getTimeInterval()).equals(timeInterval));
- break;
- }
- cache.close();
- return null;
+
+ assertNotNull(diskDirs);
+ assertTrue(diskDirs.length > 0);
+
+ //close the cache
+ cache.close();
+
+ //Delete the disk-store files
+ for (File diskDir : diskDirs) {
+ deleteDirectory(diskDir);
}
- });
- } finally {
- shutdownAll();
- }
-
- }
+ return getAllNormalMembers(cache);
+ }
+ });
- @Ignore("disabled for unknown reason")
- @Test
- public void testConfigurePDX() throws IOException {
- try {
- Object[] result = setup();
- final int locatorPort = (Integer) result[0];
- final String jmxHost = (String) result[1];
- final int jmxPort = (Integer) result[2];
- final int httpPort = (Integer) result[3];
- final String locatorString = "localHost[" + locatorPort + "]";
-
- configurePDX("com.foo.*", "true", "true", null, "true");
-
- VM dataMember = Host.getHost(0).getVM(1);
-
- dataMember.invoke(new SerializableCallable() {
-
- @Override
- public Object call() throws IOException {
- GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
- assertTrue(cache.getPdxReadSerialized());
- assertTrue(cache.getPdxIgnoreUnreadFields());
- assertTrue(cache.getPdxPersistent());
- return null;
+ final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+ //Now start the new data member and it should create all the disk-store artifacts
+ VM newMember = getHost(0).getVM(2);
+ newMember.invoke(new SerializableCallable() {
+ @Override
+ public Object call() throws IOException {
+ Properties localProps = new Properties();
+
+ File workingDir = new File(newMemberWorkingDir);
+ workingDir.mkdirs();
+
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locatorPort);
+ localProps.setProperty(NAME_NAME, ClusterConfigurationDUnitTest.newMember);
+ localProps.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true");
+ localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+ getSystem(localProps);
+ GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
+ assertNotNull(cache);
+
+
+ Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
+
+ assertFalse(diskStoreList.isEmpty());
+ assertTrue(diskStoreList.size() == 1);
+
+ for (DiskStoreImpl diskStore : diskStoreList) {
+ assertTrue(diskStore.getName().equals(diskStoreName));
+ assertTrue(Boolean.toString(diskStore.getAutoCompact()).equals(autoCompact));
+ assertTrue(Boolean.toString(diskStore.getAllowForceCompaction()).equals(allowForceCompaction));
+ assertTrue(Integer.toString(diskStore.getCompactionThreshold()).equals(compactionThreshold));
+ assertTrue(Long.toString(diskStore.getMaxOplogSize()).equals(maxOplogSize));
+ assertTrue(Integer.toString(diskStore.getQueueSize()).equals(queueSize));
+ assertTrue(Integer.toString(diskStore.getWriteBufferSize()).equals(writeBufferSize));
+ assertTrue(Long.toString(diskStore.getTimeInterval()).equals(timeInterval));
+ break;
}
- });
- } finally {
- shutdownAll();
- }
+ cache.close();
+ return null;
+ }
+ });
}
-
- private void shutdownAll() throws IOException {
- VM locatorAndMgr = Host.getHost(0).getVM(3);
- locatorAndMgr.invoke(new SerializableCallable() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ @Ignore("disabled for unknown reason") // this fails in configurePDX when @Ignore is removed
+ @Test
+ public void testConfigurePDX() throws Exception {
+ Object[] result = setup();
+ final int locatorPort = (Integer) result[0];
+ final String jmxHost = (String) result[1];
+ final int jmxPort = (Integer) result[2];
+ final int httpPort = (Integer) result[3];
+ final String locatorString = "localHost[" + locatorPort + "]";
+
+ configurePDX("com.foo.*", "true", "true", null, "true");
+
+ VM dataMember = getHost(0).getVM(1);
+ dataMember.invoke(new SerializableCallable() {
@Override
- public Object call() throws Exception {
- GemFireCacheImpl cache = (GemFireCacheImpl)CacheFactory.getAnyInstance();
- ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
+ public Object call() throws IOException {
+ GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
+ assertTrue(cache.getPdxReadSerialized());
+ assertTrue(cache.getPdxIgnoreUnreadFields());
+ assertTrue(cache.getPdxPersistent());
return null;
}
});
-
- locatorAndMgr.invoke(SharedConfigurationDUnitTest.locatorCleanup);
- //Clean up the directories
- if (serverNames != null && !serverNames.isEmpty()) {
- for (String serverName : serverNames) {
- final File serverDir = new File(serverName);
- FileUtils.cleanDirectory(serverDir);
- FileUtils.deleteDirectory(serverDir);
- }
- }
}
-
+
@Test
- public void testClusterConfigDir() {
- disconnectAllFromDS();
- final int [] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+ public void testClusterConfigDir() throws Exception {
+ final int [] ports = getRandomAvailableTCPPorts(3);
final int locator1Port = ports[0];
final String locator1Name = "locator1-" + locator1Port;
- VM locatorAndMgr = Host.getHost(0).getVM(3);
-
+
+ final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
+ final String clusterConfigPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "userSpecifiedDir";
+
+ VM locatorAndMgr = getHost(0).getVM(3);
Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
@Override
public Object call() throws IOException {
@@ -571,55 +544,47 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
try {
jmxHost = InetAddress.getLocalHost().getHostName();
- }
- catch (UnknownHostException ignore) {
+ } catch (UnknownHostException ignore) {
jmxHost = "localhost";
}
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
jmxPort = ports[0];
httpPort = ports[1];
-
- final File locatorLogFile = new File("locator-" + locator1Port + ".log");
+ final File locatorLogFile = new File(locatorLogPath);
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator1Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "config");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
+ locatorProps.setProperty(NAME_NAME, locator1Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "config");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_START_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
+ locatorProps.setProperty(JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
- File clusterConfigDir = new File("userSpecifiedDir");
+ File clusterConfigDir = new File(clusterConfigPath);
assertTrue(clusterConfigDir.mkdir());
- locatorProps.setProperty(DistributionConfig.CLUSTER_CONFIGURATION_DIR, clusterConfigDir.getCanonicalPath());
-
- locatorProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+ locatorProps.setProperty(CLUSTER_CONFIGURATION_DIR, clusterConfigDir.getCanonicalPath());
+ locatorProps.setProperty(HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
+ WaitCriterion wc = new WaitCriterion() {
+ @Override
+ public boolean done() {
+ return locator.isSharedConfigurationRunning();
+ }
+ @Override
+ public String description() {
+ return "Waiting for shared configuration to be started";
+ }
+ };
+ waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null,
- locatorProps);
- WaitCriterion wc = new WaitCriterion() {
- @Override
- public boolean done() {
- return locator.isSharedConfigurationRunning();
- }
-
- @Override
- public String description() {
- return "Waiting for shared configuration to be started";
- }
- };
- waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
- }
-
assertTrue(clusterConfigDir.list().length > 0);
final Object[] result = new Object[4];
@@ -632,64 +597,57 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
});
}
- public Object[] setup() {
- disconnectAllFromDS();
- final int [] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+ private Object[] setup() throws IOException {
+ final int [] ports = getRandomAvailableTCPPorts(3);
final int locator1Port = ports[0];
final String locator1Name = "locator1-" + locator1Port;
- VM locatorAndMgr = Host.getHost(0).getVM(3);
-
+ final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
+
+ VM locatorAndMgr = getHost(0).getVM(3);
Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
@Override
- public Object call() {
+ public Object call() throws IOException {
int httpPort;
int jmxPort;
String jmxHost;
try {
jmxHost = InetAddress.getLocalHost().getHostName();
- }
- catch (UnknownHostException ignore) {
+ } catch (UnknownHostException ignore) {
jmxHost = "localhost";
}
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
jmxPort = ports[0];
httpPort = ports[1];
-
- final File locatorLogFile = new File("locator-" + locator1Port + ".log");
+ final File locatorLogFile = new File(locatorLogPath);
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator1Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "config");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
- locatorProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
-
- try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null,
- locatorProps);
- WaitCriterion wc = new WaitCriterion() {
- @Override
- public boolean done() {
- return locator.isSharedConfigurationRunning();
- }
-
- @Override
- public String description() {
- return "Waiting for shared configuration to be started";
- }
- };
- waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
- }
+ locatorProps.setProperty(NAME_NAME, locator1Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "config");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_START_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
+ locatorProps.setProperty(JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
+ locatorProps.setProperty(HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
+ WaitCriterion wc = new WaitCriterion() {
+ @Override
+ public boolean done() {
+ return locator.isSharedConfigurationRunning();
+ }
+ @Override
+ public String description() {
+ return "Waiting for shared configuration to be started";
+ }
+ };
+ waitForCriterion(wc, TIMEOUT, INTERVAL, true);
final Object[] result = new Object[4];
result[0] = locator1Port;
@@ -706,36 +664,34 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
int httpPort = (Integer)result[3];
shellConnect(jmxHost, jmxPort, httpPort, gfsh);
+
+ final String dataMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + dataMember;
+
// Create a cache in VM 1
- VM dataMember = Host.getHost(0).getVM(1);
+ VM dataMember = getHost(0).getVM(1);
dataMember.invoke(new SerializableCallable() {
@Override
public Object call() throws IOException {
Properties localProps = new Properties();
- File workingDir = new File(ClusterConfigurationDUnitTest.dataMember);
+ File workingDir = new File(dataMemberWorkingDir);
workingDir.mkdirs();
- workingDir.deleteOnExit();
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
- localProps.setProperty(DistributionConfig.NAME_NAME, ClusterConfigurationDUnitTest.dataMember);
- localProps.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "true");
- localProps.setProperty(DistributionConfig.DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
+ localProps.setProperty(NAME_NAME, ClusterConfigurationDUnitTest.dataMember);
+ localProps.setProperty(USE_CLUSTER_CONFIGURATION_NAME, "true");
+ localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
getSystem(localProps);
Cache cache = getCache();
assertNotNull(cache);
- return CliUtil.getAllNormalMembers(cache);
+ return getAllNormalMembers(cache);
}
});
+
return result;
}
-
- /*********************************
- * Region commands
- */
-
private void createRegion(String regionName, RegionShortcut regionShortCut, String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
@@ -781,32 +737,6 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.toString());
}
- class CommandBuilder {
- private CommandStringBuilder csb;
-
- public CommandBuilder(String commandName, Map<String, String> options) {
- csb = new CommandStringBuilder(commandName);
-
- Set<Entry<String, String>> entries = options.entrySet();
-
- Iterator<Entry<String, String>> iter = entries.iterator();
-
- while (iter.hasNext()) {
- Entry<String, String> entry = iter.next();
- String option = entry.getKey();
-
- if (StringUtils.isBlank(option)) {
- csb.addOption(option, entry.getValue());
- }
- }
- }
-
- public String getCommandString() {
- return csb.toString();
- }
- }
-
-
private void createPersistentRegion(String regionName, RegionShortcut regionShortCut, String group, String diskStoreName) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGION, regionName);
@@ -823,15 +753,16 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
}
private void alterRegion(String regionName,
- String cloningEnabled,
- String aeqId,
- String cacheListener,
- String cacheWriter,
- String cacheLoader,
- String entryExpIdleTime,
- String entryExpIdleTimeAction,
- String evictionMax,
- String gsId) {
+ String cloningEnabled,
+ String aeqId,
+ String cacheListener,
+ String cacheWriter,
+ String cacheLoader,
+ String entryExpIdleTime,
+ String entryExpIdleTimeAction,
+ String evictionMax,
+ String gsId) {
+
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_REGION);
csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, "false");
csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, aeqId);
@@ -846,7 +777,8 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.getCommandString());
}
- protected void executeAndVerifyCommand(String commandString) {
+
+ private void executeAndVerifyCommand(String commandString) {
CommandResult cmdResult = executeCommand(commandString);
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Command : " + commandString);
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Command Result : " + commandResultToString(cmdResult));
@@ -854,21 +786,16 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
assertFalse(cmdResult.failedToPersist());
}
-
- /****************
- * CREATE/DESTROY INDEX
- */
-
- public void createIndex(String indexName, String expression, String regionName, String group) {
+ private void createIndex(String indexName, String expression, String regionName, String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
csb.addOption(CliStrings.CREATE_INDEX__REGION, regionName);
executeAndVerifyCommand(csb.getCommandString());
}
-
- public void destroyIndex(String indexName, String regionName, String group) {
- if (StringUtils.isBlank(indexName) && StringUtils.isBlank(regionName) && StringUtils.isBlank(group)) {
+
+ private void destroyIndex(String indexName, String regionName, String group) {
+ if (isBlank(indexName) && isBlank(regionName) && isBlank(group)) {
return;
}
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
@@ -878,20 +805,18 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.getCommandString());
}
- /*******
- * CREATE/DESTROY DISK-STORE
- */
- private void createDiskStore(String diskStoreName,
- String diskDirs,
- String autoCompact,
- String allowForceCompaction,
- String compactionThreshold,
- String duCritical,
- String duWarning,
- String maxOplogSize,
- String queueSize,
- String timeInterval,
- String writeBufferSize) {
+ private void createDiskStore(String diskStoreName,
+ String diskDirs,
+ String autoCompact,
+ String allowForceCompaction,
+ String compactionThreshold,
+ String duCritical,
+ String duWarning,
+ String maxOplogSize,
+ String queueSize,
+ String timeInterval,
+ String writeBufferSize) {
+
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
csb.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreName);
csb.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, diskDirs);
@@ -914,14 +839,7 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.toString());
}
- /*********
- *
- * CREATE GATEWAY-RECEIVER
- *
- */
-
- private void createGatewayReceiver(String manualStart, String bindAddress,
- String startPort, String endPort, String maxTimeBetweenPings, String group) {
+ private void createGatewayReceiver(String manualStart, String bindAddress, String startPort, String endPort, String maxTimeBetweenPings, String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYRECEIVER);
csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART, manualStart);
csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT, startPort);
@@ -933,18 +851,18 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
}
private void createGatewaySender(String id,
- String batchSize,
- String alertThreshold,
- String batchTimeInterval,
- String dispatcherThreads,
- String enableConflation,
- String manualStart,
- String maxQueueMemory,
- String orderPolicy,
- String parallel,
- String rmDsId,
- String socketBufferSize,
- String socketReadTimeout) {
+ String batchSize,
+ String alertThreshold,
+ String batchTimeInterval,
+ String dispatcherThreads,
+ String enableConflation,
+ String manualStart,
+ String maxQueueMemory,
+ String orderPolicy,
+ String parallel,
+ String rmDsId,
+ String socketBufferSize,
+ String socketReadTimeout) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYSENDER);
csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ID, id);
@@ -964,13 +882,8 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.getCommandString());
}
-
- /*******
- * CREATE ASYNC-EVENT-QUEUE
- */
-
- public void createAsyncEventQueue(String id, String persistent , String diskStoreName, String batchSize, String maxQueueMemory, String group) {
- String queueCommandsJarName = "testEndToEndSC-QueueCommands.jar";
+ private void createAsyncEventQueue(String id, String persistent , String diskStoreName, String batchSize, String maxQueueMemory, String group) throws IOException {
+ String queueCommandsJarName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "testEndToEndSC-QueueCommands.jar";
final File jarFile = new File(queueCommandsJarName);
try {
@@ -987,7 +900,7 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
"public void init(final Properties props) {this.props = props;}" +
"public Properties getConfig() {return this.props;}}");
- FileUtils.writeByteArrayToFile(jarFile, jarBytes);
+ writeByteArrayToFile(jarFile, jarBytes);
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
csb.addOption(CliStrings.DEPLOY__JAR, queueCommandsJarName);
executeAndVerifyCommand(csb.getCommandString());
@@ -1002,14 +915,12 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY, maxQueueMemory);
executeAndVerifyCommand(csb.getCommandString());
- } catch (IOException e) {
- e.printStackTrace();
} finally {
- FileUtils.deleteQuietly(jarFile);
+ deleteQuietly(jarFile);
}
}
-
- public void configurePDX(String autoSerializerClasses, String ignoreUnreadFields, String persistent, String portableAutoSerializerClasses, String readSerialized) {
+
+ private void configurePDX(String autoSerializerClasses, String ignoreUnreadFields, String persistent, String portableAutoSerializerClasses, String readSerialized) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CONFIGURE_PDX);
csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__AUTO__SERIALIZER__CLASSES, autoSerializerClasses);
csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__IGNORE__UNREAD_FIELDS, ignoreUnreadFields);
@@ -1018,36 +929,31 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__READ__SERIALIZED, readSerialized);
executeAndVerifyCommand(csb.getCommandString());
}
-
- //DEPLOY AND UNDEPLOY JAR
- public void createAndDeployJar(String jarName, String group) {
+
+ private void createAndDeployJar(String jarName, String group) throws IOException {
File newDeployableJarFile = new File(jarName);
- try {
- this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
- CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
- csb.addOption(CliStrings.DEPLOY__JAR, jarName);
- if (!StringUtils.isBlank(group)) {
- csb.addOption(CliStrings.DEPLOY__GROUP, group);
- }
- executeAndVerifyCommand(csb.getCommandString());
- jarFileNames.add(jarName);
- } catch (IOException e) {
- e.printStackTrace();
+ this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
+ CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
+ csb.addOption(CliStrings.DEPLOY__JAR, jarName);
+ if (!isBlank(group)) {
+ csb.addOption(CliStrings.DEPLOY__GROUP, group);
}
+ executeAndVerifyCommand(csb.getCommandString());
+ jarFileNames.add(jarName);
}
-
- public void undeployJar(String jarName, String group) {
+
+ private void undeployJar(String jarName, String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.UNDEPLOY);
- if (!StringUtils.isBlank(jarName)) {
+ if (!isBlank(jarName)) {
csb.addOption(CliStrings.UNDEPLOY__JAR, jarName);
}
- if (!StringUtils.isBlank(group)) {
+ if (!isBlank(group)) {
csb.addOption(CliStrings.UNDEPLOY__GROUP, group);
}
executeAndVerifyCommand(csb.getCommandString());
}
-
- public void alterRuntime(String copyOnRead, String lockLease, String lockTimeout, String messageSyncInterval) {
+
+ private void alterRuntime(String copyOnRead, String lockLease, String lockTimeout, String messageSyncInterval) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ, copyOnRead);
csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE, lockLease);
@@ -1055,13 +961,57 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL, messageSyncInterval);
executeAndVerifyCommand(csb.toString());
}
- public void deleteSavedJarFiles() {
- try {
- FileUtil.deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
- FileUtil.delete(new File("Deploy1.jar"));
- } catch (IOException ioe) {
- ioe.printStackTrace();
+
+ private void deleteSavedJarFiles() throws IOException {
+ deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
+ delete(new File("Deploy1.jar"));
+ }
+
+ private void shutdownAll() throws IOException {
+ VM locatorAndMgr = getHost(0).getVM(3);
+ locatorAndMgr.invoke(new SerializableCallable() {
+ @Override
+ public Object call() throws Exception {
+ GemFireCacheImpl cache = (GemFireCacheImpl)CacheFactory.getAnyInstance();
+ ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
+ return null;
+ }
+ });
+
+ locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
+ //Clean up the directories
+ if (serverNames != null && !serverNames.isEmpty()) {
+ for (String serverName : serverNames) {
+ final File serverDir = new File(serverName);
+ cleanDirectory(serverDir);
+ deleteDirectory(serverDir);
+ }
+ }
+ }
+
+ private static class CommandBuilder {
+
+ private CommandStringBuilder csb;
+
+ public CommandBuilder(String commandName, Map<String, String> options) {
+ csb = new CommandStringBuilder(commandName);
+
+ Set<Entry<String, String>> entries = options.entrySet();
+
+ Iterator<Entry<String, String>> iter = entries.iterator();
+
+ while (iter.hasNext()) {
+ Entry<String, String> entry = iter.next();
+ String option = entry.getKey();
+
+ if (isBlank(option)) {
+ csb.addOption(option, entry.getValue());
+ }
+ }
+ }
+
+ public String getCommandString() {
+ return csb.toString();
}
}
-
}
[31/37] incubator-geode git commit: GEODE-625: Adding tests for
exception handling of functions
Posted by kl...@apache.org.
GEODE-625: Adding tests for exception handling of functions
Testing how functions propagate exceptions from within the function to
the caller or the result collector.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/aca7b288
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/aca7b288
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/aca7b288
Branch: refs/heads/feature/GEODE-1276
Commit: aca7b288f378ec05e00ec3a9277265d1a9679b4a
Parents: 15a2a29
Author: Dan Smith <up...@apache.org>
Authored: Thu Apr 28 14:13:36 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 5 17:17:01 2016 -0700
----------------------------------------------------------------------
.../cache/execute/FunctionServiceBase.java | 287 +++++++++++++++++++
.../FunctionServiceLocalPRDUnitTest.java | 54 ++++
.../FunctionServiceLocalRRDUnitTest.java | 52 ++++
...unctionServiceMultipleOnMemberDUnitTest.java | 57 ++++
.../FunctionServicePeerAccessorPRDUnitTest.java | 73 +++++
.../FunctionServicePeerAccessorRRDUnitTest.java | 63 ++++
.../FunctionServiceSingleOnMemberDUnitTest.java | 49 ++++
7 files changed, 635 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceBase.java
new file mode 100644
index 0000000..eeb7d8d
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceBase.java
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import static org.hamcrest.Matchers.isA;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/*
+ * Base class for tests of FunctionService that are agnostic to the
+ * type of Execution that they are running on. The goal is to completely
+ * cover all common behavior of sending results and sending exceptions
+ * here.
+ */
+public abstract class FunctionServiceBase extends JUnit4CacheTestCase {
+
+ @Rule
+ public transient ExpectedException thrown = ExpectedException.none();
+
+ private transient CustomCollector customCollector;
+
+ @Before
+ public void createCollector() {
+ this.customCollector = new CustomCollector();
+ }
+
+ /**
+ * Return the execution used to execute functions for this
+ * test. Subclasses should override this to provide a specific
+ * execution, for example onMember.
+ */
+ public abstract Execution getExecution();
+
+ /**
+ * Return the number of members the function is expected
+ * to execute on
+ */
+ public abstract int numberOfExecutions();
+
+ @Test
+ public void defaultCollectorReturnsSingleResult() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {context.getResultSender().lastResult("done");});
+ List<String> results = (List<String>) rc.getResult();
+ assertEquals(numberOfExecutions(), results.size());
+ results.stream().forEach(element -> assertEquals("done", element));
+ }
+
+ @Test()
+ public void defaultCollectorThrowsExceptionAfterFunctionThrowsIllegalState() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {throw new IllegalStateException();});
+ thrown.expect(FunctionException.class);
+ thrown.expectCause(isA(IllegalStateException.class));
+ final Object result = rc.getResult();
+ }
+
+ @Test()
+ public void defaultCollectorThrowsExceptionAfterFunctionThrowsFunctionException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {throw new FunctionException();});
+
+ thrown.expect(FunctionException.class);
+ final Object result = rc.getResult();
+ }
+
+ /**
+ * Tests what happens if a function returns an exception as a result. This
+ * is kind a weird, but it seems that the default collector will just throw it
+ * as an exception
+ */
+ @Test()
+ public void defaultCollectorThrowsExceptionAfterFunctionReturnsIllegalStateException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {context.getResultSender().lastResult(new IllegalStateException());});
+
+ thrown.expect(FunctionException.class);
+ thrown.expectCause(isA(IllegalStateException.class));
+ final Object result = rc.getResult();
+ }
+
+ @Test()
+ public void defaultCollectorThrowsExceptionAfterFunctionReturnsFunctionException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {context.getResultSender().lastResult(new FunctionException());});
+ thrown.expect(FunctionException.class);
+ thrown.expectCause(is((Throwable) null));
+ final Object result = rc.getResult();
+ }
+
+ @Test()
+ public void defaultCollectorThrowsExceptionAfterFunctionReturnsIllegalStateExceptionAsIntermediateResult() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {
+ context.getResultSender().sendResult(new IllegalStateException());
+ context.getResultSender().lastResult("done");
+ });
+ thrown.expect(FunctionException.class);
+ thrown.expectCause(isA(IllegalStateException.class));
+ final Object result = rc.getResult();
+ }
+
+ @Test()
+ public void defaultCollectorThrowsExceptionAfterFunctionReturnsFunctionExceptionAsIntermediateResult() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {
+ context.getResultSender().sendResult(new FunctionException());
+ context.getResultSender().lastResult("done");
+ });
+ thrown.expect(FunctionException.class);
+ thrown.expectCause(is((Throwable) null));
+ final Object result = rc.getResult();
+ }
+
+ @Test
+ public void defaultCollectorReturnsResultOfSendException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {
+ context.getResultSender().sendException(new IllegalStateException());
+ });
+ final List<Object> result = (List<Object>) rc.getResult();
+ assertEquals(numberOfExecutions(), result.size());
+ result.stream().forEach(element -> assertEquals(IllegalStateException.class, element.getClass()));
+ }
+
+ @Test
+ public void defaultCollectorReturnsResultOfSendFunctionException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {
+ context.getResultSender().sendException(new FunctionException());
+ });
+ final List<Object> result = (List<Object>) rc.getResult();
+ assertEquals(numberOfExecutions(), result.size());
+ result.stream().forEach(element -> assertEquals(FunctionException.class, element.getClass()));
+ }
+
+ @Test
+ public void customCollectorDoesNotSeeExceptionFunctionThrowsIllegalState() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().withCollector(customCollector).execute((context) -> {throw new IllegalStateException();});
+ try {
+ rc.getResult();
+ fail("should have received an exception");
+ } catch (FunctionException expected) {}
+
+ Assert.assertEquals(0, customCollector.getResult().size());
+ }
+
+ @Test
+ public void customCollectorDoesNotSeeExceptionFunctionThrowsFunctionException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().withCollector(customCollector).execute((context) -> {throw new FunctionException();});
+ try {
+ rc.getResult();
+ fail("should have received an exception");
+ } catch (FunctionException expected) {}
+
+ Assert.assertEquals(0, customCollector.getResult().size());
+ }
+
+ @Test
+ public void customCollectorDoesNotSeeExceptionAfterFunctionReturnsIllegalStateException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {context.getResultSender().lastResult(new IllegalStateException());});
+ try {
+ rc.getResult();
+ fail("should have received an exception");
+ } catch (FunctionException expected) {}
+ Assert.assertEquals(0, customCollector.getResult().size());
+ }
+
+ @Test
+ public void customCollectorDoesNotSeeExceptionAfterFunctionReturnsIllegalStateExceptionAsIntermediateResult() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().execute((context) -> {
+ context.getResultSender().sendResult(new IllegalStateException());
+ context.getResultSender().lastResult("done");
+ });
+ try {
+ rc.getResult();
+ fail("should have received an exception");
+ } catch (FunctionException expected) {}
+ Assert.assertEquals(0, customCollector.getResult().size());
+ }
+
+ @Test
+ public void customCollectorReturnsResultOfSendException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().withCollector(customCollector).execute((context) -> {
+ context.getResultSender().sendException(new IllegalStateException());
+ });
+ final List<Object> result = (List<Object>) rc.getResult();
+ assertEquals(numberOfExecutions(), result.size());
+ result.stream().forEach(element -> assertEquals(IllegalStateException.class, element.getClass()));
+ assertEquals(result, customCollector.getResult());
+ }
+
+ @Test
+ public void customCollectorReturnsResultOfSendFunctionException() {
+ final Host host = Host.getHost(0);
+
+ ResultCollector rc = getExecution().withCollector(customCollector).execute((context) -> {
+ context.getResultSender().sendException(new FunctionException());
+ });
+ final List<Object> result = (List<Object>) rc.getResult();
+ assertEquals(numberOfExecutions(), result.size());
+ result.stream().forEach(element -> assertEquals(FunctionException.class, element.getClass()));
+ assertEquals(result, customCollector.getResult());
+ }
+
+ private static class CustomCollector implements ResultCollector<Object, List<Object>> {
+ private ArrayList<Object> results = new ArrayList<Object>();
+
+ @Override
+ public List<Object> getResult() throws FunctionException {
+ return results;
+ }
+
+ @Override
+ public List<Object> getResult(final long timeout, final TimeUnit unit)
+ throws FunctionException, InterruptedException
+ {
+ return results;
+ }
+
+ @Override
+ public void addResult(final DistributedMember memberID, final Object resultOfSingleExecution) {
+ results.add(resultOfSingleExecution);
+ }
+
+ @Override
+ public void endResults() {
+ }
+
+ @Override
+ public void clearResults() {
+ results.clear();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalPRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalPRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalPRDUnitTest.java
new file mode 100644
index 0000000..5617ee6
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalPRDUnitTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test of the behavior of a custom ResultCollector when handling exceptions
+ */
+@Category(DistributedTest.class)
+public class FunctionServiceLocalPRDUnitTest extends FunctionServiceBase {
+
+ public static final String REGION = "region";
+
+ private transient Region<Object, Object> region;
+
+ @Before
+ public void createRegions() {
+ region = getCache().createRegionFactory(RegionShortcut.PARTITION)
+ .create(REGION);
+ PartitionRegionHelper.assignBucketsToPartitions(region);
+ }
+
+ @Override public Execution getExecution() {
+ return FunctionService.onRegion(region);
+ }
+
+ @Override public int numberOfExecutions() {
+ return 1;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalRRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalRRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalRRDUnitTest.java
new file mode 100644
index 0000000..085e709
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceLocalRRDUnitTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test of the behavior of a custom ResultCollector when handling exceptions
+ */
+@Category(DistributedTest.class)
+public class FunctionServiceLocalRRDUnitTest extends FunctionServiceBase {
+
+ public static final String REGION = "region";
+
+ private transient Region<Object, Object> region;
+
+ @Before
+ public void createRegions() {
+ region = getCache().createRegionFactory(RegionShortcut.REPLICATE)
+ .create(REGION);
+ }
+
+ @Override public Execution getExecution() {
+ return FunctionService.onRegion(region);
+ }
+
+ @Override public int numberOfExecutions() {
+ return 1;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceMultipleOnMemberDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceMultipleOnMemberDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceMultipleOnMemberDUnitTest.java
new file mode 100644
index 0000000..cc67830
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceMultipleOnMemberDUnitTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test of the behavior of a custom ResultCollector when handling exceptions
+ */
+@Category(DistributedTest.class)
+public class FunctionServiceMultipleOnMemberDUnitTest extends FunctionServiceBase {
+
+ private Set<DistributedMember> members = new HashSet<DistributedMember>();
+
+ @Before
+ public void createDistributedSystems() {
+ getSystem();
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ VM vm1 = host.getVM(1);
+ members.add(vm0.invoke(() -> getSystem().getDistributedMember()));
+ members.add(vm1.invoke(() -> getSystem().getDistributedMember()));
+ }
+
+ @Override public Execution getExecution() {
+ return FunctionService.onMembers(members);
+ }
+
+ @Override public int numberOfExecutions() {
+ return 2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorPRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorPRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorPRDUnitTest.java
new file mode 100644
index 0000000..e5bf2d2
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorPRDUnitTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test of the behavior of a custom ResultCollector when handling exceptions
+ */
+@Category(DistributedTest.class)
+public class FunctionServicePeerAccessorPRDUnitTest extends FunctionServiceBase {
+
+ public static final String REGION = "region";
+
+ private transient Region<Object, Object> region;
+
+ @Before
+ public void createRegions() {
+ region = getCache().createRegionFactory(RegionShortcut.PARTITION_PROXY)
+ .create(REGION);
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ vm0.invoke(() -> {
+
+ getCache().createRegionFactory(RegionShortcut.PARTITION)
+ .create(REGION);
+
+ });
+
+ PartitionRegionHelper.assignBucketsToPartitions(region);
+ }
+
+ @Override public Execution getExecution() {
+ return FunctionService.onRegion(region);
+ }
+
+ @Override public int numberOfExecutions() {
+ return 1;
+ }
+
+ @Ignore("GEODE-1348 - With this topology, the exception is not wrapped in FunctionException")
+ @Override public void defaultCollectorThrowsExceptionAfterFunctionThrowsIllegalState() {
+ }
+
+ @Ignore("GEODE-1348 - With this topology, the exception is not wrapped in FunctionException")
+ @Override public void customCollectorDoesNotSeeExceptionFunctionThrowsIllegalState() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorRRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorRRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorRRDUnitTest.java
new file mode 100644
index 0000000..439e04f
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServicePeerAccessorRRDUnitTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test of the behavior of a custom ResultCollector when handling exceptions
+ */
+@Category(DistributedTest.class)
+public class FunctionServicePeerAccessorRRDUnitTest extends FunctionServiceBase {
+
+ public static final String REGION = "region";
+
+ private transient Region<Object, Object> region;
+
+ @Before
+ public void createRegions() {
+ region = getCache().createRegionFactory(RegionShortcut.REPLICATE_PROXY)
+ .create(REGION);
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ vm0.invoke(() -> {
+
+ getCache().createRegionFactory(RegionShortcut.REPLICATE)
+ .create(REGION);
+
+ });
+ }
+
+ @Override public Execution getExecution() {
+ return FunctionService.onRegion(region);
+ }
+
+ @Override public int numberOfExecutions() {
+ return 1;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aca7b288/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceSingleOnMemberDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceSingleOnMemberDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceSingleOnMemberDUnitTest.java
new file mode 100644
index 0000000..29dd3ee
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceSingleOnMemberDUnitTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.execute;
+
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Test of the behavior of a custom ResultCollector when handling exceptions
+ */
+@Category(DistributedTest.class)
+public class FunctionServiceSingleOnMemberDUnitTest extends FunctionServiceBase {
+
+ private InternalDistributedMember memberId;
+
+ @Before
+ public void createDistributedSystem() {
+ memberId = getSystem().getDistributedMember();
+ }
+
+ @Override public Execution getExecution() {
+ return FunctionService.onMember(memberId);
+ }
+
+ @Override public int numberOfExecutions() {
+ return 1;
+ }
+
+
+}
[21/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
deleted file mode 100755
index c34c91a..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
+++ /dev/null
@@ -1,2399 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.i18n;
-
-import com.gemstone.gemfire.i18n.StringId;
-
-/**
- * Added as parent class of LocalizedStrings because Eclipse is complaining
- * about the implicit static initializer for all these static final constants
- * being greater than 65535.
- *
- * @since 7.0
- */
-class ParentLocalizedStrings {
- /** reserved space for commonly used strings, messageId 0-1024 **/
- public static final StringId EMPTY = new StringId(0, "");
- public static final StringId ONE_ARG = StringId.LITERAL;
- //alias for use in temporarily adding debugging to the product
- public static final StringId DEBUG = ONE_ARG;
-
- public static final StringId DONT_RELEASE = ONE_ARG;
-
- //alias for use in the test tree
- public static final StringId TESTING = ONE_ARG;
- public static final StringId TWO_ARG = new StringId(2, "{0} {1}");
- public static final StringId TWO_ARG_COLON = new StringId(3, "{0} : {1}");
- public static final StringId ERROR = new StringId(4, "ERROR");
- public static final StringId CACHE_IS_CLOSING = new StringId(1021, "Cache is closing");
- public static final StringId NOT_A_REAL_GEMFIREVM = new StringId(1022, "Not a real GemFireVM");
- public static final StringId SHOULDNT_INVOKE = new StringId(1023, "Should not be invoked");
- public static final StringId UNSUPPORTED_AT_THIS_TIME = new StringId(1024, "Unsupported at this time");
-
- /**Gemfire strings, messageId 1025-15000 **/
- public static final StringId AbstractHealthEvaluator_OKAY_HEALTH__0 = new StringId(1025, "OKAY_HEALTH: {0}");
- public static final StringId AbstractHealthEvaluator_POOR_HEALTH__0 = new StringId(1026, "POOR_HEALTH: {0}");
- public static final StringId AbstractRegion_CACHECALLBACK_CLOSE_EXCEPTION = new StringId(1027, "CacheCallback close exception");
- public static final StringId PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS = new StringId(1028, "A pool named \"{0}\" already exists");
- public static final StringId AcceptorImpl_CACHE_SERVER_CONNECTION_LISTENER_BOUND_TO_ADDRESS_0_WITH_BACKLOG_1 = new StringId(1029, "Cache server connection listener bound to address {0} with backlog {1}.");
- public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT = new StringId(1030, "Cache server: failed accepting client connection due to socket timeout.");
- public static final StringId AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0 = new StringId(1031, "Cache server: failed accepting client connection {0}");
- public static final StringId AcceptorImpl_CACHE_SERVER_ON_PORT_0_IS_SHUTTING_DOWN = new StringId(1032, "Cache server on port {0} is shutting down.");
- public static final StringId AcceptorImpl_CACHE_SERVER_TIMED_OUT_WAITING_FOR_HANDSHAKE_FROM__0 = new StringId(1033, "Cache server: timed out waiting for handshake from {0}");
- public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_EXCEPTION = new StringId(1034, "Cache server: Unexpected Exception");
- public static final StringId AcceptorImpl_CACHE_SERVER_UNEXPECTED_IOEXCEPTION_FROM_ACCEPT = new StringId(1035, "Cache server: Unexpected IOException from accept");
- public static final StringId AcceptorImpl_EXCEEDED_MAX_CONNECTIONS_0 = new StringId(1036, "exceeded max-connections {0}");
- public static final StringId AcceptorImpl_IGNORING = new StringId(1037, "ignoring");
- public static final StringId AcceptorImpl_IGNORING_EVENT_ON_SELECTOR_KEY__0 = new StringId(1038, "ignoring event on selector key {0}");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_A_PREVIOUS_CONNECTION_ATTEMPT_FROM_THIS_CLIENT_IS_STILL_BEING_PROCESSED__0 = new StringId(1039, "A previous connection attempt from this client is still being processed: {0}");
- public static final StringId AcceptorImpl_REJECTED_CONNECTION_FROM_0_BECAUSE_CURRENT_CONNECTION_COUNT_OF_1_IS_GREATER_THAN_OR_EQUAL_TO_THE_CONFIGURED_MAX_OF_2 = new StringId(1040, "Rejected connection from {0} because current connection count of {1} is greater than or equal to the configured max of {2}");
- public static final StringId AcceptorImpl_SELECTOR_ENABLED = new StringId(1041, "SELECTOR enabled");
- public static final StringId AcceptorImpl_UNEXPECTED = new StringId(1042, "unexpected");
- public static final StringId AdminDistributedSystem_COULD_NOT_SET_THE_GEMFIRE_VM = new StringId(1043, "Could not set the GemFire VM.");
- public static final StringId AdminDistributedSystemImpl_ADDING_NEW_APPLICATION_FOR__0 = new StringId(1044, "Adding new Application for {0}");
- public static final StringId AdminDistributedSystemImpl_ADDING_NEW_CACHESERVER_FOR__0 = new StringId(1045, "Adding new CacheServer for {0}");
- public static final StringId AdminDistributedSystemImpl_WHILE_GETTING_CANONICAL_FILE = new StringId(1046, "While getting canonical file");
- public static final StringId AdminRequest_RESPONSE_TO__0__WAS_CANCELLED = new StringId(1047, "Response to {0} was cancelled.");
- public static final StringId AdminWaiters_COULD_NOT_SEND_REQUEST_0 = new StringId(1048, "Could not send request.{0}");
- public static final StringId AdminWaiters_REQUEST_SEND_TO_0_WAS_CANCELLED_1 = new StringId(1049, "Request sent to {0} was cancelled. {1}");
- public static final StringId AdminWaiters_REQUEST_SENT_TO_0_FAILED_SINCE_MEMBER_DEPARTED_1 = new StringId(1050, "Request sent to {0} failed since member departed.{1}");
- public static final StringId AgentImpl_0__IS_ALREADY_REGISTERED = new StringId(1051, "{0} is already registered.");
- public static final StringId AgentImpl_AGENT_HAS_STOPPED = new StringId(1052, "Agent has stopped");
- public static final StringId AgentImpl_AUTO_CONNECT_FAILED__0 = new StringId(1053, "auto connect failed: {0}");
- public static final StringId AgentImpl_FAILED_TO_START_HTTPADAPTOR__0 = new StringId(1054, "Failed to start HttpAdaptor: {0}");
- public static final StringId AgentImpl_FAILED_TO_START_RMICONNECTORSERVER = new StringId(1055, "Failed to start RMIConnectorServer:");
- public static final StringId AgentImpl_FAILED_TO_START_SNMPADAPTOR__0 = new StringId(1056, "Failed to start SnmpAdaptor: {0}");
- public static final StringId AgentImpl_GEMFIRE_JMX_AGENT_IS_RUNNING = new StringId(1057, "GemFire JMX Agent is running...");
- public static final StringId AgentImpl_HTTPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1058, "HttpAdaptor already registered as {0}");
- public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_ADDRESS__0 = new StringId(1059, "HTTP adaptor listening on address: {0}");
- public static final StringId AgentImpl_HTTP_ADAPTOR_LISTENING_ON_PORT__0 = new StringId(1060, "HTTP adaptor listening on port: {0}");
- public static final StringId AgentImpl_INCORRECT_NULL_HOSTNAME = new StringId(1061, "Incorrect null hostname");
- public static final StringId AgentImpl_INCORRECT_PORT_VALUE__0 = new StringId(1062, "Incorrect port value {0}");
- public static final StringId AgentImpl_RMICONNECTORSERVER_ALREADY_REGISTERED_AS__0 = new StringId(1063, "RMIConnectorServer already registered as {0}");
- public static final StringId AgentImpl_SNMPADAPTOR_ALREADY_REGISTERED_AS__0 = new StringId(1064, "SnmpAdaptor already registered as {0}");
- public static final StringId AgentImpl_STOPPING_JMX_AGENT = new StringId(1065, "Stopping JMX agent");
- public static final StringId AgentImpl_XSLTPROCESSOR_ALREADY_REGISTERED_AS__0 = new StringId(1066, "XsltProcessor already registered as {0}");
- public static final StringId AbstractRegion_THE_CONNECTION_POOL_0_HAS_NOT_BEEN_CREATED = new StringId(1067, "The connection pool \"{0}\" has not been created");
- public static final StringId AttributesFactory_0_WAS_NOT_AN_EXISTING_DIRECTORY = new StringId(1068, "\"{0}\" was not an existing directory.");
- public static final StringId AttributesFactory_ADDCACHELISTENER_PARAMETER_WAS_NULL = new StringId(1069, "addCacheListener parameter was null");
- public static final StringId AttributesFactory_AN_EVICTION_CONTROLLER_WITH_LOCAL_DESTROY_EVICTION_ACTION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1070, "An Eviction Controller with local destroy eviction action is incompatible with distributed replication");
- public static final StringId AttributesFactory_CAN_NOT_SET_DIFFERENT_CACHE_LOADER_IN_REGIONATTRIBUTES_AND_PARTITIONATTRIBUTES = new StringId(1071, "Can not set different cache loader in RegionAttributes and PartitionAttributes.");
- public static final StringId AttributesFactory_CONCURRENCYLEVEL_MUST_BE_0 = new StringId(1072, "concurrencyLevel must be > 0");
- public static final StringId AttributesFactory_DATAPOLICY_MUST_NOT_BE_NULL = new StringId(1073, "dataPolicy must not be null");
- public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1074, "Data policies other than {0} are not allowed in partitioned regions.");
- public static final StringId AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_SUPPORTED_FOR_PARTITIONED_REGIONS = new StringId(1075, "Data policies other than {0} are not supported for Partitioned Regions");
- public static final StringId AttributesFactory_DATA_POLICY_0_IS_NOT_ALLOWED_FOR_A_PARTITIONED_REGION_DATAPOLICIES_OTHER_THAN_1_ARE_NOT_ALLOWED = new StringId(1076, "Data policy {0} is not allowed for a partitioned region. DataPolicies other than {1} are not allowed.");
- public static final StringId AttributesFactory_DIR_SIZE_CANNOT_BE_NEGATIVE_0 = new StringId(1077, "Dir size cannot be negative : {0}");
- public static final StringId AttributesFactory_EVICTION_IS_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1078, "Eviction is not allowed in partitioned regions.");
- public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_DESTROY_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1079, "ExpirationAction.LOCAL_DESTROY on the entries is incompatible with distributed replication");
- public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_ENTRIES_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1080, "ExpirationAction.LOCAL_INVALIDATE on the entries is incompatible with distributed replication");
- public static final StringId AttributesFactory_EXPIRATIONACTIONLOCAL_INVALIDATE_ON_THE_REGION_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION = new StringId(1081, "ExpirationAction.LOCAL_INVALIDATE on the region is incompatible with distributed replication");
- public static final StringId AttributesFactory_EXPIRATIONATTRIBUTES_FOR_REGIONIDLETIMEOUT_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1082, "ExpirationAttributes for regionIdleTimeout are not allowed in partitioned regions.");
- public static final StringId AttributesFactory_EXPIRATIONATTRIBUTES_FOR_REGIONTIMETOLIVE_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1083, "ExpirationAttributes for regionTimeToLive are not allowed in partitioned regions.");
- public static final StringId AttributesFactory_EXPIRATION_ATTRIBUTES_ARE_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1084, "Expiration Attributes are not allowed in partitioned regions.");
- public static final StringId AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL = new StringId(1085, "idleTimeout must not be null");
- public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_ENTRY_EXPIRATION_IS_NOT_ALLOWED = new StringId(1086, "If the data policy is {0} then entry expiration is not allowed.");
- public static final StringId AttributesFactory_IF_THE_DATA_POLICY_IS_0_THEN_EVICTION_IS_NOT_ALLOWED = new StringId(1087, "If the data policy is {0} then eviction is not allowed.");
- public static final StringId AttributesFactory_IF_THE_MEMBERSHIP_ATTRIBUTES_HAS_REQUIRED_ROLES_THEN_SCOPE_MUST_NOT_BE_LOCAL = new StringId(1088, "If the membership attributes has required roles then scope must not be LOCAL.");
- public static final StringId AttributesFactory_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT = new StringId(1089, "initCacheListeners parameter had a null element");
- public static final StringId AttributesFactory_INITIALCAPACITY_MUST_BE_0 = new StringId(1090, "initialCapacity must be >= 0");
- public static final StringId AttributesFactory_KEYCONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1091, "keyConstraint must not be a primitive type");
- public static final StringId AttributesFactory_LOADFACTOR_MUST_BE_0_VALUE_IS_0 = new StringId(1092, "loadFactor must be > 0, value is {0}");
- public static final StringId AttributesFactory_MIRRORTYPE_MUST_NOT_BE_NULL = new StringId(1093, "mirrorType must not be null");
- public static final StringId AttributesFactory_MORE_THAN_ONE_CACHE_LISTENER_EXISTS = new StringId(1094, "More than one cache listener exists.");
- public static final StringId AttributesFactory_NO_MIRROR_TYPE_CORRESPONDS_TO_DATA_POLICY_0 = new StringId(1095, "No mirror type corresponds to data policy \"{0}\".");
- public static final StringId AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1 = new StringId(1096, " Number of diskSizes is {0} which is not equal to number of disk Dirs which is {1}");
- public static final StringId AttributesFactory_PARTITIONATTRIBUTES_LOCALMAXMEMORY_MUST_NOT_BE_NEGATIVE = new StringId(1097, "PartitionAttributes localMaxMemory must not be negative.");
- public static final StringId AttributesFactory_SCOPETYPE_MUST_NOT_BE_NULL = new StringId(1098, "scopeType must not be null");
- public static final StringId AttributesFactory_SETLOCKGRANTERTRUE_IS_NOT_ALLOWED_IN_PARTITIONED_REGIONS = new StringId(1099, "setLockGranter(true) is not allowed in Partitioned Regions.");
- public static final StringId AttributesFactory_SETTING_SCOPE_ON_A_PARTITIONED_REGIONS_IS_NOT_ALLOWED = new StringId(1100, "Setting Scope on a Partitioned Regions is not allowed.");
- public static final StringId AttributesFactory_STATISTICS_MUST_BE_ENABLED_FOR_EXPIRATION = new StringId(1101, "Statistics must be enabled for expiration");
- public static final StringId AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL = new StringId(1102, "timeToLive must not be null");
- public static final StringId AttributesFactory_TOTAL_SIZE_OF_PARTITION_REGION_MUST_BE_0 = new StringId(1103, "Total size of partition region must be > 0.");
- public static final StringId AttributesFactory_VALUECONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE = new StringId(1104, "valueConstraint must not be a primitive type");
- public static final StringId BaseCommand_0_CONNECTION_DISCONNECT_DETECTED_BY_EOF = new StringId(1105, "{0}: connection disconnect detected by EOF.");
- public static final StringId BaseCommand_0_EOFEXCEPTION_DURING_A_WRITE_OPERATION_ON_REGION__1_KEY_2_MESSAGEID_3 = new StringId(1106, "{0}: EOFException during a write operation on region : {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_0_QUERYSTRING_IS_1 = new StringId(1107, "{0} : QueryString is: {1}.");
- public static final StringId BaseCommand_0_UNEXPECTED_ERROR_ON_SERVER = new StringId(1108, "{0} : Unexpected Error on server");
- public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION = new StringId(1109, "{0}: Unexpected Exception");
- public static final StringId BaseCommand_0_UNEXPECTED_EXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1110, "{0}: Unexpected Exception during operation on region: {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION = new StringId(1111, "{0}: Unexpected IOException: ");
- public static final StringId BaseCommand_0_UNEXPECTED_IOEXCEPTION_DURING_OPERATION_FOR_REGION_1_KEY_2_MESSID_3 = new StringId(1112, "{0}: Unexpected IOException during operation for region: {1} key: {2} messId: {3}");
- public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION = new StringId(1113, "{0}: Unexpected ShutdownException: ");
- public static final StringId BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1114, "{0}: Unexpected ShutdownException during operation on region: {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION = new StringId(1115, "{0}: Unexpected ThreadInterruptedException: ");
- public static final StringId BaseCommand_0_UNEXPECTED_THREADINTERRUPTEDEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1116, "{0}: Unexpected ThreadInterruptedException during operation on region: {1} key: {2} messageId: {3}");
- public static final StringId BaseCommand_UNKNOWN_QUERY_EXCEPTION = new StringId(1117, "Uknown query Exception.");
- public static final StringId BaseCommand_SEVERE_CACHE_EXCEPTION_0 = new StringId(1118, "Severe cache exception : {0}");
- public static final StringId BaseCommand_UNEXPECTED_QUERYINVALIDEXCEPTION_WHILE_PROCESSING_QUERY_0 = new StringId(1119, "Unexpected QueryInvalidException while processing query {0}");
- public static final StringId LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED = new StringId(1120, "The region {0} was configured to use off heap memory but no off heap memory was configured");
- // ok to reuse 1121
- public static final StringId CacheServerImpl_CACHESERVER_CONFIGURATION___0 = new StringId(1122, "CacheServer Configuration: {0}");
- public static final StringId CacheServerImpl_FORCING_NOTIFYBYSUBSCRIPTION_TO_SUPPORT_DYNAMIC_REGIONS = new StringId(1123, "Forcing notifyBySubscription to support dynamic regions");
- // ok to reuse 1124..1130
- public static final StringId BucketAdvisor_ATTEMPTED_TO_CLOSE_BUCKETADVISOR_THAT_IS_ALREADY_CLOSED = new StringId(1131, "Attempted to close BucketAdvisor that is already CLOSED");
- public static final StringId AgentImpl_COULD_NOT_TAIL_0_BECAUSE_1 = new StringId(1132, "Could not tail \"{0}\" because: {1}");
- public static final StringId SystemAdmin_USED_TO_SPECIFY_A_HOST_NAME_OR_IP_ADDRESS_TO_GIVE_TO_CLIENTS_SO_THEY_CAN_CONNECT_TO_A_LOCATOR = new StringId(1133, "Used to specify a host name or IP address to give to clients so they can connect to a locator.");
- public static final StringId BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY = new StringId(1134, "BucketAdvisor was not closed properly.");
- public static final StringId BucketBackupMessage_BUCKETBACKUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1135, "BucketBackupMessage: data store not configured for this member");
- public static final StringId BucketCleanupMessage_BUCKETCLEANUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER = new StringId(1136, "BucketCleanupMessage: data store not configured for this member");
- public static final StringId BucketRegion_FAILED_TO_SEND_OLD_VALUE_TO_THE_FOLLOWING_MEMBERS_0 = new StringId(1137, "Failed to send old value to the following members: {0}");
- // ok to reuse 1138
- public static final StringId CFactory_COULD_NOT_CREATE_CF5IMPL = new StringId(1139, "Could not create CF5Impl");
- public static final StringId CacheClientNotifier_0_REGISTERCLIENT_EXCEPTION_ENCOUNTERED_IN_REGISTRATION_1 = new StringId(1140, "{0} :registerClient: Exception encountered in registration {1}");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_KEEPING_PROXY_FOR_DURABLE_CLIENT_NAMED_0_FOR_1_SECONDS_2 = new StringId(1141, "CacheClientNotifier: Keeping proxy for durable client named {0} for {1} seconds {2}.");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_THE_REQUESTED_DURABLE_CLIENT_HAS_THE_SAME_IDENTIFIER__0__AS_AN_EXISTING_DURABLE_CLIENT__1__DUPLICATE_DURABLE_CLIENTS_ARE_NOT_ALLOWED = new StringId(1142, "CacheClientNotifier: The requested durable client has the same identifier ( {0} ) as an existing durable client ( {1} ). Duplicate durable clients are not allowed.");
- public static final StringId CacheClientNotifier_CACHECLIENTNOTIFIER_UNSUCCESSFULLY_REGISTERED_CLIENT_WITH_IDENTIFIER__0 = new StringId(1143, "CacheClientNotifier: Unsuccessfully registered client with identifier {0}");
- public static final StringId CacheClientNotifier_CANNOT_NOTIFY_CLIENTS_TO_PERFORM_OPERATION_0_ON_EVENT_1 = new StringId(1144, "CacheClientNotifier: Cannot notify clients to perform operation {0} on event {1}");
- public static final StringId CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_PROCESSING_CQS = new StringId(1145, "Exception occurred while processing CQs");
- public static final StringId CacheClientNotifier_NOTIFYING_CLIENTS_BY_SUBSCRIPTION_0 = new StringId(1146, "Notifying clients by subscription: {0}");
- public static final StringId CacheClientNotifier_UNABLE_TO_CLOSE_CQS_FOR_THE_CLIENT__0 = new StringId(1147, "Unable to close CQs for the client: {0}");
- public static final StringId CacheClientNotifier_UNABLE_TO_GET_THE_CQSERVICE_WHILE_CLOSING_THE_DEAD_PROXIES = new StringId(1148, "Unable to get the CqService while closing the dead proxies");
- public static final StringId CacheClientProxy_0_AN_UNEXPECTED_IOEXCEPTION_OCCURRED_SO_THE_PROXY_WILL_BE_CLOSED = new StringId(1149, "{0}: An unexpected IOException occurred so the proxy will be closed.");
- public static final StringId CacheClientProxy_0_CANCELLING_EXPIRATION_TASK_SINCE_THE_CLIENT_HAS_RECONNECTED = new StringId(1150, "{0}: Cancelling expiration task since the client has reconnected.");
- public static final StringId CacheClientProxy_0_COULD_NOT_STOP_MESSAGE_DISPATCHER_THREAD = new StringId(1151, "{0}: Could not stop message dispatcher thread.");
- public static final StringId CacheClientProxy_0_EXCEPTION_IN_CLOSING_THE_UNDERLYING_HAREGION_OF_THE_HAREGIONQUEUE = new StringId(1152, "{0}: Exception in closing the underlying HARegion of the HARegionQueue");
- public static final StringId CacheClientProxy_0_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1153, "{0}: Exception occurred while attempting to add message to queue");
- public static final StringId CacheClientProxy_0_POSSIBILITY_OF_NOT_BEING_ABLE_TO_SEND_SOME_OR_ALL_THE_MESSAGES_TO_CLIENTS_TOTAL_MESSAGES_CURRENTLY_PRESENT_IN_THE_LIST_1 = new StringId(1154, "{0} Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list {1}.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_SOCKET_BEING_CLOSED_LOCALLY = new StringId(1155, "{0}: Proxy closing due to socket being closed locally.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_BROKEN_PIPE_ON_SOCKET_CONNECTION = new StringId(1156, "{0}: Proxy closing due to unexpected broken pipe on socket connection.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_BY_PEER_ON_SOCKET_CONNECTION = new StringId(1157, "{0}: Proxy closing due to unexpected reset by peer on socket connection.");
- public static final StringId CacheClientProxy_0_PROXY_CLOSING_DUE_TO_UNEXPECTED_RESET_ON_SOCKET_CONNECTION = new StringId(1158, "{0}: Proxy closing due to unexpected reset on socket connection.");
- public static final StringId CacheClientProxy_0__AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1159, "{0} : An unexpected Exception occurred");
- public static final StringId CacheClientProxy_0__EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_ADD_MESSAGE_TO_QUEUE = new StringId(1160, "{0} : Exception occurred while attempting to add message to queue");
- public static final StringId CacheClientProxy_0__PAUSING_PROCESSING = new StringId(1161, "{0} : Pausing processing");
- public static final StringId CacheClientProxy_0__RESUMING_PROCESSING = new StringId(1162, "{0} : Resuming processing");
- public static final StringId CacheClientProxy_0__THE_EXPIRATION_TASK_HAS_FIRED_SO_THIS_PROXY_IS_BEING_TERMINATED = new StringId(1163, "{0} : The expiration task has fired, so this proxy is being terminated.");
- public static final StringId CacheClientProxy_CONNECTIONPROXYIMPL_COULD_NOT_RECOVER_INSTANTIATORS_WITH_0 = new StringId(1164, "ConnectionProxyImpl: Could not recover instantiators with {0}.");
- public static final StringId CacheClientProxy_CONNECTIONPROXYIMPL_COULD_NOT_RECOVER_INSTANTIATORS_WITH_0_BECAUSE_1 = new StringId(1165, "ConnectionProxyImpl: Could not recover instantiators with {0} because {1}");
- public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_BROKEN_PIPE_ON_SOCKET = new StringId(1166, "Problem caused by broken pipe on socket.");
- public static final StringId CacheClientProxy_PROBLEM_CAUSED_BY_MESSAGE_QUEUE_BEING_CLOSED = new StringId(1167, "Problem caused by message queue being closed.");
- public static final StringId CacheClientUpdater_0_CAUGHT_FOLLOWING_EXECPTION_WHILE_ATTEMPTING_TO_CREATE_A_SERVER_TO_CLIENT_COMMUNICATION_SOCKET_AND_WILL_EXIT_1 = new StringId(1168, "{0}: Caught following exception while attempting to create a server-to-client communication socket and will exit: {1}");
- public static final StringId CacheClientUpdater_0_CONNECTION_WAS_REFUSED = new StringId(1169, "{0} connection was refused");
- public static final StringId CacheClientUpdater_SSL_NEGOTIATION_FAILED_WITH_ENDPOINT_0 = new StringId(1170, "SSL negotiation failed with endpoint: {0}");
- public static final StringId CacheClientUpdater_0_EXITING_WITHOUT_READING_SERVER_MESSAGES_BECAUSE_OF_1_REGISTERINTEREST_CALLS_BEING_IN_PROGRESS = new StringId(1171, "{0}: exiting without reading server messages because of {1} registerInterest calls being in progress.");
- public static final StringId CacheClientUpdater_0_RECEIVED_AN_UNSUPPORTED_MESSAGE_TYPE_1 = new StringId(1172, "{0}: Received an unsupported message (type={1})");
- public static final StringId CacheClientUpdater_0__1__2 = new StringId(1173, "{0} : {1} : {2}");
- public static final StringId CacheClientUpdater_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_DESTROY_ENTRY_REGION_0_KEY_1 = new StringId(1174, "The following exception occurred while attempting to destroy entry (region: {0} key: {1})");
- public static final StringId CacheClientUpdater_CACHE_UPDATE_THREAD_FINISHED_WAITING_FOR_REGISTERINTEREST_TO_COMPLETE = new StringId(1175, "Cache update thread finished waiting for registerInterest to complete");
- public static final StringId CacheClientUpdater_CACHE_UPDATE_THREAD_WAITED_MORE_THAN_0_SEC_FOR_REGISTERINTEREST_TO_COMPLETE = new StringId(1176, "Cache update thread waited more than {0} sec for registerInterest to complete");
- public static final StringId CacheClientUpdater_FAILED_TO_INVOKE_CQ_DISPATCHER_ERROR___0 = new StringId(1177, "Failed to invoke CQ Dispatcher. Error : {0}");
- public static final StringId CacheDistributionAdvisor_WAITING_FOR_CURRENT_OPERATIONS_TO_FINISH_0_ = new StringId(1178, "Waiting for current operations to finish( {0} )");
- public static final StringId CacheFactory_0_AN_OPEN_CACHE_ALREADY_EXISTS = new StringId(1179, "{0}: An open cache already exists.");
- public static final StringId InternalDistributedSystem_shutdownHook_shuttingdown = new StringId(1180, "VM is exiting - shutting down distributed system");
- public static final StringId GroupMembershipService_entered_into_membership_in_group_0_with_id_1 = new StringId(1181, "Finished joining (took {0}ms).");
- public static final StringId CacheServerLauncher_CACHE_SERVER_ERROR = new StringId(1182, "Cache server error");
- public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_APPENDED_CHARACTER_DATA_0 = new StringId(1183, "XML Parser characters, appended character data: {0}");
- public static final StringId CacheXmlParser_XML_PARSER_CHARACTERS_NEW_CHARACTER_DATA_0 = new StringId(1184, "XML Parser characters, new character data: {0}");
- public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_CLASS_NAME_0 = new StringId(1185, "XML Parser createDeclarable class name: {0}");
- public static final StringId CacheXmlParser_XML_PARSER_CREATEDECLARABLE_PROPERTIES__0 = new StringId(1186, "XML Parser createDeclarable properties: {0}");
- public static final StringId ClearRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1187, "{0}: The input region name for the clear region request is null");
- public static final StringId ClearRegion_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL = new StringId(1188, " The input region name for the clear region request is null");
- public static final StringId ClearRegion_WAS_NOT_FOUND_DURING_CLEAR_REGION_REGUEST = new StringId(1189, " was not found during clear region request");
- public static final StringId ClientHealtMonitor_0_IS_BEING_TERMINATED_BECAUSE_ITS_CLIENT_TIMEOUT_OF_1_HAS_EXPIRED = new StringId(1190, "{0} is being terminated because its client timeout of {1} has expired.");
- public static final StringId ClientHealthMonitor_0_AN_UNEXPECTED_EXCEPTION_OCCURRED = new StringId(1191, "{0}: An unexpected Exception occurred");
- public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITORTHREAD_MAXIMUM_ALLOWED_TIME_BETWEEN_PINGS_0 = new StringId(1192, "ClientHealthMonitorThread maximum allowed time between pings: {0}");
- public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_REGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1193, "ClientHealthMonitor: Registering client with member id {0}");
- public static final StringId ClientHealthMonitor_CLIENTHEALTHMONITOR_UNREGISTERING_CLIENT_WITH_MEMBER_ID_0 = new StringId(1194, "ClientHealthMonitor: Unregistering client with member id {0}");
- public static final StringId ClientHealthMonitor_CLIENT_HEALTH_MONITOR_THREAD_DISABLED_DUE_TO_MAXIMUMTIMEBETWEENPINGS_SETTING__0 = new StringId(1195, "Client health monitor thread disabled due to maximumTimeBetweenPings setting: {0}");
- public static final StringId ClientHealthMonitor_MONITORING_CLIENT_WITH_MEMBER_ID_0_IT_HAD_BEEN_1_MS_SINCE_THE_LATEST_HEARTBEAT_MAX_INTERVAL_IS_2_TERMINATED_CLIENT = new StringId(1196, "Monitoring client with member id {0}. It had been {1} ms since the latest heartbeat. Max interval is {2}. Terminated client.");
- public static final StringId ClientHealthMonitor_UNEXPECTED_INTERRUPT_EXITING = new StringId(1197, "Unexpected interrupt, exiting");
- public static final StringId ClientProxyMembershipID_UNABLE_TO_DESERIALIZE_MEMBERSHIP_ID = new StringId(1198, "Unable to deserialize membership id");
- public static final StringId DiskStore_IS_USED_IN_NONPERSISTENT_REGION = new StringId(1199, "Only regions with persistence or overflow to disk can specify DiskStore");
- public static final StringId DiskRegion_COMPLEXDISKREGIONGETNEXTDIR_MAX_DIRECTORY_SIZE_WILL_GET_VIOLATED__GOING_AHEAD_WITH_THE_SWITCHING_OF_OPLOG_ANY_WAYS_CURRENTLY_AVAILABLE_SPACE_IN_THE_DIRECTORY_IS__0__THE_CAPACITY_OF_DIRECTORY_IS___1 = new StringId(1200, "Even though the configured directory size limit has been exceeded a new oplog will be created because compaction is enabled. The configured limit is {1}. The current space used in the directory by this disk store is {0}.");
- public static final StringId DiskRegion_PROBLEM_IN_COMPACTOR_THREAD_IT_WILL_TERMINATE = new StringId(1201, "Problem in Compactor thread. It will terminate.");
- public static final StringId DiskRegion_THE_ENTRY_IN_QUESTION_IS_HAVING_DISKID_AS_0 = new StringId(1202, "The entry in question is having DiskId = {0}");
- public static final StringId ConnectionImpl_0_INTERRUPTED_READING_PING_RESPONSE_FOR_TRANSACTION_1 = new StringId(1203, "{0}: Interrupted reading ping response for transaction {1}");
- public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_BATCH_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1204, "{0}: SocketTimeoutException during batch operation on region: {1} key: {2} messageId: {3}");
- public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_CQ_OPERATION = new StringId(1205, "{0}: SocketTimeoutException during cq operation.");
- public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_DESTROY_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1206, "{0}: SocketTimeoutException during destroy operation on region: {1} key: {2} messageId: {3}");
- public static final StringId ConnectionImpl_0_SOCKETTIMEOUTEXCEPTION_DURING_PUT_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3 = new StringId(1207, "{0}: SocketTimeoutException during put operation on region: {1} key: {2} messageId: {3}");
- public static final StringId ConnectionImpl_0_TIMED_OUT_READING_PING_RESPONSE_FOR_TRANSACTION_1 = new StringId(1208, "{0}: Timed out reading ping response for transaction {1}");
- public static final StringId ConnectionImpl_AN_INCORRECT_CONNECTION_HAS_BEEN_ASSIGNED_THIS_CONNECTION_IS_ALREADY_PROCESSING_A_REQUEST = new StringId(1209, "An incorrect connection has been assigned. This connection is already processing a request.");
- public static final StringId ConnectionImpl_CONNECTION_0_WHILE_PERFORMING_A_REMOTE_CLIENTREADYTORECEIVEUPDATES = new StringId(1210, "Connection ({0}): While performing a remote clientReadyToReceiveUpdates");
- public static final StringId ConnectionImpl_THE_CACHESERVER_ON_0_HAS_DIED_UNEXPECTEDLY = new StringId(1211, "The CacheServer on {0} has died unexpectedly");
- public static final StringId ConnectionImpl_UNEXPECTED_MESSAGE_TYPE_0 = new StringId(1212, "Unexpected message type {0}");
- public static final StringId AttributesFactory_CLONENOTSUPPORTEDEXCEPTION_THROWN_IN_CLASS_THAT_IMPLEMENTS_CLONEABLE = new StringId(1213, "CloneNotSupportedException thrown in class that implements cloneable.");
- public static final StringId ConnectionProxyImpl_0_FAILED_TO_SET_PRIMARY_ENDPOINT_TO_1_2 = new StringId(1214, "{0}: Failed to set primary endpoint to <{1}>: {2}");
- public static final StringId CqQueryImpl_CQ_IS_CLOSED_CQNAME_0 = new StringId(1215, "CQ is closed, CqName : {0}");
- public static final StringId ConnectionProxyImpl_0__ADDING__1 = new StringId(1216, "{0} : Adding {1}");
- public static final StringId ConnectionProxyImpl_0__ATTEMPTING_TO_REMOVE_ENDPOINT__1__2__3 = new StringId(1217, "{0} : Attempting to remove endpoint {1} -> {2} : {3}");
- public static final StringId ConnectionProxyImpl_0__CONFIGURATION__1 = new StringId(1218, "{0} : configuration: {1}");
- public static final StringId ConnectionProxyImpl_0__INITIALIZED_USING__1 = new StringId(1219, "{0} : initialized using: {1}");
- public static final StringId ConnectionProxyImpl_0__LIVE__1__CANNOT_BE_REMOVED_BECAUSE_IT_HAS_CONNECTIONS = new StringId(1220, "{0} : Live {1} cannot be removed because it has connections.");
- public static final StringId ConnectionProxyImpl_0__LIVE__1__HAS_BEEN_REMOVED = new StringId(1221, "{0} : Live {1} has been removed.");
- public static final StringId ConnectionProxyImpl_0__NO_EXISTING_LIVE_ENDPOINT_WAS_FOUND_FOR_ENDPOINT__1__2__3__NO_ENDPOINT_WAS_REMOVED = new StringId(1222, "{0} : No existing live endpoint was found for endpoint {1} -> {2} : {3} . No endpoint was removed.");
- public static final StringId ConnectionProxyImpl_0__SUCCESSFULLY_SENT_CLIENT_READY_MESSAGE_AFTER_FAILOVER_TO__1 = new StringId(1223, "{0} : Successfully sent client ready message after failover to {1}");
- public static final StringId ConnectionProxyImpl_0__SUCCESSFULLY_SENT_CLIENT_READY_MESSAGE_TO__1 = new StringId(1224, "{0} : Successfully sent client ready message to {1}");
- public static final StringId ConnectionProxyImpl_0__THE_EXISTING_LIVE_ENDPOINT_NAMED__1__COULD_NOT_BE_REMOVED_BECAUSE_ITS_HOST_AND_PORT__2__3__DOES_NOT_MATCH_THE_REQUESTED_HOST_AND_PORT__4__5_ = new StringId(1225, "{0} : The existing live endpoint named {1} could not be removed because its host and port ( {2} : {3} ) does not match the requested host and port ( {4} : {5} ).");
- public static final StringId Connection_DISCONNECTED_AS_A_SLOWRECEIVER = new StringId(1226, "Disconnected as a slow-receiver");
- public static final StringId ConnectionProxyImpl_CACHE_IS_CLOSED = new StringId(1227, "Cache is closed");
- public static final StringId ConnectionProxyImpl_CONDITIONALLYRELEASECONNECTION_FAILED_ON_0_DUE_TO_UNKNOWN_POLICY_TYPE_1 = new StringId(1228, "conditionallyReleaseConnection: failed on <{0}> due to unknown policy type {1}");
- public static final StringId ConnectionProxyImpl_CONNECTIONPROXYIMPL_0_FINISHED_INSTANTIATORS_RECOVERY = new StringId(1229, "ConnectionProxyImpl ({0}) finished instantiators recovery.");
- public static final StringId ConnectionProxyImpl_CONNECTIONPROXYIMPL_0_STARTED_INSTANTIATORS_RECOVERY = new StringId(1230, "ConnectionProxyImpl ({0}) started instantiators recovery.");
- public static final StringId ConnectionProxyImpl_CONNECTIONPROXYIMPL_COULD_NOT_RECOVER_INSTANTIATORS_WITH_0_1 = new StringId(1231, "ConnectionProxyImpl: Could not recover instantiators with {0}. {1}");
- public static final StringId ConnectionProxyImpl_COULD_NOT_ACQUIRE_OR_CREATE_A_CONNECTION_NO_ACTIVE_SERVERS_WERE_FOUND_WHILE_REGISTERING_INSTANTIATORS = new StringId(1232, "Could not acquire or create a Connection. No active servers were found while registering instantiators.");
- public static final StringId ConnectionProxyImpl_COULD_NOT_ACQUIRE_OR_CREATE_A_CONNECTION_NO_AVAILABLE_CONNECTION_WAS_FOUND_WHILE_REGISTERING_INSTANTIATORS_BUT_THE_FOLLOWING_ACTIVE_SERVERS_EXIST_0 = new StringId(1233, "Could not acquire or create a Connection. No available Connection was found while registering instantiators, but the following active servers exist: {0}");
- public static final StringId ConnectionProxyImpl_ERROR_WHILE_REREGISTERING_THE_CQ_TO_THE_REDUNDANT_SERVER_CQNAME_0_ERROR_1 = new StringId(1234, "Error while re-registering the CQ to the redundant server. CqName : {0}, Error : {1}");
- public static final StringId ConnectionProxyImpl_EXCEPTION_WHILE_SENDING_AN_ACK_TO_THE_PRIMARY_SERVER = new StringId(1235, "Exception while sending an ack to the primary server");
- public static final StringId ConnectionProxyImpl_PROBLEM_REMOVING_ALL_INTEREST_ON_REGION_0_INTERESTTYPE_1 = new StringId(1236, "Problem removing all interest on region={0} interestType={1}");
- public static final StringId ConnectionProxyImpl_PROXY_NOT_PROPERLY_INITIALIZED_0 = new StringId(1237, "Proxy not properly initialized: {0}");
- public static final StringId ConnectionProxyImpl_THREADIDTOSEQUENCEIDEXPIRYTHREADUNEXPECTED_INTRREUPT_HENCE_CONTINUE_RUNNING = new StringId(1238, "ThreadIdToSequenceIdExpiryThread::Unexpected interrupt, hence continue running");
- public static final StringId ConnectionProxyImpl_UNEXPECTED_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_NOTIFY_PRIMARY_SERVER__0__OF_CLIENT_READINESS = new StringId(1239, "Unexpected exception occurred while attempting to notify primary server {0} of client readiness");
- public static final StringId ConnectionTable_FAILED_TO_ACCEPT_CONNECTION_FROM_0_BECAUSE_1 = new StringId(1240, "Failed to accept connection from {0} because: {1}");
- public static final StringId ConnectionTable_KEY_0___VALUE_HASH_1__DESCR_2 = new StringId(1241, "key= {0} value hash= {1} descr= {2}");
- public static final StringId ConnectionTable_P2P_CONNECTION_TABLE_CONTENTS = new StringId(1242, "P2P connection table contents-----------");
- public static final StringId Connection_0_ASYNC_CONFIGURATION_RECEIVED_1 = new StringId(1243, "{0} async configuration received {1}.");
- public static final StringId Connection_0_ERROR_READING_MESSAGE = new StringId(1244, "{0} Error reading message");
- public static final StringId Connection_0_EXCEPTION_IN_CHANNEL_READ = new StringId(1245, "{0} exception in channel read");
- public static final StringId Connection_0_EXCEPTION_RECEIVED = new StringId(1246, "{0} exception received");
- public static final StringId Connection_0_STRAY_INTERRUPT_READING_MESSAGE = new StringId(1247, "{0} Stray interrupt reading message");
- public static final StringId Connection_0_SUCCESSFULLY_REESTABLISHED_CONNECTION_TO_PEER_1 = new StringId(1248, "{0}: Successfully reestablished connection to peer {1}");
- public static final StringId Connection_ACK_READ_EXCEPTION = new StringId(1249, "ack read exception");
- public static final StringId Connection_ACK_READ_EXCEPTION_0 = new StringId(1250, "ack read exception: {0}");
- public static final StringId Connection_ACK_WAIT_THRESHOLD_EXCEEDED_WAITING_FOR_ACK_FROM_0 = new StringId(1251, "Ack wait threshold exceeded waiting for ack from {0}");
- public static final StringId Connection_ACK_WRITE_EXCEPTION = new StringId(1252, "ack write exception");
- public static final StringId Connection_ACK_WRITE_EXCEPTION_0 = new StringId(1253, "ack write exception: {0}");
- public static final StringId Connection_ALLOCATING_LARGER_NETWORK_READ_BUFFER_NEW_SIZE_IS_0_OLD_SIZE_WAS_1 = new StringId(1254, "Allocating larger network read buffer, new size is {0} old size was {1}.");
- public static final StringId Connection_BLOCKED_FOR_0_MS_WHICH_IS_LONGER_THAN_THE_MAX_OF_1_MS_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1255, "Blocked for {0}ms which is longer than the max of {1}ms, asking slow receiver {2} to disconnect.");
- public static final StringId Connection_CLASSNOTFOUND_DESERIALIZING_MESSAGE_0 = new StringId(1256, "ClassNotFound deserializing message: {0}");
- public static final StringId Connection_CONNECTION_ATTEMPTING_RECONNECT_TO_PEER__0 = new StringId(1257, "Connection: Attempting reconnect to peer {0}");
- public static final StringId Connection_CONNECTION_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1258, "Connection: shared={0} ordered={1} failed to connect to peer {2} because: {3}");
- public static final StringId Connection_CONNECTION_HANDSHAKE_FAILED_TO_CONNECT_TO_PEER_0_BECAUSE_1 = new StringId(1259, "Connection: shared={0} ordered={1} handshake failed to connect to peer {2} because: {3}");
- public static final StringId Connection_DETECTED_OLD_VERSION_PRE_5_0_1_OF_GEMFIRE_OR_NONGEMFIRE_DURING_HANDSHAKE_DUE_TO_INITIAL_BYTE_BEING_0 = new StringId(1260, "Detected old version (pre 5.0.1) of GemFire or non-GemFire during handshake due to initial byte being {0}");
- public static final StringId Connection_END_OF_FILE_ON_ACK_STREAM = new StringId(1261, "end of file on ack stream");
- public static final StringId Connection_ERROR_DESERIALIZING_MESSAGE = new StringId(1262, "Error deserializing message");
- public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_MESSAGE = new StringId(1263, "Error deserializing P2P handshake message");
- public static final StringId Connection_ERROR_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1264, "Error deserializing P2P handshake reply");
- public static final StringId Connection_ERROR_DISPATCHING_MESSAGE = new StringId(1265, "Error dispatching message");
- public static final StringId Connection_EXCEPTION_FLUSHING_BATCH_SEND_BUFFER_0 = new StringId(1266, "Exception flushing batch send buffer: {0}");
- public static final StringId Connection_FAILED_HANDLING_CHUNK_MESSAGE = new StringId(1267, "Failed handling chunk message");
- public static final StringId Connection_FAILED_HANDLING_END_CHUNK_MESSAGE = new StringId(1268, "Failed handling end chunk message");
- public static final StringId Connection_FAILED_SETTING_CHANNEL_TO_BLOCKING_MODE_0 = new StringId(1269, "Failed setting channel to blocking mode {0}");
- public static final StringId Connection_FINISHED_WAITING_FOR_REPLY_FROM_0 = new StringId(1270, "Finished waiting for reply from {0}");
- public static final StringId Connection_IOEXCEPTION_DESERIALIZING_MESSAGE = new StringId(1271, "IOException deserializing message");
- public static final StringId Connection_OWNER_SHOULD_NOT_BE_NULL = new StringId(1272, "\"owner\" should not be null");
- public static final StringId Connection_P2P_PUSHER_EXCEPTION_0 = new StringId(1273, "P2P pusher exception: {0}");
- public static final StringId Connection_QUEUED_BYTES_0_EXCEEDS_MAX_OF_1_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT = new StringId(1274, "Queued bytes {0} exceeds max of {1}, asking slow receiver {2} to disconnect.");
- public static final StringId Connection_SOCKET_0_IS_1_INSTEAD_OF_THE_REQUESTED_2 = new StringId(1275, "Socket {0} is {1} instead of the requested {2}.");
- public static final StringId Connection_THROWABLE_DESERIALIZING_P2P_HANDSHAKE_REPLY = new StringId(1276, "Throwable deserializing P2P handshake reply");
- public static final StringId Connection_THROWABLE_DISPATCHING_MESSAGE = new StringId(1277, "Throwable dispatching message");
- public static final StringId Connection_TIMED_OUT_WAITING_FOR_READERTHREAD_ON_0_TO_FINISH = new StringId(1278, "Timed out waiting for readerThread on {0} to finish.");
- public static final StringId Connection_UNABLE_TO_GET_INPUT_STREAM = new StringId(1279, "Unable to get input stream");
- public static final StringId Connection_UNABLE_TO_GET_P2P_CONNECTION_STREAMS = new StringId(1280, "Unable to get P2P connection streams");
- public static final StringId Connection_UNEXPECTED_FAILURE_DESERIALIZING_MESSAGE = new StringId(1281, "Unexpected failure deserializing message");
- public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0 = new StringId(1282, "Unknown handshake reply code: {0}");
- public static final StringId Connection_UNKNOWN_HANDSHAKE_REPLY_CODE_0_NIOMESSAGELENGTH_1_PROCESSORTYPE_2 = new StringId(1283, "Unknown handshake reply code: {0} nioMessageLength={1} processorType={2}");
- public static final StringId Connection_UNKNOWN_P2P_MESSAGE_TYPE_0 = new StringId(1284, "Unknown P2P message type: {0}");
- public static final StringId Connection_UNKNOWN_PROCESSOR_TYPE_0 = new StringId(1285, "Unknown processor type: {0}");
- public static final StringId ContainsKeyValueMess_PARTITIONED_REGION_0_IS_NOT_CONFIGURED_TO_STORE_DATA = new StringId(1286, "Partitioned Region {0} is not configured to store data");
- // ok to reuse 1287
- public static final StringId ContainsKey_0_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1288, "{0}: The input key for the containsKey request is null");
- public static final StringId ContainsKey_0_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1289, "{0}: The input region name for the containsKey request is null");
- public static final StringId ContainsKey_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1290, " The input key for the containsKey request is null");
- public static final StringId ContainsKey_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL = new StringId(1291, " The input region name for the containsKey request is null");
- public static final StringId ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST = new StringId(1292, " was not found during containsKey request");
- public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_CREATING_USERTRANSACTION_OBJECT = new StringId(1293, "ContextImpl::lookup::Error while creating UserTransaction object");
- public static final StringId ContextImpl_CONTEXTIMPL_LOOKUP_ERROR_WHILE_LOOKING_UP_0 = new StringId(1294, "ContextImpl::lookup::Error while looking up {0}");
- public static final StringId CqAttributesFactory_EXCEPTION_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1295, "Exception closing CQ Listener Error: {0}");
- public static final StringId CqAttributesFactory_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1296, "Exception occurred while closing CQ Listener Error: {0}");
- public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1297, "Runtime Exception occurred closing CQ Listener Error: {0}");
- public static final StringId CqAttributesFactory_RUNTIME_EXCEPTION_OCCURED_WHILE_CLOSING_CQ_LISTENER_ERROR_0 = new StringId(1298, "Runtime Exception occurred while closing CQ Listener Error: {0}");
- public static final StringId CqQueryImpl_FAILED_TO_STORE_CONTINUOUS_QUERY_IN_THE_REPOSITORY_CQNAME_0_1 = new StringId(1299, "Failed to store Continuous Query in the repository. CqName: {0} {1}");
- public static final StringId CqQueryImpl_0_REQUEST_TO_SERVER_FOR_CQ_1_ON_ENDPOINT_2 = new StringId(1300, "{0} request to server for cq: {1} on endpoint: {2}");
- public static final StringId PRHARRedundancyProvider_0_IN_THE_PARTITIONED_REGION_REGION_NAME_1 = new StringId(1301, "{0} Region name = {1}");
- public static final StringId CqQueryImpl_CLASS_NOT_FOUND_EXCEPTION_THE_ANTLRJAR_OR_THE_SPCIFIED_CLASS_MAY_BE_MISSING_FROM_SERVER_SIDE_CLASSPATH_ERROR_0 = new StringId(1302, "Class not found exception. The antlr.jar or the spcified class may be missing from server side classpath. Error : {0}");
- public static final StringId CqQueryImpl_CQ_IS_NOT_IN_RUNNING_STATE_STOP_CQ_DOES_NOT_APPLY_CQNAME_0 = new StringId(1303, "CQ is not in running state, stop CQ does not apply, CqName : {0}");
- public static final StringId CqQueryImpl_CQ_QUERIES_CANNOT_HAVE_MORE_THAN_ONE_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1304, "CQ queries cannot have more than one iterator in the FROM clause");
- public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_ORDER_BY = new StringId(1305, "CQ queries do not support ORDER BY");
- public static final StringId CqQueryImpl_CQ_QUERIES_DO_NOT_SUPPORT_PROJECTIONS = new StringId(1306, "CQ queries do not support projections");
- public static final StringId CqQueryImpl_CQ_QUERIES_MUST_BE_A_SELECT_STATEMENT_ONLY = new StringId(1307, "CQ queries must be a select statement only");
- public static final StringId CqQueryImpl_CQ_QUERIES_MUST_HAVE_A_REGION_PATH_ONLY_AS_THE_FIRST_ITERATOR_IN_THE_FROM_CLAUSE = new StringId(1308, "CQ queries must have a region path only as the first iterator in the FROM clause");
- public static final StringId CqQueryImpl_CQ_QUERIES_MUST_REFERENCE_ONE_AND_ONLY_ONE_REGION = new StringId(1309, "CQ queries must reference one and only one region");
- public static final StringId CqQueryImpl_ERROR_WHILE_PARSING_THE_QUERY_ERROR_0 = new StringId(1310, "Error while parsing the query. Error : {0}");
- public static final StringId PRHARRedundancyProvider_UNABLE_TO_FIND_ANY_MEMBERS_TO_HOST_A_BUCKET_IN_THE_PARTITIONED_REGION_0 = new StringId(1311, "Unable to find any members to host a bucket in the partitioned region. {0}.{1}");
- public static final StringId CqQueryImpl_EXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1312, "Exception occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
- public static final StringId CqQueryImpl_EXCEPTION_WHILE_REREGISTERING_CQ_CQNAME_0_ERROR_1 = new StringId(1313, "Exception while re-registering CQ. CqName: {0} Error : {1}");
- public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_ERROR_FROM_LAST_ENDPOINT_1 = new StringId(1314, "Failed to close the cq. CqName: {0}. Error from last endpoint: {1}");
- public static final StringId CqQueryImpl_FAILED_TO_REMOVE_CQ_FROM_THE_BASE_REGION_CQNAME__0 = new StringId(1315, "Failed to remove CQ from the base region. CqName : {0}");
- public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_ERROR_FROM_LAST_SERVER_1 = new StringId(1316, "Failed to stop the cq. CqName :{0} Error from last server: {1}");
- public static final StringId CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0 = new StringId(1317, "Failed to stop the cq. CqName :{0}.");
- public static final StringId CqQueryImpl_REGION_ON_WHICH_QUERY_IS_SPECIFIED_NOT_FOUND_LOCALLY_REGIONNAME_0 = new StringId(1318, "Region on which query is specified not found locally, regionName: {0}");
- public static final StringId CqQueryImpl_REGION__0_SPECIFIED_WITH_CQ_NOT_FOUND_CQNAME_1 = new StringId(1319, "Region : {0} specified with cq not found. CqName: {1}");
- public static final StringId CqQueryImpl_RUNTIMEEXCEPTION_OCCOURED_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR_1 = new StringId(1320, "RuntimeException occurred in the CqListener of the CQ, CqName : {0} Error : {1}");
- public static final StringId CqQueryImpl_SELECT_DISTINCT_QUERIES_NOT_SUPPORTED_IN_CQ = new StringId(1321, "select DISTINCT queries not supported in CQ");
- // ok to reuse 1322
- public static final StringId CqQueryImpl_THE_WHERE_CLAUSE_IN_CQ_QUERIES_CANNOT_REFER_TO_A_REGION = new StringId(1323, "The WHERE clause in CQ queries cannot refer to a region");
- public static final StringId CqQueryImpl_UNABLE_TO_CREATE_CQ_0_ERROR__1 = new StringId(1324, "Unable to create cq {0} Error : {1}");
- // ok to reuse 1325
- public static final StringId CqQueryImpl_UNSUPPORTED_SEND_REQUEST_TO_SERVER = new StringId(1326, "Unsupported send request to Server.");
- public static final StringId CqQueryImpl_CQ_IS_IN_RUNNING_STATE_CQNAME_0 = new StringId(1327, "CQ is in running state, CqName : {0}");
- public static final StringId CqService_0_FAILED_TO_GET_THE_SPECIFIED_CQ_1 = new StringId(1328, "{0}: Failed to get the specified CQ: {1}");
- public static final StringId CqService_CLIENT_SIDE_NEWCQ_METHOD_INVOCATION_ON_SERVER = new StringId(1329, "client side newCq() method invocation on server.");
- public static final StringId CqService_CQ_NOT_FOUND_FAILED_TO_CLOSE_THE_SPECIFIED_CQ_0 = new StringId(1330, "CQ Not found, Failed to close the specified CQ {0}");
- public static final StringId CqService_CQ_NOT_FOUND_FAILED_TO_STOP_THE_SPECIFIED_CQ_0 = new StringId(1331, "CQ Not found, Failed to stop the specified CQ {0}");
- public static final StringId CqService_CQ_NOT_FOUND_IN_THE_CQ_META_REGION_CQNAME_0 = new StringId(1332, "CQ not found in the cq meta region, CqName: {0}");
- public static final StringId CqService_CQ_WITH_THE_GIVEN_NAME_ALREADY_EXISTS_CQNAME_0 = new StringId(1333, "CQ with the given name already exists. CqName : {0}");
- public static final StringId CqService_ERROR_SENDING_CQ_MONITOROP_REQUEST = new StringId(1334, "Error sending CQ MonitorOp request.");
- public static final StringId RemoteGfManagerAgent_LISTENER_THREW_AN_EXCEPTION = new StringId(1335, "Listener threw an exception.");
- public static final StringId PRHARRedundancyProvider_FOUND_A_MEMBER_TO_HOST_A_BUCKET = new StringId(1336, "Found a member to host a bucket.");
- public static final StringId CqService_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1337, "Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
- public static final StringId CqService_EXCEPTION_WHILE_REGISTERING_CQ_ON_SERVER_CQNAME___0 = new StringId(1338, "Exception while registering CQ on server. CqName : {0}");
- public static final StringId CqService_FAILED_TO_CLOSE_CQ__0___1 = new StringId(1339, "Failed to close CQ {0} {1}");
- public static final StringId CqService_FAILED_TO_CREATE_CQ_META_REGION_0_1 = new StringId(1340, "Failed to create CQ Meta region. {0}: {1}");
- public static final StringId CqService_FAILED_TO_CREATE_CQ_META_REGION_TIMEDOUT_0_1 = new StringId(1341, "Failed to create CQ Meta region (TimedOut). {0}: {1}");
- public static final StringId CqService_FAILED_TO_INITIALIZE_CQ_META_REGION_TIMEDOUT_OR_SERVER_CONNECTION_0_1 = new StringId(1342, "Failed to Initialize: CQ Meta region (TimedOut) Or Server Connection. {0}: {1}");
- public static final StringId CqService_INITIALIZED_CQSERVICE_SUCCESSFULLY = new StringId(1343, "Initialized CqService Successfully.");
- public static final StringId CqService_INITIALIZING_CQ_SERVICE = new StringId(1344, "Initializing CQ Service.");
- public static final StringId CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED = new StringId(1345, "Invalid CQ Monitor request received.");
- public static final StringId CqService_MONITOR_CQ_REQUEST_TO_SERVER_OP_IS_0_1_2 = new StringId(1346, "Monitor CQ request to server. OP is: {0} {1} {2}");
- public static final StringId CqService_NO_ACTIVE_ENDPOINTS_FOUND_WITH_REGISTERED_CQS = new StringId(1347, "No Active endpoints found with Registered CQs.");
- public static final StringId CqService_NULL_ARGUMENT_0 = new StringId(1348, "Null argument \"{0}\"");
- public static final StringId CqService_RUNTIME_EXCEPTION_IN_THE_CQLISTENER_OF_THE_CQ_CQNAME_0_ERROR__1 = new StringId(1349, "Runtime Exception in the CqListener of the CQ, CqName: {0} Error : {1}");
- public static final StringId CqService_SERVER_SIDE_EXECUTECQ_METHOD_IS_CALLED_ON_CLIENT_CQNAME_0 = new StringId(1350, "Server side executeCq method is called on client. CqName : {0}");
- public static final StringId Oplog_EXCEPTION_IN_ACQURING_READ_LOCK_WHILE_CHECKING_THE_ASYNCH_MAPS_FOR_THE_PRESENCE_OF_AN_ENTRY_ATTEMPTING_TO_SEE_IF_IT_IS_PRESENT_IN_THE_OPLOG = new StringId(1351, "Exception in acquiring read lock, while checking the asynch maps for the presence of an entry. Attempting to see if it is present in the opLog.");
- public static final StringId CqService_THERE_WAS_NO_ACTIVE_CQS = new StringId(1352, "There was no active Cqs.");
- public static final StringId CqService_THERE_WAS_NO_ACTIVE_ENDPOINTS_ON_THE_CQS = new StringId(1353, "There was no active endpoints on the Cqs.");
- public static final StringId CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_THE_SERVER_ENDPOINTS_ON_WHICH_THIS_CQ_WAS_REGISTERED_WERE_NOT_FOUND = new StringId(1354, "Failed to close the cq. CqName: {0}. The server endpoints on which this cq was registered were not found.");
- public static final StringId CqService_UNABLE_TO_FIND_CQQUERY_FOR_THE_CQ___0 = new StringId(1355, "Unable to find CqQuery for the CQ : {0}");
- public static final StringId CreateRegionProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1356, "More than one exception thrown in {0}");
- public static final StringId CreateRegion_0_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1357, "{0}: The input parent region name for the create region request is null");
- public static final StringId CreateRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1358, "{0}: The input region name for the create region request is null");
- public static final StringId CreateRegion_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1359, " The input parent region name for the create region request is null");
- public static final StringId CreateRegion_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL = new StringId(1360, " The input region name for the create region request is null");
- public static final StringId DLockGrantor_DEBUGHANDLESUSPENDTIMEOUTS_SLEEPING_FOR__0 = new StringId(1361, "debugHandleSuspendTimeouts sleeping for {0}");
- public static final StringId DLockGrantor_DLOCKGRANTORTHREAD_CAUGHT_EXCEPTION = new StringId(1362, "DLockGrantorThread caught exception...");
- public static final StringId DLockGrantor_DLOCKGRANTORTHREAD_WAS_UNEXPECTEDLY_INTERRUPTED = new StringId(1363, "DLockGrantorThread was unexpectedly interrupted");
- public static final StringId DLockGrantor_FAILED_TO_SCHEDULE_HELD_LOCK_0_FOR_1_BECAUSE_2_ALREADY_EXISTS = new StringId(1364, "Failed to schedule held lock {0} for {1} because {2} already exists.");
- public static final StringId DLockGrantor_GRANTOR_DESTROYANDREMOVE_RESULTED_IN_UNCAUGHT_THROWABLE = new StringId(1365, "Grantor destroyAndRemove resulted in uncaught Throwable");
- public static final StringId DLockGrantor_GRANTOR_FORWARDTONEWGRANTOR_RESULTED_IN_UNCAUGHT_THROWABLE = new StringId(1366, "Grantor forwardToNewGrantor resulted in uncaught Throwable");
- public static final StringId DLockGrantor_PROCESSING_OF_POSTREMOTERELEASELOCK_THREW_UNEXPECTED_RUNTIMEEXCEPTION = new StringId(1367, "Processing of postRemoteReleaseLock threw unexpected RuntimeException");
- public static final StringId DLockGrantor_PROCESSING_OF__0__THREW_UNEXPECTED_THROWABLE = new StringId(1368, "Processing of {0} threw unexpected Throwable");
- public static final StringId DLockGrantor_RELEASED_REGULAR_LOCK_WITH_WAITING_READ_LOCK_0 = new StringId(1369, "Released regular lock with waiting read lock: {0}");
- public static final StringId DLockGrantor_UNABLE_TO_RESPOND_TO__0 = new StringId(1370, "Unable to respond to {0}");
- public static final StringId DLockRecoverGrantorProcessor_DLOCKRECOVERGRANTORMESSAGEPROCESS_THROWABLE = new StringId(1371, "[DLockRecoverGrantorMessage.process] throwable:");
- public static final StringId DLockRecoverGrantorProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1372, "More than one exception thrown in {0}");
- public static final StringId DLockRequestProcessor_DLOCKREQUESTMESSAGEPROCESS_CAUGHT_THROWABLE = new StringId(1373, "[DLockRequestMessage.process] Caught throwable:");
- public static final StringId DLockRequestProcessor_FAILED_TO_FIND_PROCESSOR_FOR__0 = new StringId(1374, "Failed to find processor for {0}");
- public static final StringId DLockRequestProcessor_HANDLED_LOCAL_ORPHANED_GRANT = new StringId(1375, "Handled local orphaned grant.");
- public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITHOUT_RELEASE = new StringId(1376, "Handled orphaned grant without release.");
- public static final StringId DLockRequestProcessor_HANDLED_ORPHANED_GRANT_WITH_RELEASE = new StringId(1377, "Handled orphaned grant with release.");
- public static final StringId DLockRequestProcessor_MORE_THAN_ONE_EXCEPTION_THROWN_IN__0 = new StringId(1378, "More than one exception thrown in {0}");
- public static final StringId DLockRequestProcessor_NO_PROCESSOR_FOUND_FOR_DLOCKRESPONSEMESSAGE__0 = new StringId(1379, "No processor found for DLockResponseMessage: {0}");
- public static final StringId DLockRequestProcessor_RELEASING_LOCAL_ORPHANED_GRANT_FOR_0 = new StringId(1380, "Releasing local orphaned grant for {0}.");
- public static final StringId DLockRequestProcessor_RELEASING_ORPHANED_GRANT_FOR__0 = new StringId(1381, "Releasing orphaned grant for {0}");
- public static final StringId DLockRequestProcessor_WAITING_TO_PROCESS_DLOCKRESPONSEMESSAGE = new StringId(1382, "Waiting to process DLockResponseMessage");
- public static final StringId DLockService_DEBUG_GRANTOR_REPORTS_NOT_HOLDER_FOR_0 = new StringId(1383, "DEBUG: Grantor reports NOT_HOLDER for {0}");
- public static final StringId DLockService_DEBUG_LOCKINTERRUPTIBLY_HAS_GONE_HOT_AND_LOOPED_0_TIMES = new StringId(1384, "DEBUG: lockInterruptibly has gone hot and looped [0] times");
- public static final StringId DLockService_DESTROYANDREMOVE_OF_0_MAY_HAVE_FAILED = new StringId(1385, "destroyAndRemove of {0} may have failed.");
- public static final StringId DLockService_FAILED_TO_NOTIFY_GRANTOR_OF_DESTRUCTION_WITHIN_0_ATTEMPTS = new StringId(1386, "Failed to notify grantor of destruction within {0} attempts.");
- public static final StringId DLockService_GRANTOR_CREATION_WAS_ABORTED_BUT_GRANTOR_WAS_NOT_DESTROYED = new StringId(1387, "Grantor creation was aborted but grantor was not destroyed");
- public static final StringId DLockService_GRANTOR_IS_STILL_INITIALIZING = new StringId(1388, "Grantor is still initializing");
- public static final StringId DLockService_GRANTOR_REPORTS_REENTRANT_LOCK_NOT_HELD_0 = new StringId(1389, "Grantor reports reentrant lock not held: {0}");
- public static final StringId DLockService_LOCK_WAS_INTERRUPTED = new StringId(1390, "lock() was interrupted");
- public static final StringId DLockToken_ATTEMPTED_CLIENTSIDE_GRANTING_WITH_0_ON_1_FOR_2_IN_3 = new StringId(1391, "Attempted client-side granting with {0} on {1} for {2} in {3}.");
- public static final StringId DLockToken_ATTEMPTING_TO_USE_DESTROYED_TOKEN_0 = new StringId(1392, "Attempting to use destroyed token: {0}");
- public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR = new StringId(1393, "Class {0} does not have a zero-argument constructor.");
- public static final StringId DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR_IT_IS_AN_INNER_CLASS_OF_1_SHOULD_IT_BE_A_STATIC_INNER_CLASS = new StringId(1394, "Class {0} does not have a zero-argument constructor. It is an inner class of {1}. Should it be a static inner class?");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCEMANAGED_CONNECTION_FACTORY_CLASS_IS_NOT_AVAILABLE = new StringId(1395, "DataSourceFactory::getManagedDataSource:Managed Connection factory class is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETMANAGEDDATASOURCE_EXCEPTION_IN_CREATING_MANAGED_CONNECTION_FACTORY_EXCEPTION_STRING_0 = new StringId(1396, "DataSourceFactory::getManagedDataSource: Exception in creating managed connection factory. Exception string = {0}");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETPOOLEDDATASOURCECONNECTIONPOOLDATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1397, "DataSourceFactory::getPooledDataSource:ConnectionPoolDataSource class name for the ResourceManager is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEJDBC_DRIVER_IS_NOT_AVAILABLE = new StringId(1398, "DataSourceFactory::getSimpleDataSource:JDBC Driver is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETSIMPLEDATASOURCEURL_STRING_TO_DATABASE_IS_NULL = new StringId(1399, "DataSourceFactory::getSimpleDataSource:URL String to Database is null");
- public static final StringId DataSourceFactory_DATASOURCEFACTORYGETTRANXDATASOURCEXADATASOURCE_CLASS_NAME_FOR_THE_RESOURCEMANAGER_IS_NOT_AVAILABLE = new StringId(1400, "DataSourceFactory::getTranxDataSource:XADataSource class name for the ResourceManager is not available");
- public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETPOOLEDDATASOURCE_EXCEPTION_CREATING_CONNECTIONPOOLDATASOURCE_EXCEPTION_STRING_0 = new StringId(1401, "DataSourceFactory::getPooledDataSource:Exception creating ConnectionPoolDataSource.Exception string={0}");
- public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETSIMPLEDATASOURCE_EXCEPTION_WHILE_CREATING_GEMFIREBASICDATASOURCE_EXCEPTION_STRING_0 = new StringId(1402, "DataSourceFactory::getSimpleDataSource:Exception while creating GemfireBasicDataSource.Exception String={0}");
- public static final StringId DataSourceFactory_DATASOURCEFACTORY_GETTRANXDATASOURCE_EXCEPTION_IN_CREATING_GEMFIRETRANSACTIONDATASOURCE__EXCEPTION_STRING_0 = new StringId(1403, "DataSourceFactory::getTranxDataSource:Exception in creating GemFireTransactionDataSource. Exception string={0}");
- public static final StringId DebugLogWriter_STARTED_USING_CLASS_LOGGER_FOR__0 = new StringId(1404, "Started using class logger for {0}");
- public static final StringId DebuggerSupport_DEBUGGER_CONTINUING = new StringId(1405, "DEBUGGER: Continuing");
- public static final StringId DebuggerSupport_WAITING_FOR_DEBUGGER_TO_ATTACH_0 = new StringId(1406, "DEBUGGER: Waiting for Java debugger to attach... {0}");
- public static final StringId DefaultQueryService_ENDING_LIST_CONTENTS_ = new StringId(1407, "ending list contents :");
- public static final StringId DefaultQueryService_EXCEPTION_REMOVING_INDEX___0 = new StringId(1408, "Exception removing index : {0}");
- public static final StringId DefaultQueryService_EXCEPTION_WHILE_CREATING_INDEX_ON_PR_DEFAULT_QUERY_PROCESSOR = new StringId(1409, "Exception while creating index on pr default query processor.");
- public static final StringId DefaultQueryService_LIST_ELEMENT___0___AND_ITS_NAME___1 = new StringId(1410, "List element : {0} and its name : {1}");
- public static final StringId DefaultQueryService_PRINTING_LIST_CONTENTS_ = new StringId(1411, "printing list contents :");
- public static final StringId Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3 = new StringId(1412, "{0}: Unknown message type ({1}) with tx: {2} from {3}");
- public static final StringId DestroEntryMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_ENTRY_0_1_FROM_CONSOLE_AT_2 = new StringId(1413, "Failed attempt to destroy or invalidate entry {0} {1} from console at {2}");
- public static final StringId DestroRegionMessage_FAILED_ATTEMPT_TO_DESTROY_OR_INVALIDATE_REGION_0_FROM_CONSOLE_AT_1 = new StringId(1414, "Failed attempt to destroy or invalidate region {0} from console at {1}");
- public static final StringId DestroyRegionOperation_CACHEWRITER_SHOULD_NOT_HAVE_BEEN_CALLED = new StringId(1415, "CacheWriter should not have been called");
- public static final StringId DestroyRegionOperation_DISTRIBUTEDLOCK_SHOULD_NOT_HAVE_BEEN_ACQUIRED = new StringId(1416, "DistributedLock should not have been acquired");
- public static final StringId DestroyRegionOperation_EXCEPTION_WHILE_PROCESSING__0_ = new StringId(1417, "Exception while processing [ {0} ]");
- public static final StringId DestroyRegionOperation_GOT_TIMEOUT_WHEN_TRYING_TO_RECREATE_REGION_DURING_REINITIALIZATION_1 = new StringId(1418, "Got timeout when trying to recreate region during re-initialization: {1}");
- public static final StringId DestroyRegionOperation_REGION_DESTRUCTION_MESSAGE_IMPLEMENTATION_IS_IN_BASICPROCESS__NOT_THIS_METHOD = new StringId(1419, "Region Destruction message implementation is in basicProcess, not this method");
- public static final StringId DestroyRegion_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL = new StringId(1420, "{0}: The input region name for the destroy region request is null");
- public static final StringId Destroy_0_DURING_ENTRY_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1 = new StringId(1421, "{0}: during entry destroy no entry was found for key {1}");
- public static final StringId Destroy_0_THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1422, "{0}: The input key for the destroy request is null");
- public static final StringId Destroy_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL = new StringId(1423, "{0}: The input region name for the destroy request is null");
- public static final StringId Destroy_0_UNEXPECTED_EXCEPTION = new StringId(1424, "{0}: Unexpected Exception");
- public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_JROCKIT_NIO_BUG = new StringId(1425, "Ignoring max-threads setting and using zero instead due to JRockit NIO bugs. See GemFire bug #40198");
- public static final StringId AbstractDistributionConfig_BIND_ADDRESS_0_INVALID_MUST_BE_IN_1 = new StringId(1426, "The bind-address \"{0}\" is not a valid address for this machine. These are the valid addresses for this machine: {1}");
- public static final StringId AcceptorImpl_IGNORING_MAX_THREADS_DUE_TO_WINDOWS_IPV6_BUG = new StringId(1427, "Ignoring max-threads setting and using zero instead due to Java bug 6230761: NIO does not work with IPv6 on Windows. See GemFire bug #40472");
- public static final StringId ExecuteFunction_AFTER_RE_EXEUCTION_NUM_OF_NODES_NOT_MATCHING = new StringId(1428, "After re-execution no of nodes do not match");
- public static final StringId AbstractRegionEntry_0_UNABLE_TO_NOTIFY_WAITING_EVENTS_AFTER_PROCESSING_1 = new StringId(1429, "{0}: Unable to notify waiting events after processing. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6699669 and GemFire bug #39130 {1}");
- public static final StringId DirectChannel_0_SECONDS_HAVE_ELAPSED_WHILE_WAITING_FOR_REPLY_FROM_1_ON_2_WHOSE_CURRENT_MEMBERSHIP_LIST_IS_3 = new StringId(1430, "{0} seconds have elapsed while waiting for reply from {1} on {2} whose current membership list is: [{3}]");
- public static final StringId DirectChannel_FINISHED_WAITING_FOR_REPLY_FROM_0_ON_1 = new StringId(1431, "Finished waiting for reply from {0} on {1}.");
- public static final StringId DirectChannel_GEMFIRE_P2P_LISTENER_STARTED_ON__0 = new StringId(1432, "GemFire P2P Listener started on {0}");
- public static final StringId DirectChannel_INTERRUPTED_OBTAINING_PERMISSION_TO_SEND_TO_MULTIPLE_PEERS = new StringId(1433, "Interrupted obtaining permission to send to multiple peers");
- public static final StringId DirectChannel_UNABLE_TO_INITIALIZE_DIRECT_CHANNEL_BECAUSE__0 = new StringId(1434, "Unable to initialize direct channel because: {0}");
- public static final StringId DirectChannel_UNEXPECTED_TIMEOUT_WHILE_WAITING_FOR_ACK_FROM__0 = new StringId(1435, "Unexpected timeout while waiting for ack from {0}");
- public static final StringId DirectChannel_VIEW_NO_LONGER_HAS_0_AS_AN_ACTIVE_MEMBER_SO_WE_WILL_NO_LONGER_WAIT_FOR_IT = new StringId(1436, "View no longer has {0} as an active member, so we will no longer wait for it.");
- public static final StringId DirectChannel_WHILE_PULLING_A_MESSAGE = new StringId(1437, "While pulling a message");
- public static final StringId TXState_CANNOT_COMMIT_REMOTED_TRANSACTION = new StringId(1438, "Cannot commit a transaction being run on behalf of a remote thread");
- public static final StringId CreateRegionProcessor_ERROR_TRANSFERRING_EVENT_STATE = new StringId(1439, "Encountered an error in transferring event state during region creation for {0}");
- public static final StringId DiskRegion_DISKREGIONGETBYTESANDBITSWITHOUTLOCKOPLOG_WITH_ID__0__COULD_NOT_BE_OBTAINED_A_CLEAR_OPERATION_MAY_HAVE_DELETED_THE_OPLOG_CURRENT_OPLOGID_1 = new StringId(1440, "DiskRegion::getBytesAndBitsWithoutLock:Oplog with ID = {0} could not be obtained. A clear operation may have deleted the Oplog. Current OplogID= {1}");
- public static final StringId DistributedCacheOperation_EXCEPTION_OCCURRED_WHILE_PROCESSING__0 = new StringId(1441, "Exception occurred while processing {0}");
- // ok to reuse 1442
- public static final StringId DistributedCacheOperation_WAITFORACKIFNEEDED_EXCEPTION = new StringId(1443, "waitForAckIfNeeded: exception");
- public static final StringId DistributedRegion_ATTEMPT_TO_ACQUIRE_DISTRIBUTED_LOCK_FOR_0_FAILED_AFTER_WAITING_1_SECONDS = new StringId(1444, "Attempt to acquire distributed lock for {0} failed after waiting {1} seconds.");
- public static final StringId DistributedRegion_DLS_DESTROY_MAY_HAVE_FAILED_FOR_0 = new StringId(1445, "DLS destroy may have failed for {0}");
- public static final StringId DistributedRegion_EXCEPTION_OCCURRED_IN_REGIONMEMBERSHIPLISTENER = new StringId(1446, "Exception occurred in RegionMembershipListener");
- public static final StringId DistributedRegion_NO_REPLICATED_REGION_FOUND_FOR_EXECUTING_FUNCTION_0 = new StringId(1447, "No Replicated Region found for executing function : {0}.");
- public static final StringId DistributedRegion_TIMED_OUT_AFTER_WAITING_0_SECONDS_FOR_THE_DISTRIBUTED_LOCK_FOR_1 = new StringId(1448, "Timed out after waiting {0} seconds for the distributed lock for {1}.");
- public static final StringId DistributedRegion_UNEXPECTED_EXCEPTION = new StringId(1449, "Unexpected exception:");
- public static final StringId DistributedSystemConfigImpl_COULD_NOT_OPEN_LOG_FILE_0 = new StringId(1450, "Could not open log file \"{0}\"");
- public static final StringId DistributedSystemConfigImpl_COULD_NOT_RENAME_0_TO_1 = new StringId(1451, "Could not rename \"{0}\" to \"{1}\".");
- public static final StringId DistributedSystemConfigImpl_LOG_FILE_0_IS_NOT_A_FILE = new StringId(1452, "Log file \"{0}\" is not a file");
- public static final StringId DistributedSystemConfigImpl_RENAMED_OLD_LOG_FILE_TO_0 = new StringId(1453, "Renamed old log file to \"{0}\".");
- public static final StringId DistributedSystemConfigImpl_STARTUP_CONFIGURATIONN_0 = new StringId(1454, "Startup Configuration:\n {0}");
- public static final StringId HARegionQueue_QUEUEREMOVALTHREAD_IS_EXITING_WITH_DUE_TO_A_VRITUALMACHINEERROR = new StringId(1455, "QueueRemovalThread is exiting with due to a VritualMachineError.");
- public static final StringId DistributionAdvisor_UNEXPECTED_EXCEPTION = new StringId(1456, "Unexpected exception:");
- public static final StringId DistributionChannel_ATTEMPTING_A_SEND_TO_A_DISCONNECTED_DISTRIBUTIONMANAGER = new StringId(1457, "Attempting a send to a disconnected DistributionManager");
- public static final StringId DistributionLocatorImpl_DONE_WAITING_FOR_LOCATOR = new StringId(1458, "Done waiting for locator");
- public static final StringId DistributionLocator_COULD_NOT_BIND_LOCATOR_TO__0__1 = new StringId(1459, "Could not bind locator to {0}[{1}]");
- public static final StringId DistributionLocator_COULD_NOT_START_LOCATOR = new StringId(1460, "Could not start locator");
- public static final StringId DistributionLocator_LOCATOR_STOPPED = new StringId(1461, "Locator stopped");
- public static final StringId DistributionManager_0_IS_THE_ELDER_AND_THE_ONLY_MEMBER = new StringId(1462, "{0} is the elder and the only member.");
- public static final StringId DistributionManager_0_IS_THE_ELDER_IN_A_GROUP_OF_1_MEMBERS = new StringId(1463, "{0} is the elder in a group of {1} members.");
- public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CLOSED_1 = new StringId(1464, "Administration member at {0} closed: {1}");
- public static final StringId DistributionManager_ADMINISTRATION_MEMBER_AT_0_CRASHED_1 = new StringId(1465, "Administration member at {0} crashed: {1}");
- public static final StringId DistributionManager_ADMITTING_MEMBER_0_NOW_THERE_ARE_1_NONADMIN_MEMBERS = new StringId(1466, "Admitting member <{0}>. Now there are {1} non-admin member(s).");
- public static final StringId DistributionManager_AT_LEAST_ONE_EXCEPTION_OCCURRED = new StringId(1467, "At least one Exception occurred.");
- public static final StringId DistributionManager_CHANGING_ELDER_FROM_0_TO_1 = new StringId(1468, "Changing Elder from {0} to {1}.");
- public static final StringId DistributionManager_CLOBBERTHREAD_THREAD_REFUSED_TO_DIE__0 = new StringId(1469, "clobberThread: Thread refused to die: {0}");
- public static final StringId DistributionManager_DAEMON_THREADS_ARE_SLOW_TO_STOP_CULPRITS_INCLUDE_0 = new StringId(1470, "Daemon threads are slow to stop; culprits include: {0}");
- public static final StringId DistributionManager_DIDNT_HEAR_BACK_FROM_ANY_OTHER_SYSTEM_I_AM_THE_FIRST_ONE = new StringId(1471, "Did not hear back from any other system. I am the first one.");
- public static final StringId DistributionManager_DISTRIBUTIONMANAGER_0_STARTED_ON_1_THERE_WERE_2_OTHER_DMS_3_4_5 = new StringId(1472, "DistributionManager {0} started on {1}. There were {2} other DMs. others: {3} {4} {5}");
- public static final StringId DistributionManager_DISTRIBUTIONMANAGER_STOPPED_IN_0_MS = new StringId(1473, "DistributionManager stopped in {0}ms.");
- public static final StringId DistributionManager_DMMEMBERSHIP_ADMITTING_NEW_ADMINISTRATION_MEMBER__0_ = new StringId(1474, "DMMembership: Admitting new administration member < {0} >.");
- public static final StringId DistributionManager_DMMEMBERSHIP_SERVICE_FAILURE__0 = new StringId(1475, "DMMembership: service failure: {0}");
- public static final StringId DistributionManager_ELDER__0__IS_NOT_CURRENTLY_AN_ACTIVE_MEMBER_SELECTING_NEW_ELDER = new StringId(1476, "Elder < {0} > is not currently an active member; selecting new elder.");
- public static final StringId DistributionManager_EXCEPTION_WHILE_CALLING_MEMBERSHIP_LISTENER_FOR_EVENT__0 = new StringId(1477, "Exception while calling membership listener for event: {0}");
- public static final StringId DistributionManager_FAILED_SENDING_SHUTDOWN_MESSAGE_TO_PEERS_TIMEOUT = new StringId(1478, "Failed sending shutdown message to peers (timeout)");
- public static final StringId DistributionManager_FORCING_AN_ELDER_JOIN_EVENT_SINCE_A_STARTUP_RESPONSE_WAS_NOT_RECEIVED_FROM_ELDER__0_ = new StringId(1479, "Forcing an elder join event since a startup response was not received from elder {0} .");
- public static final StringId DistributionManager_FORCING_THREAD_STOP_ON__0_ = new StringId(1480, "Forcing thread stop on < {0} >");
- public static final StringId DistributionManager_IGNORED_INTERRUPT_DURING_ELDERCHANGEWAIT = new StringId(1481, "Ignored interrupt during elderChangeWait");
- public static final StringId DistributionManager_INITIAL_MEMBERSHIPMANAGER_VIEW___0 = new StringId(1482, "Initial (distribution manager) view = {0}");
- public static final StringId DistributionManager_MARKING_DISTRIBUTIONMANAGER_0_AS_CLOSED = new StringId(1483, "Marking DistributionManager {0} as closed.");
- public static final StringId DistributionManager_MARKING_THE_SERIALQUEUEDEXECUTOR_WITH_ID__0__USED_BY_THE_MEMBER__1__TO_BE_UNUSED = new StringId(1484, "Marking the SerialQueuedExecutor with id : {0} used by the member {1} to be unused.");
- public static final StringId DistributionManager_MEMBER_AT_0_GRACEFULLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1485, "Member at {0} gracefully left the distributed cache: {1}");
- public static final StringId DistributionManager_MEMBER_AT_0_UNEXPECTEDLY_LEFT_THE_DISTRIBUTED_CACHE_1 = new StringId(1486, "Member at {0} unexpectedly left the distributed cache: {1}");
- public static final StringId DistributionManager_NEWLY_SELECTED_ELDER_IS_NOW__0_ = new StringId(1487, "Newly selected elder is now < {0} >");
- public static final StringId DistributionManager_NEW_ADMINISTRATION_MEMBER_DETECTED_AT_0 = new StringId(1488, "New administration member detected at {0}.");
- public static final StringId DistributionManager_NOW_CLOSING_DISTRIBUTION_FOR__0 = new StringId(1489, "Now closing distribution for {0}");
- public static final StringId DistributionManager_SHUTTING_DOWN_DISTRIBUTIONMANAGER_0_1 = new StringId(1490, "Shutting down DistributionManager {0}. {1}");
- public static final StringId DistributionManager_STARTING_DISTRIBUTIONMANAGER_0_1 = new StringId(1491, "Starting DistributionManager {0}. {1}");
- public static final StringId DistributionManager_STILL_AWAITING_0_RESPONSES_FROM_1 = new StringId(1492, "Still awaiting {0} response(s) from: {1}.");
- public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_PEER_DEPARTED_THE_VIEW = new StringId(1493, "Stopped waiting for startup reply from <{0}> because the peer departed the view.");
- public static final StringId DistributionManager_STOPPED_WAITING_FOR_STARTUP_REPLY_FROM_0_BECAUSE_THE_REPLY_WAS_FINALLY_RECEIVED = new StringId(1494, "Stopped waiting for startup reply from <{0}> because the reply was finally received.");
- public static final StringId DistributionManager_TASK_FAILED_WITH_EXCEPTION = new StringId(1495, "Task failed with exception");
- public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_CALLING_READYFORMESSAGES = new StringId(1496, "Uncaught exception calling readyForMessages");
- public static final StringId DistributionManager_UNCAUGHT_EXCEPTION_PROCESSING_MEMBER_EVENT = new StringId(1497, "Uncaught exception processing member event");
- public static final StringId DistributionManager_UNEXPECTED_INTERRUPTEDEXCEPTION = new StringId(1498, "Unexpected InterruptedException");
- public static final StringId DistributionManager_UNEXPECTED_THREADINTERRUPTEDEXCEPTION = new StringId(1499, "Unexpected ThreadInterruptedException");
- public static final StringId DistributionManager_WHILE_PUSHING_MESSAGE_0_TO_1 = new StringId(1500, "While pushing message <{0}> to {1}");
- public static final StringId DistributionManager_WHILE_SENDING_SHUTDOWN_MESSAGE = new StringId(1501, "While sending shutdown message");
- public static final StringId DistributionMessage_0__SCHEDULE_REJECTED = new StringId(1502, "{0} schedule() rejected");
- public static final StringId DistributionMessage_UNCAUGHT_EXCEPTION_PROCESSING__0 = new StringId(1503, "Uncaught exception processing {0}");
- public static final StringId DistributionMessage_UNEXPECTED_THREADINTERRUPTEDEXCEPTION_PROCESSING__0 = new StringId(1504, "Unexpected ThreadInterruptedException processing {0}");
- // ok to reuse 1505
- public static final StringId DumpB2NRegion_PARTITIONEDREGION_WITH_ID_0_IS_DESTROYED = new StringId(1506, "PartitionedRegion with id {0} is destroyed");
- public static final StringId DumpB2NRegion_PARTITIONEDREGION_WITH_ID_0_IS_LOCALLY_DESTROYED = new StringId(1507, "PartitionedRegion with id {0} is locally destroyed");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONCREATED = new StringId(1508, "DynamicRegionListener {0} threw exception on afterRegionCreated");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONDESTROYED = new StringId(1509, "DynamicRegionListener {0} threw exception on afterRegionDestroyed");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONCREATED = new StringId(1510, "DynamicRegionListener {0} threw exception on beforeRegionCreated");
- public static final StringId DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONDESTROYED = new StringId(1511, "DynamicRegionListener {0} threw exception on beforeRegionDestroyed");
- public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_CREATE_DYNAMIC_REGION__0 = new StringId(1512, "Error attempting to locally create Dynamic Region: {0}");
- public static final StringId DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_DESTROY_DYNAMIC_REGION__0 = new StringId(1513, "Error attempting to locally destroy Dynamic Region: {0}");
- public static final StringId DynamicRegionFactory_ERROR_DESTROYING_DYNAMIC_REGION__0 = new StringId(1514, "Error destroying Dynamic Region ''{0}''");
- public static final StringId DynamicRegionFactory_ERROR_INITIALIZING_DYNAMICREGIONFACTORY = new StringId(1515, "Error initializing DynamicRegionFactory");
- public static final StringId DynamicRegionFactory_ERROR__COULD_NOT_FIND_A_REGION_NAMED___0_ = new StringId(1516, "Error -- Could not find a region named: ''{0}''");
- public static final StringId ElderState_ELDERSTATE_PROBLEM_DM_0_BUT_SYSTEM_DISTRIBUTIONMANAGER_1 = new StringId(1517, "ElderState problem: dm={0}, but system DistributionManager={1}");
- public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_0 = new StringId(1518, "ElderState problem: system={0}");
- public static final StringId ElderState_ELDERSTATE_PROBLEM_SYSTEM_DISTRIBUTIONMANAGER_0 = new StringId(1519, "ElderState problem: system DistributionManager={0}");
- public static final StringId EndPointImpl_0_1_FAILED_INTEREST_LIST_RECOVERY_BECAUSE_2 = new StringId(1520, "{0}: {1} failed interest list recovery because: {2}");
- public static final StringId EndPointImpl_0_1_FINISHED_INTEREST_LIST_RECOVERY = new StringId(1521, "{0}: {1} finished interest list recovery.");
- public static final StringId EndPointImpl_0_1_STARTING_INTEREST_LIST_RECOVERY = new StringId(1522, "{0}: {1} starting interest list recovery.");
- public static final StringId EndPointImpl_0_CANNOT_CREATE_REGION_1_BECAUSE_THE_SERVER_IS_NOT_AVAILABLE = new StringId(1523, "{0}: Cannot create region {1} because the server is not available.");
- public static final StringId EndPointImpl_0_CANNOT_MAKE_PRIMARY_BECAUSE_THE_SERVER_IS_NOT_AVAILABLE = new StringId(1524, "{0}: Cannot make primary because the server is not available.");
- public static final StringId EndPointImpl_0_CANNOT_SEND_MESSAGE_BECAUSE_PRIMARY_SERVER_IS_NOT_AVAILABLE = new StringId(1525, "{0}: Cannot send message because primary server is not available.");
- public static final StringId EndPointImpl_0_UNEXPECTED_EXCEPTION_OCCURRED_WHILE_ATTEMPTING_TO_UPDATE_1 = new StringId(1526, "{0}: Unexpected Exception occurred while attempting to update {1}");
- public static final StringId EndPointImpl_CONNECTIONPROXYIMPL_0_FINISHED_INSTANTIATORS_RECOVERY = new StringId(1527, "ConnectionProxyImpl ({0}) finished instantiators recovery.");
- public static final StringId EndPointImpl_CONNECTIONPROXYIMPL_0_STARTING_INSTANTIATORS_RECOVERY = new StringId(1528, "ConnectionProxyImpl ({0}) starting instantiators recovery.");
- public static final StringId EndPointImpl_UNABLE_TO_CONNECT_TO_0_AFTER_CREATING_1_CONNECTIONS = new StringId(1529, "Unable to connect to {0} after creating {1} connections");
- public static final StringId EndPointImpl_UNABLE_TO_MAKE_0_AS_PRIMARY_DUE_TO_EXCEPTION_1 = new StringId(1530, "Unable to make {0} as primary due to exception: {1}");
-
<TRUNCATED>
[15/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
new file mode 100755
index 0000000..252b5aa
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalIntegrationTest.java
@@ -0,0 +1,827 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.net.BindException;
+import java.net.InetAddress;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.DistributionLocator;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Tests usage of LocatorLauncher as a local API in existing JVM.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherLocalIntegrationTest extends AbstractLocatorLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpLocatorLauncherLocalIntegrationTest() throws Exception {
+ disconnectFromDS();
+ System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
+ }
+
+ @After
+ public final void tearDownLocatorLauncherLocalIntegrationTest() throws Exception {
+ disconnectFromDS();
+ }
+
+ @Test
+ public void testBuilderSetProperties() throws Throwable {
+ this.launcher = new Builder()
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0")
+ .build();
+
+ try {
+ assertEquals(Status.ONLINE, this.launcher.start().getStatus());
+ waitForLocatorToStart(this.launcher, true);
+
+ final InternalLocator locator = this.launcher.getLocator();
+ assertNotNull(locator);
+
+ final DistributedSystem distributedSystem = locator.getDistributedSystem();
+
+ assertNotNull(distributedSystem);
+ assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME));
+ assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME));
+ assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME));
+ assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME));
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ assertNull(this.launcher.getLocator());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForLocatorToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // validate stale control files were deleted
+ assertFalse(stopRequestFile.exists());
+ assertFalse(statusRequestFile.exists());
+ assertFalse(statusFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForLocatorToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ }/*
+ assertTrue(getUniqueName() + " is broken if PID == Integer.MAX_VALUE", ProcessUtils.identifyPid() != Integer.MAX_VALUE);
+
+ // create existing pid file
+ this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse(realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertTrue(builder.getForce());
+ this.launcher = builder.build();
+ assertTrue(this.launcher.isForcing());
+ this.launcher.start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ try {
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartUsingForceOverwritesExistingPidFile
+ */
+
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
+ assertTrue(this.socket.isBound());
+ assertFalse(this.socket.isClosed());
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+
+ assertNotNull(System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY));
+ assertEquals(this.locatorPort, Integer.valueOf(System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY)).intValue());
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ assertEquals(this.locatorPort, this.launcher.getPort().intValue());
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+
+ // why did it not fail like it's supposed to?
+ final String property = System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY);
+ assertNotNull(property);
+ assertEquals(this.locatorPort, Integer.valueOf(property).intValue());
+ assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+ assertEquals(this.locatorPort, this.launcher.getPort().intValue());
+ assertEquals(this.locatorPort, this.socket.getLocalPort());
+ assertTrue(this.socket.isBound());
+ assertFalse(this.socket.isClosed());
+
+ fail("LocatorLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException text varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ // create existing pid file
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+
+ this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+ writePid(this.pidFile, realPid);
+
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+ RuntimeException expected = null;
+
+ try {
+ this.launcher.start();
+ fail("LocatorLauncher start should have thrown RuntimeException caused by FileAlreadyExistsException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ assertTrue(expected.getMessage(), expected.getMessage().contains("A PID file already exists and a Locator may be running in"));
+ assertEquals(RuntimeException.class, expected.getClass());
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof FileAlreadyExistsException);
+ assertTrue(cause.getMessage().contains("Pid file already exists: "));
+ assertTrue(cause.getMessage().contains("vf.gf.locator.pid for process " + realPid));
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ delete(this.pidFile);
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ @Test
+ public void testStartUsingPort() throws Throwable {
+ // generate one free port and then use it instead of default
+ final int freeTCPPort = AvailablePortHelper.getRandomAvailableTCPPort();
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPort, AvailablePort.SOCKET));
+
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(freeTCPPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ int pid = 0;
+ try {
+ // if start succeeds without throwing exception then #47778 is fixed
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(pidFile.exists());
+ pid = readPid(pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify locator did not use default port
+ assertTrue(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
+
+ final LocatorState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"" + freeTCPPort + "\" instead of " + portString, String.valueOf(freeTCPPort), portString);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartUsingPortInUseFails() throws Throwable {
+ // generate one free port and then use it instead of default
+ final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
+
+ this.launcher = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(freeTCPPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .build();
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+ fail("LocatorLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ LocatorState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ // build and start the locator
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher pidLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ final LocatorState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.workingDirectory + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (pidLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(this.workingDirectory).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ final LocatorState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.workingDirectory + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (dirLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher pidLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // stop the locator
+ final LocatorState locatorState = pidLauncher.stop();
+ assertNotNull(locatorState);
+ assertEquals(Status.STOPPED, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(true)
+ .setWorkingDirectory(this.workingDirectory)
+ .set(DistributionConfig.CLUSTER_CONFIGURATION_DIR, this.clusterConfigDirectory)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(this.workingDirectory).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // stop the locator
+ final LocatorState locatorState = dirLauncher.stop();
+ assertNotNull(locatorState);
+ assertEquals(Status.STOPPED, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
deleted file mode 100755
index bfed4d0..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.net.BindException;
-import java.net.InetAddress;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.DistributionLocator;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Tests usage of LocatorLauncher as a local API in existing JVM.
- *
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitTestCase {
-
- @Before
- public final void setUpLocatorLauncherLocalTest() throws Exception {
- disconnectFromDS();
- System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
- }
-
- @After
- public final void tearDownLocatorLauncherLocalTest() throws Exception {
- disconnectFromDS();
- }
-
- protected Status getExpectedStopStatusForNotRunning() {
- return Status.NOT_RESPONDING;
- }
-
- @Test
- public void testBuilderSetProperties() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- this.launcher = new Builder()
- .setForce(true)
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.MCAST_PORT_NAME, "0")
- .build();
-
- try {
- assertEquals(Status.ONLINE, this.launcher.start().getStatus());
- waitForLocatorToStart(this.launcher, true);
-
- final InternalLocator locator = this.launcher.getLocator();
- assertNotNull(locator);
-
- final DistributedSystem distributedSystem = locator.getDistributedSystem();
-
- assertNotNull(distributedSystem);
- assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME));
- assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME));
- assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME));
- assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME));
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- assertNull(this.launcher.getLocator());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertTrue(factory.isAttachAPIFound());
- }
-
- @Test
- public void testStartCreatesPidFile() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- this.launcher = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .build();
-
- try {
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
- assertEquals(Status.ONLINE, this.launcher.status().getStatus());
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- assertEquals(Status.ONLINE, this.launcher.status().getStatus());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartDeletesStaleControlFiles() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // create existing control files
- this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
- this.stopRequestFile.createNewFile();
- assertTrue(this.stopRequestFile.exists());
-
- this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
- this.statusRequestFile.createNewFile();
- assertTrue(this.statusRequestFile.exists());
-
- this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
- this.statusFile.createNewFile();
- assertTrue(this.statusFile.exists());
-
- // build and start the locator
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
- this.launcher.start();
-
- try {
- waitForLocatorToStart(this.launcher);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // validate stale control files were deleted
- assertFalse(stopRequestFile.exists());
- assertFalse(statusRequestFile.exists());
- assertFalse(statusFile.exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartOverwritesStalePidFile() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // create existing pid file
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
- writePid(this.pidFile, Integer.MAX_VALUE);
-
- // build and start the locator
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
- this.launcher.start();
-
- try {
- waitForLocatorToStart(this.launcher);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- @Ignore("Need to rewrite this without using dunit.Host")
- public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
- }/*
- assertTrue(getUniqueName() + " is broken if PID == Integer.MAX_VALUE", ProcessUtils.identifyPid() != Integer.MAX_VALUE);
-
- // create existing pid file
- this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
- final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
- assertFalse(realPid == ProcessUtils.identifyPid());
- writePid(this.pidFile, realPid);
-
- // build and start the locator
- final Builder builder = new Builder()
- .setForce(true)
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertTrue(builder.getForce());
- this.launcher = builder.build();
- assertTrue(this.launcher.isForcing());
- this.launcher.start();
-
- // collect and throw the FIRST failure
- Throwable failure = null;
-
- try {
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- if (failure != null) {
- throw failure;
- }
- } // testStartUsingForceOverwritesExistingPidFile
- */
-
- @Test
- public void testStartWithDefaultPortInUseFails() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
- assertTrue(this.socket.isBound());
- assertFalse(this.socket.isClosed());
- assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
-
- assertNotNull(System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY));
- assertEquals(this.locatorPort, Integer.valueOf(System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY)).intValue());
- assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
-
- this.launcher = new Builder()
- .setMemberName(getUniqueName())
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .build();
-
- assertEquals(this.locatorPort, this.launcher.getPort().intValue());
-
- RuntimeException expected = null;
- try {
- this.launcher.start();
-
- // why did it not fail like it's supposed to?
- final String property = System.getProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY);
- assertNotNull(property);
- assertEquals(this.locatorPort, Integer.valueOf(property).intValue());
- assertFalse(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
- assertEquals(this.locatorPort, this.launcher.getPort().intValue());
- assertEquals(this.locatorPort, this.socket.getLocalPort());
- assertTrue(this.socket.isBound());
- assertFalse(this.socket.isClosed());
-
- fail("LocatorLauncher start should have thrown RuntimeException caused by BindException");
- } catch (RuntimeException e) {
- expected = e;
- assertNotNull(expected.getMessage());
- // BindException text varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertNotNull(expected);
- final Throwable cause = expected.getCause();
- assertNotNull(cause);
- assertTrue(cause instanceof BindException);
- // BindException string varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
-
- // creation of log file seems to be random -- look into why sometime
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // just in case the launcher started...
- LocatorState status = null;
- try {
- status = this.launcher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- waitForFileToDelete(this.pidFile);
- assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- @Ignore("Need to rewrite this without using dunit.Host")
- public void testStartWithExistingPidFileFails() throws Throwable {
- }/*
- // create existing pid file
- final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
- assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
-
- this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
- writePid(this.pidFile, realPid);
-
- // build and start the locator
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- // collect and throw the FIRST failure
- Throwable failure = null;
- RuntimeException expected = null;
-
- try {
- this.launcher.start();
- fail("LocatorLauncher start should have thrown RuntimeException caused by FileAlreadyExistsException");
- } catch (RuntimeException e) {
- expected = e;
- assertNotNull(expected.getMessage());
- assertTrue(expected.getMessage(), expected.getMessage().contains("A PID file already exists and a Locator may be running in"));
- assertEquals(RuntimeException.class, expected.getClass());
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- // just in case the launcher started...
- LocatorState status = null;
- try {
- status = this.launcher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- assertNotNull(expected);
- final Throwable cause = expected.getCause();
- assertNotNull(cause);
- assertTrue(cause instanceof FileAlreadyExistsException);
- assertTrue(cause.getMessage().contains("Pid file already exists: "));
- assertTrue(cause.getMessage().contains("vf.gf.locator.pid for process " + realPid));
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- try {
- delete(this.pidFile);
- final Status theStatus = status.getStatus();
- assertFalse(theStatus == Status.STARTING);
- assertFalse(theStatus == Status.ONLINE);
- } catch (Throwable e) {
- logger.error(e);
- if (failure == null) {
- failure = e;
- }
- }
-
- if (failure != null) {
- throw failure;
- }
- } // testStartWithExistingPidFileFails
- */
-
- @Test
- public void testStartUsingPort() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // generate one free port and then use it instead of default
- final int freeTCPPort = AvailablePortHelper.getRandomAvailableTCPPort();
- assertTrue(AvailablePort.isPortAvailable(freeTCPPort, AvailablePort.SOCKET));
-
- this.launcher = new Builder()
- .setMemberName(getUniqueName())
- .setPort(freeTCPPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .build();
-
- int pid = 0;
- try {
- // if start succeeds without throwing exception then #47778 is fixed
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(pidFile.exists());
- pid = readPid(pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
- assertEquals(getPid(), pid);
-
- // verify locator did not use default port
- assertTrue(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
-
- final LocatorState status = this.launcher.status();
- final String portString = status.getPort();
- assertEquals("Port should be \"" + freeTCPPort + "\" instead of " + portString, String.valueOf(freeTCPPort), portString);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStartUsingPortInUseFails() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // generate one free port and then use it instead of default
- final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
-
- this.launcher = new Builder()
- .setMemberName(getUniqueName())
- .setPort(freeTCPPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .build();
-
- RuntimeException expected = null;
- try {
- this.launcher.start();
- fail("LocatorLauncher start should have thrown RuntimeException caused by BindException");
- } catch (RuntimeException e) {
- expected = e;
- assertNotNull(expected.getMessage());
- // BindException string varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- assertNotNull(expected);
- final Throwable cause = expected.getCause();
- assertNotNull(cause);
- assertTrue(cause instanceof BindException);
- // BindException string varies by platform
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
-
- // creation of log file seems to be random -- look into why sometime
- final String logFileName = getUniqueName()+".log";
- assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // just in case the launcher started...
- LocatorState status = null;
- try {
- status = this.launcher.stop();
- } catch (Throwable t) {
- // ignore
- }
-
- try {
- waitForFileToDelete(this.pidFile);
- assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStatusUsingPid() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- // build and start the locator
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- LocatorLauncher pidLauncher = null;
- try {
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
-
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- pidLauncher = new Builder().setPid(pid).build();
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- final LocatorState actualStatus = pidLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(rootFolder + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- if (pidLauncher == null) {
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- } else {
- try {
- assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
- }
-
- @Test
- public void testStatusUsingWorkingDirectory() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- LocatorLauncher dirLauncher = null;
- try {
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
-
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
- assertNotNull(dirLauncher);
- assertFalse(dirLauncher.isRunning());
-
- final LocatorState actualStatus = dirLauncher.status();
- assertNotNull(actualStatus);
- assertEquals(Status.ONLINE, actualStatus.getStatus());
- assertEquals(pid, actualStatus.getPid().intValue());
- assertTrue(actualStatus.getUptime() > 0);
- // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
- assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
- assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
- assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
- assertEquals(rootFolder + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
- assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
- assertEquals(getUniqueName(), actualStatus.getMemberName());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- if (dirLauncher == null) {
- try {
- assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- } else {
- try {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
- }
-
- @Test
- public void testStopUsingPid() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- LocatorLauncher pidLauncher = null;
- try {
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- pidLauncher = new Builder().setPid(pid).build();
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // stop the locator
- final LocatorState locatorState = pidLauncher.stop();
- assertNotNull(locatorState);
- assertEquals(Status.STOPPED, locatorState.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.launcher.stop();
- } catch (Throwable e) {
- // ignore
- }
-
- try {
- // verify the PID file was deleted
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Test
- public void testStopUsingWorkingDirectory() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(true)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config");
-
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- LocatorLauncher dirLauncher = null;
- try {
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
- assertNotNull(dirLauncher);
- assertFalse(dirLauncher.isRunning());
-
- // stop the locator
- final LocatorState locatorState = dirLauncher.stop();
- assertNotNull(locatorState);
- assertEquals(Status.STOPPED, locatorState.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- this.launcher.stop();
- } catch (Throwable e) {
- // ignore
- }
-
- try {
- // verify the PID file was deleted
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileIntegrationTest.java
new file mode 100755
index 0000000..63f7312
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileIntegrationTest.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.lang.AttachAPINotFoundException;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Subclass of LocatorLauncherRemoteDUnitTest which forces the code to not find
+ * the Attach API which is in the JDK tools.jar. As a result LocatorLauncher
+ * ends up using the FileProcessController implementation.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherRemoteFileIntegrationTest extends LocatorLauncherRemoteIntegrationTest {
+
+ @Before
+ public final void setUpLocatorLauncherRemoteFileIntegrationTest() throws Exception {
+ System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
+ }
+
+ @After
+ public final void tearDownLocatorLauncherRemoteFileIntegrationTest() throws Exception {
+ }
+
+ /**
+ * Override and assert Attach API is NOT found
+ */
+ @Override
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertFalse(factory.isAttachAPIFound());
+ }
+
+ /**
+ * Override because FileProcessController cannot request status with PID
+ */
+ @Override
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ LocatorLauncher pidLauncher = null;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ final File pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(pidFile.exists());
+ pid = readPid(pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // status with pid only should throw AttachAPINotFoundException
+ try {
+ pidLauncher.status();
+ fail("FileProcessController should have thrown AttachAPINotFoundException");
+ } catch (AttachAPINotFoundException e) {
+ // passed
+ }
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the locator
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid, true);
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Override because FileProcessController cannot request stop with PID
+ */
+ @Override
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(LocatorLauncher.class.getName());
+ command.add(LocatorLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--port=" + this.locatorPort);
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
+
+ // wait for locator to start
+ int pid = 0;
+ File pidFile = null;
+ LocatorLauncher pidLauncher = null;
+ final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForLocatorToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue(pidFile.exists());
+ pid = readPid(pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // stop with pid only should throw AttachAPINotFoundException
+ try {
+ pidLauncher.stop();
+ fail("FileProcessController should have thrown AttachAPINotFoundException");
+ } catch (AttachAPINotFoundException e) {
+ // passed
+ }
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // stop the locator
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ waitForFileToDelete(pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
deleted file mode 100755
index d3edcae..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.internal.process.ProcessStreamReader;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.lang.AttachAPINotFoundException;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Subclass of LocatorLauncherRemoteDUnitTest which forces the code to not find
- * the Attach API which is in the JDK tools.jar. As a result LocatorLauncher
- * ends up using the FileProcessController implementation.
- *
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class LocatorLauncherRemoteFileJUnitTest extends LocatorLauncherRemoteJUnitTest {
-
- @Before
- public final void setUpLocatorLauncherRemoteFileTest() throws Exception {
- System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
- }
-
- @After
- public final void tearDownLocatorLauncherRemoteFileTest() throws Exception {
- }
-
- @Override
- @Test
- /**
- * Override and assert Attach API is NOT found
- */
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertFalse(factory.isAttachAPIFound());
- }
-
- @Override
- @Test
- /**
- * Override because FileProcessController cannot request status with PID
- */
- public void testStatusUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
-
- // wait for locator to start
- int pid = 0;
- LocatorLauncher pidLauncher = null;
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher);
-
- // validate the pid file and its contents
- final File pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(pidFile.exists());
- pid = readPid(pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // status with pid only should throw AttachAPINotFoundException
- try {
- pidLauncher.status();
- fail("FileProcessController should have thrown AttachAPINotFoundException");
- } catch (AttachAPINotFoundException e) {
- // passed
- }
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- // stop the locator
- try {
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForPidToStop(pid, true);
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-
- @Override
- @Test
- /**
- * Override because FileProcessController cannot request stop with PID
- */
- public void testStopUsingPid() throws Throwable {
- final List<String> jvmArguments = getJvmArguments();
-
- final List<String> command = new ArrayList<String>();
- command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
- for (String jvmArgument : jvmArguments) {
- command.add(jvmArgument);
- }
- command.add("-cp");
- command.add(System.getProperty("java.class.path"));
- command.add(LocatorLauncher.class.getName());
- command.add(LocatorLauncher.Command.START.getName());
- command.add(getUniqueName());
- command.add("--port=" + this.locatorPort);
- command.add("--redirect-output");
-
- this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
- this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
- this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
-
- // wait for locator to start
- int pid = 0;
- File pidFile = null;
- LocatorLauncher pidLauncher = null;
- final LocatorLauncher dirLauncher = new LocatorLauncher.Builder()
- .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
- .build();
- try {
- waitForLocatorToStart(dirLauncher);
-
- // validate the pid file and its contents
- pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue(pidFile.exists());
- pid = readPid(pidFile);
- assertTrue(pid > 0);
- assertTrue(ProcessUtils.isProcessAlive(pid));
-
- // validate log file was created
- final String logFileName = getUniqueName()+".log";
- assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
-
- // use launcher with pid
- pidLauncher = new Builder()
- .setPid(pid)
- .build();
-
- assertNotNull(pidLauncher);
- assertFalse(pidLauncher.isRunning());
-
- // stop with pid only should throw AttachAPINotFoundException
- try {
- pidLauncher.stop();
- fail("FileProcessController should have thrown AttachAPINotFoundException");
- } catch (AttachAPINotFoundException e) {
- // passed
- }
-
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // stop the locator
- assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
- waitForPidToStop(pid);
- waitForFileToDelete(pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
- }
-}
[18/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
GEODE-1255: Add test coverage for using a custom log4j2.xml with Geode
* refactor launcher integration tests (rename files, use TemporaryFolder)
* refactor cluster config tests (use TemporaryFolder)
* change several additional tests to use TemporaryFolder
* add better support for TemporaryFolder usage to HeadlessGfsh
* alter HeadlessGfsh tests to use TemporaryFolder
* rescope variables and methods to private where possible
* fixup file formatting
* prevent eating of exceptions
* remove incomplete or useless javadocs
* rename LocatorJUnitTest test methods from TRAC #s to meaningful names
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/566fce96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/566fce96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/566fce96
Branch: refs/heads/feature/GEODE-1276
Commit: 566fce96aa8759d14b9825577116293c1578147e
Parents: 024cd22
Author: Kirk Lund <kl...@apache.org>
Authored: Thu May 5 15:46:26 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu May 5 15:48:30 2016 -0700
----------------------------------------------------------------------
.../LocatorLauncherAssemblyIntegrationTest.java | 155 ++
.../LocatorLauncherAssemblyJUnitTest.java | 156 --
.../SharedConfigurationEndToEndDUnitTest.java | 311 ++--
.../cache/operations/OperationContext.java | 4 -
.../internal/SharedConfiguration.java | 532 +++----
.../AbstractLauncherIntegrationJUnitTest.java | 71 -
.../AbstractLauncherIntegrationTest.java | 71 +
.../AbstractLauncherIntegrationTestCase.java | 254 ++++
.../distributed/AbstractLauncherJUnitTest.java | 298 ----
.../AbstractLauncherJUnitTestCase.java | 254 ----
.../AbstractLauncherServiceStatusJUnitTest.java | 264 ----
.../AbstractLauncherServiceStatusTest.java | 264 ++++
.../distributed/AbstractLauncherTest.java | 298 ++++
...tractLocatorLauncherIntegrationTestCase.java | 117 ++
.../AbstractLocatorLauncherJUnitTestCase.java | 105 --
...ocatorLauncherRemoteIntegrationTestCase.java | 67 +
...stractServerLauncherIntegrationTestCase.java | 95 ++
.../AbstractServerLauncherJUnitTestCase.java | 93 --
...ServerLauncherRemoteIntegrationTestCase.java | 95 ++
.../distributed/DistributedTestSuite.java | 35 -
.../distributed/HostedLocatorsDUnitTest.java | 27 +-
.../LauncherMemberMXBeanIntegrationTest.java | 151 ++
.../LauncherMemberMXBeanJUnitTest.java | 152 --
.../gemfire/distributed/LauncherTestSuite.java | 47 -
.../gemfire/distributed/LocatorJUnitTest.java | 67 +-
.../LocatorLauncherIntegrationJUnitTest.java | 248 ---
.../LocatorLauncherIntegrationTest.java | 248 +++
.../distributed/LocatorLauncherJUnitTest.java | 341 -----
...LocatorLauncherLocalFileIntegrationTest.java | 54 +
.../LocatorLauncherLocalFileJUnitTest.java | 51 -
.../LocatorLauncherLocalIntegrationTest.java | 827 ++++++++++
.../LocatorLauncherLocalJUnitTest.java | 842 -----------
...ocatorLauncherRemoteFileIntegrationTest.java | 218 +++
.../LocatorLauncherRemoteFileJUnitTest.java | 218 ---
.../LocatorLauncherRemoteIntegrationTest.java | 977 ++++++++++++
.../LocatorLauncherRemoteJUnitTest.java | 1011 -------------
...rRemoteWithCustomLoggingIntegrationTest.java | 124 ++
.../distributed/LocatorLauncherTest.java | 340 +++++
.../distributed/LocatorStateJUnitTest.java | 208 ---
.../gemfire/distributed/LocatorStateTest.java | 208 +++
.../MockServerLauncherCacheProvider.java | 8 +-
.../ServerLauncherIntegrationJUnitTest.java | 312 ----
.../ServerLauncherIntegrationTest.java | 311 ++++
.../distributed/ServerLauncherJUnitTest.java | 903 -----------
.../ServerLauncherLocalFileIntegrationTest.java | 54 +
.../ServerLauncherLocalFileJUnitTest.java | 54 -
.../ServerLauncherLocalIntegrationTest.java | 1073 +++++++++++++
.../ServerLauncherLocalJUnitTest.java | 1073 -------------
...ServerLauncherRemoteFileIntegrationTest.java | 222 +++
.../ServerLauncherRemoteFileJUnitTest.java | 222 ---
.../ServerLauncherRemoteIntegrationTest.java | 1380 +++++++++++++++++
.../ServerLauncherRemoteJUnitTest.java | 1430 ------------------
...rRemoteWithCustomLoggingIntegrationTest.java | 122 ++
.../gemfire/distributed/ServerLauncherTest.java | 898 +++++++++++
...rverLauncherWithProviderIntegrationTest.java | 89 ++
.../ServerLauncherWithProviderJUnitTest.java | 90 --
.../gemstone/gemfire/internal/ClassBuilder.java | 2 +-
.../logging/log4j/custom/BasicAppender.java | 76 +
.../CustomConfigWithCacheIntegrationTest.java | 148 ++
...stomConfigWithLogServiceIntegrationTest.java | 119 ++
.../log4j/custom/CustomConfiguration.java | 64 +
...leProcessControllerIntegrationJUnitTest.java | 13 +-
.../management/internal/cli/HeadlessGfsh.java | 23 +-
.../cli/HeadlessGfshIntegrationTest.java | 90 ++
.../internal/cli/HeadlessGfshJUnitTest.java | 85 --
.../cli/commands/CliCommandTestBase.java | 31 +-
.../ConnectCommandWithHttpAndSSLDUnitTest.java | 305 ++++
.../cli/commands/DeployCommandsDUnitTest.java | 52 +-
...WithCacheLoaderDuringCacheMissDUnitTest.java | 159 +-
...stAndDescribeDiskStoreCommandsDUnitTest.java | 117 +-
.../cli/commands/ListIndexCommandDUnitTest.java | 121 +-
.../cli/commands/ShellCommandsDUnitTest.java | 2 +-
.../cli/commands/UserCommandsDUnitTest.java | 2 +-
.../SharedConfigurationDUnitTest.java | 227 ++-
.../SharedConfigurationTestUtils.java | 40 +
.../SharedConfigurationUsingDirDUnitTest.java | 128 +-
.../security/GfshShellConnectionRule.java | 8 +-
.../logging/log4j/custom/log4j2-custom.xml | 27 +
.../pulse/internal/data/JMXDataUpdater.java | 3 -
.../wan/wancommand/WANCommandTestBase.java | 2 +-
.../ClusterConfigurationDUnitTest.java | 1236 ++++++++-------
gradle/dependency-versions.properties | 20 +-
82 files changed, 11076 insertions(+), 10163 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java
new file mode 100644
index 0000000..332cbf4
--- /dev/null
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.ManagerMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+
+import static org.junit.Assert.*;
+
+/**
+ * These tests are part of assembly as they require the REST war file to be present.
+ */
+@Category(IntegrationTest.class)
+public class LocatorLauncherAssemblyIntegrationTest extends AbstractLocatorLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpLocatorLauncherLocalTest() throws Exception {
+ disconnectFromDS();
+ System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName() + "-");
+ }
+
+ @After
+ public final void tearDownLocatorLauncherLocalTest() throws Exception {
+ disconnectFromDS();
+ }
+
+ /*
+ * This test addresses GEODE-528
+ */
+ @Test
+ public void testLocatorStopsWhenJmxPortIsZero() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(false)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false")
+ .set(DistributionConfig.JMX_MANAGER_NAME, "true")
+ .set(DistributionConfig.JMX_MANAGER_START_NAME, "true")
+ .set(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
+
+ performTest(builder);
+ }
+
+ /*
+ * This test addresses GEODE-528
+ */
+ @Test
+ public void testLocatorStopsWhenJmxPortIsNonZero() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+ final int jmxPort = AvailablePortHelper.getRandomAvailableTCPPorts(1)[0];
+
+ final Builder builder = new Builder().setMemberName(getUniqueName())
+ .setPort(this.locatorPort)
+ .setRedirectOutput(false)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false")
+ .set(DistributionConfig.JMX_MANAGER_NAME, "true")
+ .set(DistributionConfig.JMX_MANAGER_START_NAME, "true")
+ .set(DistributionConfig.JMX_MANAGER_PORT_NAME, Integer.toString(jmxPort));
+
+ performTest(builder);
+ }
+
+ private void performTest(Builder builder) {
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ LocatorLauncher dirLauncher = null;
+ int initialThreadCount = Thread.activeCount();
+
+ try {
+ this.launcher.start();
+ waitForLocatorToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+ assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(builder.getWorkingDirectory()).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // Stop the manager
+ Cache cache = CacheFactory.getAnyInstance();
+ ManagerMXBean managerBean = ManagementService.getManagementService(cache).getManagerMXBean();
+ managerBean.stop();
+
+ // stop the locator
+ final LocatorLauncher.LocatorState locatorState = dirLauncher.stop();
+ assertNotNull(locatorState);
+ assertEquals(Status.STOPPED, locatorState.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ int finalThreadCount = Integer.MAX_VALUE;
+
+ // Spin for up to 5 seconds waiting for threads to finish
+ for (int i = 0; i < 50 && finalThreadCount > initialThreadCount; i++) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException ex) {
+ // ignored
+ }
+ finalThreadCount = Thread.activeCount();
+ }
+
+ assertEquals(initialThreadCount, finalThreadCount);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyJUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyJUnitTest.java
deleted file mode 100644
index 0984508..0000000
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyJUnitTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.process.ProcessType;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.management.ManagerMXBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-
-import static org.junit.Assert.*;
-
-/**
- * These tests are part of assembly as they require the REST war file to be present.
- *
- */
-@Category(IntegrationTest.class)
-public class LocatorLauncherAssemblyJUnitTest extends AbstractLocatorLauncherJUnitTestCase {
-
- @Before
- public final void setUpLocatorLauncherLocalTest() throws Exception {
- disconnectFromDS();
- System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName() + "-");
- }
-
- @After
- public final void tearDownLocatorLauncherLocalTest() throws Exception {
- disconnectFromDS();
- }
-
- /*
- * This test addresses GEODE-528
- */
- @Test
- public void testLocatorStopsWhenJmxPortIsZero() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
-
- final Builder builder = new Builder()
- .setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(false)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false")
- .set(DistributionConfig.JMX_MANAGER_NAME, "true")
- .set(DistributionConfig.JMX_MANAGER_START_NAME, "true")
- .set(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
-
- performTest(builder);
- }
-
- /*
- * This test addresses GEODE-528
- */
- @Test
- public void testLocatorStopsWhenJmxPortIsNonZero() throws Throwable {
- String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
- final int jmxPort = AvailablePortHelper.getRandomAvailableTCPPorts(1)[0];
-
- final Builder builder = new Builder().setMemberName(getUniqueName())
- .setPort(this.locatorPort)
- .setRedirectOutput(false)
- .setWorkingDirectory(rootFolder)
- .set(DistributionConfig.LOG_LEVEL_NAME, "config")
- .set(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false")
- .set(DistributionConfig.JMX_MANAGER_NAME, "true")
- .set(DistributionConfig.JMX_MANAGER_START_NAME, "true")
- .set(DistributionConfig.JMX_MANAGER_PORT_NAME, Integer.toString(jmxPort));
-
- performTest(builder);
- }
-
- private void performTest(Builder builder) {
- assertFalse(builder.getForce());
- this.launcher = builder.build();
- assertFalse(this.launcher.isForcing());
-
- LocatorLauncher dirLauncher = null;
- int initialThreadCount = Thread.activeCount();
-
- try {
- this.launcher.start();
- waitForLocatorToStart(this.launcher);
-
- // validate the pid file and its contents
- this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
- assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
- final int pid = readPid(this.pidFile);
- assertTrue(pid > 0);
- assertEquals(ProcessUtils.identifyPid(), pid);
-
- dirLauncher = new Builder().setWorkingDirectory(builder.getWorkingDirectory()).build();
- assertNotNull(dirLauncher);
- assertFalse(dirLauncher.isRunning());
-
- // Stop the manager
- Cache cache = CacheFactory.getAnyInstance();
- ManagerMXBean managerBean = ManagementService.getManagementService(cache).getManagerMXBean();
- managerBean.stop();
-
- // stop the locator
- final LocatorLauncher.LocatorState locatorState = dirLauncher.stop();
- assertNotNull(locatorState);
- assertEquals(Status.STOPPED, locatorState.getStatus());
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- try {
- // verify the PID file was deleted
- waitForFileToDelete(this.pidFile);
- } catch (Throwable e) {
- this.errorCollector.addError(e);
- }
-
- int finalThreadCount = Integer.MAX_VALUE;
-
- // Spin for up to 5 seconds waiting for threads to finish
- for (int i = 0; i < 50 && finalThreadCount > initialThreadCount; i++) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException ex) {
- // ignored
- }
- finalThreadCount = Thread.activeCount();
- }
-
- assertEquals(initialThreadCount, finalThreadCount);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
index 653bbdc..caee9ea 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
@@ -16,117 +16,143 @@
*/
package com.gemstone.gemfire.management.internal.configuration;
+import static com.gemstone.gemfire.cache.RegionShortcut.*;
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.*;
+import static com.gemstone.gemfire.internal.FileUtil.*;
+import static com.gemstone.gemfire.internal.lang.StringUtils.*;
+import static com.gemstone.gemfire.management.internal.cli.CliUtil.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import static com.gemstone.gemfire.test.dunit.Wait.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+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.RegionShortcut;
import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.ClassBuilder;
-import com.gemstone.gemfire.internal.FileUtil;
import com.gemstone.gemfire.internal.JarDeployer;
import com.gemstone.gemfire.internal.admin.remote.ShutdownAllRequest;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.lang.StringUtils;
import com.gemstone.gemfire.management.cli.Result.Status;
-import com.gemstone.gemfire.management.internal.cli.CliUtil;
import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
@Category(DistributedTest.class)
public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
+
private static final int TIMEOUT = 10000;
private static final int INTERVAL = 500;
+
private static final String REGION1 = "R1";
private static final String REGION2 = "R2";
private static final String INDEX1 = "ID1";
- private transient ClassBuilder classBuilder = new ClassBuilder();
- public static Set<String> serverNames = new HashSet<String>();
- public static Set<String> jarFileNames = new HashSet<String>();
- private static final long serialVersionUID = -2276690105585944041L;
+ private static Set<String> serverNames;
+ private static Set<String> jarFileNames;
- public Set<String> startServers(HeadlessGfsh gfsh, String locatorString, int numServers, String serverNamePrefix, int startNum) throws ClassNotFoundException, IOException {
- Set<String> serverNames = new HashSet<String>();
+ private transient ClassBuilder classBuilder;
+ private transient String jmxHost;
+ private transient int jmxPort;
+ private transient int httpPort;
+ private transient String locatorString;
- final int[] serverPorts = AvailablePortHelper.getRandomAvailableTCPPorts(numServers);
- for (int i=0; i<numServers; i++) {
- int port = serverPorts[i];
- String serverName = serverNamePrefix+ Integer.toString(i+startNum) + "-" + port;
- CommandStringBuilder csb = new CommandStringBuilder(CliStrings.START_SERVER);
- csb.addOption(CliStrings.START_SERVER__NAME, serverName);
- csb.addOption(CliStrings.START_SERVER__LOCATORS, locatorString);
- csb.addOption(CliStrings.START_SERVER__SERVER_PORT, Integer.toString(port));
- CommandResult cmdResult = executeCommand(gfsh, csb.getCommandString());
- assertEquals(Status.OK, cmdResult.getStatus());
- }
- return serverNames;
- }
+ @Override
+ public final void postSetUpCliCommandTestBase() throws Exception {
+ disconnectAllFromDS();
+
+ addIgnoredException("EntryDestroyedException");
+
+ serverNames = new HashSet<>();
+ jarFileNames = new HashSet<>();
+
+ this.classBuilder = new ClassBuilder();
- @Test
- public void testStartServerAndExecuteCommands() throws InterruptedException, ClassNotFoundException, IOException, ExecutionException {
- IgnoredException.addIgnoredException("EntryDestroyedException");
Object[] result = setup();
- final int locatorPort = (Integer) result[0];
- final String jmxHost = (String) result[1];
- final int jmxPort = (Integer) result[2];
- final int httpPort = (Integer) result[3];
- final String locatorString = "localHost[" + locatorPort + "]";
+ int locatorPort = (Integer) result[0];
+
+ this.jmxHost = (String) result[1];
+ this.jmxPort = (Integer) result[2];
+ this.httpPort = (Integer) result[3];
+ this.locatorString = "localHost[" + locatorPort + "]";
+ }
- final HeadlessGfsh gfsh = new HeadlessGfsh("gfsh2", 300);
+ @Override
+ public final void preTearDownCliCommandTestBase() throws Exception {
+ //shutdown everything
+ shutdownAll();
+
+ serverNames.clear();
+ jarFileNames.clear();
+
+ serverNames = null;
+ jarFileNames = null;
+ }
+
+ @Test
+ public void testStartServerAndExecuteCommands() throws Exception {
+ final HeadlessGfsh gfsh = new HeadlessGfsh("gfsh2", 300, this.gfshDir);
assertNotNull(gfsh);
shellConnect(jmxHost, jmxPort, httpPort, gfsh);
serverNames.addAll(startServers(gfsh, locatorString, 2, "Server", 1));
doCreateCommands();
serverNames.addAll(startServers(gfsh, locatorString, 1, "NewMember", 4));
+
verifyRegionCreateOnAllMembers(REGION1);
verifyRegionCreateOnAllMembers(REGION2);
verifyIndexCreationOnAllMembers(INDEX1);
verifyAsyncEventQueueCreation();
-
+ }
+ private Set<String> startServers(final HeadlessGfsh gfsh, final String locatorString, final int numServers, final String serverNamePrefix, final int startNum) throws ClassNotFoundException, IOException {
+ Set<String> serverNames = new HashSet<>();
- //shutdown everything
- getLogWriter().info("Shutting down all the members");
- shutdownAll();
- deleteSavedJarFiles();
- }
+ final int[] serverPorts = getRandomAvailableTCPPorts(numServers);
+ for (int i=0; i<numServers; i++) {
+ int port = serverPorts[i];
+ String serverName = serverNamePrefix+ Integer.toString(i+startNum) + "-" + port;
+ CommandStringBuilder csb = new CommandStringBuilder(CliStrings.START_SERVER);
+ csb.addOption(CliStrings.START_SERVER__NAME, serverName);
+ csb.addOption(CliStrings.START_SERVER__LOCATORS, locatorString);
+ csb.addOption(CliStrings.START_SERVER__SERVER_PORT, Integer.toString(port));
+
+ CommandResult cmdResult = executeCommand(gfsh, csb.getCommandString());
+
+ assertEquals(Status.OK, cmdResult.getStatus());
+ }
+ return serverNames;
+ }
- private void doCreateCommands() {
- createRegion(REGION1, RegionShortcut.REPLICATE, null);
- createRegion(REGION2, RegionShortcut.PARTITION, null);
+ private void doCreateCommands() throws IOException {
+ createRegion(REGION1, REPLICATE, null);
+ createRegion(REGION2, PARTITION, null);
createIndex(INDEX1 , "AAPL", REGION1, null);
- createAndDeployJar("Deploy1.jar");
+ createAndDeployJar(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "Deploy1.jar");
createAsyncEventQueue("q1");
final String autoCompact = "true";
final String allowForceCompaction = "true";
@@ -143,34 +169,33 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
createDiskStore(diskStoreName, diskDirs, autoCompact, allowForceCompaction, compactionThreshold, duCritical, duWarning, maxOplogSize, queueSize, timeInterval, writeBufferSize);
}
-
- protected void executeAndVerifyCommand(String commandString) {
+ private void executeAndVerifyCommand(final String commandString) {
CommandResult cmdResult = executeCommand(commandString);
getLogWriter().info("Command Result : \n" + commandResultToString(cmdResult));
assertEquals(Status.OK, cmdResult.getStatus());
assertFalse(cmdResult.failedToPersist());
}
- private void createRegion(String regionName, RegionShortcut regionShortCut, String group) {
+ private void createRegion(final String regionName, final RegionShortcut regionShortCut, final String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
executeAndVerifyCommand(csb.getCommandString());
}
- private void destroyRegion(String regionName) {
+ private void destroyRegion(final String regionName) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_REGION);
csb.addOption(CliStrings.DESTROY_REGION__REGION, regionName);
executeAndVerifyCommand(csb.getCommandString());
}
- private void stopServer(String serverName) {
+ private void stopServer(final String serverName) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.STOP_SERVER);
csb.addOption(CliStrings.STOP_SERVER__MEMBER, serverName);
executeAndVerifyCommand(csb.getCommandString());
}
- public void createAsyncEventQueue(String queueName) {
+ private void createAsyncEventQueue(final String queueName) throws IOException {
String queueCommandsJarName = "testEndToEndSC-QueueCommands.jar";
final File jarFile = new File(queueCommandsJarName);
@@ -208,23 +233,22 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.getCommandString());
- } catch (IOException e) {
- e.printStackTrace();
} finally {
FileUtils.deleteQuietly(jarFile);
}
}
- private void createDiskStore(String diskStoreName,
- String diskDirs,
- String autoCompact,
- String allowForceCompaction,
- String compactionThreshold,
- String duCritical,
- String duWarning,
- String maxOplogSize,
- String queueSize,
- String timeInterval,
- String writeBufferSize) {
+
+ private void createDiskStore(final String diskStoreName,
+ final String diskDirs,
+ final String autoCompact,
+ final String allowForceCompaction,
+ final String compactionThreshold,
+ final String duCritical,
+ final String duWarning,
+ final String maxOplogSize,
+ final String queueSize,
+ final String timeInterval,
+ final String writeBufferSize) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
csb.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreName);
csb.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, diskDirs);
@@ -240,13 +264,14 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.getCommandString());
}
- private void destroyDiskStore(String diskStoreName, String group) {
+ private void destroyDiskStore(final String diskStoreName, final String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_DISK_STORE);
csb.addOption(CliStrings.DESTROY_DISK_STORE__NAME, diskStoreName);
csb.addOptionWithValueCheck(CliStrings.DESTROY_DISK_STORE__GROUP, group);
executeAndVerifyCommand(csb.toString());
}
- public void createIndex(String indexName, String expression, String regionName, String group) {
+
+ private void createIndex(final String indexName, final String expression, final String regionName, final String group) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
@@ -254,57 +279,50 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
executeAndVerifyCommand(csb.getCommandString());
}
- public void destoyIndex(String indexName, String regionName, String group) {
- if (StringUtils.isBlank(indexName) && StringUtils.isBlank(regionName) && StringUtils.isBlank(group)) {
+ private void destroyIndex(final String indexName, final String regionName, final String group) {
+ if (isBlank(indexName) && isBlank(regionName) && isBlank(group)) {
return;
}
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
- if (!StringUtils.isBlank(indexName)) {
+ if (!isBlank(indexName)) {
csb.addOption(CliStrings.DESTROY_INDEX__NAME, indexName);
}
- if (!StringUtils.isBlank(regionName)) {
+ if (!isBlank(regionName)) {
csb.addOption(CliStrings.DESTROY_INDEX__REGION, regionName);
}
- if (!StringUtils.isBlank(group)) {
+ if (!isBlank(group)) {
csb.addOption(CliStrings.DESTROY_INDEX__GROUP, group);
}
executeAndVerifyCommand(csb.getCommandString());
}
- public void createAndDeployJar(String jarName) {
+ private void createAndDeployJar(final String jarName) throws IOException {
File newDeployableJarFile = new File(jarName);
- try {
- this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
- CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
- csb.addOption(CliStrings.DEPLOY__JAR, jarName);
- executeAndVerifyCommand(csb.getCommandString());
- jarFileNames.add(jarName);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
+ CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
+ csb.addOption(CliStrings.DEPLOY__JAR, jarName);
+ executeAndVerifyCommand(csb.getCommandString());
+ jarFileNames.add(jarName);
}
- public void deleteSavedJarFiles() {
- try {
- FileUtil.deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
- FileUtil.delete(new File("Deploy1.jar"));
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
+ private void deleteSavedJarFiles() throws IOException {
+ deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
+ delete(new File("Deploy1.jar"));
}
- public Object[] setup() {
- disconnectAllFromDS();
- final int [] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+ private Object[] setup() throws IOException {
+ final int [] ports = getRandomAvailableTCPPorts(3);
final int locator1Port = ports[0];
+
final String locator1Name = "locator1-" + locator1Port;
- VM locatorAndMgr = Host.getHost(0).getVM(3);
+ final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
+ VM locatorAndMgr = getHost(0).getVM(3);
Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
@Override
- public Object call() {
+ public Object call() throws IOException {
int httpPort;
int jmxPort;
String jmxHost;
@@ -316,42 +334,37 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
jmxHost = "localhost";
}
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int[] ports = getRandomAvailableTCPPorts(2);
jmxPort = ports[0];
httpPort = ports[1];
- final File locatorLogFile = new File("locator-" + locator1Port + ".log");
+ final File locatorLogFile = new File(locatorLogPath);
final Properties locatorProps = new Properties();
- locatorProps.setProperty(DistributionConfig.NAME_NAME, locator1Name);
- locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- locatorProps.setProperty(DistributionConfig.LOG_LEVEL_NAME, "config");
- locatorProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
- locatorProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
- locatorProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
-
- try {
- final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null,
- locatorProps);
- WaitCriterion wc = new WaitCriterion() {
- @Override
- public boolean done() {
- return locator.isSharedConfigurationRunning();
- }
-
- @Override
- public String description() {
- return "Waiting for shared configuration to be started";
- }
- };
- waitForCriterion(wc, TIMEOUT, INTERVAL, true);
- } catch (IOException ioex) {
- fail("Unable to create a locator with a shared configuration");
- }
+ locatorProps.setProperty(NAME_NAME, locator1Name);
+ locatorProps.setProperty(MCAST_PORT_NAME, "0");
+ locatorProps.setProperty(LOG_LEVEL_NAME, "config");
+ locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_START_NAME, "true");
+ locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
+ locatorProps.setProperty(JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
+ locatorProps.setProperty(HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+
+ final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
+ WaitCriterion wc = new WaitCriterion() {
+ @Override
+ public boolean done() {
+ return locator.isSharedConfigurationRunning();
+ }
+ @Override
+ public String description() {
+ return "Waiting for shared configuration to be started";
+ }
+ };
+ waitForCriterion(wc, TIMEOUT, INTERVAL, true);
final Object[] result = new Object[4];
result[0] = locator1Port;
@@ -368,32 +381,28 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
int httpPort = (Integer)result[3];
shellConnect(jmxHost, jmxPort, httpPort, gfsh);
+
// Create a cache in VM 1
- VM dataMember = Host.getHost(0).getVM(1);
+ VM dataMember = getHost(0).getVM(1);
dataMember.invoke(new SerializableCallable() {
@Override
public Object call() {
Properties localProps = new Properties();
- localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- localProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost:" + locator1Port);
- localProps.setProperty(DistributionConfig.NAME_NAME, "DataMember");
+ localProps.setProperty(MCAST_PORT_NAME, "0");
+ localProps.setProperty(LOCATORS_NAME, "localhost:" + locator1Port);
+ localProps.setProperty(NAME_NAME, "DataMember");
getSystem(localProps);
Cache cache = getCache();
assertNotNull(cache);
- return CliUtil.getAllNormalMembers(cache);
+ return getAllNormalMembers(cache);
}
});
return result;
}
private void shutdownAll() throws IOException {
- VM locatorAndMgr = Host.getHost(0).getVM(3);
+ VM locatorAndMgr = getHost(0).getVM(3);
locatorAndMgr.invoke(new SerializableCallable() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
@Override
public Object call() throws Exception {
GemFireCacheImpl cache = (GemFireCacheImpl)CacheFactory.getAnyInstance();
@@ -402,7 +411,8 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
}
});
- locatorAndMgr.invoke(SharedConfigurationDUnitTest.locatorCleanup);
+ locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
+
//Clean up the directories
if (!serverNames.isEmpty()) {
for (String serverName : serverNames) {
@@ -412,10 +422,9 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
}
}
serverNames.clear();
- serverNames = null;
}
- private void verifyRegionCreateOnAllMembers(String regionName) {
+ private void verifyRegionCreateOnAllMembers(final String regionName) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESCRIBE_REGION);
csb.addOption(CliStrings.DESCRIBE_REGION__NAME, regionName);
CommandResult cmdResult = executeCommand(csb.getCommandString());
@@ -426,7 +435,7 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
}
}
- private void verifyIndexCreationOnAllMembers(String indexName) {
+ private void verifyIndexCreationOnAllMembers(final String indexName) {
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_INDEX);
CommandResult cmdResult = executeCommand(csb.getCommandString());
String resultAsString = commandResultToString(cmdResult);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
index b632edb..dec716c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
@@ -303,10 +303,6 @@ public abstract class OperationContext extends WildcardPermission{
return Resource.NULL;
}
- /**
- *
- * @return
- */
public String getRegionName(){
return "NULL";
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/SharedConfiguration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/SharedConfiguration.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/SharedConfiguration.java
index 8f190eb..0f349e9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/SharedConfiguration.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/SharedConfiguration.java
@@ -83,50 +83,38 @@ import com.gemstone.gemfire.management.internal.configuration.messages.SharedCon
import com.gemstone.gemfire.management.internal.configuration.utils.XmlUtils;
import com.gemstone.gemfire.management.internal.configuration.utils.ZipUtils;
-/*********
- *
- *
- */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({ "deprecation", "unchecked" })
public class SharedConfiguration {
private static final Logger logger = LogService.getLogger();
- static class JarFileFilter implements FilenameFilter {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
- }
- /****
+ /**
* Name of the directory where the shared configuration artifacts are stored
*/
public static final String CLUSTER_CONFIG_ARTIFACTS_DIR_NAME = "cluster_config";
- public static final String CLUSTER_CONFIG_DISK_STORE_NAME = "cluster_config";
- public static String CONFIG_DIR_PATH;//FilenameUtils.concat(System.getProperty("user.dir"), CONFIG_ARTIFACTS_DIR_NAME);
+ private static final String CLUSTER_CONFIG_DISK_STORE_NAME = "cluster_config";
public static final String CLUSTER_CONFIG_DISK_DIR_PREFIX = "ConfigDiskDir_";
public static final String CLUSTER_CONFIG = "cluster";
-
- /***
+ /**
* Name of the lock service used for shared configuration
*/
- public static final String SHARED_CONFIG_LOCK_SERVICE_NAME = "__CLUSTER_CONFIG_LS";
+ private static final String SHARED_CONFIG_LOCK_SERVICE_NAME = "__CLUSTER_CONFIG_LS";
- /***
+ /**
* Name of the lock for locking the shared configuration
*/
public static final String SHARED_CONFIG_LOCK_NAME = "__CLUSTER_CONFIG_LOCK";
- /***
+ /**
* Name of the region which is used to store the configuration information
*/
- public static final String CONFIG_REGION_NAME = "_ConfigurationRegion";
+ private static final String CONFIG_REGION_NAME = "_ConfigurationRegion";
-
- public String CONFIG_DISK_DIR_NAME;
- public String CONFIG_DISK_DIR_PATH;;
+ private final String configDirPath;
+ private final String configDiskDirName;
+ private final String configDiskDirPath;;
private final Set<PersistentMemberPattern> newerSharedConfigurationLocatorInfo = new HashSet<PersistentMemberPattern>();
private final AtomicReference<SharedConfigurationStatus> status = new AtomicReference<SharedConfigurationStatus>();
@@ -136,12 +124,9 @@ public class SharedConfiguration {
private GemFireCacheImpl cache;
private final DistributedLockService sharedConfigLockingService;
-
- /****
+ /**
* Gets or creates (if not created) shared configuration lock service
- * @return DistributedLockService
*/
-
public static DistributedLockService getSharedConfigLockService(DistributedSystem ds) {
DistributedLockService sharedConfigDls = DLockService.getServiceNamed(SHARED_CONFIG_LOCK_SERVICE_NAME);
try {
@@ -154,19 +139,9 @@ public class SharedConfiguration {
return sharedConfigDls;
}
- /**
- * Returns an array containing the names of the subdirectories in a given directory
- * @param path Path of the directory whose subdirectories are listed
- * @return String[] names of first level subdirectories, null if no subdirectories are found or if the path is incorrect
- */
- private static String[] getSubdirectories(String path) {
- File directory = new File(path);
- return directory.list(DirectoryFileFilter.INSTANCE);
- }
-
public SharedConfiguration(Cache cache) throws IOException {
this.cache = (GemFireCacheImpl)cache;
- CONFIG_DISK_DIR_NAME = CLUSTER_CONFIG_DISK_DIR_PREFIX + cache.getDistributedSystem().getName();
+ this.configDiskDirName = CLUSTER_CONFIG_DISK_DIR_PREFIX + cache.getDistributedSystem().getName();
String clusterConfigDir = cache.getDistributedSystem().getProperties().getProperty(DistributionConfig.CLUSTER_CONFIGURATION_DIR);
if (StringUtils.isBlank(clusterConfigDir)) {
clusterConfigDir = System.getProperty("user.dir");
@@ -177,17 +152,14 @@ public class SharedConfiguration {
}
clusterConfigDir = diskDir.getCanonicalPath();
}
- CONFIG_DISK_DIR_PATH = FilenameUtils.concat(clusterConfigDir, CONFIG_DISK_DIR_NAME);
- CONFIG_DIR_PATH = FilenameUtils.concat(clusterConfigDir, CLUSTER_CONFIG_ARTIFACTS_DIR_NAME);
+ this.configDiskDirPath = FilenameUtils.concat(clusterConfigDir, this.configDiskDirName);
+ configDirPath = FilenameUtils.concat(clusterConfigDir, CLUSTER_CONFIG_ARTIFACTS_DIR_NAME);
sharedConfigLockingService = getSharedConfigLockService(cache.getDistributedSystem());
status.set(SharedConfigurationStatus.NOT_STARTED);
}
- /*****
+ /**
* Add jar information into the shared configuration and save the jars in the file system
- * @param jarNames
- * @param jarBytes
- * @param groups
* @return true on success
*/
public boolean addJars(String []jarNames, byte[][]jarBytes, String[]groups) {
@@ -198,7 +170,7 @@ public class SharedConfiguration {
}
Region<String, Configuration> configRegion = getConfigurationRegion();
for (String group : groups) {
- Configuration configuration = (Configuration) configRegion.get(group);
+ Configuration configuration = configRegion.get(group);
if (configuration == null) {
configuration = new Configuration(group);
@@ -206,7 +178,7 @@ public class SharedConfiguration {
}
configuration.addJarNames(jarNames);
configRegion.put(group, configuration);
- String groupDir = FilenameUtils.concat(CONFIG_DIR_PATH, group);
+ String groupDir = FilenameUtils.concat(configDirPath, group);
writeJarFiles(groupDir, jarNames, jarBytes);
}
} catch (Exception e) {
@@ -216,12 +188,8 @@ public class SharedConfiguration {
return success;
}
-
- /***
+ /**
* Adds/replaces the xml entity in the shared configuration
- * @param xmlEntity
- * @param groups
- * @throws Exception
*/
public void addXmlEntity(XmlEntity xmlEntity, String[] groups) throws Exception {
Region<String, Configuration> configRegion = getConfigurationRegion();
@@ -248,30 +216,6 @@ public class SharedConfiguration {
}
}
- /**
- * Create a {@link Document} using
- * {@link XmlUtils#createDocumentFromXml(String)} and if the version attribute
- * is not equal to the current version then update the XML to the current
- * schema and return the document.
- *
- * @param xmlContent
- * XML content to load and upgrade.
- * @return {@link Document} from xmlContent.
- * @throws IOException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws XPathExpressionException
- * @since 8.1
- */
- // UnitTest SharedConfigurationJUnitTest.testCreateAndUpgradeDocumentFromXml
- static Document createAndUpgradeDocumentFromXml(final String xmlContent) throws SAXException, ParserConfigurationException, IOException, XPathExpressionException {
- Document doc = XmlUtils.createDocumentFromXml(xmlContent);
- if (!CacheXml.VERSION_LATEST.equals(XmlUtils.getAttribute(doc.getDocumentElement(), CacheXml.VERSION, CacheXml.GEODE_NAMESPACE))) {
- doc = XmlUtils.upgradeSchema(doc, CacheXml.GEODE_NAMESPACE, CacheXml.LATEST_SCHEMA_LOCATION, CacheXml.VERSION_LATEST);
- }
- return doc;
- }
-
public void clearSharedConfiguration() throws Exception {
Region<String, Configuration> configRegion = getConfigurationRegion();
if (configRegion != null) {
@@ -279,11 +223,9 @@ public class SharedConfiguration {
}
}
-
- /*****
+ /**
* Creates the shared configuration service
* @param loadSharedConfigFromDir when set to true, loads the configuration from the share_config directory
- * @throws Exception
*/
public void initSharedConfiguration(boolean loadSharedConfigFromDir) throws Exception {
status.set(SharedConfigurationStatus.STARTED);
@@ -349,23 +291,11 @@ public class SharedConfiguration {
status.set(SharedConfigurationStatus.RUNNING);
}
-
- public boolean lockSharedConfiguration() {
- return sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, -1, -1);
- }
-
- public void unlockSharedConfiguration() {
- sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
- }
-
- /****
+ /**
* Creates a ConfigurationResponse based on the configRequest, configuration response contains the requested shared configuration
* This method locks the SharedConfiguration
- * @param configRequest
- * @return ConfigurationResponse
- * @throws Exception
*/
- public ConfigurationResponse createConfigurationReponse(ConfigurationRequest configRequest) throws Exception {
+ public ConfigurationResponse createConfigurationReponse(final ConfigurationRequest configRequest) throws Exception {
ConfigurationResponse configResponse = new ConfigurationResponse();
@@ -401,7 +331,7 @@ public class SharedConfiguration {
return configResponse;
}
- /***
+ /**
* Create a response containing the status of the Shared configuration and information about other locators containing newer
* shared configuration data (if at all)
* @return {@link SharedConfigurationStatusResponse} containing the {@link SharedConfigurationStatus}
@@ -413,13 +343,10 @@ public class SharedConfiguration {
return response;
}
- /*****
+ /**
* Deletes the xml entity from the shared configuration.
- * @param xmlEntity
- * @param groups
- * @throws Exception
*/
- public void deleteXmlEntity (XmlEntity xmlEntity, String[] groups) throws Exception {
+ public void deleteXmlEntity(final XmlEntity xmlEntity, String[] groups) throws Exception {
Region<String, Configuration> configRegion = getConfigurationRegion();
//No group is specified, so delete in every single group if it exists.
if (groups == null) {
@@ -441,7 +368,7 @@ public class SharedConfiguration {
}
}
- public void modifyCacheAttributes(XmlEntity xmlEntity, String [] groups) throws Exception {
+ public void modifyCacheAttributes(final XmlEntity xmlEntity, String [] groups) throws Exception {
Region<String, Configuration> configRegion = getConfigurationRegion();
//No group is specified, so modify the cache attributes for a in every single group if it exists.
if (groups == null) {
@@ -474,27 +401,26 @@ public class SharedConfiguration {
}
}
- /***
- * Only to be used for clean up in DUnits.
+ /**
+ * For tests only. TODO: clean this up and remove from production code
+ * <p/>
+ * Throws {@code AssertionError} wrapping any exception thrown by operation.
*/
- public void destroySharedConfiguration() {
- Region<String, Configuration> configRegion;
+ public void destroySharedConfiguration_forTestsOnly() {
try {
- configRegion = getConfigurationRegion();
+ Region<String, Configuration> configRegion = getConfigurationRegion();
if (configRegion != null) {
configRegion.destroyRegion();
}
DiskStore configDiskStore = this.cache.findDiskStore(CLUSTER_CONFIG_ARTIFACTS_DIR_NAME);
if (configDiskStore != null) {
configDiskStore.destroy();
- File file = new File(CONFIG_DISK_DIR_PATH);
+ File file = new File(configDiskDirPath);
FileUtils.deleteDirectory(file);
}
- FileUtils.deleteDirectory(new File(CONFIG_DIR_PATH));
- } catch (IOException e) {
- e.printStackTrace();
- } catch (Exception e1) {
- e1.printStackTrace();
+ FileUtils.deleteDirectory(new File(configDirPath));
+ } catch (Exception exception) {
+ throw new AssertionError(exception);
}
}
@@ -521,7 +447,7 @@ public class SharedConfiguration {
if (configuration != null) {
Set<String> jarNameSet = configuration.getJarNames();
for (String jarName : jarNameSet) {
- String groupDirPath = FilenameUtils.concat(CONFIG_DIR_PATH, group);
+ String groupDirPath = FilenameUtils.concat(configDirPath, group);
if (!jarsAdded.contains(jarName)) {
String jarFilePath = FilenameUtils.concat(groupDirPath, jarName);
jarNames[ctr]=jarName;
@@ -531,18 +457,163 @@ public class SharedConfiguration {
}
}
}
+
jars[0] = jarNames;
jars[1] = jarBytes;
}
return jars;
}
+ public Configuration getConfiguration(String groupName) throws Exception {
+ Configuration configuration = getConfigurationRegion().get(groupName);
+ return configuration;
+ }
+
+ public Map<String, Configuration> getEntireConfiguration() throws Exception {
+ Set<String> keys = getConfigurationRegion().keySet();
+ return getConfigurationRegion().getAll(keys);
+ }
+
+ /**
+ * Returns the path of Shared configuration directory
+ * @return {@link String} path of the shared configuration directory
+ */
+ public String getSharedConfigurationDirPath() {
+ return configDirPath;
+ }
+
+ /**
+ * Gets the current status of the SharedConfiguration
+ * If the status is started , it determines if the shared configuration is waiting for new configuration on
+ * other locators
+ * @return {@link SharedConfigurationStatus}
+ */
+ public SharedConfigurationStatus getStatus() {
+ SharedConfigurationStatus scStatus = this.status.get();
+ if (scStatus == SharedConfigurationStatus.STARTED) {
+ PersistentMemberManager pmm = cache.getPersistentMemberManager();
+ Map<String, Set<PersistentMemberID>> waitingRegions = pmm.getWaitingRegions();
+ if (!waitingRegions.isEmpty()) {
+ this.status.compareAndSet(SharedConfigurationStatus.STARTED, SharedConfigurationStatus.WAITING);
+ Set<PersistentMemberID> persMemIds = waitingRegions.get(Region.SEPARATOR_CHAR + CONFIG_REGION_NAME);
+ for (PersistentMemberID persMemId : persMemIds) {
+ newerSharedConfigurationLocatorInfo.add(new PersistentMemberPattern(persMemId));
+ }
+ }
+ }
+ return this.status.get();
+ }
+
+ /**
+ * Loads the
+ * @throws Exception
+ */
+ public void loadSharedConfigurationFromDisk() throws Exception {
+ Map<String, Configuration> sharedConfigurationMap = readSharedConfigurationFromDisk();
+ getConfigurationRegion().clear();
+ getConfigurationRegion().putAll(sharedConfigurationMap);
+ }
+
+ public void modifyProperties(final Properties properties, String[] groups) throws Exception {
+ if (groups == null) {
+ groups = new String[] {SharedConfiguration.CLUSTER_CONFIG};
+ }
+ Region<String, Configuration> configRegion = getConfigurationRegion();
+ for (String group : groups) {
+ Configuration configuration = configRegion.get(group);
+ if (configuration == null) {
+ configuration = new Configuration(group);
+ }
+ configuration.getGemfireProperties().putAll(properties);
+ configRegion.put(group, configuration);
+ writeConfig(configuration);
+ }
+ }
+
+ /**
+ * Removes the jar files from the shared configuration.
+ * @param jarNames Names of the jar files.
+ * @param groups Names of the groups which had the jar file deployed.
+ * @return true on success.
+ */
+ public boolean removeJars(final String[] jarNames, String[] groups){
+ boolean success = true;
+ try {
+ Region<String, Configuration> configRegion = getConfigurationRegion();
+ if (groups == null) {
+ Set<String> groupSet = configRegion.keySet();
+ groups = groupSet.toArray(new String[groupSet.size()]);
+ }
+ for (String group : groups) {
+ Configuration configuration = (Configuration) configRegion.get(group);
+ if (configuration != null) {
+ String dirPath = FilenameUtils.concat(getSharedConfigurationDirPath(), configuration.getConfigName());
+ removeJarFiles(dirPath, jarNames);
+ }
+ }
+ for (String group : groups) {
+ Configuration configuration = (Configuration) configRegion.get(group);
+ if (configuration != null) {
+ if (!configuration.getJarNames().isEmpty()) {
+ configuration.removeJarNames(jarNames);
+ configRegion.put(group, configuration);
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.info("Exception occurred while deleting the jar files", e);
+ success = false;
+ }
+ return success;
+ }
+
+ public void renameExistingSharedConfigDirectory() {
+ File configDirFile = new File(configDirPath);
+ if (configDirFile.exists()) {
+ String configDirFileName2 = CLUSTER_CONFIG_ARTIFACTS_DIR_NAME + new SimpleDateFormat("yyyyMMddhhmm").format(new Date()) + "." + System.nanoTime();
+ File configDirFile2 = new File(FilenameUtils.concat(configDirFileName2, configDirFileName2));
+ try {
+ FileUtils.moveDirectoryToDirectory(configDirFile, configDirFile2, true);
+ } catch (IOException e) {
+ logger.info(e);
+ }
+ }
+ }
+
+ /**
+ * Writes the contents of the {@link Configuration} to the file system
+ */
+ public void writeConfig(final Configuration configuration) throws Exception {
+ File configDir = new File(getSharedConfigurationDirPath());
+ if (!configDir.exists()) {
+ if (!configDir.mkdirs()) {
+ throw new IOException("Cannot create directory : " + getSharedConfigurationDirPath());
+ }
+ }
+ String dirPath = FilenameUtils.concat(getSharedConfigurationDirPath(), configuration.getConfigName());
+ File file = new File(dirPath);
+ if (!file.exists()) {
+ if (!file.mkdir()) {
+ throw new IOException("Cannot create directory : " + dirPath);
+ }
+ }
+
+ writeProperties(dirPath, configuration);
+ writeCacheXml(dirPath, configuration);
+ }
+
+ private boolean lockSharedConfiguration() {
+ return sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, -1, -1);
+ }
+
+ private void unlockSharedConfiguration() {
+ sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
+ }
- /***
+ /**
* Gets the Jar from existing locators in the system
- * @throws Exception
*/
- public void getAllJarsFromOtherLocators() throws Exception {
+ private void getAllJarsFromOtherLocators() throws Exception {
logger.info("Getting Jar files from other locators");
DM dm = cache.getDistributionManager();
DistributedMember me = cache.getMyId();
@@ -555,7 +626,6 @@ public class SharedConfiguration {
logger.info("No other locators present");
return;
}
- @SuppressWarnings("unchecked")
ResultCollector<?, List<Object>> rc = (ResultCollector<?, List<Object>>) CliUtil.executeFunction(getAllJarsFunction, null , locators);
List<Object> results = rc.getResult();
@@ -584,7 +654,7 @@ public class SharedConfiguration {
for (String group : groups) {
Configuration config = entireConfiguration.get(group);
Set<String> groupJarNames = config.getJarNames();
- String groupDirPath = FilenameUtils.concat(CONFIG_DIR_PATH, group);
+ String groupDirPath = FilenameUtils.concat(configDirPath, group);
for (String groupJarName : groupJarNames) {
Integer index = jarIndex.get(groupJarName);
@@ -609,29 +679,22 @@ public class SharedConfiguration {
}
}
- public Configuration getConfiguration(String groupName) throws Exception {
- Configuration configuration = (Configuration)getConfigurationRegion().get(groupName);
- return configuration;
- }
-
- /*****
+ /**
* Gets the region containing the shared configuration data.
* The region is created , if it does not exist already.
* Note : this could block if this locator contains stale persistent configuration data.
- * @return {@link Region} ConfigurationRegion
- * @throws Exception
+ * @return {@link Region} ConfigurationRegion
*/
private Region<String, Configuration> getConfigurationRegion() throws Exception {
- @SuppressWarnings("unchecked")
Region<String, Configuration> configRegion = cache.getRegion(CONFIG_REGION_NAME);
try {
if (configRegion == null) {
- File diskDir = new File(CONFIG_DISK_DIR_PATH);
+ File diskDir = new File(configDiskDirPath);
if (!diskDir.exists()) {
if (!diskDir.mkdirs()) {
- throw new IOException("Cannot create directory at " + CONFIG_DISK_DIR_PATH);
+ throw new IOException("Cannot create directory at " + configDiskDirPath);
}
}
@@ -653,83 +716,24 @@ public class SharedConfiguration {
configRegion = cache.createVMRegion(CONFIG_REGION_NAME, regionAttrsFactory.create(), internalArgs);
}
+
} catch (CancelException e) {
if (configRegion == null) {
this.status.set(SharedConfigurationStatus.STOPPED);
}
throw e; // CONFIG: don't rethrow as Exception, keep it a subclass of CancelException
+
} catch (Exception e) {
if (configRegion == null) {
this.status.set(SharedConfigurationStatus.STOPPED);
}
throw new Exception("Error occurred while initializing cluster configuration", e);
}
- return configRegion;
- }
- public Map<String, Configuration> getEntireConfiguration() throws Exception {
- Set<String> keys = getConfigurationRegion().keySet();
- return getConfigurationRegion().getAll(keys);
- }
-
-
- /****
- * Returns the path of Shared configuration directory
- * @return {@link String} path of the shared configuration directory
- */
- public String getSharedConfigurationDirPath() {
- return CONFIG_DIR_PATH;
- }
-
-
- /*****
- * Gets the current status of the SharedConfiguration
- * If the status is started , it determines if the shared configuration is waiting for new configuration on
- * other locators
- * @return {@link SharedConfigurationStatus}
- */
- public SharedConfigurationStatus getStatus() {
- SharedConfigurationStatus scStatus = this.status.get();
- if (scStatus == SharedConfigurationStatus.STARTED) {
- PersistentMemberManager pmm = cache.getPersistentMemberManager();
- Map<String, Set<PersistentMemberID>> waitingRegions = pmm.getWaitingRegions();
- if (!waitingRegions.isEmpty()) {
- this.status.compareAndSet(SharedConfigurationStatus.STARTED, SharedConfigurationStatus.WAITING);
- Set<PersistentMemberID> persMemIds = waitingRegions.get(Region.SEPARATOR_CHAR + CONFIG_REGION_NAME);
- for (PersistentMemberID persMemId : persMemIds) {
- newerSharedConfigurationLocatorInfo.add(new PersistentMemberPattern(persMemId));
- }
- }
- }
- return this.status.get();
- }
- /****
- * Loads the
- * @throws Exception
- */
- public void loadSharedConfigurationFromDisk() throws Exception {
- Map<String, Configuration> sharedConfigurationMap = readSharedConfigurationFromDisk();
- getConfigurationRegion().clear();
- getConfigurationRegion().putAll(sharedConfigurationMap);
- }
-
- public void modifyProperties(Properties properties, String[] groups) throws Exception {
- if (groups == null) {
- groups = new String[] {SharedConfiguration.CLUSTER_CONFIG};
- }
- Region<String, Configuration> configRegion = getConfigurationRegion();
- for (String group : groups) {
- Configuration configuration = (Configuration) configRegion.get(group);
- if (configuration == null) {
- configuration = new Configuration(group);
- }
- configuration.getGemfireProperties().putAll(properties);
- configRegion.put(group, configuration);
- writeConfig(configuration);
- }
+ return configRegion;
}
- /*****
+ /**
* Reads the configuration information from the shared configuration directory and returns a {@link Configuration} object
* @param configName
* @param configDirectory
@@ -739,7 +743,7 @@ public class SharedConfiguration {
* @throws ParserConfigurationException
* @throws SAXException
*/
- private Configuration readConfiguration(String configName, String configDirectory) throws SAXException, ParserConfigurationException, TransformerFactoryConfigurationError, TransformerException {
+ private Configuration readConfiguration(final String configName, final String configDirectory) throws SAXException, ParserConfigurationException, TransformerFactoryConfigurationError, TransformerException {
Configuration configuration = new Configuration(configName);
String cacheXmlFullPath = FilenameUtils.concat(configDirectory, configuration.getCacheXmlFileName());
String propertiesFullPath = FilenameUtils.concat(configDirectory, configuration.getPropertiesFileName());
@@ -760,14 +764,13 @@ public class SharedConfiguration {
return configuration;
}
- /*****
+ /**
* Reads the properties from the properties file.
* @param propertiesFilePath
* @return {@link Properties}
* @throws IOException
*/
- public Properties readProperties(String propertiesFilePath) throws IOException{
-
+ private Properties readProperties(final String propertiesFilePath) throws IOException {
Properties properties = new Properties();
File propsFile = new File(propertiesFilePath);
FileInputStream fis = null;
@@ -784,9 +787,8 @@ public class SharedConfiguration {
return properties;
}
-
- /****
- * Reads the "shared_config" directory and loads all the cache.xml , gemfire.properties and deployd jars information
+ /**
+ * Reads the "shared_config" directory and loads all the cache.xml, gemfire.properties and deployed jars information
* @return {@link Map}
* @throws TransformerException
* @throws TransformerFactoryConfigurationError
@@ -794,12 +796,12 @@ public class SharedConfiguration {
* @throws SAXException
*/
private Map<String, Configuration> readSharedConfigurationFromDisk() throws SAXException, ParserConfigurationException, TransformerFactoryConfigurationError, TransformerException {
- String []subdirectoryNames = getSubdirectories(CONFIG_DIR_PATH);
+ String[] subdirectoryNames = getSubdirectories(configDirPath);
Map<String, Configuration> sharedConfiguration = new HashMap<String, Configuration>();
if (subdirectoryNames != null) {
for (String subdirectoryName : subdirectoryNames) {
- String fullpath = FilenameUtils.concat(CONFIG_DIR_PATH, subdirectoryName);
+ String fullpath = FilenameUtils.concat(configDirPath, subdirectoryName);
Configuration configuration = readConfiguration(subdirectoryName, fullpath);
sharedConfiguration.put(subdirectoryName, configuration);
}
@@ -807,16 +809,13 @@ public class SharedConfiguration {
return sharedConfiguration;
}
-
-
- /****
+ /**
* Removes the jar files from the given directory
* @param dirPath Path of the configuration directory
* @param jarNames Names of the jar files
* @throws IOException
*/
-
- public void removeJarFiles (String dirPath, String[] jarNames) throws IOException {
+ private void removeJarFiles(final String dirPath, final String[] jarNames) throws IOException {
if (jarNames != null) {
for (int i=0; i<jarNames.length; i++) {
File jarFile = new File(FilenameUtils.concat(dirPath, jarNames[i]));
@@ -838,96 +837,21 @@ public class SharedConfiguration {
}
}
- /****
- * Removes the jar files from the shared configuration.
- * @param jarNames Names of the jar files.
- * @param groups Names of the groups which had the jar file deployed.
- * @return true on success.
- */
- public boolean removeJars(String []jarNames, String[] groups){
- boolean success = true;
- try {
- Region<String, Configuration> configRegion = getConfigurationRegion();
- if (groups == null) {
- Set<String> groupSet = configRegion.keySet();
- groups = groupSet.toArray(new String[groupSet.size()]);
- }
- for (String group : groups) {
- Configuration configuration = (Configuration) configRegion.get(group);
- if (configuration != null) {
- String dirPath = FilenameUtils.concat(getSharedConfigurationDirPath(), configuration.getConfigName());
- removeJarFiles(dirPath, jarNames);
- }
- }
- for (String group : groups) {
- Configuration configuration = (Configuration) configRegion.get(group);
- if (configuration != null) {
- if (!configuration.getJarNames().isEmpty()) {
- configuration.removeJarNames(jarNames);
- configRegion.put(group, configuration);
- }
- }
- }
- } catch (Exception e) {
- logger.info("Exception occurred while deleting the jar files", e);
- success = false;
- }
- return success;
- }
-
- public void renameExistingSharedConfigDirectory() {
- File configDirFile = new File(CONFIG_DIR_PATH);
- if (configDirFile.exists()) {
- String configDirFileName2 = CLUSTER_CONFIG_ARTIFACTS_DIR_NAME + new SimpleDateFormat("yyyyMMddhhmm").format(new Date()) + "." + System.nanoTime();
- File configDirFile2 = new File(FilenameUtils.concat(configDirFileName2, configDirFileName2));
- try {
- FileUtils.moveDirectoryToDirectory(configDirFile, configDirFile2, true);
- } catch (IOException e) {
- logger.info(e);
- }
- }
- }
- /***
+ /**
* Writes the cache.xml to the file , based on Configuration
- * @param dirPath Path of the directory in which the configuration is written
- * @param configuration
- * @throws IOException
*/
- private void writeCacheXml(String dirPath, Configuration configuration) throws IOException {
+ private void writeCacheXml(final String dirPath, final Configuration configuration) throws IOException {
String fullPath = FilenameUtils.concat(dirPath,configuration.getCacheXmlFileName());
FileUtils.writeStringToFile(new File(fullPath), configuration.getCacheXmlContent(), "UTF-8") ;
}
- /***
- * Writes the contents of the {@link Configuration} to the file system
- * @param configuration
- * @throws Exception
- */
- public void writeConfig(Configuration configuration) throws Exception {
- File configDir = new File(getSharedConfigurationDirPath());
- if (!configDir.exists()) {
- if (!configDir.mkdirs()) {
- throw new IOException("Cannot create directory : " + getSharedConfigurationDirPath());
- }
- }
- String dirPath = FilenameUtils.concat(getSharedConfigurationDirPath(), configuration.getConfigName());
- File file = new File(dirPath);
- if (!file.exists()) {
- if (!file.mkdir()) {
- throw new IOException("Cannot create directory : " + dirPath);
- }
- }
-
- writeProperties(dirPath, configuration);
- writeCacheXml(dirPath, configuration);
- }
- /*****
+ /**
* Writes the
* @param dirPath target directory , where the jar files are to be written
* @param jarNames Array containing the name of the jar files.
* @param jarBytes Array of byte arrays for the jar files.
*/
- private void writeJarFiles(String dirPath , String[] jarNames, byte[][] jarBytes) {
+ private void writeJarFiles(final String dirPath, final String[] jarNames, final byte[][] jarBytes) {
for (int i=0; i<jarNames.length; i++) {
String filePath = FilenameUtils.concat(dirPath, jarNames[i]);
File jarFile = new File(filePath);
@@ -939,17 +863,49 @@ public class SharedConfiguration {
}
}
- /****
+ /**
* Writes the properties to the file based on the {@link Configuration}
- * @param dirPath
- * @param configuration
- * @throws IOException
*/
- private void writeProperties(String dirPath, Configuration configuration) throws IOException {
+ private void writeProperties(final String dirPath, final Configuration configuration) throws IOException {
String fullPath = FilenameUtils.concat(dirPath,configuration.getPropertiesFileName());
BufferedWriter bw = new BufferedWriter(new FileWriter(fullPath));
configuration.getGemfireProperties().store(bw, "");
bw.close();
}
+ /**
+ * Create a {@link Document} using
+ * {@link XmlUtils#createDocumentFromXml(String)} and if the version attribute
+ * is not equal to the current version then update the XML to the current
+ * schema and return the document.
+ *
+ * @param xmlContent XML content to load and upgrade.
+ * @return {@link Document} from xmlContent.
+ * @since 8.1
+ */
+ // UnitTest SharedConfigurationJUnitTest.testCreateAndUpgradeDocumentFromXml
+ static Document createAndUpgradeDocumentFromXml(final String xmlContent) throws SAXException, ParserConfigurationException, IOException, XPathExpressionException {
+ Document doc = XmlUtils.createDocumentFromXml(xmlContent);
+ if (!CacheXml.VERSION_LATEST.equals(XmlUtils.getAttribute(doc.getDocumentElement(), CacheXml.VERSION, CacheXml.GEODE_NAMESPACE))) {
+ doc = XmlUtils.upgradeSchema(doc, CacheXml.GEODE_NAMESPACE, CacheXml.LATEST_SCHEMA_LOCATION, CacheXml.VERSION_LATEST);
+ }
+ return doc;
+ }
+
+ /**
+ * Returns an array containing the names of the subdirectories in a given directory
+ * @param path Path of the directory whose subdirectories are listed
+ * @return String[] names of first level subdirectories, null if no subdirectories are found or if the path is incorrect
+ */
+ private static String[] getSubdirectories(String path) {
+ File directory = new File(path);
+ return directory.list(DirectoryFileFilter.INSTANCE);
+ }
+
+ private static class JarFileFilter implements FilenameFilter {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationJUnitTest.java
deleted file mode 100755
index 745090d..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationJUnitTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.assertj.core.api.Assertions.*;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.Properties;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Integration tests for AbstractLauncher class. These tests require file system I/O.
- */
-@Category(IntegrationTest.class)
-public class AbstractLauncherIntegrationJUnitTest {
-
- @Rule
- public final TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Rule
- public final TestName testName = new TestName();
-
- private File gemfirePropertiesFile;
- private Properties expectedGemfireProperties;
-
- @Before
- public void setUp() throws Exception {
- this.gemfirePropertiesFile = this.temporaryFolder.newFile("gemfire.properties");
-
- this.expectedGemfireProperties = new Properties();
- this.expectedGemfireProperties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
- this.expectedGemfireProperties.setProperty(DistributionConfig.GROUPS_NAME, "groupOne, groupTwo");
- this.expectedGemfireProperties.store(new FileWriter(this.gemfirePropertiesFile, false), this.testName.getMethodName());
-
- assertThat(this.gemfirePropertiesFile).isNotNull();
- assertThat(this.gemfirePropertiesFile.exists()).isTrue();
- assertThat(this.gemfirePropertiesFile.isFile()).isTrue();
- }
-
- @Test
- public void testLoadGemFirePropertiesFromFile() throws Exception {
- final Properties actualGemFireProperties = AbstractLauncher.loadGemFireProperties(this.gemfirePropertiesFile.toURI().toURL());
-
- assertThat(actualGemFireProperties).isNotNull();
- assertThat(actualGemFireProperties).isEqualTo(this.expectedGemfireProperties);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java
new file mode 100755
index 0000000..040d15f
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for AbstractLauncher class. These tests require file system I/O.
+ */
+@Category(IntegrationTest.class)
+public class AbstractLauncherIntegrationTest {
+
+ private File gemfirePropertiesFile;
+ private Properties expectedGemfireProperties;
+
+ @Rule
+ public final TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ @Before
+ public void setUp() throws Exception {
+ this.gemfirePropertiesFile = this.temporaryFolder.newFile("gemfire.properties");
+
+ this.expectedGemfireProperties = new Properties();
+ this.expectedGemfireProperties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
+ this.expectedGemfireProperties.setProperty(DistributionConfig.GROUPS_NAME, "groupOne, groupTwo");
+ this.expectedGemfireProperties.store(new FileWriter(this.gemfirePropertiesFile, false), this.testName.getMethodName());
+
+ assertThat(this.gemfirePropertiesFile).isNotNull();
+ assertThat(this.gemfirePropertiesFile.exists()).isTrue();
+ assertThat(this.gemfirePropertiesFile.isFile()).isTrue();
+ }
+
+ @Test
+ public void testLoadGemFirePropertiesFromFile() throws Exception {
+ final Properties actualGemFireProperties = AbstractLauncher.loadGemFireProperties(this.gemfirePropertiesFile.toURI().toURL());
+
+ assertThat(actualGemFireProperties).isNotNull();
+ assertThat(actualGemFireProperties).isEqualTo(this.expectedGemfireProperties);
+ }
+}
[34/37] incubator-geode git commit: Merge remote-tracking branch
'origin/develop' into feature/GEODE-1276
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ce7ddc0/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
index 0000000,4cd21a2..06c6bd1
mode 000000,100755..100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteIntegrationTest.java
@@@ -1,0 -1,1380 +1,1380 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package com.gemstone.gemfire.distributed;
+
+ import static org.hamcrest.CoreMatchers.*;
+ import static org.junit.Assert.*;
+
+ import java.io.File;
+ import java.io.FileOutputStream;
+ import java.io.FileWriter;
+ import java.io.IOException;
+ import java.io.PrintStream;
+ import java.io.PrintWriter;
+ import java.lang.management.ManagementFactory;
+ import java.net.InetAddress;
+ import java.util.ArrayList;
+ import java.util.List;
+ import java.util.concurrent.Callable;
+ import java.util.concurrent.atomic.AtomicBoolean;
+
+ import org.junit.After;
+ import org.junit.Before;
+ import org.junit.Ignore;
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+
+ import com.gemstone.gemfire.cache.DataPolicy;
+ import com.gemstone.gemfire.cache.Scope;
+ import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+ import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+ import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
+ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+ import com.gemstone.gemfire.internal.AvailablePort;
+ import com.gemstone.gemfire.internal.AvailablePortHelper;
+ import com.gemstone.gemfire.internal.GemFireVersion;
+ import com.gemstone.gemfire.internal.SocketCreator;
+ import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
+ import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+ import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+ import com.gemstone.gemfire.internal.logging.LocalLogWriter;
+ import com.gemstone.gemfire.internal.process.PidUnavailableException;
+ import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+ import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+ import com.gemstone.gemfire.internal.process.ProcessType;
+ import com.gemstone.gemfire.internal.process.ProcessUtils;
+ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+ import com.gemstone.gemfire.test.process.ProcessWrapper;
+
+ /**
+ * Integration tests for launching a Server in a forked process.
+ *
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.ServerState
+ * @see com.gemstone.gemfire.internal.AvailablePortHelper
+ * @since 8.0
+ */
+ @Category(IntegrationTest.class)
+ public class ServerLauncherRemoteIntegrationTest extends AbstractServerLauncherRemoteIntegrationTestCase {
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
+ public void testRunningServerOutlivesForkingProcess() throws Throwable {
+ // launch ServerLauncherForkingProcess which then launches server
+
+ // final List<String> command = new ArrayList<String>();
+ // command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ // command.add("-cp");
+ // command.add(System.getProperty("java.class.path"));
+ // command.add(ServerLauncherDUnitTest.class.getName().concat("$").concat(ServerLauncherForkingProcess.class.getSimpleName()));
+ //
+ // process = new ProcessBuilder(command).directory(temporaryFolder.getRoot()).start();
+ // assertNotNull(process);
+ // processOutReader = new ProcessStreamReader(process.getInputStream(), createListener("sysout", getUniqueName() + "#sysout")).start();
+ // processErrReader = new ProcessStreamReader(process.getErrorStream(), createListener("syserr", getUniqueName() + "#syserr")).start();
+
+ @SuppressWarnings("unused")
+ File file = new File(this.temporaryFolder.getRoot(), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
+ //-logger.info("log file is " + file);
+
+ final ProcessWrapper pw = new ProcessWrapper.Builder().mainClass(ServerLauncherForkingProcess.class).build();
+ pw.execute(null, this.temporaryFolder.getRoot()).waitFor(true);
+ //logger.info("[testRunningServerOutlivesForkingProcess] ServerLauncherForkingProcess output is:\n\n"+pw.getOutput());
+
+ // // create waiting thread since waitFor does not have a timeout
+ // Thread waiting = new Thread(new Runnable() {
+ // @Override
+ // public void run() {
+ // try {
-// assertEquals(0, process.waitFor());
++// assertIndexDetailsEquals(0, process.waitFor());
+ // } catch (InterruptedException e) {
+ // logger.error("Interrupted while waiting for process", e);
+ // }
+ // }
+ // });
+
+ // // start waiting thread and join to it for timeout
+ // try {
+ // waiting.start();
+ // waiting.join(TIMEOUT_MILLISECONDS);
+ // assertFalse("ServerLauncherForkingProcess took too long and caused timeout", waiting.isAlive());
+ //
+ // } catch (Throwable e) {
+ // logger.error(e);
+ // if (failure == null) {
+ // failure = e;
+ // }
+ // } finally {
+ // if (waiting.isAlive()) {
+ // waiting.interrupt();
+ // }
+ // }
+
+ // wait for server to start
+ int pid = 0;
+ final String serverName = ServerLauncherForkingProcess.class.getSimpleName()+"_server";
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart(dirLauncher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = serverName+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // validate the status
+ final ServerState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(getJvmArguments(), actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + serverName + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(serverName, actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // check the status
+ final ServerState serverState = this.launcher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.ONLINE, serverState.getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate stale control files were deleted
+ waitForFileToDelete(this.stopRequestFile);
+ waitForFileToDelete(this.statusRequestFile);
+ waitForFileToDelete(this.statusFile);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-721: random ports (setup overriding default port), TemporaryFolder
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertFalse(pid == Integer.MAX_VALUE);
+
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47778.
+ */
+ @Test
+ public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // verify server did not a port
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
+ // make serverPort in use
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // verify port is still in use
+ this.errorCollector.checkThat(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET), is(equalTo(false)));
+ }
+
+ @Category(FlakyTest.class) // GEODE-764: random ports, BindException, forks JVM, uses ErrorCollector
+ @Test
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ final int otherPid = getPid();
+ assertTrue("Pid " + otherPid + " should be alive", ProcessUtils.isProcessAlive(otherPid));
+ writePid(this.pidFile, otherPid);
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+ command.add("--force");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertTrue(pid != otherPid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47665.
+ */
+ @Test
+ public void testStartUsingServerPortInUseFails() throws Throwable {
+ // make serverPort in use
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--server-port=" + this.serverPort);
+
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start and fail
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = this.process.waitFor();
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final ServerState serverState = dirLauncher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT is too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
+ // generate two free ports
+ final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer().setPort(freeTCPPorts[0]);
+
+ File cacheXmlFile = new File(this.temporaryFolder.getRoot(), getUniqueName()+".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ // launch server and specify a different port
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath());
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--server-port=" + freeTCPPorts[1]);
+
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start up
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // verify server used --server-port instead of default or port in cache.xml
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
+ assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
+
+ ServerState status = this.launcher.status();
+ String portString = status.getPort();
+ int port = Integer.valueOf(portString);
+ assertEquals("Port should be " + freeTCPPorts[1] + " instead of " + port, freeTCPPorts[1], port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer();
+
+ File cacheXmlFile = new File(this.temporaryFolder.getRoot(), getUniqueName()+".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ // launch server and specify a different port
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-Dgemfire."+DistributionConfig.CACHE_XML_FILE_NAME+"="+cacheXmlFile.getCanonicalPath());
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+ command.add("--server-port=" + this.serverPort);
+
+ final String expectedString = "java.net.BindException";
+ final AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start up
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // verify server used --server-port instead of default or port in cache.xml
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ int port = Integer.valueOf(portString);
+ assertEquals("Port should be " + this.serverPort + " instead of " + port, this.serverPort, port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Category(FlakyTest.class) // GEODE-1135: random ports, BindException, fork JVM
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ String expectedString = "java.net.BindException";
+ AtomicBoolean outputContainedExpectedString = new AtomicBoolean();
+
+ // make serverPort in use
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // launch server
+ final List<String> jvmArguments = getJvmArguments();
+ jvmArguments.add("-D" + AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY + "=" + this.serverPort);
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createExpectedListener("sysout", getUniqueName() + "#sysout", expectedString, outputContainedExpectedString)).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createExpectedListener("syserr", getUniqueName() + "#syserr", expectedString, outputContainedExpectedString)).build().start();
+
+ // wait for server to start up
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ int code = this.process.waitFor();
+ assertEquals("Expected exit code 1 but was " + code, 1, code);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // check the status
+ final ServerState serverState = dirLauncher.status();
+ assertNotNull(serverState);
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // if the following fails, then the SHORTER_TIMEOUT might be too short for slow machines
+ // or this test needs to use MainLauncher in ProcessWrapper
+
+ // validate that output contained BindException
+ this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ this.temporaryFolder.getRoot() = new File(getUniqueName());
+ this.temporaryFolder.getRoot().mkdir();
+ assertTrue(this.temporaryFolder.getRoot().isDirectory() && this.temporaryFolder.getRoot().canWrite());
+
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the server
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart(dirLauncher, 10*1000, false);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ // check the status
+ final ServerState serverState = dirLauncher.status();
+ assertNotNull(serverState);
- assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
++ assertIndexDetailsEquals(Status.NOT_RESPONDING, serverState.getStatus());
+
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = dirLauncher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ @Category(FlakyTest.class) // GEODE-957: random ports, BindException, fork JVM
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ ServerLauncher pidLauncher = null;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final ServerState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ assertNotNull(this.launcher);
+ assertFalse(this.launcher.isRunning());
+
+ // validate the status
+ final ServerState actualStatus = this.launcher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath(), actualStatus.getWorkingDirectory());
+ assertEquals(jvmArguments, actualStatus.getJvmArguments());
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusWithEmptyPidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile + " already exists", this.pidFile.createNewFile());
+
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final ServerState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStatusWithNoPidFile() throws Exception {
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ ServerState serverState = dirLauncher.status();
+ assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+ }
+
+ @Test
+ public void testStatusWithStalePidFile() throws Exception {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ final int pid = 0;
+ assertFalse(ProcessUtils.isProcessAlive(pid));
+ writePid(this.pidFile, pid);
+
+ final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ .setWorkingDirectory(temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ final ServerState actualStatus = dirLauncher.status();
+ assertThat(actualStatus, is(notNullValue()));
+ assertThat(actualStatus.getStatus(), is(equalTo(Status.NOT_RESPONDING)));
+ assertThat(actualStatus.getPid(), is(nullValue()));
+ assertThat(actualStatus.getUptime().intValue(), is(equalTo(0)));
+ assertThat(actualStatus.getWorkingDirectory(), is(equalTo(this.temporaryFolder.getRoot().getCanonicalPath())));
+ assertThat(actualStatus.getClasspath(), is(nullValue()));
+ assertThat(actualStatus.getGemFireVersion(), is(equalTo(GemFireVersion.getGemFireVersion())));
+ assertThat(actualStatus.getJavaVersion(), is(nullValue()));
+ assertThat(actualStatus.getLogFile(), is(nullValue()));
+ assertThat(actualStatus.getHost(), is(nullValue()));
+ assertThat(actualStatus.getMemberName(), is(nullValue()));
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).inputListener(createLoggingListener("sysout", getUniqueName() + "#sysout")).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).inputListener(createLoggingListener("syserr", getUniqueName() + "#syserr")).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ ServerLauncher pidLauncher = null;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ // use launcher with pid
+ pidLauncher = new Builder()
+ .setPid(pid)
+ .build();
+
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // validate the status
+ final ServerState status = pidLauncher.status();
+ assertNotNull(status);
+ assertEquals(Status.ONLINE, status.getStatus());
+ assertEquals(pid, status.getPid().intValue());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ if (pidLauncher == null) {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ } else {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ }
+ waitForPidToStop(pid);
+ waitForFileToDelete(this.pidFile);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ final List<String> jvmArguments = getJvmArguments();
+
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(getUniqueName());
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ this.process = new ProcessBuilder(command).directory(this.temporaryFolder.getRoot()).start();
+ this.processOutReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream()).build().start();
+ this.processErrReader = new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream()).build().start();
+
+ // wait for server to start
+ int pid = 0;
+ this.launcher = new ServerLauncher.Builder()
+ .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())
+ .build();
+ try {
+ waitForServerToStart();
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // stop the server
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForPidToStop(pid);
+ assertFalse("PID file still exists!", this.pidFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Override
+ protected List<String> getJvmArguments() {
+ final List<String> jvmArguments = new ArrayList<String>();
+ jvmArguments.add("-Dgemfire.log-level=config");
+ jvmArguments.add("-Dgemfire.mcast-port=0");
+ return jvmArguments;
+ }
+
+ /**
+ * Used only by {@link ServerLauncherRemoteIntegrationTest#testRunningServerOutlivesForkingProcess}
+ */
+ public static class ServerLauncherForkingProcess {
+
+ public static void main(final String... args) throws IOException, PidUnavailableException {
+ //-System.out.println("inside main");
+ File file = new File(System.getProperty("user.dir"), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
+ file.createNewFile();
+ LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
+ //LogWriter logWriter = new PureLogWriter(LogWriterImpl.ALL_LEVEL);
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main PID is " + getPid());
+
+ try {
+ // launch ServerLauncher
+ final List<String> jvmArguments = null;//getJvmArguments();
+ assertTrue(jvmArguments.size() == 2);
+ final List<String> command = new ArrayList<String>();
+ command.add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
+ for (String jvmArgument : jvmArguments) {
+ command.add(jvmArgument);
+ }
+ command.add("-cp");
+ command.add(System.getProperty("java.class.path"));
+ command.add(ServerLauncher.class.getName());
+ command.add(ServerLauncher.Command.START.getName());
+ command.add(ServerLauncherForkingProcess.class.getSimpleName()+"_server");
+ command.add("--disable-default-server");
+ command.add("--redirect-output");
+
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main starting...");
+
+ //-System.out.println("launching " + command);
+
+ @SuppressWarnings("unused")
+ Process forkedProcess = new ProcessBuilder(command).start();
+
+ // processOutReader = new ProcessStreamReader(forkedProcess.getInputStream()).start();
+ // processErrReader = new ProcessStreamReader(forkedProcess.getErrorStream()).start();
+
+ // logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main waiting for Server to start...");
+ //
+ // File workingDir = new File(System.getProperty("user.dir"));
+ // System.out.println("waiting for server to start in " + workingDir);
+ // final ServerLauncher dirLauncher = new ServerLauncher.Builder()
+ // .setWorkingDirectory(workingDir.getCanonicalPath())
+ // .build();
+ // waitForServerToStart(dirLauncher, true);
+
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
+
+ //-System.out.println("exiting");
+ System.exit(0);
+ }
+ catch (Throwable t) {
+ logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main error: " + t, t);
+ System.exit(-1);
+ }
+ }
+ }
+ }
[20/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index 3a06c1c..fd6d6c8 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -1505,11 +1505,22 @@ public class LocatorDUnitTest extends DistributedTestCase {
host0 + "[" + port3 + "]";
dsProps.setProperty("locators", newLocators);
+<<<<<<< Updated upstream
final InternalDistributedMember currentCoordinator = GMSJoinLeaveTestHelper.getCurrentCoordinator();
DistributedMember vm3ID = vm3.invoke(() -> GMSJoinLeaveTestHelper.getInternalDistributedSystem().getDM().getDistributionManagerId());
assertTrue("View is " + system.getDM().getMembershipManager().getView() +
" and vm3's ID is " + vm3ID,
vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
+||||||| merged common ancestors
+ assertTrue(vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
+ //Given the start up order of servers, this server is the elder server
+ assertTrue(vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
+=======
+ DistributedMember vm3ID = vm3.invoke(() -> GMSJoinLeaveTestHelper.getInternalDistributedSystem().getDM().getDistributionManagerId());
+ assertTrue("View is " + system.getDM().getMembershipManager().getView() +
+ " and vm3's ID is " + vm3ID,
+ vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
+>>>>>>> Stashed changes
startLocatorAsync(vm1, new Object[] { port2, dsProps });
startLocatorAsync(vm2, new Object[] { port3, dsProps });
@@ -1517,11 +1528,16 @@ public class LocatorDUnitTest extends DistributedTestCase {
waitCriterion = new WaitCriterion() {
public boolean done() {
try {
+<<<<<<< Updated upstream
InternalDistributedMember c = GMSJoinLeaveTestHelper.getCurrentCoordinator();
if (c.equals(currentCoordinator)) {
//now locator should be new coordinator
return false;
}
+||||||| merged common ancestors
+=======
+ System.out.println("waiting for hosted locators to have 2 entries: " + system.getDM().getAllHostedLocators());
+>>>>>>> Stashed changes
return system.getDM().getAllHostedLocators().size() == 2;
} catch (Exception e) {
e.printStackTrace();
@@ -1534,6 +1550,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return null;
}
};
+<<<<<<< Updated upstream
Wait.waitForCriterion(waitCriterion, 30 * 1000, 1000, true);
waitUntilLocatorBecomesCoordinator(vm1);
waitUntilLocatorBecomesCoordinator(vm2);
@@ -1545,6 +1562,23 @@ public class LocatorDUnitTest extends DistributedTestCase {
assertEquals(netviewId, (int) vm3.invoke("checking ViewID", () -> GMSJoinLeaveTestHelper.getViewId()));
assertEquals(netviewId, (int) vm4.invoke("checking ViewID", () -> GMSJoinLeaveTestHelper.getViewId()));
assertFalse(vm4.invoke("Checking ViewCreator", () -> GMSJoinLeaveTestHelper.isViewCreator()));
+||||||| merged common ancestors
+ Wait.waitForCriterion(waitCriterion, 15 * 1000, 200, true);
+
+ int netviewId = vm1.invoke(() -> GMSJoinLeaveTestHelper.getViewId());
+ assertEquals(netviewId, (int) vm2.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
+ assertEquals(netviewId, (int) vm3.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
+ assertEquals(netviewId, (int) vm4.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
+ assertFalse(vm4.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
+=======
+ Wait.waitForCriterion(waitCriterion, 30 * 1000, 1000, true);
+
+ int netviewId = vm1.invoke(() -> GMSJoinLeaveTestHelper.getViewId());
+ assertEquals(netviewId, (int) vm2.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
+ assertEquals(netviewId, (int) vm3.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
+ assertEquals(netviewId, (int) vm4.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
+ assertFalse(vm4.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
+>>>>>>> Stashed changes
//Given the start up order of servers, this server is the elder server
assertFalse(vm3.invoke("Checking ViewCreator", () -> GMSJoinLeaveTestHelper.isViewCreator()));
if (vm1.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator())) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
old mode 100644
new mode 100755
index 05abe30..79f7ed6
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
@@ -90,10 +90,8 @@ public class BasicI18nJUnitTest extends TestCase {
private Set<String> getStringIdDefiningClasses() {
final Set<String> StringIdDefiningClasses = new LinkedHashSet<String>();
final String pkg = "com.gemstone.gemfire.internal.i18n.";
- StringIdDefiningClasses.add(pkg + "ParentLocalizedStrings");
+// StringIdDefiningClasses.add(pkg + "ParentLocalizedStrings");
StringIdDefiningClasses.add(pkg + "LocalizedStrings");
- // JGroupsStrings are no longer localizable
-// StringIdDefiningClasses.add(pkg + "JGroupsStrings");
StringIdDefiningClasses.add("com.gemstone.gemfire.management.internal.ManagementStrings");
return StringIdDefiningClasses;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
old mode 100644
new mode 100755
index 03746c1..f356bda
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
@@ -124,7 +124,7 @@ com/gemstone/gemfire/cache/client/SubscriptionNotEnabledException,true,-82124467
com/gemstone/gemfire/cache/client/internal/ContainsKeyOp$MODE,false
com/gemstone/gemfire/cache/client/internal/TXSynchronizationOp$CompletionType,false
com/gemstone/gemfire/cache/client/internal/pooling/ConnectionDestroyedException,true,-6918516787578041316
-com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException,true,1
+com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException,true,1
com/gemstone/gemfire/cache/execute/FunctionAdapter,false
com/gemstone/gemfire/cache/execute/FunctionException,true,4893171227542647452
com/gemstone/gemfire/cache/execute/FunctionInvocationTargetException,true,1,id:com/gemstone/gemfire/distributed/DistributedMember
[02/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
Posted by kl...@apache.org.
GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
I've removed useless threads and timing loop from the test. It will no longer
time out.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f788d698
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f788d698
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f788d698
Branch: refs/heads/feature/GEODE-1276
Commit: f788d698e877b15570052f89b9d0b5ab23023f81
Parents: 676b2a7
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Thu May 5 15:15:58 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Thu May 5 15:25:06 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 63 +++++++++++++++++++
.../execute/EmtpyRegionFunctionException.java | 63 -------------------
.../internal/LocatorLoadSnapshotJUnitTest.java | 65 +++-----------------
3 files changed, 73 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f788d698/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
new file mode 100644
index 0000000..a077779
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+
+/**
+ * Exception to indicate that Region is empty for data aware functions.
+ *
+ * @since 6.5
+ *
+ */
+public class EmptyRegionFunctionException extends FunctionException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmptyRegionFunctionException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * Exception message
+ */
+ public EmptyRegionFunctionException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * the error message
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmptyRegionFunctionException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f788d698/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
deleted file mode 100644
index 6aff9eb..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.execute;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-
-/**
- * Exception to indicate that Region is empty for data aware functions.
- *
- * @since 6.5
- *
- */
-public class EmtpyRegionFunctionException extends FunctionException {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param cause
- * a Throwable cause of this exception
- */
- public EmtpyRegionFunctionException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * Exception message
- */
- public EmtpyRegionFunctionException(String msg) {
- super(msg);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * the error message
- * @param cause
- * a Throwable cause of this exception
- */
- public EmtpyRegionFunctionException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f788d698/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
old mode 100644
new mode 100755
index 34ac767..d8a1290
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -257,21 +257,19 @@ public class LocatorLoadSnapshotJUnitTest {
assertEquals(Arrays.asList(new ServerLocation[] {} ), sn.getServersForQueue(null, excludeAll, 3));
}
-
+
/**
- * A basic test of concurrent functionality. Starts a number of
+ * A basic test of concurrent functionality. Simulate a number of
* threads making requests and expects the load to be balanced between
* three servers.
* @throws InterruptedException
*/
- @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
@Test
public void testConcurrentBalancing() throws InterruptedException {
int NUM_THREADS = 50;
final int NUM_REQUESTS = 10000;
int ALLOWED_THRESHOLD = 50; //We should never be off by more than
- //the number of concurrent threads.
-
+
final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
final ServerLocation l1 = new ServerLocation("localhost", 1);
final ServerLocation l2 = new ServerLocation("localhost", 2);
@@ -290,47 +288,18 @@ public class LocatorLoadSnapshotJUnitTest {
loadCounts.put(l2, new AtomicInteger(initialLoad2));
loadCounts.put(l3, new AtomicInteger(initialLoad3));
- Thread[] threads = new Thread[NUM_THREADS];
-// final Object lock = new Object();
for(int i =0; i < NUM_THREADS; i++) {
- threads[i] = new Thread("Thread-" + i) {
- public void run() {
- for(int ii = 0; ii < NUM_REQUESTS; ii++) {
- ServerLocation location;
-// synchronized(lock) {
- location = sn.getServerForConnection(null, Collections.EMPTY_SET);
-// }
- AtomicInteger count = (AtomicInteger) loadCounts.get(location);
- count.incrementAndGet();
- }
- }
- };
- }
-
- for(int i =0; i < NUM_THREADS; i++) {
- threads[i].start();
- }
-
- for(int i =0; i < NUM_THREADS; i++) {
- Thread t = threads[i];
- long ms = 30 * 1000;
- t.join(30 * 1000);
- if (t.isAlive()) {
- for(int j =0; j < NUM_THREADS; j++) {
- threads[j].interrupt();
- }
- fail("Thread did not terminate after " + ms + " ms: " + t);
+ for(int ii = 0; ii < NUM_REQUESTS; ii++) {
+ ServerLocation location;
+ location = sn.getServerForConnection(null, Collections.EMPTY_SET);
+ AtomicInteger count = (AtomicInteger) loadCounts.get(location);
+ count.incrementAndGet();
}
}
- double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
+ double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
NUM_REQUESTS * NUM_THREADS) / (double) loadCounts.size();
-// for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
-// Map.Entry entry = (Entry) itr.next();
-// ServerLocation location = (ServerLocation) entry.getKey();
-// AI count= (AI) entry.getValue();
-// }
-
+
for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Entry) itr.next();
ServerLocation location = (ServerLocation) entry.getKey();
@@ -368,18 +337,4 @@ public class LocatorLoadSnapshotJUnitTest {
assertFalse(sn.hasBalancedConnections("b"));
}
- public void _test2() { // delete this method?
- final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
- sn.addServer(new ServerLocation("hs20h.gemstone.com",28543), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20l.gemstone.com",22385), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20n.gemstone.com",23482), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20m.gemstone.com",23429), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20e.gemstone.com",20154), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20j.gemstone.com",24273), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20g.gemstone.com",27125), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20i.gemstone.com",25201), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20k.gemstone.com",23711), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20f.gemstone.com",21025), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- }
-
}
[24/37] incubator-geode git commit: Revert "GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing"
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index fd6d6c8..3a06c1c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -1505,22 +1505,11 @@ public class LocatorDUnitTest extends DistributedTestCase {
host0 + "[" + port3 + "]";
dsProps.setProperty("locators", newLocators);
-<<<<<<< Updated upstream
final InternalDistributedMember currentCoordinator = GMSJoinLeaveTestHelper.getCurrentCoordinator();
DistributedMember vm3ID = vm3.invoke(() -> GMSJoinLeaveTestHelper.getInternalDistributedSystem().getDM().getDistributionManagerId());
assertTrue("View is " + system.getDM().getMembershipManager().getView() +
" and vm3's ID is " + vm3ID,
vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
-||||||| merged common ancestors
- assertTrue(vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
- //Given the start up order of servers, this server is the elder server
- assertTrue(vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
-=======
- DistributedMember vm3ID = vm3.invoke(() -> GMSJoinLeaveTestHelper.getInternalDistributedSystem().getDM().getDistributionManagerId());
- assertTrue("View is " + system.getDM().getMembershipManager().getView() +
- " and vm3's ID is " + vm3ID,
- vm3.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
->>>>>>> Stashed changes
startLocatorAsync(vm1, new Object[] { port2, dsProps });
startLocatorAsync(vm2, new Object[] { port3, dsProps });
@@ -1528,16 +1517,11 @@ public class LocatorDUnitTest extends DistributedTestCase {
waitCriterion = new WaitCriterion() {
public boolean done() {
try {
-<<<<<<< Updated upstream
InternalDistributedMember c = GMSJoinLeaveTestHelper.getCurrentCoordinator();
if (c.equals(currentCoordinator)) {
//now locator should be new coordinator
return false;
}
-||||||| merged common ancestors
-=======
- System.out.println("waiting for hosted locators to have 2 entries: " + system.getDM().getAllHostedLocators());
->>>>>>> Stashed changes
return system.getDM().getAllHostedLocators().size() == 2;
} catch (Exception e) {
e.printStackTrace();
@@ -1550,7 +1534,6 @@ public class LocatorDUnitTest extends DistributedTestCase {
return null;
}
};
-<<<<<<< Updated upstream
Wait.waitForCriterion(waitCriterion, 30 * 1000, 1000, true);
waitUntilLocatorBecomesCoordinator(vm1);
waitUntilLocatorBecomesCoordinator(vm2);
@@ -1562,23 +1545,6 @@ public class LocatorDUnitTest extends DistributedTestCase {
assertEquals(netviewId, (int) vm3.invoke("checking ViewID", () -> GMSJoinLeaveTestHelper.getViewId()));
assertEquals(netviewId, (int) vm4.invoke("checking ViewID", () -> GMSJoinLeaveTestHelper.getViewId()));
assertFalse(vm4.invoke("Checking ViewCreator", () -> GMSJoinLeaveTestHelper.isViewCreator()));
-||||||| merged common ancestors
- Wait.waitForCriterion(waitCriterion, 15 * 1000, 200, true);
-
- int netviewId = vm1.invoke(() -> GMSJoinLeaveTestHelper.getViewId());
- assertEquals(netviewId, (int) vm2.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
- assertEquals(netviewId, (int) vm3.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
- assertEquals(netviewId, (int) vm4.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
- assertFalse(vm4.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
-=======
- Wait.waitForCriterion(waitCriterion, 30 * 1000, 1000, true);
-
- int netviewId = vm1.invoke(() -> GMSJoinLeaveTestHelper.getViewId());
- assertEquals(netviewId, (int) vm2.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
- assertEquals(netviewId, (int) vm3.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
- assertEquals(netviewId, (int) vm4.invoke(() -> GMSJoinLeaveTestHelper.getViewId()));
- assertFalse(vm4.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator()));
->>>>>>> Stashed changes
//Given the start up order of servers, this server is the elder server
assertFalse(vm3.invoke("Checking ViewCreator", () -> GMSJoinLeaveTestHelper.isViewCreator()));
if (vm1.invoke(() -> GMSJoinLeaveTestHelper.isViewCreator())) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
old mode 100755
new mode 100644
index 79f7ed6..05abe30
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/i18n/BasicI18nJUnitTest.java
@@ -90,8 +90,10 @@ public class BasicI18nJUnitTest extends TestCase {
private Set<String> getStringIdDefiningClasses() {
final Set<String> StringIdDefiningClasses = new LinkedHashSet<String>();
final String pkg = "com.gemstone.gemfire.internal.i18n.";
-// StringIdDefiningClasses.add(pkg + "ParentLocalizedStrings");
+ StringIdDefiningClasses.add(pkg + "ParentLocalizedStrings");
StringIdDefiningClasses.add(pkg + "LocalizedStrings");
+ // JGroupsStrings are no longer localizable
+// StringIdDefiningClasses.add(pkg + "JGroupsStrings");
StringIdDefiningClasses.add("com.gemstone.gemfire.management.internal.ManagementStrings");
return StringIdDefiningClasses;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a35cca36/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
old mode 100755
new mode 100644
index f356bda..03746c1
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
@@ -124,7 +124,7 @@ com/gemstone/gemfire/cache/client/SubscriptionNotEnabledException,true,-82124467
com/gemstone/gemfire/cache/client/internal/ContainsKeyOp$MODE,false
com/gemstone/gemfire/cache/client/internal/TXSynchronizationOp$CompletionType,false
com/gemstone/gemfire/cache/client/internal/pooling/ConnectionDestroyedException,true,-6918516787578041316
-com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException,true,1
+com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException,true,1
com/gemstone/gemfire/cache/execute/FunctionAdapter,false
com/gemstone/gemfire/cache/execute/FunctionException,true,4893171227542647452
com/gemstone/gemfire/cache/execute/FunctionInvocationTargetException,true,1,id:com/gemstone/gemfire/distributed/DistributedMember
[12/37] incubator-geode git commit: GEODE-1255: Add test coverage for
using a custom log4j2.xml with Geode
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
deleted file mode 100755
index 395a9e6..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
+++ /dev/null
@@ -1,903 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-import com.gemstone.gemfire.distributed.ServerLauncher.Command;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.support.DistributedSystemAdapter;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import edu.umd.cs.mtc.MultithreadedTestCase;
-import edu.umd.cs.mtc.TestFramework;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.concurrent.Synchroniser;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-/**
- * The ServerLauncherJUnitTest class is a test suite of unit tests testing the contract, functionality and invariants
- * of the ServerLauncher class.
- *
- * @see com.gemstone.gemfire.distributed.ServerLauncher
- * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
- * @see com.gemstone.gemfire.distributed.ServerLauncher.Command
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since 7.0
- */
-@SuppressWarnings({"deprecation", "unused"})
-@Category(UnitTest.class)
-public class ServerLauncherJUnitTest {
-
- private Mockery mockContext;
-
- @Rule
- public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Rule
- public final TestName testName = new TestName();
-
- @Before
- public void setup() {
- mockContext = new Mockery() {{
- setImposteriser(ClassImposteriser.INSTANCE);
- setThreadingPolicy(new Synchroniser());
- }};
- }
-
- @After
- public void tearDown() {
- mockContext.assertIsSatisfied();
- mockContext = null;
- }
-
- @Test
- public void testParseCommand() {
- Builder builder = new Builder();
-
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
-
- builder.parseCommand((String[]) null);
-
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
-
- builder.parseCommand(); // empty String array
-
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
-
- builder.parseCommand(Command.START.getName());
-
- assertEquals(Command.START, builder.getCommand());
-
- builder.parseCommand("Status");
-
- assertEquals(Command.STATUS, builder.getCommand());
-
- builder.parseCommand("sToP");
-
- assertEquals(Command.STOP, builder.getCommand());
-
- builder.parseCommand("--opt", "START", "-o", Command.STATUS.getName());
-
- assertEquals(Command.START, builder.getCommand());
-
- builder.setCommand(null);
- builder.parseCommand("badCommandName", "--start", "stat");
-
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
- }
-
- @Test
- public void testParseMemberName() {
- Builder builder = new Builder();
-
- assertNull(builder.getMemberName());
-
- builder.parseMemberName((String[]) null);
-
- assertNull(builder.getMemberName());
-
- builder.parseMemberName(); // empty String array
-
- assertNull(builder.getMemberName());
-
- builder.parseMemberName(Command.START.getName(), "--opt", "-o");
-
- assertNull(builder.getMemberName());
-
- builder.parseMemberName("memberOne");
-
- assertEquals("memberOne", builder.getMemberName());
- }
-
- @Test
- public void testSetAndGetCommand() {
- Builder builder = new Builder();
-
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
- assertSame(builder, builder.setCommand(Command.STATUS));
- assertEquals(Command.STATUS, builder.getCommand());
- assertSame(builder, builder.setCommand(null));
- assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
- }
-
- @Test
- public void testSetAndGetMemberName() {
- Builder builder = new Builder();
-
- assertNull(builder.getMemberName());
- assertSame(builder, builder.setMemberName("serverOne"));
- assertEquals("serverOne", builder.getMemberName());
- assertSame(builder, builder.setMemberName(null));
- assertNull(builder.getMemberName());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMemberNameToBlankString() {
- try {
- new Builder().setMemberName(" ");
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMemberNameToEmptyString() {
- try {
- new Builder().setMemberName("");
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetPid() {
- Builder builder = new Builder();
-
- assertNull(builder.getPid());
- assertSame(builder, builder.setPid(0));
- assertEquals(0, builder.getPid().intValue());
- assertSame(builder, builder.setPid(1));
- assertEquals(1, builder.getPid().intValue());
- assertSame(builder, builder.setPid(1024));
- assertEquals(1024, builder.getPid().intValue());
- assertSame(builder, builder.setPid(12345));
- assertEquals(12345, builder.getPid().intValue());
- assertSame(builder, builder.setPid(null));
- assertNull(builder.getPid());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetPidToInvalidValue() {
- try {
- new Builder().setPid(-1);
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_PID_ERROR_MESSAGE.toLocalizedString(), expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetServerBindAddress() throws Exception {
- Builder builder = new Builder();
-
- assertNull(builder.getServerBindAddress());
- assertSame(builder, builder.setServerBindAddress(null));
- assertNull(builder.getServerBindAddress());
- assertSame(builder, builder.setServerBindAddress(""));
- assertNull(builder.getServerBindAddress());
- assertSame(builder, builder.setServerBindAddress(" "));
- assertNull(builder.getServerBindAddress());
- assertSame(builder, builder.setServerBindAddress(InetAddress.getLocalHost().getCanonicalHostName()));
- assertEquals(InetAddress.getLocalHost(), builder.getServerBindAddress());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetServerBindAddressToUnknownHost() {
- try {
- new Builder().setServerBindAddress("badHostName.badCompany.com");
- }
- catch (IllegalArgumentException expected) {
- final String expectedMessage1 = LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString("Server");
- final String expectedMessage2 = "badHostName.badCompany.com is not an address for this machine.";
- assertTrue(expected.getMessage().equals(expectedMessage1) || expected.getMessage().equals(expectedMessage2));
- if (expected.getMessage().equals(expectedMessage1)) {
- assertTrue(expected.getCause() instanceof UnknownHostException);
- }
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetServerBindAddressToNonLocalHost() {
- try {
- new Builder().setServerBindAddress("yahoo.com");
- }
- catch (IllegalArgumentException expected) {
- final String expectedMessage = "yahoo.com is not an address for this machine.";
- assertEquals(expectedMessage, expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetServerBindAddressToLocalHost() throws Exception {
- String host = InetAddress.getLocalHost().getHostName();
- new Builder().setServerBindAddress(host);
- }
-
- @Test
- public void testSetAndGetHostnameForClients() {
- final Builder builder = new Builder();
-
- assertNull(builder.getHostNameForClients());
- assertSame(builder, builder.setHostNameForClients("Pegasus"));
- assertEquals("Pegasus", builder.getHostNameForClients());
- assertSame(builder, builder.setHostNameForClients(null));
- assertNull(builder.getHostNameForClients());
- }
-
- @Test
- public void testSetAndGetServerPort() {
- Builder builder = new Builder();
-
- assertEquals(ServerLauncher.DEFAULT_SERVER_PORT, builder.getServerPort());
- assertSame(builder, builder.setServerPort(0));
- assertEquals(0, builder.getServerPort().intValue());
- assertSame(builder, builder.setServerPort(1));
- assertEquals(1, builder.getServerPort().intValue());
- assertSame(builder, builder.setServerPort(80));
- assertEquals(80, builder.getServerPort().intValue());
- assertSame(builder, builder.setServerPort(1024));
- assertEquals(1024, builder.getServerPort().intValue());
- assertSame(builder, builder.setServerPort(65535));
- assertEquals(65535, builder.getServerPort().intValue());
- assertSame(builder, builder.setServerPort(null));
- assertEquals(ServerLauncher.DEFAULT_SERVER_PORT, builder.getServerPort());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetServerPortToOverflow() {
- try {
- new Builder().setServerPort(65536);
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Server"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetServerPortToUnderflow() {
- try {
- new Builder().setServerPort(-1);
- }
- catch (IllegalArgumentException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_INVALID_PORT_ERROR_MESSAGE.toLocalizedString("Server"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetCriticalHeapPercentage() {
- Builder builder = new Builder();
-
- assertNull(builder.getCriticalHeapPercentage());
- assertSame(builder, builder.setCriticalHeapPercentage(55.5f));
- assertEquals(55.5f, builder.getCriticalHeapPercentage().floatValue(), 0.0f);
- assertSame(builder, builder.setCriticalHeapPercentage(null));
- assertNull(builder.getCriticalHeapPercentage());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetCriticalHeapPercentageToOverflow() {
- try {
- new Builder().setCriticalHeapPercentage(100.01f);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Critical heap percentage (100.01) must be between 0 and 100!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetCriticalHeapPercentageToUnderflow() {
- try {
- new Builder().setCriticalHeapPercentage(-0.01f);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Critical heap percentage (-0.01) must be between 0 and 100!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetEvictionHeapPercentage() {
- Builder builder = new Builder();
-
- assertNull(builder.getEvictionHeapPercentage());
- assertSame(builder, builder.setEvictionHeapPercentage(55.55f));
- assertEquals(55.55f, builder.getEvictionHeapPercentage().floatValue(), 0.0f);
- assertSame(builder, builder.setEvictionHeapPercentage(null));
- assertNull(builder.getEvictionHeapPercentage());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetEvictionHeapPercentageToOverflow() {
- try {
- new Builder().setEvictionHeapPercentage(101.0f);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Eviction heap percentage (101.0) must be between 0 and 100!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetEvictionHeapPercentageToUnderflow() {
- try {
- new Builder().setEvictionHeapPercentage(-10.0f);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Eviction heap percentage (-10.0) must be between 0 and 100!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetMaxConnections() {
- Builder builder = new Builder();
-
- assertNull(builder.getMaxConnections());
- assertSame(builder, builder.setMaxConnections(1000));
- assertEquals(1000, builder.getMaxConnections().intValue());
- assertSame(builder, builder.setMaxConnections(null));
- assertNull(builder.getMaxConnections());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMaxConnectionsWithIllegalValue() {
- try {
- new Builder().setMaxConnections(-10);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Max Connections (-10) must be greater than 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetMaxMessageCount() {
- Builder builder = new Builder();
-
- assertNull(builder.getMaxMessageCount());
- assertSame(builder, builder.setMaxMessageCount(50));
- assertEquals(50, builder.getMaxMessageCount().intValue());
- assertSame(builder, builder.setMaxMessageCount(null));
- assertNull(builder.getMaxMessageCount());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMaxMessageCountWithIllegalValue() {
- try {
- new Builder().setMaxMessageCount(0);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Max Message Count (0) must be greater than 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetMaxThreads() {
- Builder builder = new Builder();
-
- assertNull(builder.getMaxThreads());
- assertSame(builder, builder.setMaxThreads(16));
- assertEquals(16, builder.getMaxThreads().intValue());
- assertSame(builder, builder.setMaxThreads(null));
- assertNull(builder.getMaxThreads());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMaxThreadsWithIllegalValue() {
- try {
- new Builder().setMaxThreads(-4);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Max Threads (-4) must be greater than 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetMessageTimeToLive() {
- Builder builder = new Builder();
-
- assertNull(builder.getMessageTimeToLive());
- assertSame(builder, builder.setMessageTimeToLive(30000));
- assertEquals(30000, builder.getMessageTimeToLive().intValue());
- assertSame(builder, builder.setMessageTimeToLive(null));
- assertNull(builder.getMessageTimeToLive());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetMessageTimeToLiveWithIllegalValue() {
- try {
- new Builder().setMessageTimeToLive(0);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("Message Time To Live (0) must be greater than 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testSetAndGetSocketBufferSize() {
- Builder builder = new Builder();
-
- assertNull(builder.getSocketBufferSize());
- assertSame(builder, builder.setSocketBufferSize(32768));
- assertEquals(32768, builder.getSocketBufferSize().intValue());
- assertSame(builder, builder.setSocketBufferSize(null));
- assertNull(builder.getSocketBufferSize());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSetSocketBufferSizeWithIllegalValue() {
- try {
- new Builder().setSocketBufferSize(-8192);
- }
- catch (IllegalArgumentException expected) {
- assertEquals("The Server's Socket Buffer Size (-8192) must be greater than 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
- ServerLauncher launcher = new Builder()
- .setCommand(ServerLauncher.Command.START)
- .setMemberName(null)
- .set(DistributionConfig.NAME_NAME, "serverABC")
- .build();
-
- assertNotNull(launcher);
- assertEquals(ServerLauncher.Command.START, launcher.getCommand());
- assertNull(launcher.getMemberName());
- assertEquals("serverABC", launcher.getProperties().getProperty(DistributionConfig.NAME_NAME));
- }
-
- @Test
- public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
- System.setProperty(DistributionConfig.GEMFIRE_PREFIX + DistributionConfig.NAME_NAME, "serverXYZ");
-
- ServerLauncher launcher = new Builder()
- .setCommand(ServerLauncher.Command.START)
- .setMemberName(null)
- .build();
-
- assertNotNull(launcher);
- assertEquals(ServerLauncher.Command.START, launcher.getCommand());
- assertNull(launcher.getMemberName());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testBuildNoMemberNameOnStart() {
- try {
- new Builder().setCommand(Command.START).build();
- }
- catch (IllegalStateException expected) {
- assertEquals(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Server"),
- expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testIsServing() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.singletonList(mockCacheServer)));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertTrue(serverLauncher.isServing(mockCache));
- }
-
- @Test
- public void testIsServingWhenNoCacheServersExist() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertFalse(serverLauncher.isServing(mockCache));
- }
-
- @Test
- public void reconnectedCacheIsDiscovered() throws Exception {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final Cache mockReconnectedCache = mockContext.mock(Cache.class, "ReconnectedCache");
-
- mockContext.checking(new Expectations() {{
- exactly(2).of(mockCache).isReconnecting();
- will(returnValue(Boolean.FALSE));
-
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
-
- oneOf(mockCache).isReconnecting();
- will(returnValue(Boolean.TRUE));
-
- oneOf(mockCache).getReconnectedCache();
- will(returnValue(mockReconnectedCache));
-
- oneOf(mockReconnectedCache).close();
-
- }});
-
- final ServerLauncher serverLauncher =
- new Builder()
- .setMemberName("serverOne")
- .setCache(mockCache)
- .build();
-
- assertNotNull(serverLauncher);
- serverLauncher.waitOnServer();
- }
-
- @Test
- public void reconnectingDistributedSystemIsDisconnectedOnStop() throws Exception {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
- final Cache mockReconnectedCache = mockContext.mock(Cache.class, "ReconnectedCache");
-
- mockContext.checking(new Expectations() {{
- exactly(1).of(mockCache).isReconnecting();
- will(returnValue(Boolean.TRUE));
-
- exactly(1).of(mockCache).getReconnectedCache();
- will(returnValue(mockReconnectedCache));
-
- exactly(2).of(mockReconnectedCache).isReconnecting();
- will(returnValue(Boolean.TRUE));
-
- exactly(1).of(mockReconnectedCache).getReconnectedCache();
- will(returnValue(null));
-
- oneOf(mockReconnectedCache).getDistributedSystem();
- will(returnValue(mockDistributedSystem));
-
- oneOf(mockDistributedSystem).stopReconnecting();
-
- oneOf(mockReconnectedCache).close();
- }});
-
- final ServerLauncher serverLauncher =
- new Builder()
- .setMemberName("serverOne")
- .setCache(mockCache)
- .build();
-
- assertNotNull(serverLauncher);
- serverLauncher.setIsRunningForTest();
- serverLauncher.stop();
- }
-
- @Test
- public void testIsWaiting() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getDistributedSystem();
- will(returnValue(mockDistributedSystem));
- oneOf(mockDistributedSystem).isConnected();
- will(returnValue(true));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
-
- serverLauncher.running.set(true);
-
- assertTrue(serverLauncher.isRunning());
- assertTrue(serverLauncher.isWaiting(mockCache));
- }
-
- @Test
- public void testIsWaitingWhenNotConnected() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getDistributedSystem();
- will(returnValue(mockDistributedSystem));
- oneOf(mockDistributedSystem).isConnected();
- will(returnValue(false));
- oneOf(mockCache).isReconnecting();
- will(returnValue(Boolean.FALSE));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
-
- serverLauncher.running.set(true);
-
- assertTrue(serverLauncher.isRunning());
- assertFalse(serverLauncher.isWaiting(mockCache));
- }
-
- @Test
- public void testIsWaitingWhenNotRunning() {
- ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
-
- serverLauncher.running.set(false);
-
- assertFalse(serverLauncher.isRunning());
- assertFalse(serverLauncher.isWaiting(null));
- }
-
- @Test
- public void testWaitOnServer() throws Throwable {
- TestFramework.runOnce(new ServerWaitMultiThreadedTestCase());
- }
-
- @Test
- public void testIsDefaultServerEnabled() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
- }});
-
- ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertFalse(serverLauncher.isDisableDefaultServer());
- assertTrue(serverLauncher.isDefaultServerEnabled(mockCache));
- }
-
- @Test
- public void testIsDefaultServerEnabledWhenCacheServersExist() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.singletonList(mockCacheServer)));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertFalse(serverLauncher.isDisableDefaultServer());
- assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
- }
- @Test
- public void testIsDefaultServerEnabledWhenNoCacheServersExistAndDefaultServerDisabled() {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertTrue(serverLauncher.isDisableDefaultServer());
- assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
- }
-
- @Test
- public void testStartCacheServer() throws IOException {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
- oneOf(mockCache).addCacheServer();
- will(returnValue(mockCacheServer));
- oneOf(mockCacheServer).setBindAddress(with(aNull(String.class)));
- oneOf(mockCacheServer).setPort(with(equal(11235)));
- oneOf(mockCacheServer).start();
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne")
- .setServerBindAddress(null)
- .setServerPort(11235)
- .setDisableDefaultServer(false)
- .build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertFalse(serverLauncher.isDisableDefaultServer());
-
- serverLauncher.startCacheServer(mockCache);
- }
-
- @Test
- public void testStartCacheServerWhenDefaultServerDisabled() throws IOException {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertTrue(serverLauncher.isDisableDefaultServer());
-
- serverLauncher.startCacheServer(mockCache);
- }
-
- @Test
- public void testStartCacheServerWithExistingCacheServer() throws IOException {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
- final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
-
- mockContext.checking(new Expectations() {{
- oneOf(mockCache).getCacheServers();
- will(returnValue(Collections.singletonList(mockCacheServer)));
- }});
-
- final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
-
- assertNotNull(serverLauncher);
- assertEquals("serverOne", serverLauncher.getMemberName());
- assertFalse(serverLauncher.isDisableDefaultServer());
-
- serverLauncher.startCacheServer(mockCache);
- }
-
- public static void main(final String... args) {
- System.err.printf("Thread (%1$s) is daemon (%2$s)%n", Thread.currentThread().getName(),
- Thread.currentThread().isDaemon());
- new Builder(args).setCommand(Command.START).build().run();
- }
-
- private final class ServerWaitMultiThreadedTestCase extends MultithreadedTestCase {
-
- private final AtomicBoolean connectionStateHolder = new AtomicBoolean(true);
-
- private ServerLauncher serverLauncher;
-
- @Override
- public void initialize() {
- super.initialize();
-
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
- final DistributedSystem mockDistributedSystem = new DistributedSystemAdapter() {
- @Override public boolean isConnected() {
- return connectionStateHolder.get();
- }
- };
-
- mockContext.checking(new Expectations() {{
- allowing(mockCache).getDistributedSystem();
- will(returnValue(mockDistributedSystem));
- allowing(mockCache).isReconnecting();
- will(returnValue(Boolean.FALSE));
- allowing(mockCache).getCacheServers();
- will(returnValue(Collections.emptyList()));
- oneOf(mockCache).close();
- }});
-
- this.serverLauncher = new Builder().setMemberName("dataMember").setDisableDefaultServer(true)
- .setCache(mockCache).build();
-
- assertNotNull(this.serverLauncher);
- assertEquals("dataMember", this.serverLauncher.getMemberName());
- assertTrue(this.serverLauncher.isDisableDefaultServer());
- assertTrue(connectionStateHolder.get());
- }
-
- public void thread1() {
- assertTick(0);
-
- Thread.currentThread().setName("GemFire Data Member 'main' Thread");
- this.serverLauncher.running.set(true);
-
- assertTrue(this.serverLauncher.isRunning());
- assertFalse(this.serverLauncher.isServing(this.serverLauncher.getCache()));
- assertTrue(this.serverLauncher.isWaiting(this.serverLauncher.getCache()));
-
- this.serverLauncher.waitOnServer();
-
- assertTick(1); // NOTE the tick does not advance when the other Thread terminates
- }
-
- public void thread2() {
- waitForTick(1);
-
- Thread.currentThread().setName("GemFire 'shutdown' Thread");
-
- assertTrue(this.serverLauncher.isRunning());
-
- this.connectionStateHolder.set(false);
- }
-
- @Override
- public void finish() {
- super.finish();
- assertFalse(this.serverLauncher.isRunning());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileIntegrationTest.java
new file mode 100755
index 0000000..5a457a7
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileIntegrationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Subclass of ServerLauncherLocalDUnitTest which forces the code to not find
+ * the Attach API which is in the JDK tools.jar. As a result ServerLauncher
+ * ends up using the FileProcessController implementation.
+ *
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherLocalFileIntegrationTest extends ServerLauncherLocalIntegrationTest {
+
+ @Before
+ public final void setUpServerLauncherLocalFileTest() throws Exception {
+ System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
+ }
+
+ @After
+ public final void tearDownServerLauncherLocalFileTest() throws Exception {
+ }
+
+ @Override
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertFalse(factory.isAttachAPIFound());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileJUnitTest.java
deleted file mode 100755
index bda05c4..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalFileJUnitTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * Subclass of ServerLauncherLocalDUnitTest which forces the code to not find
- * the Attach API which is in the JDK tools.jar. As a result ServerLauncher
- * ends up using the FileProcessController implementation.
- *
- * @since 8.0
- */
-@Category(IntegrationTest.class)
-public class ServerLauncherLocalFileJUnitTest extends ServerLauncherLocalJUnitTest {
-
- @Before
- public final void setUpServerLauncherLocalFileTest() throws Exception {
- System.setProperty(ProcessControllerFactory.PROPERTY_DISABLE_ATTACH_API, "true");
- }
-
- @After
- public final void tearDownServerLauncherLocalFileTest() throws Exception {
- }
-
- @Override
- @Test
- public void testIsAttachAPIFound() throws Exception {
- final ProcessControllerFactory factory = new ProcessControllerFactory();
- assertFalse(factory.isAttachAPIFound());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
new file mode 100755
index 0000000..911bfab
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalIntegrationTest.java
@@ -0,0 +1,1073 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.lang.management.ManagementFactory;
+import java.net.BindException;
+import java.net.InetAddress;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.internal.process.ProcessControllerFactory;
+import com.gemstone.gemfire.internal.process.ProcessType;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for ServerLauncher as a local API in the local JVM.
+ *
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.Builder
+ * @see com.gemstone.gemfire.distributed.ServerLauncher.ServerState
+ * @see com.gemstone.gemfire.internal.AvailablePortHelper
+ * @since 8.0
+ */
+@Category(IntegrationTest.class)
+public class ServerLauncherLocalIntegrationTest extends AbstractServerLauncherIntegrationTestCase {
+
+ @Before
+ public final void setUpServerLauncherLocalTest() throws Exception {
+ disconnectFromDS();
+ System.setProperty(ProcessType.TEST_PREFIX_PROPERTY, getUniqueName()+"-");
+ }
+
+ @After
+ public final void tearDownServerLauncherLocalTest() throws Exception {
+ disconnectFromDS();
+ }
+
+ protected Status getExpectedStopStatusForNotRunning() {
+ return Status.NOT_RESPONDING;
+ }
+
+ @Test
+ public void testBuilderSetProperties() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ this.launcher = new Builder()
+ .setDisableDefaultServer(true)
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0")
+ .build();
+
+ assertNotNull(this.launcher);
+
+ try {
+ assertEquals(Status.ONLINE, this.launcher.start().getStatus());
+ waitForServerToStart(this.launcher);
+
+ final Cache cache = this.launcher.getCache();
+
+ assertNotNull(cache);
+
+ final DistributedSystem distributedSystem = cache.getDistributedSystem();
+
+ assertNotNull(distributedSystem);
+ assertEquals("true", distributedSystem.getProperties().getProperty(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME));
+ assertEquals("config", distributedSystem.getProperties().getProperty(DistributionConfig.LOG_LEVEL_NAME));
+ assertEquals("0", distributedSystem.getProperties().getProperty(DistributionConfig.MCAST_PORT_NAME));
+ assertEquals(getUniqueName(), distributedSystem.getProperties().getProperty(DistributionConfig.NAME_NAME));
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ assertNull(this.launcher.getCache());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testIsAttachAPIFound() throws Exception {
+ final ProcessControllerFactory factory = new ProcessControllerFactory();
+ assertTrue(factory.isAttachAPIFound());
+ }
+
+ @Test
+ public void testStartCreatesPidFile() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the Server locally
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+ assertNotNull(this.launcher);
+
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ assertEquals(Status.ONLINE, this.launcher.status().getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartDeletesStaleControlFiles() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // create existing control files
+ this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
+ this.stopRequestFile.createNewFile();
+ assertTrue(this.stopRequestFile.exists());
+
+ this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
+ this.statusRequestFile.createNewFile();
+ assertTrue(this.statusRequestFile.exists());
+
+ this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
+ this.statusFile.createNewFile();
+ assertTrue(this.statusFile.exists());
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForServerToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // validate stale control files were deleted
+ assertFalse(this.stopRequestFile.exists());
+ assertFalse(this.statusRequestFile.exists());
+ assertFalse(this.statusFile.exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartOverwritesStalePidFile() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // create existing pid file
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
+ writePid(this.pidFile, Integer.MAX_VALUE);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+ this.launcher.start();
+
+ try {
+ waitForServerToStart(this.launcher);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47778.
+ */
+ @Test
+ public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ // wait for server to start
+ try {
+ // if start succeeds without throwing exception then #47778 is fixed
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify server did not a port
+ assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms fix for #47778.
+ */
+ @Test
+ public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ // wait for server to start
+ try {
+ // if start succeeds without throwing exception then #47778 is fixed
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ assertEquals("Port should be \"\" instead of " + portString, "", portString);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // verify port is still in use
+ this.errorCollector.checkThat(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET), is(equalTo(false)));
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartUsingForceOverwritesExistingPidFile() throws Throwable {
+ }/*
+ assertTrue(getUniqueName() + " is broken if PID == Integer.MAX_VALUE", ProcessUtils.identifyPid() != Integer.MAX_VALUE);
+
+ // create existing pid file
+ this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse(realPid == ProcessUtils.identifyPid());
+ writePid(this.pidFile, realPid);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setForce(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertTrue(builder.getForce());
+ this.launcher = builder.build();
+ assertTrue(this.launcher.isForcing());
+ this.launcher.start();
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+
+ try {
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // validate log file was created
+ final String logFileName = getUniqueName()+".log";
+ assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
+
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartUsingForceOverwritesExistingPidFile
+ */
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
+ // verifies part of the fix for #47664
+
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate two free ports
+ final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
+
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer().setPort(freeTCPPorts[0]);
+
+ File cacheXmlFile = this.temporaryFolder.newFile(getUniqueName() + ".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ System.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlFile.getCanonicalPath());
+
+ // start server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setServerPort(freeTCPPorts[1])
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+ this.launcher.start();
+
+ // wait for server to start up
+ try {
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify server used --server-port instead of default or port in cache.xml
+ assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
+ assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
+
+ final ServerState status = this.launcher.status();
+ final String portString = status.getPort();
+ final int port = Integer.valueOf(portString);
+ assertEquals("Port should be " + freeTCPPorts[1] + " instead of " + port, freeTCPPorts[1], port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ assertFalse("PID file still exists!", pidFile.exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ /**
+ * Confirms part of fix for #47664
+ */
+ @Test
+ public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // write out cache.xml with one port
+ final CacheCreation creation = new CacheCreation();
+ final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
+ attrs.setScope(Scope.DISTRIBUTED_ACK);
+ attrs.setDataPolicy(DataPolicy.REPLICATE);
+ creation.createRegion(getUniqueName(), attrs);
+ creation.addCacheServer();
+
+ File cacheXmlFile = this.temporaryFolder.newFile(getUniqueName() + ".xml");
+ final PrintWriter pw = new PrintWriter(new FileWriter(cacheXmlFile), true);
+ CacheXmlGenerator.generate(creation, pw);
+ pw.close();
+
+ System.setProperty(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlFile.getCanonicalPath());
+
+ // start server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setServerPort(this.serverPort)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+ this.launcher.start();
+
+ // wait for server to start up
+ try {
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertTrue(ProcessUtils.isProcessAlive(pid));
+ assertEquals(getPid(), pid);
+
+ // verify server used --server-port instead of default
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ final int port = Integer.valueOf( this.launcher.status().getPort());
+ assertEquals("Port should be " + this.serverPort + " instead of " + port, this.serverPort, port);
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // stop the server
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStartWithDefaultPortInUseFails() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+
+ // why did it not fail like it's supposed to?
+ final String property = System.getProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY);
+ assertNotNull(property);
+ assertEquals(this.serverPort, Integer.valueOf(property).intValue());
+ assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
+
+ fail("Server port is " + this.launcher.getCache().getCacheServers().get(0).getPort());
+ fail("ServerLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException text varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+
+ // creation of log file seems to be random -- look into why sometime
+ final String logFileName = getUniqueName()+".log";
+ assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ @Ignore("Need to rewrite this without using dunit.Host")
+ public void testStartWithExistingPidFileFails() throws Throwable {
+ }/*
+ // create existing pid file
+ final int realPid = Host.getHost(0).getVM(3).invoke(() -> ProcessUtils.identifyPid());
+ assertFalse("Remote pid shouldn't be the same as local pid " + realPid, realPid == ProcessUtils.identifyPid());
+
+ this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+ writePid(this.pidFile, realPid);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ // collect and throw the FIRST failure
+ Throwable failure = null;
+ RuntimeException expected = null;
+
+ try {
+ this.launcher.start();
+ fail("ServerLauncher start should have thrown RuntimeException caused by FileAlreadyExistsException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ assertTrue(expected.getMessage().contains("A PID file already exists and a Server may be running in"));
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof FileAlreadyExistsException);
+ assertTrue(cause.getMessage().contains("Pid file already exists: "));
+ assertTrue(cause.getMessage().contains("vf.gf.server.pid for process " + realPid));
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ try {
+ delete(this.pidFile);
+ final Status theStatus = status.getStatus();
+ assertFalse(theStatus == Status.STARTING);
+ assertFalse(theStatus == Status.ONLINE);
+ } catch (Throwable e) {
+ logger.error(e);
+ if (failure == null) {
+ failure = e;
+ }
+ }
+
+ if (failure != null) {
+ throw failure;
+ }
+ } // testStartWithExistingPidFileFails
+ */
+
+ /**
+ * Confirms fix for #47665.
+ */
+ @Test
+ public void testStartUsingServerPortInUseFails() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
+ final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+ this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setServerPort(freeTCPPort)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ this.launcher = builder.build();
+
+ RuntimeException expected = null;
+ try {
+ this.launcher.start();
+ fail("ServerLauncher start should have thrown RuntimeException caused by BindException");
+ } catch (RuntimeException e) {
+ expected = e;
+ assertNotNull(expected.getMessage());
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ assertNotNull(expected);
+ final Throwable cause = expected.getCause();
+ assertNotNull(cause);
+ assertTrue(cause instanceof BindException);
+ // BindException string varies by platform
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ // just in case the launcher started...
+ ServerState status = null;
+ try {
+ status = this.launcher.stop();
+ } catch (Throwable t) {
+ // ignore
+ }
+
+ try {
+ waitForFileToDelete(this.pidFile);
+ assertEquals(getExpectedStopStatusForNotRunning(), status.getStatus());
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStatusUsingPid() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher pidLauncher = null;
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ final ServerState actualStatus = pidLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (pidLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, pidLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStatusUsingWorkingDirectory() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ final ServerState actualStatus = dirLauncher.status();
+ assertNotNull(actualStatus);
+ assertEquals(Status.ONLINE, actualStatus.getStatus());
+ assertEquals(pid, actualStatus.getPid().intValue());
+ assertTrue(actualStatus.getUptime() > 0);
+ // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
+ assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
+ assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
+ assertEquals(System.getProperty("java.version"), actualStatus.getJavaVersion());
+ assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
+ assertEquals(getUniqueName(), actualStatus.getMemberName());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ if (dirLauncher == null) {
+ try {
+ assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ } else {
+ try {
+ assertEquals(Status.STOPPED, dirLauncher.stop().getStatus());
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+ }
+
+ @Test
+ public void testStopUsingPid() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher pidLauncher = null;
+
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ pidLauncher = new Builder().setPid(pid).build();
+ assertNotNull(pidLauncher);
+ assertFalse(pidLauncher.isRunning());
+
+ // stop the server
+ final ServerState serverState = pidLauncher.stop();
+ assertNotNull(serverState);
+ assertEquals(Status.STOPPED, serverState.getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+
+ @Test
+ public void testStopUsingWorkingDirectory() throws Throwable {
+ String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
+ // build and start the server
+ final Builder builder = new Builder()
+ .setDisableDefaultServer(true)
+ .setMemberName(getUniqueName())
+ .setRedirectOutput(true)
+ .setWorkingDirectory(rootFolder)
+ .set(DistributionConfig.LOG_LEVEL_NAME, "config")
+ .set(DistributionConfig.MCAST_PORT_NAME, "0");
+
+ assertFalse(builder.getForce());
+ this.launcher = builder.build();
+ assertFalse(this.launcher.isForcing());
+
+ ServerLauncher dirLauncher = null;
+ try {
+ this.launcher.start();
+ waitForServerToStart(this.launcher);
+
+ // validate the pid file and its contents
+ this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
+ assertTrue(this.pidFile.exists());
+ final int pid = readPid(this.pidFile);
+ assertTrue(pid > 0);
+ assertEquals(ProcessUtils.identifyPid(), pid);
+
+ dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
+ assertNotNull(dirLauncher);
+ assertFalse(dirLauncher.isRunning());
+
+ // stop the server
+ final ServerState serverState = dirLauncher.stop();
+ assertNotNull(serverState);
+ assertEquals(Status.STOPPED, serverState.getStatus());
+
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+
+ try {
+ this.launcher.stop();
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ try {
+ // verify the PID file was deleted
+ waitForFileToDelete(this.pidFile);
+ } catch (Throwable e) {
+ this.errorCollector.addError(e);
+ }
+ }
+}
[23/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
Posted by kl...@apache.org.
GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
I've removed useless threads and timing loop from the test. It will no longer
time out.
GEODE-1346 Typo "Emtpy" affects Exception name and some help strings
This also removes all unreferenced strings from LocalizedStrings and
removes the no-longer-needed ParentLocalizedStrings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3d73bf5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3d73bf5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3d73bf5c
Branch: refs/heads/feature/GEODE-1276
Commit: 3d73bf5ca7e9e1d682710706d2dd3a51c2c59c4d
Parents: f74d04b
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Thu May 5 15:15:58 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Thu May 5 16:04:47 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 6 +-
.../membership/InternalDistributedMember.java | 40 +
.../internal/membership/gms/GMSMember.java | 16 +
.../internal/cache/PartitionedRegion.java | 6 +-
.../gemfire/internal/i18n/LocalizedStrings.java | 2456 +++++++++++++++---
.../internal/i18n/ParentLocalizedStrings.java | 2399 -----------------
.../gemfire/distributed/LocatorDUnitTest.java | 34 +
.../internal/i18n/BasicI18nJUnitTest.java | 4 +-
.../codeAnalysis/sanctionedSerializables.txt | 2 +-
9 files changed, 2143 insertions(+), 2820 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
old mode 100644
new mode 100755
index a077779..c5a4a7a
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
@@ -29,7 +29,7 @@ public class EmptyRegionFunctionException extends FunctionException {
private static final long serialVersionUID = 1L;
/**
- * Construct an instance of EmtpyRegionFunctionException
+ * Construct an instance of EmptyRegionFunctionException
*
* @param cause
* a Throwable cause of this exception
@@ -39,7 +39,7 @@ public class EmptyRegionFunctionException extends FunctionException {
}
/**
- * Construct an instance of EmtpyRegionFunctionException
+ * Construct an instance of EmptyRegionFunctionException
*
* @param msg
* Exception message
@@ -49,7 +49,7 @@ public class EmptyRegionFunctionException extends FunctionException {
}
/**
- * Construct an instance of EmtpyRegionFunctionException
+ * Construct an instance of EmptyRegionFunctionException
*
* @param msg
* the error message
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
index f7572af..2ccbd89 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
@@ -863,9 +863,19 @@ public class InternalDistributedMember
DataSerializer.writeString(this.hostName, out);
int flags = 0;
+<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
if (this.isPartial) flags |= PARTIAL_ID_BIT;
+||||||| merged common ancestors
+ if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ if (this.isPartial) flags |= PARTIAL_ID_MASK;
+=======
+ if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ if (this.isPartial) flags |= PARTIAL_ID_MASK;
+>>>>>>> Stashed changes
// always write product version but enable reading from older versions
// that do not have it
flags |= VERSION_BIT;
@@ -955,9 +965,19 @@ public class InternalDistributedMember
DataSerializer.writeString(this.hostName, out);
int flags = 0;
+<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
if (this.isPartial) flags |= PARTIAL_ID_BIT;
+||||||| merged common ancestors
+ if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ if (this.isPartial) flags |= PARTIAL_ID_MASK;
+=======
+ if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ if (this.isPartial) flags |= PARTIAL_ID_MASK;
+>>>>>>> Stashed changes
// always write product version but enable reading from older versions
// that do not have it
flags |= VERSION_BIT;
@@ -997,9 +1017,19 @@ public class InternalDistributedMember
DataSerializer.writeString(this.hostName, out);
int flags = 0;
+<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
if (this.isPartial) flags |= PARTIAL_ID_BIT;
+||||||| merged common ancestors
+ if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ if (this.isPartial) flags |= PARTIAL_ID_MASK;
+=======
+ if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ if (this.isPartial) flags |= PARTIAL_ID_MASK;
+>>>>>>> Stashed changes
out.writeByte((byte)(flags & 0xff));
out.writeInt(dcPort);
@@ -1170,9 +1200,19 @@ public class InternalDistributedMember
out.writeInt(getPort());
int flags = 0;
+<<<<<<< Updated upstream
if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= NPD_ENABLED_BIT;
if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_BIT;
flags |= PARTIAL_ID_BIT;
+||||||| merged common ancestors
+ if (netMbr.splitBrainEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ flags |= PARTIAL_ID_MASK;
+=======
+ if (netMbr.isNetworkPartitionDetectionEnabled()) flags |= SB_ENABLED_MASK;
+ if (netMbr.preferredForCoordinator()) flags |= COORD_ENABLED_MASK;
+ flags |= PARTIAL_ID_MASK;
+>>>>>>> Stashed changes
out.writeByte((byte)(flags & 0xff));
// out.writeInt(dcPort);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
index 6089eb8..8af5e0d 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
@@ -399,8 +399,16 @@ public class GMSMember implements NetMember, DataSerializableFixedID {
Version.writeOrdinal(out, this.versionOrdinal, true);
int flags = 0;
+<<<<<<< Updated upstream
if (networkPartitionDetectionEnabled) flags |= NPD_ENABLED_BIT;
if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD_BIT;
+||||||| merged common ancestors
+ if (splitBrainEnabled) flags |= SB_ENABLED;
+ if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD;
+=======
+ if (networkPartitionDetectionEnabled) flags |= SB_ENABLED;
+ if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD;
+>>>>>>> Stashed changes
out.writeShort(flags);
DataSerializer.writeInetAddress(inetAddr, out);
@@ -421,8 +429,16 @@ public class GMSMember implements NetMember, DataSerializableFixedID {
this.versionOrdinal = Version.readOrdinal(in);
int flags = in.readShort();
+<<<<<<< Updated upstream
this.networkPartitionDetectionEnabled = (flags & NPD_ENABLED_BIT) != 0;
this.preferredForCoordinator = (flags & PREFERRED_FOR_COORD_BIT) != 0;
+||||||| merged common ancestors
+ this.splitBrainEnabled = (flags & SB_ENABLED) != 0;
+ this.preferredForCoordinator = (flags & PREFERRED_FOR_COORD) != 0;
+=======
+ this.networkPartitionDetectionEnabled = (flags & SB_ENABLED) != 0;
+ this.preferredForCoordinator = (flags & PREFERRED_FOR_COORD) != 0;
+>>>>>>> Stashed changes
this.inetAddr = DataSerializer.readInetAddress(in);
this.udpPort = in.readInt();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d73bf5c/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
index 328c196..4460a8a 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java
@@ -92,7 +92,7 @@ import com.gemstone.gemfire.cache.TransactionDataNotColocatedException;
import com.gemstone.gemfire.cache.TransactionDataRebalancedException;
import com.gemstone.gemfire.cache.TransactionException;
import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import com.gemstone.gemfire.cache.execute.EmtpyRegionFunctionException;
+import com.gemstone.gemfire.cache.execute.EmptyRegionFunctionException;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.execute.FunctionContext;
import com.gemstone.gemfire.cache.execute.FunctionException;
@@ -3879,7 +3879,7 @@ public class PartitionedRegion extends LocalRegion implements
logger.debug("Executing on bucketset : {} executeOnBucketSet Member to buckets map is : {} bucketSet is empty",
bucketSet, memberToBuckets);
}
- throw new EmtpyRegionFunctionException(
+ throw new EmptyRegionFunctionException(
LocalizedStrings.PartitionedRegion_FUNCTION_NOT_EXECUTED_AS_REGION_IS_EMPTY
.toLocalizedString());
}
@@ -4023,7 +4023,7 @@ public class PartitionedRegion extends LocalRegion implements
.groupByMemberToBuckets(this, bucketSet, function.optimizeForWrite());
if (memberToBuckets.isEmpty()) {
- throw new EmtpyRegionFunctionException(LocalizedStrings.PartitionedRegion_FUNCTION_NOT_EXECUTED_AS_REGION_IS_EMPTY.toLocalizedString()
+ throw new EmptyRegionFunctionException(LocalizedStrings.PartitionedRegion_FUNCTION_NOT_EXECUTED_AS_REGION_IS_EMPTY.toLocalizedString()
);
}