Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static aQute.junit.constants.TesterConstants.TESTER_CONTINUOUS;
import static aQute.junit.constants.TesterConstants.TESTER_CONTROLPORT;
import static aQute.junit.constants.TesterConstants.TESTER_CUSTOMSERVICE;
import static aQute.junit.constants.TesterConstants.TESTER_DIR;
import static aQute.junit.constants.TesterConstants.TESTER_NAMES;
import static aQute.junit.constants.TesterConstants.TESTER_PORT;
Expand Down Expand Up @@ -88,11 +89,17 @@ public void start(BundleContext context) throws Exception {
this.context = context;
active = true;

boolean isCustomService = Boolean.valueOf(context.getProperty(TESTER_CUSTOMSERVICE));
if (!Boolean.valueOf(context.getProperty(TESTER_SEPARATETHREAD))
&& Boolean.valueOf(context.getProperty("launch.services"))) {
&& (isCustomService || Boolean.valueOf(context.getProperty("launch.services")))) {
// can't register services on mini framework
Hashtable<String, String> ht = new Hashtable<>();
ht.put("main.thread", "true");
if (isCustomService) {
ht.put("junit.tester", "true");
}
else {
ht.put("main.thread", "true");
}
ht.put(Constants.SERVICE_DESCRIPTION, "JUnit tester");
context.registerService(Runnable.class.getName(), this, ht);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ public interface TesterConstants {
* well to use this special thread to run all tests on.
*/
String TESTER_SEPARATETHREAD = "tester.separatethread";

/**
* Register the tester {@link java.lang.Runnable} as a service with the
* attribute {@code junit.tester=true}. User code may then obtain the
* service and run then tests when convenient.
*/
String TESTER_CUSTOMSERVICE = "tester.customservice";
}