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

@ -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()
}

View File

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

View File

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

View File

@ -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 {