Package org.apache.maven.plugin.surefire
Class SurefireHelper
- java.lang.Object
-
- org.apache.maven.plugin.surefire.SurefireHelper
-
public final class SurefireHelper extends java.lang.ObjectHelper class for surefire plugins
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDUMP_FILE_DATEstatic java.lang.StringDUMP_FILE_PREFIXstatic java.lang.StringDUMP_FILENAMEstatic java.lang.StringDUMP_FILENAME_FORMATTERprivate static java.lang.String[]DUMP_FILES_PRINTstatic java.lang.StringDUMPSTREAM_FILENAMEstatic java.lang.StringDUMPSTREAM_FILENAME_FORMATTERprivate static java.lang.StringFORK_NUMBER_PLACEHOLDERThe placeholder that is replaced by the executing fork's running number.private static intMAX_PATH_LENGTH_WINDOWSThe maximum path that does not require long path prefix on Windows.
Seesun/nio/fs/WindowsPathin OpenJDK and MSDN article.private static java.lang.StringTHREAD_NUMBER_PLACEHOLDERThe placeholder that is replaced by the executing thread's running number.
-
Constructor Summary
Constructors Modifier Constructor Description privateSurefireHelper()Do not instantiate.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<CommandLineOption>commandLineOptions(org.apache.maven.execution.MavenSession session, PluginConsoleLogger log)private static java.lang.StringcreateErrorMessage(SurefireReportParameters reportParameters, RunResult result, java.lang.Exception firstForkException)static java.lang.StringescapeToPlatformPath(java.lang.String path)Escape file path for Windows when the path is too long; otherwise returnspath.private static booleanfailIfNoTests(SurefireReportParameters reportParameters)static java.lang.String[]getDumpFilesToPrint()private static booleanisFatal(java.lang.Exception firstForkException)static voidlogDebugOrCliShowErrors(java.lang.String s, PluginConsoleLogger log, java.util.Collection<CommandLineOption> cli)static java.io.FilereplaceForkThreadsInPath(java.io.File path, int replacement)static java.lang.StringreplaceThreadNumberPlaceholders(java.lang.String argLine, int threadNumber)static voidreportExecution(SurefireReportParameters reportParameters, RunResult result, PluginConsoleLogger log, java.lang.Exception firstForkException)private static voidthrowException(SurefireReportParameters reportParameters, RunResult result, java.lang.Exception firstForkException)
-
-
-
Field Detail
-
DUMP_FILE_DATE
private static final java.lang.String DUMP_FILE_DATE
-
DUMP_FILE_PREFIX
public static final java.lang.String DUMP_FILE_PREFIX
-
DUMP_FILENAME_FORMATTER
public static final java.lang.String DUMP_FILENAME_FORMATTER
-
DUMPSTREAM_FILENAME_FORMATTER
public static final java.lang.String DUMPSTREAM_FILENAME_FORMATTER
-
DUMPSTREAM_FILENAME
public static final java.lang.String DUMPSTREAM_FILENAME
-
DUMP_FILENAME
public static final java.lang.String DUMP_FILENAME
-
MAX_PATH_LENGTH_WINDOWS
private static final int MAX_PATH_LENGTH_WINDOWS
The maximum path that does not require long path prefix on Windows.
Seesun/nio/fs/WindowsPathin OpenJDK and MSDN article.
The maximum path is 260 minus 1 (NUL) but for directories it is 260 minus 12 minus 1 (to allow for the creation of a 8.3 file in the directory).- See Also:
- Constant Field Values
-
DUMP_FILES_PRINT
private static final java.lang.String[] DUMP_FILES_PRINT
-
THREAD_NUMBER_PLACEHOLDER
private static final java.lang.String THREAD_NUMBER_PLACEHOLDER
The placeholder that is replaced by the executing thread's running number. The thread number range starts with 1 Deprecated.- See Also:
- Constant Field Values
-
FORK_NUMBER_PLACEHOLDER
private static final java.lang.String FORK_NUMBER_PLACEHOLDER
The placeholder that is replaced by the executing fork's running number. The fork number range starts with 1- See Also:
- Constant Field Values
-
-
Method Detail
-
replaceThreadNumberPlaceholders
@Nonnull public static java.lang.String replaceThreadNumberPlaceholders(@Nonnull java.lang.String argLine, int threadNumber)
-
replaceForkThreadsInPath
public static java.io.File replaceForkThreadsInPath(java.io.File path, int replacement)
-
getDumpFilesToPrint
public static java.lang.String[] getDumpFilesToPrint()
-
reportExecution
public static void reportExecution(SurefireReportParameters reportParameters, RunResult result, PluginConsoleLogger log, java.lang.Exception firstForkException) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionException
-
commandLineOptions
public static java.util.List<CommandLineOption> commandLineOptions(org.apache.maven.execution.MavenSession session, PluginConsoleLogger log)
-
logDebugOrCliShowErrors
public static void logDebugOrCliShowErrors(java.lang.String s, PluginConsoleLogger log, java.util.Collection<CommandLineOption> cli)
-
escapeToPlatformPath
public static java.lang.String escapeToPlatformPath(java.lang.String path)
Escape file path for Windows when the path is too long; otherwise returnspath.
See sun/nio/fs/WindowsPath for "long path" value explanation (=247), and MSDN article for detailed escaping strategy explanation: in short,\\?\prefix for path with drive letter or\\?\UNC\for UNC path.- Parameters:
path- source path- Returns:
- escaped to platform path
-
failIfNoTests
private static boolean failIfNoTests(SurefireReportParameters reportParameters)
-
isFatal
private static boolean isFatal(java.lang.Exception firstForkException)
-
throwException
private static void throwException(SurefireReportParameters reportParameters, RunResult result, java.lang.Exception firstForkException) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionException
-
createErrorMessage
private static java.lang.String createErrorMessage(SurefireReportParameters reportParameters, RunResult result, java.lang.Exception firstForkException)
-
-