You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/05/21 10:47:05 UTC

svn commit: r946936 - in /camel/trunk: camel-core/src/test/java/org/apache/camel/processor/ components/camel-spring/src/test/java/org/apache/camel/spring/processor/ components/camel-spring/src/test/resources/org/apache/camel/spring/processor/

Author: ningjiang
Date: Fri May 21 08:47:05 2010
New Revision: 946936

URL: http://svn.apache.org/viewvc?rev=946936&view=rev
Log:
CAMEL-1537 Added SpringValidateRegExpTest

Added:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java   (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml   (with props)
Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidateRegExpTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidateRegExpTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidateRegExpTest.java?rev=946936&r1=946935&r2=946936&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidateRegExpTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidateRegExpTest.java Fri May 21 08:47:05 2010
@@ -56,8 +56,9 @@ public class ValidateRegExpTest extends 
         } catch (CamelExecutionException e) {
             // expected
             assertIsInstanceOf(PredicateValidationException.class, e.getCause());
-            assertEquals("Validation failed for Predicate[bodyAs[java.lang.String].matches('^\\d{2}\\.\\d{2}\\.\\d{4}$')]."
-                + " Exchange[Message: 1.1.2010]", e.getCause().getMessage());
+            // as the Expression could be different between the DSL and simple language, here we just check part of the message 
+            assertTrue("Get a wrong exception message", e.getCause().getMessage().startsWith("Validation failed for Predicate[bodyAs[java.lang.String]"));
+            assertTrue("Get a wrong exception message", e.getCause().getMessage().endsWith("Exchange[Message: 1.1.2010]"));           
         }
 
         assertMockEndpointsSatisfied();

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java?rev=946936&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java Fri May 21 08:47:05 2010
@@ -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.ValidateRegExpTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+/**
+ * @version $Revision$
+ */
+public class SpringValidateRegExpTest extends ValidateRegExpTest {
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/validate.xml");
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml?rev=946936&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml Fri May 21 08:47:05 2010
@@ -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.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <!-- START SNIPPET: example -->
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="direct:start"/>
+            <validate>
+                <simple>${bodyAs(java.lang.String)} regex '^\d{2}\.\d{2}\.\d{4}$'</simple>            	
+            </validate>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
+
+</beans>

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml