use of org.junit.platform.launcher.LauncherDiscoveryListener in project junit5 by junit-team.
the class LauncherDiscoveryRequestBuilder method getLauncherDiscoveryListener.
private LauncherDiscoveryListener getLauncherDiscoveryListener(ConfigurationParameters configurationParameters) {
LauncherDiscoveryListener defaultDiscoveryListener = getDefaultLauncherDiscoveryListener(configurationParameters);
if (discoveryListeners.isEmpty()) {
return defaultDiscoveryListener;
}
if (discoveryListeners.contains(defaultDiscoveryListener)) {
return LauncherDiscoveryListeners.composite(discoveryListeners);
}
List<LauncherDiscoveryListener> allDiscoveryListeners = new ArrayList<>(discoveryListeners.size() + 1);
allDiscoveryListeners.addAll(discoveryListeners);
allDiscoveryListeners.add(defaultDiscoveryListener);
return LauncherDiscoveryListeners.composite(allDiscoveryListeners);
}
use of org.junit.platform.launcher.LauncherDiscoveryListener in project junit5 by junit-team.
the class LauncherDiscoveryRequestBuilder method build.
/**
* Build the {@link LauncherDiscoveryRequest} that has been configured via
* this builder.
*/
public LauncherDiscoveryRequest build() {
LauncherConfigurationParameters launcherConfigurationParameters = buildLauncherConfigurationParameters();
LauncherDiscoveryListener discoveryListener = getLauncherDiscoveryListener(launcherConfigurationParameters);
return new DefaultDiscoveryRequest(this.selectors, this.engineFilters, this.discoveryFilters, this.postDiscoveryFilters, launcherConfigurationParameters, discoveryListener);
}
use of org.junit.platform.launcher.LauncherDiscoveryListener in project junit5 by junit-team.
the class EngineDiscoveryOrchestrator method discover.
private Map<TestEngine, TestDescriptor> discover(LauncherDiscoveryRequest request, Phase phase, Function<String, UniqueId> uniqueIdCreator) {
LauncherDiscoveryListener listener = getLauncherDiscoveryListener(request);
listener.launcherDiscoveryStarted(request);
try {
return discoverSafely(request, phase, listener, uniqueIdCreator);
} finally {
listener.launcherDiscoveryFinished(request);
}
}
use of org.junit.platform.launcher.LauncherDiscoveryListener in project junit5 by junit-team.
the class EngineDiscoveryOrchestrator method discoverSafely.
private Map<TestEngine, TestDescriptor> discoverSafely(LauncherDiscoveryRequest request, Phase phase, LauncherDiscoveryListener listener, Function<String, UniqueId> uniqueIdCreator) {
Map<TestEngine, TestDescriptor> testEngineDescriptors = new LinkedHashMap<>();
for (TestEngine testEngine : this.testEngines) {
boolean engineIsExcluded = //
request.getEngineFilters().stream().map(//
engineFilter -> engineFilter.apply(testEngine)).anyMatch(FilterResult::excluded);
if (engineIsExcluded) {
logger.debug(() -> String.format("Test discovery for engine '%s' was skipped due to an EngineFilter in %s phase.", testEngine.getId(), phase));
continue;
}
logger.debug(() -> String.format("Discovering tests during Launcher %s phase in engine '%s'.", phase, testEngine.getId()));
TestDescriptor rootDescriptor = discoverEngineRoot(testEngine, request, listener, uniqueIdCreator);
testEngineDescriptors.put(testEngine, rootDescriptor);
}
List<PostDiscoveryFilter> filters = new LinkedList<>(postDiscoveryFilters);
filters.addAll(request.getPostDiscoveryFilters());
applyPostDiscoveryFilters(testEngineDescriptors, filters);
prune(testEngineDescriptors);
return testEngineDescriptors;
}
Aggregations