Removing /api prefix from the webidor server
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 18 Oct 2009 15:48:47 +0200
changeset 12490371f3eb106
parent 123 4529cb22ff7d
child 125 4e21f47580b4
Removing /api prefix from the webidor server
freemarkerdor/pom.xml
freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java
webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java
webidor/src/test/java/cz/xelfi/quoridor/webidor/FinishedGameTest.java
webidor/src/test/java/cz/xelfi/quoridor/webidor/QuoridorTest.java
webidor/src/test/java/cz/xelfi/quoridor/webidor/resources/ChatTest.java
     1.1 --- a/freemarkerdor/pom.xml	Sun Oct 11 19:32:48 2009 +0200
     1.2 +++ b/freemarkerdor/pom.xml	Sun Oct 18 15:48:47 2009 +0200
     1.3 @@ -10,13 +10,13 @@
     1.4    <groupId>org.apidesign</groupId>
     1.5    <artifactId>freemarkerdor</artifactId>
     1.6    <name>freemarkerdor</name>
     1.7 -  <version>1.32</version>
     1.8 +  <version>1.33</version>
     1.9    <url>http://maven.apache.org</url>
    1.10    <dependencies>
    1.11      <dependency>
    1.12        <groupId>${project.groupId}</groupId>
    1.13        <artifactId>webidor</artifactId>
    1.14 -      <version>1.4</version>
    1.15 +      <version>[1.0,2.0)</version>
    1.16      </dependency>
    1.17      <dependency>
    1.18        <groupId>org.netbeans.modules</groupId>
     2.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sun Oct 11 19:32:48 2009 +0200
     2.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sun Oct 18 15:48:47 2009 +0200
     2.3 @@ -38,7 +38,6 @@
     2.4  import cz.xelfi.quoridor.IllegalPositionException;
     2.5  import cz.xelfi.quoridor.webidor.resources.Quoridor;
     2.6  import java.awt.Image;
     2.7 -import java.io.File;
     2.8  import java.io.IOException;
     2.9  import java.io.InputStream;
    2.10  import java.net.URI;
    2.11 @@ -335,7 +334,7 @@
    2.12          if (remoteAPI == null) {
    2.13              int localAPIPort = port - 1;
    2.14              apiServer = Quoridor.start(localAPIPort);
    2.15 -            base = client.resource(new URI("http://localhost:" + localAPIPort + "/api/"));
    2.16 +            base = client.resource(new URI("http://localhost:" + localAPIPort));
    2.17          } else {
    2.18              base = client.resource(new URI(remoteAPI));
    2.19              apiServer = null;
     3.1 --- a/freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java	Sun Oct 11 19:32:48 2009 +0200
     3.2 +++ b/freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java	Sun Oct 18 15:48:47 2009 +0200
     3.3 @@ -83,7 +83,7 @@
     3.4  
     3.5          Client client = new Client();
     3.6          webResource = client.resource(new URI("http://localhost:9991/"));
     3.7 -        apiResource = client.resource(new URI("http://localhost:9990/api/"));
     3.8 +        apiResource = client.resource(new URI("http://localhost:9990/"));
     3.9      }
    3.10  
    3.11      @AfterClass
    3.12 @@ -107,16 +107,18 @@
    3.13          dir.delete();
    3.14      }
    3.15  
    3.16 -    /**
    3.17 -     * Test if a WADL document is available at the relative path
    3.18 -     * "application.wadl".
    3.19 -     */
    3.20      @Test public void testApplicationWadl() {
    3.21          String serviceWadl = webResource.path("application.wadl").
    3.22                  accept(MediaTypes.WADL).get(String.class);
    3.23          assertTrue(serviceWadl.length() > 0);
    3.24      }
    3.25  
    3.26 +    @Test public void testAPIWadl() {
    3.27 +        String serviceWadl = apiResource.path("application.wadl").
    3.28 +                accept(MediaTypes.WADL).get(String.class);
    3.29 +        assertTrue(serviceWadl.length() > 0);
    3.30 +    }
    3.31 +
    3.32      @Test public void testGetIndexPage() throws Exception {
    3.33          String logJarda = apiResource.path("login").
    3.34              queryParam("name", "Jarda").
     4.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java	Sun Oct 11 19:32:48 2009 +0200
     4.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java	Sun Oct 18 15:48:47 2009 +0200
     4.3 @@ -50,7 +50,7 @@
     4.4   *
     4.5   * @author Jaroslav Tulach <jtulach@netbeans.org>
     4.6   */
     4.7 -@Path("/api")
     4.8 +@Path("/")
     4.9  @Singleton
    4.10  public final class Quoridor {
    4.11      private final File path;
     5.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/FinishedGameTest.java	Sun Oct 11 19:32:48 2009 +0200
     5.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/FinishedGameTest.java	Sun Oct 18 15:48:47 2009 +0200
     5.3 @@ -77,7 +77,6 @@
     5.4          dir.delete();
     5.5      }
     5.6      @Test public void testNotLoggedIn() {
     5.7 -        webResource = webResource.path("api");
     5.8          String status  = webResource.path("login").queryParam("id", "not-logged-in").
     5.9                  accept(MediaType.TEXT_PLAIN).get(String.class);
    5.10          assertEquals("Nobody is logged in", "", status);
    5.11 @@ -85,7 +84,6 @@
    5.12  
    5.13  
    5.14      @Test public void testCreateAGame() throws Exception {
    5.15 -        webResource = webResource.path("api");
    5.16          String logJarda = webResource.path("login").
    5.17              queryParam("name", "Jarda").
    5.18              queryParam("password", "heslo").
    5.19 @@ -131,7 +129,6 @@
    5.20      }
    5.21  
    5.22      @Test public void testResignAGame() throws Exception {
    5.23 -        webResource = webResource.path("api");
    5.24          String logJarda = webResource.path("login").
    5.25              queryParam("name", "Jarda").
    5.26              queryParam("password", "heslo").
     6.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/QuoridorTest.java	Sun Oct 11 19:32:48 2009 +0200
     6.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/QuoridorTest.java	Sun Oct 18 15:48:47 2009 +0200
     6.3 @@ -99,7 +99,6 @@
     6.4      }
     6.5  
     6.6      @Test public void testCreateAGame() throws Exception {
     6.7 -        webResource = webResource.path("api");
     6.8          String logJarda = webResource.path("login").
     6.9              queryParam("name", "Jarda").
    6.10              queryParam("password", "heslo").
     7.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/resources/ChatTest.java	Sun Oct 11 19:32:48 2009 +0200
     7.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/resources/ChatTest.java	Sun Oct 18 15:48:47 2009 +0200
     7.3 @@ -89,7 +89,6 @@
     7.4      }
     7.5  
     7.6      @Test public void testCreateAGame() throws Exception {
     7.7 -        webResource = webResource.path("api");
     7.8          String logJarda = webResource.path("login").
     7.9              queryParam("name", "Jarda").
    7.10              queryParam("password", "heslo").