public abstract class DevUtil extends AbstractContainerSupportUtil
| Modifier and Type | Class and Description |
|---|---|
class |
DevUtil.TestJob |
| Modifier and Type | Field and Description |
|---|---|
protected File |
buildFile |
protected List<String> |
destMount |
static String |
DEVC_HIDDEN_FOLDER |
static String |
DEVMODE_PROJECT_ROOT |
protected File |
generatedFeaturesFile |
protected AtomicBoolean |
hasFeaturesSh |
protected Map<String,List<String>> |
parentBuildFiles
Map of parent build files (parent build file, list of children build files)
|
protected AtomicBoolean |
serverFullyStarted |
static String |
SKIP_BETA_INSTALL_WARNING |
protected List<String> |
srcMount |
| Constructor and Description |
|---|
DevUtil(File buildDirectory,
File serverDirectory,
File sourceDirectory,
File testSourceDirectory,
File configDirectory,
File projectDirectory,
File multiModuleProjectDirectory,
List<File> resourceDirs,
boolean hotTests,
boolean skipTests,
boolean skipUTs,
boolean skipITs,
String applicationId,
long serverStartTimeout,
int appStartupTimeout,
int appUpdateTimeout,
long compileWaitMillis,
boolean libertyDebug,
boolean useBuildRecompile,
boolean gradle,
boolean pollingTest,
boolean container,
File dockerfile,
File dockerBuildContext,
String dockerRunOpts,
int dockerBuildTimeout,
boolean skipDefaultPorts,
JavaCompilerOptions compilerOptions,
boolean keepTempDockerfile,
String mavenCacheLocation,
List<ProjectModule> upstreamProjects,
boolean recompileDependencies,
String packagingType,
File buildFile,
Map<String,List<String>> parentBuildFiles,
boolean generateFeatures,
Set<String> compileArtifactPaths,
Set<String> testArtifactPaths,
List<Path> webResourceDirs) |
| Modifier and Type | Method and Description |
|---|---|
void |
addShutdownHook(ThreadPoolExecutor executor) |
protected void |
cleanTargetDir(File outputDirectory)
Delete all the Java class files within the specified directory.
|
void |
cleanUpServerEnv() |
void |
cleanUpTempConfig() |
void |
cleanUpTempDockerfile() |
abstract boolean |
compile(File dir)
Compile the specified directory
|
abstract boolean |
compile(File dir,
ProjectModule project)
Compile the specified directory for the project module
|
void |
copyFile(File fileChanged,
File srcDir,
File targetDir,
String targetFileName)
Copies the fileChanged from the srcDir to the targetDir.
|
int |
countApplicationUpdatedMessages()
Get the number of times the application updated message has appeared in the
application log
|
abstract void |
debug(String msg)
Log debug
|
abstract void |
debug(String msg,
Throwable e)
Log debug
|
abstract void |
debug(Throwable e)
Log debug
|
protected void |
deleteFile(File deletedFile,
File dir,
File targetDir,
String targetFileName)
Deletes the corresponding file in the targetDir.
|
protected void |
deleteJavaFile(File fileChanged,
File classesDir,
File compileSourceRoot)
Given the fileChanged delete the corresponding Java class or directory
|
protected void |
detectFeaturesSh(List<String> dockerfileLines) |
protected void |
disableOpenJ9SCC(List<String> dockerfileLines)
Disables OpenJ9 SCC to speed up build times by injecting environment variable before "RUN configure.sh" is called.
|
void |
enableServerDebug()
Enable server debug variables in server.env, using the user specified debug
port if it's available, otherwise uses a random available port.
|
abstract void |
error(String msg)
Log error
|
abstract void |
error(String msg,
Throwable e)
Log error
|
int |
findAvailablePort(int preferredPort,
boolean isDebugPort)
Finds an available port to use.
|
protected Set<File> |
getClassPath(Set<String> artifactPaths,
List<File> outputDirs)
Gets the class path for the specified artifactPaths and outputDirs.
|
protected static List<String> |
getCleanedLines(List<String> dockerfileLines)
Trim all lines and get them without comments or empty lines after the first FROM command
(so that directives at the beginning of the file are preserved)
|
protected static List<String> |
getCombinedLines(List<String> dockerfileLines,
char escape)
Combine multi-line commands into single lines.
|
Set<String> |
getCompileArtifacts() |
String |
getContainerName() |
Map<String,String> |
getDebugEnvironmentVariables()
Gets a map of the environment variables to set for debug mode.
|
protected static char |
getEscapeCharacter(List<String> dockerfileLines)
Get escape character from the escape directive at the top of the Dockerfile.
|
abstract Set<String> |
getExistingFeatures()
Get the set of existing features
|
protected File |
getFileFromConfigDirectory(String file)
Get the file from the configDirectory if it exists
|
String |
getHostName()
Gets the Liberty server's host name.
|
String |
getHttpPort()
Gets the Liberty server's http port.
|
String |
getHttpsPort()
Gets the Liberty server's https port.
|
Collection<String> |
getJavaSourceClassPaths() |
protected static File |
getLongestCommonDir(File dir1,
File dir2) |
abstract File |
getLooseApplicationFile()
Get the loose application configuration file.
|
static File |
getLooseAppProjectRoot(File projectDirectory,
File multiModuleProjectDirectory)
Get the root directory for mounting loose app in container.
|
protected Collection<File> |
getOmitFilesList(File looseAppFile,
String srcDirectoryPath)
Given the loose app file and the source directory path, return a list of
files that are specified in the loose app file and are in the source
directory and should be omitted from watching.
|
ProjectModule |
getProjectModule(File buildFile)
Given a build file returns the corresponding ProjectModule otherwise
returns null
|
abstract String |
getProjectName()
Get the name of the current project running dev mode.
|
abstract ServerFeatureUtil |
getServerFeatureUtilObj()
Get the ServerFeatureUtil object
|
abstract String |
getServerStartTimeoutExample()
Get an example command using the server start timeout parameter.
|
abstract io.openliberty.tools.ant.ServerTask |
getServerTask()
Get the ServerTask to start the server, which can be in either "run" or
"debug" mode
|
Set<String> |
getTestArtifacts() |
abstract void |
info(String msg)
Log info
|
abstract void |
installFeatures(File configFile,
File serverDir,
boolean generateFeatures)
Check the configuration file for new features and install features if needed
|
void |
installFeaturesToTempDir(File fileChanged,
File srcDir,
String targetFileName,
boolean generateFeaturesSuccess)
Creates a temporary copy of the configuration file and checks the configFile
in the temporary directory to avoid install-feature timing issues.
|
abstract boolean |
isDebugEnabled()
Returns whether debug is enabled by the current logger
|
protected boolean |
isGeneratedConfigFile(File fileChanged,
File srcDir,
File targetDir)
Determines if the corresponding target config file was generated by a Liberty
plugin
|
abstract boolean |
isLooseApplication()
Is the application deployed as a loose application.
|
boolean |
isMultiModuleProject()
Checks if upstreamProjects exist, indicating that this is a multi module
project
|
abstract void |
libertyCreate() |
abstract void |
libertyDeploy() |
abstract boolean |
libertyGenerateFeatures(Collection<String> classes,
boolean optimize)
Generate features for the application
|
abstract void |
libertyInstallFeature()
Install features in regular dev mode.
|
protected int |
parseHostName(String webAppMessage) |
protected void |
parseHttpPort(String webAppMessage,
int portPrefixIndex) |
protected void |
parseHttpsPort(List<String> messages) |
protected static String[] |
parseNetworks(String dockerResult)
Parses Docker network names from a "docker inspect" command result on a container.
|
protected File |
prepareTempDockerfile(File dockerfile,
String buildContextString) |
protected void |
processCopyLines(List<String> dockerfileLines,
String buildContext) |
protected List<String> |
readDockerfile(File dockerfile) |
String |
readFile(File file)
Reads the file to a String
|
abstract boolean |
recompileBuildFile(File buildFile,
Set<String> compileArtifactPaths,
Set<String> testArtifactPaths,
boolean generateFeatures,
ThreadPoolExecutor executor)
Recompile the build file
|
protected boolean |
recompileJava(Collection<File> javaFilesChanged,
Set<String> artifactPaths,
ThreadPoolExecutor executor,
boolean tests,
File outputDirectory,
File testOutputDirectory,
String projectName,
File projectBuildFile,
JavaCompilerOptions projectCompilerOptions,
boolean forceSkipUTs,
boolean skipRunningTests)
Recompile source files
|
protected boolean |
recompileJavaSource(Collection<File> javaFilesChanged,
Set<String> artifactPaths,
ThreadPoolExecutor executor,
File outputDirectory,
File testOutputDirectory,
String projectName,
File projectBuildFile,
JavaCompilerOptions projectCompilerOptions,
boolean forceSkipUTs,
boolean skipRunningTests)
Recompile Java source files and run tests after application update
|
protected boolean |
recompileJavaTest(Collection<File> javaFilesChanged,
Set<String> artifactPaths,
ThreadPoolExecutor executor,
File outputDirectory,
File testOutputDirectory,
String projectName,
File projectBuildFile,
JavaCompilerOptions projectCompilerOptions,
boolean forceSkipUTs,
boolean skipRunningTests)
Recompile test source files and run tests immediately
|
abstract void |
redeployApp()
Redeploy the application
|
protected void |
registerAll(Path start,
ThreadPoolExecutor executor)
Register the parent directory and all sub-directories with the WatchService
|
protected void |
registerAll(Path start,
ThreadPoolExecutor executor,
boolean removeOnContainerRebuild)
Register the parent directory and all sub-directories with the WatchService
|
protected void |
removeEarFileLines(List<String> dockerfileLines) |
protected static String |
removeSurroundingQuotes(String str) |
protected void |
removeWarFileLines(List<String> dockerfileLines) |
protected abstract void |
resourceDeleted(File fileChanged,
File resourceParent,
File outputDirectory) |
protected abstract void |
resourceDirectoryCreated() |
protected abstract void |
resourceModifiedOrCreated(File fileChanged,
File resourceParent,
File outputDirectory) |
void |
restartServer() |
void |
restartServer(boolean buildContainer)
Stop the server, set up Liberty and restart it.
|
void |
runHotkeyReaderThread(ThreadPoolExecutor executor)
Run a hotkey reader thread.
|
abstract void |
runIntegrationTests(File buildFile)
Run the integration tests
|
void |
runTests(boolean waitForApplicationUpdate,
int messageOccurrences,
ThreadPoolExecutor executor,
boolean forceSkipTests,
boolean forceSkipUTs,
boolean forceSkipITs,
File currentBuildFile,
String projectName)
Run unit and/or integration tests
|
void |
runTestThread(boolean waitForApplicationUpdate,
ThreadPoolExecutor executor,
int messageOccurrences,
boolean skipUnitTests,
boolean manualInvocation,
File... currentBuildFiles)
Run tests in a new thread.
|
void |
runTestThread(boolean waitForApplicationUpdate,
ThreadPoolExecutor executor,
int messageOccurrences,
boolean manualInvocation,
File... currentBuildFiles)
Run tests in a new thread.
|
abstract void |
runUnitTests(File buildFile)
Run the unit tests
|
void |
setDevStop(boolean devStop)
Whether dev mode intentionally caused the server to stop.
|
protected void |
setFeatureGeneration(boolean generateFeatures) |
void |
setLibertyDebugPort(int libertyDebugPort)
Sets the preferred debug port.
|
void |
setPropertyFiles(List<File> propertyFiles)
This is needed for Gradle only.
|
void |
startServer() |
void |
startServer(boolean buildContainer,
boolean pullParentImage)
Start the server and keep it running in a background thread.
|
abstract void |
stopServer()
Stop the server
|
protected void |
triggerMainModuleCompile(boolean testsOnly)
Trigger a compile of the entire main module.
|
protected void |
triggerUpstreamModuleCompile(ProjectModule project,
boolean testsOnly)
Trigger a compile of the entire specified module.
|
abstract boolean |
updateArtifactPaths(File parentBuildFile)
Update the compile artifact paths of any child modules of the given build
file.
|
abstract boolean |
updateArtifactPaths(ProjectModule projectModule,
boolean redeployCheck,
boolean generateFeatures,
ThreadPoolExecutor executor)
Updates the compile artifact paths of the given project module.
|
void |
updateJavaCompilerOptions(JavaCompilerOptions updatedCompilerOptions)
Updates the Java compiler options
|
protected abstract void |
updateLooseApp()
The intention here is to give a chance to run logic for an app update
but not necessarily a full re-deploy
|
abstract void |
warn(String msg)
Log warning
|
void |
watchFiles(File outputDirectory,
File testOutputDirectory,
ThreadPoolExecutor executor,
File serverXmlFile,
File bootstrapPropertiesFile,
File jvmOptionsFile)
Watch files for changes.
|
execDockerCmd, readStdOutpublic static final String DEVMODE_PROJECT_ROOT
public static final String SKIP_BETA_INSTALL_WARNING
public static final String DEVC_HIDDEN_FOLDER
protected AtomicBoolean hasFeaturesSh
protected AtomicBoolean serverFullyStarted
protected File buildFile
protected Map<String,List<String>> parentBuildFiles
protected final File generatedFeaturesFile
public DevUtil(File buildDirectory, File serverDirectory, File sourceDirectory, File testSourceDirectory, File configDirectory, File projectDirectory, File multiModuleProjectDirectory, List<File> resourceDirs, boolean hotTests, boolean skipTests, boolean skipUTs, boolean skipITs, String applicationId, long serverStartTimeout, int appStartupTimeout, int appUpdateTimeout, long compileWaitMillis, boolean libertyDebug, boolean useBuildRecompile, boolean gradle, boolean pollingTest, boolean container, File dockerfile, File dockerBuildContext, String dockerRunOpts, int dockerBuildTimeout, boolean skipDefaultPorts, JavaCompilerOptions compilerOptions, boolean keepTempDockerfile, String mavenCacheLocation, List<ProjectModule> upstreamProjects, boolean recompileDependencies, String packagingType, File buildFile, Map<String,List<String>> parentBuildFiles, boolean generateFeatures, Set<String> compileArtifactPaths, Set<String> testArtifactPaths, List<Path> webResourceDirs)
public abstract void debug(String msg)
debug in class AbstractContainerSupportUtilmsg - public abstract void debug(Throwable e)
e - public abstract void warn(String msg)
msg - public abstract void info(String msg)
msg - public abstract void error(String msg)
msg - public abstract void error(String msg, Throwable e)
error in class AbstractContainerSupportUtilmsg - e - public abstract boolean isDebugEnabled()
public abstract boolean recompileBuildFile(File buildFile, Set<String> compileArtifactPaths, Set<String> testArtifactPaths, boolean generateFeatures, ThreadPoolExecutor executor) throws PluginExecutionException
buildFile - compileArtifactPaths - testArtifactPaths - generateFeatures - boolean, true if auto generation of features is
onexecutor - The thread pool executorPluginExecutionException - if there was an error when restarting the
serverpublic abstract boolean updateArtifactPaths(ProjectModule projectModule, boolean redeployCheck, boolean generateFeatures, ThreadPoolExecutor executor) throws PluginExecutionException
projectModule - The corresponding project module to update artifact
paths forredeployCheck - Whether to redeploy the application if changes in the
dependencies are detectedgenerateFeatures - boolean, true if auto generation of features is onexecutor - The thread pool executorPluginExecutionException - if there was an error when restarting the
serverpublic abstract boolean updateArtifactPaths(File parentBuildFile)
parentBuildFile - The parent build filepublic abstract void runUnitTests(File buildFile) throws PluginScenarioException, PluginExecutionException
buildFile - corresponding build file to run tests onPluginScenarioException - if unit tests failedPluginExecutionException - if unit tests could not be runpublic abstract void runIntegrationTests(File buildFile) throws PluginScenarioException, PluginExecutionException
buildFile - corresponding buildFile to run tests onPluginScenarioException - if integration tests failedPluginExecutionException - if integration tests could not be runpublic abstract void installFeatures(File configFile, File serverDir, boolean generateFeatures)
configFile - serverDir - generateFeatures - public abstract ServerFeatureUtil getServerFeatureUtilObj()
public abstract Set<String> getExistingFeatures()
public abstract boolean compile(File dir)
dir - public abstract boolean compile(File dir, ProjectModule project)
dir - project - project module (used in multi-module scenario)public abstract void stopServer()
public abstract io.openliberty.tools.ant.ServerTask getServerTask()
throws Exception
Exception - if there was an error copying/creating config filespublic abstract void redeployApp()
throws PluginExecutionException
PluginExecutionExceptionpublic abstract String getServerStartTimeoutExample()
public abstract String getProjectName()
public abstract boolean isLooseApplication()
public abstract File getLooseApplicationFile()
public void runTests(boolean waitForApplicationUpdate,
int messageOccurrences,
ThreadPoolExecutor executor,
boolean forceSkipTests,
boolean forceSkipUTs,
boolean forceSkipITs,
File currentBuildFile,
String projectName)
waitForApplicationUpdate - Whether to wait for the application to update
before running integration testsmessageOccurrences - The previous number of times the application
updated message has appeared.executor - The thread pool executorforceSkipTests - Whether to force skip all testsforceSkipUTs - Whether to force skip the unit testsforceSkipITs - Whether to force skip the integration testscurrentBuildFile - The build file to run tests againstprojectName - The name of the current project, null if only
one project existspublic int countApplicationUpdatedMessages()
public void startServer()
throws PluginExecutionException
PluginExecutionExceptionpublic void startServer(boolean buildContainer,
boolean pullParentImage)
throws PluginExecutionException
buildContainer - Force a Docker build when in container mode. Ignored
otherwise.pullParentImage - If buildContainer is true, this determines whether the
Docker build should also pull the latest parent image.
Ignored otherwise.PluginExecutionException - If the server startup could not be verified
within the timeout, or server startup
failed.protected List<String> readDockerfile(File dockerfile) throws PluginExecutionException
PluginExecutionExceptionprotected static char getEscapeCharacter(List<String> dockerfileLines) throws PluginExecutionException
PluginExecutionExceptionprotected static List<String> getCleanedLines(List<String> dockerfileLines) throws PluginExecutionException
PluginExecutionExceptionprotected static List<String> getCombinedLines(List<String> dockerfileLines, char escape) throws PluginExecutionException
PluginExecutionExceptionprotected void removeWarFileLines(List<String> dockerfileLines) throws PluginExecutionException
PluginExecutionExceptionprotected void removeEarFileLines(List<String> dockerfileLines) throws PluginExecutionException
PluginExecutionExceptionprotected void disableOpenJ9SCC(List<String> dockerfileLines)
protected void processCopyLines(List<String> dockerfileLines, String buildContext) throws PluginExecutionException
PluginExecutionExceptionprotected abstract void updateLooseApp()
throws PluginExecutionException
PluginExecutionExceptionprotected File prepareTempDockerfile(File dockerfile, String buildContextString) throws PluginExecutionException
PluginExecutionExceptionpublic static File getLooseAppProjectRoot(File projectDirectory, File multiModuleProjectDirectory)
projectDirectory - The current project directory. Must not be null.multiModuleProjectDirectory - The multi module project directory. Can be null.protected static String[] parseNetworks(String dockerResult)
dockerResult - the result from the command "docker inspect -f '{{.NetworkSettings.Networks}}' containerName"
-> dockerResult must not contain surrounding quotes or leading/trailing whitespacepublic abstract void libertyCreate()
throws PluginExecutionException
PluginExecutionExceptionpublic abstract void libertyDeploy()
throws PluginExecutionException
PluginExecutionExceptionpublic abstract boolean libertyGenerateFeatures(Collection<String> classes, boolean optimize)
classes - class file paths features should be generated for (can be null if no modified classes)optimize - if true, generate optimized feature listpublic abstract void libertyInstallFeature()
throws PluginExecutionException
PluginExecutionExceptionpublic void restartServer()
throws PluginExecutionException
PluginExecutionExceptionpublic void restartServer(boolean buildContainer)
throws PluginExecutionException
buildContainer - Force a Docker build when in container mode. Ignored otherwise.PluginExecutionExceptionprotected int parseHostName(String webAppMessage) throws PluginExecutionException
PluginExecutionExceptionprotected void parseHttpPort(String webAppMessage, int portPrefixIndex)
protected void parseHttpsPort(List<String> messages) throws PluginExecutionException
PluginExecutionExceptionpublic void cleanUpServerEnv()
public void cleanUpTempConfig()
public void cleanUpTempDockerfile()
public void setDevStop(boolean devStop)
devStop - If true, stopping the server will not cause dev mode to print
an error message.public void addShutdownHook(ThreadPoolExecutor executor)
public Map<String,String> getDebugEnvironmentVariables() throws IOException
libertyDebugPort - the debug port to useIOExceptionpublic void enableServerDebug()
throws IOException
IOException - if there was an IO exception when reading or writing the
server.envpublic int findAvailablePort(int preferredPort,
boolean isDebugPort)
throws IOException
The - number of the port to start the search for an available port.Whether - to choose an ephemeral port. True to choose an ephemeral port,
false to search sequentially.IOException - if it could not find any available port, or there was an
error when opening a server socket regardless of port.public void runHotkeyReaderThread(ThreadPoolExecutor executor)
executor - the test thread executorprotected void setFeatureGeneration(boolean generateFeatures)
public void watchFiles(File outputDirectory, File testOutputDirectory, ThreadPoolExecutor executor, File serverXmlFile, File bootstrapPropertiesFile, File jvmOptionsFile) throws Exception
outputDirectory - testOutputDirectory - executor - compileArtifactPaths - Compile classpath elements, or null if this
DevUtil instance has useBuildRecompile=truetestArtifactPaths - Test classpath elements, or null if this
DevUtil instance has useBuildRecompile=trueserverXmlFile - Can be null when using the server.xml from the
configDirectory, which has a default value.bootstrapPropertiesFile - jvmOptionsFile - Exceptionpublic Collection<String> getJavaSourceClassPaths() throws IOException
IOExceptionprotected Collection<File> getOmitFilesList(File looseAppFile, String srcDirectoryPath)
looseAppFile - Loose Application configuration filesrcDirectoryPath - the source directory pathprotected abstract void resourceDirectoryCreated()
throws IOException
IOExceptionprotected abstract void resourceModifiedOrCreated(File fileChanged, File resourceParent, File outputDirectory) throws IOException
IOExceptionprotected abstract void resourceDeleted(File fileChanged, File resourceParent, File outputDirectory) throws IOException
IOExceptionprotected boolean isGeneratedConfigFile(File fileChanged, File srcDir, File targetDir) throws IOException
fileChanged - the file that was changedsrcDir - the directory of the file changedtargetDir - the target directoryIOException - unable to resolve canonical pathpublic String readFile(File file) throws IOException
file - IOException - unable to read file to stringpublic void installFeaturesToTempDir(File fileChanged, File srcDir, String targetFileName, boolean generateFeaturesSuccess) throws IOException
fileChanged - the file that was changedsrcDir - the directory of the file changedtargetFileName - if not null renames the fileChanged to
targetFileName in the targetDirgenerateFeaturesSuccess - if features were successfully generated, skip
install features if false. Defaults to true if
generateFeatures is offIOException - creating and copying to tempConfig directorypublic void copyFile(File fileChanged, File srcDir, File targetDir, String targetFileName) throws IOException
fileChanged - the file that was changedsrcDir - the directory of the file changedtargetDir - the target directorytargetFileName - if not null renames the fileChanged to targetFileName
in the targetDirIOException - unable to resolve canonical pathprotected void deleteFile(File deletedFile, File dir, File targetDir, String targetFileName) throws IOException
deletedFile - the file that was deleteddir - the directory of the deletedFiletargetDir - the corresponding targetDir of the deletedFiletargetFileName - if not null deletes the targetFile with this nameIOException - unable to resolve canonical pathprotected void cleanTargetDir(File outputDirectory)
outputDirectory - the directory for compiled classesprotected void registerAll(Path start, ThreadPoolExecutor executor) throws IOException
start - parent directoryexecutor - the test thread executorIOException - unable to walk through file treeprotected void registerAll(Path start, ThreadPoolExecutor executor, boolean removeOnContainerRebuild) throws IOException
start - parent directoryexecutor - the test thread executorremoveOnContainerRebuild - whether the files should be unwatched if the container is rebuiltIOException - unable to walk through file treeprotected File getFileFromConfigDirectory(String file)
file - protected void deleteJavaFile(File fileChanged, File classesDir, File compileSourceRoot) throws IOException
fileChanged - Java file changedclassesDir - the directory for compiled classescompileSourceRoot - the source directory for the Java classesIOException - unable to resolve canonical pathprotected boolean recompileJavaSource(Collection<File> javaFilesChanged, Set<String> artifactPaths, ThreadPoolExecutor executor, File outputDirectory, File testOutputDirectory, String projectName, File projectBuildFile, JavaCompilerOptions projectCompilerOptions, boolean forceSkipUTs, boolean skipRunningTests) throws PluginExecutionException
javaFilesChanged - collection of Java files changedartifactPaths - list of project artifact paths for building the classpathexecutor - the test thread executoroutputDirectory - the directory for compiled classestestOutputDirectory - the directory for compiled test classesprojectName - the name of the current project (artifactId), null if only one project existsprojectBuildFile - the build file of the current projectprojectCompilerOptions - the Java compiler options of the current projectforceSkipUTs - whether to force skipping the unit testsskipRunningTests - whether to skip running tests, takes precedence over the forceSkipUTs paramPluginExecutionException - if the classes output directory doesn't exist and can't be createdprotected boolean recompileJavaTest(Collection<File> javaFilesChanged, Set<String> artifactPaths, ThreadPoolExecutor executor, File outputDirectory, File testOutputDirectory, String projectName, File projectBuildFile, JavaCompilerOptions projectCompilerOptions, boolean forceSkipUTs, boolean skipRunningTests) throws PluginExecutionException
javaFilesChanged - collection of Java files changedartifactPaths - list of project artifact paths for building the classpathexecutor - the test thread executoroutputDirectory - the directory for compiled classestestOutputDirectory - the directory for compiled test classesprojectName - the name of the current project (artifactId), null if only one project existsprojectBuildFile - the build file of the current projectprojectCompilerOptions - the Java compiler options of the current projectforceSkipUTs - whether to force skipping the unit testsskipRunningTests - whether to skip running tests, takes precedence over the forceSkipUTs paramPluginExecutionException - if the classes output directory doesn't exist and can't be createdprotected boolean recompileJava(Collection<File> javaFilesChanged, Set<String> artifactPaths, ThreadPoolExecutor executor, boolean tests, File outputDirectory, File testOutputDirectory, String projectName, File projectBuildFile, JavaCompilerOptions projectCompilerOptions, boolean forceSkipUTs, boolean skipRunningTests) throws PluginExecutionException
javaFilesChanged - collection of Java files changedartifactPaths - list of project artifact paths for building the
classpathexecutor - the test thread executortests - indicates whether the files changed were test
filesoutputDirectory - the directory for compiled classestestOutputDirectory - the directory for compiled test classesprojectName - the name of the current project (artifactId),
null if only one project existsprojectBuildFile - the build file of the current projectprojectCompilerOptions - the Java compiler options of the current
projectforceSkipUTs - whether to force skipping the unit testsskipRunningTests - whether to skip running tests, takes
precedence over the forceSkipUTs paramPluginExecutionException - if the classes output directory doesn't
exist and can't be createdprotected Set<File> getClassPath(Set<String> artifactPaths, List<File> outputDirs) throws IOException
artifactPaths - list of artifacts for the current projectoutputDirs - list of output directories for the current projectIOException - unable to resolve canonical pathpublic void runTestThread(boolean waitForApplicationUpdate,
ThreadPoolExecutor executor,
int messageOccurrences,
boolean manualInvocation,
File... currentBuildFiles)
waitForApplicationUpdate - whether it should wait for the application to
update before running integration testsexecutor - the thread pool executormessageOccurrences - how many times the application updated
message has occurred in the logmanualInvocation - whether the tests were manually invokedcurrentBuildFiles - the build file(s) to run tests againstpublic void runTestThread(boolean waitForApplicationUpdate,
ThreadPoolExecutor executor,
int messageOccurrences,
boolean skipUnitTests,
boolean manualInvocation,
File... currentBuildFiles)
waitForApplicationUpdate - whether it should wait for the application to
update before running integration testsexecutor - the thread pool executormessageOccurrences - how many times the application updated
message has occurred in the logskipUnitTests - whether to skip the unit testsmanualInvocation - whether the tests were manually invokedcurrentBuildFiles - the build file(s) to run tests againstpublic String getHostName()
public String getHttpPort()
public String getHttpsPort()
public void setLibertyDebugPort(int libertyDebugPort)
libertyDebugPort - the preferred debug portpublic void setPropertyFiles(List<File> propertyFiles)
propertyFiles - list of property filespublic String getContainerName()
public void updateJavaCompilerOptions(JavaCompilerOptions updatedCompilerOptions)
updatedCompilerOptions - public ProjectModule getProjectModule(File buildFile) throws IOException
buildFile - IOExceptionpublic boolean isMultiModuleProject()
protected void triggerMainModuleCompile(boolean testsOnly)
throws IOException
testsOnly - true if ONLY tests should be compiledIOExceptionprotected void triggerUpstreamModuleCompile(ProjectModule project, boolean testsOnly) throws IOException
project - ProjectModule, the module to be compiledtestsOnly - true if ONLY tests should be compiledIOExceptionCopyright © 2022 the original author or authors.