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/10 18:07:03 UTC

[1/4] camel git commit: CAMEL-8044: Camel commands should be more reusable for remote JVMs

Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x fa6db18be -> 5854ae018
  refs/heads/camel-2.14.x 8b1aee1f4 -> b1fd76db9
  refs/heads/master 28165b61b -> d86c5c427


CAMEL-8044: Camel commands should be more reusable for remote JVMs


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

Branch: refs/heads/master
Commit: 25fa34d1d50d7c15ce9dcae3f140c974d96d1617
Parents: 28165b6
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 10 17:53:21 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 17:54:41 2014 +0100

----------------------------------------------------------------------
 .../camel/commands/AbstractCamelController.java |  38 +++---
 .../apache/camel/commands/CamelController.java  |   8 +-
 .../camel/commands/EndpointExplainCommand.java  |   2 +-
 .../camel/commands/EndpointListCommand.java     |   2 +-
 .../camel/commands/RestRegistryListCommand.java | 119 ++++++++-----------
 5 files changed, 75 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/25fa34d1/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
index 7cec798..96868e5 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
@@ -241,8 +241,8 @@ public abstract class AbstractCamelController implements CamelController {
         return answer;
     }
 
-    public Map<String, List<RestRegistry.RestService>> getRestServices(String camelContextName) {
-        Map<String, List<RestRegistry.RestService>> answer = new LinkedHashMap<String, List<RestRegistry.RestService>>();
+    public List<Map<String, String>> getRestServices(String camelContextName) {
+        List<Map<String, String>> answer = new ArrayList<Map<String, String>>();
 
         if (camelContextName != null) {
             CamelContext context = this.getCamelContext(camelContextName);
@@ -254,30 +254,28 @@ public abstract class AbstractCamelController implements CamelController {
                         return o1.getUrl().compareTo(o2.getUrl());
                     }
                 });
-                if (!services.isEmpty()) {
-                    answer.put(camelContextName, services);
-                }
-            }
-        } else {
-            // already sorted by camel context
-            List<CamelContext> camelContexts = this.getCamelContexts();
-            for (CamelContext camelContext : camelContexts) {
-                List<RestRegistry.RestService> services = new ArrayList<RestRegistry.RestService>(camelContext.getRestRegistry().listAllRestServices());
-                Collections.sort(services, new Comparator<RestRegistry.RestService>() {
-                    @Override
-                    public int compare(RestRegistry.RestService o1, RestRegistry.RestService o2) {
-                        return o1.getUrl().compareTo(o2.getUrl());
-                    }
-                });
-                if (!services.isEmpty()) {
-                    answer.put(camelContext.getName(), services);
+                for (RestRegistry.RestService service : services) {
+                    Map<String, String> row = new LinkedHashMap<String, String>();
+                    row.put("basePath", service.getBasePath());
+                    row.put("baseUrl", service.getBaseUrl());
+                    row.put("consumes", service.getConsumes());
+                    row.put("description", service.getDescription());
+                    row.put("inType", service.getInType());
+                    row.put("method", service.getMethod());
+                    row.put("outType", service.getOutType());
+                    row.put("produces", service.getProduces());
+                    row.put("routeId", service.getRouteId());
+                    row.put("state", service.getState());
+                    row.put("uriTemplate", service.getUriTemplate());
+                    row.put("url", service.getUrl());
+                    answer.add(row);
                 }
             }
         }
         return answer;
     }
 
