HelloWorld now runs with gretty plugin

signature-implementation
Tal Moran 2015-11-09 23:45:04 +02:00
parent eb1230d719
commit 16ec188f68
4 changed files with 17 additions and 26 deletions

View File

@ -2,13 +2,14 @@
plugins { plugins {
id "us.kirchmeier.capsule" version "1.0.1" id "us.kirchmeier.capsule" version "1.0.1"
id 'com.google.protobuf' version '0.7.0' id 'com.google.protobuf' version '0.7.0'
id "org.akhikhl.gretty" version "1.2.4"
} }
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'jetty' //apply plugin: 'jetty'
//mainClassName = 'Demo' //mainClassName = 'Demo'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
@ -29,7 +30,7 @@ ext {
description = "TODO: Add a description" description = "TODO: Add a description"
// Your project version // Your project version
version = "0.0" version = "0.0.1"
version += "${isSnapshot ? '-SNAPSHOT' : ''}" version += "${isSnapshot ? '-SNAPSHOT' : ''}"
@ -62,25 +63,11 @@ test {
task integrationTest(type: Test) { task integrationTest(type: Test) {
include '**/*IntegrationTest*' 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 // Use local maven repository
mavenLocal() mavenLocal()
jcenter()
// Use 'maven central' for other dependencies. // Use 'maven central' for other dependencies.
mavenCentral() mavenCentral()
} }

View File

@ -9,7 +9,7 @@ import service.HelloWorldService;
public class HelloWebApp { public class HelloWebApp {
private static HelloWorldService helloWorldService = new HelloWorldService(); private static HelloWorldService helloWorldService = new HelloWorldService();
@GET() @GET
public String hello() { public String hello() {
return helloWorldService.sayHello(); return helloWorldService.sayHello();
} }

View File

@ -1,6 +1,6 @@
<web-app> <web-app>
<servlet> <servlet>
<servlet-name>Jersey Hello World Application</servlet-name> <servlet-name>Jersey Hello World</servlet-name>
<servlet-class> <servlet-class>
org.glassfish.jersey.servlet.ServletContainer org.glassfish.jersey.servlet.ServletContainer
</servlet-class> </servlet-class>
@ -11,7 +11,7 @@
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Jersey Hello World Application</servlet-name> <servlet-name>Jersey Hello World</servlet-name>
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</servlet-mapping> </servlet-mapping>
</web-app> </web-app>

View File

@ -7,7 +7,9 @@ import org.junit.Test;
public class HelloIntegrationTest { 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 @Test
public void testHello() throws Exception { public void testHello() throws Exception {