1 package org.apache.maven.plugin.failsafe;
2
3 import java.util.ArrayList;
4 import java.util.Iterator;
5 import java.util.List;
6
7 import org.apache.maven.plugin.AbstractMojo;
8 import org.apache.maven.plugin.MojoExecutionException;
9
10
11
12
13
14
15
16
17
18
19 @SuppressWarnings( "all" )
20 public class HelpMojo
21 extends AbstractMojo
22 {
23
24
25
26
27
28 private boolean detail;
29
30
31
32
33
34
35 private java.lang.String goal;
36
37
38
39
40
41
42 private int lineLength;
43
44
45
46
47
48
49 private int indentSize;
50
51
52
53 public void execute()
54 throws MojoExecutionException
55 {
56 if ( lineLength <= 0 )
57 {
58 getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
59 lineLength = 80;
60 }
61 if ( indentSize <= 0 )
62 {
63 getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
64 indentSize = 2;
65 }
66
67 StringBuffer sb = new StringBuffer();
68
69 append( sb, "org.apache.maven.plugins:maven-failsafe-plugin:2.12", 0 );
70 append( sb, "", 0 );
71
72 append( sb, "Maven Failsafe Plugin", 0 );
73 append( sb, "Surefire is a test framework project.", 1 );
74 append( sb, "", 0 );
75
76 if ( goal == null || goal.length() <= 0 )
77 {
78 append( sb, "This plugin has 3 goals:", 0 );
79 append( sb, "", 0 );
80 }
81
82 if ( goal == null || goal.length() <= 0 || "help".equals( goal ) )
83 {
84 append( sb, "failsafe:help", 0 );
85 append( sb, "Display help information on maven-failsafe-plugin.\nCall\n\u00a0\u00a0mvn\u00a0failsafe:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 );
86 append( sb, "", 0 );
87 if ( detail )
88 {
89 append( sb, "Available parameters:", 1 );
90 append( sb, "", 0 );
91
92 append( sb, "detail (Default: false)", 2 );
93 append( sb, "If true, display all settable properties for each goal.", 3 );
94 append( sb, "Expression: ${detail}", 3 );
95 append( sb, "", 0 );
96
97 append( sb, "goal", 2 );
98 append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 );
99 append( sb, "Expression: ${goal}", 3 );
100 append( sb, "", 0 );
101
102 append( sb, "indentSize (Default: 2)", 2 );
103 append( sb, "The number of spaces per indentation level, should be positive.", 3 );
104 append( sb, "Expression: ${indentSize}", 3 );
105 append( sb, "", 0 );
106
107 append( sb, "lineLength (Default: 80)", 2 );
108 append( sb, "The maximum length of a display line, should be positive.", 3 );
109 append( sb, "Expression: ${lineLength}", 3 );
110 append( sb, "", 0 );
111 }
112 }
113
114 if ( goal == null || goal.length() <= 0 || "integration-test".equals( goal ) )
115 {
116 append( sb, "failsafe:integration-test", 0 );
117 append( sb, "Run integration tests using Surefire.", 1 );
118 append( sb, "", 0 );
119 if ( detail )
120 {
121 append( sb, "Available parameters:", 1 );
122 append( sb, "", 0 );
123
124 append( sb, "additionalClasspathElements", 2 );
125 append( sb, "Additional elements to be appended to the classpath.", 3 );
126 append( sb, "", 0 );
127
128 append( sb, "argLine", 2 );
129 append( sb, "Arbitrary JVM options to set on the command line.", 3 );
130 append( sb, "Expression: ${argLine}", 3 );
131 append( sb, "", 0 );
132
133 append( sb, "basedir (Default: ${basedir})", 2 );
134 append( sb, "The base directory of the project being tested. This can be obtained in your integration test via System.getProperty(\'basedir\').", 3 );
135 append( sb, "", 0 );
136
137 append( sb, "childDelegation (Default: false)", 2 );
138 append( sb, "When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode is not \'none\').\nSetting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.", 3 );
139 append( sb, "Expression: ${childDelegation}", 3 );
140 append( sb, "", 0 );
141
142 append( sb, "classesDirectory (Default: ${project.build.outputDirectory})", 2 );
143 append( sb, "The directory containing generated classes of the project being tested. This will be included after the test classes in the test classpath.", 3 );
144 append( sb, "", 0 );
145
146 append( sb, "classpathDependencyExcludes", 2 );
147 append( sb, "List of dependencies to exclude from the test classpath. Each dependency string must follow the format groupId:artifactId. For example: org.acme:project-a", 3 );
148 append( sb, "", 0 );
149
150 append( sb, "classpathDependencyScopeExclude", 2 );
151 append( sb, "A dependency scope to exclude from the test classpath. The scope should be one of the scopes defined by org.apache.maven.artifact.Artifact. This includes the following:\n-\tcompile - system, provided, compile\n-\truntime - compile, runtime\n-\tcompile+runtime - system, provided, compile, runtime\n-\truntime+system - system, compile, runtime\n-\ttest - system, provided, compile, runtime, test\n", 3 );
152 append( sb, "", 0 );
153
154 append( sb, "debugForkedProcess", 2 );
155 append( sb, "Attach a debugger to the forked JVM. If set to \'true\', the process will suspend and wait for a debugger to attach on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure arbitrary debuggability options (without overwriting the other options specified through the argLine parameter).", 3 );
156 append( sb, "Expression: ${maven.failsafe.debug}", 3 );
157 append( sb, "", 0 );
158
159 append( sb, "disableXmlReport (Default: false)", 2 );
160 append( sb, "Flag to disable the generation of report files in xml format.", 3 );
161 append( sb, "Expression: ${disableXmlReport}", 3 );
162 append( sb, "", 0 );
163
164 append( sb, "enableAssertions (Default: true)", 2 );
165 append( sb, "By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set this flag to \'false\'.", 3 );
166 append( sb, "Expression: ${enableAssertions}", 3 );
167 append( sb, "", 0 );
168
169 append( sb, "encoding (Default: ${project.reporting.outputEncoding})", 2 );
170 append( sb, "The character encoding scheme to be applied.", 3 );
171 append( sb, "Expression: ${encoding}", 3 );
172 append( sb, "", 0 );
173
174 append( sb, "environmentVariables", 2 );
175 append( sb, "Additional environment variables to set on the command line.", 3 );
176 append( sb, "", 0 );
177
178 append( sb, "excludedGroups", 2 );
179 append( sb, "(TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run.\nFor JUnit, this parameter forces the use of the 4.7 provider\nThis parameter is ignored if the suiteXmlFiles parameter is specified.", 3 );
180 append( sb, "Expression: ${excludedGroups}", 3 );
181 append( sb, "", 0 );
182
183 append( sb, "excludes", 2 );
184 append( sb, "A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be \n<excludes>\n\u00a0<exclude>**/*$*</exclude>\n</excludes>\n(which excludes all inner classes).\nThis parameter is ignored if the TestNG suiteXmlFiles parameter is specified. Each exclude item may also contain a comma-separated sublist of items, which will be treated as multiple \u00a0<exclude> entries.\n", 3 );
185 append( sb, "", 0 );
186
187 append( sb, "failIfNoSpecifiedTests", 2 );
188 append( sb, "Set this to \'true\' to cause a failure if the none of the tests specified in -Dtest=... are run. Defaults to \'true\'.", 3 );
189 append( sb, "Expression: ${it.failIfNoSpecifiedTests}", 3 );
190 append( sb, "", 0 );
191
192 append( sb, "failIfNoTests", 2 );
193 append( sb, "Set this to \'true\' to cause a failure if there are no tests to run. Defaults to \'false\'.", 3 );
194 append( sb, "Expression: ${failIfNoTests}", 3 );
195 append( sb, "", 0 );
196
197 append( sb, "forkedProcessTimeoutInSeconds", 2 );
198 append( sb, "Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out.", 3 );
199 append( sb, "Expression: ${failsafe.timeout}", 3 );
200 append( sb, "", 0 );
201
202 append( sb, "forkMode (Default: once)", 2 );
203 append( sb, "Option to specify the forking mode. Can be \'never\', \'once\', \'always\' or \'perthread\'. \'none\' and \'pertest\' are also accepted for backwards compatibility. \'always\' forks for each test-class. \'perthread\' will create \'threadCount\' parallel forks.", 3 );
204 append( sb, "Expression: ${forkMode}", 3 );
205 append( sb, "", 0 );
206
207 append( sb, "groups", 2 );
208 append( sb, "(TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included in test run, if specified.\nFor JUnit, this parameter forces the use of the 4.7 provider\nThis parameter is ignored if the suiteXmlFiles parameter is specified.", 3 );
209 append( sb, "Expression: ${groups}", 3 );
210 append( sb, "", 0 );
211
212 append( sb, "includes", 2 );
213 append( sb, "A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be \n<includes>\n\u00a0<include>**/IT*.java</include>\n\u00a0<include>**/*IT.java</include>\n\u00a0<include>**/*ITCase.java</include>\n</includes>\nEach include item may also contain a comma-separated sublist of items, which will be treated as multiple \u00a0<include> entries.\nThis parameter is ignored if the TestNG suiteXmlFiles parameter is specified.", 3 );
214 append( sb, "", 0 );
215
216 append( sb, "junitArtifactName (Default: junit:junit)", 2 );
217 append( sb, "Allows you to specify the name of the JUnit artifact. If not set, junit:junit will be used.", 3 );
218 append( sb, "Expression: ${junitArtifactName}", 3 );
219 append( sb, "", 0 );
220
221 append( sb, "jvm", 2 );
222 append( sb, "Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be a new instance of the same VM as the one used to run Maven. JVM settings are not inherited from MAVEN_OPTS.", 3 );
223 append( sb, "Expression: ${jvm}", 3 );
224 append( sb, "", 0 );
225
226 append( sb, "objectFactory", 2 );
227 append( sb, "(TestNG only) Define the factory class used to create all test instances.", 3 );
228 append( sb, "Expression: ${objectFactory}", 3 );
229 append( sb, "", 0 );
230
231 append( sb, "parallel", 2 );
232 append( sb, "(TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution. (JUnit 4.7 provider) Supports values \'classes\'/\'methods\'/\'both\' to run in separate threads, as controlled by threadCount.", 3 );
233 append( sb, "Expression: ${parallel}", 3 );
234 append( sb, "", 0 );
235
236 append( sb, "perCoreThreadCount (Default: true)", 2 );
237 append( sb, "(JUnit 4.7 provider) Indicates that threadCount is per cpu core.", 3 );
238 append( sb, "Expression: ${perCoreThreadCount}", 3 );
239 append( sb, "", 0 );
240
241 append( sb, "printSummary (Default: true)", 2 );
242 append( sb, "Option to print summary of test suites or just print the test cases that have errors.", 3 );
243 append( sb, "Expression: ${failsafe.printSummary}", 3 );
244 append( sb, "", 0 );
245
246 append( sb, "properties", 2 );
247 append( sb, "List of properties for configuring all TestNG related configurations. This is the new preferred method of configuring TestNG.", 3 );
248 append( sb, "", 0 );
249
250 append( sb, "redirectTestOutputToFile (Default: false)", 2 );
251 append( sb, "Set this to \'true\' to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).", 3 );
252 append( sb, "Expression: ${maven.test.redirectTestOutputToFile}", 3 );
253 append( sb, "", 0 );
254
255 append( sb, "remoteRepositories", 2 );
256 append( sb, "The remote plugin repositories declared in the POM.", 3 );
257 append( sb, "Expression: ${project.pluginArtifactRepositories}", 3 );
258 append( sb, "", 0 );
259
260 append( sb, "reportFormat (Default: brief)", 2 );
261 append( sb, "Selects the formatting for the test report to be generated. Can be set as \'brief\' or \'plain\'.", 3 );
262 append( sb, "Expression: ${failsafe.reportFormat}", 3 );
263 append( sb, "", 0 );
264
265 append( sb, "reportNameSuffix", 2 );
266 append( sb, "Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml, testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt. File TEST-testClassName-reportNameSuffix.xml has changed attributes \'testsuite\'--\'name\' and \'testcase\'--\'classname\' - reportNameSuffix is added to the attribute value.", 3 );
267 append( sb, "Expression: ${surefire.reportNameSuffix}", 3 );
268 append( sb, "", 0 );
269
270 append( sb, "reportsDirectory (Default: ${project.build.directory}/failsafe-reports)", 2 );
271 append( sb, "Base directory where all reports are written to.", 3 );
272 append( sb, "", 0 );
273
274 append( sb, "runOrder (Default: filesystem)", 2 );
275 append( sb, "Defines the order the tests will be run in. Supported values are \'alphabetical\', \'reversealphabetical\', \'random\', \'hourly\' (alphabetical on even hours, reverse alphabetical on odd hours), \'failedfirst\', \'balanced\' and \'filesystem\'. Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a multi-module build. Failed first will run tests that failed on previous run first, as well as new tests for this run. Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests to make all tests complete at the same time, reducing the overall execution time. Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not be checked into version control. The \'XXXXX\' is the SHA1 checksum of the entire surefire configuration, so different configurations will have different statistics files, meaning if you change any config settings you will re-run once before new statistics data can be established.", 3 );
276 append( sb, "", 0 );
277
278 append( sb, "skip (Default: false)", 2 );
279 append( sb, "Set this to \'true\' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using the \'maven.test.skip\' property, because maven.test.skip disables both running the tests and compiling the tests. Consider using the skipTests parameter instead.", 3 );
280 append( sb, "Expression: ${maven.test.skip}", 3 );
281 append( sb, "", 0 );
282
283 append( sb, "skipExec", 2 );
284 append( sb, "Deprecated. Use skipTests instead.", 3 );
285 append( sb, "", 0 );
286 append( sb, "This old parameter is just like skipTests, but bound to the old property \'maven.test.skip.exec\'.", 3 );
287 append( sb, "Expression: ${maven.test.skip.exec}", 3 );
288 append( sb, "", 0 );
289
290 append( sb, "skipITs", 2 );
291 append( sb, "Set this to \'true\' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.", 3 );
292 append( sb, "Expression: ${skipITs}", 3 );
293 append( sb, "", 0 );
294
295 append( sb, "skipTests (Default: false)", 2 );
296 append( sb, "Set this to \'true\' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.", 3 );
297 append( sb, "Expression: ${skipTests}", 3 );
298 append( sb, "", 0 );
299
300 append( sb, "suiteXmlFiles", 2 );
301 append( sb, "(TestNG only) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that suiteXmlFiles is incompatible with several other parameters of this plugin, like includes/excludes.\nThis parameter is ignored if the test parameter is specified (allowing you to run a single test instead of an entire suite).", 3 );
302 append( sb, "", 0 );
303
304 append( sb, "summaryFile", 2 );
305 append( sb, "The summary file to write integration test results to.", 3 );
306 append( sb, "Required: Yes", 3 );
307 append( sb, "Expression: ${project.build.directory}/failsafe-reports/failsafe-summary.xml", 3 );
308 append( sb, "", 0 );
309
310 append( sb, "systemProperties", 2 );
311 append( sb, "Deprecated. Use systemPropertyVariables instead.", 3 );
312 append( sb, "", 0 );
313 append( sb, "List of System properties to pass to the JUnit tests.", 3 );
314 append( sb, "", 0 );
315
316 append( sb, "systemPropertiesFile", 2 );
317 append( sb, "List of System properties, loaded from a file, to pass to the JUnit tests.", 3 );
318 append( sb, "", 0 );
319
320 append( sb, "systemPropertyVariables", 2 );
321 append( sb, "List of System properties to pass to the JUnit tests.", 3 );
322 append( sb, "", 0 );
323
324 append( sb, "test", 2 );
325 append( sb, "Specify this parameter to run individual tests by file name, overriding the includes/excludes parameters. Each pattern you specify here will be used to create an include pattern formatted like **/${test}.java, so you can just type \'-Dit.test=MyTest\' to run a single test called \'foo/MyTest.java\'.\nThis parameter overrides the includes/excludes parameters, and the TestNG suiteXmlFiles parameter. since 2.7.3 You can execute a limited number of method in the test with adding #myMethod or #my*ethod. Si type \'-Dtest=MyTest#myMethod\' supported for junit 4.x and testNg", 3 );
326 append( sb, "Expression: ${it.test}", 3 );
327 append( sb, "", 0 );
328
329 append( sb, "testClassesDirectory (Default: ${project.build.testOutputDirectory})", 2 );
330 append( sb, "The directory containing generated test classes of the project being tested. This will be included at the beginning of the test classpath.", 3 );
331 append( sb, "", 0 );
332
333 append( sb, "testNGArtifactName (Default: org.testng:testng)", 2 );
334 append( sb, "Allows you to specify the name of the TestNG artifact. If not set, org.testng:testng will be used.", 3 );
335 append( sb, "Expression: ${testNGArtifactName}", 3 );
336 append( sb, "", 0 );
337
338 append( sb, "testSourceDirectory (Default: ${project.build.testSourceDirectory})", 2 );
339 append( sb, "The test source directory containing test class sources.", 3 );
340 append( sb, "Required: Yes", 3 );
341 append( sb, "", 0 );
342
343 append( sb, "threadCount", 2 );
344 append( sb, "(forkMode=perthread or TestNG/JUnit 4.7 provider) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with the parallel parameter. (forkMode=perthread does not support/require the parallel parameter)", 3 );
345 append( sb, "Expression: ${threadCount}", 3 );
346 append( sb, "", 0 );
347
348 append( sb, "trimStackTrace (Default: true)", 2 );
349 append( sb, "Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.", 3 );
350 append( sb, "Expression: ${trimStackTrace}", 3 );
351 append( sb, "", 0 );
352
353 append( sb, "useFile (Default: true)", 2 );
354 append( sb, "Option to generate a file test report or just output the test report to the console.", 3 );
355 append( sb, "Expression: ${failsafe.useFile}", 3 );
356 append( sb, "", 0 );
357
358 append( sb, "useManifestOnlyJar (Default: true)", 2 );
359 append( sb, "By default, Surefire forks your tests using a manifest-only JAR; set this parameter to \'false\' to force it to launch your tests with a plain old Java classpath. (See http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html for a more detailed explanation of manifest-only JARs and their benefits.) Beware, setting this to \'false\' may cause your tests to fail on Windows if your classpath is too long.", 3 );
360 append( sb, "Expression: ${failsafe.useManifestOnlyJar}", 3 );
361 append( sb, "", 0 );
362
363 append( sb, "useSystemClassLoader (Default: true)", 2 );
364 append( sb, "Option to pass dependencies to the system\'s classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system\'s classloader.", 3 );
365 append( sb, "Expression: ${failsafe.useSystemClassLoader}", 3 );
366 append( sb, "", 0 );
367
368 append( sb, "useUnlimitedThreads (Default: false)", 2 );
369 append( sb, "(JUnit 4.7 provider) Indicates that the thread pool will be unlimited. The parallel parameter and the actual number of classes/methods will decide. Setting this to \'true\' effectively disables perCoreThreadCount and threadCount. Defaults to \'false\'.", 3 );
370 append( sb, "Expression: ${useUnlimitedThreads}", 3 );
371 append( sb, "", 0 );
372
373 append( sb, "workingDirectory", 2 );
374 append( sb, "Command line working directory.", 3 );
375 append( sb, "Expression: ${basedir}", 3 );
376 append( sb, "", 0 );
377 }
378 }
379
380 if ( goal == null || goal.length() <= 0 || "verify".equals( goal ) )
381 {
382 append( sb, "failsafe:verify", 0 );
383 append( sb, "Verify integration tests ran using Surefire.", 1 );
384 append( sb, "", 0 );
385 if ( detail )
386 {
387 append( sb, "Available parameters:", 1 );
388 append( sb, "", 0 );
389
390 append( sb, "basedir (Default: ${basedir})", 2 );
391 append( sb, "The base directory of the project being tested. This can be obtained in your unit test by System.getProperty(\'basedir\').", 3 );
392 append( sb, "", 0 );
393
394 append( sb, "encoding (Default: ${project.reporting.outputEncoding})", 2 );
395 append( sb, "The character encoding scheme to be applied.", 3 );
396 append( sb, "Expression: ${encoding}", 3 );
397 append( sb, "", 0 );
398
399 append( sb, "failIfNoTests", 2 );
400 append( sb, "Set this to \'true\' to cause a failure if there are no tests to run.", 3 );
401 append( sb, "Expression: ${failIfNoTests}", 3 );
402 append( sb, "", 0 );
403
404 append( sb, "reportsDirectory (Default: ${project.build.directory}/failsafe-reports)", 2 );
405 append( sb, "Base directory where all reports are written to.", 3 );
406 append( sb, "", 0 );
407
408 append( sb, "skip (Default: false)", 2 );
409 append( sb, "Set this to \'true\' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using the \'maven.test.skip\' property, because maven.test.skip disables both running the tests and compiling the tests. Consider using the skipTests parameter instead.", 3 );
410 append( sb, "Expression: ${maven.test.skip}", 3 );
411 append( sb, "", 0 );
412
413 append( sb, "skipExec", 2 );
414 append( sb, "Deprecated. Use -DskipTests instead.", 3 );
415 append( sb, "", 0 );
416 append( sb, "This old parameter is just like skipTests, but bound to the old property maven.test.skip.exec.", 3 );
417 append( sb, "Expression: ${maven.test.skip.exec}", 3 );
418 append( sb, "", 0 );
419
420 append( sb, "skipITs", 2 );
421 append( sb, "Set this to \'true\' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.", 3 );
422 append( sb, "Expression: ${skipITs}", 3 );
423 append( sb, "", 0 );
424
425 append( sb, "skipTests", 2 );
426 append( sb, "Set this to \'true\' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.", 3 );
427 append( sb, "Expression: ${skipTests}", 3 );
428 append( sb, "", 0 );
429
430 append( sb, "summaryFile", 2 );
431 append( sb, "The summary file to read integration test results from.", 3 );
432 append( sb, "Required: Yes", 3 );
433 append( sb, "Expression: ${project.build.directory}/failsafe-reports/failsafe-summary.xml", 3 );
434 append( sb, "", 0 );
435
436 append( sb, "summaryFiles", 2 );
437 append( sb, "Additional summary files to read integration test results from.", 3 );
438 append( sb, "", 0 );
439
440 append( sb, "testClassesDirectory (Default: ${project.build.testOutputDirectory})", 2 );
441 append( sb, "The directory containing generated test classes of the project being tested. This will be included at the beginning the test classpath.", 3 );
442 append( sb, "", 0 );
443
444 append( sb, "testFailureIgnore (Default: false)", 2 );
445 append( sb, "Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.", 3 );
446 append( sb, "Expression: ${maven.test.failure.ignore}", 3 );
447 append( sb, "", 0 );
448 }
449 }
450
451 if ( getLog().isInfoEnabled() )
452 {
453 getLog().info( sb.toString() );
454 }
455 }
456
457
458
459
460
461
462
463
464
465
466 private static String repeat( String str, int repeat )
467 {
468 StringBuffer buffer = new StringBuffer( repeat * str.length() );
469
470 for ( int i = 0; i < repeat; i++ )
471 {
472 buffer.append( str );
473 }
474
475 return buffer.toString();
476 }
477
478
479
480
481
482
483
484
485
486 private void append( StringBuffer sb, String description, int indent )
487 {
488 for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); )
489 {
490 sb.append( it.next().toString() ).append( '\n' );
491 }
492 }
493
494
495
496
497
498
499
500
501
502
503
504 private static List toLines( String text, int indent, int indentSize, int lineLength )
505 {
506 List<String> lines = new ArrayList<String>();
507
508 String ind = repeat( "\t", indent );
509 String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
510 for ( int i = 0; i < plainLines.length; i++ )
511 {
512 toLines( lines, ind + plainLines[i], indentSize, lineLength );
513 }
514
515 return lines;
516 }
517
518
519
520
521
522
523
524
525
526 private static void toLines( List<String> lines, String line, int indentSize, int lineLength )
527 {
528 int lineIndent = getIndentLevel( line );
529 StringBuffer buf = new StringBuffer( 256 );
530 String[] tokens = line.split( " +" );
531 for ( int i = 0; i < tokens.length; i++ )
532 {
533 String token = tokens[i];
534 if ( i > 0 )
535 {
536 if ( buf.length() + token.length() >= lineLength )
537 {
538 lines.add( buf.toString() );
539 buf.setLength( 0 );
540 buf.append( repeat( " ", lineIndent * indentSize ) );
541 }
542 else
543 {
544 buf.append( ' ' );
545 }
546 }
547 for ( int j = 0; j < token.length(); j++ )
548 {
549 char c = token.charAt( j );
550 if ( c == '\t' )
551 {
552 buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
553 }
554 else if ( c == '\u00A0' )
555 {
556 buf.append( ' ' );
557 }
558 else
559 {
560 buf.append( c );
561 }
562 }
563 }
564 lines.add( buf.toString() );
565 }
566
567
568
569
570
571
572
573 private static int getIndentLevel( String line )
574 {
575 int level = 0;
576 for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
577 {
578 level++;
579 }
580 for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
581 {
582 if ( line.charAt( i ) == '\t' )
583 {
584 level++;
585 break;
586 }
587 }
588 return level;
589 }
590 }