-    public String explainEndpoint(String camelContextName, String uri, boolean allOptions) throws Exception {
+    public String explainEndpointAsJSon(String camelContextName, String uri, boolean allOptions) throws Exception {
         CamelContext context = this.getCamelContext(camelContextName);
         if (context == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/camel/blob/25fa34d1/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
index 1f3759e..881361d 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
@@ -106,12 +106,12 @@ public interface CamelController {
     String getRestModelAsXml(String camelContextName);
 
     /**
-     * Return the REST services
+     * Return the REST services for the given Camel context.
      *
      * @param camelContextName the Camel context.
-     * @return the REST services
+     * @return a list of key/value pairs with REST information
      */
-    Map<String, List<RestRegistry.RestService>> getRestServices(String camelContextName);
+    List<Map<String, String>> getRestServices(String camelContextName);
 
     /**
      * Explains an endpoint uri
@@ -122,7 +122,7 @@ public interface CamelController {
      * @return a JSON schema with explanation of the options
      * @throws java.lang.Exception is thrown if error loading resources to explain the endpoint
      */
-    String explainEndpoint(String camelContextName, String uri, boolean allOptions) throws Exception;
+    String explainEndpointAsJSon(String camelContextName, String uri, boolean allOptions) throws Exception;
 
     /**
      * Lists Components which are in use or available on the classpath and include information

http://git-wip-us.apache.org/repos/asf/camel/blob/25fa34d1/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointExplainCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointExplainCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointExplainCommand.java
index e4ba510..cb65cce 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointExplainCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointExplainCommand.java
@@ -63,7 +63,7 @@ public class EndpointExplainCommand extends AbstractCamelCommand {
         }
 
         for (Endpoint endpoint : endpoints) {
-            String json = camelController.explainEndpoint(endpoint.getCamelContext().getName(), endpoint.getEndpointUri(), verbose);
+            String json = camelController.explainEndpointAsJSon(endpoint.getCamelContext().getName(), endpoint.getEndpointUri(), verbose);
 
             out.println("Context:\t" + endpoint.getCamelContext().getName());
 

http://git-wip-us.apache.org/repos/asf/camel/blob/25fa34d1/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointListCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointListCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointListCommand.java
index badd136..e68cae6 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointListCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/EndpointListCommand.java
@@ -87,7 +87,7 @@ public class EndpointListCommand extends AbstractCamelCommand {
 
                 if (explain) {
                     boolean first = true;
-                    String json = camelController.explainEndpoint(endpoint.getCamelContext().getName(), endpoint.getEndpointUri(), verbose);
+                    String json = camelController.explainEndpointAsJSon(endpoint.getCamelContext().getName(), endpoint.getEndpointUri(), verbose);
                     // use a basic json parser
                     List<Map<String, String>> options = JsonSchemaHelper.parseJsonSchema("properties", json, true);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/25fa34d1/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
index 5977a03..6b951de 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
@@ -22,21 +22,20 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.camel.spi.RestRegistry;
+import org.apache.camel.CamelContext;
 import org.apache.camel.util.URISupport;
 
 /**
  * List the Camel REST services from the Rest registry available in the JVM.
  */
-public class RestRegistryListCommand extends AbstractCamelCommand {
+public class RestRegistryListCommand extends AbstractContextCommand {
 
-    private static final String CONTEXT_COLUMN_LABEL = "Context";
     private static final String URL_COLUMN_NAME = "Url";
     private static final String BASE_PATH_LABEL = "Base Path";
     private static final String URI_TEMPLATE_LABEL = "Uri Template";
     private static final String METHOD_COLUMN_LABEL = "Method";
     private static final String STATE_COLUMN_LABEL = "State";
-    private static final String ROUTE_COLUMN_LABEL = "Route";
+    private static final String ROUTE_COLUMN_LABEL = "Route Id";
 
     private static final int DEFAULT_COLUMN_WIDTH_INCREMENT = 0;
     private static final String DEFAULT_FIELD_PREAMBLE = " ";
@@ -48,19 +47,18 @@ public class RestRegistryListCommand extends AbstractCamelCommand {
     private static final int MAX_COLUMN_WIDTH = 120;
     private static final int MIN_COLUMN_WIDTH = 12;
 
-    String name;
     Boolean decode = true;
     Boolean verbose = false;
 
-    public RestRegistryListCommand(String name, Boolean decode, Boolean verbose) {
-        this.name = name;
+    public RestRegistryListCommand(String context, Boolean decode, Boolean verbose) {
+        super(context);
         this.decode = decode;
         this.verbose = verbose;
     }
 
     @Override
-    public Object execute(CamelController camelController, PrintStream out, PrintStream err) throws Exception {
-        Map<String, List<RestRegistry.RestService>> services = camelController.getRestServices(name);
+    protected Object performContextCommand(CamelController camelController, CamelContext camelContext, PrintStream out, PrintStream err) throws Exception {
+        List<Map<String, String>> services = camelController.getRestServices(context);
         if (services.isEmpty()) {
             out.print("There are no REST services");
             return null;
@@ -72,37 +70,32 @@ public class RestRegistryListCommand extends AbstractCamelCommand {
 
         if (services.size() > 0) {
             if (verbose) {
-                out.println(String.format(headerFormat, CONTEXT_COLUMN_LABEL, URL_COLUMN_NAME, BASE_PATH_LABEL, URI_TEMPLATE_LABEL, METHOD_COLUMN_LABEL, STATE_COLUMN_LABEL, ROUTE_COLUMN_LABEL));
-                out.println(String.format(headerFormat, "-------", "---", "---------", "------------", "------", "-----", "-----"));
+                out.println(String.format(headerFormat, URL_COLUMN_NAME, BASE_PATH_LABEL, URI_TEMPLATE_LABEL, METHOD_COLUMN_LABEL, STATE_COLUMN_LABEL, ROUTE_COLUMN_LABEL));
+                out.println(String.format(headerFormat, "---", "---------", "------------", "------", "-----", "--------"));
             } else {
-                out.println(String.format(headerFormat, CONTEXT_COLUMN_LABEL, BASE_PATH_LABEL, URI_TEMPLATE_LABEL, METHOD_COLUMN_LABEL, STATE_COLUMN_LABEL));
-                out.println(String.format(headerFormat, "-------", "---------", "------------", "------", "-----"));
+                out.println(String.format(headerFormat, BASE_PATH_LABEL, URI_TEMPLATE_LABEL, METHOD_COLUMN_LABEL, STATE_COLUMN_LABEL));
+                out.println(String.format(headerFormat, "---------", "------------", "------", "-----"));
             }
-            for (Map.Entry<String, List<RestRegistry.RestService>> entry : services.entrySet()) {
-                String contextName = entry.getKey();
-                for (final RestRegistry.RestService service : entry.getValue()) {
-                    String contextId = contextName;
-
-                    String uri = null;
-                    if (verbose) {
-                        uri = service.getUrl();
-                        if (decode == null || decode) {
-                            // decode uri so its more human readable
-                            uri = URLDecoder.decode(uri, "UTF-8");
-                        }
-                        // sanitize and mask uri so we dont see passwords
-                        uri = URISupport.sanitizeUri(uri);
-                    }
-                    String basePath = service.getBasePath();
-                    String uriTemplate = service.getUriTemplate() != null ? service.getUriTemplate() : "";
-                    String method = service.getMethod();
-                    String state = service.getState();
-                    String route = service.getRouteId();
-                    if (verbose) {
-                        out.println(String.format(rowFormat, contextId, uri, basePath, uriTemplate, method, state, route));
-                    } else {
-                        out.println(String.format(rowFormat, contextId, basePath, uriTemplate, method, state));
+            for (Map<String, String> row : services) {
+                String uri = null;
+                if (verbose) {
+                    uri = row.get("url");
+                    if (decode == null || decode) {
+                        // decode uri so its more human readable
+                        uri = URLDecoder.decode(uri, "UTF-8");
                     }
+                    // sanitize and mask uri so we dont see passwords
+                    uri = URISupport.sanitizeUri(uri);
+                }
+                String basePath = row.get("basePath");
+                String uriTemplate = row.get("uriTemplate") != null ? row.get("uriTemplate") : "";
+                String method = row.get("method");
+                String state = row.get("state");
+                String route = row.get("routeId");
+                if (verbose) {
+                    out.println(String.format(rowFormat, uri, basePath, uriTemplate, method, state, route));
+                } else {
+                    out.println(String.format(rowFormat, basePath, uriTemplate, method, state));
                 }
             }
         }
@@ -110,8 +103,7 @@ public class RestRegistryListCommand extends AbstractCamelCommand {
         return null;
     }
 
-    private Map<String, Integer> computeColumnWidths(Map<String, List<RestRegistry.RestService>> services) throws Exception {
-        int maxContextLen = 0;
+    private Map<String, Integer> computeColumnWidths(List<Map<String, String>> services) throws Exception {
         int maxUriLen = 0;
         int maxBasePathLen = 0;
         int maxUriTemplateLen = 0;
@@ -119,39 +111,33 @@ public class RestRegistryListCommand extends AbstractCamelCommand {
         int maxStatusLen = 0;
         int maxRouteLen = 0;
 
-        for (Map.Entry<String, List<RestRegistry.RestService>> entry : services.entrySet()) {
-            String contextName = entry.getKey();
-            for (final RestRegistry.RestService service : entry.getValue()) {
-                maxContextLen = Math.max(maxContextLen, contextName == null ? 0 : contextName.length());
-
-                String uri = service.getUrl();
-                if (decode == null || decode) {
-                    // decode uri so its more human readable
-                    uri = URLDecoder.decode(uri, "UTF-8");
-                }
-                // sanitize and mask uri so we dont see passwords
-                uri = URISupport.sanitizeUri(uri);
-                maxUriLen = Math.max(maxUriLen, uri == null ? 0 : uri.length());
+        for (Map<String, String> row : services) {
+            String uri = row.get("url");
+            if (decode == null || decode) {
+                // decode uri so its more human readable
+                uri = URLDecoder.decode(uri, "UTF-8");
+            }
+            // sanitize and mask uri so we dont see passwords
+            uri = URISupport.sanitizeUri(uri);
+            maxUriLen = Math.max(maxUriLen, uri == null ? 0 : uri.length());
 
-                String basePath = service.getBasePath();
-                maxBasePathLen = Math.max(maxBasePathLen, basePath == null ? 0 : basePath.length());
+            String basePath = row.get("basePath");
+            maxBasePathLen = Math.max(maxBasePathLen, basePath == null ? 0 : basePath.length());
 
-                String uriTemplate = service.getUriTemplate();
-                maxUriTemplateLen = Math.max(maxUriTemplateLen, uriTemplate == null ? 0 : uriTemplate.length());
+            String uriTemplate = row.get("uriTemplate");
+            maxUriTemplateLen = Math.max(maxUriTemplateLen, uriTemplate == null ? 0 : uriTemplate.length());
 
-                String method = service.getMethod();
-                maxMethodLen = Math.max(maxMethodLen, method == null ? 0 : method.length());
+            String method = row.get("method");
+            maxMethodLen = Math.max(maxMethodLen, method == null ? 0 : method.length());
 
-                String status = service.getState();
-                maxStatusLen = Math.max(maxStatusLen, status == null ? 0 : status.length());
+            String status = row.get("state");
+            maxStatusLen = Math.max(maxStatusLen, status == null ? 0 : status.length());
 
-                String route = service.getRouteId();
-                maxRouteLen = Math.max(maxRouteLen, route == null ? 0 : route.length());
-            }
+            String routeId = row.get("routeId");
+            maxRouteLen = Math.max(maxRouteLen, routeId == null ? 0 : routeId.length());
         }
 
-        final Map<String, Integer> retval = new Hashtable<String, Integer>(6);
-        retval.put(CONTEXT_COLUMN_LABEL, maxContextLen);
+        final Map<String, Integer> retval = new Hashtable<String, Integer>();
         retval.put(URL_COLUMN_NAME, maxUriLen);
         retval.put(BASE_PATH_LABEL, maxBasePathLen);
         retval.put(URI_TEMPLATE_LABEL, maxUriTemplateLen);
@@ -176,14 +162,12 @@ public class RestRegistryListCommand extends AbstractCamelCommand {
         }
         columnWidthIncrement = DEFAULT_COLUMN_WIDTH_INCREMENT;
 
-        int contextLen = Math.min(columnWidths.get(CONTEXT_COLUMN_LABEL) + columnWidthIncrement, getMaxColumnWidth());
         int uriLen = Math.min(columnWidths.get(URL_COLUMN_NAME) + columnWidthIncrement, getMaxColumnWidth());
         int basePathLen = Math.min(columnWidths.get(BASE_PATH_LABEL) + columnWidthIncrement, getMaxColumnWidth());
         int uriTemplateLen = Math.min(columnWidths.get(URI_TEMPLATE_LABEL) + columnWidthIncrement, getMaxColumnWidth());
         int methodLen = Math.min(columnWidths.get(METHOD_COLUMN_LABEL) + columnWidthIncrement, getMaxColumnWidth());
         int statusLen = Math.min(columnWidths.get(STATE_COLUMN_LABEL) + columnWidthIncrement, getMaxColumnWidth());
         int routeLen = Math.min(columnWidths.get(ROUTE_COLUMN_LABEL) + columnWidthIncrement, getMaxColumnWidth());
-        contextLen = Math.max(MIN_COLUMN_WIDTH, contextLen);
         basePathLen = Math.max(MIN_COLUMN_WIDTH, basePathLen);
         uriLen = Math.max(MIN_COLUMN_WIDTH, uriLen);
         uriTemplateLen = Math.max(MIN_COLUMN_WIDTH, uriTemplateLen);
@@ -193,7 +177,6 @@ public class RestRegistryListCommand extends AbstractCamelCommand {
         // last row does not have min width
 
         final StringBuilder retval = new StringBuilder(DEFAULT_FORMAT_BUFFER_LENGTH);
-        retval.append(fieldPreamble).append("%-").append(contextLen).append('.').append(contextLen).append('s').append(fieldPostamble).append(' ');
         if (isVerbose) {
             retval.append(fieldPreamble).append("%-").append(uriLen).append('.').append(uriLen).append('s').append(fieldPostamble).append(' ');
         }


[3/4] camel git commit: Disable geocoder test by default as it requires online internet and working remote host.

Posted by da...@apache.org.
Disable geocoder test by default as it requires online internet and working remote host.


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

Branch: refs/heads/camel-2.14.x
Commit: b1fd76db9fd4b3858de73e29515f68a2a46793ae
Parents: 8b1aee1
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 10 15:44:21 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 18:06:03 2014 +0100

----------------------------------------------------------------------
 components/camel-geocoder/pom.xml | 38 ++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b1fd76db/components/camel-geocoder/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-geocoder/pom.xml b/components/camel-geocoder/pom.xml
index f6cfe56..ecd7906 100644
--- a/components/camel-geocoder/pom.xml
+++ b/components/camel-geocoder/pom.xml
@@ -69,4 +69,42 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <childDelegation>false</childDelegation>
+          <useFile>true</useFile>
+          <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+          <excludes>
+            <!-- exclude all tests as they require online internet -->
+            <exclude>**/*Test.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>geo-test</id>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <childDelegation>false</childDelegation>
+              <useFile>true</useFile>
+              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+              <includes>
+                <include>**/*Test.java</include>
+              </includes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
 </project>


[2/4] camel git commit: CAMEL-8044: Camel commands should be more reusable for remote JVMs

Posted by da...@apache.org.
CAMEL-8044: Camel commands should be more reusable for remote JVMs


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

Branch: refs/heads/master
Commit: d86c5c4273d2c6a7419f575fe1153966f1153bd0
Parents: 25fa34d
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 10 18:02:52 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 18:02:52 2014 +0100

----------------------------------------------------------------------
 .../camel/commands/AbstractCamelController.java | 44 ++++++++++++++++++++
 .../camel/commands/AbstractRouteCommand.java    |  4 +-
 .../apache/camel/commands/CamelController.java  | 32 ++++++++++++++
 .../apache/camel/commands/RouteInfoCommand.java |  9 ++--
 .../camel/commands/RouteProfileCommand.java     | 11 +++--
 .../camel/commands/RouteResumeCommand.java      |  4 +-
 .../apache/camel/commands/RouteShowCommand.java |  6 +--
 .../camel/commands/RouteStartCommand.java       |  6 +--
 .../apache/camel/commands/RouteStopCommand.java |  6 +--
 .../camel/commands/RouteSuspendCommand.java     |  6 +--
 10 files changed, 97 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
index 96868e5..c6ae955 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
@@ -134,6 +134,50 @@ public abstract class AbstractCamelController implements CamelController {
         }
     }
 
+    public void startRoute(String camelContextName, String routeId) {
+        CamelContext context = getCamelContext(camelContextName);
+        if (context != null) {
+            try {
+                context.startRoute(routeId);
+            } catch (Exception e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+    }
+
+    public void stopRoute(String camelContextName, String routeId) {
+        CamelContext context = getCamelContext(camelContextName);
+        if (context != null) {
+            try {
+                context.stopRoute(routeId);
+            } catch (Exception e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+    }
+
+    public void suspendRoute(String camelContextName, String routeId) {
+        CamelContext context = getCamelContext(camelContextName);
+        if (context != null) {
+            try {
+                context.suspendRoute(routeId);
+            } catch (Exception e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+    }
+
+    public void resumeRoute(String camelContextName, String routeId) {
+        CamelContext context = getCamelContext(camelContextName);
+        if (context != null) {
+            try {
+                context.resumeRoute(routeId);
+            } catch (Exception e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+    }
+
     @SuppressWarnings("deprecation")
     public String getRouteModelAsXml(String routeId, String camelContextName) {
         CamelContext context = this.getCamelContext(camelContextName);

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractRouteCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractRouteCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractRouteCommand.java
index fc1c83f..81fd2a6 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractRouteCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractRouteCommand.java
@@ -59,7 +59,7 @@ public abstract class AbstractRouteCommand extends AbstractCamelCommand {
             ClassLoader oldClassloader = Thread.currentThread().getContextClassLoader();
             Thread.currentThread().setContextClassLoader(camelContext.getApplicationContextClassLoader());
             try {
-                executeOnRoute(camelController, camelContext, camelRoute.getId(), out, err);
+                executeOnRoute(camelController, camelContext.getName(), camelRoute.getId(), out, err);
             } finally {
                 Thread.currentThread().setContextClassLoader(oldClassloader);
             }
@@ -68,7 +68,7 @@ public abstract class AbstractRouteCommand extends AbstractCamelCommand {
         return null;
     }
 
-    public abstract void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception;
+    public abstract void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception;
 
     /**
      * To sort the routes.

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
index 881361d..8eca54e 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
@@ -70,6 +70,38 @@ public interface CamelController {
     void resetRouteStats(String camelContextName);
 
     /**
+     * Starts the given route
+     *
+     * @param camelContextName the Camel context.
+     * @param routeId          the route ID.
+     */
+    void startRoute(String camelContextName, String routeId);
+
+    /**
+     * Stops the given route
+     *
+     * @param camelContextName the Camel context.
+     * @param routeId          the route ID.
+     */
+    void stopRoute(String camelContextName, String routeId);
+
+    /**
+     * Suspends the given route
+     *
+     * @param camelContextName the Camel context.
+     * @param routeId          the route ID.
+     */
+    void suspendRoute(String camelContextName, String routeId);
+
+    /**
+     * Resumes the given route
+     *
+     * @param camelContextName the Camel context.
+     * @param routeId          the route ID.
+     */
+    void resumeRoute(String camelContextName, String routeId);
+
+    /**
      * Return the definition of a route as XML identified by a ID and a Camel context.
      *
      * @param routeId          the route ID.

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java
index 982740d..e02a9fa 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteInfoCommand.java
@@ -23,7 +23,6 @@ import java.util.Date;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Unmarshaller;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.util.RouteStatDump;
 
 /**
@@ -47,13 +46,13 @@ public class RouteInfoCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
         out.println(stringEscape.unescapeJava("\u001B[1m\u001B[33mCamel Route " + routeId + "\u001B[0m"));
-        out.println(stringEscape.unescapeJava("\tCamel Context: " + camelContext.getName()));
+        out.println(stringEscape.unescapeJava("\tCamel Context: " + contextName));
         out.println("");
         out.println(stringEscape.unescapeJava("\u001B[1mStatistics\u001B[0m"));
 
-        String xml = camelController.getRouteStatsAsXml(routeId, camelContext.getName(), true, false);
+        String xml = camelController.getRouteStatsAsXml(routeId, contextName, true, false);
         if (xml != null) {
             JAXBContext context = JAXBContext.newInstance(RouteStatDump.class);
             Unmarshaller unmarshaller = context.createUnmarshaller();
@@ -102,7 +101,7 @@ public class RouteInfoCommand extends AbstractRouteCommand {
             }
 
             out.println("");
-            xml = camelController.getRouteModelAsXml(routeId, camelContext.getName());
+            xml = camelController.getRouteModelAsXml(routeId, contextName);
             if (xml != null) {
                 out.println(stringEscape.unescapeJava("\u001B[1mDefinition\u001B[0m"));
                 out.println(stringEscape.unescapeJava(xml));

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
index f17fab5..e0f0eb1 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
@@ -21,7 +21,6 @@ import java.io.StringReader;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Unmarshaller;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.util.ProcessorStatDump;
 import org.apache.camel.util.RouteStatDump;
 
@@ -48,20 +47,20 @@ public class RouteProfileCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
 
         JAXBContext context = JAXBContext.newInstance(RouteStatDump.class);
         Unmarshaller unmarshaller = context.createUnmarshaller();
 
         // write new header for new camel context
-        if (previousCamelContextName == null || !previousCamelContextName.equals(camelContext.getName())) {
+        if (previousCamelContextName == null || !previousCamelContextName.equals(contextName)) {
             System.out.println("");
             System.out.println(stringEscape.unescapeJava("\u001B[1mProfile\u001B[0m"));
-            System.out.println(stringEscape.unescapeJava("\tCamel Context: " + camelContext.getName()));
+            System.out.println(stringEscape.unescapeJava("\tCamel Context: " + contextName));
             System.out.println(String.format(HEADER_FORMAT, "Id", "Count", "Last (ms)", "Delta (ms)", "Mean (ms)", "Min (ms)", "Max (ms)", "Total (ms)", "Self (ms)"));
         }
 
-        String xml = camelController.getRouteStatsAsXml(routeId, camelContext.getName(), true, true);
+        String xml = camelController.getRouteStatsAsXml(routeId, contextName, true, true);
         RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new StringReader(xml));
 
         long count = route.getExchangesCompleted() + route.getExchangesFailed();
@@ -78,6 +77,6 @@ public class RouteProfileCommand extends AbstractRouteCommand {
         }
 
         // we want to group routes from the same context in the same table
-        previousCamelContextName = camelContext.getName();
+        previousCamelContextName = contextName;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteResumeCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteResumeCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteResumeCommand.java
index 6876e81..fef119a 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteResumeCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteResumeCommand.java
@@ -31,7 +31,7 @@ public class RouteResumeCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
-        camelContext.resumeRoute(routeId);
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
+        camelController.resumeRoute(contextName, routeId);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteShowCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteShowCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteShowCommand.java
index 9379eb2..9fea7e5 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteShowCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteShowCommand.java
@@ -18,8 +18,6 @@ package org.apache.camel.commands;
 
 import java.io.PrintStream;
 
-import org.apache.camel.CamelContext;
-
 /**
  * Command to show the route marshaled in XML.
  */
@@ -30,8 +28,8 @@ public class RouteShowCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
-        String xml = camelController.getRouteModelAsXml(routeId, camelContext.getName());
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
+        String xml = camelController.getRouteModelAsXml(routeId, contextName);
         if (xml == null) {
             err.println("Definition of route " + routeId + " not found.");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStartCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStartCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStartCommand.java
index b60fb5e..3b8e230 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStartCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStartCommand.java
@@ -18,8 +18,6 @@ package org.apache.camel.commands;
 
 import java.io.PrintStream;
 
-import org.apache.camel.CamelContext;
-
 /**
  * Command to start a route.
  */
@@ -30,7 +28,7 @@ public class RouteStartCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
-        camelContext.startRoute(routeId);
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
+        camelController.startRoute(contextName, routeId);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStopCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStopCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStopCommand.java
index 7412940..b3239e5 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStopCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteStopCommand.java
@@ -18,8 +18,6 @@ package org.apache.camel.commands;
 
 import java.io.PrintStream;
 
-import org.apache.camel.CamelContext;
-
 /**
  * Command to stop a route.
  */
@@ -30,7 +28,7 @@ public class RouteStopCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
-        camelContext.stopRoute(routeId);
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
+        camelController.stopRoute(contextName, routeId);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d86c5c42/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteSuspendCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteSuspendCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteSuspendCommand.java
index 1f91c07..9632510 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteSuspendCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteSuspendCommand.java
@@ -18,8 +18,6 @@ package org.apache.camel.commands;
 
 import java.io.PrintStream;
 
-import org.apache.camel.CamelContext;
-
 /**
  * Command to suspend a route.
  */
@@ -30,7 +28,7 @@ public class RouteSuspendCommand extends AbstractRouteCommand {
     }
 
     @Override
-    public void executeOnRoute(CamelController camelController, CamelContext camelContext, String routeId, PrintStream out, PrintStream err) throws Exception {
-        camelContext.suspendRoute(routeId);
+    public void executeOnRoute(CamelController camelController, String contextName, String routeId, PrintStream out, PrintStream err) throws Exception {
+        camelController.suspendRoute(contextName, routeId);
     }
 }


[4/4] camel git commit: Disable geocoder test by default as it requires online internet and working remote host.

Posted by da...@apache.org.
Disable geocoder test by default as it requires online internet and working remote host.


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

Branch: refs/heads/camel-2.13.x
Commit: 5854ae018cecf86a5eef5944c986fc5d35b8ab33
Parents: fa6db18
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 10 15:44:21 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 18:06:17 2014 +0100

----------------------------------------------------------------------
 components/camel-geocoder/pom.xml | 38 ++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5854ae01/components/camel-geocoder/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-geocoder/pom.xml b/components/camel-geocoder/pom.xml
index 3657d10..79b2283 100644
--- a/components/camel-geocoder/pom.xml
+++ b/components/camel-geocoder/pom.xml
@@ -69,4 +69,42 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <childDelegation>false</childDelegation>
+          <useFile>true</useFile>
+          <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+          <excludes>
+            <!-- exclude all tests as they require online internet -->
+            <exclude>**/*Test.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>geo-test</id>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <childDelegation>false</childDelegation>
+              <useFile>true</useFile>
+              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+              <includes>
+                <include>**/*Test.java</include>
+              </includes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
 </project>