Author: davsclaus
Date: Thu Jan 10 11:38:58 2013
New Revision: 1431292

URL: http://svn.apache.org/viewvc?rev=1431292&view=rev
Log:
Fixed tests

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMaxMessagesPerPollTest.java
    
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMoveRelativeNameTest.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1431291

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMaxMessagesPerPollTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMaxMessagesPerPollTest.java?rev=1431292&r1=1431291&r2=1431292&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMaxMessagesPerPollTest.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMaxMessagesPerPollTest.java
 Thu Jan 10 11:38:58 2013
@@ -26,28 +26,27 @@ import org.apache.camel.component.mock.M
  */
 public class FileConsumeMaxMessagesPerPollTest extends ContextTestSupport {
 
-    private String fileUrl = 
"file://target/poll/?initialDelay=2000&delay=5000&maxMessagesPerPoll=2";
+    private String fileUrl = "file://target/poll/?maxMessagesPerPoll=2";
 
     @Override
     protected void setUp() throws Exception {
         deleteDirectory("target/poll");
         super.setUp();
-        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, 
"bye.txt");
-        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, 
"hello.txt");
-        template.sendBodyAndHeader(fileUrl, "Godday World", 
Exchange.FILE_NAME, "godday.txt");
     }
 
     public void testMaxMessagesPerPoll() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(2);
-        mock.setResultWaitTime(3000);
-        mock.expectedPropertyReceived(Exchange.BATCH_SIZE, 2);
+        // we should poll at most 2
+        mock.expectedMinimumMessageCount(2);
+        mock.message(0).property(Exchange.BATCH_SIZE).isEqualTo(2);
+        mock.message(1).property(Exchange.BATCH_SIZE).isEqualTo(2);
 
-        assertMockEndpointsSatisfied();
+        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, 
"bye.txt");
+        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, 
"hello.txt");
+        template.sendBodyAndHeader(fileUrl, "Godday World", 
Exchange.FILE_NAME, "godday.txt");
 
-        mock.reset();
-        mock.expectedMessageCount(1);
-        mock.expectedPropertyReceived(Exchange.BATCH_SIZE, 1);
+        // start route
+        context.startRoute("foo");
 
         assertMockEndpointsSatisfied();
     }
@@ -55,7 +54,9 @@ public class FileConsumeMaxMessagesPerPo
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from(fileUrl).convertBodyTo(String.class).to("mock:result");
+                from(fileUrl)
+                        .routeId("foo").noAutoStartup()
+                        .convertBodyTo(String.class).to("mock:result");
             }
         };
     }

Modified: 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMoveRelativeNameTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMoveRelativeNameTest.java?rev=1431292&r1=1431291&r2=1431292&view=diff
==============================================================================
--- 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMoveRelativeNameTest.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeMoveRelativeNameTest.java
 Thu Jan 10 11:38:58 2013
@@ -26,16 +26,12 @@ import org.apache.camel.component.mock.M
  */
 public class FileConsumeMoveRelativeNameTest extends ContextTestSupport {
 
-    private String fileUrl = 
"file://target/multidir/?recursive=true&initialDelay=2000&delay=5000"
-            + "&move=.done/${file:name}.old";
+    private String fileUrl = 
"file://target/multidir/?recursive=true&move=.done/${file:name}.old";
 
     @Override
     protected void setUp() throws Exception {
         deleteDirectory("target/multidir");
         super.setUp();
-        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, 
"bye.txt");
-        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, 
"sub/hello.txt");
-        template.sendBodyAndHeader(fileUrl, "Goodday World", 
Exchange.FILE_NAME, "sub/sub2/goodday.txt");
     }
 
     public void testMultiDir() throws Exception {
@@ -46,13 +42,21 @@ public class FileConsumeMoveRelativeName
         mock.expectedFileExists("target/multidir/.done/sub/hello.txt.old");
         
mock.expectedFileExists("target/multidir/.done/sub/sub2/goodday.txt.old");
 
+        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, 
"bye.txt");
+        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, 
"sub/hello.txt");
+        template.sendBodyAndHeader(fileUrl, "Goodday World", 
Exchange.FILE_NAME, "sub/sub2/goodday.txt");
+
+        context.startRoute("foo");
+
         assertMockEndpointsSatisfied();
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from(fileUrl).convertBodyTo(String.class).to("mock:result");
+                from(fileUrl)
+                        .routeId("foo").noAutoStartup()
+                        .convertBodyTo(String.class).to("mock:result");
             }
         };
     }


Reply via email to