dependencies = getToolRepository().findDependencies(this.tool, toolEdition.edition(), version);
int size = dependencies.size();
- this.context.debug("Tool {} has {} other tool(s) as dependency", toolEdition, size);
+ LOG.debug("Tool {} has {} other tool(s) as dependency", toolEdition, size);
for (ToolDependency dependency : dependencies) {
- this.context.trace("Ensuring dependency {} for tool {}", dependency.tool(), toolEdition);
+ LOG.trace("Ensuring dependency {} for tool {}", dependency.tool(), toolEdition);
LocalToolCommandlet dependencyTool = this.context.getCommandletManager().getRequiredLocalToolCommandlet(dependency.tool());
dependencyTool.installAsDependency(dependency.versionRange(), request);
}
@@ -346,7 +356,7 @@ protected VersionIdentifier getInstalledVersion(Path toolPath) {
if (Files.exists(legacyToolVersionFile)) {
toolVersionFile = legacyToolVersionFile;
} else {
- this.context.warning("Tool {} is missing version file in {}", getName(), toolVersionFile);
+ LOG.warn("Tool {} is missing version file in {}", getName(), toolVersionFile);
return null;
}
}
@@ -373,7 +383,7 @@ protected String getInstalledEdition(Path toolPath) {
// if the realPath changed, a link has been resolved
if (realPath.equals(toolPath)) {
if (!isIgnoreSoftwareRepo()) {
- this.context.warning("Tool {} is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.", this.tool);
+ LOG.warn("Tool {} is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.", this.tool);
}
// I do not see any reliable way how we could determine the edition of a tool that does not use software repo or that was installed by devonfw-ide
return getConfiguredEdition();
@@ -384,7 +394,7 @@ protected String getInstalledEdition(Path toolPath) {
edition = this.tool;
}
if (!getToolRepository().getSortedEditions(this.tool).contains(edition)) {
- this.context.warning("Undefined edition {} of tool {}", edition, this.tool);
+ LOG.warn("Undefined edition {} of tool {}", edition, this.tool);
}
return edition;
}
@@ -413,7 +423,7 @@ private Path getInstalledSoftwareRepoPath(Path toolPath) {
// if the installPath changed, a link has been resolved
if (installPath.equals(toolPath)) {
if (!isIgnoreSoftwareRepo()) {
- this.context.warning("Tool {} is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.", this.tool);
+ LOG.warn("Tool {} is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.", this.tool);
}
// I do not see any reliable way how we could determine the edition of a tool that does not use software repo or that was installed by devonfw-ide
return null;
@@ -429,13 +439,13 @@ Path getValidInstalledSoftwareRepoPath(Path installPath, Path softwareRepoPath)
// installPath can't be shorter than softwareRepoPath
if (toolInstallNameCount < softwareRepoNameCount) {
- this.context.warning("The installation path is not located within the software repository {}.", installPath);
+ LOG.warn("The installation path is not located within the software repository {}.", installPath);
return null;
}
// ensure installPath starts with $IDE_ROOT/_ide/software/
for (int i = 0; i < softwareRepoNameCount; i++) {
if (!softwareRepoPath.getName(i).toString().equals(installPath.getName(i).toString())) {
- this.context.warning("The installation path is not located within the software repository {}.", installPath);
+ LOG.warn("The installation path is not located within the software repository {}.", installPath);
return null;
}
}
@@ -449,7 +459,7 @@ Path getValidInstalledSoftwareRepoPath(Path installPath, Path softwareRepoPath)
}
return validInstallPath;
} else {
- this.context.warning("The installation path is faulty {}.", installPath);
+ LOG.warn("The installation path is faulty {}.", installPath);
return null;
}
}
@@ -457,7 +467,7 @@ Path getValidInstalledSoftwareRepoPath(Path installPath, Path softwareRepoPath)
private boolean isToolNotInstalled(Path toolPath) {
if ((toolPath == null) || !Files.isDirectory(toolPath)) {
- this.context.debug("Tool {} not installed in {}", this.tool, toolPath);
+ LOG.debug("Tool {} not installed in {}", this.tool, toolPath);
return true;
}
return false;
@@ -468,11 +478,11 @@ public void uninstall() {
try {
Path toolPath = getToolPath();
if (!Files.exists(toolPath)) {
- this.context.warning("An installed version of {} does not exist.", this.tool);
+ LOG.warn("An installed version of {} does not exist.", this.tool);
return;
}
if (this.context.isForceMode() && !isIgnoreSoftwareRepo()) {
- this.context.warning(
+ LOG.warn(
"You triggered an uninstall of {} in version {} with force mode!\n"
+ "This will physically delete the currently installed version from the machine.\n"
+ "This may cause issues with other projects, that use the same version of that tool."
@@ -480,9 +490,9 @@ public void uninstall() {
uninstallFromSoftwareRepository(toolPath);
}
performUninstall(toolPath);
- this.context.success("Successfully uninstalled {}", this.tool);
+ IdeLogLevel.SUCCESS.log(LOG, "Successfully uninstalled {}", this.tool);
} catch (Exception e) {
- this.context.error(e, "Failed to uninstall {}", this.tool);
+ LOG.error("Failed to uninstall {}", this.tool, e);
}
}
@@ -501,12 +511,12 @@ protected void performUninstall(Path toolPath) {
private void uninstallFromSoftwareRepository(Path toolPath) {
Path repoPath = getInstalledSoftwareRepoPath(toolPath);
if ((repoPath == null) || !Files.exists(repoPath)) {
- this.context.warning("An installed version of {} does not exist in software repository.", this.tool);
+ LOG.warn("An installed version of {} does not exist in software repository.", this.tool);
return;
}
- this.context.info("Physically deleting {} as requested by the user via force mode.", repoPath);
+ LOG.info("Physically deleting {} as requested by the user via force mode.", repoPath);
this.context.getFileAccess().delete(repoPath);
- this.context.success("Successfully deleted {} from your computer.", repoPath);
+ IdeLogLevel.SUCCESS.log(LOG, "Successfully deleted {} from your computer.", repoPath);
}
@Override
@@ -546,7 +556,7 @@ protected Path findWrapper(String wrapperFileName) {
while ((dir != null) && (findBuildDescriptor(dir) != null)) {
Path wrapper = dir.resolve(wrapperFileName);
if (Files.exists(wrapper)) {
- context.debug("Using wrapper: {}", wrapper);
+ LOG.debug("Using wrapper: {}", wrapper);
return wrapper;
}
dir = dir.getParent();
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java
index 0e8c879786..10769d760e 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java
@@ -4,6 +4,9 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.cache.CachedValue;
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
@@ -20,6 +23,8 @@
*/
public abstract class PackageManagerBasedLocalToolCommandlet extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(PackageManagerBasedLocalToolCommandlet.class);
+
private final CachedValue installedVersion;
/**
@@ -156,7 +161,7 @@ private VersionIdentifier determineInstalledVersion() {
try {
return computeInstalledVersion();
} catch (Exception e) {
- this.context.debug().log(e, "Failed to compute installed version of {}", this.tool);
+ LOG.debug("Failed to compute installed version of {}", this.tool, e);
return null;
}
}
@@ -198,7 +203,7 @@ protected final void performUninstall(Path toolPath) {
runPackageManager(request).failOnError();
this.installedVersion.invalidate();
} else {
- this.context.info("IDEasy does not support uninstalling the tool {} since this will break your installation.\n"
+ LOG.info("IDEasy does not support uninstalling the tool {} since this will break your installation.\n"
+ "If you really want to uninstall it, please uninstall its parent tool via:\n"
+ "ide uninstall {}", this.tool, getParentTool().getName());
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
index 7c7bd1b753..60a1668feb 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
@@ -10,6 +10,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.event.Level;
+
import com.devonfw.tools.ide.commandlet.Commandlet;
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.common.Tags;
@@ -17,7 +21,7 @@
import com.devonfw.tools.ide.environment.EnvironmentVariables;
import com.devonfw.tools.ide.environment.EnvironmentVariablesFiles;
import com.devonfw.tools.ide.io.FileCopyMode;
-import com.devonfw.tools.ide.log.IdeSubLogger;
+import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.nls.NlsBundle;
import com.devonfw.tools.ide.os.MacOsHelper;
import com.devonfw.tools.ide.process.EnvironmentContext;
@@ -42,6 +46,8 @@
*/
public abstract class ToolCommandlet extends Commandlet implements Tags {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolCommandlet.class);
+
/** @see #getName() */
protected final String tool;
@@ -156,7 +162,7 @@ protected final ToolEdition getToolWithConfiguredEdition() {
}
@Override
- public void run() {
+ protected void doRun() {
runTool(this.arguments.asList());
}
@@ -220,7 +226,7 @@ public ProcessResult runTool(ToolInstallRequest request, ProcessMode processMode
// if the CVE check has already been done, we can assume that the install(request) has already been called before
// most likely a postInstall* method was overridden calling this method with the same request what is a programming error
// we render this warning so the error gets detected and can be fixed but we do not block the user by skipping the installation.
- this.context.warning().log(new RuntimeException(), "Preventing infinity loop during installation of {}", request.getRequested());
+ LOG.warn("Preventing infinity loop during installation of {}", request.getRequested(), new RuntimeException());
} else {
install(request);
}
@@ -291,7 +297,7 @@ public ToolInstallation install(boolean silent) {
public ToolInstallation install(ToolInstallRequest request) {
completeRequest(request);
- if (request.isInstallLoop(this.context)) {
+ if (request.isInstallLoop()) {
return toolAlreadyInstalled(request);
}
return doInstall(request);
@@ -547,14 +553,14 @@ protected ToolInstallation toolAlreadyInstalled(ToolInstallRequest request) {
* @param request the {@link ToolInstallRequest}.
*/
protected void logToolAlreadyInstalled(ToolInstallRequest request) {
- IdeSubLogger logger;
+ Level level;
if (request.isSilent()) {
- logger = this.context.debug();
+ level = Level.DEBUG;
} else {
- logger = this.context.info();
+ level = Level.INFO;
}
ToolEditionAndVersion installed = request.getInstalled();
- logger.log("Version {} of tool {} is already installed", installed.getVersion(), installed.getEdition());
+ LOG.atLevel(level).log("Version {} of tool {} is already installed", installed.getVersion(), installed.getEdition());
}
/**
@@ -619,10 +625,10 @@ protected VersionIdentifier cveCheck(ToolInstallRequest request) {
}
ToolSecurity toolSecurity = this.context.getDefaultToolRepository().findSecurity(this.tool, toolEdition.edition());
double minSeverity = IdeVariables.CVE_MIN_SEVERITY.get(context);
- ToolVulnerabilities currentVulnerabilities = toolSecurity.findCves(resolvedVersion, this.context, minSeverity);
+ ToolVulnerabilities currentVulnerabilities = toolSecurity.findCves(resolvedVersion, minSeverity);
ToolVersionChoice currentChoice = ToolVersionChoice.ofCurrent(requested, currentVulnerabilities);
request.setCveCheckDone();
- if (currentChoice.logAndCheckIfEmpty(this.context)) {
+ if (currentChoice.logAndCheckIfEmpty()) {
return resolvedVersion;
}
boolean alreadyInstalled = request.isAlreadyInstalled();
@@ -631,7 +637,7 @@ protected VersionIdentifier cveCheck(ToolInstallRequest request) {
// currently for a transitive dependency it does not make sense to suggest alternative versions, since the choice is not stored anywhere,
// and we then would ask the user again every time the tool having this dependency is started. So we only log the problem and the user needs to react
// (e.g. upgrade the tool with the dependency that is causing this).
- this.context.interaction("Please run 'ide -f install {}' to check for update suggestions!", this.tool);
+ IdeLogLevel.INTERACTION.log(LOG, "Please run 'ide -f install {}' to check for update suggestions!", this.tool);
return resolvedVersion;
}
ToolVersionChoice latest = null;
@@ -646,7 +652,7 @@ protected VersionIdentifier cveCheck(ToolInstallRequest request) {
}
if (acceptVersion(version, allowedVersions, requireStableVersion)) {
- ToolVulnerabilities newVulnerabilities = toolSecurity.findCves(version, this.context, minSeverity);
+ ToolVulnerabilities newVulnerabilities = toolSecurity.findCves(version, minSeverity);
if (newVulnerabilities.isSafer(latestVulnerabilities)) {
// we found a better/safer version
ToolEditionAndVersion toolEditionAndVersion = new ToolEditionAndVersion(toolEdition, version);
@@ -667,7 +673,7 @@ protected VersionIdentifier cveCheck(ToolInstallRequest request) {
}
}
if ((latest == null) && (nearest == null)) {
- this.context.warning(
+ LOG.warn(
"Could not find any other version resolving your CVEs.\nPlease keep attention to this tool and consider updating as soon as security fixes are available.");
if (alreadyInstalled) {
// we came here via "ide -f install ..." but no alternative is available
@@ -687,17 +693,16 @@ protected VersionIdentifier cveCheck(ToolInstallRequest request) {
if (addSuggestions) {
choices.add(nearest);
}
- nearest.logAndCheckIfEmpty(this.context);
+ nearest.logAndCheckIfEmpty();
}
if (latest != null) {
if (addSuggestions) {
choices.add(latest);
}
- latest.logAndCheckIfEmpty(this.context);
+ latest.logAndCheckIfEmpty();
}
ToolVersionChoice[] choicesArray = choices.toArray(ToolVersionChoice[]::new);
- this.context.warning(
- "Please note that by selecting an unsafe version to install, you accept the risk to be attacked.");
+ LOG.warn("Please note that by selecting an unsafe version to install, you accept the risk to be attacked.");
ToolVersionChoice answer = this.context.question(choicesArray, "Which version do you want to install?");
VersionIdentifier version = answer.toolEditionAndVersion().getResolvedVersion();
requested.setResolvedVersion(version);
@@ -762,7 +767,7 @@ public void listEditions() {
List editions = getToolRepository().getSortedEditions(getName());
for (String edition : editions) {
- this.context.info(edition);
+ LOG.info(edition);
}
}
@@ -773,7 +778,7 @@ public void listVersions() {
List versions = getToolRepository().getSortedVersions(getName(), getConfiguredEdition(), this);
for (VersionIdentifier vi : versions) {
- this.context.info(vi.toString());
+ LOG.info(vi.toString());
}
}
@@ -797,7 +802,7 @@ public void setVersion(String version) {
}
VersionIdentifier configuredVersion = VersionIdentifier.of(version);
if (!configuredVersion.isPattern() && !configuredVersion.isValid()) {
- this.context.warning("Version {} seems to be invalid", version);
+ LOG.warn("Version {} seems to be invalid", version);
}
setVersion(configuredVersion, true);
}
@@ -838,12 +843,12 @@ public void setVersion(VersionIdentifier version, boolean hint, EnvironmentVaria
settingsVariables.save();
EnvironmentVariables declaringVariables = variables.findVariable(name);
if ((declaringVariables != null) && (declaringVariables != settingsVariables)) {
- this.context.warning("The variable {} is overridden in {}. Please remove the overridden declaration in order to make the change affect.", name,
+ LOG.warn("The variable {} is overridden in {}. Please remove the overridden declaration in order to make the change affect.", name,
declaringVariables.getSource());
}
if (hint) {
- this.context.info("To install that version call the following command:");
- this.context.info("ide install {}", this.tool);
+ LOG.info("To install that version call the following command:");
+ LOG.info("ide install {}", this.tool);
}
}
@@ -887,7 +892,7 @@ public void setEdition(String edition, boolean hint, EnvironmentVariablesFiles d
}
if (!getToolRepository().getSortedEditions(this.tool).contains(edition)) {
- this.context.warning("Edition {} seems to be invalid", edition);
+ LOG.warn("Edition {} seems to be invalid", edition);
}
EnvironmentVariables variables = this.context.getVariables();
EnvironmentVariables settingsVariables = variables.getByType(destination.toType());
@@ -895,15 +900,15 @@ public void setEdition(String edition, boolean hint, EnvironmentVariablesFiles d
settingsVariables.set(name, edition, false);
settingsVariables.save();
- this.context.info("{}={} has been set in {}", name, edition, settingsVariables.getSource());
+ LOG.info("{}={} has been set in {}", name, edition, settingsVariables.getSource());
EnvironmentVariables declaringVariables = variables.findVariable(name);
if ((declaringVariables != null) && (declaringVariables != settingsVariables)) {
- this.context.warning("The variable {} is overridden in {}. Please remove the overridden declaration in order to make the change affect.", name,
+ LOG.warn("The variable {} is overridden in {}. Please remove the overridden declaration in order to make the change affect.", name,
declaringVariables.getSource());
}
if (hint) {
- this.context.info("To install that edition call the following command:");
- this.context.info("ide install {}", this.tool);
+ LOG.info("To install that edition call the following command:");
+ LOG.info("ide install {}", this.tool);
}
}
@@ -1008,29 +1013,16 @@ protected VersionIdentifier resolveVersionWithPattern(String output, Pattern pat
}
/**
- * @param step the {@link Step} to get {@link Step#asSuccess() success logger} from. May be {@code null}.
- * @return the {@link IdeSubLogger} from {@link Step#asSuccess()} or {@link IdeContext#success()} as fallback.
+ * @deprecated directly log success message and then report success on step if not null.
*/
- protected IdeSubLogger asSuccess(Step step) {
+ @Deprecated
+ protected void success(Step step, String message, Object... args) {
if (step == null) {
- return this.context.success();
+ IdeLogLevel.SUCCESS.log(LOG, message, args);
} else {
- return step.asSuccess();
+ step.success(message, args);
}
}
-
- /**
- * @param step the {@link Step} to get {@link Step#asError() error logger} from. May be {@code null}.
- * @return the {@link IdeSubLogger} from {@link Step#asError()} or {@link IdeContext#error()} as fallback.
- */
- protected IdeSubLogger asError(Step step) {
-
- if (step == null) {
- return this.context.error();
- } else {
- return step.asError();
- }
- }
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolInstallRequest.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolInstallRequest.java
index ba958820c0..083d6b47f7 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolInstallRequest.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolInstallRequest.java
@@ -2,7 +2,9 @@
import java.nio.file.Path;
-import com.devonfw.tools.ide.log.IdeLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.step.Step;
import com.devonfw.tools.ide.version.GenericVersionRange;
@@ -14,6 +16,8 @@
*/
public final class ToolInstallRequest {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolInstallRequest.class);
+
private final ToolInstallRequest parent;
private final boolean silent;
@@ -69,10 +73,9 @@ private ToolInstallRequest(ToolInstallRequest parent, boolean silent, boolean di
}
/**
- * @param logger the {@link IdeLogger} used to log an installation loop if found.
* @return {@code true} if an installation loop was found and logged, {@code false} otherwise.
*/
- public boolean isInstallLoop(IdeLogger logger) {
+ public boolean isInstallLoop() {
if ((this.requested == null) || (this.requested.getEdition() == null)) {
throw new IllegalStateException(); // this method was called too early
@@ -80,7 +83,7 @@ public boolean isInstallLoop(IdeLogger logger) {
StringBuilder sb = new StringBuilder();
boolean loopFound = detectInstallLoopRecursively(this.requested, sb);
if (loopFound) {
- logger.warning("Found installation loop:\n"
+ LOG.warn("Found installation loop:\n"
+ "{}\n"
+ "This typically indicates an internal bug in IDEasy.\n"
+ "Please report this bug, when you see this and include this entire warning message.\n"
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java b/cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
index 13043a6261..8dc31d374d 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
@@ -4,6 +4,9 @@
import java.nio.file.Path;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.io.FileAccess;
@@ -19,6 +22,8 @@
*/
public class Aws extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Aws.class);
+
/**
* The constructor.
*
@@ -69,7 +74,7 @@ protected void postExtract(Path extractedDir) {
@Override
public void printHelp(NlsBundle bundle) {
- this.context.info("To get detailed help about the usage of the AWS CLI, use \"aws help\"");
+ LOG.info("To get detailed help about the usage of the AWS CLI, use \"aws help\"");
}
@Override
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapper.java b/cli/src/main/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapper.java
index 605847de9d..e29d5f3e86 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapper.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapper.java
@@ -3,6 +3,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.environment.VariableLine;
import com.devonfw.tools.ide.json.JsonMapping;
@@ -17,6 +20,8 @@
*/
public class CustomToolsMapper extends StandardJsonObjectMapper {
+ private static final Logger LOG = LoggerFactory.getLogger(CustomToolsMapper.class);
+
private static final CustomToolsMapper INSTANCE = new CustomToolsMapper();
private final ObjectMapper MAPPER = JsonMapping.create();
@@ -101,10 +106,9 @@ private static CustomToolMetadata convert(CustomTool customTool, String reposito
* Retrieves custom tools from a devonfw-ide legacy config.
*
* @param customToolsContent String of custom tools
- * @param context the {@link IdeContext}.
* @return {@link CustomTools}.
*/
- public static CustomTools parseCustomToolsFromLegacyConfig(String customToolsContent, IdeContext context) {
+ public static CustomTools parseCustomToolsFromLegacyConfig(String customToolsContent) {
List customToolEntries = VariableLine.parseArray(customToolsContent);
if (customToolEntries.isEmpty()) {
return null;
@@ -114,12 +118,12 @@ public static CustomTools parseCustomToolsFromLegacyConfig(String customToolsCon
for (String customToolConfig : customToolEntries) {
CustomTool customTool = parseCustomToolFromLegacyConfig(customToolConfig);
if (customTool == null) {
- context.warning("Invalid custom tool entry: {}", customToolConfig);
+ LOG.warn("Invalid custom tool entry: {}", customToolConfig);
} else {
String url = customTool.url();
if (defaultUrl == null) {
if ((url == null) || url.isEmpty()) {
- context.warning("First custom tool entry has no URL specified: {}", customToolConfig);
+ LOG.warn("First custom tool entry has no URL specified: {}", customToolConfig);
} else {
defaultUrl = url;
customTool = customTool.withoutUrl();
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/docker/Docker.java b/cli/src/main/java/com/devonfw/tools/ide/tool/docker/Docker.java
index 84c2de715d..01b3881c82 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/docker/Docker.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/docker/Docker.java
@@ -1,16 +1,17 @@
package com.devonfw.tools.ide.tool.docker;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.os.SystemArchitecture;
import com.devonfw.tools.ide.os.WindowsHelper;
-import com.devonfw.tools.ide.os.WindowsHelperImpl;
import com.devonfw.tools.ide.tool.GlobalToolCommandlet;
import com.devonfw.tools.ide.tool.NativePackageManager;
import com.devonfw.tools.ide.tool.PackageManagerCommand;
@@ -24,11 +25,12 @@
*/
public class Docker extends GlobalToolCommandlet {
- private static final String PODMAN = "podman";
+ private static final Logger LOG = LoggerFactory.getLogger(Docker.class);
+ private static final String PODMAN = "podman";
private static final Pattern RDCTL_CLIENT_VERSION_PATTERN = Pattern.compile("client version:\\s*v([\\d.]+)", Pattern.CASE_INSENSITIVE);
-
+
private static final Pattern DOCKER_DESKTOP_LINUX_VERSION_PATTERN = Pattern.compile("^([0-9]+(?:\\.[0-9]+){1,2})");
/**
@@ -98,7 +100,7 @@ protected List getInstallPackageManagerCommands() {
public VersionIdentifier getInstalledVersion() {
if (!isDockerInstalled()) {
- this.context.error("Couldn't get installed version of " + this.getName());
+ LOG.error("Couldn't get installed version of " + this.getName());
return null;
}
@@ -112,7 +114,7 @@ public VersionIdentifier getInstalledVersion() {
};
if (parsedVersion == null) {
- this.context.error("Couldn't get installed version of " + this.getName());
+ LOG.error("Couldn't get installed version of " + this.getName());
}
return parsedVersion;
@@ -146,7 +148,7 @@ private VersionIdentifier getRancherDesktopClientVersion() {
public String getInstalledEdition() {
if (!isDockerInstalled()) {
- this.context.error("Couldn't get installed edition of " + this.getName());
+ LOG.error("Couldn't get installed edition of {}", this.getName());
return null;
}
@@ -172,9 +174,9 @@ private List getPackageManagerCommandsUninstall() {
List pmCommands = new ArrayList<>();
pmCommands.add(
- new PackageManagerCommand(NativePackageManager.ZYPPER, Arrays.asList("sudo zypper remove rancher-desktop")));
+ new PackageManagerCommand(NativePackageManager.ZYPPER, List.of("sudo zypper remove rancher-desktop")));
pmCommands.add(
- new PackageManagerCommand(NativePackageManager.APT, Arrays.asList("sudo apt -y autoremove rancher-desktop")));
+ new PackageManagerCommand(NativePackageManager.APT, List.of("sudo apt -y autoremove rancher-desktop")));
return pmCommands;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java b/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java
index 62e2358e36..eef00ea911 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java
@@ -8,6 +8,9 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.cli.CliException;
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
@@ -27,6 +30,8 @@
*/
public class Eclipse extends IdeToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Eclipse.class);
+
// version must correspond to eclipse-import.xml
private static final String GROOVY_VERSION = "3.0.23";
@@ -93,13 +98,13 @@ public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessCont
if (result.isSuccessful()) {
for (String line : result.getOut()) {
if (line.contains("Overall install request is satisfiable")) {
- this.context.success("Successfully installed plugin: {}", plugin.name());
+ IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {}", plugin.name());
step.success();
return true;
}
}
}
- result.log(IdeLogLevel.DEBUG, context, IdeLogLevel.ERROR);
+ result.log(IdeLogLevel.DEBUG, IdeLogLevel.ERROR);
step.error("Failed to install plugin {} ({}): exit code was {}", plugin.name(), plugin.id(), result.getExitCode());
return false;
}
@@ -121,8 +126,8 @@ protected void configureWorkspace() {
private static boolean isLocked(Path lockfile) {
if (Files.isRegularFile(lockfile)) {
- try (RandomAccessFile raFile = new RandomAccessFile(lockfile.toFile(), "rw")) {
- FileLock fileLock = raFile.getChannel().tryLock(0, 1, false);
+ try (RandomAccessFile raFile = new RandomAccessFile(lockfile.toFile(), "rw");
+ FileLock fileLock = raFile.getChannel().tryLock(0, 1, false)) {
// success, file was not locked so we immediately unlock again...
fileLock.release();
return false;
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java b/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java
index 6c55833153..6934ec2015 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java
@@ -32,7 +32,7 @@ protected boolean isExtract() {
}
@Override
- public void run() {
+ protected void doRun() {
getCommandlet(Java.class).install();
install(true);
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java
index 4c9c78ae2e..6f0256c581 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java
@@ -5,6 +5,9 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.io.FileAccess;
@@ -24,6 +27,8 @@
*/
public abstract class IdeToolCommandlet extends PluginBasedCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(IdeToolCommandlet.class);
+
/**
* The constructor.
*
@@ -48,8 +53,8 @@ private boolean hasIde(Set tags) {
}
@Override
- public final void run() {
- super.run();
+ protected final void doRun() {
+ super.doRun();
}
@Override
@@ -73,7 +78,7 @@ protected void configureWorkspace() {
FileAccess fileAccess = this.context.getFileAccess();
Path workspaceFolder = this.context.getWorkspacePath();
if (!fileAccess.isExpectedFolder(workspaceFolder)) {
- this.context.warning("Current workspace does not exist: {}", workspaceFolder);
+ LOG.warn("Current workspace does not exist: {}", workspaceFolder);
return; // should actually never happen...
}
Step step = this.context.newStep("Configuring workspace " + workspaceFolder.getFileName() + " for IDE " + this.tool);
@@ -110,10 +115,10 @@ private int mergeWorkspaceSingle(Path templatesFolder, Path workspaceFolder, int
Path setupFolder = templatesFolder.resolve(IdeContext.FOLDER_SETUP);
Path updateFolder = templatesFolder.resolve(IdeContext.FOLDER_UPDATE);
if (!Files.isDirectory(setupFolder) && !Files.isDirectory(updateFolder)) {
- this.context.trace("Skipping empty or non-existing workspace template folder {}.", templatesFolder);
+ LOG.trace("Skipping empty or non-existing workspace template folder {}.", templatesFolder);
return errors;
}
- this.context.debug("Merging workspace templates from {}...", templatesFolder);
+ LOG.debug("Merging workspace templates from {}...", templatesFolder);
return errors + this.context.getWorkspaceMerger().merge(setupFolder, updateFolder, this.context.getVariables(), workspaceFolder);
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaBasedIdeToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaBasedIdeToolCommandlet.java
index 3064204d33..837da202fd 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaBasedIdeToolCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaBasedIdeToolCommandlet.java
@@ -4,8 +4,12 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
+import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessMode;
import com.devonfw.tools.ide.process.ProcessResult;
@@ -18,6 +22,8 @@
*/
public class IdeaBasedIdeToolCommandlet extends IdeToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(IdeaBasedIdeToolCommandlet.class);
+
/**
* The constructor.
*
@@ -42,7 +48,7 @@ public boolean installPlugin(ToolPluginDescriptor plugin, final Step step, Proce
}
ProcessResult result = runTool(pc, ProcessMode.DEFAULT, args);
if (result.isSuccessful()) {
- this.context.success("Successfully installed plugin: {}", plugin.name());
+ IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {}", plugin.name());
step.success();
return true;
} else {
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaPluginDownloader.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaPluginDownloader.java
index e7ef401085..216c6a26b0 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaPluginDownloader.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeaPluginDownloader.java
@@ -14,6 +14,9 @@
import java.time.Duration;
import java.util.Optional;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.io.FileAccess;
import com.devonfw.tools.ide.os.MacOsHelper;
@@ -26,6 +29,8 @@
*/
public class IdeaPluginDownloader {
+ private static final Logger LOG = LoggerFactory.getLogger(IdeaPluginDownloader.class);
+
private static final String BUILD_FILE = "build.txt";
private final IdeContext context;
private final IdeaBasedIdeToolCommandlet commandlet;
@@ -130,7 +135,7 @@ private Path downloadPlugin(FileAccess fileAccess, String downloadUrl, Path tmpD
private void extractDownloadedPlugin(FileAccess fileAccess, Path downloadedFile, String pluginId) throws IOException {
Path targetDir = this.commandlet.getPluginsInstallationPath().resolve(pluginId);
if (Files.exists(targetDir)) {
- context.info("Plugin already installed, target directory already existing: {}", targetDir);
+ LOG.info("Plugin already installed, target directory already existing: {}", targetDir);
} else {
fileAccess.extract(downloadedFile, targetDir);
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java b/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java
index 7943fd317f..ba089a640f 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java
@@ -6,6 +6,8 @@
import java.util.Map.Entry;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import com.devonfw.tools.ide.cli.CliException;
@@ -30,6 +32,8 @@
*/
public class Intellij extends IdeaBasedIdeToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Intellij.class);
+
private static final String IDEA = "idea";
private static final String IDEA64_EXE = IDEA + "64.exe";
@@ -118,12 +122,12 @@ public void importRepository(Path repositoryPath) {
Path buildDescriptor = buildTool.findBuildDescriptor(repositoryPath);
if (buildDescriptor != null) {
String templateFilename = entry.getValue();
- this.context.debug("Found build descriptor {} so merging template {}", buildDescriptor, templateFilename);
+ LOG.debug("Found build descriptor {} so merging template {}", buildDescriptor, templateFilename);
mergeConfig(repositoryPath, templateFilename);
return;
}
}
- this.context.warning("No supported build descriptor was found for project import in {}", repositoryPath);
+ LOG.warn("No supported build descriptor was found for project import in {}", repositoryPath);
}
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/jmc/Jmc.java b/cli/src/main/java/com/devonfw/tools/ide/tool/jmc/Jmc.java
index 096cf9946b..f374f56285 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/jmc/Jmc.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/jmc/Jmc.java
@@ -1,12 +1,5 @@
package com.devonfw.tools.ide.tool.jmc;
-import com.devonfw.tools.ide.common.Tag;
-import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.io.FileAccess;
-import com.devonfw.tools.ide.process.ProcessMode;
-import com.devonfw.tools.ide.tool.LocalToolCommandlet;
-import com.devonfw.tools.ide.tool.ToolCommandlet;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -14,12 +7,24 @@
import java.util.Set;
import java.util.stream.Stream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.devonfw.tools.ide.common.Tag;
+import com.devonfw.tools.ide.context.IdeContext;
+import com.devonfw.tools.ide.io.FileAccess;
+import com.devonfw.tools.ide.process.ProcessMode;
+import com.devonfw.tools.ide.tool.LocalToolCommandlet;
+import com.devonfw.tools.ide.tool.ToolCommandlet;
+
/**
* {@link ToolCommandlet} for JDK Mission Control, An advanced set of tools for
* managing, monitoring, profiling, and troubleshooting Java applications.
*/
public class Jmc extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Jmc.class);
+
/**
* The constructor.
*
@@ -31,7 +36,7 @@ public Jmc(IdeContext context) {
}
@Override
- public void run() {
+ protected void doRun() {
runTool(ProcessMode.BACKGROUND, null, this.arguments.asList());
}
@@ -47,9 +52,7 @@ protected void postExtract(Path extractedDir) {
moveFilesAndDirs(oldBinaryPath, extractedDir);
fileAccess.delete(oldBinaryPath);
} else {
- this.context.debug(
- "JMC binary folder not found at {} - ignoring as this legacy problem may be resolved in newer versions.",
- oldBinaryPath);
+ LOG.debug("JMC binary folder not found at {} - ignoring as this legacy problem may be resolved in newer versions.", oldBinaryPath);
}
}
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java b/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java
index b6a87ef072..4619a7bce9 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java
@@ -54,7 +54,7 @@ private void verifyDockerVersion(ProcessResult result, VersionIdentifier minimum
// we have this pattern a lot that we want to get a single line output of a successful ProcessResult.
// we should create a generic method in ProcessResult for this use-case.
if (!result.isSuccessful()) {
- result.log(IdeLogLevel.WARNING, this.context);
+ result.log(IdeLogLevel.WARNING);
}
if (result.getOut().isEmpty()) {
throw new CliException("Docker is not installed, but required for lazydocker.\n" //
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java
index 03d940c37f..cf26227fa4 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java
@@ -10,6 +10,9 @@
import java.util.Set;
import java.util.regex.Matcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.git.GitContext;
@@ -29,14 +32,12 @@
*/
public class Mvn extends LocalToolCommandlet {
- /**
- * The name of the mvn folder
- */
+ private static final Logger LOG = LoggerFactory.getLogger(Mvn.class);
+
+ /** The name of the mvn folder. */
public static final String MVN_CONFIG_FOLDER = "mvn";
- /**
- * The name of the m2 repository
- */
+ /** The name of the m2 repository. */
public static final String MVN_CONFIG_LEGACY_FOLDER = ".m2";
/** The name of the settings-security.xml */
@@ -48,9 +49,7 @@ public class Mvn extends LocalToolCommandlet {
/** The pom.xml file name. */
public static final String POM_XML = "pom.xml";
- /**
- * The name of the settings.xml
- */
+ /** The name of the file settings.xml. */
public static final String SETTINGS_FILE = "settings.xml";
private static final String DOCUMENTATION_PAGE_CONF = "https://github.com/devonfw/IDEasy/blob/main/documentation/conf.adoc";
@@ -135,7 +134,7 @@ private void createSettingsFile(Path settingsFile, Path settingsTemplateFile, Pa
return;
}
if (!Files.exists(settingsTemplateFile)) {
- this.context.warning("Missing maven settings template at {}. ", settingsTemplateFile);
+ LOG.warn("Missing maven settings template at {}. ", settingsTemplateFile);
return;
}
Step step = this.context.newStep("Create mvn settings file at " + settingsFile);
@@ -150,7 +149,7 @@ private void doCreateSettingsFile(Path settingsFile, Path settingsTemplateFile,
GitContext gitContext = this.context.getGitContext();
String gitSettingsUrl = gitContext.retrieveGitUrl(this.context.getSettingsPath());
if (gitSettingsUrl == null) {
- this.context.warning("Failed to determine git remote URL for settings folder.");
+ LOG.warn("Failed to determine git remote URL for settings folder.");
} else if (!gitSettingsUrl.equals(GitContext.DEFAULT_SETTINGS_GIT_URL) && Files.exists(settingsSecurityFile)) {
Set variables = findVariables(content);
for (String variable : variables) {
@@ -168,9 +167,8 @@ private void doCreateSettingsFile(Path settingsFile, Path settingsTemplateFile,
private String getEncryptedPassword(String variable) {
String input = this.context.askForInput("Please enter secret value for variable " + variable + ":");
-
String encryptedPassword = retrievePassword("--encrypt-password", input);
- this.context.info("Encrypted as " + encryptedPassword);
+ LOG.info("Encrypted as {}", encryptedPassword);
return encryptedPassword;
}
@@ -214,7 +212,7 @@ public Path getMavenTemplatesFolder() {
if (!Files.isDirectory(templatesConfMvnFolder)) {
Path templatesConfMvnLegacyFolder = templatesConfFolder.resolve(MVN_CONFIG_LEGACY_FOLDER);
if (!Files.isDirectory(templatesConfMvnLegacyFolder)) {
- this.context.warning("No maven templates found neither in {} nor in {} - configuration broken", templatesConfMvnFolder,
+ LOG.warn("No maven templates found neither in {} nor in {} - configuration broken", templatesConfMvnFolder,
templatesConfMvnLegacyFolder);
return null;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/MvnRepository.java b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/MvnRepository.java
index 3274855bd6..fb8de6f82e 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/MvnRepository.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/MvnRepository.java
@@ -199,7 +199,7 @@ public VersionIdentifier resolveVersion(MvnArtifact artifact, GenericVersionRang
artifact = artifact.withVersion(versionString);
}
List versions = fetchVersions(artifact);
- VersionIdentifier resolvedVersion = VersionIdentifier.resolveVersionPattern(version, versions, this.context);
+ VersionIdentifier resolvedVersion = VersionIdentifier.resolveVersionPattern(version, versions);
versionString = resolvedVersion.toString();
if (versionString.endsWith("-SNAPSHOT")) {
artifact = artifact.withVersion(versionString);
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/node/Node.java b/cli/src/main/java/com/devonfw/tools/ide/tool/node/Node.java
index d4ea787276..c478896c6c 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/node/Node.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/node/Node.java
@@ -2,8 +2,12 @@
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
+import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.nls.NlsBundle;
import com.devonfw.tools.ide.process.ProcessResult;
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
@@ -17,6 +21,8 @@
*/
public class Node extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Node.class);
+
/**
* The constructor.
*
@@ -40,14 +46,14 @@ protected void postInstallOnNewInstallation(ToolInstallRequest request) {
.addArg(getToolPath().toString());
ProcessResult result = npm.runPackageManager(packageManagerRequest, true);
if (result.isSuccessful()) {
- this.context.success("Setting npm config prefix to: {} was successful", getToolPath());
+ IdeLogLevel.SUCCESS.log(LOG, "Setting npm config prefix to: {} was successful", getToolPath());
}
}
@Override
public void printHelp(NlsBundle bundle) {
- this.context.info("For a list of supported options and arguments, use \"node --help\"");
+ LOG.info("For a list of supported options and arguments, use \"node --help\"");
}
@Override
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java
index 24b3d1911d..93eeb39768 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java
@@ -4,6 +4,9 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.process.ProcessContext;
@@ -21,6 +24,8 @@
*/
public abstract class NpmBasedCommandlet extends NodeBasedCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(NpmBasedCommandlet.class);
+
/**
* The constructor.
*
@@ -52,7 +57,7 @@ protected VersionIdentifier computeInstalledVersion() {
private VersionIdentifier runPackageManagerGetInstalledVersion(String npmPackage) {
if (!Files.isDirectory(this.context.getSoftwarePath().resolve("node"))) {
- this.context.trace("Since node is not installed, also package {} for tool {} cannot be installed.", npmPackage, this.tool);
+ LOG.trace("Since node is not installed, also package {} for tool {} cannot be installed.", npmPackage, this.tool);
return null;
}
PackageManagerRequest request = new PackageManagerRequest("list", npmPackage).addArg("list").addArg("-g").addArg(npmPackage).addArg("--depth=0")
@@ -74,7 +79,7 @@ private VersionIdentifier runPackageManagerGetInstalledVersion(String npmPackage
return VersionIdentifier.of(parsedVersion);
}
} else {
- this.context.debug("The npm package {} for tool {} is not installed.", npmPackage, this.tool);
+ LOG.debug("The npm package {} for tool {} is not installed.", npmPackage, this.tool);
}
return null;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java
index 47b09afd1c..b94a4124d0 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java
@@ -4,6 +4,9 @@
import java.nio.file.Path;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.log.IdeLogLevel;
@@ -24,6 +27,8 @@
*/
public abstract class PipBasedCommandlet extends PackageManagerBasedLocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(PipBasedCommandlet.class);
+
private static final String PIP_SHOW_VERSION_PREFIX = "Version:";
/**
@@ -54,7 +59,7 @@ protected Class getPackageManagerClass() {
case "pip" -> Pip.class;
case "uv" -> Uv.class;
default -> {
- this.context.warning("Undefined value: PIP_EDITION={}", edition);
+ LOG.warn("Undefined value: PIP_EDITION={}", edition);
yield Pip.class;
}
};
@@ -115,8 +120,8 @@ protected VersionIdentifier computeInstalledVersion() {
}
}
}
- this.context.debug("Could not find version from pip show output:");
- processResult.log(IdeLogLevel.DEBUG, this.context);
+ LOG.debug("Could not find version from pip show output:");
+ processResult.log(IdeLogLevel.DEBUG);
return null;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java
index 694d8c374a..75eec695b1 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java
@@ -6,6 +6,9 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.cli.CliException;
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
@@ -22,6 +25,8 @@
*/
public abstract class PluginBasedCommandlet extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(PluginBasedCommandlet.class);
+
private ToolPlugins plugins;
/**
@@ -42,7 +47,7 @@ public PluginBasedCommandlet(IdeContext context, String tool, Set tags) {
public ToolPlugins getPlugins() {
if (this.plugins == null) {
- ToolPlugins toolPlugins = new ToolPlugins(this.context);
+ ToolPlugins toolPlugins = new ToolPlugins();
// Load project-specific plugins
Path pluginsPath = getPluginsConfigPath();
@@ -109,7 +114,7 @@ protected void postInstall(ToolInstallRequest request) {
List markerFiles = fileAccess.listChildren(this.context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE), Files::isRegularFile);
for (Path path : markerFiles) {
if (path.getFileName().toString().startsWith("plugin." + getName())) {
- this.context.debug("Plugin marker file {} got deleted.", path);
+ LOG.debug("Plugin marker file {} got deleted.", path);
fileAccess.delete(path);
}
}
@@ -133,14 +138,14 @@ protected void installPlugins(Collection plugins, ProcessC
Path pluginMarkerFile = retrievePluginMarkerFilePath(plugin);
boolean pluginMarkerFileExists = pluginMarkerFile != null && Files.exists(pluginMarkerFile);
if (pluginMarkerFileExists) {
- this.context.debug("Markerfile for IDE {} and plugin '{}' already exists.", getName(), plugin.name());
+ LOG.debug("Markerfile for IDE {} and plugin '{}' already exists.", getName(), plugin.name());
}
if (plugin.active()) {
if (this.context.isForcePlugins() || !pluginMarkerFileExists) {
Step step = this.context.newStep("Install plugin " + plugin.name());
step.run(() -> doInstallPluginStep(plugin, step, pc));
} else {
- this.context.debug("Skipping installation of plugin '{}' due to existing marker file: {}", plugin.name(), pluginMarkerFile);
+ LOG.debug("Skipping installation of plugin '{}' due to existing marker file: {}", plugin.name(), pluginMarkerFile);
}
} else {
if (!pluginMarkerFileExists) {
@@ -211,22 +216,22 @@ public void uninstallPlugin(ToolPluginDescriptor plugin) {
boolean error = false;
Path pluginsPath = getPluginsInstallationPath();
if (!Files.isDirectory(pluginsPath)) {
- this.context.debug("Omitting to uninstall plugin {} ({}) as plugins folder does not exist at {}",
+ LOG.debug("Omitting to uninstall plugin {} ({}) as plugins folder does not exist at {}",
plugin.name(), plugin.id(), pluginsPath);
error = true;
}
FileAccess fileAccess = this.context.getFileAccess();
Path match = fileAccess.findFirst(pluginsPath, p -> p.getFileName().toString().startsWith(plugin.id()), false);
if (match == null) {
- this.context.debug("Omitting to uninstall plugin {} ({}) as plugins folder does not contain a match at {}",
+ LOG.debug("Omitting to uninstall plugin {} ({}) as plugins folder does not contain a match at {}",
plugin.name(), plugin.id(), pluginsPath);
error = true;
}
if (error) {
- context.error("Could not uninstall plugin " + plugin + " because we could not find an installation");
+ LOG.error("Could not uninstall plugin {} because we could not find an installation", plugin);
} else {
fileAccess.delete(match);
- context.info("Successfully uninstalled plugin " + plugin);
+ LOG.info("Successfully uninstalled plugin {}", plugin);
}
}
@@ -257,6 +262,6 @@ public ToolPluginDescriptor getPlugin(String key) {
*/
protected void handleInstallForInactivePlugin(ToolPluginDescriptor plugin) {
- this.context.debug("Omitting installation of inactive plugin {} ({}).", plugin.name(), plugin.id());
+ LOG.debug("Omitting installation of inactive plugin {} ({}).", plugin.name(), plugin.id());
}
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPluginDescriptor.java b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPluginDescriptor.java
index da7fc8d056..7d115a540c 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPluginDescriptor.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPluginDescriptor.java
@@ -5,10 +5,12 @@
import java.util.Properties;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.common.Tags;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.log.IdeLogger;
/**
* Implementation of {@link ToolPluginDescriptor}.
@@ -21,6 +23,8 @@
*/
public record ToolPluginDescriptor(String id, String name, String url, boolean active, Set tags) implements Tags {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolPluginDescriptor.class);
+
@Override
public Set getTags() {
@@ -42,16 +46,15 @@ public static ToolPluginDescriptor of(Path propertiesFile, IdeContext context, b
String id = getString(properties, "id", "plugin_id");
String url = getString(properties, "url", "plugin_url");
if (needUrl && ((url == null) || url.isBlank())) {
- context.warning("Missing plugin URL in {}", propertiesFile);
+ LOG.warn("Missing plugin URL in {}", propertiesFile);
}
- boolean active = getBoolean(properties, "active", "plugin_active", propertiesFile, context);
+ boolean active = getBoolean(properties, "active", "plugin_active", propertiesFile);
String tagsCsv = getString(properties, "tags", "plugin_tags");
Set tags = Tag.parseCsv(tagsCsv);
return new ToolPluginDescriptor(id, name, url, active, tags);
}
- private static boolean getBoolean(Properties properties, String key, String legacyKey, Path propertiesFile,
- IdeLogger logger) {
+ private static boolean getBoolean(Properties properties, String key, String legacyKey, Path propertiesFile) {
String value = getString(properties, key, legacyKey);
if (value == null) {
@@ -63,7 +66,7 @@ private static boolean getBoolean(Properties properties, String key, String lega
} else if ("false".equals(lower)) {
return false;
}
- logger.warning("Invalid boolean value '{}' for property '{}' in {}", value, key, propertiesFile);
+ LOG.warn("Invalid boolean value '{}' for property '{}' in {}", value, key, propertiesFile);
return false;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPlugins.java b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPlugins.java
index 4374210eb3..ca626ad6be 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPlugins.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPlugins.java
@@ -5,27 +5,24 @@
import java.util.HashMap;
import java.util.Map;
-import com.devonfw.tools.ide.context.IdeContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A wrapper class for holding two maps of plugin descriptors: one keyed by plugin ID and the other keyed by plugin name.
*/
public class ToolPlugins {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolPlugins.class);
+
private final Map mapById;
private final Map mapByName;
-
- private final IdeContext context;
-
/**
* The constructor.
- *
- * @param context the {@link IdeContext}.
*/
- public ToolPlugins(IdeContext context) {
+ public ToolPlugins() {
super();
- this.context = context;
this.mapById = new HashMap<>();
this.mapByName = new HashMap<>();
}
@@ -72,7 +69,7 @@ protected void add(ToolPluginDescriptor descriptor) {
private void put(String key, ToolPluginDescriptor descriptor, Map map) {
ToolPluginDescriptor duplicate = map.put(key, descriptor);
if (duplicate != null) {
- this.context.info("Plugin with key {} was {} but got overridden by {}", key, duplicate, descriptor);
+ LOG.info("Plugin with key {} was {} but got overridden by {}", key, duplicate, descriptor);
}
}
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/python/Python.java b/cli/src/main/java/com/devonfw/tools/ide/tool/python/Python.java
index 78df0ea958..caa38b5a3e 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/python/Python.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/python/Python.java
@@ -5,6 +5,9 @@
import java.nio.file.StandardCopyOption;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.cli.CliException;
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
@@ -22,6 +25,8 @@
*/
public class Python extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Python.class);
+
private final VersionIdentifier PYTHON_MIN_VERSION = VersionIdentifier.of("3.8.2");
/**
@@ -53,7 +58,7 @@ protected void performToolInstallation(ToolInstallRequest request, Path installa
renameVenvFolderToPython(fileAccess, softwarePath, installationPath);
this.context.writeVersionFile(resolvedVersion, installationPath);
createWindowsSymlinkBinFolder(fileAccess, installationPath);
- this.context.debug("Installed {} in version {} at {}", this.tool, resolvedVersion, installationPath);
+ LOG.debug("Installed {} in version {} at {}", this.tool, resolvedVersion, installationPath);
}
@Override
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/repository/AbstractToolRepository.java b/cli/src/main/java/com/devonfw/tools/ide/tool/repository/AbstractToolRepository.java
index f1cc935a36..90d34d4f1c 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/repository/AbstractToolRepository.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/repository/AbstractToolRepository.java
@@ -8,6 +8,10 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.event.Level;
+
import com.devonfw.tools.ide.cli.CliException;
import com.devonfw.tools.ide.cli.CliOfflineException;
import com.devonfw.tools.ide.context.IdeContext;
@@ -32,6 +36,8 @@
*/
public abstract class AbstractToolRepository implements ToolRepository {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractToolRepository.class);
+
private static final int MAX_TEMP_DOWNLOADS = 9;
/** The owning {@link IdeContext}. */
@@ -88,14 +94,14 @@ protected Path doDownload(UrlDownloadFileMetadata metadata) {
Path downloadCache = this.context.getDownloadPath().resolve(getId());
this.context.getFileAccess().mkdirs(downloadCache);
Path target = downloadCache.resolve(downloadFilename);
-
+
if (Files.exists(target)) {
// File is already cached
if (this.context.getNetworkStatus().isOffline()) {
- this.context.debug("Using cached download of {} in version {} from {} (offline mode)",
+ LOG.debug("Using cached download of {} in version {} from {} (offline mode)",
metadata.getTool(), metadata.getVersion(), target);
} else {
- this.context.interaction("Artifact already exists at {}\nTo force update please delete the file and run again.", target);
+ IdeLogLevel.INTERACTION.log(LOG, "Artifact already exists at {}\nTo force update please delete the file and run again.", target);
}
} else {
if (this.context.getNetworkStatus().isOffline()) {
@@ -130,7 +136,7 @@ private Path download(UrlDownloadFileMetadata metadata, Path target) {
error = e;
}
if (i < max) {
- this.context.error(error, "Failed to download from " + url);
+ LOG.error("Failed to download from " + url, error);
}
}
throw new IllegalStateException("Download of " + target.getFileName() + " failed after trying " + size + " URL(s).", error);
@@ -178,8 +184,7 @@ protected String createDownloadFilename(String tool, String edition, VersionIden
} else {
extension = "zip";
}
- this.context.warning("Could not determine file extension from URL {} - guess was {} but may be incorrect.", url,
- extension);
+ LOG.warn("Could not determine file extension from URL {} - guess was {} but may be incorrect.", url, extension);
}
sb.append(".");
sb.append(extension);
@@ -256,11 +261,11 @@ private void verifyChecksums(Path file, UrlChecksums expectedChecksums, Object v
checksumVerified = true;
}
if (!checksumVerified) {
- IdeLogLevel level = IdeLogLevel.WARNING;
+ Level level = Level.WARN;
if (isLatestVersion(version)) {
- level = IdeLogLevel.DEBUG;
+ level = Level.DEBUG;
}
- this.context.level(level).log("No checksum found for {}", file);
+ LOG.atLevel(level).log("No checksum found for {}", file);
}
}
@@ -275,7 +280,7 @@ protected void verifyChecksum(Path file, UrlGenericChecksum expectedChecksum) {
String hashAlgorithm = expectedChecksum.getHashAlgorithm();
String actualChecksum = this.context.getFileAccess().checksum(file, hashAlgorithm);
if (expectedChecksum.getChecksum().equals(actualChecksum)) {
- this.context.success("{} checksum {} is correct.", hashAlgorithm, actualChecksum);
+ IdeLogLevel.SUCCESS.log(LOG, "{} checksum {} is correct.", hashAlgorithm, actualChecksum);
} else {
throw new CliException("Downloaded file " + file + " has the wrong " + hashAlgorithm + " checksum!\n" //
+ "Expected " + expectedChecksum + "\n" //
@@ -291,7 +296,7 @@ protected void verifyChecksum(Path file, UrlGenericChecksum expectedChecksum) {
public VersionIdentifier resolveVersion(String tool, String edition, GenericVersionRange version, ToolCommandlet toolCommandlet) {
List versions = getSortedVersions(tool, edition, toolCommandlet);
- return VersionIdentifier.resolveVersionPattern(version, versions, this.context);
+ return VersionIdentifier.resolveVersionPattern(version, versions);
}
@Override
@@ -304,9 +309,9 @@ public Collection findDependencies(String tool, String edition,
dependencies = urlTool.getDependencyFile().getDependencies();
}
if (dependencies != ToolDependencies.getEmpty()) {
- this.context.trace("Found dependencies in {}", dependencies);
+ LOG.trace("Found dependencies in {}", dependencies);
}
- return dependencies.findDependencies(version, this.context);
+ return dependencies.findDependencies(version);
}
@Override
@@ -318,7 +323,7 @@ public ToolSecurity findSecurity(String tool, String edition) {
security = urlTool.getSecurityFile().getSecurity();
}
if (security != ToolSecurity.getEmpty()) {
- this.context.trace("Found dependencies in {}", security);
+ LOG.trace("Found CVE information in {}", security);
}
return security;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/sonar/Sonar.java b/cli/src/main/java/com/devonfw/tools/ide/tool/sonar/Sonar.java
index c7637c90fb..5e2063e177 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/sonar/Sonar.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/sonar/Sonar.java
@@ -5,6 +5,9 @@
import java.util.Properties;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.EnumProperty;
@@ -13,8 +16,14 @@
import com.devonfw.tools.ide.tool.java.Java;
import com.devonfw.tools.ide.tool.mvn.Mvn;
+/**
+ * {@link LocalToolCommandlet} for SonarQube.
+ */
public class Sonar extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Sonar.class);
+
+ /** The {@link SonarCommand} to run. */
public final EnumProperty command;
/**
@@ -44,7 +53,7 @@ public ToolInstallation install(boolean silent) {
}
@Override
- public void run() {
+ protected void doRun() {
SonarCommand command = this.command.getValue();
@@ -88,13 +97,13 @@ protected String getBinaryName() {
private void printSonarWebPort() {
- this.context.info("SonarQube is running at localhost on the following port (default 9000):");
+ LOG.info("SonarQube is running at localhost on the following port (default 9000):");
Path sonarPropertiesPath = getToolPath().resolve("conf/sonar.properties");
Properties sonarProperties = this.context.getFileAccess().readProperties(sonarPropertiesPath);
String sonarWebPort = sonarProperties.getProperty("sonar.web.port");
if (sonarWebPort != null) {
- this.context.info(sonarWebPort);
+ LOG.info(sonarWebPort);
}
}
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java b/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java
index 5d3ddd5719..abab95ec13 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java
@@ -9,6 +9,8 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -30,6 +32,8 @@
*/
public class Tomcat extends LocalToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Tomcat.class);
+
private static final String CATALINA = "catalina";
private static final String CATALINA_BAT = CATALINA + ".bat";
private static final String CATALINA_BASH_SCRIPT = CATALINA + ".sh";
@@ -83,8 +87,8 @@ private void printTomcatPort() {
String portNumber = findTomcatPort();
if (!portNumber.isEmpty()) {
- this.context.info("Tomcat is running at localhost on HTTP port {}:", portNumber);
- this.context.info("http://localhost:{}", portNumber);
+ LOG.info("Tomcat is running at localhost on HTTP port {}:", portNumber);
+ LOG.info("http://localhost:{}", portNumber);
}
}
@@ -102,14 +106,14 @@ private String findTomcatPort() {
Element ConnectorElement = (Element) connectorNodes.item(0);
portNumber = ConnectorElement.getAttribute("port");
} else {
- this.context.warning("Port element not found in server.xml");
+ LOG.warn("Port element not found in server.xml");
}
} catch (ParserConfigurationException | IOException | SAXException e) {
- this.context.error(e);
+ LOG.error(e.toString(), e);
}
}
if (portNumber.isEmpty()) {
- this.context.warning("Could not find HTTP port in {}", tomcatPropertiesPath);
+ LOG.warn("Could not find HTTP port in {}", tomcatPropertiesPath);
}
return portNumber;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java b/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java
index f626eaaf44..9cfc99407c 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java
@@ -6,9 +6,13 @@
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.io.IdeProgressBar;
+import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessMode;
import com.devonfw.tools.ide.process.ProcessResult;
@@ -22,6 +26,8 @@
*/
public class Vscode extends IdeToolCommandlet {
+ private static final Logger LOG = LoggerFactory.getLogger(Vscode.class);
+
/**
* The constructor.
*
@@ -61,11 +67,11 @@ public boolean installPlugin(ToolPluginDescriptor plugin, Step step, ProcessCont
extensionsCommands.add(plugin.id());
ProcessResult result = runTool(pc, ProcessMode.DEFAULT_CAPTURE, extensionsCommands);
if (result.isSuccessful()) {
- this.context.success("Successfully installed plugin: {}", plugin.name());
+ IdeLogLevel.SUCCESS.log(LOG, "Successfully installed plugin: {}", plugin.name());
step.success();
return true;
} else {
- this.context.warning("An error occurred while installing plugin: {}", plugin.name());
+ LOG.warn("An error occurred while installing plugin: {}", plugin.name());
return false;
}
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/model/UrlMetadata.java b/cli/src/main/java/com/devonfw/tools/ide/url/model/UrlMetadata.java
index 5160e14712..48167a7150 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/url/model/UrlMetadata.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/url/model/UrlMetadata.java
@@ -9,6 +9,9 @@
import java.util.List;
import java.util.Map;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.cli.CliException;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.os.SystemInfo;
@@ -25,6 +28,8 @@
*/
public class UrlMetadata implements AbstractUrlMetadata {
+ private static final Logger LOG = LoggerFactory.getLogger(UrlMetadata.class);
+
private final IdeContext context;
private final UrlRepository repository;
@@ -80,7 +85,7 @@ public List getSortedEditions(String tool) {
List list = new ArrayList<>();
UrlTool urlTool = this.repository.getChild(tool);
if (urlTool == null) {
- this.context.warning("Can't get sorted editions for tool {} because it does not exist in {}.", tool, this.repository.getPath());
+ LOG.warn("Can't get sorted editions for tool {} because it does not exist in {}.", tool, this.repository.getPath());
} else {
for (UrlEdition urlEdition : urlTool.getChildren()) {
list.add(urlEdition.getName());
@@ -128,7 +133,7 @@ private List computeSortedVersions(String tool, String editio
public VersionIdentifier resolveVersion(String tool, String edition, GenericVersionRange version, ToolCommandlet toolCommandlet) {
List versions = getSortedVersions(tool, edition, toolCommandlet);
- return VersionIdentifier.resolveVersionPattern(version, versions, this.context);
+ return VersionIdentifier.resolveVersionPattern(version, versions);
}
/**
diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java
index 92600ed96b..ab48f98299 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java
@@ -8,8 +8,10 @@
import java.util.Map;
import java.util.TreeMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.json.JsonMapping;
-import com.devonfw.tools.ide.log.IdeLogger;
import com.devonfw.tools.ide.version.VersionIdentifier;
import com.devonfw.tools.ide.version.VersionRange;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -22,6 +24,8 @@
*/
public class ToolDependencies {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolDependencies.class);
+
private static final ObjectMapper MAPPER = JsonMapping.create();
private static final ToolDependencies EMPTY = new ToolDependencies(Collections.emptyMap(), Path.of("empty"));
@@ -40,7 +44,7 @@ private ToolDependencies(Map> dependencies, P
* @param version the {@link VersionIdentifier} of the tool to install.
* @return The {@link List} of {@link ToolDependency}s for the given tool version.
*/
- public List findDependencies(VersionIdentifier version, IdeLogger logger) {
+ public List findDependencies(VersionIdentifier version) {
for (Map.Entry> entry : this.dependencies.entrySet()) {
VersionRange versionRange = entry.getKey();
@@ -50,7 +54,7 @@ public List findDependencies(VersionIdentifier version, IdeLogge
}
int size = dependencies.size();
if (size > 0) {
- logger.warning("No match for version {} while {} version ranges are configured in {} - configuration error?!", version, size, this.path);
+ LOG.warn("No match for version {} while {} version ranges are configured in {} - configuration error?!", version, size, this.path);
}
return Collections.emptyList();
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolSecurity.java b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolSecurity.java
index 929846f489..0e90f47a73 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolSecurity.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolSecurity.java
@@ -11,9 +11,11 @@
import java.util.TreeMap;
import java.util.function.Predicate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.json.JsonMapping;
import com.devonfw.tools.ide.json.JsonObject;
-import com.devonfw.tools.ide.log.IdeLogger;
import com.devonfw.tools.ide.security.ToolVulnerabilities;
import com.devonfw.tools.ide.variable.IdeVariables;
import com.devonfw.tools.ide.version.VersionIdentifier;
@@ -27,6 +29,8 @@
*/
public class ToolSecurity implements JsonObject {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolSecurity.class);
+
static final String PROPERTY_ISSUES = "issues";
private static final ObjectMapper MAPPER = JsonMapping.create();
@@ -108,11 +112,10 @@ public void clearIssues() {
* Finds all {@link Cve}s for the given {@link VersionIdentifier} that also match the given {@link Predicate}.
*
* @param version the {@link VersionIdentifier} to check.
- * @param logger the {@link IdeLogger}.
* @param predicate the {@link Predicate} deciding which matching {@link Cve}s are {@link Predicate#test(Object) accepted}.
* @return all {@link Cve}s for the given {@link VersionIdentifier}.
*/
- public ToolVulnerabilities findCves(VersionIdentifier version, IdeLogger logger, Predicate predicate) {
+ public ToolVulnerabilities findCves(VersionIdentifier version, Predicate predicate) {
List cvesOfVersion = new ArrayList<>();
for (Cve cve : this.issues) {
for (VersionRange range : cve.versions()) {
@@ -120,7 +123,7 @@ public ToolVulnerabilities findCves(VersionIdentifier version, IdeLogger logger,
if (predicate.test(cve)) {
cvesOfVersion.add(cve);
} else {
- logger.info("Ignoring CVE {} with severity {}", cve.id(), cve.severity());
+ LOG.info("Ignoring CVE {} with severity {}", cve.id(), cve.severity());
}
}
}
@@ -132,12 +135,11 @@ public ToolVulnerabilities findCves(VersionIdentifier version, IdeLogger logger,
* Finds all {@link Cve}s for the given {@link VersionIdentifier} and {@code minSeverity}.
*
* @param version the {@link VersionIdentifier} to check.
- * @param logger the {@link IdeLogger}.
* @param minSeverity the {@link IdeVariables#CVE_MIN_SEVERITY minimum severity}.
* @return the {@link ToolVulnerabilities} for the given {@link VersionIdentifier}.
*/
- public ToolVulnerabilities findCves(VersionIdentifier version, IdeLogger logger, double minSeverity) {
- return findCves(version, logger, cve -> cve.severity() >= minSeverity);
+ public ToolVulnerabilities findCves(VersionIdentifier version, double minSeverity) {
+ return findCves(version, cve -> cve.severity() >= minSeverity);
}
/**
diff --git a/cli/src/main/java/com/devonfw/tools/ide/util/PrivacyUtil.java b/cli/src/main/java/com/devonfw/tools/ide/util/PrivacyUtil.java
index 1577ee6501..c230d35814 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/util/PrivacyUtil.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/util/PrivacyUtil.java
@@ -17,13 +17,24 @@ public final class PrivacyUtil {
"tbz2", "zip", "compress", "compression", "global", "value", "code", "branch", "string", "long", "number", "numeric", "apache", "commons", "hibernate",
"storage", "db", "spring", "springframework", "boot", "quarkus", "mnt", "usr", "user", "users", "windows", "etc", "var", "log", "lib", "drivers",
"system", "system32", "appdata", "module", "info", "sha1", "md5", "sha256", "sha512", "pkcs", "p12", "cert", "file", "files", "bin", "bash", "program",
- "mingw64");
+ "mingw64", "dummy", "hosts");
// construction forbidden
private PrivacyUtil() {
}
+ private static int indexOfSlash(String arg, int start) {
+ int index = arg.indexOf('/', start);
+ int index2 = arg.indexOf('\\', start);
+ if (index2 < 0) {
+ return index;
+ } else if ((index < 0) || (index2 < index)) {
+ return index2;
+ }
+ return index;
+ }
+
/**
* @param arg the path or any {@link String} containing one or multiple paths.
* @return a normalized form of the
@@ -72,23 +83,24 @@ public static String removeSensitivePathInformation(String arg) {
}
index = indexOfSlash(arg, index);
if (index < 0) {
- result.append(arg, start, length); // append rest
+ // append rest
+ int end = start;
+ while (end < length) {
+ int cp = arg.codePointAt(end);
+ if ((cp == ' ') || (cp == '"') || (cp == '\'')) {
+ break;
+ }
+ end++;
+ }
+ appendSegment(arg, result, start, end);
+ if (end < length) {
+ result.append(arg, end, length);
+ }
}
}
return result.toString();
}
- private static int indexOfSlash(String arg, int start) {
- int index = arg.indexOf('/', start);
- int index2 = arg.indexOf('\\', start);
- if (index2 < 0) {
- return index;
- } else if ((index < 0) || (index2 < index)) {
- return index2;
- }
- return index;
- }
-
private static void appendSegment(String arg, StringBuilder result, int start, int index) {
String segment = arg.substring(start, index);
diff --git a/cli/src/main/java/com/devonfw/tools/ide/variable/AbstractVariableDefinitionList.java b/cli/src/main/java/com/devonfw/tools/ide/variable/AbstractVariableDefinitionList.java
index 2cbecac83e..e9b0f53c48 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/variable/AbstractVariableDefinitionList.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/variable/AbstractVariableDefinitionList.java
@@ -5,6 +5,9 @@
import java.util.List;
import java.util.function.Function;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.context.IdeContext;
/**
@@ -12,6 +15,8 @@
*/
public abstract class AbstractVariableDefinitionList extends AbstractVariableDefinition> {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractVariableDefinitionList.class);
+
/**
* The constructor.
*
@@ -87,7 +92,7 @@ protected List parseList(String value, IdeContext context) {
try {
list.add(parseValue(item.trim(), context));
} catch (Exception e) {
- context.warning().log(e, "Invalid value '{}' for element of variable {}", item, getName());
+ LOG.warn("Invalid value '{}' for element of variable {}", item, getName(), e);
return null;
}
diff --git a/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java b/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java
index e7ef0e2167..86ee95027c 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java
@@ -103,11 +103,17 @@ public interface IdeVariables {
c -> Boolean.TRUE);
/**
- * {@link VariableDefinition} for support of legacy xml templates without XML merge namespace
+ * {@link VariableDefinition} for support of legacy xml templates without XML merge namespace.
*/
VariableDefinitionBoolean IDE_XML_MERGE_LEGACY_SUPPORT_ENABLED = new VariableDefinitionBoolean("IDE_XML_MERGE_LEGACY_SUPPORT_ENABLED", null,
c -> Boolean.FALSE);
+ /**
+ * {@link VariableDefinition} to enable writing logfiles to disc.
+ */
+ VariableDefinitionBoolean IDE_WRITE_LOGFILE = new VariableDefinitionBoolean("IDE_WRITE_LOGFILE", null,
+ c -> Boolean.TRUE);
+
/** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getProjectName() DEVON_IDE_CUSTOM_TOOLS}. */
VariableDefinitionString DEVON_IDE_CUSTOM_TOOLS = new VariableDefinitionString("DEVON_IDE_CUSTOM_TOOLS");
diff --git a/cli/src/main/java/com/devonfw/tools/ide/variable/VariableDefinitionBoolean.java b/cli/src/main/java/com/devonfw/tools/ide/variable/VariableDefinitionBoolean.java
index ae318e0f11..9ef45bcde5 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/variable/VariableDefinitionBoolean.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/variable/VariableDefinitionBoolean.java
@@ -3,6 +3,9 @@
import java.util.Locale;
import java.util.function.Function;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.context.IdeContext;
/**
@@ -10,6 +13,8 @@
*/
public class VariableDefinitionBoolean extends AbstractVariableDefinition {
+ private static final Logger LOG = LoggerFactory.getLogger(VariableDefinitionBoolean.class);
+
/**
* The constructor.
*
@@ -85,7 +90,7 @@ public Boolean fromString(String value, IdeContext context) {
case "true", "yes" -> Boolean.TRUE;
case "false", "no" -> Boolean.FALSE;
default -> {
- context.warning("Variable {} has invalid boolean value {} - using false as fallback");
+ LOG.warn("Variable {} has invalid boolean value {} - using false as fallback", getName(), value);
yield Boolean.FALSE;
}
};
diff --git a/cli/src/main/java/com/devonfw/tools/ide/version/VersionIdentifier.java b/cli/src/main/java/com/devonfw/tools/ide/version/VersionIdentifier.java
index 8644ef13d1..bafadc950e 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/version/VersionIdentifier.java
+++ b/cli/src/main/java/com/devonfw/tools/ide/version/VersionIdentifier.java
@@ -3,8 +3,10 @@
import java.util.List;
import java.util.Objects;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.cli.CliException;
-import com.devonfw.tools.ide.log.IdeLogger;
import com.devonfw.tools.ide.tool.ToolCommandlet;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -15,6 +17,8 @@
*/
public final class VersionIdentifier implements VersionObject, GenericVersionRange {
+ private static final Logger LOG = LoggerFactory.getLogger(VersionIdentifier.class);
+
/** {@link VersionIdentifier} "*" that will resolve to the latest stable version. */
public static final VersionIdentifier LATEST = new VersionIdentifier(VersionSegment.of("*"));
@@ -64,24 +68,23 @@ private VersionIdentifier(VersionSegment start) {
* @param versions the
* {@link com.devonfw.tools.ide.tool.repository.ToolRepository#getSortedVersions(String, String, ToolCommandlet) available versions, sorted in descending
* order}.
- * @param logger the {@link IdeLogger}.
* @return the resolved version
*/
- public static VersionIdentifier resolveVersionPattern(GenericVersionRange version, List versions, IdeLogger logger) {
+ public static VersionIdentifier resolveVersionPattern(GenericVersionRange version, List versions) {
if (version == null) {
version = LATEST;
}
if (!version.isPattern()) {
for (VersionIdentifier vi : versions) {
if (vi.equals(version)) {
- logger.debug("Resolved version {} to version {}", version, vi);
+ LOG.debug("Resolved version {} to version {}", version, vi);
return vi;
}
}
}
for (VersionIdentifier vi : versions) {
if (version.contains(vi)) {
- logger.debug("Resolved version pattern {} to version {}", version, vi);
+ LOG.debug("Resolved version pattern {} to version {}", version, vi);
return vi;
}
}
diff --git a/cli/src/main/resources/META-INF/native-image/com.devonfw.tools.IDEasy/ide-cli/reflect-config.json b/cli/src/main/resources/META-INF/native-image/com.devonfw.tools.IDEasy/ide-cli/reflect-config.json
index e9a098dbd0..5eb3b81a7d 100644
--- a/cli/src/main/resources/META-INF/native-image/com.devonfw.tools.IDEasy/ide-cli/reflect-config.json
+++ b/cli/src/main/resources/META-INF/native-image/com.devonfw.tools.IDEasy/ide-cli/reflect-config.json
@@ -44,5 +44,19 @@
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true
+ },
+ {
+ "name": "com.devonfw.tools.ide.log.JulConsoleHandler",
+ "allDeclaredConstructors": false,
+ "allPublicConstructors": true,
+ "allDeclaredFields": false,
+ "allDeclaredMethods": false
+ },
+ {
+ "name": "java.util.logging.FileHandler",
+ "allDeclaredConstructors": false,
+ "allPublicConstructors": true,
+ "allDeclaredFields": false,
+ "allDeclaredMethods": false
}
]
diff --git a/cli/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider b/cli/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
new file mode 100644
index 0000000000..1ace08ba64
--- /dev/null
+++ b/cli/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
@@ -0,0 +1 @@
+com.devonfw.tools.ide.log.Slf4jProviderIdeasy
diff --git a/cli/src/test/java/com/devonfw/tools/ide/commandlet/HelpCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/commandlet/HelpCommandletTest.java
index 1057801485..e059ae73e3 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/commandlet/HelpCommandletTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/commandlet/HelpCommandletTest.java
@@ -15,7 +15,6 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.context.IdeTestContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.nls.NlsBundle;
import com.devonfw.tools.ide.property.KeywordProperty;
import com.devonfw.tools.ide.property.Property;
@@ -32,7 +31,7 @@ class HelpCommandletTest extends AbstractIdeContextTest {
void testThatHomeIsNotRequired() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
// act
HelpCommandlet help = new HelpCommandlet(context);
// assert
@@ -110,7 +109,7 @@ void testRunWithCommandlet() {
void testEnsureAllNlsPropertiesPresent(String locale) throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
NlsBundle bundleRoot = new NlsBundle(context, Locale.ROOT);
NlsBundle bundle = new NlsBundle(context, Locale.forLanguageTag(locale));
SoftAssertions soft = new SoftAssertions();
diff --git a/cli/src/test/java/com/devonfw/tools/ide/commandlet/InstallCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/commandlet/InstallCommandletTest.java
index daa12ea169..a453275307 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/commandlet/InstallCommandletTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/commandlet/InstallCommandletTest.java
@@ -1,5 +1,7 @@
package com.devonfw.tools.ide.commandlet;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import java.util.List;
import org.junit.jupiter.api.Test;
@@ -13,8 +15,6 @@
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
/**
* Test of {@link InstallCommandlet}.
*/
@@ -130,14 +130,14 @@ void testInstallCommandletWithSkipUpdates(WireMockRuntimeInfo wmRuntimeInfo) {
install.version.setValueAsString("17*", context);
// Record the log entry count before the action
- int logCountBefore = context.getLogger().getEntries().size();
+ int logCountBefore = context.getTestStartContext().getEntries().size();
// act - try to install with --skip-updates
// Should skip the update to 17.0.10 since 17.0.6 matches the pattern
install.run();
// assert - should NOT download 17.0.10, should stay on 17.0.6
- List newLogEntries = context.getLogger().getEntries().subList(logCountBefore, context.getLogger().getEntries().size());
+ List newLogEntries = context.getTestStartContext().getEntries().subList(logCountBefore, context.getTestStartContext().getEntries().size());
boolean hasDownloadMessage = newLogEntries.stream().anyMatch(e -> e.message().contains("Trying to download"));
assertThat(hasDownloadMessage).as("Should not download when --skip-updates is enabled and version matches pattern").isFalse();
assertThat(context.getSoftwarePath().resolve("java/.ide.software.version")).exists().hasContent(installedVersion);
@@ -194,13 +194,13 @@ void testInstallCommandletWithSkipUpdatesInstallsWhenVersionMismatch(WireMockRun
install.tool.setValueAsString("java", context);
install.version.setValueAsString("21*", context);
- int logCountBefore = context.getLogger().getEntries().size();
+ int logCountBefore = context.getTestStartContext().getEntries().size();
// act - install with --skip-updates but with non-matching version
install.run();
// assert - SHOULD download and install 21.x because installed 17.0.6 does NOT match pattern "21*"
- List newLogEntries = context.getLogger().getEntries().subList(logCountBefore, context.getLogger().getEntries().size());
+ List newLogEntries = context.getTestStartContext().getEntries().subList(logCountBefore, context.getTestStartContext().getEntries().size());
boolean hasDownloadMessage = newLogEntries.stream().anyMatch(e -> e.message().contains("Trying to download") && e.message().contains("21."));
assertThat(hasDownloadMessage).as("Should download when --skip-updates is enabled but version does not match").isTrue();
assertThat(context.getSoftwarePath().resolve("java/.ide.software.version")).exists().hasContent("21.0.8_9");
@@ -242,7 +242,7 @@ public void testInstallCommandletOfflineWithCachedDownload(WireMockRuntimeInfo w
// Determine the correct file extension and OS name based on the current OS
String fileExtension = context.getSystemInfo().isWindows() ? "zip" : "tgz";
String osName = context.getSystemInfo().getOs().toString().toLowerCase();
- assertThat(context).logAtDebug().hasMessage("Using cached download of java in version " + version + " from "
+ assertThat(context).logAtDebug().hasMessage("Using cached download of java in version " + version + " from "
+ context.getDownloadPath().resolve("default").resolve("java-" + version + "-" + osName + "-x64." + fileExtension) + " (offline mode)");
}
@@ -299,7 +299,7 @@ public void testInstallCommandletOfflineUpdateWithoutCachedDownload(WireMockRunt
// assert - should continue using the old version and log a warning
assertThat(context.getSoftwarePath().resolve("java/.ide.software.version")).exists().hasContent(installedVersion);
- assertThat(context).logAtWarning().hasMessage("Cannot download java in version " + targetVersion
+ assertThat(context).logAtWarning().hasMessage("Cannot download java in version " + targetVersion
+ " because we are offline. Continuing with already installed version " + installedVersion + ".");
}
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefaultTest.java b/cli/src/test/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefaultTest.java
index 3d295a41ff..b6e034de83 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefaultTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefaultTest.java
@@ -6,7 +6,7 @@
import com.devonfw.tools.ide.commandlet.VersionCommandlet;
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.property.Property;
import com.devonfw.tools.ide.property.VersionProperty;
@@ -27,7 +27,7 @@ void testAddAllMatches() {
String[] expectedCandidates = { "2.0", "2.1", "20", "200" };
VersionProperty versionProperty = new VersionProperty("", false, "version");
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
// act
@@ -46,7 +46,7 @@ void testAddAllMatchesEmptyInput() {
String input = "";
VersionProperty versionProperty = new VersionProperty("", false, "version");
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
// act
@@ -66,7 +66,7 @@ void testClearCandidates() {
String[] expectedCandidates = sortedCandidates;
VersionProperty versionProperty = new VersionProperty("", false, "version");
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
// act
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeContextTest.java b/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeContextTest.java
index 51f204d60c..ad5d37022a 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeContextTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeContextTest.java
@@ -14,9 +14,9 @@
import org.assertj.core.api.Assertions;
import com.devonfw.tools.ide.io.FileAccess;
-import com.devonfw.tools.ide.io.FileAccessImpl;
import com.devonfw.tools.ide.io.FileCopyMode;
import com.devonfw.tools.ide.io.IdeProgressBarTestImpl;
+import com.devonfw.tools.ide.io.IdeProgressBarTestImpl.ProgressEvent;
import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.tool.repository.ToolRepositoryMock;
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
@@ -99,7 +99,7 @@ protected static IdeTestContext newContext(String testProject, String projectPat
*/
protected static IdeTestContext newContext(String testProject, String projectPath, boolean copyForMutation, WireMockRuntimeInfo wmRuntimeInfo) {
- return newContext(testProject, projectPath, copyForMutation, wmRuntimeInfo, IdeLogLevel.TRACE);
+ return newContext(testProject, projectPath, copyForMutation, wmRuntimeInfo, IdeLogLevel.DEBUG);
}
/**
@@ -118,7 +118,7 @@ protected static IdeTestContext newContext(String testProject, String projectPat
Path ideRoot = TEST_PROJECTS.resolve(testProject);
if (copyForMutation) {
Path ideRootCopy = TEST_PROJECTS_COPY.resolve(testProject);
- FileAccess fileAccess = new FileAccessImpl(IdeTestContextMock.get());
+ FileAccess fileAccess = new IdeTestContext().getFileAccess();
fileAccess.delete(ideRootCopy);
fileAccess.mkdirs(TEST_PROJECTS_COPY);
fileAccess.copy(ideRoot, TEST_PROJECTS_COPY, FileCopyMode.COPY_TREE_OVERRIDE_TREE);
@@ -158,11 +158,11 @@ protected static IdeTestContextAssertion assertThat(IdeTestContext context) {
return new IdeTestContextAssertion(context);
}
- private static List assertProgressEventsAndSize(AbstractIdeTestContext context, String taskName, int chunkCount,
+ private static List assertProgressEventsAndSize(AbstractIdeTestContext context, String taskName, int chunkCount,
long maxSize) {
IdeProgressBarTestImpl progressBar = context.getProgressBarMap().get(taskName);
assertThat(progressBar).as(taskName).isNotNull();
- List eventList = progressBar.getEventList();
+ List eventList = progressBar.getEventList();
assertThat(eventList).hasSize(chunkCount + 1);
// extra case for unknown file size (indefinite progress bar)
if (progressBar.getMaxSize() != -1L) {
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java b/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java
index 26c2b4659a..84022d2a05 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java
@@ -6,6 +6,9 @@
import java.util.Map;
import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.commandlet.Commandlet;
import com.devonfw.tools.ide.commandlet.CommandletManager;
import com.devonfw.tools.ide.commandlet.TestCommandletManager;
@@ -18,7 +21,7 @@
import com.devonfw.tools.ide.environment.IdeSystemTestImpl;
import com.devonfw.tools.ide.io.IdeProgressBar;
import com.devonfw.tools.ide.io.IdeProgressBarTestImpl;
-import com.devonfw.tools.ide.log.IdeLogger;
+import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.network.NetworkStatusMock;
import com.devonfw.tools.ide.os.SystemInfo;
import com.devonfw.tools.ide.os.SystemInfoImpl;
@@ -35,6 +38,8 @@
*/
public class AbstractIdeTestContext extends AbstractIdeContext {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractIdeTestContext.class);
+
/** {@link Path} to use as workingDirectory for mocking. */
public static final Path PATH_MOCK = Path.of("/");
@@ -63,13 +68,13 @@ public class AbstractIdeTestContext extends AbstractIdeContext {
/**
* The constructor.
*
- * @param logger the {@link IdeLogger}.
+ * @param startContext the {@link IdeStartContextImpl}.
* @param workingDirectory the optional {@link Path} to current working directory.
* @param wireMockRuntimeInfo wireMock server on a random port.
*/
- public AbstractIdeTestContext(IdeStartContextImpl logger, Path workingDirectory, WireMockRuntimeInfo wireMockRuntimeInfo) {
+ public AbstractIdeTestContext(IdeStartContextImpl startContext, Path workingDirectory, WireMockRuntimeInfo wireMockRuntimeInfo) {
- super(logger, workingDirectory);
+ super(startContext, workingDirectory);
this.answers = new String[0];
this.progressBarMap = new HashMap<>();
this.systemInfo = super.getSystemInfo();
@@ -119,7 +124,7 @@ protected IdeHomeAndWorkspace findIdeHome(Path workingDirectory) {
// Validate that the detected IDE home (if any) is within test boundaries
Path ideHome = result.home();
if (ideHome != null && testBoundary != null && !ideHome.startsWith(testBoundary)) {
- debug("Test isolation violation: Detected IDE home '{}' is outside test boundary '{}'.\n"
+ LOG.debug("Test isolation violation: Detected IDE home '{}' is outside test boundary '{}'.\n"
+ "This indicates the test project structure is incomplete or improperly configured.\n"
+ "A valid IDE home directories is determined by isIdeHome() method.\n"
+ "Please ensure your test project has the required structure.", ideHome, testBoundary);
@@ -157,7 +162,7 @@ protected String readLine() {
throw new IllegalStateException("End of answers reached!");
}
String answer = this.answers[this.answerIndex++];
- interaction(answer);
+ IdeLogLevel.INTERACTION.log(LOG, answer);
return answer;
}
@@ -216,7 +221,7 @@ protected AbstractEnvironmentVariables createSystemVariables() {
public IdeSystemTestImpl getSystem() {
if (this.system == null) {
- this.system = new IdeSystemTestImpl(this);
+ this.system = new IdeSystemTestImpl();
}
return (IdeSystemTestImpl) this.system;
}
@@ -407,4 +412,11 @@ public String getDefaultWindowsGitPath() {
protected Path findBashInWindowsRegistry() {
return null;
}
+
+ @Override
+ protected boolean isWriteLogfile(Commandlet cmd) {
+
+ return false;
+ }
+
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/IdeContextTest.java b/cli/src/test/java/com/devonfw/tools/ide/context/IdeContextTest.java
index 9aeaa0e761..a81b81b47f 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/context/IdeContextTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/context/IdeContextTest.java
@@ -4,6 +4,8 @@
import java.util.Properties;
import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.devonfw.tools.ide.cli.CliArguments;
import com.devonfw.tools.ide.common.SystemPath;
@@ -22,6 +24,8 @@
*/
class IdeContextTest extends AbstractIdeContextTest {
+ private static final Logger LOG = LoggerFactory.getLogger(IdeContextTest.class);
+
/**
* Test of {@link IdeContext} initialization from basic project.
*/
@@ -182,19 +186,19 @@ void testRunWithoutLogging() {
String testDebugMessage = "Test debug message that will be suppressed because of threshold";
IdeTestContext context = newContext(PROJECT_BASIC, null, false);
// act
- context.warning(testWarningMessage);
+ LOG.warn(testWarningMessage);
// assert
assertThat(context).logAtWarning().hasMessage(testWarningMessage);
// and act
context.runWithoutLogging(() -> {
- context.warning(testWarningMessage2);
- context.info(testInfoMessage);
- context.debug(testDebugMessage);
+ LOG.warn(testWarningMessage2);
+ LOG.info(testInfoMessage);
+ LOG.debug(testDebugMessage);
assertThat(context).log().hasNoMessage(testWarningMessage2);
assertThat(context).log().hasNoMessage(testInfoMessage);
assertThat(context).log().hasNoMessage(testDebugMessage);
}, IdeLogLevel.INFO);
- context.warning(testWarningMessage3);
+ LOG.warn(testWarningMessage3);
assertThat(context).log()
.hasEntries(IdeLogEntry.ofWarning(testWarningMessage), IdeLogEntry.ofWarning(testWarningMessage2), IdeLogEntry.ofInfo(testInfoMessage),
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/IdeSlf4jContext.java b/cli/src/test/java/com/devonfw/tools/ide/context/IdeSlf4jContext.java
deleted file mode 100644
index b587bedd36..0000000000
--- a/cli/src/test/java/com/devonfw/tools/ide/context/IdeSlf4jContext.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.devonfw.tools.ide.context;
-
-import java.nio.file.Path;
-
-import com.devonfw.tools.ide.log.IdeLogLevel;
-import com.devonfw.tools.ide.log.IdeSubLoggerSlf4j;
-
-/**
- * Implementation of {@link IdeContext} for testing.
- */
-public class IdeSlf4jContext extends AbstractIdeTestContext {
-
- private static final Path PATH_MOCK = Path.of("/");
-
- /**
- * The constructor.
- */
- public IdeSlf4jContext() {
- this(PATH_MOCK);
- }
-
- /**
- * The constructor.
- *
- * @param workingDirectory the optional {@link Path} to current working directory.
- */
- public IdeSlf4jContext(Path workingDirectory) {
-
- super(new IdeStartContextImpl(IdeLogLevel.TRACE, IdeSubLoggerSlf4j::new), workingDirectory, null);
- }
-
-}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContext.java b/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContext.java
index 918b9b4245..88b1934e1a 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContext.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContext.java
@@ -7,7 +7,7 @@
import com.devonfw.tools.ide.git.GitContext;
import com.devonfw.tools.ide.git.GitContextMock;
import com.devonfw.tools.ide.log.IdeLogLevel;
-import com.devonfw.tools.ide.log.IdeTestLogger;
+import com.devonfw.tools.ide.log.IdeTestStartContext;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.tool.mvn.MvnRepository;
import com.devonfw.tools.ide.tool.npm.NpmRepository;
@@ -20,8 +20,6 @@
*/
public class IdeTestContext extends AbstractIdeTestContext {
- private final IdeTestLogger logger;
-
private GitContext gitContext;
/**
@@ -40,7 +38,7 @@ public IdeTestContext() {
*/
public IdeTestContext(Path workingDirectory, WireMockRuntimeInfo wireMockRuntimeInfo) {
- this(workingDirectory, IdeLogLevel.TRACE, wireMockRuntimeInfo);
+ this(workingDirectory, IdeLogLevel.DEBUG, wireMockRuntimeInfo);
}
/**
@@ -52,13 +50,12 @@ public IdeTestContext(Path workingDirectory, WireMockRuntimeInfo wireMockRuntime
*/
public IdeTestContext(Path workingDirectory, IdeLogLevel logLevel, WireMockRuntimeInfo wireMockRuntimeInfo) {
- this(new IdeTestLogger(logLevel), workingDirectory, wireMockRuntimeInfo);
+ this(new IdeTestStartContext(logLevel), workingDirectory, wireMockRuntimeInfo);
}
- private IdeTestContext(IdeTestLogger logger, Path workingDirectory, WireMockRuntimeInfo wireMockRuntimeInfo) {
+ private IdeTestContext(IdeTestStartContext startContext, Path workingDirectory, WireMockRuntimeInfo wireMockRuntimeInfo) {
- super(logger, workingDirectory, wireMockRuntimeInfo);
- this.logger = logger;
+ super(startContext, workingDirectory, wireMockRuntimeInfo);
this.gitContext = new GitContextMock();
}
@@ -90,11 +87,11 @@ public static IdeTestContext of() {
}
/**
- * @return the {@link IdeTestLogger}.
+ * @return the {@link IdeTestStartContext}.
*/
- public IdeTestLogger getLogger() {
+ public IdeTestStartContext getTestStartContext() {
- return logger;
+ return (IdeTestStartContext) getStartContext();
}
/**
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextAssertion.java b/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextAssertion.java
index 76a685eaaa..8a259bc311 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextAssertion.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextAssertion.java
@@ -26,7 +26,7 @@ public IdeTestContextAssertion(IdeTestContext context) {
*/
public IdeTestLoggerAssertion log(IdeLogLevel level) {
- return new IdeTestLoggerAssertion(context.getLogger().getEntries(), level);
+ return new IdeTestLoggerAssertion(context.getTestStartContext().getEntries(), level);
}
/**
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextMock.java b/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextMock.java
deleted file mode 100644
index 75c92e6829..0000000000
--- a/cli/src/test/java/com/devonfw/tools/ide/context/IdeTestContextMock.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.devonfw.tools.ide.context;
-
-/**
- * Mock instance of {@link com.devonfw.tools.ide.context.IdeContext}.
- *
- * @see #get()
- */
-public class IdeTestContextMock extends IdeSlf4jContext {
-
- private static final IdeTestContextMock INSTANCE = new IdeTestContextMock();
-
- private IdeTestContextMock() {
-
- super();
- }
-
- @Override
- protected boolean isMutable() {
-
- return false;
- }
-
- /**
- * @return the singleton mock instance of {@link com.devonfw.tools.ide.context.IdeContext}. Does NOT have {@link #getIdeHome() IDE_HOME}.
- */
- public static IdeTestContextMock get() {
-
- return INSTANCE;
- }
-
-}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/ProcessContextTestImpl.java b/cli/src/test/java/com/devonfw/tools/ide/context/ProcessContextTestImpl.java
index a12b721a37..1d1d63ec16 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/context/ProcessContextTestImpl.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/context/ProcessContextTestImpl.java
@@ -32,7 +32,7 @@ public ProcessResult run(ProcessMode processMode) {
ProcessResult result = super.run(ProcessMode.DEFAULT_CAPTURE);
// this hack is still required to capture test script output
if (result.isSuccessful() && (processMode == ProcessMode.DEFAULT || processMode == ProcessMode.BACKGROUND)) {
- result.log(IdeLogLevel.INFO, context);
+ result.log(IdeLogLevel.INFO);
}
return result;
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesFileTest.java b/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesFileTest.java
index 25e58a7240..0ee2013957 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesFileTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesFileTest.java
@@ -11,7 +11,6 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.version.VersionIdentifier;
@@ -80,7 +79,7 @@ void testSave(@TempDir Path tempDir) throws Exception {
assertThat(lines).containsExactlyElementsOf(linesToWrite);
EnvironmentVariablesPropertiesFile variables = new EnvironmentVariablesPropertiesFile(null, TYPE,
- propertiesFilePath, IdeTestContextMock.get());
+ propertiesFilePath, new IdeTestContext());
// act
variables.set("var5", "5", true);
@@ -125,7 +124,7 @@ void testSaveWithMissingParentFilePath(@TempDir Path tempDir) throws Exception {
Path propertiesFilePath = tempDir.resolve("test.properties");
EnvironmentVariablesPropertiesFile variables = new EnvironmentVariablesPropertiesFile(null, TYPE,
- propertiesFilePath, IdeTestContextMock.get());
+ propertiesFilePath, new IdeTestContext());
// act
variables.set("var1", "1.0", false);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesMock.java b/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesMock.java
index 59f57753b7..25181a7619 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesMock.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesPropertiesMock.java
@@ -7,6 +7,9 @@
import java.util.Objects;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.context.IdeContext;
/**
@@ -14,6 +17,8 @@
*/
public final class EnvironmentVariablesPropertiesMock extends EnvironmentVariablesMap {
+ private static final Logger LOG = LoggerFactory.getLogger(EnvironmentVariablesPropertiesMock.class);
+
private static final Path PROPERTIES_FILE_PATH = Path.of(DEFAULT_PROPERTIES);
private static final Path LEGACY_PROPERTIES_FILE_PATH = Path.of(LEGACY_PROPERTIES);
@@ -49,7 +54,7 @@ public EnvironmentVariablesPropertiesMock(AbstractEnvironmentVariables parent, E
public void save() {
if (this.modifiedVariables.isEmpty()) {
- this.context.trace("No changes to save in properties file {}", getPropertiesFilePath());
+ LOG.trace("No changes to save in properties file {}", getPropertiesFilePath());
return;
}
this.modifiedVariables.clear();
@@ -103,9 +108,9 @@ public String set(String name, String value, boolean export) {
String oldValue = this.variables.put(name, value);
boolean flagChanged = export != this.exportedVariables.contains(name);
if (Objects.equals(value, oldValue) && !flagChanged) {
- this.context.trace("Set variable '{}={}' caused no change in {}", name, value, getPropertiesFilePath());
+ LOG.trace("Set variable '{}={}' caused no change in {}", name, value, getPropertiesFilePath());
} else {
- this.context.debug("Set variable '{}={}' in {}", name, value, getPropertiesFilePath());
+ LOG.debug("Set variable '{}={}' in {}", name, value, getPropertiesFilePath());
this.modifiedVariables.add(name);
if (export && (value != null)) {
this.exportedVariables.add(name);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/environment/IdeSystemTestImpl.java b/cli/src/test/java/com/devonfw/tools/ide/environment/IdeSystemTestImpl.java
index 0486ce956b..aa9f4566bb 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/environment/IdeSystemTestImpl.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/environment/IdeSystemTestImpl.java
@@ -4,31 +4,30 @@
import java.util.Map;
import java.util.Properties;
-import com.devonfw.tools.ide.log.IdeLogger;
-
/**
* Extends {@link IdeSystemImpl} for testing. It will not modify your {@link System} and allows to modify environment variables for testing.
*/
public class IdeSystemTestImpl extends IdeSystemImpl {
/**
- * @param logger the {@link IdeLogger}.
+ * The constructor.
*/
- public IdeSystemTestImpl(IdeLogger logger) {
+ public IdeSystemTestImpl() {
- this(logger, new Properties(), new HashMap<>());
+ this(new Properties(), new HashMap<>());
this.environmentVariables.put("PATH", System.getenv("PATH"));
}
/**
- * @param logger the {@link IdeLogger}.
+ * The constructor.
+ *
* @param systemProperties the {@link System#getProperties() system properties} for testing.
* @param environmentVariables the {@link System#getenv() environment variables} for testing.
*/
- public IdeSystemTestImpl(IdeLogger logger, Properties systemProperties,
+ public IdeSystemTestImpl(Properties systemProperties,
Map environmentVariables) {
- super(logger, systemProperties, environmentVariables);
+ super(systemProperties, environmentVariables);
}
/**
@@ -49,11 +48,10 @@ public Properties getProperties() {
}
/**
- * @param logger the {@link IdeLogger}.
* @return a new instance of {@link IdeSystemTestImpl} initialized with {@link System} values but decoupled so changes do not affect {@link System}.
*/
- public static IdeSystemTestImpl ofSystemDefaults(IdeLogger logger) {
+ public static IdeSystemTestImpl ofSystemDefaults() {
- return new IdeSystemTestImpl(logger, new Properties(System.getProperties()), new HashMap<>(System.getenv()));
+ return new IdeSystemTestImpl(new Properties(System.getProperties()), new HashMap<>(System.getenv()));
}
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/environment/VariableLineTest.java b/cli/src/test/java/com/devonfw/tools/ide/environment/VariableLineTest.java
index d8cdce43f0..00d44ca7a3 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/environment/VariableLineTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/environment/VariableLineTest.java
@@ -7,18 +7,15 @@
import com.devonfw.tools.ide.environment.VariableLine.Empty;
import com.devonfw.tools.ide.environment.VariableLine.Garbage;
import com.devonfw.tools.ide.environment.VariableLine.Variable;
-import com.devonfw.tools.ide.log.IdeSlf4jRootLogger;
/**
* Test of {@link VariableLine}.
*/
class VariableLineTest extends Assertions {
- private static final IdeSlf4jRootLogger LOGGER = IdeSlf4jRootLogger.of();
-
private VariableLine line(String line) {
- return VariableLine.of(line, LOGGER, new VariableSource(EnvironmentVariablesType.RESOLVED, null));
+ return VariableLine.of(line, new VariableSource(EnvironmentVariablesType.RESOLVED, null));
}
/**
diff --git a/cli/src/test/java/com/devonfw/tools/ide/io/FileAccessImplTest.java b/cli/src/test/java/com/devonfw/tools/ide/io/FileAccessImplTest.java
index 6e6b4d4739..7cd4750ad8 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/io/FileAccessImplTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/io/FileAccessImplTest.java
@@ -25,9 +25,7 @@
import org.junit.jupiter.api.io.TempDir;
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
-import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.context.IdeTestContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
/**
* Test of {@link FileAccessImpl}.
@@ -43,7 +41,7 @@ void testSymlinkAbsolute(@TempDir Path tempDir) {
// relative links are checked in testRelativeLinksWorkAfterMoving
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -65,7 +63,7 @@ void testSymlinkAbsolute(@TempDir Path tempDir) {
void testSymlinkAbsolutePassingRelativeSource(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -89,7 +87,7 @@ void testSymlinkAbsolutePassingRelativeSource(@TempDir Path tempDir) {
void testSymlinkAbsoluteAsFallback(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -112,7 +110,7 @@ void testSymlinkAbsoluteAsFallback(@TempDir Path tempDir) {
void testSymlinkAbsoluteBreakAfterMoving(@TempDir Path tempDir) throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -138,7 +136,7 @@ void testSymlinkAbsoluteBreakAfterMoving(@TempDir Path tempDir) throws IOExcepti
void testSymlinkRelativeWorkAfterMovingPassingRelativeSource(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -163,7 +161,7 @@ void testSymlinkRelativeWorkAfterMovingPassingRelativeSource(@TempDir Path tempD
void testSymlinkRelativeWorkAfterMoving(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -189,7 +187,7 @@ void testSymlinkWindowsJunctionsCanNotPointToFiles(@TempDir Path tempDir) throws
// arrange
WindowsSymlinkTestHelper.assumeSymlinksSupported();
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = context.getFileAccess();
Path file = tempDir.resolve("file");
Files.createFile(file);
@@ -210,7 +208,7 @@ void testSymlinkWindowsJunctionsCanNotPointToFiles(@TempDir Path tempDir) throws
void testSymlinkShortcutPaths(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path dir = tempDir.resolve("parent");
createDirs(fileAccess, dir);
@@ -447,7 +445,7 @@ private void assertSymlinkRead(Path link, Path trueTarget) {
void testUnzip(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
// act
context.getFileAccess()
@@ -467,7 +465,7 @@ void testUnzip(@TempDir Path tempDir) {
void testUntarWithNoneCompressionWithFilePermissions(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
if (context.getSystemInfo().isWindows()) {
return;
}
@@ -489,7 +487,7 @@ void testUntarWithNoneCompressionWithFilePermissions(@TempDir Path tempDir) {
void testUntarWithGzCompressionWithFilePermissions(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
if (context.getSystemInfo().isWindows()) {
return;
}
@@ -512,7 +510,8 @@ void testUntarWithGzCompressionWithFilePermissions(@TempDir Path tempDir) {
void testUntarWithBzip2CompressionWithFilePermissions(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
+ new IdeTestContext();
if (context.getSystemInfo().isWindows()) {
return;
}
@@ -543,7 +542,7 @@ void testUntarWithGzipCompressionWithSymbolicLink(@TempDir Path tempDir) {
// arrange
WindowsSymlinkTestHelper.assumeSymlinksSupported();
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
Path linkTarGz = Path.of("src/test/resources/com/devonfw/tools/ide/io/link.tar.gz");
FileAccess fileAccess = context.getFileAccess();
@@ -577,7 +576,7 @@ void testGeneratePermissionString() {
@Test
void testDisabledExtractMovesArchive(@TempDir Path tempDir) {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccessImpl fileAccess = new FileAccessImpl(context);
Path downloadArchive = tempDir.resolve("downloaded.zip");
fileAccess.touch(downloadArchive);
@@ -600,7 +599,7 @@ void testDisabledExtractMovesArchive(@TempDir Path tempDir) {
@Test
void testExtractTgzArchive(@TempDir Path tempDir) throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccessImpl fileAccess = new FileAccessImpl(context);
Path downloadedTgz = tempDir.resolve("downloaded.tgz");
fileAccess.touch(downloadedTgz);
@@ -642,7 +641,7 @@ void testExtractTgzArchive(@TempDir Path tempDir) throws IOException {
*/
@Test
void testFindExistingFileInFolders(@TempDir Path tempDir) {
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccessImpl fileAccess = new FileAccessImpl(context);
Path subfolder1 = tempDir.resolve("subfolder1");
fileAccess.mkdirs(subfolder1);
@@ -728,7 +727,7 @@ void testDownloadSmallFileWithoutProgressBar(@TempDir Path tempDir) throws IOExc
void testSymlinkOverwritesBrokenJunction(@TempDir Path tempDir) throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
Path sourceDir = tempDir.resolve("source");
Path targetLink = tempDir.resolve("junction");
@@ -768,7 +767,7 @@ void testSymlinkOverwritesBrokenJunction(@TempDir Path tempDir) throws IOExcepti
void testIsJunctionHandlesBrokenLinks(@TempDir Path tempDir) throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
FileAccess fileAccess = new FileAccessImpl(context);
if (!context.getSystemInfo().isWindows()) {
@@ -798,7 +797,7 @@ void testIsJunctionHandlesBrokenLinks(@TempDir Path tempDir) throws IOException
fileAccess.symlink(newSource, brokenLink, false);
assertThat(brokenLink.toRealPath()).isEqualTo(newSource);
} else {
- context.info("Test adapted for Windows environment - testing basic junction functionality");
+ System.out.println("Test adapted for Windows environment - testing basic junction functionality");
// On Windows, just test that basic junction functionality works
Path sourceDir = tempDir.resolve("source");
Path junctionLink = tempDir.resolve("junction");
@@ -818,7 +817,7 @@ void testIsJunctionHandlesBrokenLinks(@TempDir Path tempDir) throws IOException
void testBinPath() {
// arrange
- FileAccess fileAccess = IdeTestContextMock.get().getFileAccess();
+ FileAccess fileAccess = new IdeTestContext().getFileAccess();
Path projects = Path.of("src/test/resources/ide-projects");
Path rootPath = projects.resolve("basic/project/software/java");
Path binPath = rootPath.resolve("bin");
@@ -847,7 +846,7 @@ void testFindAncestor() {
private void verifyFindAncestor(String path, String baseDir, int subfolderCount, String expectedResult) {
- FileAccess fileAccess = IdeTestContextMock.get().getFileAccess();
+ FileAccess fileAccess = new IdeTestContext().getFileAccess();
Path result = fileAccess.findAncestor(asPath(path), asPath(baseDir), subfolderCount);
AbstractPathAssert> assertion = assertThat(result).as("findAncestor(" + path + ", " + baseDir + ", " + subfolderCount);
if (expectedResult == null) {
@@ -868,7 +867,7 @@ private static Path asPath(String path) {
void testIsNonEmptyFile(@TempDir Path tempDir) throws IOException {
// arrange
- FileAccess fileAccess = IdeTestContextMock.get().getFileAccess();
+ FileAccess fileAccess = new IdeTestContext().getFileAccess();
// act + assert
assertThat(fileAccess.isNonEmptyFile(tempDir)).isFalse();
diff --git a/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java b/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java
index 2e4626b805..94ccd02d53 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java
@@ -26,48 +26,49 @@ class IdeProgressBarTest extends AbstractIdeContextTest {
private static final String TEST_URL = "/os/windows_x64_url.tgz";
+ @TempDir
+ Path tempDir;
+
/**
* Tests if a download of a file with a valid content length was displaying an {@link IdeProgressBar} properly.
*
- * @param tempDir temporary directory to use.
* @param wmRuntimeInfo wireMock server on a random port
*/
@Test
- void testProgressBarDownloadWithValidContentLength(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) {
+ void testProgressBarDownloadWithValidContentLength(WireMockRuntimeInfo wmRuntimeInfo) {
stubFor(any(urlMatching("/os/.*")).willReturn(
aResponse().withStatus(200).withBody(new byte[MAX_LENGTH]).withHeader("Content-Length", String.valueOf(MAX_LENGTH))));
- IdeContext context = newContext(tempDir);
+ IdeContext context = newContext(this.tempDir);
FileAccess impl = context.getFileAccess();
- impl.download(wmRuntimeInfo.getHttpBaseUrl() + TEST_URL, tempDir.resolve("windows_x64_url.tgz"));
- assertThat(tempDir.resolve("windows_x64_url.tgz")).exists();
+ impl.download(wmRuntimeInfo.getHttpBaseUrl() + TEST_URL, this.tempDir.resolve("windows_x64_url.tgz"));
+ assertThat(this.tempDir.resolve("windows_x64_url.tgz")).exists();
assertProgressBar(context, "Downloading", MAX_LENGTH);
}
/**
* Tests if {@link FileAccess#download(String, Path)} with missing content length is working properly.
*
- * @param tempDir temporary directory to use.
* @param wmRuntimeInfo wireMock server on a random port
*/
@Test
- void testProgressBarDownloadWithMissingContentLength(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) {
+ void testProgressBarDownloadWithMissingContentLength(WireMockRuntimeInfo wmRuntimeInfo) {
//arrange
String taskName = "Downloading";
stubFor(any(urlMatching("/os/.*")).willReturn(aResponse().withStatus(200).withBody(new byte[MAX_LENGTH])));
- IdeTestContext context = newContext(tempDir);
+ IdeTestContext context = newContext(this.tempDir);
FileAccess impl = context.getFileAccess();
//act
String testUrl = wmRuntimeInfo.getHttpBaseUrl() + TEST_URL;
- impl.download(testUrl, tempDir.resolve("windows_x64_url.tgz"));
+ impl.download(testUrl, this.tempDir.resolve("windows_x64_url.tgz"));
//assert
assertUnknownProgressBar(context, "Downloading", MAX_LENGTH);
assertThat(context).logAtWarning().hasMessage(
"Content-Length was not provided by download from " + testUrl);
- assertThat(tempDir.resolve("windows_x64_url.tgz")).exists();
+ assertThat(this.tempDir.resolve("windows_x64_url.tgz")).exists();
IdeProgressBarTestImpl progressBar = context.getProgressBarMap().get(taskName);
assertThat(progressBar.getMaxSize()).isEqualTo(-1);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/io/IniFileImplTest.java b/cli/src/test/java/com/devonfw/tools/ide/io/IniFileImplTest.java
index 231b3c789f..628c14a0fe 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/io/IniFileImplTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/io/IniFileImplTest.java
@@ -10,7 +10,7 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.io.ini.IniFile;
import com.devonfw.tools.ide.io.ini.IniFileImpl;
import com.devonfw.tools.ide.io.ini.IniSection;
@@ -64,7 +64,7 @@ private IniFile getIniFile(IdeContext context, String content) throws IOExceptio
@Test
void testGetSectionNames() throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
IniFile iniFileA = getIniFile(context, iniContentWithInitialProperties);
IniFile iniFIleB = getIniFile(context, iniContent);
@@ -88,7 +88,7 @@ void testGetSectionNames() throws IOException {
@Test
void testRemoveSection() throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
IniFile iniFileA = getIniFile(context, iniContentWithInitialProperties);
IniFile iniFileB = getIniFile(context, iniContent);
String[] expectedSections = { "filter \"lfs\"", "credential", "credential.details", "core" };
@@ -113,7 +113,7 @@ void testRemoveSection() throws IOException {
@Test
void testGetSection() throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
IniFile iniFileA = getIniFile(context, iniContentWithInitialProperties);
IniFile iniFileB = getIniFile(context, iniContent);
String sectionName = "credential";
@@ -143,7 +143,7 @@ void testGetSection() throws IOException {
@Test
void testGetOrCreateSection() throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
IniFile iniFileA = getIniFile(context, iniContentWithInitialProperties);
IniFile iniFileB = getIniFile(context, iniContent);
String sectionName = "credential";
@@ -186,7 +186,7 @@ void testGetOrCreateSection() throws IOException {
@Test
void testToString() throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
IniFile iniFileA = getIniFile(context, iniContentWithInitialProperties);
IniFile iniFileB = getIniFile(context, iniContent);
@@ -207,7 +207,7 @@ void testToString() throws IOException {
@Test
void testAddProperty() throws IOException {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
IniFile iniFileB = getIniFile(context, iniContent);
String expectedContent = "variable = value\n" + iniContent;
diff --git a/cli/src/main/java/com/devonfw/tools/ide/log/IdeLogListenerCollector.java b/cli/src/test/java/com/devonfw/tools/ide/log/IdeLogListenerCollector.java
similarity index 89%
rename from cli/src/main/java/com/devonfw/tools/ide/log/IdeLogListenerCollector.java
rename to cli/src/test/java/com/devonfw/tools/ide/log/IdeLogListenerCollector.java
index 5950be0c78..6099578011 100644
--- a/cli/src/main/java/com/devonfw/tools/ide/log/IdeLogListenerCollector.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/log/IdeLogListenerCollector.java
@@ -1,7 +1,7 @@
package com.devonfw.tools.ide.log;
-import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* Implementation of {@link IdeLogListener} that collects all events as {@link IdeLogEntry}.
@@ -15,7 +15,7 @@ public class IdeLogListenerCollector extends IdeLogListenerBuffer {
*/
public IdeLogListenerCollector() {
super(false);
- this.entries = new ArrayList<>(512);
+ this.entries = new CopyOnWriteArrayList<>();
}
/**
diff --git a/cli/src/test/java/com/devonfw/tools/ide/log/IdeSlf4jRootLogger.java b/cli/src/test/java/com/devonfw/tools/ide/log/IdeSlf4jRootLogger.java
deleted file mode 100644
index 5aa4e17336..0000000000
--- a/cli/src/test/java/com/devonfw/tools/ide/log/IdeSlf4jRootLogger.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.devonfw.tools.ide.log;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * {@link IdeLogger} that delegates to SLF4J used for testing.
- */
-public class IdeSlf4jRootLogger implements IdeLogger {
-
- private static final IdeSlf4jRootLogger INSTANCE = new IdeSlf4jRootLogger();
-
- private final Map loggers;
-
- /**
- * The constructor.
- */
- public IdeSlf4jRootLogger() {
-
- super();
- this.loggers = new HashMap<>();
- for (IdeLogLevel level : IdeLogLevel.values()) {
- this.loggers.put(level, new IdeSubLoggerSlf4j(level, null));
- }
- }
-
- @Override
- public IdeSubLogger level(IdeLogLevel level) {
-
- return this.loggers.get(level);
- }
-
- /**
- * @return the singleton instance.
- */
- public static IdeSlf4jRootLogger of() {
-
- return INSTANCE;
- }
-
-}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/log/IdeSubLoggerSlf4j.java b/cli/src/test/java/com/devonfw/tools/ide/log/IdeSubLoggerSlf4j.java
deleted file mode 100644
index e39bb3f283..0000000000
--- a/cli/src/test/java/com/devonfw/tools/ide/log/IdeSubLoggerSlf4j.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.devonfw.tools.ide.log;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.event.Level;
-import org.slf4j.spi.LoggingEventBuilder;
-
-/**
- * Implementation of {@link IdeSubLogger} for testing that delegates to slf4j.
- */
-public class IdeSubLoggerSlf4j extends AbstractIdeSubLogger {
-
- private static final Logger LOG = LoggerFactory.getLogger(IdeSubLoggerSlf4j.class);
-
- private final Level logLevel;
-
- /**
- * The constructor.
- *
- * @param level the {@link #getLevel() log-level}.
- */
- public IdeSubLoggerSlf4j(IdeLogLevel level) {
- this(level, null);
- }
-
- /**
- * The constructor.
- *
- * @param level the {@link #getLevel() log-level}.
- */
- public IdeSubLoggerSlf4j(IdeLogLevel level, IdeLogListener listener) {
-
- super(level, false, IdeLogExceptionDetails.NONE, listener);
- this.logLevel = switch (level) {
- case TRACE -> Level.TRACE;
- case DEBUG -> Level.DEBUG;
- case WARNING -> Level.WARN;
- case ERROR -> Level.ERROR;
- default -> Level.INFO;
- };
- }
-
- @Override
- protected void doLog(String message, Throwable error) {
-
- LoggingEventBuilder builder = LOG.atLevel(this.logLevel);
- String msg = message;
- if (error != null) {
- builder = builder.setCause(error);
- if (msg == null) {
- msg = error.toString();
- }
- }
- if (this.level.isCustom()) {
- msg = this.level.name() + ":" + message;
- }
- builder.log(msg);
- }
-
-}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLogger.java b/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLogger.java
deleted file mode 100644
index ca889bbc22..0000000000
--- a/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLogger.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.devonfw.tools.ide.log;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.devonfw.tools.ide.context.IdeStartContextImpl;
-
-/**
- * Extends {@link IdeStartContextImpl} for testing.
- */
-public class IdeTestLogger extends IdeStartContextImpl {
-
- private final IdeLogListenerCollector collector;
-
- public IdeTestLogger() {
-
- this(IdeLogLevel.DEBUG);
- }
-
- public IdeTestLogger(IdeLogLevel minLogLevel) {
-
- this(new ArrayList<>(), minLogLevel, new IdeLogListenerCollector());
- }
-
- private IdeTestLogger(List entries, IdeLogLevel minLogLevel, IdeLogListenerCollector collector) {
-
- super(minLogLevel, level -> new IdeSubLoggerSlf4j(level, collector));
- this.collector = collector;
- }
-
- /**
- * @return the {@link List} of {@link IdeLogEntry} that have been logged for test assertions.
- */
- public List getEntries() {
-
- return this.collector.getEntries();
- }
-}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLoggerAssertion.java b/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLoggerAssertion.java
index e67bc6c5be..3676fb1759 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLoggerAssertion.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestLoggerAssertion.java
@@ -21,7 +21,7 @@ public IdeTestLoggerAssertion(List entries, IdeLogLevel level) {
}
/**
- * @param message the expected {@link com.devonfw.tools.ide.log.IdeSubLogger#log(String) log message}.
+ * @param message the expected {@link IdeLogEntry#message() log message}.
* @return this assertion itself for fluent API calls.
*/
public IdeTestLoggerAssertion hasMessage(String message) {
@@ -30,8 +30,7 @@ public IdeTestLoggerAssertion hasMessage(String message) {
}
/**
- * @param message the {@link String} expected to be {@link String#contains(CharSequence) contained} in a
- * {@link com.devonfw.tools.ide.log.IdeSubLogger#log(String) log message}.
+ * @param message the {@link String} expected to be {@link String#contains(CharSequence) contained} in a {@link IdeLogEntry}.
* @return this assertion itself for fluent API calls.
*/
public IdeTestLoggerAssertion hasMessageContaining(String message) {
@@ -40,7 +39,7 @@ public IdeTestLoggerAssertion hasMessageContaining(String message) {
}
/**
- * @param message the {@link com.devonfw.tools.ide.log.IdeSubLogger#log(String) log message} that is not expected and should not have been logged.
+ * @param message the {@link IdeLogEntry#message() log message} that is not expected and should not have been logged.
* @return this assertion itself for fluent API calls.
*/
public IdeTestLoggerAssertion hasNoMessage(String message) {
@@ -49,8 +48,7 @@ public IdeTestLoggerAssertion hasNoMessage(String message) {
}
/**
- * @param message the {@link String} expected not be {@link String#contains(CharSequence) contained} in any
- * {@link com.devonfw.tools.ide.log.IdeSubLogger#log(String) log message}.
+ * @param message the {@link String} expected not be {@link String#contains(CharSequence) contained} in any {@link IdeLogEntry}.
* @return this assertion itself for fluent API calls.
*/
public IdeTestLoggerAssertion hasNoMessageContaining(String message) {
@@ -69,7 +67,7 @@ public IdeTestLoggerAssertion hasNoEntryWithException() {
}
/**
- * @param messages the expected {@link com.devonfw.tools.ide.log.IdeSubLogger#log(String) log message}s in order.
+ * @param messages the expected {@link IdeLogEntry#message()} message}s in order.
* @return this assertion itself for fluent API calls.
*/
public IdeTestLoggerAssertion hasEntries(String... messages) {
diff --git a/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestStartContext.java b/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestStartContext.java
new file mode 100644
index 0000000000..4b174eb778
--- /dev/null
+++ b/cli/src/test/java/com/devonfw/tools/ide/log/IdeTestStartContext.java
@@ -0,0 +1,37 @@
+package com.devonfw.tools.ide.log;
+
+import java.util.List;
+
+import com.devonfw.tools.ide.context.IdeStartContextImpl;
+
+/**
+ * Extends {@link IdeStartContextImpl} for testing.
+ */
+public class IdeTestStartContext extends IdeStartContextImpl {
+
+ private final IdeLogListenerCollector collector;
+
+ /**
+ * The constructor.
+ *
+ * @param logLevelConsole the {@link IdeLogLevel} acting as threshold for the console.
+ */
+ public IdeTestStartContext(IdeLogLevel logLevelConsole) {
+
+ this(logLevelConsole, new IdeLogListenerCollector());
+ }
+
+ private IdeTestStartContext(IdeLogLevel logLevelConsole, IdeLogListenerCollector logListener) {
+
+ super(logLevelConsole, logListener);
+ this.collector = logListener;
+ }
+
+ /**
+ * @return the {@link List} of {@link IdeLogEntry} that have been logged for test assertions.
+ */
+ public List getEntries() {
+
+ return this.collector.getEntries();
+ }
+}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/merge/xml/XmlMergerTest.java b/cli/src/test/java/com/devonfw/tools/ide/merge/xml/XmlMergerTest.java
index c0f1d52a51..e3be322fb1 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/merge/xml/XmlMergerTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/merge/xml/XmlMergerTest.java
@@ -17,7 +17,6 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.environment.EnvironmentVariables;
import com.devonfw.tools.ide.environment.EnvironmentVariablesPropertiesMock;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
@@ -51,7 +50,7 @@ void testMerger(Path folder, @TempDir Path tempDir) throws Exception {
Path targetPath = tempDir.resolve(TARGET_XML);
Path resultPath = folder.resolve(RESULT_XML);
Files.copy(folder.resolve(TARGET_XML), targetPath, REPLACE_EXISTING);
- IdeTestContextMock context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
EnvironmentVariablesPropertiesMock mockVariables = new EnvironmentVariablesPropertiesMock(null, EnvironmentVariablesType.SETTINGS, context);
mockVariables.set("JAVA_HOME", "/projects/myproject", false);
mockVariables.set("JAVA_VERSION", "21", false);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/migration/IdeMigratorTest.java b/cli/src/test/java/com/devonfw/tools/ide/migration/IdeMigratorTest.java
index 87b6d7cc3f..01365bc96e 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/migration/IdeMigratorTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/migration/IdeMigratorTest.java
@@ -3,6 +3,8 @@
import java.util.List;
import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeContext;
@@ -14,6 +16,8 @@
*/
class IdeMigratorTest extends AbstractIdeContextTest {
+ private static final Logger LOG = LoggerFactory.getLogger(IdeMigratorTest.class);
+
/** Test that no migration is executed when outside of project. */
@Test
void testDoesNothingWithoutIdeHome() {
@@ -77,7 +81,7 @@ public Dummy202501002() {
@Override
public void run(IdeContext context) {
- context.info("202501002 migration was done");
+ LOG.info("202501002 migration was done");
}
}
@@ -90,7 +94,7 @@ public Dummy202502003() {
@Override
public void run(IdeContext context) {
- context.info("202502003 migration completed");
+ LOG.info("202502003 migration completed");
}
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/os/MacOsHelperTest.java b/cli/src/test/java/com/devonfw/tools/ide/os/MacOsHelperTest.java
index d694301281..3c11e90a0d 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/os/MacOsHelperTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/os/MacOsHelperTest.java
@@ -23,7 +23,7 @@ void testJava() {
// arrange
String tool = "java";
Path rootDir = APPS_DIR.resolve(tool);
- MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.MAC_X64, CONTEXT);
+ MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.MAC_X64);
// act
Path linkDir = helper.findLinkDir(rootDir, tool);
// assert
@@ -37,7 +37,7 @@ void testSpecial() {
// arrange
String tool = "special";
Path rootDir = APPS_DIR.resolve(tool);
- MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.MAC_X64, CONTEXT);
+ MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.MAC_X64);
// act
Path linkDir = helper.findLinkDir(rootDir, tool);
// assert
@@ -51,7 +51,7 @@ void testNotMac() {
// arrange
String tool = "java";
Path rootDir = APPS_DIR.resolve(tool);
- MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.LINUX_X64, CONTEXT);
+ MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.LINUX_X64);
// act
Path linkDir = helper.findLinkDir(rootDir, tool);
// assert
@@ -65,7 +65,7 @@ void testJmc() {
// arrange
String tool = "jmc";
Path rootDir = APPS_DIR.resolve(tool);
- MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.MAC_X64, CONTEXT);
+ MacOsHelper helper = new MacOsHelper(CONTEXT.getFileAccess(), SystemInfoMock.MAC_X64);
// act
Path linkDir = helper.findLinkDir(rootDir, tool);
// assert
diff --git a/cli/src/test/java/com/devonfw/tools/ide/os/WindowsHelperImplTest.java b/cli/src/test/java/com/devonfw/tools/ide/os/WindowsHelperImplTest.java
index b9c8f95cde..85935fb72a 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/os/WindowsHelperImplTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/os/WindowsHelperImplTest.java
@@ -7,7 +7,7 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.AbstractIdeTestContext;
-import com.devonfw.tools.ide.context.IdeSlf4jContext;
+import com.devonfw.tools.ide.context.IdeTestContext;
/**
* Tests for {@link WindowsHelperImpl}.
@@ -20,7 +20,7 @@ class WindowsHelperImplTest extends AbstractIdeContextTest {
@Test
void testWindowsHelperParseRegString() {
// arrange
- AbstractIdeTestContext context = new IdeSlf4jContext();
+ AbstractIdeTestContext context = new IdeTestContext();
WindowsHelperImpl helper = new WindowsHelperImpl(context);
List output = new ArrayList<>();
output.add("");
@@ -39,7 +39,7 @@ void testWindowsHelperParseRegString() {
@Test
void testWindowsHelperParseEmptyRegStringReturnsNull() {
// arrange
- AbstractIdeTestContext context = new IdeSlf4jContext();
+ AbstractIdeTestContext context = new IdeTestContext();
WindowsHelperImpl helper = new WindowsHelperImpl(context);
List output = new ArrayList<>();
// act
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/BooleanPropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/BooleanPropertyTest.java
index 9935bb4706..432f921e8c 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/BooleanPropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/BooleanPropertyTest.java
@@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
/**
* Test of {@link BooleanProperty}.
@@ -15,7 +15,7 @@ class BooleanPropertyTest {
@Test
void testParse() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
BooleanProperty boolProp = new BooleanProperty("name", false, "alias");
assertThat(boolProp.parse("true", context)).isTrue();
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/CommandletPropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/CommandletPropertyTest.java
index 9015efb1b2..ca3c841723 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/CommandletPropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/CommandletPropertyTest.java
@@ -10,7 +10,7 @@
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
import com.devonfw.tools.ide.completion.CompletionCandidateCollectorDefault;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.tool.helm.Helm;
import com.devonfw.tools.ide.tool.intellij.Intellij;
@@ -23,7 +23,7 @@ class CommandletPropertyTest {
void testCompleteValue() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
String[] expectedCandidates = { "help", "helm" };
String input = "he";
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
@@ -40,7 +40,7 @@ void testCompleteValue() {
void testParse() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
// act
CommandletProperty cmdProp = new CommandletProperty("", false, "");
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/EnumPropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/EnumPropertyTest.java
index 6f942a357c..769ff113bb 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/EnumPropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/EnumPropertyTest.java
@@ -10,7 +10,7 @@
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
import com.devonfw.tools.ide.completion.CompletionCandidateCollectorDefault;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
/**
* Test of {@link EnumProperty}.
@@ -32,7 +32,7 @@ void testGetValueType() {
@Test
void testParse() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
EnumProperty enumProp = new EnumProperty<>("", false, "", TestEnum.class);
assertThat(enumProp.parse("elementzero", context)).isEqualTo(TestEnum.ELEMENTZERO);
@@ -42,7 +42,7 @@ void testParse() {
@Test
void testCompleteValue() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
String[] expectedCandidates = { "elementzero", "elementone", "elementtwo" };
String input = "ele";
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/LocalePropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/LocalePropertyTest.java
index 34588c0f85..8ccdac5f90 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/LocalePropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/LocalePropertyTest.java
@@ -10,7 +10,7 @@
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
import com.devonfw.tools.ide.completion.CompletionCandidateCollectorDefault;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
/**
* Test of {@link LocaleProperty}.
@@ -22,7 +22,7 @@ class LocalePropertyTest extends Assertions {
void testGermany() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
Locale germany = Locale.GERMANY;
// act
LocaleProperty property = new LocaleProperty("--locale", true, null);
@@ -39,7 +39,7 @@ void testGermany() {
void testCompletion() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
String[] expectedCandidates = { "de", "de-AT", "de-BE", "de-CH", "de-DE", "de-IT", "de-LI", "de-LU", "de-Latn-DE" };
String input = "de";
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/NumberPropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/NumberPropertyTest.java
index b8719743ca..6210b80580 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/NumberPropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/NumberPropertyTest.java
@@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
/**
* Test of {@link NumberProperty}.
@@ -16,7 +16,7 @@ class NumberPropertyTest {
@Test
void testParse() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
// act
NumberProperty numberProp = new NumberProperty("", false, "");
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/ToolPropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/ToolPropertyTest.java
index 16a4f17240..11d028c48c 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/ToolPropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/ToolPropertyTest.java
@@ -10,7 +10,7 @@
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
import com.devonfw.tools.ide.completion.CompletionCandidateCollectorDefault;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.tool.intellij.Intellij;
import com.devonfw.tools.ide.tool.java.Java;
@@ -21,7 +21,7 @@ class ToolPropertyTest {
@Test
void testCompleteValue() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
String[] expectedCandidates = { "az", "android-studio", "aws" };
String input = "a";
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
@@ -34,7 +34,7 @@ void testCompleteValue() {
@Test
void testParse() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
ToolProperty toolProp = new ToolProperty("", false, "");
assertThat(toolProp.parse("intellij", context)).isInstanceOf(Intellij.class);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/property/VersionPropertyTest.java b/cli/src/test/java/com/devonfw/tools/ide/property/VersionPropertyTest.java
index d17d5edab5..1105b1f441 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/property/VersionPropertyTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/property/VersionPropertyTest.java
@@ -11,7 +11,7 @@
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
import com.devonfw.tools.ide.completion.CompletionCandidateCollectorDefault;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.version.VersionIdentifier;
/**
@@ -21,7 +21,7 @@ class VersionPropertyTest {
@Test
void testParse() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
VersionProperty versionProp = new VersionProperty("", false, "");
assertThat(versionProp.parse("1", context)).isEqualTo(VersionIdentifier.of("1"));
@@ -34,7 +34,7 @@ void testParse() {
*/
@Test
void testCompleteValueUnfitCommandlet() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
VersionProperty versionProp = new VersionProperty("", false, "");
@@ -49,7 +49,7 @@ void testCompleteValueUnfitCommandlet() {
*/
@Test
void testCompleteValuePatternGiven() {
- IdeContext context = IdeTestContextMock.get();
+ IdeContext context = new IdeTestContext();
String anyVersion = "*";
String anyVersionAfter2 = "2.*";
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/step/StepTest.java b/cli/src/test/java/com/devonfw/tools/ide/step/StepTest.java
index 8f6eb4f4d8..0a5b87d12c 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/step/StepTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/step/StepTest.java
@@ -5,6 +5,7 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.log.IdeLogEntry;
+import com.devonfw.tools.ide.log.IdeLogLevel;
/**
* Test of {@link Step}.
@@ -15,7 +16,7 @@ class StepTest extends AbstractIdeContextTest {
void testValidUsageSuccess() {
// arrage
- IdeTestContext context = newContext(PROJECT_BASIC, "project", false);
+ IdeTestContext context = newContext(PROJECT_BASIC, "project", false, null, IdeLogLevel.TRACE);
// act
Step step = context.newStep("Test-Step");
try {
@@ -36,7 +37,7 @@ void testValidUsageSuccess() {
void testValidUsageSuccessSilent() {
// arrage
- IdeTestContext context = newContext(PROJECT_BASIC, "project", false);
+ IdeTestContext context = newContext(PROJECT_BASIC, "project", false, null, IdeLogLevel.TRACE);
// act
Step step = context.newStep(true, "Test-Step", "arg1", "arg2");
try {
@@ -61,7 +62,7 @@ void testValidUsageSuccessSilent() {
void testValidUsageError() {
// arrage
- IdeTestContext context = newContext(PROJECT_BASIC, "project", false);
+ IdeTestContext context = newContext(PROJECT_BASIC, "project", false, null, IdeLogLevel.TRACE);
// act
Step step = context.newStep("Test-Step");
try {
@@ -82,14 +83,14 @@ void testValidUsageError() {
void testInvalidUsageSuccessError() {
// arrage
- IdeTestContext context = newContext(PROJECT_BASIC, "project", false);
+ IdeTestContext context = newContext(PROJECT_BASIC, "project", false, null, IdeLogLevel.TRACE);
// act
Step step = context.newStep("Test-Step");
try {
step.success("The Test-Step succeeded as expected");
throw new IllegalStateException("unexpected situation!");
} catch (IllegalStateException e) {
- step.error(e);
+ step.error(e, e.toString());
} finally {
step.close();
}
@@ -107,7 +108,7 @@ void testInvalidUsageSuccessError() {
void testInvalidUsageErrorSuccess() {
// arrage
- IdeTestContext context = newContext(PROJECT_BASIC, "project", false);
+ IdeTestContext context = newContext(PROJECT_BASIC, "project", false, null, IdeLogLevel.TRACE);
// act
Step step = context.newStep("Test-Step");
try {
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/LocalToolCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/LocalToolCommandletTest.java
index dec62d8e0e..c5f3f34df5 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/LocalToolCommandletTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/LocalToolCommandletTest.java
@@ -131,7 +131,7 @@ void testRunToolWithDependencies() {
private static void runIntellijAndCheckInstallationWithJavaDependency(IdeTestContext context) {
// arrange
- context.getLogger().getEntries().clear(); // clear logs from previous run(s)
+ context.getTestStartContext().getEntries().clear(); // clear logs from previous run(s)
Intellij intellij = context.getCommandletManager().getCommandlet(Intellij.class);
// act
intellij.run();
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapperTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapperTest.java
index 4fbddc8ed8..cdc644432c 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapperTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/custom/CustomToolsMapperTest.java
@@ -9,7 +9,6 @@
import com.devonfw.tools.ide.context.AbstractIdeTestContext;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeSlf4jContext;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.os.OperatingSystem;
import com.devonfw.tools.ide.os.SystemArchitecture;
@@ -43,7 +42,7 @@ void testReadCustomToolsFromLegacyConfig() {
IdeContext context = new IdeTestContext();
String legacyProperties = "(jboss-eap:7.1.4.GA:all:https://host.tld/projects/my-project firefox:70.0.1:all:)";
// act
- CustomTools customTools = CustomToolsMapper.parseCustomToolsFromLegacyConfig(legacyProperties, context);
+ CustomTools customTools = CustomToolsMapper.parseCustomToolsFromLegacyConfig(legacyProperties);
// assert
assertThat(customTools.url()).isEqualTo("https://host.tld/projects/my-project");
assertThat(customTools.tools()).containsExactly(new CustomTool("jboss-eap", "7.1.4.GA", true, true,
@@ -57,7 +56,7 @@ void testReadEmptyCustomToolsFromLegacyConfig() {
IdeContext context = new IdeTestContext();
String legacyProperties = "()";
// act
- CustomTools customTools = CustomToolsMapper.parseCustomToolsFromLegacyConfig(legacyProperties, context);
+ CustomTools customTools = CustomToolsMapper.parseCustomToolsFromLegacyConfig(legacyProperties);
// assert
assertThat(customTools).isNull();
}
@@ -68,7 +67,7 @@ void testReadFaultyCustomToolsFromLegacyConfig() {
IdeContext context = new IdeTestContext();
String legacyProperties = "(jboss-eap:7.1.4.GA:all)";
// act
- CustomTools customTools = CustomToolsMapper.parseCustomToolsFromLegacyConfig(legacyProperties, context);
+ CustomTools customTools = CustomToolsMapper.parseCustomToolsFromLegacyConfig(legacyProperties);
// assert
assertThat(customTools).isNull();
}
@@ -80,7 +79,7 @@ void testReadFaultyCustomToolsFromLegacyConfig() {
void testProperConvertFromCustomToolsJsonToCustomToolMetaData() {
// arrange
- AbstractIdeTestContext context = new IdeSlf4jContext(Path.of(""));
+ AbstractIdeTestContext context = new IdeTestContext();
context.setSystemInfo(SystemInfoMock.LINUX_X64);
String name = "jboss-eap";
String version = "7.4.5.GA";
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/dotnet/DotNetTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/dotnet/DotNetTest.java
index 4ba8c644da..fbb783a889 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/dotnet/DotNetTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/dotnet/DotNetTest.java
@@ -81,7 +81,6 @@ private void runExecutable(String operatingSystem) {
SystemInfo systemInfo = SystemInfoMock.of(operatingSystem);
this.context.setSystemInfo(systemInfo);
- this.context.info("Running dotnet binary from: {}", this.commandlet.getToolBinPath());
this.commandlet.run();
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/ide/IdeToolDummyCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/ide/IdeToolDummyCommandletTest.java
index 582e287919..9478f37ffd 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/ide/IdeToolDummyCommandletTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/ide/IdeToolDummyCommandletTest.java
@@ -13,7 +13,7 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.AbstractIdeTestContext;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeSlf4jContext;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessErrorHandling;
import com.devonfw.tools.ide.process.ProcessMode;
@@ -37,7 +37,7 @@ class IdeToolDummyCommandletTest extends AbstractIdeContextTest {
@Test
void testDummyCommandlet(@TempDir Path tempDir) {
- AbstractIdeTestContext context = new IdeSlf4jContext();
+ AbstractIdeTestContext context = new IdeTestContext();
context.setPluginsPath(tempDir);
context.setIdeHome(tempDir);
context.setSettingsPath(Path.of("src/test/resources/settings/dummy"));
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java
index 1f537a2a9b..8047049eeb 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java
@@ -90,7 +90,7 @@ void testIntellijRun(String os) {
SystemInfo systemInfo = SystemInfoMock.of(os);
this.context.setSystemInfo(systemInfo);
Intellij commandlet = new Intellij(this.context);
- this.context.info("Starting testIntellijRun on {}", os);
+ System.out.println("Starting testIntellijRun on " + os);
// act
commandlet.run();
@@ -121,7 +121,7 @@ void testCheckPluginInstallation() {
// part 2 of test
// arrange
- context.getLogger().getEntries().clear();
+ context.getTestStartContext().getEntries().clear();
// act
commandlet.run();
// assert
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/mvn/MvnRepositoryTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/mvn/MvnRepositoryTest.java
index 4b980e39ce..142617013e 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/mvn/MvnRepositoryTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/mvn/MvnRepositoryTest.java
@@ -13,7 +13,6 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.os.OperatingSystem;
import com.devonfw.tools.ide.os.SystemArchitecture;
import com.devonfw.tools.ide.tool.ToolCommandlet;
@@ -221,7 +220,7 @@ void testGetMetadataWithSnapshot() {
void testResolveSnapshotVersion() {
// arrange
- IdeTestContextMock context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
MvnRepository mvnRepository = context.getMvnRepository();
Document metadata = parseXml(XML_SNAPSNOT_METADATA);
@@ -237,7 +236,7 @@ void testResolveSnapshotVersion() {
void testResolveVersion() {
// arrange
- IdeTestContextMock context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
MvnRepository mvnRepository = context.getMvnRepository();
Document metadata = parseXml(XML_RELEASE_METADATA);
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/pycharm/PycharmTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/pycharm/PycharmTest.java
index 6ea76228b3..b82803d48c 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/pycharm/PycharmTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/pycharm/PycharmTest.java
@@ -88,7 +88,7 @@ void testPycharmRun(String os) {
SystemInfo systemInfo = SystemInfoMock.of(os);
this.context.setSystemInfo(systemInfo);
Pycharm commandlet = new Pycharm(this.context);
- this.context.info("Starting testPycharmRun on {}", os);
+ System.out.println("Starting testPycharmRun on " + os);
// act
commandlet.run();
@@ -119,7 +119,7 @@ void testCheckPluginInstallation() {
// part 2 of test
// arrange
- context.getLogger().getEntries().clear();
+ context.getTestStartContext().getEntries().clear();
// act
commandlet.run();
// assert
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/repository/ToolRepositoryMock.java b/cli/src/test/java/com/devonfw/tools/ide/tool/repository/ToolRepositoryMock.java
index abadfdbca0..06a53d7717 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/repository/ToolRepositoryMock.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/repository/ToolRepositoryMock.java
@@ -13,6 +13,9 @@
import java.util.Set;
import java.util.stream.Stream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.tool.ToolCommandlet;
import com.devonfw.tools.ide.url.model.file.UrlDownloadFile;
@@ -26,6 +29,8 @@
*/
public class ToolRepositoryMock extends DefaultToolRepository {
+ private static final Logger LOG = LoggerFactory.getLogger(ToolRepositoryMock.class);
+
private static final String VERSION_DEFAULT = "default";
/** Variable to be used as base url for WireMock url replacement */
@@ -63,7 +68,7 @@ public Path download(String tool, String edition, VersionIdentifier version, Too
String versionString = version.toString();
Path versionFolder = editionFolder.resolve(versionString);
if (!Files.isDirectory(versionFolder)) {
- this.context.debug("Could not find version {} so using 'default' for {}/{}", version, tool, edition);
+ LOG.debug("Could not find version {} so using 'default' for {}/{}", version, tool, edition);
versionString = VERSION_DEFAULT;
versionFolder = editionFolder.resolve(versionString);
}
@@ -82,7 +87,7 @@ public Path download(String tool, String edition, VersionIdentifier version, Too
Path child = iterator.next();
if (Files.isRegularFile(child) && child.getFileName().startsWith("content.")) {
contentArchive = child;
- this.context.debug("Using compressed archive {} for mock download of {}/{}", child.getFileName(), tool,
+ LOG.debug("Using compressed archive {} for mock download of {}/{}", child.getFileName(), tool,
edition);
} else {
break;
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/spring/SpringTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/spring/SpringTest.java
index cadb6a38de..da24f0048a 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/spring/SpringTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/spring/SpringTest.java
@@ -28,7 +28,6 @@ void testSpringInstall(WireMockRuntimeInfo wireMockRuntimeInfo) {
// arrange
IdeTestContext context = newContext(PROJECT_SPRING, wireMockRuntimeInfo);
Spring commandlet = new Spring(context);
- context.info("Starting testSpringInstall");
// act
commandlet.install();
@@ -48,7 +47,6 @@ void testSpringRun(WireMockRuntimeInfo wireMockRuntimeInfo) {
// arrange
IdeTestContext context = newContext(PROJECT_SPRING, wireMockRuntimeInfo);
Spring commandlet = new Spring(context);
- context.info("Starting testSpringRun");
commandlet.arguments.addValue("foo");
// act
diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java
index 434c4ffe8b..23c2007bc1 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java
@@ -61,7 +61,7 @@ void testCheckPluginInstallation() {
// part 2 of test
// arrange
- context.getLogger().getEntries().clear();
+ context.getTestStartContext().getEntries().clear();
// act
commandlet.run();
// assert
diff --git a/cli/src/test/java/com/devonfw/tools/ide/url/model/AbstractUrlModelTest.java b/cli/src/test/java/com/devonfw/tools/ide/url/model/AbstractUrlModelTest.java
index e6e1d91de8..8e7c180662 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/url/model/AbstractUrlModelTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/url/model/AbstractUrlModelTest.java
@@ -6,7 +6,7 @@
import com.devonfw.tools.ide.context.AbstractIdeTestContext;
import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeSlf4jContext;
+import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.url.model.folder.UrlRepository;
/**
@@ -30,7 +30,7 @@ protected UrlRepository newRepo() {
*/
protected IdeContext newContext() {
- AbstractIdeTestContext context = new IdeSlf4jContext(Path.of(""));
+ AbstractIdeTestContext context = new IdeTestContext();
context.setUrlsPath(URLS_PATH);
return context;
}
diff --git a/cli/src/test/java/com/devonfw/tools/ide/variable/IdeVariablesTest.java b/cli/src/test/java/com/devonfw/tools/ide/variable/IdeVariablesTest.java
index 691553c0e8..b6617caa12 100644
--- a/cli/src/test/java/com/devonfw/tools/ide/variable/IdeVariablesTest.java
+++ b/cli/src/test/java/com/devonfw/tools/ide/variable/IdeVariablesTest.java
@@ -6,8 +6,7 @@
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
-import com.devonfw.tools.ide.context.IdeContext;
-import com.devonfw.tools.ide.context.IdeTestContextMock;
+import com.devonfw.tools.ide.context.IdeTestContext;
/**
* Test of {@link IdeVariables}.
@@ -19,7 +18,7 @@ class IdeVariablesTest extends Assertions {
void testIdeTools() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
// act
List ideTools = IdeVariables.IDE_TOOLS.get(context);
// assert
@@ -31,7 +30,7 @@ void testIdeTools() {
void testHttpProtocols() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
// act
List httpVersionsEmpty = IdeVariables.HTTP_VERSIONS.get(context);
List httpVersions2_11 = IdeVariables.HTTP_VERSIONS.fromString("HTTP_2, http_1_1", context);
@@ -45,7 +44,7 @@ void testHttpProtocols() {
void testIdeToolsWithCommasInBashArray() {
// arrange
- IdeContext context = IdeTestContextMock.get();
+ IdeTestContext context = new IdeTestContext();
// act - using bash array syntax with commas (supported for convenience)
List ideTools = IdeVariables.IDE_TOOLS.fromString("(java, maven, python, node)", context);
// assert - should parse correctly with comma as separator
diff --git a/documentation/variables.adoc b/documentation/variables.adoc
index 14a797fdd4..fde4a03242 100644
--- a/documentation/variables.adoc
+++ b/documentation/variables.adoc
@@ -40,4 +40,5 @@ See also link:https://github.com/devonfw/IDEasy/blob/main/cli/src/main/java/com/
|`HTTP_VERSIONS`|e.g. `HTTP_2, HTTP_1_1`| The optional list of HTTP versions to try in the given order (e.g. "HTTP_2, HTTP_1_1"). This can be used as a workaround for network/VPN related issues - see issue https://github.com/devonfw/IDEasy/issues/1393[#1393].
|`JASYPT_OPTS`|`algorithm=PBEWITHHMACSHA512ANDAES_256 ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator`|Options of jasypt.
|`IDE_XML_MERGE_LEGACY_SUPPORT_ENABLED`|e.g. `false`|Support of legacy xml templates without XML merge namespace.
+|`IDE_WRITE_LOGFILE`|`true`|Automatically write logfiles to `$IDE_ROOT/_ide/logs/YYYY/MM/dd/«project»-ide-«command»-HH-mm-ss.log`. If you are not inside an IDEasy project or your command is not related to a project then `«project»` will be `_ide`. The logfile structure is designed in a way that allows you to quickly find and cleanup based on date but also based on details like the project and sub-command.
|=======================
diff --git a/gui/src/main/java/com/devonfw/ide/gui/MainController.java b/gui/src/main/java/com/devonfw/ide/gui/MainController.java
index 1bb6f0905b..0e64f0a47e 100644
--- a/gui/src/main/java/com/devonfw/ide/gui/MainController.java
+++ b/gui/src/main/java/com/devonfw/ide/gui/MainController.java
@@ -12,7 +12,6 @@
import com.devonfw.tools.ide.context.IdeStartContextImpl;
import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.log.IdeLogListenerBuffer;
-import com.devonfw.tools.ide.log.IdeSubLoggerOut;
import com.devonfw.tools.ide.variable.IdeVariables;
/**
@@ -22,14 +21,19 @@ public class MainController {
@FXML
private ComboBox selectedProject;
+
@FXML
private ComboBox selectedWorkspace;
+
@FXML
private Button androidStudioOpen;
+
@FXML
private Button eclipseOpen;
+
@FXML
private Button intellijOpen;
+
@FXML
private Button vsCodeOpen;
@@ -130,7 +134,7 @@ private void openIDE(String inIde) {
final IdeLogListenerBuffer buffer = new IdeLogListenerBuffer();
IdeLogLevel logLevel = IdeLogLevel.INFO;
- IdeStartContextImpl startContext = new IdeStartContextImpl(logLevel, level -> new IdeSubLoggerOut(level, null, true, logLevel, buffer));
+ IdeStartContextImpl startContext = new IdeStartContextImpl(logLevel, buffer);
IdeGuiContext context = new IdeGuiContext(startContext, Path.of(this.directoryPath).resolve(this.projectValue).resolve(this.workspaceValue));
context.getCommandletManager().getCommandlet(inIde).run();
}
diff --git a/security/src/main/java/com/devonfw/tools/IDEasy/dev/BuildSecurityJsonFiles.java b/security/src/main/java/com/devonfw/tools/IDEasy/dev/BuildSecurityJsonFiles.java
index b1e0ec6a49..33662b1eb4 100644
--- a/security/src/main/java/com/devonfw/tools/IDEasy/dev/BuildSecurityJsonFiles.java
+++ b/security/src/main/java/com/devonfw/tools/IDEasy/dev/BuildSecurityJsonFiles.java
@@ -16,7 +16,6 @@
import org.slf4j.LoggerFactory;
import com.devonfw.tools.ide.context.IdeContextConsole;
-import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.url.model.UrlMetadata;
import com.devonfw.tools.ide.url.model.file.UrlSecurityFile;
import com.devonfw.tools.ide.url.model.file.json.Cve;
@@ -62,7 +61,7 @@ private BuildSecurityJsonFiles(Path urlsPath) {
super();
UrlFinalReport report = new UrlFinalReport();
this.updateManager = new UpdateManager(urlsPath, report, Instant.now());
- IdeContextConsole context = new IdeContextConsole(IdeLogLevel.INFO, null, false);
+ IdeContextConsole context = new IdeContextConsole();
this.urlMetadata = new UrlMetadata(context, this.updateManager.getUrlRepository());
Settings settings = new Settings();
engine = new Engine(settings);
diff --git a/url-updater/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider b/url-updater/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
new file mode 100644
index 0000000000..0bb90a9c2b
--- /dev/null
+++ b/url-updater/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
@@ -0,0 +1 @@
+ch.qos.logback.classic.spi.LogbackServiceProvider
diff --git a/url-updater/src/test/java/com/devonfw/tools/ide/url/updater/UrlUpdaterTest.java b/url-updater/src/test/java/com/devonfw/tools/ide/url/updater/UrlUpdaterTest.java
index 2f414ff38b..602367858e 100644
--- a/url-updater/src/test/java/com/devonfw/tools/ide/url/updater/UrlUpdaterTest.java
+++ b/url-updater/src/test/java/com/devonfw/tools/ide/url/updater/UrlUpdaterTest.java
@@ -39,7 +39,7 @@ class UrlUpdaterTest extends AbstractUrlUpdaterTest {
private final static String TEST_DATA_ROOT = "src/test/resources/integrationtest/UrlUpdaterTest";
/**
- * Tests if the {@link com.devonfw.tools.ide.url.updater.UrlUpdater} can automatically add a missing OS (in this case the linux_x64)
+ * Tests if the {@link UrlUpdater} can automatically add a missing OS (in this case the linux_x64)
*
* @param tempDir Temporary directory
* @param wmRuntimeInfo wireMock server on a random port
@@ -251,7 +251,7 @@ void testVersionRemovedIfErrorPersists(@TempDir Path tempDir, WireMockRuntimeInf
}
/**
- * Tests if the {@link com.devonfw.tools.ide.url.updater.UrlUpdater} will fail resolving a server with a Content-Type:text header response.
+ * Tests if the {@link UrlUpdater} will fail resolving a server with a Content-Type:text header response.
*
* See: #1343 for reference.
*
@@ -278,7 +278,7 @@ void testUrlUpdaterWithTextContentTypeWillNotCreateStatusJson(@TempDir Path temp
}
/**
- * Tests if the {@link com.devonfw.tools.ide.url.updater.UrlUpdater} will handle the literally latest version of a tool correctly
+ * Tests if the {@link UrlUpdater} will handle the literally latest version of a tool correctly
*
* @param tempDir Temporary directory
* @param wmRuntimeInfo wireMock server on a random port