geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [2/2] geode git commit: GEODE-2647: remove unnecessary client puts from ClientHealthStatsDUnitTest
Date Fri, 14 Apr 2017 16:33:26 GMT
GEODE-2647: remove unnecessary client puts from ClientHealthStatsDUnitTest

This removes the puts from the clients which was unnecessary for the
tests. By removing the puts, the race condition caused by async puts
and clears for the subscription enabled test is gone.


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

Branch: refs/heads/develop
Commit: ed300c5d282f90434ea37d1dc7a09eace3557879
Parents: d939ceb
Author: Kirk Lund <klund@apache.org>
Authored: Thu Apr 13 15:21:30 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Fri Apr 14 09:33:18 2017 -0700

----------------------------------------------------------------------
 .../management/ClientHealthStatsDUnitTest.java  | 59 +-------------------
 1 file changed, 2 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/ed300c5d/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
index 5142571..760a47a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
@@ -73,13 +73,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
       ClientHealthStatsDUnitTest.class.getSimpleName() + "_Region";
 
   // client1VM and client2VM VM fields
-  private static ClientCache clientCache;
-
-  // TODO: assert following values in each client VM
-  private static int numOfCreates;
-  private static int numOfUpdates;
-  private static int numOfInvalidates;
-  private static boolean lastKeyReceived;
+  private static volatile ClientCache clientCache;
+  private static volatile boolean lastKeyReceived;
 
   private VM managerVM;
   private VM serverVM;
@@ -107,9 +102,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
   public void after() throws Exception {
     invokeInEveryVM(() -> {
       lastKeyReceived = false;
-      numOfCreates = 0;
-      numOfUpdates = 0;
-      numOfInvalidates = 0;
       clientCache = null;
     });
   }
@@ -124,9 +116,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
     this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true));
     this.client2VM.invoke(() -> createClientCache(this.hostName, port, 2, true));
 
-    this.client1VM.invoke(() -> put());
-    this.client2VM.invoke(() -> put());
-
     DistributedMember serverMember = this.managementTestRule.getDistributedMember(this.serverVM);
     this.managerVM.invoke(() -> verifyClientStats(serverMember, port, 2));
 
@@ -143,9 +132,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
     this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, false));
     this.client2VM.invoke(() -> createClientCache(this.hostName, port, 2, false));
 
-    this.client1VM.invoke(() -> put());
-    this.client2VM.invoke(() -> put());
-
     DistributedMember serverMember = this.managementTestRule.getDistributedMember(this.serverVM);
     this.managerVM.invoke(() -> verifyClientStats(serverMember, port, 0));
     this.managementTestRule.stopManager(this.managerVM);
@@ -161,9 +147,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
     this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true));
     this.client2VM.invoke(() -> createClientCache(this.hostName, port, 2, true));
 
-    this.client1VM.invoke(() -> put());
-    this.client2VM.invoke(() -> put());
-
     this.client1VM.invoke(() -> clientCache.close(true));
     this.client2VM.invoke(() -> clientCache.close(true));
 
@@ -206,9 +189,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
    */
   private boolean cacheClientProxyHasBeenPause() {
     CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance();
-    // TODO: CacheClientNotifier clientNotifier =
-    // ((CacheServerImpl)this.managementTestRule.getCache().getCacheServers().get(0)).getAcceptor().getCacheClientNotifier();
-
     Collection<CacheClientProxy> clientProxies = clientNotifier.getClientProxies();
 
     for (CacheClientProxy clientProxy : clientProxies) {
@@ -263,21 +243,10 @@ public class ClientHealthStatsDUnitTest implements Serializable {
 
     regionFactory.addCacheListener(new CacheListenerAdapter<String, String>() {
       @Override
-      public void afterInvalidate(final EntryEvent<String, String> event) {
-        numOfInvalidates++;
-      }
-
-      @Override
       public void afterCreate(final EntryEvent<String, String> event) {
         if ("last_key".equals(event.getKey())) {
           lastKeyReceived = true;
         }
-        numOfCreates++;
-      }
-
-      @Override
-      public void afterUpdate(final EntryEvent<String, String> event) {
-        numOfUpdates++;
       }
     });
 
@@ -359,30 +328,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
   }
 
   /**
-   * Invoked in client1VM and client2VM
-   */
-  private void put() {
-    Cache cache = (Cache) clientCache;
-    Region<String, String> region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
-
-    region.put(KEY1, VALUE1);
-    assertThat(region.getEntry(KEY1).getValue()).isEqualTo(VALUE1);
-
-    region.put(KEY2, VALUE2);
-    assertThat(region.getEntry(KEY2).getValue()).isEqualTo(VALUE2);
-
-    region.clear();
-
-    region.put(KEY1, VALUE1);
-    assertThat(region.getEntry(KEY1).getValue()).isEqualTo(VALUE1);
-
-    region.put(KEY2, VALUE2);
-    assertThat(region.getEntry(KEY2).getValue()).isEqualTo(VALUE2);
-
-    region.clear();
-  }
-
-  /**
    * Invoked in serverVM
    */
   private void verifyStats(final int serverPort) throws Exception {


Mime
View raw message