Search in sources :

Example 1 with BackendServiceLoader

use of io.cucumber.core.runtime.BackendServiceLoader 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);
}
Also used : BackendSupplier(io.cucumber.core.runtime.BackendSupplier) ObjectFactoryServiceLoader(io.cucumber.core.runtime.ObjectFactoryServiceLoader) SingletonRunnerSupplier(io.cucumber.core.runtime.SingletonRunnerSupplier) SingletonObjectFactorySupplier(io.cucumber.core.runtime.SingletonObjectFactorySupplier) ThreadLocalObjectFactorySupplier(io.cucumber.core.runtime.ThreadLocalObjectFactorySupplier) EventBus(io.cucumber.core.eventbus.EventBus) TimeServiceEventBus(io.cucumber.core.runtime.TimeServiceEventBus) TimeServiceEventBus(io.cucumber.core.runtime.TimeServiceEventBus) ExitStatus(io.cucumber.core.runtime.ExitStatus) ThreadLocalRunnerSupplier(io.cucumber.core.runtime.ThreadLocalRunnerSupplier) CucumberExecutionContext(io.cucumber.core.runtime.CucumberExecutionContext) SingletonRunnerSupplier(io.cucumber.core.runtime.SingletonRunnerSupplier) RunnerSupplier(io.cucumber.core.runtime.RunnerSupplier) ThreadLocalRunnerSupplier(io.cucumber.core.runtime.ThreadLocalRunnerSupplier) BackendServiceLoader(io.cucumber.core.runtime.BackendServiceLoader) PluginFactory(io.cucumber.core.plugin.PluginFactory) SingletonObjectFactorySupplier(io.cucumber.core.runtime.SingletonObjectFactorySupplier) ObjectFactorySupplier(io.cucumber.core.runtime.ObjectFactorySupplier) ThreadLocalObjectFactorySupplier(io.cucumber.core.runtime.ThreadLocalObjectFactorySupplier) Plugins(io.cucumber.core.plugin.Plugins)

Aggregations

EventBus (io.cucumber.core.eventbus.EventBus)1 PluginFactory (io.cucumber.core.plugin.PluginFactory)1 Plugins (io.cucumber.core.plugin.Plugins)1 BackendServiceLoader (io.cucumber.core.runtime.BackendServiceLoader)1 BackendSupplier (io.cucumber.core.runtime.BackendSupplier)1 CucumberExecutionContext (io.cucumber.core.runtime.CucumberExecutionContext)1 ExitStatus (io.cucumber.core.runtime.ExitStatus)1 ObjectFactoryServiceLoader (io.cucumber.core.runtime.ObjectFactoryServiceLoader)1 ObjectFactorySupplier (io.cucumber.core.runtime.ObjectFactorySupplier)1 RunnerSupplier (io.cucumber.core.runtime.RunnerSupplier)1 SingletonObjectFactorySupplier (io.cucumber.core.runtime.SingletonObjectFactorySupplier)1 SingletonRunnerSupplier (io.cucumber.core.runtime.SingletonRunnerSupplier)1 ThreadLocalObjectFactorySupplier (io.cucumber.core.runtime.ThreadLocalObjectFactorySupplier)1 ThreadLocalRunnerSupplier (io.cucumber.core.runtime.ThreadLocalRunnerSupplier)1 TimeServiceEventBus (io.cucumber.core.runtime.TimeServiceEventBus)1