ramu11 commented on code in PR #30345:
URL: https://github.com/apache/camel/pull/30345#discussion_r4623653302


##########
catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java:
##########
@@ -2269,6 +2269,66 @@ public void chaosModel() {
         Assertions.assertFalse(chaos.getCollection("recipes").isEmpty());
     }
 
+    @Test
+    public void patternRecipesResource() throws Exception {
+        String json;
+        try (InputStream is = catalog.loadResource("patterns", 
"recipes.json")) {
+            assertNotNull(is);
+            json = loadText(is);
+        }
+
+        JsonObject patternRecipes = JsonMapper.deserialize(json);
+        assertNotNull(patternRecipes);
+        assertEquals("1", String.valueOf(patternRecipes.get("schemaVersion")));
+        assertNotNull(patternRecipes.getString("description"));
+
+        java.util.Collection<?> recipes = 
patternRecipes.getCollection("recipes");

Review Comment:
   Addressed in the new commit



##########
catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java:
##########
@@ -2269,6 +2269,66 @@ public void chaosModel() {
         Assertions.assertFalse(chaos.getCollection("recipes").isEmpty());
     }
 
+    @Test
+    public void patternRecipesResource() throws Exception {
+        String json;
+        try (InputStream is = catalog.loadResource("patterns", 
"recipes.json")) {
+            assertNotNull(is);
+            json = loadText(is);
+        }
+
+        JsonObject patternRecipes = JsonMapper.deserialize(json);
+        assertNotNull(patternRecipes);
+        assertEquals("1", String.valueOf(patternRecipes.get("schemaVersion")));
+        assertNotNull(patternRecipes.getString("description"));
+
+        java.util.Collection<?> recipes = 
patternRecipes.getCollection("recipes");
+        assertNotNull(recipes);
+        assertEquals(10, recipes.size());
+
+        java.util.Set<String> ids = new java.util.HashSet<>();
+
+        for (Object value : recipes) {
+            assertTrue(value instanceof JsonObject, "Each recipe must be a 
JSON object");
+
+            JsonObject recipe = (JsonObject) value;
+            String id = recipe.getString("id");
+
+            assertNotNull(id, "Each recipe must have an id");
+            assertTrue(ids.add(id), "Duplicate recipe id: " + id);
+            assertNotNull(recipe.getString("name"), id + " needs a name");
+            assertNotNull(recipe.getString("problem"), id + " needs a problem 
statement");
+
+            assertNotNull(recipe.getCollection("components"), id + " needs 
components");
+            assertNotNull(recipe.getCollection("eips"), id + " needs EIPs");
+            assertNotNull(recipe.getCollection("recommendedOptions"), id + " 
needs recommendedOptions");
+            assertNotNull(recipe.getCollection("pitfalls"), id + " needs 
pitfalls");
+            assertNotNull(recipe.getCollection("examples"), id + " needs 
examples");
+
+            JsonObject route = recipe.getJsonObject("exampleRoute");
+            assertNotNull(route, id + " needs exampleRoute");
+            assertEquals("yaml", route.getString("dsl"), id + " must use YAML 
DSL");
+
+            String source = route.getString("source");
+            assertNotNull(source, id + " needs YAML source");
+            assertTrue(!source.isBlank(), id + " YAML source must not be 
empty");

Review Comment:
   Addressed in the new commit



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to