camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r555584 [2/2] - in /activemq/camel/trunk: ./ apache-camel/ apache-camel/src/main/descriptors/ camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/builder/xm...
Date Thu, 12 Jul 2007 11:27:14 GMT
Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/LanguageTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/LanguageTestSupport.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/LanguageTestSupport.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/LanguageTestSupport.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,92 @@
+/*
+ * 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;
+
+import org.apache.camel.impl.DefaultExchange;
+
+/**
+ * A useful base class for testing the language plugins in Camel
+ * @version $Revision: $
+ */
+public abstract class LanguageTestSupport extends ContextTestSupport {
+    protected Exchange exchange;
+
+    protected abstract String getLanguageName();
+
+
+    /**
+     * Asserts that the given predicate expression evaluated on the current language and
message
+     * exchange evaluates to true
+     */
+    protected void assertPredicate(String expression) {
+        assertPredicate(exchange, expression, true);
+    }
+
+    /**
+     * Asserts that the given predicate expression evaluated on the current language and
message
+     * exchange evaluates to the expected value
+     */
+    protected void assertPredicate(String expression, boolean expected) {
+        assertPredicate(exchange, expression, expected);
+    }
+
+    protected void assertPredicate(Exchange exchange, String expression, boolean expected)
{
+        assertPredicate(getLanguageName(), expression, exchange, expected);
+    }
+
+
+    /**
+     * Asserts that this language expression evaluates to the given value on the given exchange
+     */
+    protected void assertExpression(Exchange exchange, String expressionText, Object expectedValue)
{
+        assertExpression(exchange, getLanguageName(), expressionText, expectedValue);
+    }
+
+    /**
+     * Asserts that this language expression evaluates to the given value on the current
exchange
+     */
+    protected void assertExpression(String expressionText, Object expectedValue) {
+        assertExpression(exchange, expressionText, expectedValue);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        exchange = createExchange();
+        assertNotNull("No exchange created!", exchange);
+        populateExchange(exchange);
+    }
+
+    /**
+     * A factory method to create an Exchange implementation
+     */
+    protected Exchange createExchange() {
+        return new DefaultExchange(context);
+    }
+
+
+    /**
+     * A strategy method to populate an exchange with some example values for use
+     * by language plugins
+     */
+    protected void populateExchange(Exchange exchange) {
+        Message in = exchange.getIn();
+        in.setHeader("foo", "abc");
+        in.setHeader("bar", 123);
+        in.setBody("<hello id='m123'>world!</hello>");
+    }
+}

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.language;
+
+import org.apache.camel.LanguageTestSupport;
+
+/**
+ * @version $Revision: $
+ */
+public class SimpleTest extends LanguageTestSupport {
+
+    public void testExpressions() throws Exception {
+        assertExpression("body", "<hello id='m123'>world!</hello>");
+        assertExpression("in.body", "<hello id='m123'>world!</hello>");
+        assertExpression("in.header.foo", "abc");
+        assertExpression("header.foo", "abc");
+    }
+
+    public void testPredicates() throws Exception {
+        assertPredicate("body");
+        assertPredicate("header.foo");
+        assertPredicate("header.madeUpHeader", false);
+    }
+
+    protected String getLanguageName() {
+        return "simple";
+    }
+}
\ No newline at end of file

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.language;
+
+import org.apache.camel.LanguageTestSupport;
+
+/**
+ * @version $Revision: $
+ */
+public class XPathTest extends LanguageTestSupport {
+    public void testExpressions() throws Exception {
+        assertExpression("in:body()", "<hello id='m123'>world!</hello>");
+        assertExpression("in:header('foo')", "abc");
+        assertExpression("$foo", "abc");
+    }
+
+    public void testPredicates() throws Exception {
+        assertPredicate("in:header('foo') = 'abc'");
+        assertPredicate("$foo = 'abc'");
+        assertPredicate("$foo = 'bar'", false);
+    }
+
+    protected String getLanguageName() {
+        return "xpath";
+    }
+}

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
Thu Jul 12 04:27:11 2007
@@ -16,68 +16,56 @@
  */
 package org.apache.camel.processor;
 
