Skip to content
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

#898: Improved output of get-version/edition and uninstall/-plugin #903

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

WorkingAmeise
Copy link
Contributor

Closes: #898
Edition/VersionGetCommandlet changed them to log the configured option if the tool is not installed and the installed option if it is installed.
Changed the toolInstallInfo method to log into IdeSublogger instead of using context.info or context.warning.
Changed the uninstall commandlet to log a warning in case the requested commandlet is not installed.
Changed the uninstallPlugin commandlet to give feedback wether the plugin could be deleted or if there was not installation found.
Adjusted Tests for Edition/VersionGetCommandlet as well as Uninstall commandlet to expect the correct loglevel or content of logged messages.
Added logAtProccessable to IdeTestContextAssertions to check if a log-message was logged on PROCESSABLE-level.
Added .ide.software.version file to the npm software in the basic ide-test-project-ressource, since it was needed to test my implementation.

WorkingAmeise added 2 commits December 19, 2024 12:57
Edition/VersionGetCommandlet changed them to log the configured option if the tool is not installed and the installed option if it is installed.
Changed the toolInstallInfo method to log into IdeSublogger instead of using context.info or context.warning.
Changed the uninstall commandlet to log a warning in case the requested commandlet is not installed.
Changed the uninstallPlugin commandlet to give feedback wether the plugin could be deleted or if there was not installation found.
Adjusted Tests for Edition/VersionGetCommandlet as well as Uninstall commandlet to expect the correct loglevel or content of logged messages.
Added logAtProccessable to IdeTestContextAssertions to check if a log-message was logged on PROCESSABLE-level.
Added .ide.software.version file to the npm software in the basic ide-test-project-ressource, since it was needed to test my implementation.
added CHANGELOG entry
@WorkingAmeise WorkingAmeise self-assigned this Dec 19, 2024
@coveralls
Copy link
Collaborator

coveralls commented Dec 19, 2024

Pull Request Test Coverage Report for Build 12435451937

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 24 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.1%) to 67.345%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/tool/LocalToolCommandlet.java 1 85.19%
com/devonfw/tools/ide/commandlet/UninstallPluginCommandlet.java 4 31.58%
com/devonfw/tools/ide/commandlet/VersionGetCommandlet.java 6 70.69%
com/devonfw/tools/ide/commandlet/EditionGetCommandlet.java 6 70.69%
com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java 7 70.37%
Totals Coverage Status
Change from base Build 12430022855: -0.1%
Covered Lines: 6659
Relevant Lines: 9539

💛 - Coveralls

@WorkingAmeise WorkingAmeise added the enhancement New feature or request label Dec 19, 2024
@hohwille hohwille added this to the release:2025.01.001 milestone Dec 20, 2024
@hohwille hohwille self-assigned this Dec 20, 2024
@hohwille
Copy link
Member

@jan-vcapgemini please have a look.
I reworked this PR and consider it as ready for review.
FYI: I also did some improvements and fixes of existing code that before was not part of this PR (e.g. LocalToolCommandlet.getInstalledEdition()).

@hohwille
Copy link
Member

hohwille commented Jan 7, 2025

[ERROR]   EditionGetCommandletTest.testEditionGetCommandletInstalledEditionToolNotInstalled:90 
The first entry that was not matching from a block of 4 expected log-entries was:
PROCESSABLE:No installation of tool java was found.

In the logs of this test:
...
WARNING:Tool java is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.
...
PROCESSABLE:java

So if I get this correct, the test was expecting the message No installation of tool java was found. but this PR is changing the behaviour to print the configured edition if no installed edition could be found and no --configured or --installed option is specified.
Therefore the test(s) have to be adjusted.

@hohwille hohwille changed the title #898 improved feedback messages #898: Improved output of get-version/edition and uninstall/-plugin Jan 7, 2025
Comment on lines +134 to +136
* @return 0 if the uninstallation was successfull and 1 if it failed
*/
public void uninstallPlugin(ToolPluginDescriptor plugin) {
public int uninstallPlugin(ToolPluginDescriptor plugin) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean success flag instead of int?
Or throw an exception in case of failure/error?
Or do the logging in this method and keep void return type?
IMHO the last option makes to most sense.

Comment on lines +90 to +93
assertThat(context).log().hasEntries(IdeLogEntry.ofProcessable("No installation of tool java was found."),
IdeLogEntry.ofProcessable("The configured edition for tool java is java"),
IdeLogEntry.ofProcessable("To install that edition call the following command:"),
IdeLogEntry.ofProcessable("ide install java"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment about the failing test...

Suggested change
assertThat(context).log().hasEntries(IdeLogEntry.ofProcessable("No installation of tool java was found."),
IdeLogEntry.ofProcessable("The configured edition for tool java is java"),
IdeLogEntry.ofProcessable("To install that edition call the following command:"),
IdeLogEntry.ofProcessable("ide install java"));
assertThat(context).log().hasEntries(IdeLogEntry.ofProcessable("java"));

IdeLogEntry.ofInfo("The configured edition for tool az is az"),
IdeLogEntry.ofInfo("To install that edition call the following command:"),
IdeLogEntry.ofInfo("ide install az"));
assertThat(context).logAtProcessable().hasMessage("az");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it seems vice versa. The output in the test was like this:

14:20:56.527 [main] - INFO  - c.d.tools.ide.log.IdeSubLoggerSlf4j - PROCESSABLE:No installation of tool az was found.
14:20:56.527 [main] - INFO  - c.d.tools.ide.log.IdeSubLoggerSlf4j - PROCESSABLE:The configured edition for tool az is az
14:20:56.527 [main] - INFO  - c.d.tools.ide.log.IdeSubLoggerSlf4j - PROCESSABLE:To install that edition call the following command:
14:20:56.527 [main] - INFO  - c.d.tools.ide.log.IdeSubLoggerSlf4j - PROCESSABLE:ide install az

So IMHO something is still broken with the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Improved output of get-version/edition and uninstall/-plugin
4 participants