camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r897833 - in /camel/trunk: camel-core/src/test/java/org/apache/camel/management/ camel-core/src/test/java/org/apache/camel/processor/ components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/ components/camel-mail/src/test/...
Date Mon, 11 Jan 2010 10:45:32 GMT
Author: davsclaus
Date: Mon Jan 11 10:45:32 2010
New Revision: 897833

URL: http://svn.apache.org/viewvc?rev=897833&view=rev
Log:
Fixed tests on slower boxes

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedTimerTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownDeferTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownNotDeferTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
    camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteAllTasksTest.java
    camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteCurrentTaskOnlyTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedTimerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedTimerTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedTimerTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedTimerTest.java
Mon Jan 11 10:45:32 2010
@@ -53,9 +53,9 @@
         String camelId = (String) mbeanServer.getAttribute(name, "CamelId");
         assertEquals("camel-1", camelId);
 
-        // change period
-        mbeanServer.setAttribute(name, new Attribute("Period", 1000));
-        mbeanServer.setAttribute(name, new Attribute("Delay", 0));
+        // change period and delay
+        mbeanServer.setAttribute(name, new Attribute("Period", 500));
+        mbeanServer.setAttribute(name, new Attribute("Delay", 250));
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.reset();
@@ -70,8 +70,7 @@
         // Take the time to check the service is started to help avoid
         // sporadic failure on slower machines.
         String state = (String) mbeanServer.getAttribute(on, "State");
-        assertEquals("Should be started", 
-            org.apache.camel.ServiceStatus.Started.name(), state);
+        assertEquals("Should be started", org.apache.camel.ServiceStatus.Started.name(),
state);
         
         // start and we should be done in at most 3 second
         mock.expectedMinimumMessageCount(3);

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownDeferTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownDeferTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownDeferTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownDeferTest.java
Mon Jan 11 10:45:32 2010
@@ -34,6 +34,9 @@
     }
 
     public void testShutdownDeferred() throws Exception {
+        // give it 20 seconds to shutdown
+        context.getShutdownStrategy().setTimeout(20);
+        
         MockEndpoint bar = getMockEndpoint("mock:bar");
         bar.expectedMinimumMessageCount(1);
 
@@ -48,7 +51,7 @@
         context.stop();
 
         // should route all 5
-        assertEquals("Should complete all 8 messages", 5, bar.getReceivedCounter());
+        assertEquals("Should complete all messages", 5, bar.getReceivedCounter());
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownNotDeferTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownNotDeferTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownNotDeferTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownNotDeferTest.java
Mon Jan 11 10:45:32 2010
@@ -34,6 +34,9 @@
     }
 
     public void testShutdownNotDeferred() throws Exception {
+        // give it 20 seconds to shutdown
+        context.getShutdownStrategy().setTimeout(20);
+
         MockEndpoint bar = getMockEndpoint("mock:bar");
         bar.expectedMinimumMessageCount(1);
 
@@ -48,7 +51,7 @@
         context.stop();
 
         // should not route all 5
-        assertTrue("Should NOT complete all 5 messages, was " + bar.getReceivedCounter(),
bar.getReceivedCounter() < 5);
+        assertTrue("Should NOT complete all messages, was " + bar.getReceivedCounter(), bar.getReceivedCounter()
< 5);
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
Mon Jan 11 10:45:32 2010
@@ -69,6 +69,7 @@
         }
 
         resultEndpoint.expectedBodiesReceived(bodies);
+        resultEndpoint.setResultWaitTime(20000);
         resultEndpoint.assertIsSatisfied();
 
         service.shutdown();
@@ -77,6 +78,7 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        disableJMX();
         resultEndpoint = getMockEndpoint("mock:result");
     }
 
