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 2009/01/12 09:30:08 UTC
svn commit: r733650 [1/4] - in /activemq/camel/trunk:
camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/component/file/
camel-core/src/main/java/org/apache/camel/model/
camel-core/src/main/java/org/apache/camel/model/...
Author: ningjiang
Date: Mon Jan 12 00:30:05 2009
New Revision: 733650
URL: http://svn.apache.org/viewvc?rev=733650&view=rev
Log:
Fixed the svn properties by running the svn_apply_autoprops.py
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/package-info.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ScatterGatherTest.java (props changed)
activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java (props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/NoOpRemoteFileProcessStrategy.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/RemoteFileExpressionRenamer.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/RemoteFileProcessStrategyFactory.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/RemoteFileProcessStrategySupport.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/RemoteFileRenameExclusiveReadLockStrategy.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/RemoteFileRenamer.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/RenameRemoteFileProcessStrategy.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPreMoveFileExpressionTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByExpressionTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByIgnoreCaseExpressionTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSortByNestedExpressionTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIdempotentRefTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java (contents, props changed)
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpIllegalOptionsTest.java (contents, props changed)
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/config/JmsEndpointWithCustomDestinationTest.java (contents, props changed)
activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/config/JmsEndpointWithCustomDestinationTest-context.xml (props changed)
activemq/camel/trunk/components/camel-mvel/pom.xml (props changed)
activemq/camel/trunk/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MVEL.java (props changed)
activemq/camel/trunk/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelExpression.java (props changed)
activemq/camel/trunk/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/MvelLanguage.java (contents, props changed)
activemq/camel/trunk/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/RootObject.java (props changed)
activemq/camel/trunk/components/camel-mvel/src/main/java/org/apache/camel/language/mvel/package.html (props changed)
activemq/camel/trunk/components/camel-mvel/src/main/resources/META-INF/LICENSE.txt (props changed)
activemq/camel/trunk/components/camel-mvel/src/main/resources/META-INF/NOTICE.txt (props changed)
activemq/camel/trunk/components/camel-mvel/src/test/java/org/apache/camel/language/mvel/MvelTest.java (props changed)
activemq/camel/trunk/components/camel-mvel/src/test/resources/jndi.properties (props changed)
activemq/camel/trunk/components/camel-mvel/src/test/resources/log4j.properties (props changed)
activemq/camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/AggregateRssFeedCollection.java (props changed)
activemq/camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/AggregateRssFeedStrategy.java (props changed)
activemq/camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssDateComparator.java (props changed)
activemq/camel/trunk/components/camel-rss/src/main/resources/META-INF/LICENSE.txt (props changed)
activemq/camel/trunk/components/camel-rss/src/main/resources/META-INF/NOTICE.txt (props changed)
activemq/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssCustomAggregatorTest.java (props changed)
activemq/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssEntrySortDefaultsTest.java (props changed)
activemq/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssEntrySortTest.java (props changed)
activemq/camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssFilterTest.java (props changed)
activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SThreadType.scala (props changed)
activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ThreadTest.scala (props changed)
activemq/camel/trunk/components/camel-spring-javaconfig/src/test/resources/log4j.properties (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/EndpointUriSetFromSpringTest.java (contents, props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/SpringOnExceptionSubRouteTest.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/EndpointUriSetFromSpringTest-context.xml (props changed)
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionSubRouteTest.xml (props changed)
activemq/camel/trunk/components/camel-tagsoup/pom.xml (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/main/java/org/apache/camel/dataformat/tagsoup/TidyMarkupDataFormat.java (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/main/resources/META-INF/LICENSE.txt (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/main/resources/META-INF/NOTICE.txt (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupDataFormatAsDomNodeTest.java (contents, props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupDataFormatAsStringTest.java (contents, props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupDataFormatWithUnmarshalTypeTest.java (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupTestSupport.java (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/resources/log4j.properties (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/resources/org/apache/camel/dataformat/tagsoup/testfile1.html (props changed)
activemq/camel/trunk/components/camel-tagsoup/src/test/resources/org/apache/camel/dataformat/tagsoup/testfile2-evilHtml.html (props changed)
activemq/camel/trunk/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/GoogleTalkTest.java (props changed)
activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java (contents, props changed)
activemq/camel/trunk/tests/camel-itest/src/test/resources/users.properties (props changed)
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java Mon Jan 12 00:30:05 2009
@@ -1,44 +1,44 @@
-/**
- * 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 java.io.File;
-
-/**
- * Strategy for acquiring exclusive read locks for files to be consumed.
- * After granting the read lock it is realeased, we just want to make sure that when we start
- * consuming the file its not currently in progress of being written by third party.
- * <p/>
- * Camel supports out of the box the following strategies:
- * <ul>
- * <li>FileLockExclusiveReadLockStrategy using {@link java.nio.channels.FileLock}</li>
- * <li>FileRenameExclusiveReadLockStrategy waiting until its possible to rename the file. Can be used on file
- * systems where the FileLock isn't supported.</li>
- * </ul>
- */
-public interface ExclusiveReadLockStrategy {
-
- /**
- * Acquires exclusive read lock to the file.
- *
- * @param file the file
- * @return <tt>true</tt> if read lock was acquired.
- * If <tt>false</tt> Camel will skip the file and try it on the next poll
- */
- boolean acquireExclusiveReadLock(File file);
-
-}
+/**
+ * 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 java.io.File;
+
+/**
+ * Strategy for acquiring exclusive read locks for files to be consumed.
+ * After granting the read lock it is realeased, we just want to make sure that when we start
+ * consuming the file its not currently in progress of being written by third party.
+ * <p/>
+ * Camel supports out of the box the following strategies:
+ * <ul>
+ * <li>FileLockExclusiveReadLockStrategy using {@link java.nio.channels.FileLock}</li>
+ * <li>FileRenameExclusiveReadLockStrategy waiting until its possible to rename the file. Can be used on file
+ * systems where the FileLock isn't supported.</li>
+ * </ul>
+ */
+public interface ExclusiveReadLockStrategy {
+
+ /**
+ * Acquires exclusive read lock to the file.
+ *
+ * @param file the file
+ * @return <tt>true</tt> if read lock was acquired.
+ * If <tt>false</tt> Camel will skip the file and try it on the next poll
+ */
+ boolean acquireExclusiveReadLock(File file);
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/ExclusiveReadLockStrategy.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java Mon Jan 12 00:30:05 2009
@@ -26,7 +26,7 @@
/**
* Represents an XML <inOnly/> element
*
- * @version $Revision: 725058 $
+ * @version $Revision$
*/
@XmlRootElement(name = "inOnly")
@XmlAccessorType(XmlAccessType.FIELD)
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java Mon Jan 12 00:30:05 2009
@@ -34,7 +34,7 @@
/**
* Base class for sending to an endpoint with an optional {@link ExchangePattern}
*
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
//@XmlType(name = "sendType")
@XmlAccessorType(XmlAccessType.FIELD)
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java Mon Jan 12 00:30:05 2009
@@ -1,82 +1,82 @@
-/**
- * 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 java.io.File;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.converter.IOConverter;
-
-/**
- * Unit test for the FileRenameStrategy using preMoveExpression and expression options
- */
-public class FileConsumerBeginAndCommitExpressionRenameStrategyTest extends ContextTestSupport {
-
- public void testRenameSuccess() throws Exception {
- deleteDirectory("target/inprogress");
- deleteDirectory("target/done");
- deleteDirectory("target/reports");
-
- MockEndpoint mock = getMockEndpoint("mock:report");
- mock.expectedMessageCount(1);
- mock.expectedBodiesReceived("Hello Paris");
-
- template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
-
- mock.assertIsSatisfied();
-
- // sleep to let the file consumer do its renaming
- Thread.sleep(100);
-
- // content of file should be Hello Paris
- String content = IOConverter.toString(new File("./target/done/paris.bak"));
- assertEquals("The file should have been renamed", "Hello Paris", content);
- }
-
- public void testIllegalOptions() throws Exception {
- try {
- context.getEndpoint("file://target?expression=../done/${file:name}&delete=true").createConsumer(new Processor() {
- public void process(Exchange exchange) throws Exception {
- }
- });
- fail("Should have thrown an exception");
- } catch (IllegalArgumentException e) {
- // ok
- }
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() throws Exception {
- from("file://target/reports?preMoveExpression=../inprogress/${file:name.noext}.bak&expression=../done/${file:name}&consumer.delay=5000")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- FileExchange fe = (FileExchange) exchange;
- assertEquals("The file should have been move to inprogress",
- "inprogress", fe.getFile().getParentFile().getName());
- }
- })
- .to("mock:report");
- }
- };
- }
-
+/**
+ * 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 java.io.File;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.converter.IOConverter;
+
+/**
+ * Unit test for the FileRenameStrategy using preMoveExpression and expression options
+ */
+public class FileConsumerBeginAndCommitExpressionRenameStrategyTest extends ContextTestSupport {
+
+ public void testRenameSuccess() throws Exception {
+ deleteDirectory("target/inprogress");
+ deleteDirectory("target/done");
+ deleteDirectory("target/reports");
+
+ MockEndpoint mock = getMockEndpoint("mock:report");
+ mock.expectedMessageCount(1);
+ mock.expectedBodiesReceived("Hello Paris");
+
+ template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
+
+ mock.assertIsSatisfied();
+
+ // sleep to let the file consumer do its renaming
+ Thread.sleep(100);
+
+ // content of file should be Hello Paris
+ String content = IOConverter.toString(new File("./target/done/paris.bak"));
+ assertEquals("The file should have been renamed", "Hello Paris", content);
+ }
+
+ public void testIllegalOptions() throws Exception {
+ try {
+ context.getEndpoint("file://target?expression=../done/${file:name}&delete=true").createConsumer(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ }
+ });
+ fail("Should have thrown an exception");
+ } catch (IllegalArgumentException e) {
+ // ok
+ }
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("file://target/reports?preMoveExpression=../inprogress/${file:name.noext}.bak&expression=../done/${file:name}&consumer.delay=5000")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ FileExchange fe = (FileExchange) exchange;
+ assertEquals("The file should have been move to inprogress",
+ "inprogress", fe.getFile().getParentFile().getName());
+ }
+ })
+ .to("mock:report");
+ }
+ };
+ }
+
}
\ No newline at end of file
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java Mon Jan 12 00:30:05 2009
@@ -1,92 +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.component.file;
-
-import java.io.File;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.converter.IOConverter;
-
-/**
- * Unit test for the FileRenameStrategy using preMove and move options
- */
-public class FileConsumerBeginAndCommitRenameStrategyTest extends ContextTestSupport {
-
- public void testRenameSuccess() throws Exception {
- deleteDirectory("target/inprogress");
- deleteDirectory("target/done");
- deleteDirectory("target/reports");
-
- MockEndpoint mock = getMockEndpoint("mock:report");
- mock.expectedMessageCount(1);
- mock.expectedBodiesReceived("Hello Paris");
-
- template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
-
- mock.assertIsSatisfied();
-
- // sleep to let the file consumer do its renaming
- Thread.sleep(100);
-
- // content of file should be Hello Paris
- String content = IOConverter.toString(new File("./target/done/paris.txt"));
- assertEquals("The file should have been renamed", "Hello Paris", content);
- }
-
- public void testIllegalOptions() throws Exception {
- try {
- context.getEndpoint("file://target?moveNamePrefix=../done/&delete=true").createConsumer(new Processor() {
- public void process(Exchange exchange) throws Exception {
- }
- });
- fail("Should have thrown an exception");
- } catch (IllegalArgumentException e) {
- // ok
- }
-
- try {
- context.getEndpoint("file://target?expression=${file:name.noext}.bak&delete=true").createConsumer(new Processor() {
- public void process(Exchange exchange) throws Exception {
- }
- });
- fail("Should have thrown an exception");
- } catch (IllegalArgumentException e) {
- // ok
- }
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() throws Exception {
- from("file://target/reports?preMoveNamePrefix=../inprogress/&moveNamePrefix=../done/&consumer.delay=5000")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- FileExchange fe = (FileExchange) exchange;
- assertEquals("The file should have been move to inprogress",
- "inprogress", fe.getFile().getParentFile().getName());
- }
- })
- .to("mock:report");
- }
- };
- }
-
+/**
+ * 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 java.io.File;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.converter.IOConverter;
+
+/**
+ * Unit test for the FileRenameStrategy using preMove and move options
+ */
+public class FileConsumerBeginAndCommitRenameStrategyTest extends ContextTestSupport {
+
+ public void testRenameSuccess() throws Exception {
+ deleteDirectory("target/inprogress");
+ deleteDirectory("target/done");
+ deleteDirectory("target/reports");
+
+ MockEndpoint mock = getMockEndpoint("mock:report");
+ mock.expectedMessageCount(1);
+ mock.expectedBodiesReceived("Hello Paris");
+
+ template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
+
+ mock.assertIsSatisfied();
+
+ // sleep to let the file consumer do its renaming
+ Thread.sleep(100);
+
+ // content of file should be Hello Paris
+ String content = IOConverter.toString(new File("./target/done/paris.txt"));
+ assertEquals("The file should have been renamed", "Hello Paris", content);
+ }
+
+ public void testIllegalOptions() throws Exception {
+ try {
+ context.getEndpoint("file://target?moveNamePrefix=../done/&delete=true").createConsumer(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ }
+ });
+ fail("Should have thrown an exception");
+ } catch (IllegalArgumentException e) {
+ // ok
+ }
+
+ try {
+ context.getEndpoint("file://target?expression=${file:name.noext}.bak&delete=true").createConsumer(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ }
+ });
+ fail("Should have thrown an exception");
+ } catch (IllegalArgumentException e) {
+ // ok
+ }
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("file://target/reports?preMoveNamePrefix=../inprogress/&moveNamePrefix=../done/&consumer.delay=5000")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ FileExchange fe = (FileExchange) exchange;
+ assertEquals("The file should have been move to inprogress",
+ "inprogress", fe.getFile().getParentFile().getName());
+ }
+ })
+ .to("mock:report");
+ }
+ };
+ }
+
}
\ No newline at end of file
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java Mon Jan 12 00:30:05 2009
@@ -1,86 +1,86 @@
-/**
- * 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 java.io.File;
-import java.io.FileWriter;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-
-/**
- * Unit test for the FileRenameStrategy using preMoveExpression options
- */
-public class FileConsumerBeginExpressionRenameStrategyTest extends ContextTestSupport {
-
- public void testRenameSuccess() throws Exception {
- deleteDirectory("target/inprogress");
- deleteDirectory("target/reports");
-
- MockEndpoint mock = getMockEndpoint("mock:report");
- mock.expectedMessageCount(1);
- mock.expectedBodiesReceived("Hello Paris");
-
- template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
-
- Thread.sleep(100);
-
- mock.assertIsSatisfied();
- }
-
- public void testRenameFileExists() throws Exception {
- deleteDirectory("target/inprogress");
- deleteDirectory("target/reports");
-
- // create a file in inprogress to let there be a duplicate file
- File file = new File("target/inprogress");
- file.mkdirs();
- FileWriter fw = new FileWriter("./target/inprogress/london.bak");
- fw.write("I was there once in London");
- fw.flush();
- fw.close();
-
- MockEndpoint mock = getMockEndpoint("mock:report");
- mock.expectedBodiesReceived("Hello London");
-
- template.sendBodyAndHeader("file:target/reports", "Hello London", FileComponent.HEADER_FILE_NAME, "london.txt");
-
- Thread.sleep(100);
-
- mock.assertIsSatisfied();
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() throws Exception {
- from("file://target/reports?preMoveExpression=../inprogress/${file:name.noext}.bak&consumer.delay=5000")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- FileExchange fe = (FileExchange) exchange;
- assertEquals("The file should have been move to inprogress",
- "inprogress", fe.getFile().getParentFile().getName());
- }
- })
- .to("mock:report");
- }
- };
- }
-
+/**
+ * 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 java.io.File;
+import java.io.FileWriter;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * Unit test for the FileRenameStrategy using preMoveExpression options
+ */
+public class FileConsumerBeginExpressionRenameStrategyTest extends ContextTestSupport {
+
+ public void testRenameSuccess() throws Exception {
+ deleteDirectory("target/inprogress");
+ deleteDirectory("target/reports");
+
+ MockEndpoint mock = getMockEndpoint("mock:report");
+ mock.expectedMessageCount(1);
+ mock.expectedBodiesReceived("Hello Paris");
+
+ template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
+
+ Thread.sleep(100);
+
+ mock.assertIsSatisfied();
+ }
+
+ public void testRenameFileExists() throws Exception {
+ deleteDirectory("target/inprogress");
+ deleteDirectory("target/reports");
+
+ // create a file in inprogress to let there be a duplicate file
+ File file = new File("target/inprogress");
+ file.mkdirs();
+ FileWriter fw = new FileWriter("./target/inprogress/london.bak");
+ fw.write("I was there once in London");
+ fw.flush();
+ fw.close();
+
+ MockEndpoint mock = getMockEndpoint("mock:report");
+ mock.expectedBodiesReceived("Hello London");
+
+ template.sendBodyAndHeader("file:target/reports", "Hello London", FileComponent.HEADER_FILE_NAME, "london.txt");
+
+ Thread.sleep(100);
+
+ mock.assertIsSatisfied();
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("file://target/reports?preMoveExpression=../inprogress/${file:name.noext}.bak&consumer.delay=5000")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ FileExchange fe = (FileExchange) exchange;
+ assertEquals("The file should have been move to inprogress",
+ "inprogress", fe.getFile().getParentFile().getName());
+ }
+ })
+ .to("mock:report");
+ }
+ };
+ }
+
}
\ No newline at end of file
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java Mon Jan 12 00:30:05 2009
@@ -1,86 +1,86 @@
-/**
- * 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 java.io.File;
-import java.io.FileWriter;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-
-/**
- * Unit test for the FileRenameStrategy using preMove options
- */
-public class FileConsumerBeginRenameStrategyTest extends ContextTestSupport {
-
- public void testRenameSuccess() throws Exception {
- deleteDirectory("target/inprogress");
- deleteDirectory("target/reports");
-
- MockEndpoint mock = getMockEndpoint("mock:report");
- mock.expectedMessageCount(1);
- mock.expectedBodiesReceived("Hello Paris");
-
- template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
-
- Thread.sleep(100);
-
- mock.assertIsSatisfied();
- }
-
- public void testRenameFileExists() throws Exception {
- deleteDirectory("target/inprogress");
- deleteDirectory("target/reports");
-
- // create a file in inprogress to let there be a duplicate file
- File file = new File("target/inprogress");
- file.mkdirs();
- FileWriter fw = new FileWriter("./target/inprogress/london.txt");
- fw.write("I was there once in London");
- fw.flush();
- fw.close();
-
- MockEndpoint mock = getMockEndpoint("mock:report");
- mock.expectedBodiesReceived("Hello London");
-
- template.sendBodyAndHeader("file:target/reports", "Hello London", FileComponent.HEADER_FILE_NAME, "london.txt");
-
- Thread.sleep(100);
-
- mock.assertIsSatisfied();
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() throws Exception {
- from("file://target/reports?preMoveNamePrefix=../inprogress/&consumer.delay=5000")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- FileExchange fe = (FileExchange) exchange;
- assertEquals("The file should have been move to inprogress",
- "inprogress", fe.getFile().getParentFile().getName());
- }
- })
- .to("mock:report");
- }
- };
- }
-
+/**
+ * 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 java.io.File;
+import java.io.FileWriter;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * Unit test for the FileRenameStrategy using preMove options
+ */
+public class FileConsumerBeginRenameStrategyTest extends ContextTestSupport {
+
+ public void testRenameSuccess() throws Exception {
+ deleteDirectory("target/inprogress");
+ deleteDirectory("target/reports");
+
+ MockEndpoint mock = getMockEndpoint("mock:report");
+ mock.expectedMessageCount(1);
+ mock.expectedBodiesReceived("Hello Paris");
+
+ template.sendBodyAndHeader("file:target/reports", "Hello Paris", FileComponent.HEADER_FILE_NAME, "paris.txt");
+
+ Thread.sleep(100);
+
+ mock.assertIsSatisfied();
+ }
+
+ public void testRenameFileExists() throws Exception {
+ deleteDirectory("target/inprogress");
+ deleteDirectory("target/reports");
+
+ // create a file in inprogress to let there be a duplicate file
+ File file = new File("target/inprogress");
+ file.mkdirs();
+ FileWriter fw = new FileWriter("./target/inprogress/london.txt");
+ fw.write("I was there once in London");
+ fw.flush();
+ fw.close();
+
+ MockEndpoint mock = getMockEndpoint("mock:report");
+ mock.expectedBodiesReceived("Hello London");
+
+ template.sendBodyAndHeader("file:target/reports", "Hello London", FileComponent.HEADER_FILE_NAME, "london.txt");
+
+ Thread.sleep(100);
+
+ mock.assertIsSatisfied();
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("file://target/reports?preMoveNamePrefix=../inprogress/&consumer.delay=5000")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ FileExchange fe = (FileExchange) exchange;
+ assertEquals("The file should have been move to inprogress",
+ "inprogress", fe.getFile().getParentFile().getName());
+ }
+ })
+ .to("mock:report");
+ }
+ };
+ }
+
}
\ No newline at end of file
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java Mon Jan 12 00:30:05 2009
@@ -1,83 +1,83 @@
-/**
- * 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 java.io.File;
-import java.io.FileOutputStream;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Unit test to verify exclusive read option using *none*
- */
-public class FileExclusiveReadNoneStrategyTest extends ContextTestSupport {
-
- private static final Log LOG = LogFactory.getLog(FileExclusiveReadNoneStrategyTest.class);
- private String fileUrl = "file://target/exclusiveread/slowfile?noop=true&consumer.delay=500&readLock=none";
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("seda:start").process(new MySlowFileProcessor());
- from(fileUrl + "&readLockTimeout=1000").to("mock:result");
- }
- };
- }
-
- public void testPollFileWhileSlowFileIsBeingWritten() throws Exception {
- deleteDirectory("./target/exclusiveread");
- createDirectory("./target/exclusiveread/slowfile");
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMessageCount(1);
-
- // send a message to seda:start to trigger the creating of the slowfile to poll
- template.sendBody("seda:start", "Create the slow file");
-
- mock.assertIsSatisfied();
-
- String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
- LOG.debug("Body is: " + body);
- assertFalse("Should not wait and read the entire file", body.endsWith("Bye World"));
- }
-
- private class MySlowFileProcessor implements Processor {
-
- public void process(Exchange exchange) throws Exception {
- LOG.info("Creating a slow file with no locks...");
- File file = new File("./target/exclusiveread/slowfile/hello.txt");
- FileOutputStream fos = new FileOutputStream(file);
- fos.write("Hello World".getBytes());
- for (int i = 0; i < 3; i++) {
- Thread.sleep(1000);
- fos.write(("Line #" + i).getBytes());
- LOG.info("Appending to slowfile");
- }
- fos.write("Bye World".getBytes());
- fos.close();
- LOG.info("... done creating slowfile");
- }
- }
-
+/**
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Unit test to verify exclusive read option using *none*
+ */
+public class FileExclusiveReadNoneStrategyTest extends ContextTestSupport {
+
+ private static final Log LOG = LogFactory.getLog(FileExclusiveReadNoneStrategyTest.class);
+ private String fileUrl = "file://target/exclusiveread/slowfile?noop=true&consumer.delay=500&readLock=none";
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("seda:start").process(new MySlowFileProcessor());
+ from(fileUrl + "&readLockTimeout=1000").to("mock:result");
+ }
+ };
+ }
+
+ public void testPollFileWhileSlowFileIsBeingWritten() throws Exception {
+ deleteDirectory("./target/exclusiveread");
+ createDirectory("./target/exclusiveread/slowfile");
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ // send a message to seda:start to trigger the creating of the slowfile to poll
+ template.sendBody("seda:start", "Create the slow file");
+
+ mock.assertIsSatisfied();
+
+ String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
+ LOG.debug("Body is: " + body);
+ assertFalse("Should not wait and read the entire file", body.endsWith("Bye World"));
+ }
+
+ private class MySlowFileProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ LOG.info("Creating a slow file with no locks...");
+ File file = new File("./target/exclusiveread/slowfile/hello.txt");
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write("Hello World".getBytes());
+ for (int i = 0; i < 3; i++) {
+ Thread.sleep(1000);
+ fos.write(("Line #" + i).getBytes());
+ LOG.info("Appending to slowfile");
+ }
+ fos.write("Bye World".getBytes());
+ fos.close();
+ LOG.info("... done creating slowfile");
+ }
+ }
+
}
\ No newline at end of file
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java Mon Jan 12 00:30:05 2009
@@ -25,7 +25,7 @@
import org.apache.camel.component.mock.MockEndpoint;
/**
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class FromEndpointTest extends ContextTestSupport {
private MockEndpoint results;
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ScatterGatherTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java Mon Jan 12 00:30:05 2009
@@ -1,143 +1,143 @@
-/**
- * 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.remote;
-
-import java.util.Comparator;
-
-import org.apache.camel.Expression;
-import org.apache.camel.language.simple.FileLanguage;
-import org.apache.camel.util.ObjectHelper;
-
-/**
- * Default remote file sorter.
- */
-public final class DefaultRemoteFileSorter {
-
- private DefaultRemoteFileSorter() {
- }
-
- /**
- * Returns a new sort by name
- */
- public static Comparator<RemoteFile> sortByName(final boolean reverse) {
- return new Comparator<RemoteFile>() {
- public int compare(RemoteFile o1, RemoteFile o2) {
- int answer = o1.getFileName().compareTo(o2.getFileName());
- return reverse ? -1 * answer : answer;
- }
- };
- }
-
- /**
- * Returns a new sort by path name
- */
- public static Comparator<RemoteFile> sortByPathName(final boolean reverse) {
- return new Comparator<RemoteFile>() {
- public int compare(RemoteFile o1, RemoteFile o2) {
- int answer = o1.getParent().compareTo(o2.getParent());
- return reverse ? -1 * answer : answer;
- }
- };
- }
-
- /**
- * Returns a new sort by last modified (newest first)
- */
- public static Comparator<RemoteFile> sortByLastModified(final boolean reverse) {
- return new Comparator<RemoteFile>() {
- public int compare(RemoteFile o1, RemoteFile o2) {
- long delta = o1.getLastModified() - o2.getLastModified();
- if (delta == 0) {
- return 0;
- }
- int answer = delta > 0 ? 1 : -1;
- return reverse ? -1 * answer : answer;
- }
- };
- }
-
- /**
- * Returns a new sort by file size (smallest first)
- */
- public static Comparator<RemoteFile> sortBySize(final boolean reverse) {
- return new Comparator<RemoteFile>() {
- public int compare(RemoteFile o1, RemoteFile o2) {
- long delta = o1.getFileLength() - o2.getFileLength();
- if (delta == 0) {
- return 0;
- }
- int answer = delta > 0 ? 1 : -1;
- return reverse ? -1 * answer : answer;
- }
- };
- }
-
- /**
- * Returns a new sory by file language expression
- *
- * @param expression the file language expression
- * @param reverse true to reverse order
- * @return the comparator
- */
- public static Comparator<RemoteFileExchange> sortByFileLanguage(final String expression, final boolean reverse) {
- return sortByFileLanguage(expression, reverse, false, null);
- }
-
- /**
- * Returns a new sory by file language expression
- *
- * @param expression the file language expression
- * @param reverse true to reverse order
- * @param ignoreCase ignore case if comparing strings
- * @return the comparator
- */
- public static Comparator<RemoteFileExchange> sortByFileLanguage(final String expression, final boolean reverse,
- final boolean ignoreCase) {
- return sortByFileLanguage(expression, reverse, ignoreCase, null);
- }
-
- /**
- * Returns a new sory by file language expression
- *
- * @param expression the file language expression
- * @param reverse true to reverse order
- * @param ignoreCase ignore case if comparing strings
- * @param nested nested comparator for sub group sorting, can be null
- * @return the comparator
- */
- public static Comparator<RemoteFileExchange> sortByFileLanguage(final String expression, final boolean reverse,
- final boolean ignoreCase, final Comparator<RemoteFileExchange> nested) {
- return new Comparator<RemoteFileExchange>() {
- public int compare(RemoteFileExchange o1, RemoteFileExchange o2) {
- final Expression exp = FileLanguage.file(expression);
- Object result1 = exp.evaluate(o1);
- Object result2 = exp.evaluate(o2);
- int answer = ObjectHelper.compare(result1, result2, ignoreCase);
- // if equal then sub sort by nested comparator
- if (answer == 0 && nested != null) {
- answer = nested.compare(o1, o2);
- }
- return reverse ? -1 * answer : answer;
- }
-
- public String toString() {
- return expression + (nested != null ? ";" + nested.toString() : "");
- }
- };
- }
-
-}
+/**
+ * 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.remote;
+
+import java.util.Comparator;
+
+import org.apache.camel.Expression;
+import org.apache.camel.language.simple.FileLanguage;
+import org.apache.camel.util.ObjectHelper;
+
+/**
+ * Default remote file sorter.
+ */
+public final class DefaultRemoteFileSorter {
+
+ private DefaultRemoteFileSorter() {
+ }
+
+ /**
+ * Returns a new sort by name
+ */
+ public static Comparator<RemoteFile> sortByName(final boolean reverse) {
+ return new Comparator<RemoteFile>() {
+ public int compare(RemoteFile o1, RemoteFile o2) {
+ int answer = o1.getFileName().compareTo(o2.getFileName());
+ return reverse ? -1 * answer : answer;
+ }
+ };
+ }
+
+ /**
+ * Returns a new sort by path name
+ */
+ public static Comparator<RemoteFile> sortByPathName(final boolean reverse) {
+ return new Comparator<RemoteFile>() {
+ public int compare(RemoteFile o1, RemoteFile o2) {
+ int answer = o1.getParent().compareTo(o2.getParent());
+ return reverse ? -1 * answer : answer;
+ }
+ };
+ }
+
+ /**
+ * Returns a new sort by last modified (newest first)
+ */
+ public static Comparator<RemoteFile> sortByLastModified(final boolean reverse) {
+ return new Comparator<RemoteFile>() {
+ public int compare(RemoteFile o1, RemoteFile o2) {
+ long delta = o1.getLastModified() - o2.getLastModified();
+ if (delta == 0) {
+ return 0;
+ }
+ int answer = delta > 0 ? 1 : -1;
+ return reverse ? -1 * answer : answer;
+ }
+ };
+ }
+
+ /**
+ * Returns a new sort by file size (smallest first)
+ */
+ public static Comparator<RemoteFile> sortBySize(final boolean reverse) {
+ return new Comparator<RemoteFile>() {
+ public int compare(RemoteFile o1, RemoteFile o2) {
+ long delta = o1.getFileLength() - o2.getFileLength();
+ if (delta == 0) {
+ return 0;
+ }
+ int answer = delta > 0 ? 1 : -1;
+ return reverse ? -1 * answer : answer;
+ }
+ };
+ }
+
+ /**
+ * Returns a new sory by file language expression
+ *
+ * @param expression the file language expression
+ * @param reverse true to reverse order
+ * @return the comparator
+ */
+ public static Comparator<RemoteFileExchange> sortByFileLanguage(final String expression, final boolean reverse) {
+ return sortByFileLanguage(expression, reverse, false, null);
+ }
+
+ /**
+ * Returns a new sory by file language expression
+ *
+ * @param expression the file language expression
+ * @param reverse true to reverse order
+ * @param ignoreCase ignore case if comparing strings
+ * @return the comparator
+ */
+ public static Comparator<RemoteFileExchange> sortByFileLanguage(final String expression, final boolean reverse,
+ final boolean ignoreCase) {
+ return sortByFileLanguage(expression, reverse, ignoreCase, null);
+ }
+
+ /**
+ * Returns a new sory by file language expression
+ *
+ * @param expression the file language expression
+ * @param reverse true to reverse order
+ * @param ignoreCase ignore case if comparing strings
+ * @param nested nested comparator for sub group sorting, can be null
+ * @return the comparator
+ */
+ public static Comparator<RemoteFileExchange> sortByFileLanguage(final String expression, final boolean reverse,
+ final boolean ignoreCase, final Comparator<RemoteFileExchange> nested) {
+ return new Comparator<RemoteFileExchange>() {
+ public int compare(RemoteFileExchange o1, RemoteFileExchange o2) {
+ final Expression exp = FileLanguage.file(expression);
+ Object result1 = exp.evaluate(o1);
+ Object result2 = exp.evaluate(o2);
+ int answer = ObjectHelper.compare(result1, result2, ignoreCase);
+ // if equal then sub sort by nested comparator
+ if (answer == 0 && nested != null) {
+ answer = nested.compare(o1, o2);
+ }
+ return reverse ? -1 * answer : answer;
+ }
+
+ public String toString() {
+ return expression + (nested != null ? ";" + nested.toString() : "");
+ }
+ };
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/DefaultRemoteFileSorter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date