geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [08/32] geode git commit: GEODE-2954 Old client gets null memberID in cache listener
Date Wed, 31 May 2017 17:01:13 GMT
GEODE-2954 Old client gets null memberID in cache listener

I've added a new test that demonstrates that a new-version server sends
an EventID to a client that the client is unable to deserialize
completely.  It gets an error when deserializing its member ID,
causing cache listeners to get a null when requesting the ID of
the member that effected the change.

The fix is to reserialize the member ID in EventID.toData if the
destination stream is for an older version, such as a 1.1.0 client.
This ensures the proper on-wire format is used for that version of Geode.

I've also bumped up the version ordinal for 1.2 since version 59 is
marked as unusable in Version.java.

I've changed the Banner to show the version ordinal because the other
version information in the banner isn't completely trustworthy.  It
looks for a GemFireVersion.properties file on the classpath to get
this information and so it may not get it from the Geode jar file
as expected.


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

Branch: refs/heads/feature/GEODE-1279
Commit: e79d27d7e258d2a5f0d8a3155cc1911825a90493
Parents: 096c22d
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Wed May 24 15:13:52 2017 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Thu May 25 07:45:18 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/internal/Banner.java  |   2 +
 .../java/org/apache/geode/internal/Version.java |   4 +-
 .../apache/geode/internal/cache/EventID.java    |  11 +-
 .../sockets/ClientServerMiscBCDUnitTest.java    |  44 +++
 .../tier/sockets/ClientServerMiscDUnitTest.java | 358 ++++++++-----------
 .../cli/commands/ShowDeadlockDUnitTest.java     |   0
 .../sanctionedDataSerializables.txt             |   8 +-
 7 files changed, 215 insertions(+), 212 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/geode-core/src/main/java/org/apache/geode/internal/Banner.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/Banner.java b/geode-core/src/main/java/org/apache/geode/internal/Banner.java
