Package org.jbehave.core.embedder

Examples of org.jbehave.core.embedder.Embedder


     * {@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;
    }
View Full Code Here


        Configuration configuration = new MostUsefulConfiguration()
                .useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder)
                .useFailureStrategy(new SilentlyAbsorbingFailure())
                .useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));

        Embedder embedder = new Embedder();
        embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
        embedder.useConfiguration(configuration);
        embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
        embedder.useMetaFilters(asList("-skip true"));

        try {
            embedder.runStoriesAsPaths(asList(storyPaths));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        AbstractEmbedderMojo mojo = new AbstractEmbedderMojo() {
            public void execute() throws MojoExecutionException, MojoFailureException {
            }
        };
        // When
        Embedder embedder = mojo.newEmbedder();
        // Then
        EmbedderControls embedderControls = embedder.embedderControls();
        assertThat(embedderControls.batch(), is(false));
        assertThat(embedderControls.generateViewAfterStories(), is(true));
        assertThat(embedderControls.ignoreFailureInStories(), is(false));
        assertThat(embedderControls.ignoreFailureInView(), is(false));
        assertThat(embedderControls.threads(), is(1));
View Full Code Here

        mojo.ignoreFailureInView = true;
        mojo.skip = true;
        mojo.storyTimeoutInSecs = 60;
        mojo.failOnStoryTimeout = true;
        mojo.threads = 2;
        Embedder embedder = mojo.newEmbedder();
        // Then
        EmbedderControls embedderControls = embedder.embedderControls();
        assertThat(embedderControls.batch(), is(true));
        assertThat(embedderControls.generateViewAfterStories(), is(false));
        assertThat(embedderControls.ignoreFailureInStories(), is(true));
        assertThat(embedderControls.ignoreFailureInView(), is(true));
        assertThat(embedderControls.skip(), is(true));
View Full Code Here

            public void execute() throws MojoExecutionException, MojoFailureException {
            }
        };
        // When
        mojo.executorsClass = MyExecutors.class.getName();
        Embedder embedder = mojo.newEmbedder();
        // Then
        assertThat(embedder.executorService(), sameInstance(EXECUTOR_SERVICE));
    }
View Full Code Here

            public void execute() throws MojoExecutionException, MojoFailureException {
            }
        };
        // When
        mojo.metaFilters = new String[] { "filter1", "filter2" };
        Embedder embedder = mojo.newEmbedder();
        // Then
        assertThat(embedder.metaFilters(), equalTo(asList("filter1", "filter2")));
    }
View Full Code Here

            public void execute() throws MojoExecutionException, MojoFailureException {
            }
        };
        // When
        mojo.metaFilters = new String[] { "filter1", null };
        Embedder embedder = mojo.newEmbedder();
        // Then
        assertThat(embedder.metaFilters(), equalTo(asList("filter1")));
    }
View Full Code Here

            public void execute() throws MojoExecutionException, MojoFailureException {
            }
        };
        mojo.setLog(log);
        // When
        Embedder embedder = mojo.newEmbedder();
        // Then
        EmbedderMonitor embedderMonitor = embedder.embedderMonitor();
        assertThat(embedderMonitor.toString(), containsString("MavenEmbedderMonitor"));

        // and verify monitor calls are propagated to Mojo Log
        BatchFailures failures = new BatchFailures();
        embedderMonitor.batchFailed(failures);
View Full Code Here

        // When
        Properties systemProperties = new Properties();
        systemProperties.setProperty("one", "1");
        systemProperties.setProperty("two", "2");
        mojo.systemProperties = systemProperties;
        Embedder embedder = mojo.newEmbedder();
        // Then
        assertThat(embedder.systemProperties(), equalTo(systemProperties));
    }
View Full Code Here

            public void execute() throws MojoExecutionException, MojoFailureException {
            }
        };
        // When
        mojo.embedderClass = MyEmbedder.class.getName();
        Embedder embedder = mojo.newEmbedder();
        // Then
        assertThat(embedder.getClass().getName(), equalTo(MyEmbedder.class.getName()));
    }
View Full Code Here

TOP

Related Classes of org.jbehave.core.embedder.Embedder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.