Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

Commit

Permalink
Merge pull request #68 from paypal/develop
Browse files Browse the repository at this point in the history
Revving up to version 2.3.1-RELEASE
  • Loading branch information
fabiocarvalho777 authored May 12, 2017
2 parents 68f272c + d859929 commit 629cf7a
Show file tree
Hide file tree
Showing 30 changed files with 396 additions and 57 deletions.
14 changes: 5 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ jdk:

install: mvn install

before_install:
# Installing Codacy code coverage reporter upload tool
- curl -sL https://github.com/jpm4j/jpm4j.installers/raw/master/dist/biz.aQute.jpm.run.jar >t.jar
- sudo java -jar t.jar init
- rm t.jar
- sudo jpm install com.codacy:codacy-coverage-reporter:assembly

after_success:
# Installing Codacy code coverage reporter upload tool
# This is a workaround until [this issue here](https://github.com/codacy/codacy-coverage-reporter/issues/49) is not solved.
- wget https://github.com/codacy/codacy-coverage-reporter/releases/download/1.0.13/codacy-coverage-reporter-1.0.13-assembly.jar -O ccr.jar
# Uploading Cobertura report to Codacy
- codacy-coverage-reporter -l Java -r ./resteasy-spring-boot-starter/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./resteasy-spring-boot-starter/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
# Deploying SNAPSHOT artifacts to Maven Central
- mvn -B -f ./resteasy-spring-boot-starter/pom.xml -s ./resteasy-spring-boot-starter/settings.xml -DskipTests=true -Dcobertura.skip deploy
- mvn -B -f ./resteasy-spring-boot-starter/pom.xml -s ./resteasy-spring-boot-starter/settings.xml -DskipTests=true -Dcobertura.skip deploy
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Add the Maven dependency below to your Spring Boot application pom file.<br>
<dependency>
<groupId>com.paypal.springboot</groupId>
<artifactId>resteasy-spring-boot-starter</artifactId>
<version>2.3.0-RELEASE</version>
<version>2.3.1-RELEASE</version>
<scope>runtime</scope>
</dependency>
```
Expand All @@ -38,7 +38,7 @@ Just define your JAX-RS application class (a subclass of [Application](http://do
See section _JAX-RS application registration methods_ in [How to use RESTEasy Spring Boot Starter](mds/USAGE.md) for further information.

``` java
package com.test;
package com.sample.app;

import org.springframework.stereotype.Component;
import javax.ws.rs.ApplicationPath;
Expand All @@ -62,11 +62,9 @@ See [RESTEasy Spring Boot starter release notes](mds/RELEASE_NOTES.md).

## Projects

##### sample-app
A simple Spring Boot application that exposes JAX-RS endpoints as Spring beans using RESTEasy via this RESTEasy Spring Boot starter.

##### resteasy-spring-boot-starter
The RESTEasy Spring Boot Starter project.
- **sample-app**: A simple Spring Boot application that exposes JAX-RS endpoints as Spring beans using RESTEasy via this RESTEasy Spring Boot starter.
- **resteasy-spring-boot-starter**: The RESTEasy Spring Boot Starter project.
- **resteasy-spring-boot-starter-test**: Integration tests for the RESTEasy Spring Boot Starter project.

