use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class EmbedderTaskBehaviour method shouldCreateNewEmbedderWithExecutors.
@Test
public void shouldCreateNewEmbedderWithExecutors() {
// Given
AbstractEmbedderTask task = new AbstractEmbedderTask() {
};
// When
task.setExecutorsClass(MyExecutors.class.getName());
Embedder embedder = task.newEmbedder();
// Then
assertThat(embedder.executorService(), sameInstance(EXECUTOR_SERVICE));
}
use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class EmbedderTaskBehaviour method shouldCreateNewEmbedderWithSystemProperties.
@Test
public void shouldCreateNewEmbedderWithSystemProperties() throws IOException {
// Given
AbstractEmbedderTask task = new AbstractEmbedderTask() {
};
// When
Properties systemProperties = new Properties();
systemProperties.setProperty("one", "1");
systemProperties.setProperty("two", "2");
ByteArrayOutputStream out = new ByteArrayOutputStream();
systemProperties.store(out, "");
task.setSystemProperties(out.toString());
Embedder embedder = task.newEmbedder();
// Then
assertThat(embedder.systemProperties(), equalTo(systemProperties));
}
use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class AnnotationBuilder method buildEmbedder.
public Embedder buildEmbedder() {
if (!finder.isAnnotationPresent(UsingEmbedder.class)) {
return defaultEmbedder();
}
boolean batch = control(finder, "batch");
boolean skip = control(finder, "skip");
boolean generateViewAfterStories = control(finder, "generateViewAfterStories");
boolean ignoreFailureInStories = control(finder, "ignoreFailureInStories");
boolean ignoreFailureInView = control(finder, "ignoreFailureInView");
boolean verboseFailures = control(finder, "verboseFailures");
boolean verboseFiltering = control(finder, "verboseFiltering");
String storyTimeouts = finder.getAnnotatedValue(UsingEmbedder.class, String.class, "storyTimeouts");
long storyTimeoutInSecs = finder.getAnnotatedValue(UsingEmbedder.class, Long.class, "storyTimeoutInSecs");
String storyTimeoutInSecsByPath = finder.getAnnotatedValue(UsingEmbedder.class, String.class, "storyTimeoutInSecsByPath");
boolean failOnStoryTimeout = control(finder, "failOnStoryTimeout");
int threads = finder.getAnnotatedValue(UsingEmbedder.class, Integer.class, "threads");
Embedder embedder = embedder();
EmbedderControls embedderControls = embedder.embedderControls();
embedderControls.doBatch(batch).doSkip(skip).doGenerateViewAfterStories(generateViewAfterStories).doIgnoreFailureInStories(ignoreFailureInStories).doIgnoreFailureInView(ignoreFailureInView).doVerboseFailures(verboseFailures).doVerboseFiltering(verboseFiltering).doFailOnStoryTimeout(failOnStoryTimeout).useThreads(threads);
if (storyTimeoutInSecs != 0) {
embedderControls.useStoryTimeoutInSecs(storyTimeoutInSecs);
}
if (StringUtils.isNotBlank(storyTimeoutInSecsByPath)) {
embedderControls.useStoryTimeoutInSecsByPath(storyTimeoutInSecsByPath);
}
if (StringUtils.isNotBlank(storyTimeouts)) {
embedderControls.useStoryTimeouts(storyTimeouts);
}
Configuration configuration = buildConfiguration();
embedder.useConfiguration(configuration);
boolean useStepsFactory = finder.getAnnotatedValue(UsingEmbedder.class, Boolean.class, "stepsFactory");
if (useStepsFactory) {
embedder.useStepsFactory(buildStepsFactory(configuration));
} else {
embedder.useCandidateSteps(buildCandidateSteps(configuration));
}
List<String> metaFilters = finder.getAnnotatedValues(UsingEmbedder.class, String.class, "metaFilters");
if (!metaFilters.isEmpty()) {
embedder.useMetaFilters(metaFilters);
}
Properties systemProperties = loadProperties(finder.getAnnotatedValue(UsingEmbedder.class, String.class, "systemProperties"));
if (!systemProperties.isEmpty()) {
embedder.useSystemProperties(systemProperties);
}
return embedder;
}
use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class MapStoriesAsEmbeddables method execute.
public void execute() throws BuildException {
Embedder embedder = newEmbedder();
log("Mapping stories as embeddables using embedder " + embedder, MSG_INFO);
embedder.runAsEmbeddables(classNames());
}
use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class MapStoriesAsPaths method execute.
public void execute() throws BuildException {
Embedder embedder = newEmbedder();
log("Mapping stories as paths using embedder " + embedder, MSG_INFO);
embedder.mapStoriesAsPaths(storyPaths());
}
Aggregations