-import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
-import static org.apache.camel.component.mock.MockEndpoint.expectsMessageCount;
-
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.apache.camel.component.mock.MockEndpoint.expectsMessageCount;
 
 /**
  * @version $Revision: 1.1 $
  */
 public class ChoiceTest extends ContextTestSupport {
-    protected Endpoint<Exchange> startEndpoint;
     protected MockEndpoint x, y, z;
 
     public void testSendToFirstWhen() throws Exception {
-        x.expectedBodiesReceived("one");
+        String body = "<one/>";
+        x.expectedBodiesReceived(body);
         expectsMessageCount(0, y, z);
 
-        sendMessage("bar", "one");
+        sendMessage("bar", body);
 
         assertIsSatisfied(x, y, z);
     }
 
     public void testSendToSecondWhen() throws Exception {
-        y.expectedBodiesReceived("two");
+        String body = "<two/>";
+        y.expectedBodiesReceived(body);
         expectsMessageCount(0, x, z);
 
-        sendMessage("cheese", "two");
+        sendMessage("cheese", body);
 
         assertIsSatisfied(x, y, z);
     }
 
     public void testSendToOtherwiseClause() throws Exception {
-        z.expectedBodiesReceived("three");
+        String body = "<three/>";
+        z.expectedBodiesReceived(body);
         expectsMessageCount(0, x, y);
 
-        sendMessage("somethingUndefined", "three");
+        sendMessage("somethingUndefined", body);
 
         assertIsSatisfied(x, y, z);
     }
 
     protected void sendMessage(final Object headerValue, final Object body) throws Exception
{
-        template.send(startEndpoint, new Processor() {
-            public void process(Exchange exchange) {
-                // now lets fire in a message
-                Message in = exchange.getIn();
-                in.setBody(body);
-                in.setHeader("foo", headerValue);
-            }
-        });
+        template.sendBody("direct:start", body, "foo", headerValue);
     }
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
 
-        startEndpoint = resolveMandatoryEndpoint("direct:a");
-
         x = (MockEndpoint) resolveMandatoryEndpoint("mock:x");
         y = (MockEndpoint) resolveMandatoryEndpoint("mock:y");
         z = (MockEndpoint) resolveMandatoryEndpoint("mock:z");
@@ -86,7 +74,7 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:a").choice()
+                from("direct:start").choice()
                         .when(header("foo").isEqualTo("bar")).to("mock:x")
                         .when(header("foo").isEqualTo("cheese")).to("mock:y")
                         .otherwise().to("mock:z");

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java
Thu Jul 12 04:27:11 2007
@@ -30,7 +30,7 @@
         MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         resultEndpoint.expectedMessageCount(1);
 
-        template.sendBody("direct:a", "matched", "foo", "bar");
+        template.sendBody("direct:start", "<matched/>", "foo", "bar");
 
         resultEndpoint.assertIsSatisfied();
     }
@@ -39,7 +39,7 @@
         MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         resultEndpoint.expectedMessageCount(0);
 
-        template.sendBody("direct:a", "notMatched", "foo", "notMatchedHeaderValue");
+        template.sendBody("direct:start", "<notMatched/>", "foo", "notMatchedHeaderValue");
 
         resultEndpoint.assertIsSatisfied();
     }
@@ -48,7 +48,7 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:a").filter(header("foo").isEqualTo("bar")).to("mock:result");
+                from("direct:start").filter(header("foo").isEqualTo("bar")).to("mock:result");
             }
         };
     }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
