You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/05/20 17:10:56 UTC
[31/50] [abbrv] incubator-geode git commit: GEODE-1378: Don't launch
dunit VMs in checkMissedTests
GEODE-1378: Don't launch dunit VMs in checkMissedTests
Setting a system property to disable launching dunit VMs during
checkMissedTests.
DistributedLockServiceDUnitTest failed with this property set because it
was doing work in the constructor. I cleaned up the test to create the
blackboard in the set up method instead.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/18761c72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/18761c72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/18761c72
Branch: refs/heads/feature/GEODE-835
Commit: 18761c729396936e1f05dcfd69f344f5762dedb7
Parents: b3d9061
Author: Dan Smith <up...@apache.org>
Authored: Tue May 17 15:00:53 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Wed May 18 11:20:28 2016 -0700
----------------------------------------------------------------------
.../DistributedLockServiceDUnitTest.java | 46 +++++++++-----------
gradle/test.gradle | 4 ++
2 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/18761c72/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
index 42c3f01..5729bf6 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
@@ -54,10 +54,14 @@ import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
/**
* This class tests distributed ownership via the DistributedLockService api.
*/
+@Category(DistributedTest.class)
public class DistributedLockServiceDUnitTest extends DistributedTestCase {
protected static DistributedSystem dlstSystem;
@@ -72,25 +76,10 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
public DistributedLockServiceDUnitTest(String name) {
super(name);
- if (blackboard == null) {
- try {
- blackboard = DistributedLockBlackboardImpl.getInstance();
- } catch (Exception e) {
- throw new RuntimeException("initialization error", e);
- }
- }
}
/////////// Test lifecycle //////////
-
- public static void caseSetUp() throws Exception {
- disconnectAllFromDS();
- }
-
- public static void caseTearDown() throws Exception {
- disconnectAllFromDS();
- }
-
+
/**
* Returns a previously created (or new, if this is the first
* time this method is called in this VM) distributed system
@@ -98,23 +87,25 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
*/
@Override
public final void postSetUp() throws Exception {
+
+ createBlackboard();
+ Invoke.invokeInEveryVM(() -> createBlackboard());
+
// Create a DistributedSystem in every VM
connectDistributedSystem();
- for (int h = 0; h < Host.getHostCount(); h++) {
- Host host = Host.getHost(h);
+ Invoke.invokeInEveryVM(() -> connectDistributedSystem());
+ }
- for (int v = 0; v < host.getVMCount(); v++) {
- host.getVM(v).invoke(
- DistributedLockServiceDUnitTest.class, "connectDistributedSystem", null);
- }
+ private void createBlackboard() throws Exception {
+ if (blackboard == null) {
+ blackboard = DistributedLockBlackboardImpl.getInstance();
}
}
@Override
public final void preTearDown() throws Exception {
- Invoke.invokeInEveryVM(DistributedLockServiceDUnitTest.class,
- "destroyAllDLockServices");
+ Invoke.invokeInEveryVM(() -> destroyAllDLockServices());
// invokeInEveryVM(DistributedLockServiceDUnitTest.class,
// "remoteDumpAllDLockServices");
@@ -126,7 +117,12 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
this.lockGrantor = null;
}
-
+
+ @Override
+ public void postTearDown() throws Exception {
+ disconnectAllFromDS();
+ }
+
public static void destroyAllDLockServices() {
DLockService.destroyAll();
dlstSystem = null;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/18761c72/gradle/test.gradle
----------------------------------------------------------------------
diff --git a/gradle/test.gradle b/gradle/test.gradle
index 96fbfc5..1d3701f 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -80,6 +80,10 @@ subprojects {
excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
}
+ //Skip launching any DUnit VMs during this run. This will prevent
+ //junit from launching VMs while parsing categories
+ systemProperty 'gemfire.DUnitLauncher.LAUNCHED', 'true'
+
beforeTest { descriptor ->
throw new GradleException("The test " + descriptor.getClassName() + "." + descriptor.getName() + " does not include a junit category.");
}