camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r904429 - in /camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/issues/ resources/org/apache/camel/spring/issues/
Date Fri, 29 Jan 2010 09:14:43 GMT
Author: davsclaus
Date: Fri Jan 29 09:14:40 2010
New Revision: 904429

URL: http://svn.apache.org/viewvc?rev=904429&view=rev
Log:
Added unit test based on issue with renaming file on Windows

Added:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.java
  (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.xml
      - copied, changed from r904390, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/stringDataFormatTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/validate.xsd
  (with props)

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.java?rev=904429&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.java
(added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.java
Fri Jan 29 09:14:40 2010
@@ -0,0 +1,53 @@
+/**
+ * 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 org.apache.camel.Exchange;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringRenameFileOnCommitIssueTest extends SpringTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        deleteDirectory("./target/renameissue");
+        super.setUp();
+    }
+
+    public void testFileRenameFileOnCommitIssue() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedFileExists("./target/renameissue/.camel/hello.xml");
+
+        String body = "<?xml version=\"1.0\"?><persons xmlns=\"http://foo.com/bar\"><person
name=\"James\"/><person name=\"Claus\"/></persons>";
+
+        template.sendBodyAndHeader("file://target/renameissue", body, Exchange.FILE_NAME,
"hello.xml");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.xml");
+    }
+
+}

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

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

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.xml
(from r904390, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/stringDataFormatTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/stringDataFormatTest.xml&r1=904390&r2=904429&rev=904429&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/stringDataFormatTest.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringRenameFileOnCommitIssueTest.xml
Fri Jan 29 09:14:40 2010
@@ -22,25 +22,22 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-    <bean id="xs" class="org.apache.camel.model.dataformat.StringDataFormat">
-        <property name="charset" value="utf-8"/>
-    </bean>
 
-    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+    <camelContext trace="true" id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
-            <from uri="direct:marshal"/>
-            <!-- using a bean id -->
-            <marshal ref="xs"/>
-            <to uri="mock:marshal"/>
+            <from uri="file://target/renameissue?noop=false"/>
+            <setProperty propertyName="PartitionID">
+                <xpath>//persons/person[1]/@name</xpath>
+            </setProperty>
+            <convertBodyTo type="String"/>
+            <to uri="validator:org/apache/camel/spring/issues/validate.xsd"/>
+            <inOut uri="direct:source"/>
+            <to uri="mock:result"/>
         </route>
 
         <route>
-            <from uri="direct:unmarshal"/>
-            <!-- using a child node -->
-            <unmarshal>
-                <string charset="UTF-8"/>
-            </unmarshal>
-            <to uri="mock:unmarshal"/>
+            <from uri="direct:source"/>
+            <transform><constant>Hello World</constant></transform>
         </route>
     </camelContext>
 

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/validate.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/validate.xsd?rev=904429&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/validate.xsd
(added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/validate.xsd
Fri Jan 29 09:14:40 2010
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+    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.
+-->
+<xs:schema elementFormDefault="qualified" version="1.0"
+           targetNamespace="http://foo.com/bar"
+           xmlns:tns="http://foo.com/bar"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" type="tns:person" maxOccurs="unbounded"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:complexType name="person">
+        <xs:attribute name="name"/>
+    </xs:complexType>
+
+</xs:schema>
+

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

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

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



Mime
View raw message