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 2014/12/12 12:12:02 UTC

[2/2] camel git commit: CAMEL-8044: Camel commands useable for remote JVMs using jolokia

CAMEL-8044: Camel commands useable for remote JVMs using jolokia


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/09493697
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/09493697
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/09493697

Branch: refs/heads/master
Commit: 094936976c7383f68bdae0ba194d69313ae192fe
Parents: 353c6af
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Dec 12 11:33:59 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Dec 12 11:43:50 2014 +0100

----------------------------------------------------------------------
 .../jolokia/JolokiaCamelController.java         |  3 +-
 .../commands/jolokia/NoopStringEscape.java      | 37 +++++++++++++++
 .../commands/jolokia/JolokiaCommandsTest.java   | 50 ++++++++++++++++++++
 3 files changed, 88 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/09493697/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/JolokiaCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/JolokiaCamelController.java b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/JolokiaCamelController.java
index 3e7b251..43dc921 100644
--- a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/JolokiaCamelController.java
+++ b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/JolokiaCamelController.java
@@ -499,8 +499,7 @@ public class JolokiaCamelController extends AbstractCamelController implements R
             if (response != null) {
                 JSONObject data = response.getValue();
                 for (Object obj : data.values()) {
-                    JSONObject data2 = (JSONObject) obj;
-                    JSONObject component = (JSONObject) data2.values().iterator().next();
+                    JSONObject component = (JSONObject) obj;
 
                     Map<String, String> row = new LinkedHashMap<String, String>();
                     row.put("artifactId", asString(component.get("artifactId")));

http://git-wip-us.apache.org/repos/asf/camel/blob/09493697/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/NoopStringEscape.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/NoopStringEscape.java b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/NoopStringEscape.java
new file mode 100644
index 0000000..d1cdd39
--- /dev/null
+++ b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/NoopStringEscape.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.commands.jolokia;
+
+import org.apache.camel.commands.StringEscape;
+
+public class NoopStringEscape implements StringEscape {
+
+    @Override
+    public String unescapeJava(String s) {
+        return s;
+    }
+
+    @Override
+    public String escapeJava(String s) {
+        return s;
+    }
+
+    @Override
+    public String hex(char c) {
+        return Character.toString(c);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/09493697/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaCommandsTest.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaCommandsTest.java b/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaCommandsTest.java
new file mode 100644
index 0000000..e5f9fb1
--- /dev/null
+++ b/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaCommandsTest.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.commands.jolokia;
+
+import org.apache.camel.commands.ContextInfoCommand;
+import org.apache.camel.commands.ContextListCommand;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("used for manual testing")
+public class JolokiaCommandsTest {
+
+    private String url = "http://localhost:8080/jolokia";
+
+    private RemoteCamelController controller;
+
+    @Test
+    public void testContextList() throws Exception {
+        controller = new JolokiaCamelController();
+        controller.connect(url, null, null);
+
+        ContextListCommand cmd = new ContextListCommand();
+        cmd.execute(controller, System.out, System.err);
+    }
+
+    @Test
+    public void testContextInfo() throws Exception {
+        controller = new JolokiaCamelController();
+        controller.connect(url, null, null);
+
+        ContextInfoCommand cmd = new ContextInfoCommand("myCamel", true);
+        cmd.setStringEscape(new NoopStringEscape());
+        cmd.execute(controller, System.out, System.err);
+    }
+
+}