camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1431355 - in /camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.java resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml
Date Thu, 10 Jan 2013 13:46:21 GMT
Author: davsclaus
Date: Thu Jan 10 13:46:20 2013
New Revision: 1431355

URL: http://svn.apache.org/viewvc?rev=1431355&view=rev
Log:
CAMEL-5949: XML DSL - Should not have default values in errorhandler

Added:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.java
  (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml
      - copied, changed from r1431333, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.java?rev=1431355&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.java
(added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.java
Thu Jan 10 13:46:20 2013
@@ -0,0 +1,63 @@
+/**
+ * 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.issues;
+
+import java.io.File;
+import java.io.StringWriter;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.TestCase;
+import org.apache.camel.model.Constants;
+import org.apache.camel.spring.CamelContextFactoryBean;
+import org.apache.camel.spring.SpringCamelContext;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class CamelContextModelErrorHandlerIssueTest extends TestCase {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CamelContextModelErrorHandlerIssueTest.class);
+
+    @Test
+    public void testCamelContextModel() throws Exception {
+        JAXBContext jaxbContext = JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES
+ ":org.apache.camel.spring", SpringCamelContext.class.getClassLoader());
+
+        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+        Object obj = unmarshaller.unmarshal(new File("src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml"));
+        assertNotNull(obj);
+
+        CamelContextFactoryBean context = (CamelContextFactoryBean) obj;
+
+        assertEquals("myCamel", context.getId());
+        assertEquals("dlc", context.getErrorHandlerRef());
+        assertEquals(1, context.getRoutes().size());
+
+        Marshaller marshaller = jaxbContext.createMarshaller();
+        StringWriter writer = new StringWriter();
+        marshaller.marshal(context, writer);
+
+        String s = writer.getBuffer().toString();
+        LOG.info(s);
+        assertTrue("Should have error handler", s.contains("<errorHandler"));
+        assertTrue("Should have redelivery policy", s.contains("<redeliveryPolicy"));
+    }
+}

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

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

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml
(from r1431333, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml&r1=1431333&r2=1431355&rev=1431355&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelContextModelErrorHandlerIssueTest.xml
Thu Jan 10 13:46:20 2013
@@ -1,31 +1,21 @@
 <?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.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
-
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
-        <routeBuilder ref="xxxroute"/>
-    </camelContext>
-
-    <bean id="route" class="org.apache.camel.spring.issues.MyRouteBuilder"/>
-
-</beans>
+<camelContext id="myCamel" errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
+  <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="log://deadLetterQueue">
+    <redeliveryPolicy delayPattern="1:60000;2:300000;3:3600000;4:7200000;5:14400000;6:43200000"
+                      retryAttemptedLogLevel="ERROR" asyncDelayedRedelivery="true" maximumRedeliveries="6"/>
+  </errorHandler>
+  <route>
+    <from uri="file:src/data?noop=true"/>
+    <choice>
+      <when>
+        <xpath>/person/city = 'London'</xpath>
+        <log message="UK message"/>
+        <to uri="file:target/messages/uk"/>
+      </when>
+      <otherwise>
+        <log message="Other message"/>
+        <to uri="file:target/messages/others"/>
+      </otherwise>
+    </choice>
+  </route>
+</camelContext>



Mime
View raw message