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

Add a method to Kamelet catalog to print all the dependencies for eac… #551

Merged
merged 1 commit into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

import com.fasterxml.jackson.databind.DeserializationFeature;
Expand Down Expand Up @@ -159,6 +160,20 @@ public List<String> getKameletDependencies(String name) {
}
}

public void getAllKameletDependencies() {
Map<String, Kamelet> treeMap = new TreeMap<>(kameletModels);
for (Map.Entry<String, Kamelet> entry: treeMap.entrySet()) {
StringBuilder builder = new StringBuilder();
for (String dep: entry.getValue().getSpec().getDependencies()) {
builder.append(dep + System.lineSeparator());
}
System.out.println(entry.getKey());
System.out.println("---------------------------------------------------------------------------------------------------");
System.out.println(builder.toString());
builder.append(System.lineSeparator());
}
}

public JsonNode getKameletFlow(String name) {
Kamelet kamelet = kameletModels.get(name);
if (kamelet != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,8 @@ void testAllKameletFilesLoaded() throws Exception {
assertEquals(numberOfKameletFiles, catalog.getKameletsName().size(), "Some embedded kamelet definition files cannot be loaded.");
}

@Test
void testAllKameletDependencies() throws Exception {
catalog.getAllKameletDependencies();
}
}