File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
biz.aQute.tester.junit-platform/src/aQute/tester/junit/platform
biz.aQute.tester/src/aQute/junit/constants Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 22
33import static aQute .junit .constants .TesterConstants .TESTER_CONTINUOUS ;
44import static aQute .junit .constants .TesterConstants .TESTER_CONTROLPORT ;
5+ import static aQute .junit .constants .TesterConstants .TESTER_CUSTOMSERVICE ;
56import static aQute .junit .constants .TesterConstants .TESTER_DIR ;
67import static aQute .junit .constants .TesterConstants .TESTER_NAMES ;
78import static aQute .junit .constants .TesterConstants .TESTER_PORT ;
@@ -88,11 +89,17 @@ public void start(BundleContext context) throws Exception {
8889 this .context = context ;
8990 active = true ;
9091
92+ boolean isCustomService = Boolean .valueOf (context .getProperty (TESTER_CUSTOMSERVICE ));
9193 if (!Boolean .valueOf (context .getProperty (TESTER_SEPARATETHREAD ))
92- && Boolean .valueOf (context .getProperty ("launch.services" ))) {
94+ && ( isCustomService || Boolean .valueOf (context .getProperty ("launch.services" ) ))) {
9395 // can't register services on mini framework
9496 Hashtable <String , String > ht = new Hashtable <>();
95- ht .put ("main.thread" , "true" );
97+ if (isCustomService ) {
98+ ht .put ("junit.tester" , "true" );
99+ }
100+ else {
101+ ht .put ("main.thread" , "true" );
102+ }
96103 ht .put (Constants .SERVICE_DESCRIPTION , "JUnit tester" );
97104 context .registerService (Runnable .class .getName (), this , ht );
98105 } else {
Original file line number Diff line number Diff line change @@ -66,4 +66,11 @@ public interface TesterConstants {
6666 * well to use this special thread to run all tests on.
6767 */
6868 String TESTER_SEPARATETHREAD = "tester.separatethread" ;
69+
70+ /**
71+ * Register the tester {@link java.lang.Runnable} as a service with the
72+ * attribute {@code junit.tester=true}. User code may then obtain the
73+ * service and run then tests when convenient.
74+ */
75+ String TESTER_CUSTOMSERVICE = "tester.customservice" ;
6976}
You can’t perform that action at this time.
0 commit comments