camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r821024 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/view/GraphGeneratorSupport.java main/java/org/apache/camel/view/RouteDotGenerator.java test/java/org/apache/camel/view/DotViewTest.java
Date Fri, 02 Oct 2009 14:05:43 GMT
Author: davsclaus
Date: Fri Oct  2 14:05:43 2009
New Revision: 821024

URL: http://svn.apache.org/viewvc?rev=821024&view=rev
Log:
MR-187: Added more unit tests.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/view/GraphGeneratorSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/view/DotViewTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/view/GraphGeneratorSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/view/GraphGeneratorSupport.java?rev=821024&r1=821023&r2=821024&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/view/GraphGeneratorSupport.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/view/GraphGeneratorSupport.java
Fri Oct  2 14:05:43 2009
@@ -48,10 +48,9 @@
     protected int clusterCounter;
     protected String extension;
 
-    //private String imagePrefix = "http://www.enterpriseintegrationpatterns.com/img/";
-    private String imagePrefix = "http://camel.apache.org/images/eip/";
-    private Map<Object, NodeData> nodeMap = new HashMap<Object, NodeData>();
-    private boolean makeParentDirs = true;
+    private final String imagePrefix = "http://camel.apache.org/images/eip/";
+    private final Map<Object, NodeData> nodeMap = new HashMap<Object, NodeData>();
+    private final boolean makeParentDirs = true;
     private Map<String, List<RouteDefinition>> routeGroupMap;
 
     protected GraphGeneratorSupport(String dir, String extension) {
@@ -59,36 +58,13 @@
         this.extension = extension;
     }
 
-    public String getDir() {
-        return dir;
-    }
-
-    /**
-     * Sets the destination directory in which to create the diagrams
-     */
-    public void setDir(String dir) {
-        this.dir = dir;
-    }
-
-    public String getImagePrefix() {
-        return imagePrefix;
-    }
-
-    public void setImagePrefix(String imagePrefix) {
-        this.imagePrefix = imagePrefix;
-    }
-
     public String getRoutesText(CamelContext context) throws IOException {
+        // used by web console
         List<RouteDefinition> routes = context.getRouteDefinitions();
         routeGroupMap = createRouteGroupMap(routes);
         return createRouteMapText();
     }
 
-    public String getRouteText(RouteDefinition route) throws IOException {
-        routeGroupMap = createRouteGroupMap(route);
-        return createRouteMapText();
-    }
-
     private String createRouteMapText() {
         StringWriter buffer = new StringWriter();
         PrintWriter writer = new PrintWriter(buffer);
@@ -181,12 +157,6 @@
         return map;
     }
 
-    protected Map<String, List<RouteDefinition>> createRouteGroupMap(RouteDefinition
route) {
-        Map<String, List<RouteDefinition>> map = new HashMap<String, List<RouteDefinition>>();
-        addRouteToMap(map, route);
-        return map;
-    }
-
     protected void addRouteToMap(Map<String, List<RouteDefinition>> map, RouteDefinition
route) {
         String group = route.getGroup();
         if (group == null) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java?rev=821024&r1=821023&r2=821024&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java Fri
Oct  2 14:05:43 2009
@@ -74,17 +74,11 @@
         }
     }
 
-    protected String escapeNodeId(String text) {
-        return text.replace('.', '_').replace("$", "_");
-    }
-
     protected void printRoute(PrintWriter writer, final RouteDefinition route, FromDefinition
input) {
         NodeData nodeData = getNodeData(input);
 
         printNode(writer, nodeData);
 
-        // TODO we should add a transactional client / event driven consumer / polling client
-
         NodeData from = nodeData;
         for (ProcessorDefinition output : route.getOutputs()) {
             NodeData newData = printNode(writer, from, output);

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/view/DotViewTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/view/DotViewTest.java?rev=821024&r1=821023&r2=821024&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/view/DotViewTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/view/DotViewTest.java Fri Oct  2
14:05:43 2009
@@ -38,10 +38,15 @@
 
         context.addRoutes(new MulticastRoute());
         context.addRoutes(new PipelineRoute());
+        context.addRoutes(new AnotherPipelineRoute());
         context.addRoutes(new FromToRoute());
         context.addRoutes(new ChoiceRoute());
         context.addRoutes(new FilterRoute());
         context.addRoutes(new ComplexRoute());
+        context.addRoutes(new FromToBeanRoute());
+        context.addRoutes(new RoutingSlipRoute());
+        context.addRoutes(new AggreagateRoute());
+        context.addRoutes(new ResequenceRoute());
     }
 
     static class MulticastRoute extends RouteBuilder {
@@ -57,12 +62,42 @@
         }
     }
 
+    static class AnotherPipelineRoute extends RouteBuilder {
+        public void configure() throws Exception {
+            from("seda:pipeline.in").pipeline("seda:pipeline.out1", "seda:pipeline.out2",
"seda:pipeline.out3");
+        }
+    }
+
     static class FromToRoute extends RouteBuilder {
         public void configure() throws Exception {
             from("seda:foo").to("seda:bar");
         }
     }
 
+    static class FromToBeanRoute extends RouteBuilder {
+        public void configure() throws Exception {
+            from("seda:foo").beanRef("myBean", "myMethod");
+        }
+    }
+
+    static class RoutingSlipRoute extends RouteBuilder {
+        public void configure() throws Exception {
+            from("seda:foo").routingSlip("splipHeader");
+        }
+    }
+
+    static class AggreagateRoute extends RouteBuilder {
+        public void configure() throws Exception {
+            from("seda:foo").aggregate(constant("messageId")).to("seda:aggregated");
+        }
+    }
+
+    static class ResequenceRoute extends RouteBuilder {
+        public void configure() throws Exception {
+            from("seda:foo").resequence(constant("seqNum")).to("seda:bar");
+        }
+    }
+
     static class ChoiceRoute extends RouteBuilder {
         public void configure() throws Exception {
             from("file:target/foo/xyz?noop=true").



Mime
View raw message