]> gerrit.simantics Code Review - simantics/platform.git/blob
2acc58a794b818242234b6e4ad61c9cd0706ba5f
[simantics/platform.git] /
1 package org.simantics.tests.modelled.junit;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.List;
6
7 import org.junit.runner.Description;
8 import org.simantics.scl.compiler.commands.CommandSession;
9 import org.simantics.scl.osgi.SCLOsgi;
10
11 public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner<RuntimeSTSTestRunner> {
12
13     private final List<RuntimeSTSTestRunner> children = new ArrayList<>();
14     private final String suiteName;
15
16     protected RuntimeSTSSuiteRunner(Class<?> clazz, String suiteName) throws Exception {
17         super(clazz);
18         this.suiteName = suiteName;
19     }
20
21     @Override
22     protected String getName() {
23         return suiteName;
24     }
25
26     @Override
27     public Description getDescription() {
28         Description description = Description.createSuiteDescription(getName(), getRunnerAnnotations());
29         getChildren().forEach(child -> description.addChild(describeChild(child)));
30         return description;
31     }
32
33     public void addChildren(Collection<RuntimeSTSTestRunner> testChildren) {
34         CommandSession session = new CommandSession(SCLOsgi.MODULE_REPOSITORY, null);
35         testChildren.forEach(c -> c.setCommandSession(session));
36         children.addAll(testChildren);
37     }
38
39     @Override
40     public List<RuntimeSTSTestRunner> getChildren() {
41         return children;
42     }
43
44     @Override
45     public void initialize() throws Exception {
46     }
47
48     @Override
49     public void deinitialize() throws Exception {
50     }
51
52 }