svn commit: r803122 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/loadbalancer/ components/camel-web/src/main/java/org/apache/camel/web/util/ components/camel-web/src/test/java/o...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r803122 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/loadbalancer/ components/camel-web/src/main/java/org/apache/camel/web/util/ components/camel-web/src/test/java/o...

janstey-3
Author: janstey
Date: Tue Aug 11 13:52:55 2009
New Revision: 803122

URL: http://svn.apache.org/viewvc?rev=803122&view=rev
Log:
reverting my last commit so I can apply the latest web console patch... will send a new one shortly

Removed:
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/AOPDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/InterceptDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/InterceptSendToEndpointDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/OnCompletionDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/ResequenceDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/SplitDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/StreamCachingDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/util/
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java
    camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionNodeRenderer.java
    camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionRenderer.java
    camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/GroovyRenderer.java
    camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OnExceptionDefinitionRenderer.java
    camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OutputDefinitionRenderer.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/ChoiceDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/LoadBalanceDSLTest.java
    camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/SortDSLTest.java
    camel/trunk/components/camel-web/src/test/resources/testedRoutes.txt

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java Tue Aug 11 13:52:55 2009
@@ -66,7 +66,7 @@
 
     @Override
     public String getShortName() {
-        return "interceptSendToEndpoint";
+        return "interceptEndpoint";
     }
 
     @Override

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java Tue Aug 11 13:52:55 2009
@@ -52,10 +52,6 @@
         this.correlationExpression = correlationExpression;
         this.loadBalancer = loadBalancer;
     }
