View Javadoc

1   /*
2    * $Id: SftpSizeCheckFunctionalTestCase.java 22475 2011-07-20 14:30:04Z justin.calleja $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.sftp;
12  
13  import java.util.Arrays;
14  import java.util.Collection;
15  
16  import org.junit.Test;
17  import org.junit.runners.Parameterized.Parameters;
18  
19  /**
20   * Test the sizeCheck feature.
21   */
22  public class SftpSizeCheckFunctionalTestCase extends AbstractSftpTestCase
23  {
24  
25      private static final long TIMEOUT = 15000;
26  
27      // Size of the generated stream - 2 Mb
28      final static int SEND_SIZE = 1024 * 1024 * 2;
29  
30      public SftpSizeCheckFunctionalTestCase(ConfigVariant variant, String configResources)
31      {
32          super(variant, configResources);
33      }
34      
35      @Parameters
36      public static Collection<Object[]> parameters()
37      {
38          return Arrays.asList(new Object[][]{
39              {ConfigVariant.SERVICE, "mule-sftp-sizeCheck-test-config-service.xml"},
40              {ConfigVariant.FLOW, "mule-sftp-sizeCheck-test-config-flow.xml"}
41          });
42      }
43  
44      @Override
45      protected void doSetUp() throws Exception
46      {
47          super.doSetUp();
48  
49          initEndpointDirectory("inboundEndpoint");
50      }
51  
52      /**
53       * Test the sizeCheck feature
54       */
55      @Test
56      public void testSizeCheck() throws Exception
57      {
58          // TODO. Add some tests specific to sizeCheck, i.e. create a very large file
59          // and ensure that the sizeChec prevents the inbound enpoint to read the file
60          // during creation of it
61  
62          executeBaseTest("inboundEndpoint", "vm://test.upload", FILE_NAME, SEND_SIZE, "receiving", TIMEOUT);
63      }
64  }