1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Tue Sep 08 07:45:59 2009 +0200
1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Tue Sep 08 07:54:12 2009 +0200
1.3 @@ -215,30 +215,32 @@
1.4 }
1.5
1.6 static Callable<Void> startServers(int port) throws Exception {
1.7 - final HttpServer api = Quoridor.start(port + 1);
1.8 + File home = new File(System.getProperty("user.home"));
1.9 + File quoridor = new File(home, ".quoridor");
1.10 +
1.11 + System.setProperty("quoridor.dir", quoridor.getPath());
1.12 +
1.13 + ResourceConfig rc = new PackagesResourceConfig(
1.14 + "cz.xelfi.quoridor.webidor",
1.15 + "cz.xelfi.quoridor.freemarkerdor"
1.16 + );
1.17 +
1.18 Client client = new Client();
1.19 - base = client.resource(new URI("http://localhost:" + (port + 1) + "/api/"));
1.20 + base = client.resource(new URI("http://localhost:" + port + "/api/"));
1.21
1.22 - final HttpServer s = start(port);
1.23 + final String baseUri = "http://localhost:" + port + "/";
1.24 + final HttpServer server = HttpServerFactory.create(baseUri, rc);
1.25 + server.start();
1.26 System.out.println("Quoridor started at port " + port);
1.27
1.28 return new Callable<Void>() {
1.29 public Void call() throws Exception {
1.30 - s.stop(0);
1.31 - api.stop(0);
1.32 + server.stop(0);
1.33 return null;
1.34 }
1.35 };
1.36 }
1.37
1.38 - static HttpServer start(int port) throws IOException {
1.39 - final String baseUri = "http://localhost:" + port + "/";
1.40 - ResourceConfig rc = new PackagesResourceConfig("cz.xelfi.quoridor.freemarkerdor");
1.41 - HttpServer server = HttpServerFactory.create(baseUri, rc);
1.42 - server.start();
1.43 - return server;
1.44 - }
1.45 -
1.46 private Viewable viewable(String page, Document doc, Object... more) {
1.47 String bundle = page.split("\\.")[0];
1.48
2.1 --- a/freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java Tue Sep 08 07:45:59 2009 +0200
2.2 +++ b/freemarkerdor/src/test/java/cz/xelfi/quoridor/freemarkerdor/UITest.java Tue Sep 08 07:54:12 2009 +0200
2.3 @@ -108,7 +108,7 @@
2.4 if (res.indexOf("Login") == -1) {
2.5 fail("Wrong index.html:\n" + res);
2.6 }
2.7 - if (res.indexOf("action=\"login\"") == -1) {
2.8 + if (res.indexOf("action=\"/login\"") == -1) {
2.9 fail("Wrong index.html:\n" + res);
2.10 }
2.11 if (res.toLowerCase().indexOf("error") != -1) {