You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/10/18 13:08:00 UTC
[5/5] camel git commit: Camel catalog - Add api to get list of all
the other stuff in json
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/e10513eb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e10513eb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e10513eb
Branch: refs/heads/camel-2.16.x
Commit: e10513eb7981a91dd0fc9726765d3725c5578575
Parents: 887e12b
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Oct 18 12:50:47 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Oct 18 13:10:22 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/e10513eb/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/e10513eb/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);
}
}