View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.sftp;
8   
9   import org.junit.Test;
10  
11  /**
12   * Test sending and receiving a very large message.
13   * <p/>
14   * This test will probably fail due to the standard timeout. According to
15   * http://www.mulesource.org/display/MULE2USER/Functional+Testing the only way to
16   * change the timeout is "add -Dmule.test.timeoutSecs=XX either to the mvn command
17   * you use to run Mule or to the JUnit test runner in your IDE." Tested with
18   * '-Dmule.test.timeoutSecs=300'
19   */
20  public class SftpSendReceiveLargeFileFunctionalTestCase extends AbstractSftpTestCase
21  {
22  
23      private static final long TIMEOUT = 600000;
24  
25      // Size of the generated stream - 200 Mb
26      final static int SEND_SIZE = 1024 * 1024 * 200;
27  
28      public SftpSendReceiveLargeFileFunctionalTestCase()
29      {
30          // Increase the timeout of the test to 300 s
31          logger.info("Timeout was set to: " + System.getProperty(TEST_TIMEOUT_SYSTEM_PROPERTY, "-1"));
32          System.setProperty(TEST_TIMEOUT_SYSTEM_PROPERTY, "600000");
33          logger.info("Timeout is now set to: " + System.getProperty(TEST_TIMEOUT_SYSTEM_PROPERTY, "-1"));
34      }
35  
36      @Override
37      protected String getConfigResources()
38      {
39          // Uses the same config as SftpSendReceiveFunctionalTestCase
40          return "mule-send-receive-large-file-test-config.xml";
41      }
42  
43      @Override
44      protected void doSetUp() throws Exception
45      {
46          super.doSetUp();
47  
48          initEndpointDirectory("inboundEndpoint");
49      }
50  
51      /**
52       * Test sending and receiving a large file.
53       */
54      @Test
55      public void testSendAndReceiveLargeFile() throws Exception
56      {
57          executeBaseTest("inboundEndpoint", "vm://test.upload", "bigfile.txt", SEND_SIZE, "receiving", TIMEOUT);
58      }
59  }