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

Merged
merged 1 commit into from
Oct 23, 2024
Merged

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)

@@ -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

}
} else {
// No manifest coordinate, print no-stream-strategy and repository ids
console.println(channel.getName() + " no-stream-strategy: " + channel.getNoStreamStrategy());
Copy link
Collaborator

Choose a reason for hiding this comment

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

just one thing - can you inline this to something like <channel_name> <no_manifest_strategy> @ <repo1_id>,<repo2_id>[...]. All other cases are one line, we should keep this the same

Copy link
Collaborator

@spyrkob spyrkob left a comment

Choose a reason for hiding this comment

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

Thanks @parsharma

@spyrkob spyrkob merged commit be8aea9 into wildfly-extras:main Oct 23, 2024
7 checks passed
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