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 the sizeCheck feature.
13   */
14  public class SftpSizeCheckFunctionalTestCase extends AbstractSftpTestCase
15  {
16  
17      private static final long TIMEOUT = 15000;
18  
19      // Size of the generated stream - 2 Mb
20      final static int SEND_SIZE = 1024 * 1024 * 2;
21  
22      @Override
23      protected String getConfigResources()
24      {
25          return "mule-sftp-sizeCheck-test-config.xml";
26      }
27  
28      @Override
29      protected void doSetUp() throws Exception
30      {
31          super.doSetUp();
32  
33          initEndpointDirectory("inboundEndpoint");
34      }
35  
36      /**
37       * Test the sizeCheck feature
38       */
39      @Test
40      public void testSizeCheck() throws Exception
41      {
42          // TODO. Add some tests specific to sizeCheck, i.e. create a very large file
43          // and ensure that the sizeChec prevents the inbound enpoint to read the file
44          // during creation of it
45  
46          executeBaseTest("inboundEndpoint", "vm://test.upload", FILE_NAME, SEND_SIZE, "receiving", TIMEOUT);
47      }
48  }