camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r563818 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/component/file/FileExchange.java test/java/org/apache/camel/component/file/FileExchangeTest.java
Date Wed, 08 Aug 2007 11:40:36 GMT
Author: jstrachan
Date: Wed Aug  8 04:40:34 2007
New Revision: 563818

URL: http://svn.apache.org/viewvc?view=rev&rev=563818
Log:
added test case for bug from James Zhang along with fix

Added:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java
  (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java?view=diff&rev=563818&r1=563817&r2=563818
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java
Wed Aug  8 04:40:34 2007
@@ -16,11 +16,12 @@
  */
 package org.apache.camel.component.file;
 
-import java.io.File;
-
 import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultExchange;
 
+import java.io.File;
+
 /**
  * A {@link Exchange} for File
  *
@@ -47,5 +48,9 @@
      */
     public void setFile(File file) {
         this.file = file;
+    }
+
+    public Exchange copy() {
+        return new FileExchange(getContext(), getFile());
     }
 }

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java?view=auto&rev=563818
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java
Wed Aug  8 04:40:34 2007
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+
+import java.io.File;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class FileExchangeTest extends ContextTestSupport {
+    
+    public void testCopy() {
+        File file = new File(FileExchangeTest.class.getResource("FileExchangeTest.class").getFile());
+
+        FileExchange fileExchange = new FileExchange(context, file);
+        Exchange exchange = fileExchange.copy();
+        FileExchange copy = assertIsInstanceOf(FileExchange.class, exchange);
+        assertEquals("File", file, copy.getFile());
+    }
+}
\ No newline at end of file

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message