-    
-    public Expression getCorrelationExpression() {
-        return correlationExpression;
-    }
 
     protected synchronized Processor chooseProcessor(List<Processor> processors, Exchange exchange) {
         Object value = correlationExpression.evaluate(exchange, Object.class);

Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionNodeRenderer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionNodeRenderer.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionNodeRenderer.java (original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionNodeRenderer.java Tue Aug 11 13:52:55 2009
@@ -105,19 +105,12 @@
                 ExpressionRenderer.render(buffer, expression);
             }
         } else if (expNode instanceof SplitDefinition) {
-            if (expression.getExpressionValue() != null) {
-                buffer.append("(");
-                ExpressionRenderer.render(buffer, expression);
-                buffer.append(")");
-            } else if (expression.getExpressionType() != null) {
-                buffer.append("().");
+            String expValue = expression.getExpressionValue().toString();
+            if (!expValue.contains("(")) {
+                buffer.append("().").append(expValue).append("()");
+            } else {
                 ExpressionRenderer.render(buffer, expression);
             }
-
-            SplitDefinition split = (SplitDefinition)expNode;
-            if (split.isStreaming()) {
-                buffer.append(".streaming()");
-            }
         } else if (expNode instanceof TransformDefinition) {
             String expValue = expression.getExpressionValue().toString();
             if (expValue.startsWith("append") || expValue.startsWith("prepend") || expValue.startsWith("to")) {

Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionRenderer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionRenderer.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionRenderer.java (original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/ExpressionRenderer.java Tue Aug 11 13:52:55 2009
@@ -111,14 +111,9 @@
      */
     public static void renderExpression(StringBuilder buffer, String expression) {
         if (!expression.contains(",")) {
-            if (expression.contains("(")) {
-                // header(foo) -> header("foo")
-                expression = expression.replaceAll("\\(", "(\"").replaceAll("\\)", "\")");
-                buffer.append(expression);
-            } else {
-                // body -> body()
-                buffer.append(expression).append("()");
-            }
+            // header(foo) -> header("foo")
+            expression = expression.replaceAll("\\(", "(\"").replaceAll("\\)", "\")");
+            buffer.append(expression);
         } else if (expression.startsWith("tokenize")) {
             String words[] = expression.split("\\(");
             if (words.length == 2) {
@@ -126,17 +121,8 @@
                 String tokenize = words[1].substring(words[1].indexOf(" ") + 1, words[1].lastIndexOf(")"));
                 words[1] = words[1].substring(0, words[1].indexOf(","));
 
-                if (!words[1].contains("[")) {
-                    // body
-                    buffer.append(words[1]).append("()");
-                } else {
-                    // bodyAs[clazz]
-                    String word = words[1].substring(0, words[1].indexOf("As"));
-                    String clazz = words[1].substring(words[1].lastIndexOf(".") + 1, words[1].length() - 1);
-                    buffer.append(word).append("(").append(clazz).append(".class)");
-                }
-
-                buffer.append(".").append(words[0]).append("(\"").append(tokenize).append("\")");
+                buffer.append(words[1]).append("().");
+                buffer.append(words[0]).append("(\"").append(tokenize).append("\")");
             } else if (words.length == 3) {
                 // tokenize(header(foo), ,) -> header("foo").tokenize(",")
                 String symbolName = words[2].substring(0, words[2].indexOf(")"));

Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/GroovyRenderer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/GroovyRenderer.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/GroovyRenderer.java (original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/GroovyRenderer.java Tue Aug 11 13:52:55 2009
@@ -80,7 +80,7 @@
         // render the global dsl not started with from, like global
         // onCompletion, onException, intercept
         for (ProcessorDefinition processor : outputs) {
-            if (processor.getParent() == null && !(processor instanceof SendDefinition)) {
+            if (processor.getParent() == null) {
                 renderProcessor(buffer, processor);
                 buffer.append(";");
             }
@@ -96,14 +96,9 @@
         }
         buffer.append(")");
 
-        // render some route configurations
-        if (route.isStreamCache() != null && route.isStreamCache()) {
-            buffer.append(".streamCaching()");
-        }
-
         // render the outputs of the router
         for (ProcessorDefinition processor : outputs) {
-            if (processor.getParent() == route || processor instanceof SendDefinition) {
+            if (processor.getParent() == route) {
                 renderProcessor(buffer, processor);
             }
         }
@@ -170,9 +165,7 @@
             } else if (lb instanceof RoundRobinLoadBalancer) {
                 buffer.append(".roundRobin()");
             } else if (lb instanceof StickyLoadBalancer) {
-                buffer.append(".sticky(");
-                ExpressionRenderer.renderExpression(buffer, ((StickyLoadBalancer)lb).getCorrelationExpression().toString());
-                buffer.append(")");
+                buffer.append(".sticky()");
             } else if (lb instanceof TopicLoadBalancer) {
                 buffer.append(".topic()");
             }
@@ -196,18 +189,12 @@
 
             List<Expression> exps = resequence.getExpressionList();
             for (Expression exp : exps) {
-                ExpressionRenderer.renderExpression(buffer, exp.toString());
+                buffer.append(exp.toString()).append("()");
                 if (exp != exps.get(exps.size() - 1)) {
                     buffer.append(", ");
                 }
             }
             buffer.append(")");
-
-            if (resequence.getStreamConfig() != null) {
-                // TODO improve stream() support
-                buffer.append(".stream()");
-            }
-
         } else if (processor instanceof RoutingSlipDefinition) {
             RoutingSlipDefinition routingSlip = (RoutingSlipDefinition)processor;
             buffer.append(".").append(routingSlip.getShortName()).append("(\"").append(routingSlip.getHeaderName()).append("\", \"").append(routingSlip.getUriDelimiter())

Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OnExceptionDefinitionRenderer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OnExceptionDefinitionRenderer.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OnExceptionDefinitionRenderer.java (original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OnExceptionDefinitionRenderer.java Tue Aug 11 13:52:55 2009
@@ -45,12 +45,6 @@
         }
         buffer.append(")");
 
-        // render handled() dsl
-        if (onException.getHandledPolicy() != null) {
-            String handled = onException.getHandledPolicy().toString();
-            buffer.append(".handled(").append(handled).append(")");
-        }
-
         List<ProcessorDefinition> branches = onException.getOutputs();
         for (ProcessorDefinition branch : branches) {
             SendDefinitionRenderer.render(buffer, branch);

Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OutputDefinitionRenderer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OutputDefinitionRenderer.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OutputDefinitionRenderer.java (original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/OutputDefinitionRenderer.java Tue Aug 11 13:52:55 2009
@@ -17,18 +17,14 @@
 
 package org.apache.camel.web.util;
 
-import java.util.List;
-
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.camel.model.AOPDefinition;
 import org.apache.camel.model.BeanDefinition;
-import org.apache.camel.model.ChoiceDefinition;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.model.EnrichDefinition;
 import org.apache.camel.model.FinallyDefinition;
 import org.apache.camel.model.InterceptDefinition;
-import org.apache.camel.model.InterceptFromDefinition;
 import org.apache.camel.model.InterceptSendToEndpointDefinition;
 import org.apache.camel.model.MarshalDefinition;
 import org.apache.camel.model.MulticastDefinition;
@@ -48,7 +44,6 @@
 import org.apache.camel.model.TransactedDefinition;
 import org.apache.camel.model.TryDefinition;
 import org.apache.camel.model.UnmarshalDefinition;
-import org.apache.camel.model.WhenDefinition;
 
 /**
  *
@@ -86,20 +81,11 @@
             String resourceUri = enrich.substring(enrich.indexOf('[') + 1, enrich.indexOf(' '));
             buffer.append("(\"").append(resourceUri).append("\")");
         } else if (out instanceof FinallyDefinition) {
-
+            
         } else if (out instanceof InterceptDefinition) {
             buffer.append("()");
-            if (out instanceof InterceptFromDefinition) {
-
-            } else {
-
-            }
         } else if (out instanceof InterceptSendToEndpointDefinition) {
-            InterceptSendToEndpointDefinition interceptSend = (InterceptSendToEndpointDefinition)out;
-            buffer.append("(\"").append(interceptSend.getUri()).append("\")");
-            if (interceptSend.getSkipSendToOriginalEndpoint()) {
-                buffer.append(".skipSendToOriginalEndpoint()");
-            }
+
         } else if (out instanceof MarshalDefinition) {
             DataFormatDefinition dataFormat = ((MarshalDefinition)out).getDataFormatType();
             buffer.append("().").append(dataFormat.getClass().getAnnotation(XmlRootElement.class).name()).append("()");
@@ -129,7 +115,7 @@
             ExpressionRenderer.renderExpression(buffer, sort.getExpression().toString());
             buffer.append(")");
         } else if (out instanceof StopDefinition) {
-            buffer.append("()");
+
         } else if (out instanceof ThreadsDefinition) {
 
         } else if (out instanceof TransactedDefinition) {
@@ -138,6 +124,7 @@
 
         } else if (out instanceof UnmarshalDefinition) {
             DataFormatDefinition dataFormat = ((UnmarshalDefinition)out).getDataFormatType();
+            Class clazz = dataFormat.getClass();
             buffer.append("().").append(dataFormat.getClass().getAnnotation(XmlRootElement.class).name()).append("()");
         }
     }

Modified: camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/ChoiceDSLTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/ChoiceDSLTest.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/ChoiceDSLTest.java (original)
+++ camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/ChoiceDSLTest.java Tue Aug 11 13:52:55 2009
@@ -47,9 +47,7 @@
         String DSL = "from(\"direct:start\").split().body().choice()" +
          ".when().method(\"orderItemHelper\", \"isWidget\").to(\"bean:widgetInventory\", \"seda:aggregate\")" +
          ".otherwise().to(\"bean:gadgetInventory\", \"seda:aggregate\")";
-        
-        //TODO check this result
-        String expectedDSL = "from(\"direct:start\").split(body()).choice()" +
+        String expectedDSL = "from(\"direct:start\").split().body().choice()" +
          ".when().method(\"orderItemHelper\", \"isWidget\").to(\"bean:widgetInventory\").to(\"seda:aggregate\")" +
          ".otherwise().to(\"bean:gadgetInventory\").to(\"seda:aggregate\")" +
          ".end()";

Modified: camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/LoadBalanceDSLTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/LoadBalanceDSLTest.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/LoadBalanceDSLTest.java (original)
+++ camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/LoadBalanceDSLTest.java Tue Aug 11 13:52:55 2009
@@ -36,11 +36,4 @@
         assertEquals(expectedDSL, render(DSL));
     }
 
- public void testLoadBalanceSticky() throws Exception {
-        String DSL = "from(\"direct:start\").loadBalance().sticky(header(\"foo\")).to(\"mock:x\", \"mock:y\", \"mock:z\")";
-        String expectedDSL = "from(\"direct:start\").loadBalance().sticky(header(\"foo\")).to(\"mock:x\").to(\"mock:y\").to(\"mock:z\")";
-
-        assertEquals(expectedDSL, render(DSL));
-    }
-
 }

Modified: camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/SortDSLTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/SortDSLTest.java?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/SortDSLTest.java (original)
+++ camel/trunk/components/camel-web/src/test/java/org/apache/camel/web/groovy/SortDSLTest.java Tue Aug 11 13:52:55 2009
@@ -22,7 +22,7 @@
  */
 public class SortDSLTest extends GroovyRendererTestSupport {
 
-    public void testSort() throws Exception {
+    public void testRecipientList() throws Exception {
         String DSL = "from(\"direct:start\").sort(body().tokenize(\",\")).to(\"bean:MyServiceBean.processLine\")";
         String expectedDSL = DSL;
 

Modified: camel/trunk/components/camel-web/src/test/resources/testedRoutes.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/test/resources/testedRoutes.txt?rev=803122&r1=803121&r2=803122&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/test/resources/testedRoutes.txt (original)
+++ camel/trunk/components/camel-web/src/test/resources/testedRoutes.txt Tue Aug 11 13:52:55 2009
@@ -35,8 +35,7 @@
 from("direct:start").filter(body().contains("World")).to("mock:result")
 #########################loadBalance#########################
 from("direct:start").loadBalance().random().to("mock:x", "mock:y", "mock:z")
-from("direct:start").loadBalance().failover(IOException.class).to("mock:x", "mock:y", "mock:z")
-from("direct:start").loadBalance().sticky(header("foo")).to("mock:x", "mock:y", "mock:z")
+#from("direct:start").loadBalance().failover(IOException.class).to("direct:x", "direct:y") // No getExceptions method for FailOverLoadBalancer
 #########################loop#########################
 from("direct:start").loop(8).to("mock:result")
 from("direct:start").loop(header("loop")).to("mock:result")
@@ -50,12 +49,7 @@
 #########################recipientList#########################
 from("direct:start").recipientList(header("recipientListHeader").tokenize(","))
 #########################resequencer#########################
-<<<<<<< .mine
-from("direct:start").resequence(body()).to("mock:result")
-from("direct:start").resequencer(header("seqnum")).stream().to("mock:result")
-=======
 #from("direct:start").resequence(body()).to("mock:result")
->>>>>>> .r801852
 #########################routingSlip#########################
 from("direct:start").routingSlip("headerName")
 from("direct:start").routingSlip("aRoutingSlipHeader", "#")
@@ -66,9 +60,9 @@
 from("direct:start").sort(body().tokenize(",")).to("bean:MyServiceBean.processLine")
 #from("direct:start").sort(body().tokenize("\n")).to("bean:MyServiceBean.processLine")
 #########################split#########################
-from("direct:start").split(body().tokenize(",")).streaming().to("mock:result")
-from("direct:start").split(body(String.class).tokenize("\n")).to("mock:result")
-from("direct:start").split().method("mySplitterBean", "splitBody").to("mock:result")
+#from("direct:start").split(body().tokenize(",")).streaming().to("mock:result")
+#from("direct:start").split(body(String.class).tokenize("\n")).to("mock:result")
+#from("direct:start").split().method("mySplitterBean", "splitBody").to("mock:result")
 #from("direct:start").split(xpath("//foo/bar")).convertBodyTo(String.class).to("mock:result")
 #########################throttle#########################
 from("direct:start").throttle(100).to("mock:result")
@@ -78,7 +72,7 @@
 from("direct:start").transform().constant("London").to("mock:result")
 from("direct:start").transform(body().append(" World!")).to("mock:result")
 from("direct:start").transform(sendTo("direct:foo")).to("mock:result")
-#from("direct:start").beanRef("myTransformerBean", "myMethodName").to("mock:result")
+#from("activemq:SomeQueue").beanRef("myTransformerBean", "myMethodName").to("mqseries:AnotherQueue")
 #########################validation#########################
 #########################xpath#########################
 from("direct:start").filter().xpath("/person[@name='James']").to("mock:result")
@@ -86,7 +80,7 @@
 #########################wireTap#########################
 from("direct:start").to("log:foo").wireTap("direct:tap").to("mock:result")
 from("direct:start").delay(1000).setBody().constant("Tapped").to("mock:result", "mock:tap")
-from("direct:start").wireTap("direct:foo", constant("Bye World")).to("mock:result")
+#from("direct:start").wireTap("direct:foo", constant("Bye World")).to("mock:result")
 #########################others#########################
 from("direct:start").marshal().serialization().to("direct:marshalled")
 from("direct:start").unmarshal().serialization().to("mock:result")
\ No newline at end of file