-
Notifications
You must be signed in to change notification settings - Fork 55
#809: Enhance uninstall with --force to remove from the software repo #1242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hohwille
merged 22 commits into
devonfw:main
from
juliane-cap:809-uninstall-force-remove-from-repo
May 20, 2025
Merged
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1413928
#809: Enhance uninstall with --force to remove a tool from the softwa…
juliane-cap 9664ef1
adjust exceptions to coding conventions
juliane-cap 30344ec
Add Test for force uninstall
juliane-cap e837029
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 9847de3
Merge branch 'main' into 809-uninstall-force-remove-from-repo
jan-vcapgemini ee84131
Refactor minor path details
juliane-cap 253f486
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 64d1c71
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 5ef1a3f
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 0125011
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 62ff9fe
add custom macOS workaround
juliane-cap d3d39f7
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 19c6d04
Take special cases into account
juliane-cap 0c9ce4c
Fix logs causing errors
juliane-cap c655dc2
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 6b92bbe
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 069bc09
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 0acc93c
Merge branch 'main' into 809-uninstall-force-remove-from-repo
juliane-cap 85c5786
Simplified changes by moving methods to implementation class
juliane-cap 6e08263
Add JUnit Test for LocalToolCommandlet Method
juliane-cap c264ec0
Merge branch 'main' into 809-uninstall-force-remove-from-repo
hohwille f87f955
Update cli/src/test/java/com/devonfw/tools/ide/commandlet/UninstallCo…
hohwille File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
cli/src/test/java/com/devonfw/tools/ide/tool/LocalToolCommandletTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| package com.devonfw.tools.ide.tool; | ||
|
|
||
| import java.nio.file.Path; | ||
| import java.util.Set; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import com.devonfw.tools.ide.common.Tag; | ||
| 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.log.IdeLogEntry; | ||
|
|
||
| /** | ||
| * Test of {@link LocalToolCommandlet}. | ||
| */ | ||
| public class LocalToolCommandletTest extends AbstractIdeContextTest { | ||
|
|
||
| /** | ||
| * Dummy commandlet extending {@link LocalToolCommandlet} for testing. | ||
| */ | ||
| public static class LocalToolDummyCommandlet extends LocalToolCommandlet { | ||
|
|
||
| LocalToolDummyCommandlet(IdeContext context) { | ||
|
|
||
| super(context, "dummy", Set.of(Tag.TEST)); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test {@link LocalToolCommandlet#getValidInstalledSoftwareRepoPath(Path, Path)} with a long installation path, as commonly encountered on macOS systems. | ||
| */ | ||
| @Test | ||
| public void testGetValidInstalledSoftwareRepoPathWithLongPath() { | ||
| // arrange | ||
| Path installPath = Path.of("/projects/_ide/software/default/java/java/21.0.7_6/Contents/Resources/app/"); | ||
| Path softwareRepoPath = Path.of("/projects/_ide/software/"); | ||
| Path expectedResultPath = Path.of("/projects/_ide/software/default/java/java/21.0.7_6/"); | ||
| IdeTestContext context = newContext(PROJECT_BASIC); | ||
| LocalToolDummyCommandlet localToolCommandlet = new LocalToolDummyCommandlet(context); | ||
|
|
||
| // act | ||
| Path resultPath = localToolCommandlet.getValidInstalledSoftwareRepoPath(installPath, softwareRepoPath); | ||
|
|
||
| // assert | ||
| assertThat(resultPath).isEqualTo(expectedResultPath); | ||
| } | ||
|
|
||
| /** | ||
| * Test {@link LocalToolCommandlet#getValidInstalledSoftwareRepoPath(Path, Path)} with a valid installation path. | ||
| */ | ||
| @Test | ||
| public void testGetValidInstalledSoftwareRepoPathWithValidPath() { | ||
| // arrange | ||
| Path installPath = Path.of("/projects/_ide/software/default/java/java/21.0.7_6/"); | ||
| Path softwareRepoPath = Path.of("/projects/_ide/software/"); | ||
| IdeTestContext context = newContext(PROJECT_BASIC); | ||
| LocalToolDummyCommandlet localToolCommandlet = new LocalToolDummyCommandlet(context); | ||
|
|
||
| // act | ||
| Path resultPath = localToolCommandlet.getValidInstalledSoftwareRepoPath(installPath, softwareRepoPath); | ||
|
|
||
| // assert | ||
| assertThat(resultPath).isEqualTo(installPath); | ||
| } | ||
|
|
||
| /** | ||
| * Test {@link LocalToolCommandlet#getValidInstalledSoftwareRepoPath(Path, Path)} with an installation path that is too short. | ||
| */ | ||
| @Test | ||
| public void testGetValidInstalledSoftwareRepoPathWithShortPath() { | ||
| // arrange | ||
| Path installPath = Path.of("/projects/_ide/software/default/java/java/"); | ||
| Path softwareRepoPath = Path.of("/projects/_ide/software/"); | ||
| IdeTestContext context = newContext(PROJECT_BASIC); | ||
| LocalToolDummyCommandlet localToolCommandlet = new LocalToolDummyCommandlet(context); | ||
|
|
||
| // act | ||
| Path resultPath = localToolCommandlet.getValidInstalledSoftwareRepoPath(installPath, softwareRepoPath); | ||
|
|
||
| // assert | ||
| assertThat(resultPath).isNull(); | ||
| assertThat(context).log().hasEntries(IdeLogEntry.ofWarning("The installation path is faulty " + installPath + ".")); | ||
| } | ||
|
|
||
| /** | ||
| * Test {@link LocalToolCommandlet#getValidInstalledSoftwareRepoPath(Path, Path)} with an installation path that completely differs from the software | ||
| * repository path. | ||
| */ | ||
| @Test | ||
| public void testGetValidInstalledSoftwareRepoPathWithWrongPath() { | ||
| // arrange | ||
| Path installPath = Path.of("/projects/IDEasy/workspaces/main/IDEasy/software/java/"); | ||
| Path softwareRepoPath = Path.of("/projects/_ide/software/"); | ||
| IdeTestContext context = newContext(PROJECT_BASIC); | ||
| LocalToolDummyCommandlet localToolCommandlet = new LocalToolDummyCommandlet(context); | ||
|
|
||
| // act | ||
| Path resultPath = localToolCommandlet.getValidInstalledSoftwareRepoPath(installPath, softwareRepoPath); | ||
|
|
||
| // assert | ||
| assertThat(resultPath).isNull(); | ||
| assertThat(context).log().hasEntries(IdeLogEntry.ofWarning("The installation path is not located within the software repository " + installPath + ".")); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.