From 3e8cd4aef089a228d7f2e141f2b2159f820a4266 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Thu, 15 Jun 2017 13:13:43 +0300 Subject: [PATCH 1/1] Fixing exclude filter bug & adding query cache flushing refs #7305 Change-Id: I16b48b8d0aa4cb19a1cbc60084d046ec83d20187 --- .../tests/modelled/junit/v2/ModelledSTSRunner.java | 13 ++++++++++++- .../modelled/junit/v2/ModelledSTSSuiteRunner.java | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java index 31077a080..393174906 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java @@ -13,12 +13,17 @@ import org.junit.runner.notification.RunNotifier; import org.junit.runners.ParentRunner; import org.junit.runners.model.InitializationError; import org.simantics.Simantics; +import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.db.testing.common.AcornTests; import org.simantics.tests.modelled.utils.ModelledSTSSuite; import org.simantics.tests.modelled.utils.STSSuiteTestCollector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ModelledSTSRunner extends ParentRunner { + private static final Logger LOGGER = LoggerFactory.getLogger(ModelledSTSRunner.class); + public static final String INCLUSION_FILTER = "org.simantics.tests.modelled.singleTestIncludeFilter"; public static final String EXCLUSION_FILTER = "org.simantics.tests.modelled.excludeFilter"; @@ -26,6 +31,7 @@ public class ModelledSTSRunner extends ParentRunner { public ModelledSTSRunner(Class testClass) throws InitializationError { super(testClass); + try { initialize0(); Collection suites = STSSuiteTestCollector.collectTests(); @@ -96,7 +102,12 @@ public class ModelledSTSRunner extends ParentRunner { @Override protected void runChild(ModelledSTSSuiteRunner child, RunNotifier notifier) { - child.run(notifier); + try { + child.run(notifier); + } finally { + // Clear query cache + Layer0Utils.queryDebugSupport("QueryControl.flush"); + } // TODO: Add coverage reporting to ModelledSTSRunner // CombinedCoverage cover = child.getCoverage(); // CoverageBuilder b = new CoverageBuilder(); diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java index ac42653e5..0bfb1f1ce 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java @@ -32,11 +32,11 @@ public class ModelledSTSSuiteRunner extends ParentRunner // Filter inclusions String inclusionFilter = System.getProperty(ModelledSTSRunner.INCLUSION_FILTER); for (ModelledSTSTest test : suite.getSortedChildren()) { - boolean add = false; + boolean add = true; if (exclusionFilter != null) { String[] filters = exclusionFilter.split(","); - if (!startsWithAny(test, filters)) { - add = true; + if (startsWithAny(test, filters)) { + add = false; } } if (inclusionFilter != null) { -- 2.43.2