geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [1/2] incubator-geode git commit: Add forEachVMInvoke with targetClass argument
Date Wed, 01 Jun 2016 21:14:27 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-837 51c2417a4 -> 056d2a23e


Add forEachVMInvoke with targetClass argument

* required by JUnit3DistributedCacheTestCase


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

Branch: refs/heads/feature/GEODE-837
Commit: 49be214885010035af732ee492b7393ae01c0f25
Parents: 51c2417
Author: Kirk Lund <klund@apache.org>
Authored: Wed Jun 1 14:13:07 2016 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Wed Jun 1 14:13:07 2016 -0700

----------------------------------------------------------------------
 .../cache/DistributedCacheTestCase.java         | 38 +++++++-------------
 1 file changed, 13 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49be2148/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
index 5a1c0b3..6e74c28 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
@@ -16,15 +16,8 @@
  */
 package com.gemstone.gemfire.internal.cache;
 
-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.InternalGemFireException;
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
@@ -40,32 +33,26 @@ import com.gemstone.gemfire.distributed.internal.DistributionManager;
 import com.gemstone.gemfire.distributed.internal.DistributionManagerDUnitTest;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 
 /**
  * This is the abstract superclass of tests that validate the
  * functionality of GemFire's distributed caches.  It provides a
  * number of convenient helper classes.
  */
-public abstract class DistributedCacheTestCase
-  extends JUnit4DistributedTestCase {
+public abstract class DistributedCacheTestCase extends JUnit4DistributedTestCase {
 
   /** The current cache in this VM */
   protected static Cache cache = null;
 
-  ///////////////////////  Constructors  ///////////////////////
-
-  public DistributedCacheTestCase() {
-    super();
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     setUpDistributedCacheTestCase(true);
   }
+
   /**
    * Creates the {@link Cache} and root region in each remote VM
    * and, if createLocalCache, in this VM.
@@ -173,8 +160,6 @@ public abstract class DistributedCacheTestCase
     return exceptionInThreads;
   }
 
-  //////////////////////  Helper Methods  //////////////////////
-
   /**
    * Returns the root region of the cache.  We assume that the {@link
    * Cache} and the root region have already been created.
@@ -259,9 +244,6 @@ public abstract class DistributedCacheTestCase
     remoteDefineEntry(regionName, entryName, scope, true);
   }
 
-
-  
-  
   /**
    * Defines an entry in the Region with the given name and scope.  In
    * 3.0 this method create a subregion named <code>entryName</code>
@@ -313,7 +295,6 @@ public abstract class DistributedCacheTestCase
       "Defined Entry named '" + entryName + "' in region '" +
       sub.getFullPath() +"'");
   }
-  
 
   /**
    * Puts (or creates) a value in a subregion of <code>region</code>
@@ -357,8 +338,7 @@ public abstract class DistributedCacheTestCase
    throws CacheException {
      remotePut(regionName, entryName, value, Scope.DISTRIBUTED_NO_ACK);
    }
-                                  
-  
+
   /**
    * Replaces the value of an entry in a region in a remote VM
    *
@@ -471,11 +451,19 @@ public abstract class DistributedCacheTestCase
    * every VM that host knows about.
    */
   public void forEachVMInvoke(String methodName, Object[] args) {
+    forEachVMInvoke(getClass(), methodName, args);
+  }
+
+  /**
+   * Assumes there is only one host, and invokes the given method in
+   * every VM that host knows about.
+   */
+  public void forEachVMInvoke(Class<?> targetClass, String methodName, Object[] args)
{
     Host host = Host.getHost(0);
     int vmCount = host.getVMCount();
     for (int i=0; i<vmCount; i++) {
       LogWriterUtils.getLogWriter().info("Invoking " + methodName + "on VM#" + i);
-      host.getVM(i).invoke(this.getClass(), methodName, args);
+      host.getVM(i).invoke(targetClass, methodName, args);
     }
   }
 }


Mime
View raw message