You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/08/06 06:30:57 UTC

svn commit: r801508 - /camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java

Author: davsclaus
Date: Thu Aug  6 04:30:57 2009
New Revision: 801508

URL: http://svn.apache.org/viewvc?rev=801508&view=rev
Log:
Added an unit test based on user forum reporting.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java   (with props)

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java?rev=801508&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java Thu Aug  6 04:30:57 2009
@@ -0,0 +1,56 @@
+/**
+ * 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.component.mock.MockEndpoint;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class FileConsumerNoopTest extends ContextTestSupport {
+
+    public void testNoop() throws Exception {
+        File file = new File("src/main/data");
+        String[] before = file.list();
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(2);
+        assertMockEndpointsSatisfied();
+
+        // wait a little to let file consumer run some more
+        Thread.sleep(2000);
+        String[] after = file.list();
+        assertEquals("Same number of files should exist", before.length, after.length);
+
+        // should not come new files since
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://src/main/data?noop=true").to("mock:result");
+            }
+        };
+    }
+}

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

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date