1
2
3
4
5
6
7 package org.mule.transport.sftp;
8
9 import org.mule.transport.sftp.notification.SftpTransportNotificationTestListener;
10
11 import org.junit.Test;
12
13 import static org.junit.Assert.assertFalse;
14 import static org.junit.Assert.assertTrue;
15
16
17
18
19 public class SftpNotificationFunctionalTestCase extends AbstractSftpTestCase
20 {
21
22 private static final long TIMEOUT = 15000;
23
24
25 private final static int SEND_SIZE = 1024 * 1024 * 2;
26
27 @Override
28 protected void doSetUp() throws Exception
29 {
30 super.doSetUp();
31
32 initEndpointDirectory("inboundEndpoint");
33
34 SftpTransportNotificationTestListener.reset();
35 }
36
37 @Override
38 protected String getConfigResources()
39 {
40 return "mule-sftp-notification-test-config.xml";
41 }
42
43
44
45
46 @Test
47 public void testNotification() throws Exception
48 {
49 executeBaseTest("inboundEndpoint", "vm://test.upload", FILE_NAME, SEND_SIZE, "receiving", TIMEOUT);
50 }
51
52
53
54
55 @Override
56 protected void executeBaseAssertionsBeforeCall()
57 {
58
59 super.executeBaseAssertionsBeforeCall();
60
61
62 assertFalse(SftpTransportNotificationTestListener.gotSftpPutNotification());
63 assertFalse(SftpTransportNotificationTestListener.gotSftpRenameNotification());
64 assertFalse(SftpTransportNotificationTestListener.gotSftpGetNotification());
65 assertFalse(SftpTransportNotificationTestListener.gotSftpDeleteNotification());
66 }
67
68
69
70
71 @Override
72 protected void executeBaseAssertionsAfterCall(int sendSize, int receivedSize)
73 {
74
75 super.executeBaseAssertionsAfterCall(sendSize, receivedSize);
76
77
78 assertTrue(SftpTransportNotificationTestListener.gotSftpPutNotification());
79 assertTrue(SftpTransportNotificationTestListener.gotSftpRenameNotification());
80 assertTrue(SftpTransportNotificationTestListener.gotSftpGetNotification());
81 assertTrue(SftpTransportNotificationTestListener.gotSftpDeleteNotification());
82 }
83 }