GEODE-3139 remove artifacts from classpath of backward-compatibility tests

reinstating this - passes precheckin

GEODE-3153 Client receives duplicate events during rolling upgrade

Another problem was found in backward-compatibility testing.  If a
1.0.0 client was receiving subscription events generated by a 1.0.0
peer "feeder" member and the events were routed through a 1.0.0 server
the client might see duplicate events when the server is stopped and
the client fails over to a 1.2.0 server holding its redundant
subscription queue.  This is especially possible if a large "ack"
period is established in the client.

The problem stems from the EventID deserialization/reserialization of
the memberID bytes when sending to a 1.0 client.  It was deserializing
using Version.CURRENT, which ignores the UUID bytes in the serialized ID.
Then it serialized the identifier using the client's version, which
includes the UUID bytes but which are zero due to the version used
in deserialization.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/fb4e96bf
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/fb4e96bf
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/fb4e96bf

Branch: refs/heads/feature/GEODE-3109
Commit: fb4e96bfbad9e66966fd13cd35499bc7f3a020e4
Parents: 92f2708
Author: Bruce Schuchardt <bschucha...@pivotal.io>
Authored: Mon Jul 3 13:06:30 2017 -0700
Committer: Bruce Schuchardt <bschucha...@pivotal.io>
Committed: Mon Jul 3 13:08:44 2017 -0700

----------------------------------------------------------------------
 .../membership/gms/membership/GMSJoinLeave.java |   6 +-
 .../java/org/apache/geode/internal/Version.java |   2 +-
 .../apache/geode/internal/cache/EventID.java    |  29 +++-
 .../sockets/ClientServerMiscBCDUnitTest.java    | 151 +++++++++++++++++--
 .../tier/sockets/ClientServerMiscDUnitTest.java | 112 ++++++++++----
 .../test/dunit/standalone/ProcessManager.java   |  40 ++---
 .../sanctionedDataSerializables.txt             |   8 +-
 7 files changed, 275 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index 56e2662..9591673 100644
