diff --git a/bulletin-board-server/build.gradle b/bulletin-board-server/build.gradle index f09a484..62af04a 100644 --- a/bulletin-board-server/build.gradle +++ b/bulletin-board-server/build.gradle @@ -1,14 +1,15 @@ plugins { - id "us.kirchmeier.capsule" version "1.0.1" - id 'com.google.protobuf' version '0.7.0' + id "us.kirchmeier.capsule" version "1.0.1" + id 'com.google.protobuf' version '0.7.0' + id "org.akhikhl.gretty" version "1.2.4" } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' -apply plugin: 'jetty' +//apply plugin: 'jetty' //mainClassName = 'Demo' apply plugin: 'maven-publish' @@ -29,7 +30,7 @@ ext { description = "TODO: Add a description" // Your project version -version = "0.0" +version = "0.0.1" version += "${isSnapshot ? '-SNAPSHOT' : ''}" @@ -62,25 +63,11 @@ test { task integrationTest(type: Test) { include '**/*IntegrationTest*' - jettyRun { - httpPort = 8081 // Port for test - daemon = true - stopPort = 8091 // Port for stop signal - stopKey = 'stopKey' - } - jettyStop { - stopPort = 8091 // Port for stop signal - stopKey = 'stopKey' - } - - doFirst { - jettyRun.execute() - } - - doLast { - jettyStop.execute() - } +} +gretty { + httpPort = 8081 + integrationTestTask = 'integrationTest' } @@ -164,6 +151,8 @@ repositories { // Use local maven repository mavenLocal() + jcenter() + // Use 'maven central' for other dependencies. mavenCentral() } diff --git a/bulletin-board-server/src/main/java/webapp/HelloWebApp.java b/bulletin-board-server/src/main/java/webapp/HelloWebApp.java index a98f6a6..0a518f7 100644 --- a/bulletin-board-server/src/main/java/webapp/HelloWebApp.java +++ b/bulletin-board-server/src/main/java/webapp/HelloWebApp.java @@ -9,7 +9,7 @@ import service.HelloWorldService; public class HelloWebApp { private static HelloWorldService helloWorldService = new HelloWorldService(); - @GET() + @GET public String hello() { return helloWorldService.sayHello(); } diff --git a/bulletin-board-server/src/main/webapp/WEB-INF/web.xml b/bulletin-board-server/src/main/webapp/WEB-INF/web.xml index cdf4628..f2c6e23 100644 --- a/bulletin-board-server/src/main/webapp/WEB-INF/web.xml +++ b/bulletin-board-server/src/main/webapp/WEB-INF/web.xml @@ -1,6 +1,6 @@ - Jersey Hello World Application + Jersey Hello World org.glassfish.jersey.servlet.ServletContainer @@ -11,7 +11,7 @@ 1 - Jersey Hello World Application + Jersey Hello World /* diff --git a/bulletin-board-server/src/test/java/HelloIntegrationTest.java b/bulletin-board-server/src/test/java/HelloIntegrationTest.java index a6c7e48..9de027e 100644 --- a/bulletin-board-server/src/test/java/HelloIntegrationTest.java +++ b/bulletin-board-server/src/test/java/HelloIntegrationTest.java @@ -7,7 +7,9 @@ import org.junit.Test; public class HelloIntegrationTest { - private static String HELLO_URL = "http://localhost:8080/hello"; + private static String PROP_GETTY_URL = "gretty.httpBaseURI"; + private static String BASE_URL = System.getProperty(PROP_GETTY_URL); + private static String HELLO_URL = BASE_URL + "/hello"; @Test public void testHello() throws Exception {