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

channel list output is confusing #755 #777

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

parsharma
Copy link
Contributor

Issue: #755

if (fullList) {
console.println(ChannelMapper.toYaml(channels));
} else {
console.println(channel.getName() + " " + channel.getManifestCoordinate().getGroupId() + ":" + channel.getManifestCoordinate().getArtifactId() + ":" +
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to handle following cases:

  1. Manifest coordinate is a Maven coordinate with full GAV
  2. Manifest coordinate is a Maven coordinate with just GA
  3. Manifest coordinate is an URL
  4. There is no manifest coordinate at all (we should print the value no-stream-strategy and ids of the repositories in this case)

@@ -53,6 +53,9 @@ public static class ChannelListCommand extends AbstractCommand {
@CommandLine.Option(names = CliConstants.DIR)
Optional<Path> directory;

@CommandLine.Option(names = CliConstants.FULL)
Copy link
Collaborator

Choose a reason for hiding this comment

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

New options need to be described in the UsageMessages.properties

@@ -191,7 +191,33 @@ public void testList() {
int exitCode = commandLine.execute(CliConstants.Commands.CHANNEL, CliConstants.Commands.LIST,
CliConstants.DIR, dir.toString());
Assert.assertEquals(ReturnCodes.SUCCESS, exitCode);
Assert.assertEquals(3, getStandardOutput().lines().filter(l->l.contains("manifest")).count());
Assert.assertEquals(3, getStandardOutput().lines()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use Assertions.assertThat and compare it to actual expected lines ("test1 g:a", "test2 g:a:v", "test3 file:/a:b")

CliConstants.DIR, dir.toString());
Assert.assertEquals(ReturnCodes.SUCCESS, exitCode);
String output = getStandardOutput();
Assert.assertTrue("Expected 'schemaVersion' in the output",
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test doesn't actually verify that the correct values are printed. You should be able to get the output, convert it back to Channel objects and compare with the input.
Or simply compare the output with serialized input.

@parsharma
Copy link
Contributor Author

@spyrkob, I have updated the code according to the review comments. Please have a look and let me know if more changes are needed.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants