1 | |
package org.jbehave.core.configuration; |
2 | |
|
3 | |
import org.jbehave.core.Embeddable; |
4 | |
import org.jbehave.core.embedder.Embedder; |
5 | |
import org.jbehave.core.embedder.StoryControls; |
6 | |
import org.jbehave.core.failures.FailingUponPendingStep; |
7 | |
import org.jbehave.core.failures.FailureStrategy; |
8 | |
import org.jbehave.core.failures.PassingUponPendingStep; |
9 | |
import org.jbehave.core.failures.PendingStepStrategy; |
10 | |
import org.jbehave.core.failures.RethrowingFailure; |
11 | |
import org.jbehave.core.failures.SilentlyAbsorbingFailure; |
12 | |
import org.jbehave.core.i18n.LocalizedKeywords; |
13 | |
import org.jbehave.core.io.AbsolutePathCalculator; |
14 | |
import org.jbehave.core.io.LoadFromClasspath; |
15 | |
import org.jbehave.core.io.PathCalculator; |
16 | |
import org.jbehave.core.io.StoryLoader; |
17 | |
import org.jbehave.core.io.StoryPathResolver; |
18 | |
import org.jbehave.core.io.UnderscoredCamelCaseResolver; |
19 | |
import org.jbehave.core.parsers.RegexPrefixCapturingPatternParser; |
20 | |
import org.jbehave.core.parsers.RegexStoryParser; |
21 | |
import org.jbehave.core.parsers.StepPatternParser; |
22 | |
import org.jbehave.core.parsers.StoryParser; |
23 | |
import org.jbehave.core.reporters.ConsoleOutput; |
24 | |
import org.jbehave.core.reporters.FreemarkerViewGenerator; |
25 | |
import org.jbehave.core.reporters.PrintStreamStepdocReporter; |
26 | |
import org.jbehave.core.reporters.StepdocReporter; |
27 | |
import org.jbehave.core.reporters.StoryReporter; |
28 | |
import org.jbehave.core.reporters.StoryReporterBuilder; |
29 | |
import org.jbehave.core.reporters.ViewGenerator; |
30 | |
import org.jbehave.core.steps.MarkUnmatchedStepsAsPending; |
31 | |
import org.jbehave.core.steps.ParameterConverters; |
32 | |
import org.jbehave.core.steps.PrintStreamStepMonitor; |
33 | |
import org.jbehave.core.steps.SilentStepMonitor; |
34 | |
import org.jbehave.core.steps.StepCollector; |
35 | |
import org.jbehave.core.steps.StepFinder; |
36 | |
import org.jbehave.core.steps.StepMonitor; |
37 | |
|
38 | |
import com.thoughtworks.paranamer.NullParanamer; |
39 | |
import com.thoughtworks.paranamer.Paranamer; |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | 297 | public abstract class Configuration { |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 297 | private StoryControls storyControls = new StoryControls(); |
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | 297 | private Keywords keywords = new LocalizedKeywords(); |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | 297 | private StepCollector stepCollector = new MarkUnmatchedStepsAsPending(); |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | 297 | private StoryParser storyParser = new RegexStoryParser(keywords); |
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | 297 | private StoryLoader storyLoader = new LoadFromClasspath(); |
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | 297 | private StoryPathResolver storyPathResolver = new UnderscoredCamelCaseResolver(); |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | 297 | private FailureStrategy failureStrategy = new RethrowingFailure(); |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | 297 | private PendingStepStrategy pendingStepStrategy = new PassingUponPendingStep(); |
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | 297 | private StoryReporter defaultStoryReporter = new ConsoleOutput(); |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | 297 | private StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder(); |
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | 297 | private StepFinder stepFinder = new StepFinder(); |
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | 297 | private StepdocReporter stepdocReporter = new PrintStreamStepdocReporter(); |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | 297 | private StepPatternParser stepPatternParser = new RegexPrefixCapturingPatternParser(); |
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | 297 | private StepMonitor stepMonitor = new SilentStepMonitor(); |
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | 297 | private Paranamer paranamer = new NullParanamer(); |
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | 297 | private ParameterConverters parameterConverters = new ParameterConverters(); |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | 297 | private ViewGenerator viewGenerator = new FreemarkerViewGenerator(); |
155 | |
|
156 | 297 | private PathCalculator pathCalculator = new AbsolutePathCalculator(); |
157 | |
|
158 | |
public Keywords keywords() { |
159 | 363 | return keywords; |
160 | |
} |
161 | |
|
162 | |
public boolean dryRun() { |
163 | 2 | return storyControls.dryRun(); |
164 | |
} |
165 | |
|
166 | |
public StoryControls storyControls() { |
167 | 209 | return storyControls; |
168 | |
} |
169 | |
|
170 | |
public StoryParser storyParser() { |
171 | 5 | return storyParser; |
172 | |
} |
173 | |
|
174 | |
public StoryLoader storyLoader() { |
175 | 5 | return storyLoader; |
176 | |
} |
177 | |
|
178 | |
public StoryPathResolver storyPathResolver() { |
179 | 14 | return storyPathResolver; |
180 | |
} |
181 | |
|
182 | |
public FailureStrategy failureStrategy() { |
183 | 48 | return failureStrategy; |
184 | |
} |
185 | |
|
186 | |
public PendingStepStrategy pendingStepStrategy() { |
187 | 42 | return pendingStepStrategy; |
188 | |
} |
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
public StoryReporter defaultStoryReporter() { |
194 | 4 | return defaultStoryReporter; |
195 | |
} |
196 | |
|
197 | |
public StoryReporter storyReporter(String storyPath) { |
198 | 4 | return storyReporterBuilder.build(storyPath); |
199 | |
} |
200 | |
|
201 | |
public StoryReporterBuilder storyReporterBuilder() { |
202 | 129 | return storyReporterBuilder; |
203 | |
} |
204 | |
|
205 | |
public StepCollector stepCollector() { |
206 | 117 | return stepCollector; |
207 | |
} |
208 | |
|
209 | |
public StepFinder stepFinder() { |
210 | 4 | return stepFinder; |
211 | |
} |
212 | |
|
213 | |
public StepdocReporter stepdocReporter() { |
214 | 4 | return stepdocReporter; |
215 | |
} |
216 | |
|
217 | |
public StepPatternParser stepPatternParser() { |
218 | 66 | return stepPatternParser; |
219 | |
} |
220 | |
|
221 | |
public StepMonitor stepMonitor() { |
222 | 114 | return stepMonitor; |
223 | |
} |
224 | |
|
225 | |
public Paranamer paranamer() { |
226 | 67 | return paranamer; |
227 | |
} |
228 | |
|
229 | |
public ParameterConverters parameterConverters() { |
230 | 131 | return parameterConverters; |
231 | |
} |
232 | |
|
233 | |
public ViewGenerator viewGenerator() { |
234 | 21 | return viewGenerator; |
235 | |
} |
236 | |
|
237 | |
public PathCalculator pathCalculator() { |
238 | 2 | return pathCalculator; |
239 | |
} |
240 | |
|
241 | |
public Configuration useKeywords(Keywords keywords) { |
242 | 308 | this.keywords = keywords; |
243 | 308 | return this; |
244 | |
} |
245 | |
|
246 | |
public Configuration doDryRun(Boolean dryRun) { |
247 | 1 | this.storyControls.doDryRun(dryRun); |
248 | 1 | return this; |
249 | |
} |
250 | |
|
251 | |
public Configuration useStoryControls(StoryControls storyControls){ |
252 | 305 | this.storyControls = storyControls; |
253 | 305 | return this; |
254 | |
} |
255 | |
|
256 | |
public Configuration usePendingStepStrategy(PendingStepStrategy pendingStepStrategy) { |
257 | 329 | this.pendingStepStrategy = pendingStepStrategy; |
258 | 329 | return this; |
259 | |
} |
260 | |
|
261 | |
public Configuration useFailureStrategy(FailureStrategy failureStrategy) { |
262 | 328 | this.failureStrategy = failureStrategy; |
263 | 328 | return this; |
264 | |
} |
265 | |
|
266 | |
public Configuration useStoryParser(StoryParser storyParser) { |
267 | 328 | this.storyParser = storyParser; |
268 | 328 | return this; |
269 | |
} |
270 | |
|
271 | |
public Configuration useStoryLoader(StoryLoader storyLoader) { |
272 | 330 | this.storyLoader = storyLoader; |
273 | 330 | return this; |
274 | |
} |
275 | |
|
276 | |
public Configuration useStoryPathResolver(StoryPathResolver storyPathResolver) { |
277 | 14 | this.storyPathResolver = storyPathResolver; |
278 | 14 | return this; |
279 | |
} |
280 | |
|
281 | |
public Configuration useDefaultStoryReporter(StoryReporter storyReporter) { |
282 | 12 | this.defaultStoryReporter = storyReporter; |
283 | 12 | return this; |
284 | |
} |
285 | |
|
286 | |
public Configuration useStoryReporterBuilder(StoryReporterBuilder storyReporterBuilder) { |
287 | 128 | this.storyReporterBuilder = storyReporterBuilder; |
288 | 128 | return this; |
289 | |
} |
290 | |
|
291 | |
public Configuration useStepCollector(StepCollector stepCollector) { |
292 | 328 | this.stepCollector = stepCollector; |
293 | 328 | return this; |
294 | |
} |
295 | |
|
296 | |
public Configuration useStepFinder(StepFinder stepFinder) { |
297 | 309 | this.stepFinder = stepFinder; |
298 | 309 | return this; |
299 | |
} |
300 | |
|
301 | |
public Configuration useStepdocReporter(StepdocReporter stepdocReporter) { |
302 | 309 | this.stepdocReporter = stepdocReporter; |
303 | 309 | return this; |
304 | |
} |
305 | |
|
306 | |
public Configuration useStepPatternParser(StepPatternParser stepPatternParser) { |
307 | 305 | this.stepPatternParser = stepPatternParser; |
308 | 305 | return this; |
309 | |
} |
310 | |
|
311 | |
public Configuration useStepMonitor(StepMonitor stepMonitor) { |
312 | 305 | this.stepMonitor = stepMonitor; |
313 | 305 | return this; |
314 | |
} |
315 | |
|
316 | |
public Configuration useParanamer(Paranamer paranamer) { |
317 | 306 | this.paranamer = paranamer; |
318 | 306 | return this; |
319 | |
} |
320 | |
|
321 | |
public Configuration useParameterConverters(ParameterConverters parameterConverters) { |
322 | 12 | this.parameterConverters = parameterConverters; |
323 | 12 | return this; |
324 | |
} |
325 | |
|
326 | |
public Configuration useViewGenerator(ViewGenerator viewGenerator) { |
327 | 314 | this.viewGenerator = viewGenerator; |
328 | 314 | return this; |
329 | |
} |
330 | |
|
331 | |
public Configuration usePathCalculator(PathCalculator pathCalculator) { |
332 | 12 | this.pathCalculator = pathCalculator; |
333 | 12 | return this; |
334 | |
} |
335 | |
} |