Skip to content

Commit

Permalink
devonfw#103: implemented requested changes
Browse files Browse the repository at this point in the history
renamed retrievePath to getPath
renamed addPath to setPath
  • Loading branch information
jan-vcapgemini committed Feb 23, 2024
1 parent 097bbdc commit a7d686c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public SystemPath(String envPath, Path softwarePath, char pathSeparator, IdeCont
} else {
Path duplicate = this.tool2pathMap.putIfAbsent(tool, path);
if (duplicate != null) {
context.warning("Duplicated tool path for tool: {} at path: {} with duplicated path: {}.", tool, path, duplicate);
context.warning("Duplicated tool path for tool: {} at path: {} with duplicated path: {}.", tool, path,
duplicate);
}
}
}
Expand Down Expand Up @@ -160,16 +161,16 @@ public Path findBinary(Path toolPath) {
* @return the {@link Path} to the directory of the tool where the binaries can be found or {@code null} if the tool
* is not installed.
*/
public Path retrievePath(String tool) {
public Path getPath(String tool) {

return this.tool2pathMap.get(tool);
}

/**
* @param tool the name of the tool.
* @param path the new {@link #retrievePath(String) tool bin path}.
* @param path the new {@link #getPath(String) tool bin path}.
*/
public void addPath(String tool, Path path) {
public void setPath(String tool, Path path) {

this.tool2pathMap.put(tool, path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected boolean doInstall(boolean silent) {
fileAccess.backup(toolPath);
}
fileAccess.symlink(installation.linkDir(), toolPath);
this.context.getPath().addPath(this.tool, installation.binDir());
this.context.getPath().setPath(this.tool, installation.binDir());
if (installedVersion == null) {
this.context.success("Successfully installed {} in version {}", this.tool, resolvedVersion);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public void testBasicProjectEnvironment() {
assertThat(systemPath.toString()).isNotEqualTo(envPath).endsWith(envPath);
Path softwarePath = context.getSoftwarePath();
Path javaBin = softwarePath.resolve("java/bin");
assertThat(systemPath.retrievePath("java")).isEqualTo(javaBin);
assertThat(systemPath.getPath("java")).isEqualTo(javaBin);
Path mvnBin = softwarePath.resolve("mvn/bin");
assertThat(systemPath.retrievePath("mvn")).isEqualTo(mvnBin);
assertThat(systemPath.getPath("mvn")).isEqualTo(mvnBin);
assertThat(systemPath.toString()).contains(javaBin.toString(), mvnBin.toString());
assertThat(variables.getType()).isSameAs(EnvironmentVariablesType.RESOLVED);
assertThat(variables.getByType(EnvironmentVariablesType.RESOLVED)).isSameAs(variables);
Expand Down

0 comments on commit a7d686c

Please sign in to comment.