index b6a89bf..a218a5b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/Banner.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/Banner.java
@@ -104,6 +104,8 @@ public class Banner {
 
     GemFireVersion.print(out);
 
+    out.println("Communications version: " + Version.CURRENT_ORDINAL);
+
     out.println("Process ID: " + processId);
     out.println("User: " + sp.get("user.name"));
     sp.remove("user.name");

http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/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 1c131e8..5576971 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
@@ -59,7 +59,7 @@ public class Version implements Comparable<Version> {
   /** byte used as ordinal to represent this <code>Version</code> */
   private final short ordinal;
 
-  public static final int HIGHEST_VERSION = 60;
+  public static final int HIGHEST_VERSION = 65;
 
   private static final Version[] VALUES = new Version[HIGHEST_VERSION + 1];
 
@@ -190,7 +190,7 @@ public class Version implements Comparable<Version> {
   public static final Version GEODE_111 =
       new Version("GEODE", "1.1.1", (byte) 1, (byte) 1, (byte) 1, (byte) 0, GEODE_111_ORDINAL);
 
-  private static final byte GEODE_120_ORDINAL = 60;
+  private static final byte GEODE_120_ORDINAL = 65;
 
   public static final Version GEODE_120 =
       new Version("GEODE", "1.2.0", (byte) 1, (byte) 2, (byte) 0, (byte) 0, GEODE_120_ORDINAL);

http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/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 87835ff..71acdc9 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
@@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
@@ -322,7 +323,15 @@ public class EventID implements DataSerializableFixedID, Serializable,
Externali
   }
 
   public void toData(DataOutput dop) throws IOException {
-    DataSerializer.writeByteArray(this.membershipID, dop);
+    Version version = InternalDataSerializer.getVersionForDataStream(dop);
+    if (version.compareTo(Version.GFE_90) <= 0) {
+      InternalDistributedMember member = getDistributedMember();
+      HeapDataOutputStream hdos = new HeapDataOutputStream(version);
+      member.writeEssentialData(hdos);
+      DataSerializer.writeByteArray(hdos.toByteArray(), dop);
+    } else {
+      DataSerializer.writeByteArray(this.membershipID, dop);
+    }
     DataSerializer.writeByteArray(getOptimizedByteArrayForEventID(this.threadID, this.sequenceID),
         dop);
     dop.writeInt(this.bucketID);

http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/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 be0ac6b..d51c196 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
@@ -14,17 +14,28 @@
  */
 package org.apache.geode.internal.cache.tier.sockets;
 
+import static org.junit.Assert.assertFalse;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.Pool;
+import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.NetworkUtils;
+import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.standalone.VersionManager;
 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.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 @Category({DistributedTest.class, ClientServerTest.class, BackwardCompatibilityTest.class})
 @RunWith(Parameterized.class)
@@ -46,4 +57,37 @@ public class ClientServerMiscBCDUnitTest extends ClientServerMiscDUnitTest
{
     testVersion = version;
   }
 
+  @Test
+  public void testSubscriptionWithCurrentServerAndOldClients() throws Exception {
+    // start server first
+    int serverPort = initServerCache(true);
+    VM client1 = Host.getHost(0).getVM(testVersion, 1);
+    VM client2 = Host.getHost(0).getVM(testVersion, 3);
+    String hostname = NetworkUtils.getServerHostName(Host.getHost(0));
+    client1.invoke("create client1 cache", () -> {
+      createClientCache(hostname, serverPort);
+      populateCache();
+      registerInterest();
+    });
+    client2.invoke("create client2 cache", () -> {
+      Pool ignore = createClientCache(hostname, serverPort);
+    });
+
+    client2.invoke("putting data in client2", () -> putForClient());
+
+    // client1 will receive client2's updates asynchronously
+    client1.invoke(() -> {
+      Region r2 = getCache().getRegion(REGION_NAME2);
+      MemberIDVerifier verifier = (MemberIDVerifier) ((LocalRegion) r2).getCacheListener();
+      Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> verifier.eventReceived);
+    });
+
+    // client2's update should have included a memberID - GEODE-2954
+    client1.invoke(() -> {
+      Region r2 = getCache().getRegion(REGION_NAME2);
+      MemberIDVerifier verifier = (MemberIDVerifier) ((LocalRegion) r2).getCacheListener();
+      assertFalse(verifier.memberIDNotReceived);
+    });
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/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 b4f3185..9ca5ab9 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
@@ -30,6 +30,7 @@ import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.CacheWriterException;
 import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.Scope;
@@ -42,7 +43,9 @@ import org.apache.geode.cache.client.internal.Op;
 import org.apache.geode.cache.client.internal.PoolImpl;
 import org.apache.geode.cache.client.internal.RegisterInterestTracker;
 import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.cache.util.CacheListenerAdapter;
 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.internal.AvailablePort;
@@ -63,6 +66,7 @@ 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;
@@ -72,6 +76,7 @@ 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
@@ -95,9 +100,9 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase {
 
   private static final String server_k2 = "server-k2";
 
-  private static final String REGION_NAME1 = "ClientServerMiscDUnitTest_region1";
+  static final String REGION_NAME1 = "ClientServerMiscDUnitTest_region1";
 
-  private static final String REGION_NAME2 = "ClientServerMiscDUnitTest_region2";
+  static final String REGION_NAME2 = "ClientServerMiscDUnitTest_region2";
 
   private static final String PR_REGION_NAME = "ClientServerMiscDUnitTest_PRregion";
 
@@ -138,13 +143,13 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase {
     server2 = host.getVM(3);
   }
 
-  private int initServerCache(boolean notifyBySub) {
+  int initServerCache(boolean notifyBySub) {
     Object[] args = new Object[] {notifyBySub, getMaxThreads()};
     return ((Integer) server1.invoke(ClientServerMiscDUnitTest.class, "createServerCache",
args))
         .intValue();
   }
 
-  private int initServerCache2(boolean notifyBySub) {
+  int initServerCache2(boolean notifyBySub) {
     Object[] args = new Object[] {notifyBySub, getMaxThreads()};
     return ((Integer) server2.invoke(ClientServerMiscDUnitTest.class, "createServerCache",
args))
         .intValue();
@@ -373,19 +378,18 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase {
   public void testForTwoRegionHavingDifferentInterestList() throws Exception {
     // start server first
     PORT1 = initServerCache(true);
-    createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1);
-    populateCache();
-    registerInterest();
-    server1.invoke(() -> ClientServerMiscDUnitTest.put());
+    int serverPort = PORT1;
+    VM client1 = Host.getHost(0).getVM(testVersion, 1);
+    String hostname = NetworkUtils.getServerHostName(Host.getHost(0));
+    client1.invoke("create client1 cache", () -> {
+      createClientCache(hostname, serverPort);
+      populateCache();
+      registerInterest();
+    });
 
-    // pause(5000 + 5000 + 10000);
-    /*
-     * final int maxWaitTime = Integer.getInteger(WAIT_PROPERTY, WAIT_DEFAULT).intValue();
try {
-     * Thread.yield(); Thread.sleep(maxWaitTime); } catch (InterruptedException e) {
-     * fail("interrupted"); }
-     */
-    verifyUpdates();
+    server1.invoke("putting entries in server1", () -> put());
 
+    client1.invoke(() -> verifyUpdates());
   }
 
   /**
@@ -590,65 +594,27 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase {
 
     populateCache();
     server1.invoke(() -> ClientServerMiscDUnitTest.put());
-    // pause(5000);
-    WaitCriterion wc = new WaitCriterion() {
-      String excuse;
-
-      public boolean done() {
-        Object val = region1.getEntry(k1).getValue();
-        return k1.equals(val);
-      }
 
-      public String description() {
-        return excuse;
-      }
-    };
-    Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
-
-    // assertIndexDetailsEquals(region1.getEntry(k1).getValue(), k1);
-    wc = new WaitCriterion() {
-      String excuse;
-
-      public boolean done() {
-        Object val = region1.getEntry(k2).getValue();
-        return k2.equals(val);
-      }
-
-      public String description() {
-        return excuse;
-      }
-    };
-    Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
-
-    wc = new WaitCriterion() {
-      String excuse;
-
-      public boolean done() {
-        Object val = region2.getEntry(k1).getValue();
-        return k1.equals(val);
-      }
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = region1.getEntry(k1).getValue();
+      return k1.equals(val);
+    });
 
-      public String description() {
-        return excuse;
-      }
-    };
-    Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = region1.getEntry(k2).getValue();
+      return k2.equals(val);
+    });
 
-    // assertIndexDetailsEquals(region1.getEntry(k2).getValue(), k2);
-    // assertIndexDetailsEquals(region2.getEntry(k1).getValue(), k1);
-    wc = new WaitCriterion() {
-      String excuse;
 
-      public boolean done() {
-        Object val = region2.getEntry(k2).getValue();
-        return k2.equals(val);
-      }
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = region2.getEntry(k1).getValue();
+      return k1.equals(val);
+    });
 
-      public String description() {
-        return excuse;
-      }
-    };
-    Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = region2.getEntry(k2).getValue();
+      return k2.equals(val);
+    });
 
     // assertIndexDetailsEquals(region2.getEntry(k2).getValue(), k2);
   }
@@ -857,6 +823,32 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase {
     return p;
   }
 
+  static class MemberIDVerifier extends CacheListenerAdapter {
+    boolean memberIDNotReceived = true;
+    boolean eventReceived = false;
+
+    @Override
+    public void afterCreate(EntryEvent event) {
+      eventReceived(event);
+    }
+
+    @Override
+    public void afterUpdate(EntryEvent event) {
+      eventReceived(event);
+    }
+
+    private void eventReceived(EntryEvent event) {
+      eventReceived = true;
+      DistributedMember memberID = event.getDistributedMember();
+      memberIDNotReceived = (memberID == null);
+    }
+
+    public void reset() {
+      memberIDNotReceived = true;
+      eventReceived = false;
+    }
+  }
+
   public static Integer createServerCache(Boolean notifyBySubscription, Integer maxThreads)
       throws Exception {
     Cache cache = new ClientServerMiscDUnitTest().createCacheV(new Properties());
@@ -893,17 +885,12 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase {
     return 0;
   }
 
-  public static void registerInterest() {
-    try {
-      Cache cache = new ClientServerMiscDUnitTest().getCache();
-      Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
-      assertNotNull(r);
-      // r.registerInterestRegex(CacheClientProxy.ALL_KEYS);
-      r.registerInterest("ALL_KEYS");
-    } catch (CacheWriterException e) {
-      e.printStackTrace();
-      Assert.fail("Test failed due to CacheWriterException during registerInterest", e);
-    }
+  public static void registerInterest() throws Exception {
+    Cache cache = new ClientServerMiscDUnitTest().getCache();
+    Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
+    assertNotNull(r);
+    r.registerInterest("ALL_KEYS");
+    r.getAttributesMutator().addCacheListener(new MemberIDVerifier());
   }
 
   public static void registerInterestForInvalidatesInBothTheRegions() {
@@ -1070,153 +1057,114 @@ public class ClientServerMiscDUnitTest extends JUnit4CacheTestCase
{
   }
 
   public static void verifyCacheClientProxyOnServer() {
-    try {
-      Cache cache = new ClientServerMiscDUnitTest().getCache();
-      assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size());
-      CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
-      assertNotNull(bs);
-      assertNotNull(bs.getAcceptor());
-      final CacheClientNotifier ccn = bs.getAcceptor().getCacheClientNotifier();
-
-      assertNotNull(ccn);
-      WaitCriterion wc = new WaitCriterion() {
-        String excuse;
+    Cache cache = new ClientServerMiscDUnitTest().getCache();
+    assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size());
+    CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
+    assertNotNull(bs);
+    assertNotNull(bs.getAcceptor());
+    final CacheClientNotifier ccn = bs.getAcceptor().getCacheClientNotifier();
+
+    assertNotNull(ccn);
+    WaitCriterion wc = new WaitCriterion() {
+      String excuse;
 
-        public boolean done() {
-          return ccn.getClientProxies().size() == 1;
-        }
+      public boolean done() {
+        return ccn.getClientProxies().size() == 1;
+      }
 
-        public String description() {
-          return excuse;
-        }
-      };
-      Wait.waitForCriterion(wc, 40 * 1000, 1000, true);
-    } catch (Exception ex) {
-      ex.printStackTrace();
-      fail("while setting verifyNoCacheClientProxyOnServer  " + ex);
-    }
+      public String description() {
+        return excuse;
+      }
+    };
+    Wait.waitForCriterion(wc, 40 * 1000, 1000, true);
   }
 
   public static void populateCache() {
-    try {
-      Cache cache = new ClientServerMiscDUnitTest().getCache();
-      Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME1);
-      Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
-      assertNotNull(r1);
-      assertNotNull(r2);
+    Cache cache = new ClientServerMiscDUnitTest().getCache();
+    Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME1);
+    Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
+    assertNotNull(r1);
+    assertNotNull(r2);
 
-      if (!r1.containsKey(k1))
-        r1.create(k1, k1);
-      if (!r1.containsKey(k2))
-        r1.create(k2, k2);
-      if (!r2.containsKey(k1))
-        r2.create(k1, k1);
-      if (!r2.containsKey(k2))
-        r2.create(k2, k2);
-
-      assertEquals(r1.getEntry(k1).getValue(), k1);
-      assertEquals(r1.getEntry(k2).getValue(), k2);
-      assertEquals(r2.getEntry(k1).getValue(), k1);
-      assertEquals(r2.getEntry(k2).getValue(), k2);
-    } catch (Exception ex) {
-      Assert.fail("failed while createEntries()", ex);
-    }
+    if (!r1.containsKey(k1))
+      r1.create(k1, k1);
+    if (!r1.containsKey(k2))
+      r1.create(k2, k2);
+    if (!r2.containsKey(k1))
+      r2.create(k1, k1);
+    if (!r2.containsKey(k2))
+      r2.create(k2, k2);
+
+    assertEquals(r1.getEntry(k1).getValue(), k1);
+    assertEquals(r1.getEntry(k2).getValue(), k2);
+    assertEquals(r2.getEntry(k1).getValue(), k1);
+    assertEquals(r2.getEntry(k2).getValue(), k2);
   }
 
   public static void put() {
-    try {
-      Cache cache = new ClientServerMiscDUnitTest().getCache();
-      Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME1);
-      Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
-      assertNotNull(r1);
-      assertNotNull(r2);
+    Cache cache = new ClientServerMiscDUnitTest().getCache();
+    Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME1);
+    Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
+    assertNotNull(r1);
+    assertNotNull(r2);
 
-      r1.put(k1, server_k1);
-      r1.put(k2, server_k2);
+    r1.put(k1, server_k1);
+    r1.put(k2, server_k2);
 
-      r2.put(k1, server_k1);
-      r2.put(k2, server_k2);
+    r2.put(k1, server_k1);
+    r2.put(k2, server_k2);
 
-      assertEquals(r1.getEntry(k1).getValue(), server_k1);
-      assertEquals(r1.getEntry(k2).getValue(), server_k2);
-      assertEquals(r2.getEntry(k1).getValue(), server_k1);
-      assertEquals(r2.getEntry(k2).getValue(), server_k2);
-    } catch (Exception ex) {
-      Assert.fail("failed while put()", ex);
-    }
+    assertEquals(r1.getEntry(k1).getValue(), server_k1);
+    assertEquals(r1.getEntry(k2).getValue(), server_k2);
+    assertEquals(r2.getEntry(k1).getValue(), server_k1);
+    assertEquals(r2.getEntry(k2).getValue(), server_k2);
   }
 
-  public static void verifyUpdates() {
-    try {
-      Cache cache = new ClientServerMiscDUnitTest().getCache();
-      final Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME1);
-      final Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
-      assertNotNull(r1);
-      assertNotNull(r2);
-      // verify updates
-      WaitCriterion wc = new WaitCriterion() {
-        String excuse;
-
-        public boolean done() {
-          Object val = r1.getEntry(k1).getValue();
-          return k1.equals(val);
-        }
+  public static void putForClient() {
+    Cache cache = new ClientServerMiscDUnitTest().getCache();
+    Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
 
-        public String description() {
-          return excuse;
-        }
-      };
-      Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
-
-      // assertIndexDetailsEquals(k1, r1.getEntry(k1).getValue());
-      wc = new WaitCriterion() {
-        String excuse;
-
-        public boolean done() {
-          Object val = r1.getEntry(k2).getValue();
-          return k2.equals(val);
-        }
-
-        public String description() {
-          return excuse;
-        }
-      };
-      Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
+    r2.put(k1, "client2_k1");
+    r2.put(k2, "client2_k2");
+  }
 
-      // assertIndexDetailsEquals(k2, r1.getEntry(k2).getValue());
-      wc = new WaitCriterion() {
-        String excuse;
+  public static void verifyUpdates() {
+    Cache cache = new ClientServerMiscDUnitTest().getCache();
+    final Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME1);
+    final Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
+    assertNotNull(r1);
+    assertNotNull(r2);
 
-        public boolean done() {
-          Object val = r2.getEntry(k1).getValue();
-          return server_k1.equals(val);
-        }
+    // no interest registered in region1 - it should hold client values, which are
+    // the same as the keys
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = r1.getEntry(k1).getValue();
+      return k1.equals(val);
+    });
 
-        public String description() {
-          return excuse;
-        }
-      };
-      Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = r1.getEntry(k2).getValue();
+      return k2.equals(val);
+    });
 
-      // assertIndexDetailsEquals(server_k1, r2.getEntry(k1).getValue());
-      wc = new WaitCriterion() {
-        String excuse;
+    // interest was registered in region2 - it should contain server values
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = r2.getEntry(k1).getValue();
+      return server_k1.equals(val);
+    });
 
-        public boolean done() {
-          Object val = r2.getEntry(k2).getValue();
-          return server_k2.equals(val);
-        }
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Object val = r2.getEntry(k2).getValue();
+      return server_k2.equals(val);
+    });
 
-        public String description() {
-          return excuse;
-        }
-      };
-      Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
+    // events should have contained a memberID
+    MemberIDVerifier verifier = (MemberIDVerifier) ((LocalRegion) r2).getCacheListener();
+    assertTrue("client should have received a listener event", verifier.eventReceived);
+    assertFalse("client received an update but the event had no member id",
+        verifier.memberIDNotReceived);
+    verifier.reset();
 
-      // assertIndexDetailsEquals(server_k2, r2.getEntry(k2).getValue());
-    } catch (Exception ex) {
-      Assert.fail("failed while verifyUpdates()", ex);
-    }
   }
 
   public static void verifyInvalidatesOnBothRegions() {

http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/geode/blob/e79d27d7/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 f2baa50..88df942 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,2a2bb80038b500042bb80038b800394d2a2cb8003ab500092a2cb8003ab5000b2a2bb9003b0100b5000c2a2bb9003c0100b50001b1
-fromDataPre_GFE_8_0_0_0,33,2a2bb80038b500042bb80038b800394d2a2cb8003ab500092a2cb8003ab5000bb1
-toData,44,2ab400042bb800352ab400092ab4000bb800332bb800352b2ab4000cb9003602002b2ab40001b900370200b1
-toDataPre_GFE_8_0_0_0,24,2ab400042bb800352ab400092ab4000bb800332bb80035b1
+fromData,53,2a2bb8003db500042bb8003db8003e4d2a2cb8003fb500092a2cb8003fb5000b2a2bb900400100b5000c2a2bb900410100b50001b1
+fromDataPre_GFE_8_0_0_0,33,2a2bb8003db500042bb8003db8003e4d2a2cb8003fb500092a2cb8003fb5000bb1
+toData,92,2bb800354d2cb20036b600379d00242ab600384ebb0010592cb700393a042d1904b600151904b600162bb8003aa7000b2ab400042bb8003a2ab400092ab4000bb800332bb8003a2b2ab4000cb9003b02002b2ab40001b9003c0200b1
+toDataPre_GFE_8_0_0_0,24,2ab400042bb8003a2ab400092ab4000bb800332bb8003ab1
 
 org/apache/geode/internal/cache/EventTracker$EventSeqnoHolder,2
 fromData,22,2a2bb9000e0100b500042a2bb8000fc00010b50005b1


Mime
View raw message