Search in sources :

Example 46 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class GenerateStoriesView method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    Embedder embedder = newEmbedder();
    getLog().info("Generating stories view using embedder " + embedder);
    try {
        embedder.generateReportsView();
    } catch (RuntimeException e) {
        throw new MojoFailureException("Failed to generate stories view", e);
    }
}
Also used : MojoFailureException(org.apache.maven.plugin.MojoFailureException) Embedder(org.jbehave.core.embedder.Embedder)

Example 47 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class ReportStepdocsAsEmbeddables method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    Embedder embedder = newEmbedder();
    getLog().info("Reporting stepdocs as embeddables using embedder " + embedder);
    try {
        embedder.reportStepdocsAsEmbeddables(classNames());
    } catch (RuntimeException e) {
        throw new MojoFailureException("Failed to report stepdocs as embeddables", e);
    }
}
Also used : MojoFailureException(org.apache.maven.plugin.MojoFailureException) Embedder(org.jbehave.core.embedder.Embedder)

Example 48 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class RunStoriesAsEmbeddables method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    Embedder embedder = newEmbedder();
    getLog().info("Running stories as embeddables using embedder " + embedder);
    try {
        embedder.runAsEmbeddables(classNames());
    } catch (RuntimeException e) {
        throw new MojoFailureException("Failed to run stories as embeddables", e);
    }
}
Also used : MojoFailureException(org.apache.maven.plugin.MojoFailureException) Embedder(org.jbehave.core.embedder.Embedder)

Example 49 with Embedder

use of org.jbehave.core.embedder.Embedder 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;
}
Also used : EmbedderClassLoader(org.jbehave.core.embedder.EmbedderClassLoader) Embedder(org.jbehave.core.embedder.Embedder) ConfigurableEmbedder(org.jbehave.core.ConfigurableEmbedder) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) URL(java.net.URL) ExecutorServiceFactory(org.jbehave.core.embedder.executors.ExecutorServiceFactory)

Example 50 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class GenerateStoriesView method execute.

public void execute() throws BuildException {
    Embedder embedder = newEmbedder();
    log("Generating stories view using embedder " + embedder, MSG_INFO);
    embedder.generateReportsView();
}
Also used : Embedder(org.jbehave.core.embedder.Embedder)

Aggregations

Embedder (org.jbehave.core.embedder.Embedder)56 Test (org.junit.Test)33 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)25 ConfigurableEmbedder (org.jbehave.core.ConfigurableEmbedder)10 MojoFailureException (org.apache.maven.plugin.MojoFailureException)8 EmbedderControls (org.jbehave.core.embedder.EmbedderControls)7 Configuration (org.jbehave.core.configuration.Configuration)6 MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)6 File (java.io.File)5 Properties (java.util.Properties)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)5 CandidateSteps (org.jbehave.core.steps.CandidateSteps)5 StoryPathResolver (org.jbehave.core.io.StoryPathResolver)4 HashSet (java.util.HashSet)3 Artifact (org.apache.maven.artifact.Artifact)3 Build (org.apache.maven.model.Build)3 MavenProject (org.apache.maven.project.MavenProject)3 ArchiverManager (org.codehaus.plexus.archiver.manager.ArchiverManager)3 StoryFinder (org.jbehave.core.io.StoryFinder)3