1
2
3
4
5
6
7 package org.mule.transport.sftp;
8
9 import org.mule.api.endpoint.ImmutableEndpoint;
10 import org.mule.module.client.MuleClient;
11
12 import org.junit.Test;
13
14 import static org.junit.Assert.assertTrue;
15
16
17
18
19
20
21 public class SftpExpressionFilenameParserTestCase extends AbstractSftpTestCase
22 {
23
24 protected static final long TIMEOUT = 10000;
25 private static final String OUTBOUND_ENDPOINT_NAME = "outboundEndpoint";
26 private static final String INBOUND_ENDPOINT_NAME = "inboundEndpoint";
27
28 @Override
29 protected String getConfigResources()
30 {
31 return "mule-sftp-expressionFilenameParser-config.xml";
32 }
33
34 @Override
35 protected void doSetUp() throws Exception
36 {
37 super.doSetUp();
38
39 initEndpointDirectory(INBOUND_ENDPOINT_NAME);
40 initEndpointDirectory(OUTBOUND_ENDPOINT_NAME);
41 }
42
43 @Test
44 public void testExpressionFilenameParser() throws Exception
45 {
46 MuleClient muleClient = new MuleClient(muleContext);
47 dispatchAndWaitForDelivery(new DispatchParameters(INBOUND_ENDPOINT_NAME, OUTBOUND_ENDPOINT_NAME));
48
49 SftpClient sftpClient = null;
50 try
51 {
52
53
54 sftpClient = getSftpClient(muleClient, OUTBOUND_ENDPOINT_NAME);
55 ImmutableEndpoint endpoint = (ImmutableEndpoint) muleClient.getProperty(OUTBOUND_ENDPOINT_NAME);
56 assertTrue("A new file in the outbound endpoint should exist", super.verifyFileExists(sftpClient,
57 endpoint.getEndpointURI().getPath(), FILE_NAME));
58 }
59 finally
60 {
61 sftpClient.disconnect();
62 }
63 }
64 }