1 | |
package org.jbehave.core.embedder; |
2 | |
|
3 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
4 | |
import org.apache.commons.lang.builder.ToStringStyle; |
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
public class EmbedderControls { |
10 | |
|
11 | 75 | private boolean batch = false; |
12 | 75 | private boolean skip = false; |
13 | 75 | private boolean generateViewAfterStories = true; |
14 | 75 | private boolean ignoreFailureInStories = false; |
15 | 75 | private boolean ignoreFailureInView = false; |
16 | 75 | private boolean verboseFailures = false; |
17 | 75 | private boolean verboseFiltering = false; |
18 | 75 | private String storyTimeouts = "300"; |
19 | 75 | private int threads = 1; |
20 | 75 | private boolean failOnStoryTimeout = false; |
21 | |
|
22 | 75 | public EmbedderControls() { |
23 | 75 | } |
24 | |
|
25 | |
public boolean batch() { |
26 | 35 | return batch; |
27 | |
} |
28 | |
|
29 | |
public boolean skip() { |
30 | 87 | return skip; |
31 | |
} |
32 | |
|
33 | |
public boolean generateViewAfterStories() { |
34 | 42 | return generateViewAfterStories; |
35 | |
} |
36 | |
|
37 | |
public boolean ignoreFailureInStories() { |
38 | 100 | return ignoreFailureInStories; |
39 | |
} |
40 | |
|
41 | |
public boolean ignoreFailureInView() { |
42 | 15 | return ignoreFailureInView; |
43 | |
} |
44 | |
|
45 | |
public boolean verboseFailures(){ |
46 | 54 | return verboseFailures; |
47 | |
} |
48 | |
|
49 | |
public boolean verboseFiltering() { |
50 | 8 | return verboseFiltering; |
51 | |
} |
52 | |
|
53 | |
public String storyTimeouts() { |
54 | 54 | return storyTimeouts; |
55 | |
} |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
public long storyTimeoutInSecs() { |
61 | |
try { |
62 | 6 | return Long.parseLong(storyTimeouts); |
63 | 0 | } catch (NumberFormatException e ){ |
64 | 0 | return 0; |
65 | |
} |
66 | |
} |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
public String storyTimeoutInSecsByPath() { |
72 | 6 | return storyTimeouts(); |
73 | |
} |
74 | |
|
75 | |
public boolean failOnStoryTimeout() { |
76 | 13 | return failOnStoryTimeout; |
77 | |
} |
78 | |
|
79 | |
public int threads() { |
80 | 209 | return threads; |
81 | |
} |
82 | |
|
83 | |
public EmbedderControls doBatch(boolean batch) { |
84 | 14 | this.batch = batch; |
85 | 14 | return this; |
86 | |
} |
87 | |
|
88 | |
public EmbedderControls doSkip(boolean skip) { |
89 | 12 | this.skip = skip; |
90 | 12 | return this; |
91 | |
} |
92 | |
|
93 | |
public EmbedderControls doGenerateViewAfterStories(boolean generateViewAfterStories) { |
94 | 14 | this.generateViewAfterStories = generateViewAfterStories; |
95 | 14 | return this; |
96 | |
} |
97 | |
|
98 | |
public EmbedderControls doIgnoreFailureInStories(boolean ignoreFailureInStories) { |
99 | 13 | this.ignoreFailureInStories = ignoreFailureInStories; |
100 | 13 | return this; |
101 | |
} |
102 | |
|
103 | |
public EmbedderControls doIgnoreFailureInView(boolean ignoreFailureInView) { |
104 | 12 | this.ignoreFailureInView = ignoreFailureInView; |
105 | 12 | return this; |
106 | |
} |
107 | |
|
108 | |
public EmbedderControls doVerboseFailures(boolean verboseFailures){ |
109 | 10 | this.verboseFailures = verboseFailures; |
110 | 10 | return this; |
111 | |
} |
112 | |
|
113 | |
public EmbedderControls doVerboseFiltering(boolean verboseFiltering){ |
114 | 9 | this.verboseFiltering = verboseFiltering; |
115 | 9 | return this; |
116 | |
} |
117 | |
|
118 | |
public EmbedderControls useStoryTimeouts(String storyTimeouts) { |
119 | 35 | this.storyTimeouts = storyTimeouts; |
120 | 35 | return this; |
121 | |
} |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
public EmbedderControls useStoryTimeoutInSecs(long storyTimeoutInSecs) { |
127 | 9 | useStoryTimeouts(Long.toString(storyTimeoutInSecs)); |
128 | 9 | return this; |
129 | |
} |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
public EmbedderControls useStoryTimeoutInSecsByPath(String storyTimeoutInSecsByPath) { |
135 | 0 | useStoryTimeouts(storyTimeoutInSecsByPath); |
136 | 0 | return this; |
137 | |
} |
138 | |
|
139 | |
public EmbedderControls doFailOnStoryTimeout(boolean failOnStoryTimeout) { |
140 | 21 | this.failOnStoryTimeout = failOnStoryTimeout; |
141 | 21 | return this; |
142 | |
} |
143 | |
|
144 | |
public EmbedderControls useThreads(int threads) { |
145 | 10 | this.threads = threads; |
146 | 10 | return this; |
147 | |
} |
148 | |
|
149 | |
@Override |
150 | |
public String toString() { |
151 | 52 | return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); |
152 | |
} |
153 | |
} |