getDependencyIarJars() {
if (!Files.exists(iarJarClasspath)) {
return Collections.emptyList();
}
- var iarJars = new ClasspathJar(iarJarClasspath).getFiles();
- return iarJars;
+ return new ClasspathJar(iarJarClasspath).getFiles();
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java b/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java
index 978f7c05..5d4d064c 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java
@@ -156,9 +156,9 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo {
*
*
* deployTestUsers: auto
- *target:
- * version: RELEASED
- * state: ACTIVE_AND_RELEASED
+ * target:
+ * version: RELEASED
+ * state: ACTIVE_AND_RELEASED
*
*
*
@@ -168,9 +168,9 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo {
*
*
* deployTestUsers: ${ivy.deploy.test.users}
- *target:
- * version: AUTO
- * state: ${ivy.deploy.target.state}
+ * target:
+ * version: AUTO
+ * state: ${ivy.deploy.target.state}
*
*
*
@@ -211,9 +211,7 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo {
@Parameter(property = "ivy.deploy.engine.app")
String deployToEngineApplication;
- public AbstractDeployMojo() {
- super();
- }
+ public AbstractDeployMojo() {}
protected final boolean checkSkip() {
if (skipDeploy) {
@@ -228,7 +226,7 @@ protected final boolean checkSkip() {
}
protected final Path createDeployOptionsFile(DeploymentOptionsFileFactory optionsFileFactory)
- throws MojoExecutionException {
+ throws MojoExecutionException {
if (deployOptionsFile != null) {
return optionsFileFactory.createFromTemplate(deployOptionsFile, project, session, fileFilter);
}
@@ -255,7 +253,7 @@ protected static void deleteFile(Path file) {
}
protected final void deployToDirectory(Path resolvedOptionsFile, Path deployDir)
- throws MojoExecutionException {
+ throws MojoExecutionException {
var targetDeployableFile = createTargetDeployableFile(deployDir);
String deployablePath = deployDir.relativize(targetDeployableFile).toString();
IvyDeployer deployer = new FileDeployer(deployDir, resolvedOptionsFile, deployTimeoutInSeconds, deployFile, targetDeployableFile);
@@ -264,7 +262,7 @@ protected final void deployToDirectory(Path resolvedOptionsFile, Path deployDir)
private final Path createTargetDeployableFile(Path deployDir) {
return deployDir
- .resolve(deployToEngineApplication)
- .resolve(deployFile.getFileName().toString());
+ .resolve(deployToEngineApplication)
+ .resolve(deployFile.getFileName().toString());
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java
index 0a19f64e..77253ecb 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java
@@ -135,7 +135,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
if (StringUtils.isEmpty(deployToEngineApplication)) {
throw new MojoExecutionException(
- "The parameter 'deployToEngineApplication' for goal " + GOAL + " is missing.");
+ "The parameter 'deployToEngineApplication' for goal " + GOAL + " is missing.");
}
var resolvedOptionsFile = createDeployOptionsFile(new DeploymentOptionsFileFactory(deployFile));
@@ -154,8 +154,8 @@ private void deployWithOptions(Path resolvedOptionsFile) throws MojoExecutionExc
deployToRestService(resolvedOptionsFile);
} else {
getLog().warn("Invalid deploy method " + deployMethod
- + " configured in parameter deployMethod (Supported values are " + DeployMethod.DIRECTORY + ", "
- + DeployMethod.HTTP + ")");
+ + " configured in parameter deployMethod (Supported values are " + DeployMethod.DIRECTORY + ", "
+ + DeployMethod.HTTP + ")");
}
}
@@ -163,13 +163,13 @@ private void deployToDirectory(Path resolvedOptionsFile) throws MojoExecutionExc
var deployDir = getDeployDirectory();
if (deployEngineDirectory == null) {
getLog().warn("Skipping deployment, target engine could not be evaluated." +
- "Please configure an existing engine to deploy to with argument .");
+ "Please configure an existing engine to deploy to with argument .");
return;
}
if (!Files.exists(deployDir)) {
getLog().warn("Skipping deployment to engine '" + deployEngineDirectory + "'. The directory '"
- + deployDir + "' does not exist.");
+ + deployDir + "' does not exist.");
return;
}
checkDirParams();
@@ -182,7 +182,7 @@ private void deployToRestService(Path resolvedOptionsFile) throws MojoExecutionE
Server server = session.getSettings().getServer(deployServerId);
if (server == null) {
getLog().warn("Can not load credentials from settings.xml because server '" + deployServerId
- + "' is not definied. Try to deploy with default username, password");
+ + "' is not definied. Try to deploy with default username, password");
}
var httpDeployer = new HttpDeployer(secDispatcher, server, deployEngineUrl, deployToEngineApplication, deployFile, resolvedOptionsFile);
httpDeployer.deploy(getLog());
@@ -194,9 +194,9 @@ private void checkHttpParams() {
}
Object defaultDeployEngineDirectory = project.getProperties().get(ENGINE_DIRECTORY_PROPERTY);
if (deployEngineDirectory != null
- && !deployEngineDirectory.toFile().getPath().equals(defaultDeployEngineDirectory)) {
+ && !deployEngineDirectory.toFile().getPath().equals(defaultDeployEngineDirectory)) {
logParameterIgnoredByMethod("deployEngineDirectory", deployEngineDirectory.toFile().getPath(),
- DeployMethod.HTTP);
+ DeployMethod.HTTP);
}
}
@@ -211,7 +211,7 @@ private void checkDirParams() {
private void logParameterIgnoredByMethod(String parameter, String value, String method) {
getLog().warn("Parameter " + parameter + " is set to " + value + " but will be ignored by " + method
- + " deployment.");
+ + " deployment.");
}
private Path getDeployDirectory() throws MojoExecutionException {
@@ -224,14 +224,14 @@ private Path getDeployDirectory() throws MojoExecutionException {
return deployEngineDirectory.resolve(deployDirectory);
}
- public static interface DefaultDeployOptions {
+ public interface DefaultDeployOptions {
String VERSION_AUTO = "AUTO";
String STATE_ACTIVE_AND_RELEASED = "ACTIVE_AND_RELEASED";
String FILE_FORMAT_AUTO = "AUTO";
String DEPLOY_TEST_USERS = "AUTO";
}
- public static interface DeployMethod {
+ public interface DeployMethod {
String DIRECTORY = "DIRECTORY";
String HTTP = "HTTP";
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java
index 37d7d5ac..9864050a 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java
@@ -52,7 +52,7 @@
public class DeployToTestEngineMojo extends AbstractDeployMojo {
public static final String TEST_GOAL = "deploy-to-test-engine";
- public static interface Property {
+ public interface Property {
String TEST_ENGINE_APP = "test.engine.app";
}
@@ -86,7 +86,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
props.set(Property.TEST_ENGINE_APP, deployToEngineApplication);
boolean isDefaultFile = deployFile.getFileName()
- .endsWith(project.getArtifactId() + "-" + project.getVersion() + ".iar");
+ .endsWith(project.getArtifactId() + "-" + project.getVersion() + ".iar");
if (isDefaultFile && deployDepsAsApp) {
provideDepsAsAppZip();
}
@@ -132,7 +132,7 @@ Path createFullAppZip(List deps) throws ArchiverException, IOException {
}
} else {
getLog().warn("Can not add dependency to app zip '" + dep + "'. \n "
- + "Dependency type is neither an IAR nor a reactor project.");
+ + "Dependency type is neither an IAR nor a reactor project.");
}
}
appZipper.createArchive();
@@ -145,7 +145,7 @@ static Optional findPackedIar(Path dep) throws IOException {
return Optional.empty();
}
try (Stream find = Files.find(target, 1,
- (p, attr) -> p.getFileName().toString().endsWith(".iar"))) {
+ (p, attr) -> p.getFileName().toString().endsWith(".iar"))) {
return find.findAny();
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java
index 48d00cb0..845cc803 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java
@@ -57,15 +57,15 @@ public interface OsgiDir {
private static final String SLF4J_VERSION = "2.0.13";
private static final List ENGINE_LIB_DIRECTORIES = Arrays.asList(
- OsgiDir.INSTALL_AREA + "/" + OsgiDir.LIB_BOOT,
- OsgiDir.PLUGINS,
- OsgiDir.INSTALL_AREA + "/configuration/org.eclipse.osgi", // unpacked
- // jars from
- // OSGI
- // bundles
- "webapps" + File.separator + "ivy" + File.separator + "WEB-INF" + File.separator + "lib");
+ OsgiDir.INSTALL_AREA + "/" + OsgiDir.LIB_BOOT,
+ OsgiDir.PLUGINS,
+ OsgiDir.INSTALL_AREA + "/configuration/org.eclipse.osgi", // unpacked
+ // jars from
+ // OSGI
+ // bundles
+ "webapps" + File.separator + "ivy" + File.separator + "WEB-INF" + File.separator + "lib");
- private MavenContext maven;
+ private final MavenContext maven;
public EngineClassLoaderFactory(MavenContext mavenContext) {
this.maven = mavenContext;
@@ -85,9 +85,9 @@ public URLClassLoader createEngineClassLoader(Path engineDirectory) throws IOExc
public List getSlf4jJars() {
return List.of(
- maven.getJar("org.slf4j", "slf4j-api", SLF4J_VERSION),
- maven.getJar("org.slf4j", "slf4j-simple", SLF4J_VERSION),
- maven.getJar("org.slf4j", "log4j-over-slf4j", SLF4J_VERSION));
+ maven.getJar("org.slf4j", "slf4j-api", SLF4J_VERSION),
+ maven.getJar("org.slf4j", "slf4j-simple", SLF4J_VERSION),
+ maven.getJar("org.slf4j", "log4j-over-slf4j", SLF4J_VERSION));
}
public static List getOsgiBootstrapClasspath(Path engineDirectory) {
@@ -104,9 +104,9 @@ private static void addToClassPath(List classPathFiles, Path dir, Predicat
if (Files.isDirectory(dir)) {
try (var stream = Files.list(dir)) {
var files = stream
- .filter(filter)
- .map(p -> p.toFile())
- .toList();
+ .filter(filter)
+ .map(Path::toFile)
+ .toList();
classPathFiles.addAll(files);
} catch (IOException ex) {
throw new RuntimeException(ex);
@@ -127,9 +127,9 @@ public static List getIvyEngineClassPathFiles(Path engineDirectory) {
}
try (var walker = Files.walk(jarDir)) {
var jars = walker
- .filter(p -> p.getFileName().toString().endsWith(".jar"))
- .map(p -> p.toFile())
- .toList();
+ .filter(p -> p.getFileName().toString().endsWith(".jar"))
+ .map(Path::toFile)
+ .toList();
classPathFiles.addAll(jars);
} catch (IOException ex) {
throw new RuntimeException(ex);
@@ -164,7 +164,7 @@ public static class MavenContext {
private final Log log;
public MavenContext(RepositorySystem repoSystem, ArtifactRepository localRepository, MavenProject project,
- Log log) {
+ Log log) {
this.repoSystem = repoSystem;
this.localRepository = localRepository;
this.project = project;
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java
index cab91e0b..2f6e33af 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java
@@ -47,7 +47,7 @@
* Sends commands like start, stop to the ivy Engine
*/
public class EngineControl {
- public static interface Property {
+ public interface Property {
String TEST_ENGINE_URL = "test.engine.url";
String TEST_ENGINE_LOG = "test.engine.log";
}
@@ -59,9 +59,8 @@ public enum EngineState {
STOPPED, STARTING, RUNNING, STOPPING, UNREGISTERED, FAILED;
}
- private EngineMojoContext context;
- private AtomicBoolean engineStarted = new AtomicBoolean(false);
-
+ private final EngineMojoContext context;
+ private final AtomicBoolean engineStarted = new AtomicBoolean(false);
private enum Command {
start, stop, status
@@ -84,10 +83,10 @@ public Process start() throws Exception {
streamHandler.start();
process.onExit()
- .thenAccept(p -> context.log.info("Engine process stopped."))
- .exceptionally(ex -> {
- throw new RuntimeException("Engine operation failed.", ex);
- });
+ .thenAccept(p -> context.log.info("Engine process stopped."))
+ .exceptionally(ex -> {
+ throw new RuntimeException("Engine operation failed.", ex);
+ });
waitForEngineStarted();
return process;
@@ -179,8 +178,8 @@ private void waitForEngineStarted() throws Exception {
i++;
if (i / 2 > context.timeoutInSeconds) {
throw new TimeoutException("Timeout while starting engine " + context.timeoutInSeconds + " [s].\n"
- + "Check the engine log for details or increase the timeout property '"
- + StartTestEngineMojo.IVY_ENGINE_START_TIMEOUT_SECONDS + "'");
+ + "Check the engine log for details or increase the timeout property '"
+ + StartTestEngineMojo.IVY_ENGINE_START_TIMEOUT_SECONDS + "'");
}
}
context.log.info("Engine started after " + i / 2 + " [s]");
@@ -204,10 +203,10 @@ private String executeSynch(ProcessBuilder statusCmd) throws IOException {
private EngineState parseState(String engineOut) {
var state = engineOut.lines()
- .map(line -> parse(line))
- .filter(Objects::nonNull)
- .findFirst()
- .orElse(null);
+ .map(this::parse)
+ .filter(Objects::nonNull)
+ .findFirst()
+ .orElse(null);
if (state == null) {
context.log.error("Failed to evaluate engine state of engine in directory " + context.engineDirectory);
}
@@ -237,7 +236,6 @@ private static long waitFor(Supplier condition, long duration, TimeUnit
return watch.getDuration().toMillis();
}
-
private final class ProcessStreamHandler {
private final InputStream out;
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java
index 1aa1e537..dbbbe8a8 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java
@@ -31,8 +31,8 @@ public Stream asStream() {
try {
return Files.readAllLines(jvmOptionsFile).stream()
- .filter(line -> !line.isBlank())
- .filter(line -> !line.matches("^\\s*#.*$"));
+ .filter(line -> !line.isBlank())
+ .filter(line -> !line.matches("^\\s*#.*$"));
} catch (IOException ex) {
log.warn("Couldn't read the jvm module options from '" + jvmOptionsFile + "' file.", ex);
return Stream.empty();
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java
index 1d3f9739..ec15e271 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java
@@ -38,7 +38,7 @@ public class EngineMojoContext {
public final Integer timeoutInSeconds;
public EngineMojoContext(Path engineDirectory, MavenProject project, Log log, Path engineLogFile,
- EngineVmOptions vmOptions, Integer timeoutInSeconds) {
+ EngineVmOptions vmOptions, Integer timeoutInSeconds) {
this.engineDirectory = engineDirectory;
this.project = project;
this.log = log;
@@ -63,10 +63,10 @@ private Path setupEngineClasspathJarIfNotExists() {
try {
log.info("Creating a classpath jar for starting the engine");
new ClasspathJar(classpathJar)
- .createFileEntries(EngineClassLoaderFactory.getOsgiBootstrapClasspath(engineDirectory));
+ .createFileEntries(EngineClassLoaderFactory.getOsgiBootstrapClasspath(engineDirectory));
} catch (Exception ex) {
throw new RuntimeException(
- "Could not create engine classpath jar: '" + classpathJar + "'", ex);
+ "Could not create engine classpath jar: '" + classpathJar + "'", ex);
}
}
return classpathJar;
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java
index b3df05c1..9666a833 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java
@@ -15,8 +15,8 @@ public class EngineVersionEvaluator {
public static final String LIBRARY_ID = "ch.ivyteam.util";
- private Log log;
- private Path engineDir;
+ private final Log log;
+ private final Path engineDir;
public EngineVersionEvaluator(Log log, Path engineDir) {
this.log = log;
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java b/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java
index 1075b2a2..e9c98102 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java
@@ -50,7 +50,7 @@ public class MavenProjectBuilderProxy {
private final Log log;
public MavenProjectBuilderProxy(EngineClassLoaderFactory classLoaderFactory, File workspace,
- File baseDirToBuildIn, Log log, int timeoutEngineStartInSeconds) throws Exception {
+ File baseDirToBuildIn, Log log, int timeoutEngineStartInSeconds) throws Exception {
this.baseDirToBuildIn = baseDirToBuildIn;
this.log = log;
@@ -67,10 +67,10 @@ public MavenProjectBuilderProxy(EngineClassLoaderFactory classLoaderFactory, Fil
}
private void logEngine()
- throws ReflectionException, IntrospectionException, MalformedObjectNameException {
+ throws ReflectionException, IntrospectionException, MalformedObjectNameException {
var cl = this.getClass().getClassLoader();
var message = "MavenProjectBuilderProxy instance " + System.identityHashCode(this) +
- " created with class loader " + cl + " (" + System.identityHashCode(cl) + ")";
+ " created with class loader " + cl + " (" + System.identityHashCode(cl) + ")";
try {
ManagementFactory.getPlatformMBeanServer().getMBeanInfo(new ObjectName("ivy Engine:type=Server"));
log.warn(message + " ivy engine is already running!");
@@ -80,9 +80,9 @@ private void logEngine()
}
private Class> getOsgiBundledDelegate(URLClassLoader ivyEngineClassLoader,
- int timeoutEngineStartInSeconds) throws Exception {
+ int timeoutEngineStartInSeconds) throws Exception {
Object bundleContext = new OsgiRuntime(baseDirToBuildIn.toPath(), log).startEclipseOsgiImpl(ivyEngineClassLoader,
- timeoutEngineStartInSeconds);
+ timeoutEngineStartInSeconds);
hackProvokeEagerStartOfJdt(bundleContext);
Object buildBundle = findBundle(bundleContext, "ch.ivyteam.ivy.dataclasses.build");
return loadClassInBundle(buildBundle, FQ_DELEGATE_CLASS_NAME);
@@ -90,12 +90,12 @@ private Class> getOsgiBundledDelegate(URLClassLoader ivyEngineClassLoader,
private static Class> loadClassInBundle(Object bundle, String className) throws Exception {
return (Class>) bundle.getClass().getDeclaredMethod("loadClass", String.class).invoke(bundle,
- className);
+ className);
}
private static Object findBundle(Object bundleContext, String symbolicName) throws Exception {
Object[] bundles = (Object[]) bundleContext.getClass().getDeclaredMethod("getBundles")
- .invoke(bundleContext);
+ .invoke(bundleContext);
for (Object bundleObj : bundles) {
Object bundleSymbolicName = bundleObj.getClass().getMethod("getSymbolicName").invoke(bundleObj);
if (symbolicName.equals(bundleSymbolicName)) {
@@ -107,8 +107,8 @@ private static Object findBundle(Object bundleContext, String symbolicName) thro
private static String getEngineClasspath(List jars) {
return jars.stream()
- .map(file -> file.getAbsolutePath())
- .collect(Collectors.joining(File.pathSeparator));
+ .map(File::getAbsolutePath)
+ .collect(Collectors.joining(File.pathSeparator));
}
/**
@@ -133,26 +133,26 @@ public List createIarJars(List iarDependencies) throws Exception {
@SuppressWarnings("unchecked")
public Map compile(File projectDirToBuild, List iarJars, Map options)
- throws Exception {
+ throws Exception {
Method compileMethod = getMethod("compile", File.class, List.class, String.class, Map.class);
return (Map) executeInEngineDir(
- () -> compileMethod.invoke(delegate, projectDirToBuild, iarJars, engineClasspath, options));
+ () -> compileMethod.invoke(delegate, projectDirToBuild, iarJars, engineClasspath, options));
}
@SuppressWarnings("unchecked")
public Map validate(File projectDirToBuild, List dependentProjects,
- Map options) throws Exception {
+ Map options) throws Exception {
Method validate = getMethod("validate", File.class, List.class, String.class, Map.class);
return (Map) executeInEngineDir(
- () -> validate.invoke(delegate, projectDirToBuild, dependentProjects, engineClasspath, options));
+ () -> validate.invoke(delegate, projectDirToBuild, dependentProjects, engineClasspath, options));
}
@SuppressWarnings("unchecked")
public Map testCompile(File projectDirToBuild, List iarJars,
- Map options) throws Exception {
+ Map options) throws Exception {
Method compileMethod = getMethod("testCompile", File.class, List.class, String.class, Map.class);
return (Map) executeInEngineDir(
- () -> compileMethod.invoke(delegate, projectDirToBuild, iarJars, engineClasspath, options));
+ () -> compileMethod.invoke(delegate, projectDirToBuild, iarJars, engineClasspath, options));
}
private Method getMethod(String name, Class>... parameterTypes) {
@@ -160,9 +160,9 @@ private Method getMethod(String name, Class>... parameterTypes) {
return delegateClass.getDeclaredMethod(name, parameterTypes);
} catch (NoSuchMethodException ex) {
throw new RuntimeException(
- "Method " + name + "(" + parameterTypes + ") does not exist in engine '" + baseDirToBuildIn
- + "'. \n"
- + "You might need to configure another version to work with.");
+ "Method " + name + "(" + parameterTypes + ") does not exist in engine '" + baseDirToBuildIn
+ + "'. \n"
+ + "You might need to configure another version to work with.");
}
}
@@ -189,4 +189,4 @@ public interface Result {
String TEST_OUTPUT_DIR = "ivy.project.test.output.dir";
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java b/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java
index 47e465ae..cd8bf8bb 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java
@@ -35,38 +35,31 @@ class OsgiRuntime {
}
Object startEclipseOsgiImpl(URLClassLoader ivyEngineClassLoader, int timeoutEngineStartInSeconds)
- throws Exception {
+ throws Exception {
Class> osgiBooter = ivyEngineClassLoader.loadClass("org.eclipse.core.runtime.adaptor.EclipseStarter");
Method mainMethod = osgiBooter.getDeclaredMethod("main", String[].class);
List mainArgs = new ArrayList<>(
- Arrays.asList("-application", "ch.ivyteam.ivy.server.exec.engine.maven"));
+ Arrays.asList("-application", "ch.ivyteam.ivy.server.exec.engine.maven"));
if (log.isDebugEnabled()) {
mainArgs.add("-debug");
}
final String[] args = mainArgs.toArray(new String[mainArgs.size()]);
runThreadWithProperties(() -> mainMethod.invoke(null, (Object) args), timeoutEngineStartInSeconds);
- Object bundleContext = osgiBooter.getDeclaredMethod("getSystemBundleContext").invoke(null);
- return bundleContext;
+ return osgiBooter.getDeclaredMethod("getSystemBundleContext").invoke(null);
}
void runThreadWithProperties(Callable> function, int timeoutEngineStartInSeconds) throws Exception {
Map properties = createOsgiConfigurationProps();
Map oldProperties = setSystemProperties(properties);
try {
- ThreadFactory threadFactory = new ThreadFactory() {
-
- @Override
- public Thread newThread(Runnable r) {
- return new Thread(r, "Init Engine Thread");
- }
- };
+ ThreadFactory threadFactory = r -> new Thread(r, "Init Engine Thread");
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(threadFactory);
Future> result = singleThreadExecutor.submit(function);
try {
TimeUnit timeUnit = TimeUnit.SECONDS;
if (log.isDebugEnabled()) {
log.debug("Waiting " + timeoutEngineStartInSeconds + " " + timeUnit.name().toLowerCase()
- + " on engine start");
+ + " on engine start");
}
result.get(timeoutEngineStartInSeconds, timeUnit);
} catch (Exception ex) {
@@ -102,30 +95,30 @@ private Map createOsgiConfigurationProps() {
properties.put("osgi.install.area", osgiDir.toAbsolutePath().toString());
properties.put("org.osgi.framework.bundle.parent", "framework");
properties.put("org.osgi.framework.bootdelegation",
- "javax.annotation,ch.ivyteam.ivy.boot.osgi.win,ch.ivyteam.ivy.jaas," // original
- + "org.apache.log4j,org.apache.log4j.helpers,org.apache.log4j.spi,org.apache.log4j.xml," // add
- // log4j
- + "org.slf4j.impl,org.slf4j,org.slf4j.helpers,org.slf4j.spi," // add
- // slf4j
- + "javax.net.ssl," // validate openApi
-
- // jdt compiler
- + "javax.lang.model,"
- + "javax.annotation.processing,"
- + "javax.tools,"
- + "javax.lang.model.util,"
- + "javax.lang.model.element,"
- + "javax.lang.model.type,"
-
- // oxygen platform
- + "javax.management,javax.management.openmbean,javax.xml.parsers,"
- + "sun.net.www.protocol.http.ntlm,com.sun.xml.internal.ws.util,com.sun.nio.zipfs,org.xml.sax,"
- + "org.w3c.dom,"
-
- // for java 11
- + "javax.xml,javax.xml.datatype,javax.xml.namespace,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stream,javax.xml.validation,javax.xml.xpath,"
- + "org.xml.sax.ext,org.xml.sax.helpers,"
- + "javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util");
+ "javax.annotation,ch.ivyteam.ivy.boot.osgi.win,ch.ivyteam.ivy.jaas," // original
+ + "org.apache.log4j,org.apache.log4j.helpers,org.apache.log4j.spi,org.apache.log4j.xml," // add
+ // log4j
+ + "org.slf4j.impl,org.slf4j,org.slf4j.helpers,org.slf4j.spi," // add
+ // slf4j
+ + "javax.net.ssl," // validate openApi
+
+ // jdt compiler
+ + "javax.lang.model,"
+ + "javax.annotation.processing,"
+ + "javax.tools,"
+ + "javax.lang.model.util,"
+ + "javax.lang.model.element,"
+ + "javax.lang.model.type,"
+
+ // oxygen platform
+ + "javax.management,javax.management.openmbean,javax.xml.parsers,"
+ + "sun.net.www.protocol.http.ntlm,com.sun.xml.internal.ws.util,com.sun.nio.zipfs,org.xml.sax,"
+ + "org.w3c.dom,"
+
+ // for java 11
+ + "javax.xml,javax.xml.datatype,javax.xml.namespace,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stream,javax.xml.validation,javax.xml.xpath,"
+ + "org.xml.sax.ext,org.xml.sax.helpers,"
+ + "javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util");
if (log.isDebugEnabled()) {
log.debug("Configuration OSGi system properties:");
@@ -134,4 +127,4 @@ private Map createOsgiConfigurationProps() {
return properties;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/Slf4jSimpleEngineProperties.java b/src/main/java/ch/ivyteam/ivy/maven/engine/Slf4jSimpleEngineProperties.java
index c0b94552..f80971a6 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/Slf4jSimpleEngineProperties.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/Slf4jSimpleEngineProperties.java
@@ -30,17 +30,17 @@
public class Slf4jSimpleEngineProperties {
private static final String DEFAULT_LOG_LEVEL = SimpleLogger.DEFAULT_LOG_LEVEL_KEY;
private static final List INTERESTING_LOGGERS = Arrays.asList(
- "ch.ivyteam.ivy.scripting.dataclass.internal.InMemoryEngineController", // engine
- // start/stop
- "ch.ivyteam.ivy.project.build.MavenProjectBuilder", // maven engine
- // interface
- "ch.ivyteam.ivy.scripting.dataclass.internal.ProjectDataClassManager", // dataclass
- // source
- // generation
- "ch.ivyteam.ivy.java.internal.JavaBuilder", // jdt compiler
- "ch.ivyteam.ivy.webservice.process.restricted.WebServiceProcessClassBuilder" // webservice
- // source
- // generation
+ "ch.ivyteam.ivy.scripting.dataclass.internal.InMemoryEngineController", // engine
+ // start/stop
+ "ch.ivyteam.ivy.project.build.MavenProjectBuilder", // maven engine
+ // interface
+ "ch.ivyteam.ivy.scripting.dataclass.internal.ProjectDataClassManager", // dataclass
+ // source
+ // generation
+ "ch.ivyteam.ivy.java.internal.JavaBuilder", // jdt compiler
+ "ch.ivyteam.ivy.webservice.process.restricted.WebServiceProcessClassBuilder" // webservice
+ // source
+ // generation
);
private static final String IVY_PREFIX = "ch.ivyteam.ivy";
@@ -93,11 +93,11 @@ private static void setDefaultProperty(String property, String value) {
/**
* Valid levels as documented in {@link org.slf4j.simple.SimpleLogger}
*/
- static interface Level {
+ interface Level {
String TRACE = "trace";
String DEBUG = "debug";
String INFO = "info";
String WARNING = "warn";
String ERROR = "error";
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java
index bf173339..8873c05b 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java
@@ -24,7 +24,7 @@ public DeploymentOptionsFileFactory(Path deployableArtifact) {
}
public Path createFromTemplate(Path optionsFile, MavenProject project, MavenSession session,
- MavenFileFilter fileFilter) throws MojoExecutionException {
+ MavenFileFilter fileFilter) throws MojoExecutionException {
if (!isOptionsFile(optionsFile.toFile())) {
return null;
}
@@ -33,7 +33,7 @@ public Path createFromTemplate(Path optionsFile, MavenProject project, MavenSess
var targetFile = getTargetFile(ext);
try {
fileFilter.copyFile(optionsFile.toFile(), targetFile.toFile(), true, project, Collections.emptyList(), false,
- StandardCharsets.UTF_8.name(), session);
+ StandardCharsets.UTF_8.name(), session);
} catch (MavenFilteringException ex) {
throw new MojoExecutionException("Failed to resolve templates in options file", ex);
}
@@ -42,9 +42,9 @@ public Path createFromTemplate(Path optionsFile, MavenProject project, MavenSess
private static boolean isOptionsFile(File optionsFile) {
return optionsFile != null &&
- optionsFile.exists() &&
- optionsFile.isFile() &&
- optionsFile.canRead();
+ optionsFile.exists() &&
+ optionsFile.isFile() &&
+ optionsFile.canRead();
}
public Path createFromConfiguration(String options) throws MojoExecutionException {
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/YamlOptionsFactory.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/YamlOptionsFactory.java
index c31b363c..817b5022 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/YamlOptionsFactory.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/YamlOptionsFactory.java
@@ -38,7 +38,7 @@ public static String toYaml(AbstractDeployMojo config) throws IOException {
gen.close();
String yaml = writer.toString();
- if (yaml.equals("{}\n")) {
+ if ("{}\n".equals(yaml)) {
return null;
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/EngineLogLineHandler.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/EngineLogLineHandler.java
index a406f4da..1f76a31a 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/EngineLogLineHandler.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/EngineLogLineHandler.java
@@ -23,7 +23,7 @@
/**
* Logs only log lines with a well known severity into maven log.
- *
+ *
*
* {@link Level#INFO} is logged as debug, as it contains information to trace
* the detailed deployment steps which are too detailed for a normal deployment
@@ -47,23 +47,23 @@ public void handleLine(String logLine) {
String message = matcher.group(2);
message = " ENGINE:" + message;
- if (level.equalsIgnoreCase(Level.INFO)) { // infos are too detailed, but
+ if (Level.INFO.equalsIgnoreCase(level)) { // infos are too detailed, but
// users can trace in debug -X
// mode.
log.debug(message);
}
- if (level.equalsIgnoreCase(Level.WARNING)) {
+ if (Level.WARNING.equalsIgnoreCase(level)) {
log.warn(message);
}
- if (level.equalsIgnoreCase(Level.ERROR)) {
+ if (Level.ERROR.equalsIgnoreCase(level)) {
log.error(message);
}
}
}
- static interface Level {
+ interface Level {
String INFO = "info";
String WARNING = "warning";
String ERROR = "error";
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java
index b6e566df..2d5d9060 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java
@@ -36,7 +36,6 @@ public class FileDeployer implements IvyDeployer {
private Log log;
private DeploymentFiles deploymentFiles;
-
public FileDeployer(Path deployDir, Path deploymentOptionsFile, Integer deployTimeoutInSeconds, Path deployFile, Path targetDeployableFile) {
this.deployDir = deployDir;
this.deploymentOptionsFile = deploymentOptionsFile;
@@ -118,7 +117,7 @@ private void failOnError() throws MojoExecutionException {
}
private static void wait(Supplier condition, long duration, TimeUnit unit)
- throws TimeoutException {
+ throws TimeoutException {
long waitMs = unit.toMillis(duration);
long startMs = System.currentTimeMillis();
long maxMs = waitMs + startMs;
@@ -128,8 +127,7 @@ private static void wait(Supplier condition, long duration, TimeUnit un
throw new TimeoutException("Operation reached timeout of " + duration + " " + unit);
}
Thread.sleep(100);
- } catch (InterruptedException ex) {
- }
+ } catch (InterruptedException ex) {}
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java
index 682fb80b..912f976e 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java
@@ -39,7 +39,7 @@ class FileLogForwarder {
private final Log mavenLog;
private FileAlterationMonitor monitor;
- private LogLineHandler logLineHandler;
+ private final LogLineHandler logLineHandler;
/**
* @param engineLog the log file to watch for new lines
@@ -100,7 +100,7 @@ private void readNewLines(RandomAccessFile readableLog) throws IOException {
}
}
- static interface LogLineHandler {
+ interface LogLineHandler {
void handleLine(String newLogLine);
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java
index 44fcd5d8..f8fb921b 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java
@@ -33,15 +33,15 @@
public class HttpDeployer {
private static final String DEPLOY_URI = "/system/api/apps/";
- private String serverUrl;
- private String targetApplication;
- private Path deployFile;
- private Path deploymentOptions;
- private Server server;
- private SecDispatcher secDispatcher;
+ private final String serverUrl;
+ private final String targetApplication;
+ private final Path deployFile;
+ private final Path deploymentOptions;
+ private final Server server;
+ private final SecDispatcher secDispatcher;
public HttpDeployer(SecDispatcher secDispatcher, Server server, String serverUrl, String targetApplication,
- Path deployFile, Path deploymentOptions) {
+ Path deployFile, Path deploymentOptions) {
this.secDispatcher = secDispatcher;
this.server = server;
this.serverUrl = serverUrl;
@@ -61,7 +61,7 @@ public void deploy(Log log) throws MojoExecutionException {
}
private void executeRequest(Log log, CloseableHttpClient client)
- throws IOException, URISyntaxException, MojoExecutionException {
+ throws IOException, URISyntaxException, MojoExecutionException {
String url = serverUrl + DEPLOY_URI + targetApplication;
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("X-Requested-By", "maven-build-plugin");
@@ -114,7 +114,7 @@ private HttpClientContext getRequestContext(String url) throws URISyntaxExceptio
HttpHost httpHost = URIUtils.extractHost(new URI(url));
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(AuthScope.ANY,
- new UsernamePasswordCredentials(username, password));
+ new UsernamePasswordCredentials(username, password));
AuthCache authCache = new BasicAuthCache();
authCache.put(httpHost, new BasicScheme());
HttpClientContext context = HttpClientContext.create();
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java b/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java
index 77950e99..0e1729f5 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java
@@ -21,8 +21,8 @@ public class MavenEngineDownloader implements EngineDownloader {
private final DefaultArtifact engineArtifact;
public MavenEngineDownloader(Log log, String ivyVersion, String osArchitecture,
- List pluginRepositories, RepositorySystem repositorySystem,
- RepositorySystemSession repositorySession) {
+ List pluginRepositories, RepositorySystem repositorySystem,
+ RepositorySystemSession repositorySession) {
this.log = log;
this.engineArtifact = toEngineArtifact(ivyVersion, osArchitecture);
this.repositorySystem = repositorySystem;
diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java b/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java
index b296d0fc..9208989b 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java
@@ -35,8 +35,8 @@ public class URLEngineDownloader implements EngineDownloader {
public ProxyInfoProvider proxies;
public URLEngineDownloader(URL engineDownloadUrl, URL engineListPageUrl, String osArchitecture,
- String ivyVersion, VersionRange ivyVersionRange, Log log, Path downloadDirectory,
- ProxyInfoProvider proxies) {
+ String ivyVersion, VersionRange ivyVersionRange, Log log, Path downloadDirectory,
+ ProxyInfoProvider proxies) {
this.engineDownloadUrl = engineDownloadUrl;
this.engineListPageUrl = engineListPageUrl;
this.osArchitecture = osArchitecture;
@@ -81,7 +81,7 @@ private Path downloadEngineFromUrl(URL engineUrl) throws MojoExecutionException
return downloadZip;
} catch (Exception ex) {
throw new MojoExecutionException("Failed to download engine from '" + engineUrl + "' to '"
- + downloadDirectory + "'", ex);
+ + downloadDirectory + "'", ex);
}
}
@@ -128,7 +128,7 @@ public String getZipFileNameFromDownloadLocation() {
}
public URL findEngineDownloadUrl(InputStream htmlStream)
- throws MojoExecutionException, MalformedURLException, URISyntaxException {
+ throws MojoExecutionException, MalformedURLException, URISyntaxException {
String engineFileNameRegex = "AxonIvyEngine[^.]+?\\.[^.]+?\\.+[^_]*?_" + osArchitecture + "\\.zip";
Pattern enginePattern = Pattern.compile("href=[\"|'][^\"']*?" + engineFileNameRegex + "[\"|']");
try (Scanner scanner = new Scanner(htmlStream)) {
@@ -137,12 +137,12 @@ public URL findEngineDownloadUrl(InputStream htmlStream)
String engineLinkMatch = scanner.findWithinHorizon(enginePattern, 0);
if (engineLinkMatch == null) {
throw new MojoExecutionException("Could not find a link to engine for version '" + ivyVersion
- + "' on site '" + engineListPageUrl + "'");
+ + "' on site '" + engineListPageUrl + "'");
}
String versionString = StringUtils.substringBetween(engineLinkMatch, "AxonIvyEngine",
- "_" + osArchitecture);
+ "_" + osArchitecture);
ArtifactVersion version = new DefaultArtifactVersion(
- EngineVersionEvaluator.toReleaseVersion(versionString));
+ EngineVersionEvaluator.toReleaseVersion(versionString));
if (ivyVersionRange.containsVersion(version)) {
engineLink = StringUtils.replace(engineLinkMatch, "\"", "'");
engineLink = StringUtils.substringBetween(engineLink, "href='", "'");
diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java
index 1423b2b6..7d67c9a5 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java
@@ -44,7 +44,7 @@ public final Path getEngineDir(MavenProject project) throws MojoExecutionExcepti
protected final boolean engineToTarget() throws MojoExecutionException {
return isLocation(TestEngineLocation.COPY_FROM_TEMPLATE) ||
- isLocation(TestEngineLocation.COPY_FROM_CACHE) && isCachedEngine();
+ isLocation(TestEngineLocation.COPY_FROM_CACHE) && isCachedEngine();
}
private boolean isLocation(String location) {
@@ -63,7 +63,7 @@ Path getTargetDir(MavenProject project) {
return Path.of(project.getBuild().getDirectory()).resolve("ivyEngine");
}
- static interface TestEngineLocation {
+ interface TestEngineLocation {
String COPY_FROM_CACHE = "COPY_FROM_CACHE";
String COPY_FROM_TEMPLATE = "COPY_FROM_TEMPLATE";
String MODIFY_EXISTING = "MODIFY_EXISTING";
diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java
index 42bdac5b..6a164001 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java
@@ -55,17 +55,17 @@ public class SetupIntegrationTestPropertiesMojo extends AbstractEngineMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
var props = new MavenProperties(project, getLog());
String jmvArgs = asJvmArgs(props,
- EngineControl.Property.TEST_ENGINE_URL,
- EngineControl.Property.TEST_ENGINE_LOG,
- DeployToTestEngineMojo.Property.TEST_ENGINE_APP);
+ EngineControl.Property.TEST_ENGINE_URL,
+ EngineControl.Property.TEST_ENGINE_LOG,
+ DeployToTestEngineMojo.Property.TEST_ENGINE_APP);
jmvArgs += new EngineModuleHints(identifyAndGetEngineDirectory(), getLog()).asString();
props.append(FAILSAFE_ARGLINE_PROPERTY, jmvArgs);
}
private static String asJvmArgs(MavenProperties store, String... keys) {
return Arrays.stream(keys)
- .map(key -> "-D" + key + "=" + store.get(key))
- .collect(Collectors.joining(" "));
+ .map(key -> "-D" + key + "=" + store.get(key))
+ .collect(Collectors.joining(" "));
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java
index 867f50de..da9b84b8 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java
@@ -53,7 +53,7 @@
public class SetupIvyTestPropertiesMojo extends AbstractEngineMojo {
public static final String GOAL = "ivy-test-properties";
- public static interface Property {
+ public interface Property {
String IVY_ENGINE_CLASSPATH = "ivy.engine.classpath";
String IVY_PROJECT_IAR_CLASSPATH = "ivy.project.iar.classpath";
String IVY_TEST_VM_RUNTIME = "ivy.test.vm.runtime";
@@ -119,8 +119,8 @@ private List getProjects() {
deps.add(project.getBasedir().toPath());
deps.addAll(MavenRuntime.getDependencies(project, session, "iar"));
return deps.stream()
- .map(file -> file.toUri())
- .collect(Collectors.toList());
+ .map(Path::toUri)
+ .collect(Collectors.toList());
}
/**
@@ -128,12 +128,12 @@ private List getProjects() {
*/
private void configureMavenTestProperties(MavenProperties properties) throws MojoExecutionException {
List IVY_PROPS = List.of(
- Property.IVY_TEST_VM_RUNTIME,
- Property.IVY_ENGINE_CLASSPATH,
- Property.IVY_PROJECT_IAR_CLASSPATH);
+ Property.IVY_TEST_VM_RUNTIME,
+ Property.IVY_ENGINE_CLASSPATH,
+ Property.IVY_PROJECT_IAR_CLASSPATH);
String surefireClasspath = IVY_PROPS.stream()
- .map(property -> "${" + property + "}")
- .collect(Collectors.joining(","));
+ .map(property -> "${" + property + "}")
+ .collect(Collectors.joining(","));
properties.setMavenProperty(Property.MAVEN_TEST_ADDITIONAL_CLASSPATH, surefireClasspath);
var jvmOptions = new EngineModuleHints(identifyAndGetEngineDirectory(), getLog());
properties.append(Property.MAVEN_TEST_ARGLINE, jvmOptions.asString());
diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java
index 3cc70979..6f9290c7 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java
@@ -135,13 +135,13 @@ private Path copyEngineToTarget(Path cachedEngineDir) {
var targetEngine = getTargetDir(project);
if (Files.exists(targetEngine)) {
getLog().warn("Skipping copy of engine to " + targetEngine
- + " it already exists. Use \"mvn clean\" to ensure a clean engine each cycle.");
+ + " it already exists. Use \"mvn clean\" to ensure a clean engine each cycle.");
return targetEngine;
}
try {
getLog().info("Parameter is set to " + testEngine +
- ", copying engine from: " + cachedEngineDir + " to " + targetEngine);
+ ", copying engine from: " + cachedEngineDir + " to " + targetEngine);
copyEngine(cachedEngineDir, targetEngine);
return targetEngine;
diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java b/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java
index 12745984..01cdd98d 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java
@@ -14,7 +14,7 @@ public class IvyTestRuntime {
public static final String RUNTIME_PROPS_RESOURCE = "ivyTestRuntime.properties";
- public static interface Key {
+ public interface Key {
String PRODUCT_DIR = "product.dir";
String PROJECT_LOCATIONS = "project.locations";
}
@@ -27,10 +27,10 @@ public void setProductDir(Path engineDir) {
public void setProjectLocations(List locations) {
var joinedUris = locations
- .stream()
- .map(URI::toASCIIString)
- .map(uri -> "<" + uri + ">") // RFC 3986 Appendix C
- .collect(Collectors.joining(", "));
+ .stream()
+ .map(URI::toASCIIString)
+ .map(uri -> "<" + uri + ">") // RFC 3986 Appendix C
+ .collect(Collectors.joining(", "));
props.setProperty(Key.PROJECT_LOCATIONS, joinedUris);
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/ClasspathJar.java b/src/main/java/ch/ivyteam/ivy/maven/util/ClasspathJar.java
index 3cf94169..be1ae21d 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/util/ClasspathJar.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/util/ClasspathJar.java
@@ -70,7 +70,7 @@ public void createFileEntries(Collection classpathEntries) throws IOExcept
}
private void writeManifest(String name, ZipOutputStream jarStream, List classpathEntries)
- throws IOException {
+ throws IOException {
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
manifest.getMainAttributes().putValue("Name", name);
@@ -86,8 +86,8 @@ private void writeManifest(String name, ZipOutputStream jarStream, List
private static List getClassPathUris(Collection classpathEntries) {
return classpathEntries.stream()
- .map(file -> file.toURI().toASCIIString())
- .collect(Collectors.toList());
+ .map(file -> file.toURI().toASCIIString())
+ .collect(Collectors.toList());
}
public List getFiles() {
diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/FileSetConverter.java b/src/main/java/ch/ivyteam/ivy/maven/util/FileSetConverter.java
index 9bfc7dad..d6cca747 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/util/FileSetConverter.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/util/FileSetConverter.java
@@ -33,7 +33,7 @@ public FileSetConverter(Path pomFileDir) {
}
public List toPlexusFileSets(
- org.apache.maven.model.FileSet[] mavenFileSets) {
+ org.apache.maven.model.FileSet[] mavenFileSets) {
if (mavenFileSets == null) {
return Collections.emptyList();
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java b/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java
index da53b170..5916d10e 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java
@@ -33,28 +33,28 @@ public MavenDependencies type(String newTypeFilter) {
public List localTransient() {
return stream(project.getArtifacts())
- .filter(this::isLocalDep)
- .filter(this::include)
- .map(Artifact::getFile)
- .map(File::toPath)
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .filter(this::isLocalDep)
+ .filter(this::include)
+ .map(Artifact::getFile)
+ .map(File::toPath)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
}
private boolean isLocalDep(Artifact artifact) {
return artifact.getDependencyTrail().stream()
- .filter(dep -> dep.contains(":iar")) // iar or iar-integration-test
- .filter(dep -> !dep.startsWith(project.getGroupId() + ":" + project.getArtifactId() + ":"))
- .findAny()
- .isEmpty();
+ .filter(dep -> dep.contains(":iar")) // iar or iar-integration-test
+ .filter(dep -> !dep.startsWith(project.getGroupId() + ":" + project.getArtifactId() + ":"))
+ .findAny()
+ .isEmpty();
}
public List all() {
return stream(project.getArtifacts())
- .filter(this::include)
- .map(this::toFile)
- .map(File::toPath)
- .collect(Collectors.toList());
+ .filter(this::include)
+ .map(this::toFile)
+ .map(File::toPath)
+ .collect(Collectors.toList());
}
private static Stream stream(Set deps) {
@@ -66,8 +66,8 @@ private static Stream stream(Set deps) {
private File toFile(Artifact artifact) {
return findReactorProject(artifact)
- .map(MavenProject::getBasedir)
- .orElse(artifact.getFile());
+ .map(MavenProject::getBasedir)
+ .orElse(artifact.getFile());
}
private boolean include(Artifact artifact) {
@@ -85,8 +85,8 @@ private Optional findReactorProject(Artifact artifact) {
return Optional.empty();
}
return session.getAllProjects().stream()
- .filter(p -> p.getArtifact().equals(artifact))
- .findAny();
+ .filter(p -> p.getArtifact().equals(artifact))
+ .findAny();
}
}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/PathUtils.java b/src/main/java/ch/ivyteam/ivy/maven/util/PathUtils.java
index a9d3dfe0..e7479884 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/util/PathUtils.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/util/PathUtils.java
@@ -11,15 +11,15 @@
public interface PathUtils {
- public static String toExtension(Path path) {
+ static String toExtension(Path path) {
return toExtension(path.getFileName().toString());
}
- public static String toExtension(String path) {
+ static String toExtension(String path) {
return StringUtils.substringAfterLast(path, ".");
}
- public static void delete(Path path) {
+ static void delete(Path path) {
if (path == null) {
return;
}
@@ -29,14 +29,14 @@ public static void delete(Path path) {
try (var stream = Files.walk(path)) {
stream.sorted(Comparator.reverseOrder())
- .map(Path::toFile)
- .forEach(File::delete);
+ .map(Path::toFile)
+ .forEach(File::delete);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
- public static void clean(Path path) {
+ static void clean(Path path) {
delete(path);
try {
Files.createDirectories(path);
@@ -44,4 +44,4 @@ public static void clean(Path path) {
throw new UncheckedIOException(ex);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ch/ivyteam/ivy/maven/validate/ValidateMojo.java b/src/main/java/ch/ivyteam/ivy/maven/validate/ValidateMojo.java
index 7fb3705c..bdbea698 100644
--- a/src/main/java/ch/ivyteam/ivy/maven/validate/ValidateMojo.java
+++ b/src/main/java/ch/ivyteam/ivy/maven/validate/ValidateMojo.java
@@ -69,8 +69,9 @@ private Optional findProjectBuildPlugin(List plugins) {
private String versionProjects(Map> versionToProjectsMap, String version) {
return version + " -> [" +
versionToProjectsMap.get(version).stream()
- .map(p -> p.getArtifactId())
- .collect(Collectors.joining(", ")) +
+ .map(MavenProject::getArtifactId)
+ .collect(Collectors.joining(", "))
+ +
"]";
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java b/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java
index 76adfc5e..9d3c4b59 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java
@@ -51,12 +51,11 @@ private static String toRange(String version) {
private static String getNextMajor(String version) {
DefaultArtifactVersion parsed = new DefaultArtifactVersion(version);
int majorVersion = parsed.getMajorVersion();
- String nextMajor = new StringBuilder()
- .append(majorVersion + 1).append('.')
- .append(parsed.getMinorVersion()).append('.')
- .append(parsed.getIncrementalVersion())
- .toString();
- return nextMajor;
+ return new StringBuilder()
+ .append(majorVersion + 1).append('.')
+ .append(parsed.getMinorVersion()).append('.')
+ .append(parsed.getIncrementalVersion())
+ .toString();
}
private static String getLocalRepoPath() {
@@ -66,8 +65,8 @@ private static String getLocalRepoPath() {
}
StringBuilder defaultHomePath = new StringBuilder(SystemUtils.USER_HOME)
- .append(File.separatorChar).append(".m2")
- .append(File.separatorChar).append("repository");
+ .append(File.separatorChar).append(".m2")
+ .append(File.separatorChar).append("repository");
return defaultHomePath.toString();
}
@@ -76,8 +75,8 @@ private static final Path evalEngineDir(AbstractEngineMojo mojo) {
}
@Rule
- public ProjectMojoRule installUpToDateEngineRule = new ProjectMojoRule(
- Path.of("src/test/resources/base"), InstallEngineMojo.GOAL) {
+ public ProjectMojoRule installUpToDateEngineRule = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), InstallEngineMojo.GOAL){
private static final String TIMESTAMP_FILE_NAME = "downloadtimestamp";
@@ -122,8 +121,7 @@ private boolean isOlderThan24h(File timestampFile) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -1);
long yesterday = cal.getTimeInMillis();
- boolean cachedEngineIsOlderThan24h = yesterday > createTimeMillis;
- return cachedEngineIsOlderThan24h;
+ return yesterday > createTimeMillis;
} catch (IOException ex) { // corrupt state - trigger re-download
return true;
}
@@ -172,7 +170,7 @@ protected void before() throws Throwable {
private void provideClasspathJar() throws IOException {
var cpJar = new SharedFile(project).getEngineOSGiBootClasspathJar();
new ClasspathJar(cpJar).createFileEntries(EngineClassLoaderFactory
- .getOsgiBootstrapClasspath(installUpToDateEngineRule.getMojo().getRawEngineDirectory()));
+ .getOsgiBootstrapClasspath(installUpToDateEngineRule.getMojo().getRawEngineDirectory()));
}
@Override
diff --git a/src/test/java/ch/ivyteam/ivy/maven/ProjectMojoRule.java b/src/test/java/ch/ivyteam/ivy/maven/ProjectMojoRule.java
index 7afbc8a5..4a76baba 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/ProjectMojoRule.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/ProjectMojoRule.java
@@ -40,8 +40,8 @@ public class ProjectMojoRule extends MojoRule {
protected Path projectDir;
private T mojo;
- private String mojoName;
- private Path templateProjectDir;
+ private final String mojoName;
+ private final Path templateProjectDir;
public MavenProject project;
public ProjectMojoRule(Path srcDir, String mojoName) {
@@ -90,4 +90,4 @@ private static void copyDirectory(Path source, Path target) {
throw new UncheckedIOException(ex);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestIarPackagingMojo.java b/src/test/java/ch/ivyteam/ivy/maven/TestIarPackagingMojo.java
index 6808a5c5..6db2324a 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestIarPackagingMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestIarPackagingMojo.java
@@ -45,8 +45,8 @@
public class TestIarPackagingMojo {
@Rule
- public ProjectMojoRule rule = new ProjectMojoRule(
- Path.of("src/test/resources/base"), IarPackagingMojo.GOAL) {
+ public ProjectMojoRule rule = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), IarPackagingMojo.GOAL){
@Override
protected void before() throws Throwable {
@@ -82,28 +82,28 @@ public void archiveCreationDefault() throws Exception {
var iarFile = iarFiles.getFirst();
assertThat(iarFile).hasFileName("base-1.0.0.iar");
assertThat(mojo.project.getArtifact().getFile())
- .as("Created IAR must be registered as artifact for later repository installation.")
- .isEqualTo(iarFile.toFile());
+ .as("Created IAR must be registered as artifact for later repository installation.")
+ .isEqualTo(iarFile.toFile());
try (ZipFile archive = new ZipFile(iarFile.toFile())) {
assertThat(archive.getEntry(".classpath")).as(".classpath must be packed for internal binary retrieval")
- .isNotNull();
+ .isNotNull();
assertThat(archive.getEntry("src_hd")).as("Empty directories should be included (by default) "
- + "so that the IAR can be re-imported into the designer").isNotNull();
+ + "so that the IAR can be re-imported into the designer").isNotNull();
assertThat(archive.getEntry("target/sampleOutput.txt"))
- .as("'target/sampleOutput.txt' should not be packed").isNull();
+ .as("'target/sampleOutput.txt' should not be packed").isNull();
assertThat(archive.getEntry("target")).as("'target' must be packed because there are target/classes")
- .isNotNull();
+ .isNotNull();
assertThat(archive.getEntry(".svn/svn.txt")).as("'.svn' folder should not be packed").isNull();
assertThat(archive.getEntry(".svn")).as("'target'.svn should not be packed").isNull();
assertThat(archive.getEntry("classes/gugus.txt")).as("classes content should be included by default")
- .isNotNull();
+ .isNotNull();
assertThat(archive.getEntry("target/classes/gugus.txt"))
- .as("target/classes content should be included by default").isNotNull();
+ .as("target/classes content should be included by default").isNotNull();
assertThat(archive.getEntry("target/classesAnother/gugus.txt"))
- .as("target/classesAnother should not be packed by default").isNull();
+ .as("target/classesAnother should not be packed by default").isNull();
assertThat(archive.getEntry("target/anythingelse/gugus.txt"))
- .as("target/anythingelse should not be packed by default").isNull();
+ .as("target/anythingelse should not be packed by default").isNull();
}
}
@@ -143,7 +143,7 @@ public void canDefineCustomInclusions() throws Exception {
mojo.execute();
try (ZipFile archive = new ZipFile(mojo.project.getArtifact().getFile())) {
assertThat(archive.getEntry(relativeCustomIncludePath)).as("Custom inclusions must be included")
- .isNotNull();
+ .isNotNull();
}
}
@@ -164,16 +164,16 @@ public void canOverwriteDefaultInclusions() throws Exception {
try (InputStream is = archive.getInputStream(archive.getEntry("pom.xml"))) {
String pomInArchive = new String(is.readAllBytes(), StandardCharsets.UTF_8);
assertThat(pomInArchive)
- .as("customer should be able to overwrite pre-defined resource with their own includes.")
- .contains("flattened");
+ .as("customer should be able to overwrite pre-defined resource with their own includes.")
+ .contains("flattened");
}
List extends ZipEntry> pomEntries = Collections.list(archive.entries()).stream()
- .filter(entry -> entry.getName().equals("pom.xml"))
- .collect(Collectors.toList());
+ .filter(entry -> "pom.xml".equals(entry.getName()))
+ .collect(Collectors.toList());
assertThat(pomEntries)
- .as("if same path is specified twice, the users entry should win and no duplicates must exist.")
- .hasSize(1);
+ .as("if same path is specified twice, the users entry should win and no duplicates must exist.")
+ .hasSize(1);
}
}
@@ -185,7 +185,7 @@ public void canExcludeEmptyDirectories() throws Exception {
try (ZipFile archive = new ZipFile(mojo.project.getArtifact().getFile())) {
assertThat(archive.getEntry("src_hd")).as("Empty directory should be excluded by mojo configuration")
- .isNull();
+ .isNull();
}
}
@@ -203,7 +203,7 @@ public void doNotPackTargetFolderIfThereAreNoTargetClasses() throws Exception {
var iarFile = iarFiles.getFirst();
try (ZipFile archive = new ZipFile(iarFile.toFile())) {
assertThat(archive.getEntry("target"))
- .as("'target' will not be packed when there are no target/classes").isNull();
+ .as("'target' will not be packed when there are no target/classes").isNull();
}
}
@@ -213,7 +213,7 @@ public void includeTarget_srcHdGenerated() throws Exception {
var target = mojo.project.getBasedir().toPath().resolve("target");
var viewGenerated = target.resolve("src_hd")
- .resolve("com").resolve("acme").resolve("FormDialog").resolve("FormDialog.xhtml");
+ .resolve("com").resolve("acme").resolve("FormDialog").resolve("FormDialog.xhtml");
Files.createDirectories(viewGenerated.getParent());
Files.writeString(viewGenerated, "", StandardOpenOption.CREATE_NEW);
@@ -226,7 +226,7 @@ public void includeTarget_srcHdGenerated() throws Exception {
var iarFile = iarFiles.getFirst();
try (ZipFile archive = new ZipFile(iarFile.toFile())) {
assertThat(archive.getEntry("target/src_hd/com/acme/FormDialog/FormDialog.xhtml"))
- .as("generated jsf.dialog views are included").isNotNull();
+ .as("generated jsf.dialog views are included").isNotNull();
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java b/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java
index ad36f471..b279ddc6 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java
@@ -51,8 +51,8 @@ public class TestInstallEngineMojo {
private InstallEngineMojo mojo;
@Rule
- public ProjectMojoRule rule = new ProjectMojoRule(
- Path.of("src/test/resources/base"), InstallEngineMojo.GOAL) {
+ public ProjectMojoRule rule = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), InstallEngineMojo.GOAL){
@Override
protected void before() throws Throwable {
super.before();
@@ -84,7 +84,7 @@ public void testEngineDownload_defaultBehaviour() throws Exception {
var listPageResponse = new MockHttpServerResponse();
String defaultEngineName = "AxonIvyEngine" + DEFAULT_VERSION + ".46949_" + DEFAULT_ARCH;
listPageResponse.setMockResponseContent(
- "the engine!");
+ "the engine!");
mockServer.setMockHttpServerResponses(listPageResponse, createFakeZipResponse(createFakeEngineZip(mojo.ivyVersion)));
// test setup can not expand expression ${settings.localRepository}: so we
@@ -95,18 +95,18 @@ public void testEngineDownload_defaultBehaviour() throws Exception {
var defaultEngineDir = mojo.engineCacheDirectory.resolve(DEFAULT_VERSION);
assertThat(defaultEngineDir).doesNotExist();
assertThat(mojo.engineDownloadUrl)
- .as("Default config should favour to download an engine from the 'list page url'.")
- .isNull();
+ .as("Default config should favour to download an engine from the 'list page url'.")
+ .isNull();
assertThat(mojo.autoInstallEngine).isTrue();
mojo.execute();
assertThat(defaultEngineDir)
- .as("Engine must be automatically downloaded")
- .exists()
- .isDirectory()
- .as("Engine directory should automatically be set to subdir of the local repository cache.")
- .isEqualTo(mojo.getRawEngineDirectory());
+ .as("Engine must be automatically downloaded")
+ .exists()
+ .isDirectory()
+ .as("Engine directory should automatically be set to subdir of the local repository cache.")
+ .isEqualTo(mojo.getRawEngineDirectory());
}
private static MockHttpServerResponse createFakeZipResponse(Path zip) throws Exception {
@@ -180,8 +180,8 @@ public void testEngineDownload_alreadyInstalledVersionTooOld() throws Exception
public void testEngineDownload_ifNotExisting() throws Exception {
mojo.engineDirectory = createTempDir("tmpEngine");
assertThat(mojo.engineDirectory)
- .isDirectory()
- .isEmptyDirectory();
+ .isDirectory()
+ .isEmptyDirectory();
mojo.autoInstallEngine = true;
mockServer.setMockHttpServerResponses(createFakeZipResponse(createFakeEngineZip(mojo.ivyVersion)));
@@ -250,8 +250,8 @@ public void testEngineDownload_overProxy() throws Exception {
downloader.proxies = this::localTestProxy;
var downloaded = downloader.downloadEngine();
assertThat(downloaded)
- .as("served file via proxy")
- .exists();
+ .as("served file via proxy")
+ .exists();
}
private ProxyInfo localTestProxy(@SuppressWarnings("unused") String protocol) {
@@ -297,7 +297,7 @@ public void testEngineLinkFinder_absolute_http() throws Exception {
mojo.restrictVersionToMinimalCompatible = false;
mojo.osArchitecture = "Windows_x86";
assertThat(findLink("the latest engine"))
- .isEqualTo("http://developer.axonivy.com/download/7.0.0/AxonIvyEngine7.0.0.46949_Windows_x86.zip");
+ .isEqualTo("http://developer.axonivy.com/download/7.0.0/AxonIvyEngine7.0.0.46949_Windows_x86.zip");
}
@Test
@@ -306,7 +306,7 @@ public void testEngineLinkFinder_absolute_https() throws Exception {
mojo.restrictVersionToMinimalCompatible = false;
mojo.osArchitecture = "Windows_x86";
assertThat(findLink("the latest engine"))
- .isEqualTo("https://developer.axonivy.com/download/7.0.0/AxonIvyEngine7.0.0.46949_Windows_x86.zip");
+ .isEqualTo("https://developer.axonivy.com/download/7.0.0/AxonIvyEngine7.0.0.46949_Windows_x86.zip");
}
@Test
@@ -316,7 +316,7 @@ public void testEngineLinkFinder_relative() throws Exception {
mojo.osArchitecture = "Windows_x86";
mojo.engineListPageUrl = URI.create("http://localhost/").toURL();
assertThat(findLink("the latest engine"))
- .isEqualTo("http://localhost/7.0.0/AxonIvyEngine7.0.0.46949_Windows_x86.zip");
+ .isEqualTo("http://localhost/7.0.0/AxonIvyEngine7.0.0.46949_Windows_x86.zip");
}
@Test
@@ -325,8 +325,8 @@ public void testEngineLinkFinder_sprintVersionQualifier() throws Exception {
mojo.restrictVersionToMinimalCompatible = false;
mojo.osArchitecture = "Windows_x64";
assertThat(findLink(
- "Axon Ivy Engine Windows x64"))
- .isEqualTo("http://www.ivyteam.ch/downloads/XIVY/Saentis/7.0.0-S2/AxonIvyEngine7.0.0.47245.S2_Windows_x64.zip");
+ "Axon Ivy Engine Windows x64"))
+ .isEqualTo("http://www.ivyteam.ch/downloads/XIVY/Saentis/7.0.0-S2/AxonIvyEngine7.0.0.47245.S2_Windows_x64.zip");
}
@Test
@@ -338,7 +338,7 @@ public void testEngineLinkFinder_wrongVersion() throws Exception {
failBecauseExceptionWasNotThrown(MojoExecutionException.class);
} catch (MojoExecutionException ex) {
assertThat(ex).hasMessageStartingWith(
- "Could not find a link to engine for version '" + DEFAULT_VERSION + "'");
+ "Could not find a link to engine for version '" + DEFAULT_VERSION + "'");
}
}
@@ -348,11 +348,11 @@ public void testEngineLinkFinder_wrongArchitecture() throws Exception {
mojo.osArchitecture = "Linux_x86";
try {
findLink("the latest engine");
+ + DEFAULT_VERSION + ".46949_Windows_x86.zip\">the latest engine");
failBecauseExceptionWasNotThrown(MojoExecutionException.class);
} catch (MojoExecutionException ex) {
assertThat(ex).hasMessageStartingWith(
- "Could not find a link to engine for version '" + DEFAULT_VERSION + "'");
+ "Could not find a link to engine for version '" + DEFAULT_VERSION + "'");
}
}
@@ -364,9 +364,9 @@ public void testEngineLinkFinder_multipleLinks() throws Exception {
mojo.engineListPageUrl = URI.create("http://localhost/").toURL();
assertThat(findLink(
- "the latest engine" // windows
- + "the latest engine")) // linux
- .isEqualTo("http://localhost/7.0.0/AxonIvyEngine7.0.0.46949_Linux_x86.zip");
+ "the latest engine" // windows
+ + "the latest engine")) // linux
+ .isEqualTo("http://localhost/7.0.0/AxonIvyEngine7.0.0.46949_Linux_x86.zip");
}
private String findLink(String html) throws MojoExecutionException, URISyntaxException, IOException {
@@ -384,10 +384,10 @@ public void testDefaultListPage_isAvailable() throws Exception {
String engineUrl = getUrlDownloader().findEngineDownloadUrl(mojo.engineListPageUrl.openStream()).toExternalForm();
assertThat(engineUrl)
- .as("The default engine list page url '" + mojo.engineListPageUrl.toExternalForm() + "' "
- + "must provide an engine for the current default engine version '" + mojo.ivyVersion
- + "'.")
- .contains(mojo.ivyVersion);
+ .as("The default engine list page url '" + mojo.engineListPageUrl.toExternalForm() + "' "
+ + "must provide an engine for the current default engine version '" + mojo.ivyVersion
+ + "'.")
+ .contains(mojo.ivyVersion);
}
private URLEngineDownloader getUrlDownloader() throws MojoExecutionException {
@@ -408,14 +408,14 @@ public void testIvyVersion_mustMatchMinimalPluginVersion() {
@Test
public void testZipFileEngineVersionParser() {
assertThat(InstallEngineMojo.ivyEngineVersionOfZip("AxonIvyEngine6.1.1.51869_Linux_x64.zip"))
- .isEqualTo("6.1.1");
+ .isEqualTo("6.1.1");
assertThat(InstallEngineMojo.ivyEngineVersionOfZip("AxonIvyEngine6.2_Windows_x64.zip"))
- .isEqualTo("6.2");
+ .isEqualTo("6.2");
assertThat(InstallEngineMojo
- .ivyEngineVersionOfZip("AxonIvyDesigner6.1.1-SNAPSHOT.51869-win32.win32.x86_64.zip"))
- .isEqualTo("6.1.1");
+ .ivyEngineVersionOfZip("AxonIvyDesigner6.1.1-SNAPSHOT.51869-win32.win32.x86_64.zip"))
+ .isEqualTo("6.1.1");
assertThat(InstallEngineMojo.ivyEngineVersionOfZip("AxonIvyEngine_Linux_x64.zip"))
- .isEqualTo("AxonIvyEngine_Linux_x64.zip"); // do not return null!
+ .isEqualTo("AxonIvyEngine_Linux_x64.zip"); // do not return null!
}
private static String getFakeLibraryPath(final String version) {
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestLoggerIntegration.java b/src/test/java/ch/ivyteam/ivy/maven/TestLoggerIntegration.java
index ca5b36cf..ecf86f95 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestLoggerIntegration.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestLoggerIntegration.java
@@ -40,7 +40,7 @@ public void forwardEngineLogsToMavenConsole() {
assertThat(slf4jJars).hasSize(3);
assertThat(slf4jJars.get(0).getName()).startsWith("slf4j-api-");
assertThat(outContent.toString())
- .as("no warnings must be printed during slf4j library re-solving from local repo")
- .isEmpty();
+ .as("no warnings must be printed during slf4j library re-solving from local repo")
+ .isEmpty();
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyCleanupMojo.java b/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyCleanupMojo.java
index 2a8f119f..8603f955 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyCleanupMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyCleanupMojo.java
@@ -26,8 +26,8 @@
public class TestMavenDependencyCleanupMojo extends BaseEngineProjectMojoTest {
@Rule
- public ProjectMojoRule compile = new ProjectMojoRule(
- Path.of("src/test/resources/base"), MavenDependencyCleanupMojo.GOAL);
+ public ProjectMojoRule compile = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), MavenDependencyCleanupMojo.GOAL);
@Test
public void noMavenDepsDir() throws Exception {
@@ -42,7 +42,7 @@ public void noMavenDepsDir() throws Exception {
public void cleanupMavenDepsDir() throws Exception {
var mojo = compile.getMojo();
var mvnLibDir = Files
- .createDirectories(mojo.project.getBasedir().toPath().resolve("lib").resolve("mvn-deps"));
+ .createDirectories(mojo.project.getBasedir().toPath().resolve("lib").resolve("mvn-deps"));
var mvnDep = Files.copy(Path.of("src/test/resources/jjwt-0.9.1.jar"), mvnLibDir.resolve("jjwt-0.9.1.jar"));
assertThat(mvnLibDir).exists();
assertThat(mvnDep).exists();
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyMojo.java b/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyMojo.java
index b9f000ca..b4ad1faf 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestMavenDependencyMojo.java
@@ -37,8 +37,8 @@ public class TestMavenDependencyMojo extends BaseEngineProjectMojoTest {
private MavenDependencyMojo testMojo;
@Rule
- public CompileMojoRule deps = new CompileMojoRule(
- MavenDependencyMojo.GOAL) {
+ public CompileMojoRule deps = new CompileMojoRule<>(
+ MavenDependencyMojo.GOAL){
@Override
protected void before() throws Throwable {
super.before();
@@ -80,12 +80,12 @@ public void onlyLocalDeps() throws Exception {
Artifact artifact = new ArtifactStubFactory().createArtifact("io.jsonwebtoken", "jjwt", "0.9.1");
artifact.setFile(Path.of("src/test/resources/jjwt-0.9.1.jar").toFile());
artifact.setDependencyTrail(
- List.of(mojo.project.getArtifact().toString(), "other.group:other.artifact:iar:1.0.0"));
+ List.of(mojo.project.getArtifact().toString(), "other.group:other.artifact:iar:1.0.0"));
mojo.project.setArtifacts(Set.of(artifact));
mojo.execute();
assertThat(getMavenLibs(mvnLibDir))
- .as("libs provided through a dependent 'iar' should not be packed.")
- .isEmpty();
+ .as("libs provided through a dependent 'iar' should not be packed.")
+ .isEmpty();
}
private static List getMavenLibs(Path mvnLibDir) throws IOException {
@@ -94,9 +94,9 @@ private static List getMavenLibs(Path mvnLibDir) throws IOException {
}
try (var walker = Files.walk(mvnLibDir, 1)) {
return walker
- .filter(p -> !p.equals(mvnLibDir))
- .map(p -> p.getFileName().toString())
- .collect(Collectors.toList());
+ .filter(p -> !p.equals(mvnLibDir))
+ .map(p -> p.getFileName().toString())
+ .collect(Collectors.toList());
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestShareEngineClasspathMojo.java b/src/test/java/ch/ivyteam/ivy/maven/TestShareEngineClasspathMojo.java
index a18fd6eb..37ddfa94 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestShareEngineClasspathMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestShareEngineClasspathMojo.java
@@ -34,22 +34,22 @@ public class TestShareEngineClasspathMojo {
public void engineClasspathIsSharedAsProperty() throws Exception {
ShareEngineCoreClasspathMojo mojo = rule.getMojo();
assertThat(getEngineClasspathProperty())
- .as("used classpath has not been evaluated.")
- .isNullOrEmpty();
+ .as("used classpath has not been evaluated.")
+ .isNullOrEmpty();
mojo.execute();
assertThat(getEngineClasspathProperty())
- .as("used classpath must be shared as property so that other mojos can access it")
- .contains("dummy-boot.jar");
+ .as("used classpath must be shared as property so that other mojos can access it")
+ .contains("dummy-boot.jar");
}
private String getEngineClasspathProperty() {
return (String) rule.getMojo().project.getProperties()
- .get(ShareEngineCoreClasspathMojo.IVY_ENGINE_CORE_CLASSPATH_PROPERTY);
+ .get(ShareEngineCoreClasspathMojo.IVY_ENGINE_CORE_CLASSPATH_PROPERTY);
}
@Rule
- public ProjectMojoRule rule = new ProjectMojoRule(Path.of("src/test/resources/base"), ShareEngineCoreClasspathMojo.GOAL) {
+ public ProjectMojoRule rule = new ProjectMojoRule(Path.of("src/test/resources/base"), ShareEngineCoreClasspathMojo.GOAL){
@Override
protected void before() throws Throwable {
diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestSlf4jWarningConfiguration.java b/src/test/java/ch/ivyteam/ivy/maven/TestSlf4jWarningConfiguration.java
index 5ae30929..82c3745a 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/TestSlf4jWarningConfiguration.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/TestSlf4jWarningConfiguration.java
@@ -17,7 +17,7 @@ class TestSlf4jWarningConfiguration {
void mavenLikeWarning() {
Slf4jSimpleEngineProperties.install();
assertThat(System.getProperty(SimpleLogger.WARN_LEVEL_STRING_KEY))
- .as("SLF4J warning string is not maven-like [WARNING]")
- .isEqualTo("WARNING");
+ .as("SLF4J warning string is not maven-like [WARNING]")
+ .isEqualTo("WARNING");
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/compile/CompileMojoRule.java b/src/test/java/ch/ivyteam/ivy/maven/compile/CompileMojoRule.java
index 94ece336..b2e39672 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/compile/CompileMojoRule.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/compile/CompileMojoRule.java
@@ -51,16 +51,16 @@ public void configureMojo(AbstractEngineInstanceMojo newMojo) throws IllegalAcce
private ArtifactRepository provideLocalRepository() throws IllegalAccessException {
DefaultArtifactRepositoryFactory factory = new DefaultArtifactRepositoryFactory();
setVariableValueToObject(factory, "factory",
- new org.apache.maven.repository.legacy.repository.DefaultArtifactRepositoryFactory());
+ new org.apache.maven.repository.legacy.repository.DefaultArtifactRepositoryFactory());
LegacySupport legacySupport = new DefaultLegacySupport();
setVariableValueToObject(factory, "legacySupport", legacySupport);
ArtifactRepository localRepository = factory.createArtifactRepository("local", "http://localhost",
- new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy());
+ new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy());
setVariableValueToObject(localRepository, "basedir", BaseEngineProjectMojoTest.LOCAL_REPOSITORY);
return localRepository;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/compile/TestCompileProjectMojo.java b/src/test/java/ch/ivyteam/ivy/maven/compile/TestCompileProjectMojo.java
index c6f3ff1d..45440f2a 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/compile/TestCompileProjectMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/compile/TestCompileProjectMojo.java
@@ -34,8 +34,8 @@ public class TestCompileProjectMojo extends BaseEngineProjectMojoTest {
private CompileTestProjectMojo testMojo;
@Rule
- public CompileMojoRule compile = new CompileMojoRule(
- CompileProjectMojo.GOAL) {
+ public CompileMojoRule compile = new CompileMojoRule<>(
+ CompileProjectMojo.GOAL){
@Override
protected void before() throws Throwable {
super.before();
@@ -62,16 +62,16 @@ public void buildWithExistingProject() throws Exception {
assertThat(findFiles(wsProcDir, "java")).hasSize(1);
assertThat(findFiles(classDir, "txt"))
- .as("classes directory must only be cleand by the builder before compilation if class files are found")
- .hasSize(1);
+ .as("classes directory must only be cleand by the builder before compilation if class files are found")
+ .hasSize(1);
assertThat(findFiles(classDir, "class"))
- .as("compiled classes must exist. but not contain any test class or old class files.")
- .hasSize(4);
+ .as("compiled classes must exist. but not contain any test class or old class files.")
+ .hasSize(4);
testMojo.execute();
assertThat(findFiles(classDir, "class"))
- .as("compiled classes must contain test resources as well")
- .hasSize(5);
+ .as("compiled classes must contain test resources as well")
+ .hasSize(5);
}
private static List findFiles(Path dir, String fileExtension) throws IOException {
@@ -80,8 +80,8 @@ private static List findFiles(Path dir, String fileExtension) throws IOExc
}
try (var stream = Files.walk(dir)) {
return stream
- .filter(p -> p.getFileName().toString().endsWith("." + fileExtension))
- .toList();
+ .filter(p -> p.getFileName().toString().endsWith("." + fileExtension))
+ .toList();
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java
index 2dab4cdb..a599f385 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java
@@ -56,8 +56,8 @@ public void deployPackedIar() throws Throwable {
mockEngineDeployThread.failOnException();
assertThat(deployedIar)
- .as("IAR should not exist in engine deploy directory")
- .doesNotExist();
+ .as("IAR should not exist in engine deploy directory")
+ .doesNotExist();
}
@Test
@@ -86,8 +86,8 @@ public void deployWithExistingOptionsFile() throws Throwable {
mockEngineDeployThread.failOnException();
assertThat(deployedIar)
- .as("IAR should not exist in engine deploy directory")
- .doesNotExist();
+ .as("IAR should not exist in engine deploy directory")
+ .doesNotExist();
}
@Test
@@ -108,12 +108,12 @@ public void deployWithOptions() throws Throwable {
Callable engineOperation = () -> {
assertThat(deploymentOptionsFile).exists();
assertThat(deploymentOptionsFile).hasContent(
- """
- deployTestUsers: "TRUE"
- target:
- version: RELEASED
- state: INACTIVE
- fileFormat: EXPANDED""");
+ """
+ deployTestUsers: "TRUE"
+ target:
+ version: RELEASED
+ state: INACTIVE
+ fileFormat: EXPANDED""");
Files.delete(deploymentOptionsFile);
assertThat(deployedIar).exists();
Files.delete(deployedIar);
@@ -124,8 +124,8 @@ public void deployWithOptions() throws Throwable {
mockEngineDeployThread.failOnException();
assertThat(deployedIar)
- .as("IAR should not exist in engine deploy directory")
- .doesNotExist();
+ .as("IAR should not exist in engine deploy directory")
+ .doesNotExist();
}
@Test
@@ -155,14 +155,14 @@ public void failOnEngineDeployError() throws Throwable {
private static Path getTarget(Path iar, DeployToEngineMojo mojo) {
return mojo.deployEngineDirectory
- .resolve(mojo.deployDirectory)
- .resolve(mojo.deployToEngineApplication)
- .resolve(iar.getFileName().toString());
+ .resolve(mojo.deployDirectory)
+ .resolve(mojo.deployToEngineApplication)
+ .resolve(iar.getFileName().toString());
}
@Rule
- public ProjectMojoRule rule = new ProjectMojoRule(
- Path.of("src/test/resources/base"), DeployToEngineMojo.GOAL) {
+ public ProjectMojoRule rule = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), DeployToEngineMojo.GOAL){
@Override
protected void before() throws Throwable {
super.before();
@@ -203,7 +203,7 @@ public DelayedOperation(long delay, TimeUnit unit) {
}
public void execute(Callable delayedFunction) {
- thread = new Thread() {
+ thread = new Thread(){
@Override
public void run() {
try {
diff --git a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java
index 962624ec..9024e7a8 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java
@@ -98,7 +98,7 @@ public void canDeployRemoteIar_settingsPassword() throws Exception {
public void canDeployRemoteIar_encryptedSettingsPassword() throws Exception {
addServerConnection("{VUpeDRRbfD4Hmk9WLKzhqLkLttTCsWfLtr75Nt9K/3k=}");
System.setProperty("settings.security",
- TestDeployToRunningEngine.class.getResource("settings-security.xml").getPath());
+ TestDeployToRunningEngine.class.getResource("settings-security.xml").getPath());
deployIarRemoteAndAssert();
}
@@ -120,15 +120,15 @@ private void deployIarRemoteAndAssert() throws Exception, MojoExecutionException
System.setOut(originalOut);
startedProcess = mojo.startEngine();
deployMojo.deployEngineUrl = (String) rule.project.getProperties()
- .get(EngineControl.Property.TEST_ENGINE_URL);
+ .get(EngineControl.Property.TEST_ENGINE_URL);
System.setOut(new PrintStream(outContent));
deployMojo.execute();
assertThat(outContent.toString()).contains("Start deploying project(s) of file")
- .contains("Application: test")
- .contains("Deploying users ...")
- .doesNotContain("deployDirectory is set but will not be used for HTTP Deployment.");
+ .contains("Application: test")
+ .contains("Deploying users ...")
+ .doesNotContain("deployDirectory is set but will not be used for HTTP Deployment.");
} finally {
kill(startedProcess);
}
@@ -136,9 +136,9 @@ private void deployIarRemoteAndAssert() throws Exception, MojoExecutionException
private static Path getTarget(Path iar, DeployToEngineMojo mojo) {
return mojo.deployEngineDirectory
- .resolve(mojo.deployDirectory)
- .resolve(mojo.deployToEngineApplication)
- .resolve(iar.getFileName().toString());
+ .resolve(mojo.deployDirectory)
+ .resolve(mojo.deployToEngineApplication)
+ .resolve(iar.getFileName().toString());
}
private static void kill(Process startedProcess) {
@@ -148,11 +148,11 @@ private static void kill(Process startedProcess) {
}
@Rule
- public RunnableEngineMojoRule rule = new RunnableEngineMojoRule(
- StartTestEngineMojo.GOAL);
+ public RunnableEngineMojoRule rule = new RunnableEngineMojoRule<>(
+ StartTestEngineMojo.GOAL);
@Rule
- public ProjectMojoRule deployRule = new ProjectMojoRule(
- Path.of("src/test/resources/base"), DeployToEngineMojo.GOAL);
+ public ProjectMojoRule deployRule = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), DeployToEngineMojo.GOAL);
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java
index e1e6523d..f0ab5695 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java
@@ -51,14 +51,14 @@ public void autoAppZip() throws ArchiverException, IOException {
Files.createFile(builtTarget.resolve("alreadyPacked.iar"));
var appZip = mojo.createFullAppZip(List.of(
- Files.createFile(workspace.resolve("demo.iar")),
- Files.createFile(workspace.resolve("demoTest.iar")),
- reactorProject,
- builtTarget.getParent()));
+ Files.createFile(workspace.resolve("demo.iar")),
+ Files.createFile(workspace.resolve("demoTest.iar")),
+ reactorProject,
+ builtTarget.getParent()));
assertThat(appZip.getFileName().toString()).isEqualTo("myApp-app.zip");
assertThat(DeployToTestEngineMojo.findPackedIar(builtTarget.getParent())).isPresent();
assertThat(getRootFiles(appZip))
- .containsOnly("demo.iar", "demoTest.iar", "myReactorProject", "alreadyPacked.iar");
+ .containsOnly("demo.iar", "demoTest.iar", "myReactorProject", "alreadyPacked.iar");
}
private static List getRootFiles(Path zip) throws IOException {
@@ -67,8 +67,8 @@ private static List getRootFiles(Path zip) throws IOException {
Path root = zipFsCr.getPath("/");
try (Stream paths = Files.list(root)) {
return paths
- .map(child -> child.getFileName().toString())
- .collect(Collectors.toList());
+ .map(child -> child.getFileName().toString())
+ .collect(Collectors.toList());
}
}
}
@@ -80,6 +80,6 @@ public void appNameSanitizing() {
@Rule
public ProjectMojoRule deploy = new ProjectMojoRule<>(
- Path.of("src/test/resources/base"), DeployToTestEngineMojo.TEST_GOAL);
+ Path.of("src/test/resources/base"), DeployToTestEngineMojo.TEST_GOAL);
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java b/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java
index 82414356..59a9d7f3 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java
@@ -53,8 +53,8 @@ void readWriteClasspath() throws IOException {
String manifest = new String(in.readAllBytes(), StandardCharsets.UTF_8);
assertThat(manifest)
- .as("Manifest should not start with a whitespace or it will not be interpreted by the JVM")
- .startsWith("Manifest-Version:");
+ .as("Manifest should not start with a whitespace or it will not be interpreted by the JVM")
+ .startsWith("Manifest-Version:");
}
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineControl.java b/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineControl.java
index 2351a33c..d1aacdcf 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineControl.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineControl.java
@@ -30,8 +30,8 @@
public class TestEngineControl extends BaseEngineProjectMojoTest {
@Rule
- public RunnableEngineMojoRule rule = new RunnableEngineMojoRule(
- StopTestEngineMojo.GOAL);
+ public RunnableEngineMojoRule rule = new RunnableEngineMojoRule<>(
+ StopTestEngineMojo.GOAL);
@Test
public void resolveEngineState() throws MojoExecutionException {
diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/download/TestLatestMinorVersionRange.java b/src/test/java/ch/ivyteam/ivy/maven/engine/download/TestLatestMinorVersionRange.java
index c5e53e7b..82aa8b2a 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/engine/download/TestLatestMinorVersionRange.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/engine/download/TestLatestMinorVersionRange.java
@@ -14,7 +14,7 @@ void get() {
assertThat(new LatestMinorVersionRange("8.1.0").get().toString()).isEqualTo("[8.1.0,8.2.0)");
assertThatThrownBy(() -> new LatestMinorVersionRange("8").get())
- .isInstanceOf(RuntimeException.class)
- .hasMessage("Could not calculate version spec from 8");
+ .isInstanceOf(RuntimeException.class)
+ .hasMessage("Could not calculate version spec from 8");
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/log/LogCollector.java b/src/test/java/ch/ivyteam/ivy/maven/log/LogCollector.java
index b9fb5e65..697feb3a 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/log/LogCollector.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/log/LogCollector.java
@@ -36,8 +36,8 @@ public class LogCollector implements Log {
private final List errors = new ArrayList<>();
public static class LogEntry {
- private String message;
- private Throwable error;
+ private final String message;
+ private final Throwable error;
private LogEntry(String message, Throwable error) {
if (message == null) {
@@ -75,8 +75,7 @@ public List getErrors() {
}
public List getLogs() {
- List logs = new ArrayList<>();
- logs.addAll(debuggings);
+ List logs = new ArrayList<>(debuggings);
logs.addAll(infos);
logs.addAll(warnings);
logs.addAll(errors);
diff --git a/src/test/java/ch/ivyteam/ivy/maven/test/TestEngineControlEngineDirectory.java b/src/test/java/ch/ivyteam/ivy/maven/test/TestEngineControlEngineDirectory.java
index caf714d5..4de74f20 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/test/TestEngineControlEngineDirectory.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/test/TestEngineControlEngineDirectory.java
@@ -12,8 +12,8 @@
public class TestEngineControlEngineDirectory extends BaseEngineProjectMojoTest {
@Rule
- public RunnableEngineMojoRule rule = new RunnableEngineMojoRule(
- StopTestEngineMojo.GOAL);
+ public RunnableEngineMojoRule rule = new RunnableEngineMojoRule<>(
+ StopTestEngineMojo.GOAL);
@Test
public void engineControl_engineDir_doesNotExist() throws Exception {
diff --git a/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java b/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java
index a65e4586..8fcba516 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java
@@ -48,14 +48,14 @@ public class TestSetupIvyTestPropertiesMojo extends BaseEngineProjectMojoTest {
public void engineClasspathIsSharedAsProperty() throws Exception {
var mojo = rule.getMojo();
assertThat(getProperty(Property.IVY_ENGINE_CLASSPATH))
- .as("used classpath has not been evaluated.")
- .isNullOrEmpty();
+ .as("used classpath has not been evaluated.")
+ .isNullOrEmpty();
assertThat(getProperty(Property.MAVEN_TEST_ARGLINE)).isNullOrEmpty();
mojo.execute();
assertThat(getProperty(Property.IVY_ENGINE_CLASSPATH))
- .as("used classpath must be shared as property so that other mojos can access it")
- .isNotEmpty();
+ .as("used classpath must be shared as property so that other mojos can access it")
+ .isNotEmpty();
}
@Test
@@ -77,11 +77,11 @@ public void engineClasspathIsConfiguredForSurefire() throws Exception {
MavenProject project = rule.getMojo().project;
assertThat(project.getBuild().getTestOutputDirectory())
- .isEqualTo(project.getBasedir().toPath().resolve("classes-test").toAbsolutePath().toString());
+ .isEqualTo(project.getBasedir().toPath().resolve("classes-test").toAbsolutePath().toString());
assertThat(project.getProperties().get(Property.MAVEN_TEST_ADDITIONAL_CLASSPATH))
- .isEqualTo("${" + Property.IVY_TEST_VM_RUNTIME + "},"
- + "${" + Property.IVY_ENGINE_CLASSPATH + "},"
- + "${" + Property.IVY_PROJECT_IAR_CLASSPATH + "}");
+ .isEqualTo("${" + Property.IVY_TEST_VM_RUNTIME + "},"
+ + "${" + Property.IVY_ENGINE_CLASSPATH + "},"
+ + "${" + Property.IVY_PROJECT_IAR_CLASSPATH + "}");
}
@Test
@@ -91,13 +91,13 @@ public void ivyTestRuntimeClasspathResource() throws Exception {
MavenProject project = rule.getMojo().project;
String vmRtEntry = project.getProperties().getProperty(Property.IVY_TEST_VM_RUNTIME);
Properties props = new Properties();
- try (var loader = new URLClassLoader(new URL[] { Path.of(vmRtEntry).toUri().toURL()}, null);
- var is = loader.getResourceAsStream(IvyTestRuntime.RUNTIME_PROPS_RESOURCE)) {
+ try (var loader = new URLClassLoader(new URL[] {Path.of(vmRtEntry).toUri().toURL()}, null);
+ var is = loader.getResourceAsStream(IvyTestRuntime.RUNTIME_PROPS_RESOURCE)) {
props.load(is);
}
assertThat(props.getProperty(Key.PRODUCT_DIR)).isNotEmpty();
assertThat(props.getProperty(Key.PROJECT_LOCATIONS))
- .isEqualTo("<" + rule.getMojo().project.getBasedir().toPath().toUri() + ">");
+ .isEqualTo("<" + rule.getMojo().project.getBasedir().toPath().toUri() + ">");
}
@Test
@@ -126,8 +126,8 @@ protected void before() throws Throwable {
private void writeTestClasspathJar() throws IOException {
var classPathJar = new SharedFile(getMojo().project).getEngineClasspathJar();
new ClasspathJar(classPathJar).createFileEntries(List.of(
- Files.createTempFile("dummy", ".jar").toFile(),
- Files.createTempFile("dummy2", ".jar").toFile()));
+ Files.createTempFile("dummy", ".jar").toFile(),
+ Files.createTempFile("dummy2", ".jar").toFile()));
}
private void writeTestCompileResult() throws IOException {
diff --git a/src/test/java/ch/ivyteam/ivy/maven/test/TestShareIntegrationTestPropertiesMojo.java b/src/test/java/ch/ivyteam/ivy/maven/test/TestShareIntegrationTestPropertiesMojo.java
index 7ce899dc..2e464fc8 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/test/TestShareIntegrationTestPropertiesMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/test/TestShareIntegrationTestPropertiesMojo.java
@@ -55,7 +55,7 @@ public void shareFailsafeProps() throws MojoExecutionException, MojoFailureExcep
mojo.execute();
String argLine = (String) props.get(SetupIntegrationTestPropertiesMojo.FAILSAFE_ARGLINE_PROPERTY);
assertThat(argLine)
- .startsWith("-Dtest.engine.url=http://127.0.0.1:9999 -Dtest.engine.log=/var/logs/ivy.log -Dtest.engine.app=myTstApp")
- .contains(" --add-opens=");
+ .startsWith("-Dtest.engine.url=http://127.0.0.1:9999 -Dtest.engine.log=/var/logs/ivy.log -Dtest.engine.app=myTstApp")
+ .contains(" --add-opens=");
}
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/test/TestStartEngine.java b/src/test/java/ch/ivyteam/ivy/maven/test/TestStartEngine.java
index 59703449..42671d76 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/test/TestStartEngine.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/test/TestStartEngine.java
@@ -47,8 +47,8 @@ public void canStartEngine() throws Exception {
try {
startedProcess = mojo.startEngine();
assertThat(getProperty(EngineControl.Property.TEST_ENGINE_URL))
- .startsWith("http://")
- .endsWith("/");
+ .startsWith("http://")
+ .endsWith("/");
assertThat(Path.of(getProperty(EngineControl.Property.TEST_ENGINE_LOG))).exists();
} finally {
kill(startedProcess);
@@ -69,7 +69,7 @@ public void startEngine_MODIFY_EXISTING_configuredEngine() throws MojoExecutionE
mojo.testEngine = TestEngineLocation.MODIFY_EXISTING;
mojo.engineDirectory = Files.createTempDirectory("test");
assertThat(mojo.engineToTarget()).as("MODIFY_EXISTING set and using configured engine do not copy")
- .isFalse();
+ .isFalse();
}
@Test
@@ -93,7 +93,7 @@ public void startEngine_COPY_FROM_TEMPLATE_configuredEngine() throws MojoExecuti
mojo.testEngine = TestEngineLocation.COPY_FROM_TEMPLATE;
mojo.engineDirectory = Files.createTempDirectory("test");
assertThat(mojo.engineToTarget()).as("COPY_FROM_TEMPLATE set and using configured engine do copy")
- .isTrue();
+ .isTrue();
}
@Test
@@ -117,7 +117,7 @@ public void startEngine_COPY_FROM_CACHE_configuredEngine() throws MojoExecutionE
mojo.testEngine = TestEngineLocation.COPY_FROM_CACHE;
mojo.engineDirectory = Files.createTempDirectory("test");
assertThat(mojo.engineToTarget()).as("COPY_FROM_CACHE set and using configured engine do not copy")
- .isFalse();
+ .isFalse();
}
@Test
@@ -135,8 +135,8 @@ public void startEngine_copyEngineToTarget() throws Exception {
mojo.testEngine = TestEngineLocation.COPY_FROM_TEMPLATE;
var engineDirTarget = mojo.getEngineDir(mojo.project);
assertThat(engineDirTarget)
- .endsWithRaw(Path.of("target").resolve("ivyEngine"))
- .doesNotExist();
+ .endsWithRaw(Path.of("target").resolve("ivyEngine"))
+ .doesNotExist();
startedProcess = mojo.startEngine();
assertThat(engineDirTarget).exists();
@@ -155,8 +155,8 @@ public void startEngine_targetDirectoryNotClean() throws Exception {
try {
var engineDirTarget = mojo.getEngineDir(mojo.project);
assertThat(engineDirTarget)
- .endsWithRaw(Path.of("target").resolve("ivyEngine"))
- .doesNotExist();
+ .endsWithRaw(Path.of("target").resolve("ivyEngine"))
+ .doesNotExist();
assertThat(log.getWarnings().toString()).doesNotContain("Skipping copy");
startedProcess = mojo.startEngine();
@@ -193,16 +193,14 @@ public void startEngine_copiedEngine_executable() throws Exception {
private void assertFileExecutable(Path file) {
assertThat(file)
- .exists()
- .isExecutable();
+ .exists()
+ .isExecutable();
}
private static void kill(Process startedProcess) {
if (startedProcess != null) {
startedProcess.destroy();
- await().untilAsserted(() ->
- assertThat(startedProcess.isAlive()).as("gracefully wait on stop").isFalse()
- );
+ await().untilAsserted(() -> assertThat(startedProcess.isAlive()).as("gracefully wait on stop").isFalse());
}
}
@@ -211,8 +209,8 @@ private String getProperty(String name) {
}
@Rule
- public RunnableEngineMojoRule rule = new RunnableEngineMojoRule(
- StartTestEngineMojo.GOAL) {
+ public RunnableEngineMojoRule rule = new RunnableEngineMojoRule<>(
+ StartTestEngineMojo.GOAL){
@Override
protected void before() throws Throwable {
super.before();
diff --git a/src/test/java/ch/ivyteam/ivy/maven/util/TestPathUtils.java b/src/test/java/ch/ivyteam/ivy/maven/util/TestPathUtils.java
index ed1e83fc..c4e46c44 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/util/TestPathUtils.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/util/TestPathUtils.java
@@ -11,7 +11,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
-
class TestPathUtils {
@Test
diff --git a/src/test/java/ch/ivyteam/ivy/maven/validate/TestValidateMojo.java b/src/test/java/ch/ivyteam/ivy/maven/validate/TestValidateMojo.java
index fa7fe966..34ec85fa 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/validate/TestValidateMojo.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/validate/TestValidateMojo.java
@@ -16,13 +16,12 @@
import ch.ivyteam.ivy.maven.ProjectMojoRule;
import ch.ivyteam.ivy.maven.log.LogCollector;
-
public class TestValidateMojo {
private ValidateMojo mojo;
@Rule
- public ProjectMojoRule rule = new ProjectMojoRule(
- Path.of("src/test/resources/base"), ValidateMojo.GOAL) {
+ public ProjectMojoRule rule = new ProjectMojoRule<>(
+ Path.of("src/test/resources/base"), ValidateMojo.GOAL){
@Override
protected void before() throws Throwable {
super.before();
@@ -39,9 +38,9 @@ public void samePluginVersions() throws Exception {
mojo.validateConsistentPluginVersion(List.of(p1, p2));
assertThat(log.getDebug()).hasSize(2);
assertThat(log.getDebug().get(0).toString())
- .contains("com.axonivy.ivy.ci:project-build-plugin:12.0.0 configured in MavenProject: group:project1:12.0.0-SNAPSHOT");
+ .contains("com.axonivy.ivy.ci:project-build-plugin:12.0.0 configured in MavenProject: group:project1:12.0.0-SNAPSHOT");
assertThat(log.getDebug().get(1).toString())
- .contains("com.axonivy.ivy.ci:project-build-plugin:12.0.0 configured in MavenProject: group:project2:12.0.0-SNAPSHOT");
+ .contains("com.axonivy.ivy.ci:project-build-plugin:12.0.0 configured in MavenProject: group:project2:12.0.0-SNAPSHOT");
assertThat(log.getErrors()).isEmpty();
}
@@ -52,13 +51,13 @@ public void differentPluginVersions() throws Exception {
var p1 = createMavenProject("project1", "12.0.0");
var p2 = createMavenProject("project2", "12.0.1");
assertThatThrownBy(() -> mojo.validateConsistentPluginVersion(List.of(p1, p2)))
- .isInstanceOf(MojoExecutionException.class);
+ .isInstanceOf(MojoExecutionException.class);
assertThat(log.getErrors()).hasSize(1);
assertThat(log.getErrors().get(0).toString())
- .isEqualTo("""
- Several versions of project-build-plugins are configured [12.0.0, 12.0.1]:
- 12.0.0 -> [project1]
- 12.0.1 -> [project2]""");
+ .isEqualTo("""
+ Several versions of project-build-plugins are configured [12.0.0, 12.0.1]:
+ 12.0.0 -> [project1]
+ 12.0.1 -> [project2]""");
}
private MavenProject createMavenProject(String projectId, String version) {