## Reporting an issue
Please open an issue using our [GitHub issues](https://github.com/paypal/resteasy-spring-boot/issues) page.
Expand All @@ -77,5 +75,5 @@ You are very welcome to contribute to RESTEasy Spring Boot starter! Read our [Co
## Contacting us
To contact us, please send an email to [email protected].

##License
## License
This project is licensed under the [Apache 2 License](License.html).
13 changes: 8 additions & 5 deletions mds/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Contribution guidelines

## Basic
- Open an issue in [GitHub issues](https://github.com/paypal/resteasy-spring-boot/issues)
- Fork the repo
- Make sure you checkout the correct development branch
- If there is not one open already, open an issue in [GitHub issues](https://github.com/paypal/resteasy-spring-boot/issues)
- Fork this repo
- Checkout `develop` branch
- Apply your changes
- Make sure all projects build and all unit tests pass
- Make sure code coverage doesn't drop (add extra unit tests if necessary)
- If fixing a bug, make sure you add an unit or integration test to expose the issue
- If adding a new feature, make sure you add an unit or integration test to test the feature
- If adding a new feature, add end user documentation as well
- Add comments to the code explaining your changes if necessary
- Create a pull request to the correct development branch (mention the issue id in the PR comments)

## Code style
Make sure to follow the code style of the existing code.
Make sure to follow the code style of the existing code. That means for example four spaces for indentation.

## Commit messages
When commiting make sure the commit message is describing what is changed and why. See the example below.
When committing, make sure the commit message is describing what is changed and why. See the example below.

[issue id] a short description
A more detailed description
Expand Down
18 changes: 18 additions & 0 deletions mds/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Release notes

## 2.3.1-RELEASE

#### Release date
May 12th, 2017.

#### Third-party versions
- RESTEasy: 3.1.0.Final
- Spring Boot: 1.5.3.RELEASE

#### New features and enhancements
1. [66 - Upgrade to Spring Boot 1.5.3.RELEASE](https://github.com/paypal/resteasy-spring-boot/issues/66)
1. [64 - Renaming `ResteasySpringBootConfig` to `RestEasyAutoConfiguration`](https://github.com/paypal/resteasy-spring-boot/issues/64)
1. [54 - Add a test case to integration tests to reproduce issue with multiple applications](https://github.com/paypal/resteasy-spring-boot/issues/54)
1. [57 - Add a test case to check for warning or error messages](https://github.com/paypal/resteasy-spring-boot/issues/57)

#### Bug fixes
1. [67 - Remove all warnings during build](https://github.com/paypal/resteasy-spring-boot/issues/67)

## 2.3.0-RELEASE

#### Release date
Expand Down
6 changes: 3 additions & 3 deletions mds/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Add the Maven dependency below to your Spring Boot application pom file.<br>
<dependency>
<groupId>com.paypal.springboot</groupId>
<artifactId>resteasy-spring-boot-starter</artifactId>
<version>2.3.0-RELEASE</version>
<version>2.3.1-RELEASE</version>
<scope>runtime</scope>
</dependency>
```
Expand All @@ -17,7 +17,7 @@ Just define your JAX-RS application class (a subclass of [Application](http://do
See section [JAX-RS application registration methods](#jax-rs-application-registration-methods) for further information.

``` java
package com.test;
package com.sample.app;

import org.springframework.stereotype.Component;
import javax.ws.rs.ApplicationPath;
Expand Down Expand Up @@ -61,7 +61,7 @@ __Important notes__
1. Property `resteasy.jaxrs.app` has been deprecated and replaced by `resteasy.jaxrs.app.classes` since version *2.2.0-RELEASE* (see [issue 35](https://github.com/paypal/resteasy-spring-boot/issues/35)). Property `resteasy.jaxrs.app` is going to be finally removed in version *3.0.0-RELEASE*.

#### RESTEasy configuration
RESTEasy offers a few configuration switches, [as seen here](http://docs.jboss.org/resteasy/docs/3.0.17.Final/userguide/html_single/index.html#d4e127), and they are set as Servlet context init parameters. In Spring Boot, Servlet context init parameters are defined via Spring Boot `application.properties` file, using the property prefix `server.context-parameters.*` (search for it in [Spring Boot reference guide](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/)).</br>
RESTEasy offers a few configuration switches, [as seen here](http://docs.jboss.org/resteasy/docs/3.1.0.Final/userguide/html_single/index.html#configuration_switches), and they are set as Servlet context init parameters. In Spring Boot, Servlet context init parameters are defined via Spring Boot `application.properties` file, using the property prefix `server.context-parameters.*` (search for it in [Spring Boot reference guide](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/)).</br>

As an example, to set RESTEasy property `resteasy.role.based.security` to `true`, just add the property bellow to Spring Boot `application.properties` file.

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.paypal.springboot</groupId>
<artifactId>resteasy-spring-boot-starter-parent</artifactId>
<version>2.3.0-RELEASE</version>
<version>2.3.1-RELEASE</version>
<packaging>pom</packaging>

<modules>
Expand Down
9 changes: 8 additions & 1 deletion resteasy-spring-boot-starter-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.paypal.springboot</groupId>
<artifactId>resteasy-spring-boot-starter-test</artifactId>
<version>2.3.0-RELEASE</version>
<version>2.3.1-RELEASE</version>
<name>${project.artifactId}</name>

<description>Integration test project for RESTEasy Spring Boot starter</description>
Expand Down Expand Up @@ -41,6 +41,12 @@
</repository>
</distributionManagement>

<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
Expand Down Expand Up @@ -125,6 +131,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20</version>
<executions>
<execution>
<id>failsafe-integration-tests</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.paypal.springboot.resteasy;

import com.test.Application;
import com.sample.app.Application;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import org.springframework.boot.SpringApplication;
import org.springframework.util.SocketUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -13,18 +14,28 @@
import static org.hamcrest.CoreMatchers.notNullValue;

/**
* This is an integration test based on a simple sample application (see sample-app project)
* This is an integration test based on a simple sample application and
* very common use cases (see sample-app project)
*
* @author facarvalho
*/
public class ResteasySpringBootStarterIT {
public class CommonUseCasesIT {

@BeforeClass
public void beforeClass() {
public void startingApplicationUp() {
RestAssured.basePath = "sample-app";
int port = SocketUtils.findAvailableTcpPort();
RestAssured.port = port;
SpringApplication.run(Application.class, "--server.port=" + port).registerShutdownHook();

SpringApplication springApplication = new SpringApplication(Application.class);
springApplication.addListeners(new LogbackTestApplicationListener());
springApplication.run("--server.port=" + port).registerShutdownHook();
}

@AfterClass
public void shuttingDownApplication() {
Response response = given().basePath("/").post("/shutdown");
response.then().statusCode(200).body("message", equalTo("Shutting down, bye..."));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.paypal.springboot.resteasy;

import com.test.Application;
import com.sample.app.Application;
import io.restassured.response.Response;
import org.springframework.beans.BeansException;
import org.springframework.boot.SpringApplication;
Expand All @@ -20,10 +20,17 @@
*
* @author facarvalho
*/
public class ResteasySpringBootStarterConfigurationIT {
public class ConfigurationIT {

private int configureAndStartApp(Properties properties) {
return configureAndStartApp(properties, true);
}

private int configureAndStartApp(Properties properties, boolean assertPerfectLog) {
SpringApplication springApplication = new SpringApplication(Application.class);
if (assertPerfectLog) {
springApplication.addListeners(new LogbackTestApplicationListener());
}
if (properties != null) {
springApplication.setDefaultProperties(properties);
}
Expand All @@ -34,6 +41,11 @@ private int configureAndStartApp(Properties properties) {
return port;
}

private void appShutdown(int port) {
Response response = given().basePath("/").port(port).post("/shutdown");
response.then().statusCode(200).body("message", equalTo("Shutting down, bye..."));
}

private void assertResourceFound(int port, String basePath) {
Response response = given().basePath(basePath).port(port).body("is there anybody out there?").post("/echo");
response.then().statusCode(200).body("timestamp", notNullValue()).body("echoText", equalTo("is there anybody out there?"));
Expand All @@ -51,6 +63,8 @@ public void implicitAutoTest() {
assertResourceFound(port, "sample-app");
assertResourceNotFound(port, "sample-app-test");
assertResourceNotFound(port, "/");

appShutdown(port);
}

@Test
Expand All @@ -63,6 +77,8 @@ public void explicitAutoTest() {
assertResourceFound(port, "sample-app");
assertResourceNotFound(port, "sample-app-test");
assertResourceNotFound(port, "/");

appShutdown(port);
}

@Test
Expand All @@ -75,19 +91,23 @@ public void beansTest() {
assertResourceFound(port, "sample-app");
assertResourceNotFound(port, "sample-app-test");
assertResourceNotFound(port, "/");

appShutdown(port);
}

@Test
public void propertySpringBeanClassTest() {
Properties properties = new Properties();
properties.put("resteasy.jaxrs.app.registration", "property");
properties.put("resteasy.jaxrs.app.classes", "com.test.JaxrsApplication");
properties.put("resteasy.jaxrs.app.classes", "com.sample.app.JaxrsApplication");

int port = configureAndStartApp(properties);

assertResourceFound(port, "sample-app");
assertResourceNotFound(port, "sample-app-test");
assertResourceNotFound(port, "/");

appShutdown(port);
}

@Test
Expand All @@ -101,6 +121,8 @@ public void propertyNonSpringBeanClassTest() {
assertResourceNotFound(port, "sample-app");
assertResourceFound(port, "sample-app-test");
assertResourceNotFound(port, "/");

appShutdown(port);
}

@Test
Expand All @@ -110,7 +132,7 @@ public void invalidClassTest() {
properties.put("resteasy.jaxrs.app.classes", "com.foor.bar.NonExistentApplicationClass");

try {
configureAndStartApp(properties);
configureAndStartApp(properties, false);

Assert.fail("Expected exception, due to class not found, has not been thrown");
} catch (BeansException ex) {
Expand All @@ -129,6 +151,8 @@ public void scanningTest() {
assertResourceFound(port, "sample-app");
assertResourceFound(port, "sample-app-test");
assertResourceNotFound(port, "/");

appShutdown(port);
}

}
Loading

0 comments on commit 629cf7a

Please sign in to comment.