Repository: camel Updated Branches: refs/heads/master e96fe7f80 -> de4f1cb9c
Camel catalog - Add api to get list of all the other stuff in json Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/de4f1cb9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/de4f1cb9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/de4f1cb9 Branch: refs/heads/master Commit: de4f1cb9c2837e44bcd3e2aa5cb54d54033c9984 Parents: e96fe7f Author: Claus Ibsen <davscl...@apache.org> Authored: Sun Oct 18 12:50:47 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Oct 18 12:52:00 2015 +0200 ---------------------------------------------------------------------- .../camel/catalog/DefaultCamelCatalog.java | 8 +++---- .../apache/camel/catalog/CamelCatalogTest.java | 23 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/de4f1cb9/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java ---------------------------------------------------------------------- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index 121afb8..e91b170 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -741,7 +741,7 @@ public class DefaultCamelCatalog implements CamelCatalog { String scheme = names.get(i); String json = componentJSonSchema(scheme); // skip first line - json = CatalogHelper.between(json, "\"component\": {", "\"componentProperties\""); + json = CatalogHelper.between(json, "\"component\": {", "\"componentProperties\": {"); json = json.trim(); // skip last comma if not the last if (i == names.size() - 1) { @@ -766,7 +766,7 @@ public class DefaultCamelCatalog implements CamelCatalog { String scheme = names.get(i); String json = dataFormatJSonSchema(scheme); // skip first line - json = CatalogHelper.between(json, "\"dataformat\": {", "\"properties\""); + json = CatalogHelper.between(json, "\"dataformat\": {", "\"properties\": {"); json = json.trim(); // skip last comma if not the last if (i == names.size() - 1) { @@ -791,7 +791,7 @@ public class DefaultCamelCatalog implements CamelCatalog { String scheme = names.get(i); String json = languageJSonSchema(scheme); // skip first line - json = CatalogHelper.between(json, "\"language\": {", "\"properties\""); + json = CatalogHelper.between(json, "\"language\": {", "\"properties\": {"); json = json.trim(); // skip last comma if not the last if (i == names.size() - 1) { @@ -816,7 +816,7 @@ public class DefaultCamelCatalog implements CamelCatalog { String scheme = names.get(i); String json = modelJSonSchema(scheme); // skip first line - json = CatalogHelper.between(json, "\"model\": {", "\"properties\""); + json = CatalogHelper.between(json, "\"model\": {", "\"properties\": {"); json = json.trim(); // skip last comma if not the last if (i == names.size() - 1) { http://git-wip-us.apache.org/repos/asf/camel/blob/de4f1cb9/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java ---------------------------------------------------------------------- diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java index 811d9a6..899e295 100644 --- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java +++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java @@ -20,10 +20,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import junit.framework.TestCase; import org.junit.Test; import static org.apache.camel.catalog.CatalogHelper.loadText; +import static org.junit.Assert.assertNotNull; public class CamelCatalogTest extends TestCase { @@ -242,24 +245,44 @@ public class CamelCatalogTest extends TestCase { public void testListComponentsAsJson() throws Exception { String json = catalog.listComponentsAsJson(); assertNotNull(json); + + // validate we can parse the json + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(json); + assertNotNull(tree); } @Test public void testListDataFormatsAsJson() throws Exception { String json = catalog.listDataFormatsAsJson(); assertNotNull(json); + + // validate we can parse the json + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(json); + assertNotNull(tree); } @Test public void testListLanguagesAsJson() throws Exception { String json = catalog.listLanguagesAsJson(); assertNotNull(json); + + // validate we can parse the json + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(json); + assertNotNull(tree); } @Test public void testListModelsAsJson() throws Exception { String json = catalog.listModelsAsJson(); assertNotNull(json); + + // validate we can parse the json + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(json); + assertNotNull(tree); } }