EmbedderControls.java

  1. package org.jbehave.core.embedder;

  2. import org.apache.commons.lang3.builder.ToStringBuilder;
  3. import org.apache.commons.lang3.builder.ToStringStyle;

  4. /**
  5.  * Holds values used by the Embedder to control execution flow.
  6.  */
  7. public class EmbedderControls {

  8.     private boolean batch = false;
  9.     private boolean skip = false;
  10.     private boolean generateViewAfterStories = true;
  11.     private boolean ignoreFailureInStories = false;
  12.     private boolean ignoreFailureInView = false;
  13.     private boolean verboseFailures = false;
  14.     private boolean verboseFiltering = false;
  15.     private String storyTimeouts = "300";
  16.     private int threads = 1;
  17.     private boolean failOnStoryTimeout = false;

  18.     public EmbedderControls() {
  19.     }

  20.     public boolean batch() {
  21.         return batch;
  22.     }

  23.     public boolean skip() {
  24.         return skip;
  25.     }

  26.     public boolean generateViewAfterStories() {
  27.         return generateViewAfterStories;
  28.     }

  29.     public boolean ignoreFailureInStories() {
  30.         return ignoreFailureInStories;
  31.     }

  32.     public boolean ignoreFailureInView() {
  33.         return ignoreFailureInView;
  34.     }

  35.     public boolean verboseFailures() {
  36.         return verboseFailures;
  37.     }

  38.     public boolean verboseFiltering() {
  39.         return verboseFiltering;
  40.     }

  41.     public String storyTimeouts() {
  42.         return storyTimeouts;
  43.     }

  44.     public boolean failOnStoryTimeout() {
  45.         return failOnStoryTimeout;
  46.     }

  47.     public int threads() {
  48.         return threads;
  49.     }

  50.     public EmbedderControls doBatch(boolean batch) {
  51.         this.batch = batch;
  52.         return this;
  53.     }

  54.     public EmbedderControls doSkip(boolean skip) {
  55.         this.skip = skip;
  56.         return this;
  57.     }

  58.     public EmbedderControls doGenerateViewAfterStories(boolean generateViewAfterStories) {
  59.         this.generateViewAfterStories = generateViewAfterStories;
  60.         return this;
  61.     }

  62.     public EmbedderControls doIgnoreFailureInStories(boolean ignoreFailureInStories) {
  63.         this.ignoreFailureInStories = ignoreFailureInStories;
  64.         return this;
  65.     }

  66.     public EmbedderControls doIgnoreFailureInView(boolean ignoreFailureInView) {
  67.         this.ignoreFailureInView = ignoreFailureInView;
  68.         return this;
  69.     }

  70.     public EmbedderControls doVerboseFailures(boolean verboseFailures) {
  71.         this.verboseFailures = verboseFailures;
  72.         return this;        
  73.     }

  74.     public EmbedderControls doVerboseFiltering(boolean verboseFiltering) {
  75.         this.verboseFiltering = verboseFiltering;
  76.         return this;        
  77.     }

  78.     public EmbedderControls useStoryTimeouts(String storyTimeouts) {
  79.         this.storyTimeouts = storyTimeouts;
  80.         return this;
  81.     }

  82.     public EmbedderControls doFailOnStoryTimeout(boolean failOnStoryTimeout) {
  83.         this.failOnStoryTimeout = failOnStoryTimeout;
  84.         return this;
  85.     }

  86.     public EmbedderControls useThreads(int threads) {
  87.         this.threads = threads;
  88.         return this;
  89.     }
  90.    
  91.     @Override
  92.     public String toString() {
  93.         return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
  94.     }
  95. }