@@ -138,7 +140,7 @@
         public void run() {
             for (long i = start; i < end; i += increment) {
                 try {
-                    Thread.sleep(2);
+                    Thread.sleep(4);
                 } catch (InterruptedException e) {
                     // ignore
                 }

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
(original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java
Mon Jan 11 10:45:32 2010
@@ -18,9 +18,7 @@
 
 import java.io.File;
 
-import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
-import org.apache.camel.Producer;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.converter.IOConverter;
@@ -50,6 +48,7 @@
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         resultEndpoint.expectedMessageCount(2);
         resultEndpoint.assertIsSatisfied();
+
         Exchange ex = resultEndpoint.getExchanges().get(0);
         byte[] bytes = ex.getIn().getBody(byte[].class);
         assertTrue("Logo size wrong", bytes.length > 10000);
@@ -67,30 +66,16 @@
 
     private void prepareFtpServer() throws Exception {
         // prepares the FTP Server by creating a file on the server that we want to unit
-        // test that we can pool and store as a local file        
-        Endpoint endpoint = context.getEndpoint(getFtpUrl());
-        Exchange exchange = endpoint.createExchange();
-        exchange.getIn().setBody(IOConverter.toFile("src/test/data/ftpbinarytest/logo.jpeg"));
-        exchange.getIn().setHeader(Exchange.FILE_NAME, "logo.jpeg");
-        Producer producer = endpoint.createProducer();
-        producer.start();
-        producer.process(exchange);
-        producer.stop();
-
-        endpoint = context.getEndpoint(getFtpUrl());
-        exchange = endpoint.createExchange();
-        exchange.getIn().setBody(IOConverter.toFile("src/test/data/ftpbinarytest/logo1.jpeg"));
-        exchange.getIn().setHeader(Exchange.FILE_NAME, "logo1.jpeg");
-        producer = endpoint.createProducer();
-        producer.start();
-        producer.process(exchange);
-        producer.stop();
+        // test that we can pool and store as a local file
+        template.sendBodyAndHeader(getFtpUrl(), IOConverter.toFile("src/test/data/ftpbinarytest/logo.jpeg"),
Exchange.FILE_NAME, "logo.jpeg");
+        template.sendBodyAndHeader(getFtpUrl(), IOConverter.toFile("src/test/data/ftpbinarytest/logo1.jpeg"),
Exchange.FILE_NAME, "logo1.jpeg");
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
                 String fileUrl = "file:target/ftptest/?noop=true";
+
                 from(getFtpUrl()).to(fileUrl, "mock:result");
             }
         };

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
(original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java
Mon Jan 11 10:45:32 2010
@@ -51,6 +51,9 @@
 
     @Test
     public void testShutdownCompleteAllTasks() throws Exception {
+        // give it 20 seconds to shutdown
+        context.getShutdownStrategy().setTimeout(20);
+
         MockEndpoint bar = getMockEndpoint("mock:bar");
         bar.expectedMinimumMessageCount(1);
         bar.setResultWaitTime(3000);

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
(original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java
Mon Jan 11 10:45:32 2010
@@ -51,6 +51,9 @@
 
     @Test
     public void testShutdownCompleteCurrentTaskOnly() throws Exception {
+        // give it 20 seconds to shutdown
+        context.getShutdownStrategy().setTimeout(20);
+
         MockEndpoint bar = getMockEndpoint("mock:bar");
         bar.expectedMinimumMessageCount(1);
         bar.setResultWaitTime(3000);

Modified: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteAllTasksTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteAllTasksTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteAllTasksTest.java
(original)
+++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteAllTasksTest.java
Mon Jan 11 10:45:32 2010
@@ -42,6 +42,9 @@
 
     @Test
     public void testShutdownCompleteAllTasks() throws Exception {
+        // give it 20 seconds to shutdown
+        context.getShutdownStrategy().setTimeout(20);
+
         MockEndpoint bar = getMockEndpoint("mock:bar");
         bar.expectedMinimumMessageCount(1);
         bar.setResultWaitTime(3000);
@@ -51,8 +54,8 @@
         // shutdown during processing
         context.stop();
 
-        // should route all 8
-        assertEquals("Should complete all messages", 8, bar.getReceivedCounter());
+        // should route all 5
+        assertEquals("Should complete all messages", 5, bar.getReceivedCounter());
     }
 
     private void prepareMailbox() throws Exception {
@@ -66,8 +69,8 @@
         folder.expunge();
 
         // inserts 8 new messages
-        Message[] messages = new Message[8];
-        for (int i = 0; i < 8; i++) {
+        Message[] messages = new Message[5];
+        for (int i = 0; i < 5; i++) {
             messages[i] = new MimeMessage(sender.getSession());
             messages[i].setText("Message " + i);
         }

Modified: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteCurrentTaskOnlyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteCurrentTaskOnlyTest.java?rev=897833&r1=897832&r2=897833&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteCurrentTaskOnlyTest.java
(original)
+++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailShutdownCompleteCurrentTaskOnlyTest.java
Mon Jan 11 10:45:32 2010
@@ -42,6 +42,9 @@
 
     @Test
     public void testShutdownCompleteCurrentTaskOnly() throws Exception {
+        // give it 20 seconds to shutdown
+        context.getShutdownStrategy().setTimeout(20);
+
         MockEndpoint bar = getMockEndpoint("mock:bar");
         bar.expectedMinimumMessageCount(1);
         bar.setResultWaitTime(3000);
@@ -51,8 +54,8 @@
         // shutdown during processing
         context.stop();
 
-        // should NOT route all 8
-        assertTrue("Should NOT complete all messages, was: " + bar.getReceivedCounter(),
bar.getReceivedCounter() < 8);
+        // should NOT route all 5
+        assertTrue("Should NOT complete all messages, was: " + bar.getReceivedCounter(),
bar.getReceivedCounter() < 5);
     }
 
     private void prepareMailbox() throws Exception {
@@ -66,8 +69,8 @@
         folder.expunge();
 
         // inserts 8 new messages
-        Message[] messages = new Message[8];
-        for (int i = 0; i < 8; i++) {
+        Message[] messages = new Message[5];
+        for (int i = 0; i < 5; i++) {
             messages[i] = new MimeMessage(sender.getSession());
             messages[i].setText("Message " + i);
         }



Mime
View raw message