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