Upgrade samples to Spring Boot 1.3.3.RELEASE
Closes gh-222
This commit is contained in:
@@ -59,8 +59,8 @@ public class SampleBuildConfigurer {
|
||||
}
|
||||
sampleBuild.doFirst {
|
||||
replaceVersion(new File(this.workingDir, 'build.gradle'),
|
||||
"springRestdocsVersion = '.*'",
|
||||
"springRestdocsVersion = '${project.version}'")
|
||||
"ext\\['spring-restdocs.version'\\] = '.*'",
|
||||
"ext['spring-restdocs.version'] = '${project.version}'")
|
||||
}
|
||||
}
|
||||
else if (new File(sampleDir, 'pom.xml').isFile()) {
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE'
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,14 @@ targetCompatibility = 1.7
|
||||
|
||||
ext {
|
||||
snippetsDir = file('build/generated-snippets')
|
||||
springRestdocsVersion = '1.1.0.BUILD-SNAPSHOT'
|
||||
}
|
||||
|
||||
ext['spring-restdocs.version'] = '1.1.0.BUILD-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile "org.springframework.restdocs:spring-restdocs-restassured:$springRestdocsVersion"
|
||||
testCompile "org.springframework.restdocs:spring-restdocs-restassured:${project.ext['spring-restdocs.version']}"
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE'
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,10 @@ targetCompatibility = 1.7
|
||||
|
||||
ext {
|
||||
snippetsDir = file('build/generated-snippets')
|
||||
springRestdocsVersion = '1.1.0.BUILD-SNAPSHOT'
|
||||
}
|
||||
|
||||
ext['spring-restdocs.version'] = '1.1.0.BUILD-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-rest'
|
||||
@@ -36,7 +37,7 @@ dependencies {
|
||||
|
||||
testCompile 'com.jayway.jsonpath:json-path'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile "org.springframework.restdocs:spring-restdocs-mockmvc:$springRestdocsVersion"
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
@@ -17,13 +17,9 @@
|
||||
package com.example.notes;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@EnableJpaRepositories
|
||||
@SpringBootApplication
|
||||
public class RestNotesSlate {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.2.7.RELEASE</version>
|
||||
<version>1.3.3.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.restdocs</groupId>
|
||||
<artifactId>spring-restdocs-mockmvc</artifactId>
|
||||
<version>${spring-restdocs.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -138,6 +138,10 @@ include::{snippets}/notes-list-example/curl-request.adoc[]
|
||||
|
||||
include::{snippets}/notes-list-example/http-response.adoc[]
|
||||
|
||||
[[resources-notes-list-links]]
|
||||
==== Links
|
||||
|
||||
include::{snippets}/notes-list-example/links.adoc[]
|
||||
|
||||
|
||||
[[resources-notes-create]]
|
||||
@@ -183,6 +187,11 @@ include::{snippets}/tags-list-example/curl-request.adoc[]
|
||||
|
||||
include::{snippets}/tags-list-example/http-response.adoc[]
|
||||
|
||||
[[resources-tags-list-links]]
|
||||
==== Links
|
||||
|
||||
include::{snippets}/tags-list-example/links.adoc[]
|
||||
|
||||
|
||||
|
||||
[[resources-tags-create]]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,13 +17,9 @@
|
||||
package com.example.notes;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@EnableJpaRepositories
|
||||
@SpringBootApplication
|
||||
public class RestNotesSpringDataRest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -133,8 +133,12 @@ public class ApiDocumentation {
|
||||
this.mockMvc.perform(get("/notes"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("notes-list-example",
|
||||
links(
|
||||
linkWithRel("self").description("Canonical link for this resource"),
|
||||
linkWithRel("profile").description("The ALPS profile for this resource")),
|
||||
responseFields(
|
||||
fieldWithPath("_embedded.notes").description("An array of <<resources-note, Note resources>>"))));
|
||||
fieldWithPath("_embedded.notes").description("An array of <<resources-note, Note resources>>"),
|
||||
fieldWithPath("_links").description("<<resources-tags-list-links, Links>> to other resources"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -195,9 +199,11 @@ public class ApiDocumentation {
|
||||
.andExpect(jsonPath("body", is(note.get("body"))))
|
||||
.andExpect(jsonPath("_links.self.href", is(noteLocation)))
|
||||
.andExpect(jsonPath("_links.tags", is(notNullValue())))
|
||||
.andDo(print())
|
||||
.andDo(document("note-get-example",
|
||||
links(
|
||||
linkWithRel("self").description("This <<resources-note,note>>"),
|
||||
linkWithRel("self").description("Canonical link for this <<resources-note,note>>"),
|
||||
linkWithRel("note").description("This <<resources-note,note>>"),
|
||||
linkWithRel("tags").description("This note's tags")),
|
||||
responseFields(
|
||||
fieldWithPath("title").description("The title of the note"),
|
||||
@@ -217,8 +223,12 @@ public class ApiDocumentation {
|
||||
this.mockMvc.perform(get("/tags"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("tags-list-example",
|
||||
links(
|
||||
linkWithRel("self").description("Canonical link for this resource"),
|
||||
linkWithRel("profile").description("The ALPS profile for this resource")),
|
||||
responseFields(
|
||||
fieldWithPath("_embedded.tags").description("An array of <<resources-tag,Tag resources>>"))));
|
||||
fieldWithPath("_embedded.tags").description("An array of <<resources-tag,Tag resources>>"),
|
||||
fieldWithPath("_links").description("<<resources-tags-list-links, Links>> to other resources"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -295,7 +305,8 @@ public class ApiDocumentation {
|
||||
.andExpect(jsonPath("name", is(tag.get("name"))))
|
||||
.andDo(document("tag-get-example",
|
||||
links(
|
||||
linkWithRel("self").description("This <<resources-tag,tag>>"),
|
||||
linkWithRel("self").description("Canonical link for this <<resources-tag,tag>>"),
|
||||
linkWithRel("tag").description("This <<resources-tag,tag>>"),
|
||||
linkWithRel("notes").description("The <<resources-tagged-notes,notes>> that have this tag")),
|
||||
responseFields(
|
||||
fieldWithPath("name").description("The name of the tag"),
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE'
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,10 @@ targetCompatibility = 1.7
|
||||
|
||||
ext {
|
||||
snippetsDir = file('build/generated-snippets')
|
||||
springRestdocsVersion = '1.1.0.BUILD-SNAPSHOT'
|
||||
}
|
||||
|
||||
ext['spring-restdocs.version'] = '1.1.0.BUILD-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
compile 'org.springframework.boot:spring-boot-starter-hateoas'
|
||||
@@ -40,7 +41,7 @@ dependencies {
|
||||
|
||||
testCompile 'com.jayway.jsonpath:json-path'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile "org.springframework.restdocs:spring-restdocs-mockmvc:$springRestdocsVersion"
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,13 +17,9 @@
|
||||
package com.example.notes;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@EnableJpaRepositories
|
||||
@SpringBootApplication
|
||||
public class RestNotesSpringHateoas {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE'
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ targetCompatibility = 1.7
|
||||
|
||||
ext {
|
||||
snippetsDir = file('build/generated-snippets')
|
||||
springRestdocsVersion = '1.1.0.BUILD-SNAPSHOT'
|
||||
}
|
||||
ext['spring-restdocs.version'] = '1.1.0.BUILD-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||
@@ -37,7 +37,7 @@ dependencies {
|
||||
exclude group: 'junit', module: 'junit;'
|
||||
}
|
||||
testCompile 'org.testng:testng:6.9.10'
|
||||
testCompile "org.springframework.restdocs:spring-restdocs-mockmvc:$springRestdocsVersion"
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
Reference in New Issue
Block a user