1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.ftp.server;
12
13 import org.mule.tck.junit4.rule.DynamicPort;
14
15 import org.apache.commons.net.ftp.FTPClient;
16 import org.junit.After;
17 import org.junit.Before;
18 import org.junit.Rule;
19 import org.junit.Test;
20
21
22
23
24 public class ServerTest
25 {
26
27 private Server ftpServer = null;
28
29 @Rule
30 public DynamicPort dynamicPort = new DynamicPort("port1");
31
32 @Before
33 public void setUpServer() throws Exception
34 {
35 ftpServer = new Server(dynamicPort.getNumber());
36 }
37
38 @After
39 public void tearDown()
40 {
41 ftpServer.stop();
42 }
43
44
45
46
47
48
49
50 @Test
51 public void testServerLogin() throws Exception
52 {
53 FTPClient ftpClient = new FTPClient();
54 ftpClient.connect("localhost", dynamicPort.getNumber());
55 ftpClient.login("admin", "admin");
56 }
57 }