Thu Jul 12 04:27:11 2007
@@ -35,7 +35,7 @@
     public void testSendMessagesInWrongOrderButReceiveThemInCorrectOrder() throws Exception
{
         resultEndpoint.expectedBodiesReceived("Guillaume", "Hiram", "James", "Rob");
 
-        sendBodies("direct:a", "Rob", "Hiram", "Guillaume", "James");
+        sendBodies("direct:start", "Rob", "Hiram", "Guillaume", "James");
 
         resultEndpoint.assertIsSatisfied();
         List<Exchange> list = resultEndpoint.getReceivedExchanges();
@@ -55,7 +55,7 @@
         return new RouteBuilder() {
             public void configure() {
                 // START SNIPPET: example
-                from("direct:a").resequencer(body()).to("mock:result");
+                from("direct:start").resequencer(body()).to("mock:result");
                 // END SNIPPET: example
             }
         };

Modified: activemq/camel/trunk/components/camel-ftp/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/resources/log4j.properties?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/test/resources/log4j.properties (original)
+++ activemq/camel/trunk/components/camel-ftp/src/test/resources/log4j.properties Thu Jul
12 04:27:11 2007
@@ -18,8 +18,7 @@
 #
 # The logging properties used for eclipse testing, We want to see debug output on the console.
 #
-log4j.rootLogger=DEBUG, out
-#log4j.rootLogger=INFO, out
+log4j.rootLogger=WARN, out
 
 log4j.logger.org.apache.activemq=WARN
 log4j.logger.org.apache.mina=WARN

Added: activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguage.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguage.java
(added)
+++ activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguage.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.builder.script;
+
+import org.apache.camel.spi.Language;
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+import org.apache.camel.Predicate;
+
+/**
+ * @version $Revision: $
+ */
+public class ScriptLanguage implements Language {
+    private final String language;
+
+    public ScriptLanguage(String language) {
+        this.language = language;
+    }
+
+    public Predicate<Exchange> createPredicate(String expression) {
+        return new ScriptBuilder(language, expression);
+    }
+
+    public Expression<Exchange> createExpression(String expression) {
+        return new ScriptBuilder(language, expression);
+    }
+}

Added: activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguageResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguageResolver.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguageResolver.java
(added)
+++ activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptLanguageResolver.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.builder.script;
+
+import org.apache.camel.spi.LanguageResolver;
+import org.apache.camel.spi.Language;
+import org.apache.camel.CamelContext;
+
+/**
+ * @version $Revision: $
+ */
+public class ScriptLanguageResolver implements LanguageResolver {
+    public Language resolveLanguage(String name, CamelContext context) {
+        return new ScriptLanguage(name);
+    }
+}

Added: activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/language/script/GroovyLanguageTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/language/script/GroovyLanguageTest.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/language/script/GroovyLanguageTest.java
(added)
+++ activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/language/script/GroovyLanguageTest.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.language.script;
+
+import org.apache.camel.LanguageTestSupport;
+
+/**
+ * @version $Revision: $
+ */
+public class GroovyLanguageTest extends LanguageTestSupport {
+    public void testGroovyExpressions() throws Exception {
+        assertExpression("exchange.in.headers.foo", "abc");
+        assertExpression("request.headers.foo", "abc");
+        //assertExpression("headers.foo", "abc");
+    }
+
+    protected String getLanguageName() {
+        return "groovy";
+    }
+}

Modified: activemq/camel/trunk/components/camel-spring/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/pom.xml?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/pom.xml (original)
+++ activemq/camel/trunk/components/camel-spring/pom.xml Thu Jul 12 04:27:11 2007
@@ -116,6 +116,7 @@
           <useFile>true</useFile>
           <excludes>
             <!-- TODO - FIXME ASAP -->
+            <exclude>**/SpringResequencerTest.*</exclude>
             <exclude>**/ContentBasedRouteTest.*</exclude>
             <exclude>**/SpringXmlRouteBuilderTest.*</exclude>
             <exclude>**/InjectedBeanTest.*</exclude>

Added: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringChoiceTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringChoiceTest.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringChoiceTest.java
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringChoiceTest.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ChoiceTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision: $
+ */
+public class SpringChoiceTest extends ChoiceTest {
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/choice.xml");
+    }
+}
\ No newline at end of file

Added: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFilterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFilterTest.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFilterTest.java
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFilterTest.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.FilterTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision: $
+ */
+public class SpringFilterTest extends FilterTest {
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/filter.xml");
+    }
+}

Added: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringResequencerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringResequencerTest.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringResequencerTest.java
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringResequencerTest.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ResequencerTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision: $
+ */
+public class SpringResequencerTest extends ResequencerTest {
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/resequencer.xml");
+    }
+}
\ No newline at end of file