--- 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -126,6 +126,8 @@ public class GMSJoinLeave implements JoinLeave, 
MessageHandler {
    * membership logger
    */
   private static final Logger logger = Services.getLogger();
+  private static final boolean ALLOW_OLD_VERSION_FOR_TESTING = Boolean
+      .getBoolean(DistributionConfig.GEMFIRE_PREFIX + 
"allow_old_members_to_join_for_testing");
 
   /**
    * the view ID where I entered into membership
@@ -532,7 +534,8 @@ public class GMSJoinLeave implements JoinLeave, 
MessageHandler {
 
     logger.info("received join request from {}", 
incomingRequest.getMemberID());
 
-    if 
(incomingRequest.getMemberID().getVersionObject().compareTo(Version.CURRENT) < 
0) {
+    if (!ALLOW_OLD_VERSION_FOR_TESTING
+        && 
incomingRequest.getMemberID().getVersionObject().compareTo(Version.CURRENT) < 
0) {
       logger.warn("detected an attempt to start a peer using an older version 
of the product {}",
           incomingRequest.getMemberID());
       JoinResponseMessage m =
@@ -542,6 +545,7 @@ public class GMSJoinLeave implements JoinLeave, 
MessageHandler {
       services.getMessenger().send(m);
       return;
     }
+
     Object creds = incomingRequest.getCredentials();
     String rejection;
     try {

http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/main/java/org/apache/geode/internal/Version.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/Version.java 
b/geode-core/src/main/java/org/apache/geode/internal/Version.java
index 5576971..3064c4c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/Version.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/Version.java
@@ -175,7 +175,7 @@ public class Version implements Comparable<Version> {
 
   // 41-44 available for 8.2.x variants
 
-  private static final byte GFE_90_ORDINAL = 45;
+  private static final byte GFE_90_ORDINAL = 45; // this is also GEODE 
1.0.0-incubating
 
   public static final Version GFE_90 =
       new Version("GFE", "9.0", (byte) 9, (byte) 0, (byte) 0, (byte) 0, 
GFE_90_ORDINAL);

http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/main/java/org/apache/geode/internal/cache/EventID.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/EventID.java 
b/geode-core/src/main/java/org/apache/geode/internal/cache/EventID.java
index 55c89f1..8621649 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EventID.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EventID.java
@@ -39,6 +39,7 @@ import 
org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.internal.DataSerializableFixedID;
 import org.apache.geode.internal.HeapDataOutputStream;
 import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataInputStream;
 import org.apache.geode.internal.cache.ha.HARegionQueue;
 import org.apache.geode.internal.cache.ha.ThreadIdentifier;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
@@ -291,8 +292,23 @@ public class EventID implements DataSerializableFixedID, 
Serializable, Externali
    * @return the member that initiated this event
    */
   public InternalDistributedMember getDistributedMember() {
+    return getDistributedMember(Version.CURRENT);
+  }
+
+  /**
+   * deserialize the memberID bytes using the given version. The correct thing 
to do would be to
+   * have EventID carry the version ordinal of the serialized memberID, or to 
have it be part of the
+   * memberID bytes and use that version to deserialize the bytes
+   */
+  private InternalDistributedMember getDistributedMember(Version 
targetVersion) {
     ByteArrayInputStream bais = new ByteArrayInputStream(this.membershipID);
     DataInputStream dis = new DataInputStream(bais);
+    if (0 <= targetVersion.compareTo(Version.GFE_90)
+        && targetVersion.compareTo(Version.GEODE_110) < 0) {
+      // GEODE-3153: clients expect to receive UUID bytes, which are only
+      // read if the stream's version is 1.0.0-incubating
+      dis = new VersionedDataInputStream(dis, Version.GFE_90);
+    }
     InternalDistributedMember result = null;
     try {
       result = InternalDistributedMember.readEssentialData(dis);
@@ -324,8 +340,14 @@ public class EventID implements DataSerializableFixedID, 
Serializable, Externali
 
   public void toData(DataOutput dop) throws IOException {
     Version version = InternalDataSerializer.getVersionForDataStream(dop);
-    if (version.compareTo(Version.GFE_90) <= 0) {
-      InternalDistributedMember member = getDistributedMember();
+    // if we are sending to old clients we need to reserialize the ID
+    // using the client's version to ensure it gets the proper on-wire form
+    // of the identifier
+    // See GEODE-3072
+    if (version.compareTo(Version.GEODE_110) < 0) {
+      InternalDistributedMember member = getDistributedMember(version);
+      // reserialize with the client's version so that we write the UUID
+      // bytes
       HeapDataOutputStream hdos = new HeapDataOutputStream(version);
       member.writeEssentialData(hdos);
       DataSerializer.writeByteArray(hdos.toByteArray(), dop);
@@ -423,6 +445,9 @@ public class EventID implements DataSerializableFixedID, 
Serializable, Externali
    * GEODE-3072 - v1.0.0 memberIDs in EventIDs may have trailing bytes that 
should be ignored
    */
   static private boolean nullUUIDCheck(byte[] memberID, int position) {
+    if (position < 0) {
+      return false;
+    }
     if (memberID.length - position != NULL_90_MEMBER_DATA_LENGTH) {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscBCDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscBCDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscBCDUnitTest.java
index bc48d97..46896c4 100755
--- 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscBCDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscBCDUnitTest.java
@@ -18,9 +18,25 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.awaitility.Awaitility;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.client.Pool;
-import 
org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.cache.client.PoolManager;
+import org.apache.geode.cache.client.internal.PoolImpl;
+import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.cache.EventID;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.test.dunit.Host;
@@ -31,18 +47,6 @@ import 
org.apache.geode.test.junit.categories.BackwardCompatibilityTest;
 import org.apache.geode.test.junit.categories.ClientServerTest;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import 
org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
-import org.awaitility.Awaitility;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
 
 @Category({DistributedTest.class, ClientServerTest.class, 
BackwardCompatibilityTest.class})
 @RunWith(Parameterized.class)
@@ -98,6 +102,112 @@ public class ClientServerMiscBCDUnitTest extends 
ClientServerMiscDUnitTest {
   }
 
   @Test
+  public void testSubscriptionWithMixedServersAndNewPeerFeed() throws 
Exception {
+    
doTestSubscriptionWithMixedServersAndPeerFeed(VersionManager.CURRENT_VERSION, 
true);
+  }
+
+  @Test
+  public void testSubscriptionWithMixedServersAndOldPeerFeed() throws 
Exception {
+    doTestSubscriptionWithMixedServersAndPeerFeed(testVersion, true);
+  }
+
+  @Test
+  public void testSubscriptionWithMixedServersAndOldClientFeed() throws 
Exception {
+    doTestSubscriptionWithMixedServersAndPeerFeed(testVersion, false);
+  }
+
+  private void doTestSubscriptionWithMixedServersAndPeerFeed(String version,
+      boolean usePeerForFeed) {
+    server1 = Host.getHost(0).getVM(testVersion, 2);
+    server2 = Host.getHost(0).getVM(3);
+    VM server3 = Host.getHost(0).getVM(4);
+    VM interestClient = Host.getHost(0).getVM(testVersion, 0);
+    VM feeder = Host.getHost(0).getVM(version, 1);
+
+    // start servers first
+    int server1Port = initServerCache(true);
+
+    int server2Port = initServerCache2(true);
+
+    int server3Port = server3.invoke(() -> createServerCache(true, 
getMaxThreads(), false));
+
+    System.out.println("old server is vm 2 and new server is vm 3");
+    System.out
+        .println("old server port is " + server1Port + " and new server port 
is " + server2Port);
+
+    String hostname = NetworkUtils.getServerHostName(Host.getHost(0));
+    interestClient.invoke("create interestClient cache", () -> {
+      createClientCache(hostname, 300000, false, server1Port, server2Port, 
server3Port);
+      populateCache();
+      registerInterest();
+    });
+
+    if (!usePeerForFeed) {
+      feeder.invoke("create client cache for feed", () -> {
+        Pool ignore = createClientCache(hostname, server1Port);
+      });
+    }
+    feeder.invoke("putting data in feeder", () -> putForClient());
+
+    // interestClient will receive feeder's updates asynchronously
+    interestClient.invoke("verification 1", () -> {
+      Region r2 = getCache().getRegion(REGION_NAME2);
+      MemberIDVerifier verifier = (MemberIDVerifier) ((LocalRegion) 
r2).getCacheListener();
+      Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> 
verifier.eventReceived);
+      verifier.reset();
+    });
+
+    server1.invoke("shutdown old server", () -> {
+      getCache().getDistributedSystem().disconnect();
+    });
+
+    server2.invoke("wait for failover queue to drain", () -> {
+      CacheClientProxy proxy =
+          
CacheClientNotifier.getInstance().getClientProxies().iterator().next();
+      Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> {
+        proxy.getHARegionQueue().isEmpty();
+      });
+    });
+
+    // the client should now get duplicate events from the current-version 
server
+    interestClient.invoke("verification 2", () -> {
+      Cache cache = getCache();
+      Region r2 = cache.getRegion(REGION_NAME2);
+      MemberIDVerifier verifier = (MemberIDVerifier) ((LocalRegion) 
r2).getCacheListener();
+      assertFalse(verifier.eventReceived); // no duplicate events should have 
arrived
+      PoolImpl pool = (PoolImpl) 
PoolManager.find("ClientServerMiscDUnitTestPool");
+
+      Map seqMap = pool.getThreadIdToSequenceIdMap();
+      assertEquals(3, seqMap.size()); // one for each server and one for the 
feed
+      verifier.reset();
+    });
+
+    server2.invoke("shutdown new server", () -> {
+      getCache().getDistributedSystem().disconnect();
+    });
+
+    server3.invoke("wait for failover queue to drain", () -> {
+      CacheClientProxy proxy =
+          
CacheClientNotifier.getInstance().getClientProxies().iterator().next();
+      Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> {
+        proxy.getHARegionQueue().isEmpty();
+      });
+    });
+
+    // the client should now get duplicate events from the current-version 
server
+    interestClient.invoke("verification 3", () -> {
+      Cache cache = getCache();
+      Region r2 = cache.getRegion(REGION_NAME2);
+      MemberIDVerifier verifier = (MemberIDVerifier) ((LocalRegion) 
r2).getCacheListener();
+      assertFalse(verifier.eventReceived); // no duplicate events should have 
arrived
+      PoolImpl pool = (PoolImpl) 
PoolManager.find("ClientServerMiscDUnitTestPool");
+
+      Map seqMap = pool.getThreadIdToSequenceIdMap();
+      assertEquals(4, seqMap.size()); // one for each server and one for the 
feed
+    });
+  }
+
+  @Test
   public void testDistributedMemberBytesWithCurrentServerAndOldClient() throws 
Exception {
     // Start current version server
     int serverPort = initServerCache(true);
@@ -120,19 +230,28 @@ public class ClientServerMiscBCDUnitTest extends 
ClientServerMiscDUnitTest {
 
     // Verify member id bytes on client and server are equal
     String complaint = "size on client=" + 
clientMembershipIdBytesOnClient.length
-        + "; size on server=" + clientMembershipIdBytesOnServer.length;
+        + "; size on server=" + clientMembershipIdBytesOnServer.length + 
"\nclient bytes="
+        + Arrays.toString(clientMembershipIdBytesOnClient) + "\nserver bytes="
+        + Arrays.toString(clientMembershipIdBytesOnServer);
     assertTrue(complaint,
         Arrays.equals(clientMembershipIdBytesOnClient, 
clientMembershipIdBytesOnServer));
   }
 
   private byte[] getClientMembershipIdBytesOnClient() {
-    return EventID.getMembershipId(getCache().getDistributedSystem());
+    DistributedSystem system = getCache().getDistributedSystem();
+    byte[] result =
+        EventID.getMembershipId(new 
ClientProxyMembershipID(system.getDistributedMember()));
+    System.out.println("client ID bytes are " + Arrays.toString(result));
+    return result;
   }
 
   private byte[] getClientMembershipIdBytesOnServer() {
     Set cpmIds = 
ClientHealthMonitor.getInstance().getClientHeartbeats().keySet();
     assertEquals(1, cpmIds.size());
     ClientProxyMembershipID cpmId = (ClientProxyMembershipID) 
cpmIds.iterator().next();
-    return EventID.getMembershipId(cpmId);
+    System.out.println("client ID on server is " + 
cpmId.getDistributedMember());
+    byte[] result = EventID.getMembershipId(cpmId);
+    System.out.println("client ID bytes are " + Arrays.toString(result));
+    return result;
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
index bfe4646..1824513 100755
--- 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
@@ -23,6 +23,19 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.awaitility.Awaitility;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.GemFireConfigException;
 import org.apache.geode.GemFireIOException;
 import org.apache.geode.cache.AttributesFactory;
@@ -34,6 +47,7 @@ import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.PartitionAttributesFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.Scope;
 import org.apache.geode.cache.client.ClientCacheFactory;
 import org.apache.geode.cache.client.NoAvailableServersException;
@@ -50,10 +64,13 @@ import org.apache.geode.cache30.CacheSerializableRunnable;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.DistributedSystemDisconnectedException;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import 
org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.AvailablePort;
 import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.ha.ThreadIdentifier;
 import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.dunit.DistributedTestUtils;
 import org.apache.geode.test.dunit.Host;
@@ -67,18 +84,6 @@ import 
org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
 import org.apache.geode.test.dunit.standalone.VersionManager;
 import org.apache.geode.test.junit.categories.ClientServerTest;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import 
org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
-import org.awaitility.Awaitility;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
 
 /**
  * Tests client server corner cases between Region and Pool
@@ -763,15 +768,20 @@ public class ClientServerMiscDUnitTest extends 
JUnit4CacheTestCase {
   }
 
   public static void createClientCacheV(String h, int port) throws Exception {
-    _createClientCache(h, false, port);
+    _createClientCache(h, false, -1, port);
   }
 
   public static void createEmptyClientCache(String h, int... ports) throws 
Exception {
-    _createClientCache(h, false, ports);
+    _createClientCache(h, false, -1, ports);
   }
 
   public static Pool createClientCache(String h, int... ports) throws 
Exception {
-    return _createClientCache(h, false, ports);
+    return _createClientCache(h, false, -1, ports);
+  }
+
+  public static Pool createClientCache(String h, int subscriptionAckInterval, 
boolean empty,
+      int... ports) throws Exception {
+    return _createClientCache(h, empty, subscriptionAckInterval, ports);
   }
 
   private static PoolFactory addServers(PoolFactory factory, String h, int... 
ports) {
@@ -781,28 +791,41 @@ public class ClientServerMiscDUnitTest extends 
JUnit4CacheTestCase {
     return factory;
   }
 
-  public static Pool _createClientCache(String h, boolean empty, int... ports) 
throws Exception {
+  public static Pool _createClientCache(String h, boolean empty, int 
subscriptionAckInterval,
+      int... ports) throws Exception {
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
     Cache cache = new ClientServerMiscDUnitTest().createCacheV(props);
     ClientServerMiscDUnitTest.static_cache = cache;
-    PoolFactory poolFactory = PoolManager.createFactory();
-    PoolImpl p = (PoolImpl) addServers(poolFactory, h, 
ports).setSubscriptionEnabled(true)
-        
.setThreadLocalConnections(true).setReadTimeout(1000).setSocketBufferSize(32768)
-        
.setMinConnections(3).setSubscriptionRedundancy(-1).setPingInterval(2000)
-        // .setRetryAttempts(5)
-        // .setRetryInterval(2000)
-        .create("ClientServerMiscDUnitTestPool");
+    System.setProperty(DistributionConfig.GEMFIRE_PREFIX + 
"bridge.disableShufflingOfEndpoints",
+        "true");
+    PoolImpl p;
+    try {
+      PoolFactory poolFactory = PoolManager.createFactory();
+      addServers(poolFactory, h, 
ports).setSubscriptionEnabled(true).setThreadLocalConnections(true)
+          .setReadTimeout(1000).setSocketBufferSize(32768).setMinConnections(3)
+          .setSubscriptionRedundancy(1).setPingInterval(2000);
+      // .setRetryAttempts(5)
+      // .setRetryInterval(2000)
+      if (subscriptionAckInterval > 0) {
+        poolFactory.setSubscriptionAckInterval(subscriptionAckInterval);
+      }
+      p = (PoolImpl) poolFactory.create("ClientServerMiscDUnitTestPool");
 
-    AttributesFactory factory = new AttributesFactory();
-    factory.setScope(Scope.DISTRIBUTED_ACK);
-    if (empty) {
-      factory.setDataPolicy(DataPolicy.EMPTY);
+      AttributesFactory factory = new AttributesFactory();
+      factory.setScope(Scope.DISTRIBUTED_ACK);
+      if (empty) {
+        factory.setDataPolicy(DataPolicy.EMPTY);
+      }
+      factory.setPoolName(p.getName());
+
+      attrs = factory.create();
+    } finally {
+      System.getProperties()
+          .remove(DistributionConfig.GEMFIRE_PREFIX + 
"bridge.disableShufflingOfEndpoints");
     }
-    factory.setPoolName(p.getName());
 
-    attrs = factory.create();
     Region region1 = cache.createRegion(REGION_NAME1, attrs);
     Region region2 = cache.createRegion(REGION_NAME2, attrs);
     Region prRegion = cache.createRegion(PR_REGION_NAME, attrs);
@@ -857,6 +880,7 @@ public class ClientServerMiscDUnitTest extends 
JUnit4CacheTestCase {
       eventReceived = true;
       DistributedMember memberID = event.getDistributedMember();
       memberIDNotReceived = (memberID == null);
+      // System.out.println("received event " + event);
     }
 
     public void reset() {
@@ -865,6 +889,32 @@ public class ClientServerMiscDUnitTest extends 
JUnit4CacheTestCase {
     }
   }
 
+  public static void dumpPoolIdentifiers() throws Exception {
+    // duplicate events were received, so let's look at the thread identifiers 
we have
+    PoolImpl pool = (PoolImpl) 
PoolManager.find("ClientServerMiscDUnitTestPool");
+
+    Map seqMap = pool.getThreadIdToSequenceIdMap();
+    for (Iterator it = seqMap.keySet().iterator(); it.hasNext();) {
+      ThreadIdentifier tid = (ThreadIdentifier) it.next();
+      byte[] memberBytes = tid.getMembershipID();
+      dumpMemberId(tid, memberBytes);
+    }
+  }
+
+  public static void dumpMemberId(Object holder, byte[] memberBytes) throws 
Exception {
+    byte[] newBytes = new byte[memberBytes.length + 17];
+    System.arraycopy(memberBytes, 0, newBytes, 0, memberBytes.length);
+    ByteArrayInputStream bais = new ByteArrayInputStream(newBytes);
+    DataInputStream dataIn = new DataInputStream(bais);
+    InternalDistributedMember memberId = 
InternalDistributedMember.readEssentialData(dataIn);
+    StringBuilder sb = new StringBuilder(300);
+    sb.append('<').append(Thread.currentThread().getName()).append("> 
").append(holder)
+        .append(" is ").append(memberId).append(" byte count = 
").append(memberBytes.length)
+        .append(" bytes = ").append(Arrays.toString(memberBytes));
+    System.out.println(sb.toString());
+  }
+
+
   public static Integer createServerCache(Boolean notifyBySubscription, 
Integer maxThreads,
       boolean isHA) throws Exception {
     Cache cache = new ClientServerMiscDUnitTest().createCacheV(new 
Properties());
@@ -873,6 +923,7 @@ public class ClientServerMiscDUnitTest extends 
JUnit4CacheTestCase {
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableConflation(true);
     factory.setDataPolicy(DataPolicy.REPLICATE);
+    factory.setConcurrencyChecksEnabled(true);
     RegionAttributes myAttrs = factory.create();
     Region r1 = cache.createRegion(REGION_NAME1, myAttrs);
     Region r2 = cache.createRegion(REGION_NAME2, myAttrs);
@@ -1144,6 +1195,9 @@ public class ClientServerMiscDUnitTest extends 
JUnit4CacheTestCase {
   public static void putForClient() {
     Cache cache = new ClientServerMiscDUnitTest().getCache();
     Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
+    if (r2 == null) {
+      r2 = 
cache.createRegionFactory(RegionShortcut.REPLICATE).create(REGION_NAME2);
+    }
 
     r2.put(k1, "client2_k1");
     r2.put(k2, "client2_k2");

http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
 
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
index 0170b26..73f701d 100755
--- 
a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
+++ 
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
@@ -178,26 +178,26 @@ public class ProcessManager {
       classPath = dunitClasspath;
     } else {
       // remove current-version product classes and resources from the 
classpath
-      // String buildDir = separator + "geode-core" + separator + "build" + 
separator;
-      //
-      // String mainClasses = buildDir + "classes" + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, mainClasses);
-      //
-      // String mainResources = buildDir + "resources" + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, mainResources);
-      //
-      // String generatedResources = buildDir + "generated-resources" + 
separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, generatedResources);
-      //
-      // buildDir = separator + "geode-common" + separator + "build" + 
separator + "classes"
-      // + separator + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, buildDir);
-      //
-      // buildDir = separator + "geode-json" + separator + "build" + separator 
+ "classes" +
-      // separator
-      // + "main";
-      // dunitClasspath = removeFromPath(dunitClasspath, buildDir);
-      //
+       String buildDir = separator + "geode-core" + separator + "build" + 
separator;
+
+       String mainClasses = buildDir + "classes" + separator + "main";
+       dunitClasspath = removeFromPath(dunitClasspath, mainClasses);
+
+       String mainResources = buildDir + "resources" + separator + "main";
+       dunitClasspath = removeFromPath(dunitClasspath, mainResources);
+
+       String generatedResources = buildDir + "generated-resources" + 
separator + "main";
+       dunitClasspath = removeFromPath(dunitClasspath, generatedResources);
+
+       buildDir = separator + "geode-common" + separator + "build" + separator 
+ "classes"
+       + separator + "main";
+       dunitClasspath = removeFromPath(dunitClasspath, buildDir);
+
+       buildDir = separator + "geode-json" + separator + "build" + separator + 
"classes" +
+       separator
+       + "main";
+       dunitClasspath = removeFromPath(dunitClasspath, buildDir);
+
       classPath = versionManager.getClasspath(version) + File.pathSeparator + 
dunitClasspath;
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/fb4e96bf/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
 
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index b69e004..433e641 100644
--- 
a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ 
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -997,10 +997,10 @@ 
fromData,50,2a03b500052bb9004201003d1c9900112abb000759b70043b50004a7000e2abb0003
 toData,22,2b2ab40004c10007b9004002002ab400042bb60041b1
 
 org/apache/geode/internal/cache/EventID,4
-fromData,53,2a2bb8003db500042bb8003db8003e4d2a2cb8003fb500092a2cb8003fb5000b2a2bb900400100b5000c2a2bb900410100b50001b1
-fromDataPre_GFE_8_0_0_0,33,2a2bb8003db500042bb8003db8003e4d2a2cb8003fb500092a2cb8003fb5000bb1
-toData,92,2bb800354d2cb20036b600379d00242ab600384ebb0010592cb700393a042d1904b600151904b600162bb8003aa7000b2ab400042bb8003a2ab400092ab4000bb800332bb8003a2b2ab4000cb9003b02002b2ab40001b9003c0200b1
-toDataPre_GFE_8_0_0_0,24,2ab400042bb8003a2ab400092ab4000bb800332bb8003ab1
+fromData,53,2a2bb80041b500042bb80041b800424d2a2cb80043b500092a2cb80043b5000b2a2bb900440100b5000c2a2bb900450100b50001b1
+fromDataPre_GFE_8_0_0_0,33,2a2bb80041b500042bb80041b800424d2a2cb80043b500092a2cb80043b5000bb1
+toData,93,2bb8003a4d2cb2003bb6003c9d00252a2cb6002e4ebb0010592cb7003d3a042d1904b600151904b600162bb8003ea7000b2ab400042bb8003e2ab400092ab4000bb800382bb8003e2b2ab4000cb9003f02002b2ab40001b900400200b1
+toDataPre_GFE_8_0_0_0,24,2ab400042bb8003e2ab400092ab4000bb800382bb8003eb1
 
 org/apache/geode/internal/cache/EventTracker$EventSeqnoHolder,2
 fromData,22,2a2bb9000e0100b500042a2bb8000fc00010b50005b1

Reply via email to