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