use of io.cucumber.core.plugin.Plugins in project cucumber-jvm by cucumber.
the class CommandlineOptionsParserTest method set_strict_on_strict_aware_formatters.
@Test
void set_strict_on_strict_aware_formatters() {
RuntimeOptions options = parser.parse("--plugin", AwareFormatter.class.getName()).build();
Plugins plugins = new Plugins(new PluginFactory(), options);
plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
AwareFormatter formatter = (AwareFormatter) plugins.getPlugins().get(0);
assertThat(formatter.isStrict(), is(true));
}
use of io.cucumber.core.plugin.Plugins in project cucumber-jvm by cucumber.
the class CucumberOptionsAnnotationParserTest method create_without_options_with_base_class_without_options.
@Test
void create_without_options_with_base_class_without_options() {
Class<?> subClassWithMonoChromeTrueClass = WithoutOptionsWithBaseClassWithoutOptions.class;
RuntimeOptions runtimeOptions = parser().parse(subClassWithMonoChromeTrueClass).build();
Plugins plugins = new Plugins(new PluginFactory(), runtimeOptions);
plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
assertAll(() -> assertThat(runtimeOptions.getFeaturePaths(), contains(uri("classpath:/io/cucumber/core/options"))), () -> assertThat(runtimeOptions.getGlue(), contains(uri("classpath:/io/cucumber/core/options"))), () -> assertThat(plugins.getPlugins(), is(empty())));
}
use of io.cucumber.core.plugin.Plugins in project cucumber-jvm by cucumber.
the class CucumberOptionsAnnotationParserTest method create_without_options.
@Test
void create_without_options() {
RuntimeOptions runtimeOptions = parser().parse(WithoutOptions.class).build();
assertAll(() -> assertThat(runtimeOptions.getObjectFactoryClass(), is(nullValue())), () -> assertThat(runtimeOptions.getFeaturePaths(), contains(uri("classpath:/io/cucumber/core/options"))), () -> assertThat(runtimeOptions.getGlue(), contains(uri("classpath:/io/cucumber/core/options"))));
Plugins plugins = new Plugins(new PluginFactory(), runtimeOptions);
plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
assertAll(() -> assertThat(plugins.getPlugins(), is(empty())));
}
use of io.cucumber.core.plugin.Plugins in project cucumber-jvm by cucumber.
the class CucumberEngineExecutionContext method createCucumberExecutionContext.
private CucumberExecutionContext createCucumberExecutionContext() {
Supplier<ClassLoader> classLoader = CucumberEngineExecutionContext.class::getClassLoader;
ObjectFactoryServiceLoader objectFactoryServiceLoader = new ObjectFactoryServiceLoader(classLoader, options);
EventBus bus = synchronize(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
Plugins plugins = new Plugins(new PluginFactory(), options);
ExitStatus exitStatus = new ExitStatus(options);
plugins.addPlugin(exitStatus);
RunnerSupplier runnerSupplier;
if (options.isParallelExecutionEnabled()) {
plugins.setSerialEventBusOnEventListenerPlugins(bus);
ObjectFactorySupplier objectFactorySupplier = new ThreadLocalObjectFactorySupplier(objectFactoryServiceLoader);
BackendSupplier backendSupplier = new BackendServiceLoader(classLoader, objectFactorySupplier);
runnerSupplier = new ThreadLocalRunnerSupplier(options, bus, backendSupplier, objectFactorySupplier);
} else {
plugins.setEventBusOnEventListenerPlugins(bus);
ObjectFactorySupplier objectFactorySupplier = new SingletonObjectFactorySupplier(objectFactoryServiceLoader);
BackendSupplier backendSupplier = new BackendServiceLoader(classLoader, objectFactorySupplier);
runnerSupplier = new SingletonRunnerSupplier(options, bus, backendSupplier, objectFactorySupplier);
}
return new CucumberExecutionContext(bus, exitStatus, runnerSupplier);
}
use of io.cucumber.core.plugin.Plugins in project cucumber-jvm by cucumber.
the class CommandlineOptionsParserTest method creates_default_summary_printer_for_deprecated_default_summary_argument.
@Test
void creates_default_summary_printer_for_deprecated_default_summary_argument() {
RuntimeOptions options = parser.parse("--plugin default_summary").addDefaultSummaryPrinterIfNotDisabled().build();
Plugins plugins = new Plugins(new PluginFactory(), options);
plugins.setEventBusOnEventListenerPlugins(new TimeServiceEventBus(Clock.systemUTC(), UUID::randomUUID));
assertThat(plugins.getPlugins(), hasItem(plugin("io.cucumber.core.plugin.DefaultSummaryPrinter")));
}
Aggregations