1   package uba.db.sql.server;
2   
3   import java.io.File;
4   import java.net.InetSocketAddress;
5   
6   import junit.framework.TestCase;
7   
8   /***
9    * Test de unidad para {@link uba.db.sql.server.ServerCommandLineArguments}.
10   *
11   * @version $Revision: 1.1 $
12   */
13  public class ServerCommandLineArgumentsTest extends TestCase {
14      private ServerCommandLineArguments cmdLine;
15      private static final String HOST = "localhost";
16      private static final int PORT = 3000;
17      private static final String DIRECTORY = "prueba";
18  
19      /***
20       * @see junit.framework.TestCase#setUp()
21       */
22      protected void setUp() throws Exception {
23          super.setUp();
24          cmdLine = new ServerCommandLineArguments(new String[] { "-d", DIRECTORY, "-h", HOST,
25                  "-p", new Integer(PORT).toString() });
26      }
27  
28      /***
29       * Test: obtener el nombre el host.
30       */
31      public void testHostName() throws Exception {
32          assertEquals(HOST, cmdLine.host());
33      }
34  
35      /***
36       * Test: obtener el port.
37       */
38      public void testPort() throws Exception {
39          assertEquals(PORT, cmdLine.port());
40      }
41      
42      /***
43       * Test: obtener el directorio de la base de datos.
44       */
45      public void testDatabaseDirectory() {
46          assertEquals(new File(DIRECTORY), cmdLine.databaseDirectory());
47      }
48  
49      /***
50       * Test: obtener la dirección que utilizará el servidor.
51       */
52      public void testServerAddress() {
53          assertEquals(new InetSocketAddress(HOST, PORT), cmdLine.serverAddress());
54      }
55  }