use of org.jbehave.core.embedder.executors.ExecutorServiceFactory in project jbehave-core by jbehave.
the class AbstractEmbedderMojo method newEmbedder.
/**
* Creates an instance of Embedder, either using
* {@link #injectableEmbedderClass} (if set) or defaulting to
* {@link #embedderClass}.
*
* @return An Embedder
*/
protected Embedder newEmbedder() {
Embedder embedder = null;
EmbedderClassLoader classLoader = classLoader();
if (injectableEmbedderClass != null) {
embedder = classLoader.newInstance(InjectableEmbedder.class, injectableEmbedderClass).injectedEmbedder();
} else {
embedder = classLoader.newInstance(Embedder.class, embedderClass);
}
URL codeLocation = codeLocation();
if (codeLocation != null) {
embedder.configuration().storyReporterBuilder().withCodeLocation(codeLocation);
}
embedder.useClassLoader(classLoader);
embedder.useEmbedderControls(embedderControls());
if (executorsClass != null) {
ExecutorServiceFactory executorServiceFactory = classLoader.newInstance(ExecutorServiceFactory.class, executorsClass);
embedder.useExecutorService(executorServiceFactory.create(embedder.embedderControls()));
}
embedder.useEmbedderMonitor(embedderMonitor());
if (isNotEmpty(metaFilters)) {
List<String> filters = new ArrayList<>();
for (String filter : metaFilters) {
if (filter != null) {
filters.add(filter);
}
}
embedder.useMetaFilters(filters);
}
if (!systemProperties.isEmpty()) {
embedder.useSystemProperties(systemProperties);
}
return embedder;
}
use of org.jbehave.core.embedder.executors.ExecutorServiceFactory in project jbehave-core by jbehave.
the class AbstractEmbedderTask method newEmbedder.
/**
* Creates an instance of Embedder, either using
* {@link #injectableEmbedderClass} (if set) or defaulting to
* {@link #embedderClass}.
*
* @return An Embedder
*/
protected Embedder newEmbedder() {
Embedder embedder = null;
EmbedderClassLoader classLoader = classLoader();
if (injectableEmbedderClass != null) {
embedder = classLoader.newInstance(InjectableEmbedder.class, injectableEmbedderClass).injectedEmbedder();
} else {
embedder = classLoader.newInstance(Embedder.class, embedderClass);
}
URL codeLocation = codeLocation();
if (codeLocation != null) {
embedder.configuration().storyReporterBuilder().withCodeLocation(codeLocation);
}
embedder.useClassLoader(classLoader);
embedder.useEmbedderControls(embedderControls());
if (executorsClass != null) {
ExecutorServiceFactory executorServiceFactory = classLoader.newInstance(ExecutorServiceFactory.class, executorsClass);
embedder.useExecutorService(executorServiceFactory.create(embedder.embedderControls()));
}
embedder.useEmbedderMonitor(embedderMonitor());
if (!metaFilters.isEmpty()) {
embedder.useMetaFilters(metaFilters);
}
if (!systemProperties.isEmpty()) {
embedder.useSystemProperties(systemProperties);
}
return embedder;
}
Aggregations