Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit c47fbb1

Browse files
authored
Initial setup for Travis CI (#48)
* Initial setup for Travis CI * Fixed Travis CI batch * Add unreleased Spring REST Docs core test JAR * More stable JSON comparison * Add JDK 8 as a testing target * Add missing Servlet dependency * Removed Java Money dependency because it's JDK8 only
1 parent c6524b8 commit c47fbb1

File tree

13 files changed

+66
-17
lines changed

13 files changed

+66
-17
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: java
2+
3+
jdk:
4+
- oraclejdk8
5+
- oraclejdk7
6+
7+
before_install:
8+
- mvn install:install-file -Dfile=lib/spring-restdocs-core-1.1.2.RELEASE-test.jar
9+
-DgroupId=org.springframework.restdocs -DartifactId=spring-restdocs-core
10+
-Dversion=1.1.2.RELEASE -Dpackaging=jar -Dclassifier=test

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Spring Auto REST Docs
2+
[![Apache License 2](https://img.shields.io/badge/license-ASF2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.txt)
3+
[![Build Status](https://travis-ci.org/ScaCap/spring-auto-restdocs.svg?branch=master.svg?branch=master)](https://travis-ci.org/ScaCap/spring-auto-restdocs.svg?branch=master)
24

35
**Full documentation at https://scacap.github.io/spring-auto-restdocs**
46

173 KB
Binary file not shown.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
<groupId>org.apache.maven.plugins</groupId>
9090
<artifactId>maven-compiler-plugin</artifactId>
9191
<configuration>
92-
<source>${maven.compiler.source}</source>
93-
<target>${maven.compiler.target}</target>
92+
<source>${java.version}</source>
93+
<target>${java.version}</target>
9494
</configuration>
9595
</plugin>
9696
<plugin>

spring-auto-restdocs-core/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@
7777
<groupId>javax.el</groupId>
7878
<artifactId>javax.el-api</artifactId>
7979
</dependency>
80+
<dependency>
81+
<groupId>javax.servlet</groupId>
82+
<artifactId>javax.servlet-api</artifactId>
83+
<version>3.1.0</version>
84+
<scope>provided</scope>
85+
</dependency>
8086
<dependency>
8187
<groupId>org.slf4j</groupId>
8288
<artifactId>slf4j-simple</artifactId>

spring-auto-restdocs-example/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@
7171
<artifactId>spring-auto-restdocs-core</artifactId>
7272
<version>${project.version}</version>
7373
</dependency>
74-
<dependency>
75-
<groupId>org.javamoney</groupId>
76-
<artifactId>moneta</artifactId>
77-
<version>1.0</version>
78-
</dependency>
7974
<dependency>
8075
<groupId>org.springframework.data</groupId>
8176
<artifactId>spring-data-commons</artifactId>

spring-auto-restdocs-example/src/main/java/capital/scalable/restdocs/example/items/ItemResource.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import capital.scalable.restdocs.example.items.ItemResponse.Attributes;
3232
import capital.scalable.restdocs.example.items.ItemResponse.Metadata;
33-
import org.javamoney.moneta.Money;
3433
import org.springframework.data.domain.Page;
3534
import org.springframework.data.domain.PageImpl;
3635
import org.springframework.http.HttpStatus;

spring-auto-restdocs-example/src/main/java/capital/scalable/restdocs/example/items/ItemResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import lombok.Value;
3434
import org.hibernate.validator.constraints.NotBlank;
3535
import org.hibernate.validator.constraints.NotEmpty;
36-
import org.javamoney.moneta.Money;
3736

3837
/**
3938
* Java object for a single JSON item.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package capital.scalable.restdocs.example.items;
2+
3+
import java.math.BigDecimal;
4+
5+
/**
6+
* Simplified version of Java Money (JDK8 only) to demonstrate custom serializers.
7+
*/
8+
public class Money {
9+
10+
private final String currencyCode;
11+
12+
private final BigDecimal number;
13+
14+
private Money(BigDecimal number, String currencyCode) {
15+
this.currencyCode = currencyCode;
16+
this.number = number;
17+
}
18+
19+
public String getCurrencyCode() {
20+
return currencyCode;
21+
}
22+
23+
public BigDecimal getNumberStripped() {
24+
if (this.number.signum() == 0) {
25+
return BigDecimal.ZERO;
26+
}
27+
return this.number.stripTrailingZeros();
28+
}
29+
30+
public static Money of(BigDecimal number, String currencyCode) {
31+
return new Money(number, currencyCode);
32+
}
33+
}

spring-auto-restdocs-example/src/main/java/capital/scalable/restdocs/example/jackson/JsonConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package capital.scalable.restdocs.example.jackson;
1818

19+
import capital.scalable.restdocs.example.items.Money;
1920
import com.fasterxml.jackson.annotation.JsonAutoDetect;
2021
import com.fasterxml.jackson.databind.ObjectMapper;
2122
import com.fasterxml.jackson.databind.module.SimpleModule;
22-
import org.javamoney.moneta.Money;
2323
import org.springframework.context.annotation.Bean;
2424
import org.springframework.context.annotation.Configuration;
2525

0 commit comments

Comments
 (0)