Removing compile time dependency on webidor, its functionality is accessed only via REST
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 18 Oct 2009 20:29:49 +0200
changeset 126e905cd9b1e4a
parent 125 4e21f47580b4
child 127 ac8fff40babc
Removing compile time dependency on webidor, its functionality is accessed only via REST
freemarkerdor/pom.xml
freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java
     1.1 --- a/freemarkerdor/pom.xml	Sun Oct 18 18:00:58 2009 +0200
     1.2 +++ b/freemarkerdor/pom.xml	Sun Oct 18 20:29:49 2009 +0200
     1.3 @@ -16,9 +16,20 @@
     1.4      <dependency>
     1.5        <groupId>${project.groupId}</groupId>
     1.6        <artifactId>webidor</artifactId>
     1.7 +      <version>[1.0, 2.0)</version>
     1.8 +      <scope>test</scope>
     1.9 +    </dependency>
    1.10 +    <dependency>
    1.11 +      <groupId>${project.groupId}</groupId>
    1.12 +      <artifactId>quoridor</artifactId>
    1.13        <version>[1.0,2.0)</version>
    1.14      </dependency>
    1.15      <dependency>
    1.16 +      <groupId>com.sun.jersey</groupId>
    1.17 +      <artifactId>jersey-server</artifactId>
    1.18 +      <version>1.1.0-ea</version>
    1.19 +    </dependency>
    1.20 +    <dependency>
    1.21        <groupId>org.netbeans.modules</groupId>
    1.22        <artifactId>org-netbeans-libs-freemarker</artifactId>
    1.23        <version>RELEASE67</version>
     2.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sun Oct 18 18:00:58 2009 +0200
     2.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sun Oct 18 20:29:49 2009 +0200
     2.3 @@ -36,7 +36,6 @@
     2.4  import com.sun.net.httpserver.HttpServer;
     2.5  import cz.xelfi.quoridor.Board;
     2.6  import cz.xelfi.quoridor.IllegalPositionException;
     2.7 -import cz.xelfi.quoridor.webidor.resources.Quoridor;
     2.8  import java.awt.Image;
     2.9  import java.io.IOException;
    2.10  import java.io.InputStream;
    2.11 @@ -332,9 +331,7 @@
    2.12  
    2.13          final HttpServer apiServer;
    2.14          if (remoteAPI == null) {
    2.15 -            int localAPIPort = port - 1;
    2.16 -            apiServer = Quoridor.start(localAPIPort);
    2.17 -            base = client.resource(new URI("http://localhost:" + localAPIPort));
    2.18 +            throw new IllegalArgumentException("Provide URL to API server"); // NOI18N
    2.19          } else {
    2.20              base = client.resource(new URI(remoteAPI));
    2.21              apiServer = null;
     3.1 --- a/freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java	Sun Oct 18 18:00:58 2009 +0200
     3.2 +++ b/freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java	Sun Oct 18 20:29:49 2009 +0200
     3.3 @@ -31,6 +31,8 @@
     3.4  import com.sun.jersey.api.client.WebResource;
     3.5  import com.sun.jersey.core.header.MediaTypes;
     3.6  import com.sun.jersey.core.util.MultivaluedMapImpl;
     3.7 +import com.sun.net.httpserver.HttpServer;
     3.8 +import cz.xelfi.quoridor.webidor.resources.Quoridor;
     3.9  import java.awt.Image;
    3.10  import java.io.File;
    3.11  import java.io.FileOutputStream;
    3.12 @@ -56,6 +58,7 @@
    3.13   */
    3.14  public class UITest extends Object {
    3.15      private static File dir;
    3.16 +    private static HttpServer stopAPI;
    3.17      private static Callable<Void> stop;
    3.18      private WebResource webResource;
    3.19      private WebResource apiResource;
    3.20 @@ -70,7 +73,8 @@
    3.21          dir.delete();
    3.22          dir.mkdirs();
    3.23          System.setProperty("quoridor.dir", dir.getPath());
    3.24 -        stop = UI.startServers(9991, null);
    3.25 +        stopAPI = Quoridor.start(9990);
    3.26 +        stop = UI.startServers(9991, "http://localhost:9990");
    3.27  
    3.28          File passwd = new File(dir, "passwd");
    3.29          FileOutputStream os = new FileOutputStream(passwd);
    3.30 @@ -92,6 +96,9 @@
    3.31          if (stop != null) {
    3.32              stop.call();
    3.33          }
    3.34 +        if (stopAPI != null) {
    3.35 +            stopAPI.stop(0);
    3.36 +        }
    3.37      }
    3.38  
    3.39      static void deleteRec(File dir) throws IOException {