You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2016/09/13 21:13:15 UTC
incubator-geode git commit: GEODE-762: change default setting for
enable-network-partition-detection
Repository: incubator-geode
Updated Branches:
refs/heads/develop 0705e85cd -> 3897a76ea
GEODE-762: change default setting for enable-network-partition-detection
This setting now defaults to being turned on. Some unit tests that perform
HA operations have been modified to disable it.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3897a76e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3897a76e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3897a76e
Branch: refs/heads/develop
Commit: 3897a76eae648f1f89debf0bd41f883686581766
Parents: 0705e85
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Tue Sep 13 14:10:38 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Tue Sep 13 14:12:59 2016 -0700
----------------------------------------------------------------------
.../web/controllers/RestAPITestBase.java | 2 +-
.../distributed/ConfigurationProperties.java | 2 +-
.../internal/DistributionConfig.java | 2 +-
.../internal/membership/NetView.java | 8 ++---
.../gms/messenger/JGroupsMessenger.java | 5 ---
.../cache/wan/GatewaySenderEventImpl.java | 2 +-
.../com/gemstone/gemfire/LonerDMJUnitTest.java | 3 ++
.../cache30/ClientMembershipDUnitTest.java | 24 +++++++------
.../PRBucketSynchronizationDUnitTest.java | 38 +++++++++++---------
.../cache30/RRSynchronizationDUnitTest.java | 36 ++++++++++++-------
.../RegionMembershipListenerDUnitTest.java | 13 ++++---
.../gemfire/cache30/TXDistributedDUnitTest.java | 1 +
.../internal/cache/Bug41733DUnitTest.java | 13 ++++---
.../cache/ConcurrentMapOpsDUnitTest.java | 10 ++++--
.../cache/partitioned/Bug39356DUnitTest.java | 13 +++++--
...ersalMembershipListenerAdapterDUnitTest.java | 18 +++++++---
.../security/AbstractSecureServerDUnitTest.java | 12 +++++++
.../internal/JUnit4DistributedTestCase.java | 2 +-
.../test/dunit/standalone/ProcessManager.java | 23 ++++++++----
.../cq/dunit/CqStatsUsingPoolDUnitTest.java | 10 +++++-
...StatsUsingPoolOptimizedExecuteDUnitTest.java | 9 +----
.../cli/commands/ClientCommandsDUnitTest.java | 1 +
22 files changed, 161 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
index de48cf9..57b92be 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
@@ -201,7 +201,7 @@ class RestAPITestBase extends JUnit4DistributedTestCase {
System.out.println("Response : " + httpResponseString);
//verify function execution result
JSONArray resultArray = new JSONArray(httpResponseString);
- assertEquals(resultArray.length(), expectedServerResponses);
+ assertEquals(expectedServerResponses, resultArray.length());
} catch (Exception e) {
//fail("exception", e);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
index fa0862f..c919a64 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
@@ -415,7 +415,7 @@ public interface ConfigurationProperties {
* <U>Description</U>: Turns on network partitioning detection algorithms, which
* detect loss of quorum and shuts down losing partitions.
* </p>
- * <U>Default</U>: "false"
+ * <U>Default</U>: "true"
*/
String ENABLE_NETWORK_PARTITION_DETECTION = "enable-network-partition-detection";
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
index 27f2884..e137273 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
@@ -1590,7 +1590,7 @@ public interface DistributionConfig extends Config, LogConfig {
*/
@ConfigAttribute(type = Boolean.class)
String ENABLE_NETWORK_PARTITION_DETECTION_NAME = ENABLE_NETWORK_PARTITION_DETECTION;
- boolean DEFAULT_ENABLE_NETWORK_PARTITION_DETECTION = false;
+ boolean DEFAULT_ENABLE_NETWORK_PARTITION_DETECTION = true;
/**
* Get the value of the
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
old mode 100755
new mode 100644
index 7d9a84c..470d5e0
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
@@ -39,7 +39,6 @@ import com.gemstone.gemfire.internal.Version;
*
* @since GemFire 5.5
*/
-@SuppressWarnings("SynchronizeOnNonFinalField")
public class NetView implements DataSerializableFixedID {
private int viewId;
@@ -51,6 +50,7 @@ public class NetView implements DataSerializableFixedID {
private Set<InternalDistributedMember> crashedMembers;
private InternalDistributedMember creator;
private Set<InternalDistributedMember> hashedMembers;
+ private final Object membersLock = new Object();
static public final Random RANDOM = new Random();
@@ -286,7 +286,7 @@ public class NetView implements DataSerializableFixedID {
}
public InternalDistributedMember getCoordinator() {
- synchronized (members) {
+ synchronized (membersLock) {
for (InternalDistributedMember addr : members) {
if (addr.getNetMember().preferredForCoordinator()) {
return addr;
@@ -307,7 +307,7 @@ public class NetView implements DataSerializableFixedID {
if (rejections == null) {
return getCoordinator();
}
- synchronized (members) {
+ synchronized (membersLock) {
for (InternalDistributedMember addr : members) {
if (addr.getNetMember().preferredForCoordinator() && !rejections.contains(addr)) {
return addr;
@@ -337,7 +337,7 @@ public class NetView implements DataSerializableFixedID {
List<InternalDistributedMember> results = new ArrayList<>();
List<InternalDistributedMember> notPreferredCoordinatorList = new ArrayList<>();
- synchronized (members) {
+ synchronized (membersLock) {
for (InternalDistributedMember addr : members) {
if (addr.equals(localAddress)) {
continue;// this is must to add
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
index f999c94..898d712 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
@@ -166,11 +166,6 @@ public class JGroupsMessenger implements Messenger {
boolean b = dc.getEnableNetworkPartitionDetection();
- if (b) {
- if (!SocketCreator.FORCE_DNS_USE) {
- SocketCreator.resolve_dns = false;
- }
- }
System.setProperty("jgroups.resolve_dns", String.valueOf(!b));
InputStream is;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
index 83811ec..fa1d7b9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
@@ -751,7 +751,7 @@ public class GatewaySenderEventImpl implements
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
short version = in.readShort();
if (version != VERSION) {
- // warning?
+ // warning?`
}
this.isInitialized = true;
this.action = in.readInt();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/LonerDMJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/LonerDMJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/LonerDMJUnitTest.java
index 9b721d8..96f2ddf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/LonerDMJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/LonerDMJUnitTest.java
@@ -60,6 +60,7 @@ public class LonerDMJUnitTest {
cfg.setProperty(MCAST_PORT, "0");
cfg.setProperty(LOCATORS, "");
cfg.setProperty(STATISTIC_SAMPLING_ENABLED, "false");
+ cfg.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
for (int i=0; i < 2; i++) {
start = System.currentTimeMillis();
@@ -114,6 +115,7 @@ public class LonerDMJUnitTest {
cfg.setProperty(LOCATORS, "");
cfg.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
cfg.setProperty(STATISTIC_ARCHIVE_FILE, "lonerStats.gfs");
+ cfg.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
for (int i=0; i < 1; i++) {
start = System.currentTimeMillis();
@@ -167,6 +169,7 @@ public class LonerDMJUnitTest {
cfg.setProperty(LOCATORS, "");
cfg.setProperty(ROLES, "lonelyOne");
cfg.setProperty(NAME, name);
+ cfg.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
DistributedSystem ds = DistributedSystem.connect(cfg);
System.out.println("MemberId = " + ds.getMemberId());
assertEquals(host.toString(), ds.getDistributedMember().getHost());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
old mode 100755
new mode 100644
index 39ae008..9bcc2a4
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
@@ -16,6 +16,7 @@
*/
package com.gemstone.gemfire.cache30;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
import java.io.IOException;
@@ -47,9 +48,7 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.distributed.DurableClientAttributes;
+import com.gemstone.gemfire.distributed.*;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.cache.tier.InternalClientMembership;
import com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl;
@@ -68,9 +67,6 @@ import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-
/**
* Tests the ClientMembership API including ClientMembershipListener.
*
@@ -744,6 +740,7 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
*/
@Test
public void testClientMembershipEventsInClient() throws Exception {
+ properties = null;
getSystem();
IgnoredException.addIgnoredException("IOException");
final boolean[] fired = new boolean[3];
@@ -850,6 +847,7 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
Properties config = new Properties();
config.setProperty(MCAST_PORT, "0");
config.setProperty(LOCATORS, "");
+ config.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
getSystem(config);
try {
@@ -1053,6 +1051,7 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
Properties config = new Properties();
config.setProperty(MCAST_PORT, "0");
config.setProperty(LOCATORS, "");
+ config.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
properties = config;
DistributedSystem s = getSystem(config);
AttributesFactory factory = new AttributesFactory();
@@ -1472,6 +1471,7 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
public Properties getDistributedSystemProperties() {
if (properties == null) {
properties = new Properties();
+ properties.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
}
return properties;
}
@@ -1553,10 +1553,14 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
Map clients = InternalClientMembership.getConnectedClients(true);
assertNotNull(clients);
testGetNotifiedClients_clientCount = clients.size();
- if (testGetNotifiedClients_clientCount > 0) {
- // assert that the clientMemberId matches
- assertEquals(clientMemberId, clients.keySet().iterator().next());
- }
+ // [bruce] this is not a valid assertion - the server may not use
+ // fully qualified host names while clients always use them in
+ // forming their member ID. The test needs to check InetAddresses,
+ // not strings
+// if (testGetNotifiedClients_clientCount > 0) {
+// // assert that the clientMemberId matches
+// assertEquals(clientMemberId, clients.keySet().iterator().next());
+// }
});
clientCounts[whichVM] = vm.invoke("getTestGetNotifiedClients_clientCount",
() -> ClientMembershipDUnitTest.getTestGetNotifiedClients_clientCount());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
index 8fb4487..1e1e75f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
@@ -15,19 +15,19 @@
* limitations under the License.
*/
package com.gemstone.gemfire.cache30;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
-import java.util.HashSet;
-import java.util.Set;
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.distributed.*;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+
+import java.util.*;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.DataPolicy;
@@ -35,7 +35,6 @@ import com.gemstone.gemfire.cache.EvictionAction;
import com.gemstone.gemfire.cache.EvictionAttributes;
import com.gemstone.gemfire.cache.Operation;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
@@ -63,7 +62,7 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
*
*
*/
-@Category(DistributedTest.class)
+@Category(DistributedTest.class)
public class PRBucketSynchronizationDUnitTest extends JUnit4CacheTestCase {
static enum TestType {
IN_MEMORY,
@@ -76,18 +75,25 @@ public class PRBucketSynchronizationDUnitTest extends JUnit4CacheTestCase {
public PRBucketSynchronizationDUnitTest() {
super();
}
+
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
- @Test
+ @Test
public void testThatBucketSyncOnPrimaryLoss() {
doBucketsSyncOnPrimaryLoss(TestType.IN_MEMORY);
}
- @Test
+ @Test
public void testThatBucketsSyncOnPrimaryLossWithPersistence() {
doBucketsSyncOnPrimaryLoss(TestType.PERSISTENT);
}
- @Test
+ @Test
public void testThatBucketsSyncOnPrimaryLossWithOverflow() {
doBucketsSyncOnPrimaryLoss(TestType.OVERFLOW);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
index a46bbab..93c2edb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
@@ -15,15 +15,18 @@
* limitations under the License.
*/
package com.gemstone.gemfire.cache30;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import com.gemstone.gemfire.distributed.*;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.cache.*;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
@@ -38,7 +41,7 @@ import com.gemstone.gemfire.test.dunit.*;
*
*
*/
-@Category(DistributedTest.class)
+@Category(DistributedTest.class)
public class RRSynchronizationDUnitTest extends JUnit4CacheTestCase {
static enum TestType {
IN_MEMORY,
@@ -52,17 +55,24 @@ public class RRSynchronizationDUnitTest extends JUnit4CacheTestCase {
super();
}
- @Test
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
+
+ @Test
public void testThatRegionsSyncOnPeerLoss() {
doRegionsSyncOnPeerLoss(TestType.IN_MEMORY);
}
- @Test
+ @Test
public void testThatRegionsSyncOnPeerLossWithPersistence() {
doRegionsSyncOnPeerLoss(TestType.PERSISTENT);
}
- @Test
+ @Test
public void testThatRegionsSyncOnPeerLossWithOverflow() {
doRegionsSyncOnPeerLoss(TestType.OVERFLOW);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
index 156577a..f86d722 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
@@ -21,13 +21,12 @@ import org.junit.Test;
import static org.junit.Assert.*;
+import com.gemstone.gemfire.distributed.*;
import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
@@ -39,7 +38,6 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.RegionEvent;
import com.gemstone.gemfire.cache.RegionMembershipListener;
import com.gemstone.gemfire.cache.util.RegionMembershipListenerAdapter;
-import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
@@ -79,6 +77,13 @@ public class RegionMembershipListenerDUnitTest extends JUnit4CacheTestCase {
public final void postTearDownCacheTestCase() throws Exception {
DistributedRegion.TEST_HOOK_ADD_PROFILE = false;
}
+
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties props = super.getDistributedSystemProperties();
+ props.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return props;
+ }
protected VM getOtherVm() {
Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
index 0eee516..c498172 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
@@ -529,6 +529,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
public Properties getDistributedSystemProperties() {
Properties p = super.getDistributedSystemProperties();
p.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+ p.put(ENABLE_NETWORK_PARTITION_DETECTION, "false");
return p;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java
index d768b59..332953a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java
@@ -18,9 +18,7 @@ package com.gemstone.gemfire.internal.cache;
import static org.junit.Assert.*;
-import java.util.Collections;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -30,7 +28,7 @@ import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
+import com.gemstone.gemfire.distributed.*;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
@@ -56,6 +54,13 @@ public class Bug41733DUnitTest extends JUnit4CacheTestCase {
disconnectAllFromDS();
}
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
+
/**
* Test the we can handle a member departing after creating
* a bucket on the remote node but before we choose a primary
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
index 74283e7..e2ee004 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
@@ -23,8 +23,7 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Ignore;
@@ -73,6 +72,13 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
enum OP {PUTIFABSENT, REPLACE, REMOVE}
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
+
private void createRegions(VM vm) {
vm.invoke(new SerializableCallable() {
public Object call() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
index 90b8ecc..d9581dc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
@@ -19,8 +19,7 @@ package com.gemstone.gemfire.internal.cache.partitioned;
import static org.junit.Assert.*;
import java.io.Serializable;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -33,6 +32,7 @@ import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.PartitionAttributes;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.distributed.*;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
@@ -53,7 +53,14 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
public class Bug39356DUnitTest extends JUnit4CacheTestCase {
protected static final String REGION_NAME = "myregion";
-
+
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
+
/**
* This tests the case where the VM forcing other
* VMs to create a bucket crashes while creating the bucket.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
index 2936d52..1c3d7b4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
@@ -39,9 +39,8 @@ import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.ServerConnectivityException;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache30.ClientServerTestCase;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.DurableClientAttributes;
-import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.distributed.*;
+import com.gemstone.gemfire.internal.*;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.tier.InternalClientMembership;
import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
@@ -95,7 +94,14 @@ public class UniversalMembershipListenerAdapterDUnitTest extends ClientServerTes
public final void postTearDownCacheTestCase() throws Exception {
InternalClientMembership.unregisterAllListeners();
}
-
+
+ @Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
+
/**
* Tests wrapping of BridgeMembershipEvent fired as MembershipEvent.
*/
@@ -429,6 +435,7 @@ public class UniversalMembershipListenerAdapterDUnitTest extends ClientServerTes
Properties config = new Properties();
config.setProperty(MCAST_PORT, "0");
config.setProperty(LOCATORS, "");
+ config.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -1840,6 +1847,7 @@ public class UniversalMembershipListenerAdapterDUnitTest extends ClientServerTes
Properties config = new Properties();
config.setProperty(MCAST_PORT, "0");
config.setProperty(LOCATORS, "");
+// config.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
getSystem(config);
getLogWriter().info("[testServerEventsInLonerClient] create system bridge client");
@@ -1881,7 +1889,7 @@ public class UniversalMembershipListenerAdapterDUnitTest extends ClientServerTes
// gather details for later creation of pool...
assertEquals(ports[0],
- (int) vm0.invoke(() -> UniversalMembershipListenerAdapterDUnitTest.getTestServerEventsInLonerClient_port()));
+ (int) vm0.invoke("getServerPort", () -> UniversalMembershipListenerAdapterDUnitTest.getTestServerEventsInLonerClient_port()));
getLogWriter().info("[testServerEventsInLonerClient] ports[0]=" + ports[0]);
getLogWriter().info("[testServerEventsInLonerClient] serverMemberId=" + serverMemberId);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractSecureServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractSecureServerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractSecureServerDUnitTest.java
index e054206..fd38814 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractSecureServerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractSecureServerDUnitTest.java
@@ -36,6 +36,7 @@ import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.distributed.*;
import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.Invoke;
@@ -57,6 +58,7 @@ public class AbstractSecureServerDUnitTest extends JUnit4CacheTestCase {
protected int jmxPort = 0;
protected int restPort = 0;
protected Map<String, Object> values;
+ protected volatile Properties dsProperties;
public AbstractSecureServerDUnitTest(){
values = new HashMap();
@@ -96,6 +98,10 @@ public class AbstractSecureServerDUnitTest extends JUnit4CacheTestCase {
props.setProperty(HTTP_SERVICE_PORT, restPort+"");
}
+ props.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+
+ this.dsProperties = props;
+
getSystem(props);
CacheFactory cf = new CacheFactory();
@@ -117,6 +123,11 @@ public class AbstractSecureServerDUnitTest extends JUnit4CacheTestCase {
}
@Override
+ public Properties getDistributedSystemProperties() {
+ return dsProperties;
+ }
+
+ @Override
public void preTearDownCacheTestCase() throws Exception {
Invoke.invokeInEveryVM(()->closeCache());
closeCache();
@@ -130,6 +141,7 @@ public class AbstractSecureServerDUnitTest extends JUnit4CacheTestCase {
Properties props = new Properties();
props.setProperty(UserPasswordAuthInit.USER_NAME, userName);
props.setProperty(UserPasswordAuthInit.PASSWORD, password);
+ props.setProperty(LOG_LEVEL, "fine");
props.setProperty(LOCATORS, "");
props.setProperty(MCAST_PORT, "0");
props.setProperty(SECURITY_CLIENT_AUTH_INIT, UserPasswordAuthInit.class.getName() + ".create");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
old mode 100755
new mode 100644
index 4020491..6b1a833
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
@@ -287,7 +287,7 @@ public abstract class JUnit4DistributedTestCase implements DistributedTestFixtur
public static final void disconnectAllFromDS() {
disconnectFromDS();
- Invoke.invokeInEveryVM(()->disconnectFromDS());
+ Invoke.invokeInEveryVM("disconnectFromDS", ()->disconnectFromDS());
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
index a630afa..c8e8e7d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
@@ -16,12 +16,14 @@
*/
package com.gemstone.gemfire.test.dunit.standalone;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.internal.FileUtil;
-import org.apache.commons.io.FileUtils;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.rmi.AccessException;
@@ -33,7 +35,11 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import org.apache.commons.io.FileUtils;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.internal.FileUtil;
/**
*
@@ -168,6 +174,11 @@ public class ProcessManager {
cmds.add("-D" + DUnitLauncher.WORKSPACE_DIR_PARAM + "=" + new File(".").getAbsolutePath());
if (vmNum >= 0) { // let the locator print a banner
cmds.add("-D" + InternalLocator.INHIBIT_DM_BANNER + "=true");
+ } else {
+ // most distributed unit tests were written under the assumption that network partition
+ // detection is disabled, so we turn it off in the locator. Tests for network partition
+ // detection should create a separate locator that has it enabled
+ cmds.add("-D"+DistributionConfig.GEMFIRE_PREFIX+ENABLE_NETWORK_PARTITION_DETECTION+"=false");
}
cmds.add("-D"+LOG_LEVEL+"=" + DUnitLauncher.logLevel);
if (DUnitLauncher.LOG4J != null) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
index ddec1ba..aa46a29 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
@@ -21,11 +21,12 @@ import org.junit.Test;
import static org.junit.Assert.*;
+import com.gemstone.gemfire.distributed.*;
import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Collection;
+import java.util.*;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.query.CqException;
@@ -66,6 +67,13 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
}
@Override
+ public Properties getDistributedSystemProperties() {
+ Properties result = super.getDistributedSystemProperties();
+ result.put(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ return result;
+ }
+
+ @Override
public final void postSetUp() throws Exception {
// avoid IllegalStateException from HandShake by connecting all vms to
// system before creating pool
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolOptimizedExecuteDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolOptimizedExecuteDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolOptimizedExecuteDUnitTest.java
index 4e84a4a..deb43b0 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolOptimizedExecuteDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqStatsUsingPoolOptimizedExecuteDUnitTest.java
@@ -17,18 +17,11 @@
package com.gemstone.gemfire.cache.query.cq.dunit;
import org.junit.experimental.categories.Category;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.query.internal.cq.CqService;
import com.gemstone.gemfire.cache.query.internal.cq.CqServiceImpl;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Test class for testing {@link CqServiceImpl#EXECUTE_QUERY_DURING_INIT} flag
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3897a76e/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
index 4ff4a16..0f94d1a 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
@@ -795,6 +795,7 @@ public class ClientCommandsDUnitTest extends CliCommandTestBase {
protected Properties getServerProperties() {
Properties p = new Properties();
p.setProperty(LOCATORS, "localhost[" + getDUnitLocatorPort() + "]");
+ p.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
return p;
}