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