X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.tests.modelled%2Fsrc%2Forg%2Fsimantics%2Ftests%2Fmodelled%2Fjunit%2Fv2%2FModelledSTSRunner.java;h=e77224b58c72caa59b1e290831e817803844368e;hp=c74f6efaea0fb0485f377177eba45ecfe26191d2;hb=4789a20d317a245e03096df441baba1ab338c1f0;hpb=1cc487c3f6cf4b46b1fdd727183a9483e3bc05bb 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 c74f6efae..e77224b58 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 @@ -1,7 +1,8 @@ package org.simantics.tests.modelled.junit.v2; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import java.util.stream.Collectors; import org.eclipse.core.runtime.NullProgressMonitor; import org.junit.runner.Description; @@ -12,28 +13,30 @@ import org.junit.runners.ParentRunner; import org.junit.runners.model.InitializationError; import org.simantics.Simantics; import org.simantics.db.testing.common.AcornTests; -import org.simantics.scl.compiler.commands.CommandSession; -import org.simantics.scl.osgi.SCLOsgi; +import org.simantics.tests.modelled.utils.ModelledSTSSuite; import org.simantics.tests.modelled.utils.STSSuiteTestCollector; public class ModelledSTSRunner extends ParentRunner { - private CommandSession commandSession; + private final List children; - public ModelledSTSRunner(Class testClass) throws Exception { + public ModelledSTSRunner(Class testClass) throws InitializationError { super(testClass); - initialize0(); + try { + initialize0(); + Collection suites = STSSuiteTestCollector.collectTests(); + children = new ArrayList<>(suites.size()); + for (ModelledSTSSuite suite : suites) { + children.add(new ModelledSTSSuiteRunner(suite)); + } + } catch (Exception e) { + throw new InitializationError(e); + } } @Override protected List getChildren() { - return STSSuiteTestCollector.collectTests().stream().map(suite -> { - try { - return new ModelledSTSSuiteRunner(suite); - } catch (Exception e) { - throw new RuntimeException(e); - } - }).collect(Collectors.toList()); + return children; } @Override @@ -55,7 +58,6 @@ public class ModelledSTSRunner extends ParentRunner { @Override protected void runChild(ModelledSTSSuiteRunner child, RunNotifier notifier) { - child.setCommandSesssion(commandSession); child.run(notifier); // TODO: Add coverage reporting to ModelledSTSRunner // CombinedCoverage cover = child.getCoverage(); @@ -70,7 +72,6 @@ public class ModelledSTSRunner extends ParentRunner { private void initialize0() throws Exception { AcornTests.newSimanticsWorkspace(null, null); - this.commandSession = new CommandSession(SCLOsgi.MODULE_REPOSITORY, null); initialize(); }