View Javadoc

1   /*
2    * $Id: SftpQuartzRequesterFunctionalTestCase.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 SftpQuartzRequesterFunctionalTestCase extends AbstractSftpTestCase
23  {
24  
25      private static final long TIMEOUT = 20000;
26  
27      // Size of the generated stream - 2 Mb
28      final static int SEND_SIZE = 1024 * 1024 * 2;
29  
30      public SftpQuartzRequesterFunctionalTestCase(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-quartzRequester-test-config-service.xml"},
40              {ConfigVariant.FLOW, "mule-sftp-quartzRequester-test-config-flow.xml"}});
41      }
42  
43      @Override
44      protected void doSetUp() throws Exception
45      {
46          super.doSetUp();
47  
48          // In this test we need to get the outboundEndpoint instead of the inbound
49          initEndpointDirectory("outboundEndpoint");
50      }
51  
52      /**
53       * Test a quarts based requester
54       */
55      @Test
56      public void testQuartzRequester() 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  }