Added: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Service;
+import org.apache.camel.spring.SpringCamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision: $
+ */
+public class SpringTestHelper {
+    public static CamelContext createSpringCamelContext(ContextTestSupport test, String classpathUri)
throws Exception {
+        test.setUseRouteBuilder(false);
+
+        final ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(classpathUri);
+        test.setCamelContextService(new Service() {
+            public void start() throws Exception {
+                applicationContext.start();
+
+            }
+
+            public void stop() throws Exception {
+                applicationContext.stop();
+            }
+        });
+
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+}

Copied: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterTest.java
(from r555223, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterTest.java?view=diff&rev=555584&p1=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java&r1=555223&p2=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterTest.java&r2=555584
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterTest.java
Thu Jul 12 04:27:11 2007
@@ -15,58 +15,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.processor;
+package org.apache.camel.spring.processor;
 
-import static org.apache.camel.builder.xml.XPathBuilder.xpath;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.Message;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.XPathBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.XPathFilterTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 /**
  * @version $Revision: 1.1 $
  */
-public class XPathFilterTest extends ContextTestSupport {
-    protected Endpoint<Exchange> startEndpoint;
-    protected MockEndpoint resultEndpoint;
-
-    public void testSendMatchingMessage() throws Exception {
-        resultEndpoint.expectedMessageCount(1);
-
-        sendBody("direct:start", "<person name='James' city='London'/>");
-
-        resultEndpoint.assertIsSatisfied();
-    }
-
-    public void testSendNotMatchingMessage() throws Exception {
-        resultEndpoint.expectedMessageCount(0);
-
-        sendBody("direct:start", "<person name='Hiram' city='Tampa'/>");
-
-        resultEndpoint.assertIsSatisfied();
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        startEndpoint = resolveMandatoryEndpoint("direct:start");
-        resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint("mock:result");
-    }
-
-    protected RouteBuilder createRouteBuilder() {
-        return new RouteBuilder() {
-            public void configure() {
-                // START SNIPPET: example
-                from("direct:start").filter(
-                        xpath("/person[@name='James']")
-                ).to("mock:result");
-                // END SNIPPET: example
-            }
-        };
+public class SpringXPathFilterTest extends XPathFilterTest {
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/xpathFilter.xml");
     }
 }

Added: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <when>
+        <xpath>$foo = 'bar'</xpath>
+        <to uri="mock:x"/>
+      </when>
+      <when>
+        <xpath>$foo = 'cheese'</xpath>
+        <to uri="mock:y"/>
+      </when>
+      <otherwise>
+        <to uri="mock:z"/>
+      </otherwise>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+</beans>

Copied: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/filter.xml
(from r555223, activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/filter.xml?view=diff&rev=555584&p1=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml&r1=555223&p2=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/filter.xml&r2=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/filter.xml
Thu Jul 12 04:27:11 2007
@@ -27,7 +27,7 @@
     <route>
       <from uri="direct:start"/>
       <filter>
-        <xpath>/person[@name='James']</xpath>
+        <xpath>$foo = 'bar'</xpath>
         <to uri="mock:result"/>
       </filter>
     </route>

Added: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencer.xml?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencer.xml
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencer.xml
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <resequencer>
+        <simple>body</simple>
+        <to uri="mock:result"/>
+      </resequencer>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+</beans>

Added: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilter.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilter.xml?view=auto&rev=555584
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilter.xml
(added)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilter.xml
Thu Jul 12 04:27:11 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <filter>
+        <xpath>/person[@name='James']</xpath>
+        <to uri="mock:result"/>
+      </filter>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+</beans>

Modified: activemq/camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/pom.xml?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/components/pom.xml (original)
+++ activemq/camel/trunk/components/pom.xml Thu Jul 12 04:27:11 2007
@@ -38,6 +38,7 @@
     <module>camel-bam</module>
     <module>camel-cxf</module>
     <module>camel-ftp</module>
+    <module>camel-juel</module>
     <module>camel-http</module>
     <module>camel-irc</module>
     <module>camel-jaxb</module>

Modified: activemq/camel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?view=diff&rev=555584&r1=555583&r2=555584
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Thu Jul 12 04:27:11 2007
@@ -194,6 +194,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-juel</artifactId>
+        <version>${camel-version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-http</artifactId>
         <version>${camel-version}</version>
       </dependency>



Mime
View raw message