View Javadoc

1   /*
2    * $Id: ServerTest.java 20320 2010-11-24 15:03:31Z dfeist $
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.ftp.server;
12  
13  import org.apache.commons.net.ftp.FTPClient;
14  
15  import junit.framework.TestCase;
16  
17  /**
18   * Tests for the embedded ftp server startup, log in, and shutdown.
19   */
20  public class ServerTest extends TestCase
21  {
22      private Server ftpServer = null;
23  
24      public void setUp() throws Exception
25      {
26          ftpServer = new Server(Server.DEFAULT_PORT);
27      }
28  
29      /**
30       * Sanity test that the embedded ftp server is working. Useful as a first step if
31       * the ftp transport tests are failing.
32       * 
33       * @throws Exception
34       */
35      public void testServer() throws Exception
36      {
37          FTPClient ftpClient = new FTPClient();
38          ftpClient.connect("localhost", Server.DEFAULT_PORT);
39          ftpClient.login("admin", "admin");
40      }
41  
42      public void tearDown()
43      {
44          ftpServer.stop();
45          ftpServer = null;
46      }
47  }