Upgrade to Gradle 6.8 and modernize the build
Closes gh-719
This commit is contained in:
293
build.gradle
293
build.gradle
@@ -1,185 +1,117 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.spring.io/plugins-snapshot' }
|
||||
maven { url 'https://repo.spring.io/plugins-release' }
|
||||
maven { url 'https://plugins.gradle.org/m2/' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
|
||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
|
||||
classpath 'io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE'
|
||||
classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$javaFormatVersion"
|
||||
classpath 'io.spring.nohttp:nohttp-gradle:0.0.2.RELEASE'
|
||||
}
|
||||
plugins {
|
||||
id 'io.spring.javaformat' version "$javaFormatVersion" apply false
|
||||
id 'io.spring.nohttp' version '0.0.6.RELEASE' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = 'org.springframework.restdocs'
|
||||
group = "org.springframework.restdocs"
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url "https://repo.spring.io/snapshot" }
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'samples'
|
||||
apply plugin: 'org.sonarqube'
|
||||
apply plugin: 'io.spring.nohttp'
|
||||
|
||||
sonarqube {
|
||||
properties {
|
||||
property 'sonar.jacoco.reportPath', "${buildDir.name}/jacoco.exec"
|
||||
property 'sonar.java.coveragePlugin', 'jacoco'
|
||||
property 'sonar.links.ci', 'https://build.spring.io/browse/SRD'
|
||||
property 'sonar.links.homepage', 'https://github.com/spring-projects/spring-restdocs'
|
||||
property 'sonar.links.issue', 'https://github.com/spring-projects/spring-restdocs'
|
||||
property 'sonar.links.scm', 'https://github.com/spring-projects/spring-restdocs'
|
||||
}
|
||||
}
|
||||
apply plugin: "samples"
|
||||
apply plugin: "io.spring.nohttp"
|
||||
|
||||
nohttp {
|
||||
source.exclude 'samples/rest-notes-slate/slate/source/javascripts/lib/_jquery*.js'
|
||||
source.exclude 'buildSrc/.gradle/**'
|
||||
source.exclude '**/build/**'
|
||||
source.exclude '**/target/**'
|
||||
whitelistFile = project.file('config/nohttp/whitelist.lines')
|
||||
source.exclude "samples/rest-notes-slate/slate/source/javascripts/lib/_jquery*.js"
|
||||
source.exclude "buildSrc/.gradle/**"
|
||||
source.exclude "**/build/**"
|
||||
source.exclude "**/target/**"
|
||||
}
|
||||
|
||||
ext {
|
||||
springVersion = '5.0.15.RELEASE'
|
||||
springVersion = "5.0.15.RELEASE"
|
||||
javadocLinks = [
|
||||
'https://docs.oracle.com/javase/8/docs/api/',
|
||||
"https://docs.oracle.com/javase/8/docs/api/",
|
||||
"https://docs.spring.io/spring-framework/docs/$springVersion/javadoc-api/",
|
||||
'https://docs.jboss.org/hibernate/stable/beanvalidation/api/',
|
||||
'https://docs.jboss.org/hibernate/stable/validator/api/'
|
||||
"https://docs.jboss.org/hibernate/stable/beanvalidation/api/",
|
||||
"https://docs.jboss.org/hibernate/stable/validator/api/"
|
||||
] as String[]
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'propdeps'
|
||||
apply plugin: 'propdeps-eclipse'
|
||||
apply plugin: 'propdeps-maven'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'matrixtest'
|
||||
subprojects { subproject ->
|
||||
plugins.withType(JavaPlugin) {
|
||||
subproject.apply plugin: "io.spring.javaformat"
|
||||
subproject.apply plugin: "checkstyle"
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom "org.springframework:spring-framework-bom:$springVersion"
|
||||
configurations {
|
||||
internal {
|
||||
canBeConsumed = false
|
||||
canBeResolved = false
|
||||
}
|
||||
compileClasspath.extendsFrom(internal)
|
||||
runtimeClasspath.extendsFrom(internal)
|
||||
testCompileClasspath.extendsFrom(internal)
|
||||
testRuntimeClasspath.extendsFrom(internal)
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging {
|
||||
exceptionFormat "full"
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs = [ "-Xlint:deprecation", "-Xlint:-options", "-Werror" ]
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.withType(Test) {
|
||||
maxHeapSize = "1024M"
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||
configProperties = [ "checkstyle.config.dir" : rootProject.file("config/checkstyle") ]
|
||||
toolVersion = "8.22"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
dependency 'com.fasterxml.jackson.core:jackson-databind:2.9.5'
|
||||
dependency 'com.samskivert:jmustache:1.12'
|
||||
dependency 'commons-codec:commons-codec:1.10'
|
||||
dependency 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
dependency 'javax.validation:validation-api:2.0.0.Final'
|
||||
dependency 'junit:junit:4.12'
|
||||
dependency 'io.rest-assured:rest-assured:3.0.7'
|
||||
dependency 'org.apache.pdfbox:pdfbox:2.0.7'
|
||||
dependency 'org.assertj:assertj-core:3.11.1'
|
||||
dependency 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.18'
|
||||
dependency 'org.hamcrest:hamcrest-core:1.3'
|
||||
dependency 'org.hamcrest:hamcrest-library:1.3'
|
||||
dependency 'org.hibernate.validator:hibernate-validator:6.0.9.Final'
|
||||
dependency 'org.jacoco:org.jacoco.agent:0.7.9'
|
||||
dependency 'org.javamoney:moneta:1.1'
|
||||
dependency 'org.jruby:jruby-complete:9.1.13.0'
|
||||
dependency 'org.junit.jupiter:junit-jupiter-api:5.0.0'
|
||||
dependency 'org.mockito:mockito-core:1.10.19'
|
||||
dependency 'org.springframework.hateoas:spring-hateoas:0.23.0.RELEASE'
|
||||
dependency 'org.synchronoss.cloud:nio-multipart-parser:1.1.0'
|
||||
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:$javaFormatVersion")
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging {
|
||||
exceptionFormat "full"
|
||||
}
|
||||
}
|
||||
plugins.withType(MavenPublishPlugin) {
|
||||
subproject.apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
|
||||
|
||||
eclipseJdt {
|
||||
inputFile = rootProject.file('config/eclipse/org.eclipse.jdt.core.prefs')
|
||||
doLast {
|
||||
project.file('.settings/org.eclipse.jdt.ui.prefs').withWriter { writer ->
|
||||
writer << rootProject.file('config/eclipse/org.eclipse.jdt.ui.prefs').text
|
||||
javadoc {
|
||||
description = "Generates project-level javadoc for use in -javadoc jar"
|
||||
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = "Spring REST Docs $version"
|
||||
options.docTitle = "${options.header} API"
|
||||
options.links = javadocLinks
|
||||
options.addStringOption "-quiet"
|
||||
options.encoding = "UTF-8"
|
||||
options.source = "1.8"
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs = [ '-Xlint:deprecation', '-Xlint:-options', '-Werror' ]
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def codeProjects = subprojects - project(":docs")
|
||||
configure(codeProjects) {
|
||||
apply plugin: 'io.spring.javaformat'
|
||||
apply plugin: 'checkstyle'
|
||||
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
|
||||
|
||||
checkstyle {
|
||||
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
|
||||
configProperties = [ 'checkstyle.config.dir' : rootProject.file('config/checkstyle') ]
|
||||
toolVersion = '8.22'
|
||||
}
|
||||
|
||||
configurations {
|
||||
jacoco
|
||||
}
|
||||
|
||||
dependencies {
|
||||
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$javaFormatVersion"
|
||||
jacoco 'org.jacoco:org.jacoco.agent::runtime'
|
||||
}
|
||||
}
|
||||
|
||||
def publishedCodeProjects = codeProjects.findAll { codeProject -> !codeProject.name.contains('spring-restdocs-asciidoctor-')}
|
||||
configure(publishedCodeProjects) { subproject ->
|
||||
javadoc {
|
||||
description = "Generates project-level javadoc for use in -javadoc jar"
|
||||
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = "Spring REST Docs $version"
|
||||
options.docTitle = "${options.header} API"
|
||||
options.links = javadocLinks
|
||||
options.addStringOption '-quiet'
|
||||
options.encoding = 'UTF-8'
|
||||
options.source = '1.8'
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from project.sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
classifier = "javadoc"
|
||||
from javadoc
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
}
|
||||
}
|
||||
|
||||
samples {
|
||||
dependOn 'spring-restdocs-core:install'
|
||||
dependOn 'spring-restdocs-mockmvc:install'
|
||||
dependOn 'spring-restdocs-restassured:install'
|
||||
dependOn 'spring-restdocs-webtestclient:install'
|
||||
dependOn 'spring-restdocs-asciidoctor:install'
|
||||
dependOn "spring-restdocs-core:publishToMavenLocal"
|
||||
dependOn "spring-restdocs-mockmvc:publishToMavenLocal"
|
||||
dependOn "spring-restdocs-restassured:publishToMavenLocal"
|
||||
dependOn "spring-restdocs-webtestclient:publishToMavenLocal"
|
||||
dependOn "spring-restdocs-asciidoctor:publishToMavenLocal"
|
||||
|
||||
restNotesSpringHateoas {
|
||||
workingDir "$projectDir/samples/rest-notes-spring-hateoas"
|
||||
@@ -215,49 +147,52 @@ samples {
|
||||
task api (type: Javadoc) {
|
||||
group = "Documentation"
|
||||
description = "Generates aggregated Javadoc API documentation."
|
||||
dependsOn {
|
||||
subprojects.collect {
|
||||
it.tasks.getByName("jar")
|
||||
project.rootProject.gradle.projectsEvaluated {
|
||||
Set<String> excludedProjects = ['spring-restdocs-asciidoctor']
|
||||
Set<Project> publishedProjects = rootProject.subprojects.findAll { it != project}
|
||||
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
|
||||
.findAll { !excludedProjects.contains(it.name) }
|
||||
.findAll { !it.name.startsWith('spring-boot-starter') }
|
||||
dependsOn publishedProjects.javadoc
|
||||
source publishedProjects.javadoc.source
|
||||
classpath = project.files(publishedProjects.javadoc.classpath)
|
||||
destinationDir = project.file "${buildDir}/docs/javadoc"
|
||||
options {
|
||||
author = true
|
||||
docTitle = "Spring REST Docs ${project.version} API"
|
||||
encoding = "UTF-8"
|
||||
memberLevel = "protected"
|
||||
outputLevel = "quiet"
|
||||
source = "1.8"
|
||||
splitIndex = true
|
||||
stylesheetFile = file("src/main/javadoc/spring-javadoc.css")
|
||||
use = true
|
||||
windowTitle = "Spring REST Docs ${project.version} API"
|
||||
}
|
||||
}
|
||||
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = "Spring REST Docs $version"
|
||||
options.splitIndex = true
|
||||
options.links = javadocLinks
|
||||
options.addStringOption '-quiet'
|
||||
|
||||
source publishedCodeProjects.findAll { it.name != 'spring-restdocs-asciidoctor' }
|
||||
.collect { it.sourceSets.main.allJava }
|
||||
|
||||
destinationDir = new File(buildDir, "api")
|
||||
|
||||
doFirst {
|
||||
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
|
||||
}
|
||||
}
|
||||
|
||||
task docsZip(type: Zip, dependsOn: [':docs:asciidoctor', ':api', ':buildSamples']) {
|
||||
group = 'Distribution'
|
||||
baseName = 'spring-restdocs'
|
||||
classifier = 'docs'
|
||||
description = "Builds -${classifier} archive containing API and reference documentation"
|
||||
destinationDir = file("${project.buildDir}/distributions")
|
||||
task docsZip(type: Zip, dependsOn: [":docs:asciidoctor", ":api", ":buildSamples"]) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-restdocs"
|
||||
archiveClassifier = "docs"
|
||||
description = "Builds -${archiveClassifier} archive containing API and reference documentation"
|
||||
destinationDirectory = file("${project.buildDir}/distributions")
|
||||
|
||||
from(project.tasks.findByPath(':docs:asciidoctor')) {
|
||||
into 'reference'
|
||||
from(project.tasks.findByPath(":docs:asciidoctor")) {
|
||||
into "reference"
|
||||
}
|
||||
|
||||
from(api) {
|
||||
into 'api'
|
||||
into "api"
|
||||
}
|
||||
|
||||
from(file('samples/rest-notes-spring-hateoas/build/asciidoc/html5')) {
|
||||
into 'samples/restful-notes'
|
||||
from(file("samples/rest-notes-spring-hateoas/build/asciidoc/html5")) {
|
||||
into "samples/restful-notes"
|
||||
}
|
||||
|
||||
from(file('samples/rest-notes-slate/build/docs')) {
|
||||
into 'samples/slate'
|
||||
from(file("samples/rest-notes-slate/build/docs")) {
|
||||
into "samples/slate"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
buildSrc/build.gradle
Normal file
4
buildSrc/build.gradle
Normal file
@@ -0,0 +1,4 @@
|
||||
plugins {
|
||||
id "java-gradle-plugin"
|
||||
id "groovy-gradle-plugin"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -55,7 +55,7 @@ public class SampleBuildConfigurer {
|
||||
sampleBuild.dependsOn gradleVersionsUpdate
|
||||
if (build) {
|
||||
Task gradleBuild = createGradleBuild(project, sampleDir, dependencies)
|
||||
Task verifyIncludesTask = createVerifyIncludes(project, new File(sampleDir, 'build/asciidoc'))
|
||||
Task verifyIncludesTask = createVerifyIncludes(project, new File(sampleDir, 'build/docs/asciidoc'))
|
||||
verifyIncludesTask.dependsOn gradleBuild
|
||||
sampleBuild.dependsOn verifyIncludesTask
|
||||
gradleBuild.dependsOn gradleVersionsUpdate
|
||||
@@ -161,4 +161,4 @@ public class SampleBuildConfigurer {
|
||||
}
|
||||
return verifyIncludesTask
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2014-2021 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.build.optional;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.attributes.Bundling;
|
||||
import org.gradle.api.attributes.LibraryElements;
|
||||
import org.gradle.api.attributes.Usage;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||
|
||||
/**
|
||||
* A {@code Plugin} that adds support for Maven-style optional dependencies. Creates a new
|
||||
* {@code optional} configuration. The {@code optional} configuration is part of the
|
||||
* project's compile and runtime classpath's but does not affect the classpath of
|
||||
* dependent projects.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class OptionalDependenciesPlugin implements Plugin<Project> {
|
||||
|
||||
/**
|
||||
* Name of the {@code optional} configuration.
|
||||
*/
|
||||
public static final String OPTIONAL_CONFIGURATION_NAME = "optional";
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
Configuration optional = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME);
|
||||
project.getConfigurations().getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
project.getConfigurations().getByName(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
project.getConfigurations().getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
project.getConfigurations().getByName(JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
project.getConfigurations().getByName(JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME).extendsFrom(optional);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
implementation-class:org.springframework.restdocs.build.optional.OptionalDependenciesPlugin
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="com.puppycrawl.tools.checkstyle.Checker">
|
||||
<module name="io.spring.javaformat.checkstyle.SpringChecks" />
|
||||
<module name="io.spring.javaformat.checkstyle.SpringChecks">
|
||||
<property name="avoidStaticImportExcludes" value=" org.springframework.restdocs.cli.CliDocumentation.*"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -1,31 +1,87 @@
|
||||
plugins {
|
||||
id 'org.asciidoctor.convert' version '1.5.9.2'
|
||||
id "org.asciidoctor.jvm.convert" version "3.2.0"
|
||||
id "java-library"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url 'https://repo.spring.io/release' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
maven { url "https://repo.spring.io/release" }
|
||||
maven { url "https://repo.spring.io/snapshot" }
|
||||
}
|
||||
|
||||
configurations {
|
||||
asciidoctorExt
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctor 'io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.2.RELEASE'
|
||||
testCompile project(':spring-restdocs-mockmvc')
|
||||
testCompile project(':spring-restdocs-restassured')
|
||||
testCompile project(':spring-restdocs-webtestclient')
|
||||
testCompile 'io.rest-assured:rest-assured'
|
||||
testCompile 'javax.validation:validation-api'
|
||||
testCompile 'junit:junit'
|
||||
testCompile 'org.testng:testng:6.9.10'
|
||||
testCompile 'org.junit.jupiter:junit-jupiter-api'
|
||||
asciidoctorExt("io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch:0.5.0")
|
||||
|
||||
internal(platform(project(":spring-restdocs-platform")))
|
||||
|
||||
testImplementation(project(":spring-restdocs-mockmvc"))
|
||||
testImplementation(project(":spring-restdocs-restassured"))
|
||||
testImplementation(project(":spring-restdocs-webtestclient"))
|
||||
testImplementation("io.rest-assured:rest-assured")
|
||||
testImplementation("javax.validation:validation-api")
|
||||
testImplementation("junit:junit")
|
||||
testImplementation("org.testng:testng:6.9.10")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api")
|
||||
}
|
||||
|
||||
tasks.findByPath("artifactoryPublish")?.enabled = false
|
||||
|
||||
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
|
||||
baseDirFollowsSourceDir()
|
||||
}
|
||||
|
||||
jar {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
javadoc {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
configurations 'asciidoctorExt'
|
||||
sources {
|
||||
include 'index.adoc'
|
||||
include "index.adoc"
|
||||
}
|
||||
attributes 'revnumber': project.version,
|
||||
'branch-or-tag': project.version.endsWith('SNAPSHOT') ? 'main': "v${project.version}"
|
||||
attributes "revnumber": project.version,
|
||||
"branch-or-tag": project.version.endsWith("SNAPSHOT") ? "main": "v${project.version}"
|
||||
inputs.files(sourceSets.test.java)
|
||||
}
|
||||
|
||||
task api (type: Javadoc) {
|
||||
group = "Documentation"
|
||||
description = "Generates aggregated Javadoc API documentation."
|
||||
dependsOn {
|
||||
subprojects.collect {
|
||||
it.tasks.getByName("jar")
|
||||
}
|
||||
}
|
||||
project.rootProject.gradle.projectsEvaluated {
|
||||
Set<String> excludedProjects = ['spring-restdocs-asciidoctor']
|
||||
Set<Project> publishedProjects = rootProject.subprojects.findAll { it != project}
|
||||
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
|
||||
.findAll { !excludedProjects.contains(it.name) }
|
||||
dependsOn publishedProjects.javadoc
|
||||
source publishedProjects.javadoc.source
|
||||
classpath = project.files(publishedProjects.javadoc.classpath)
|
||||
destinationDir = project.file "${buildDir}/docs/javadoc"
|
||||
options {
|
||||
author = true
|
||||
docTitle = "Spring REST Docs ${project.version} API"
|
||||
encoding = "UTF-8"
|
||||
memberLevel = "protected"
|
||||
outputLevel = "quiet"
|
||||
source = "1.8"
|
||||
splitIndex = true
|
||||
stylesheetFile = file("src/main/javadoc/spring-javadoc.css")
|
||||
use = true
|
||||
windowTitle = "Spring REST Docs ${project.version} API"
|
||||
}
|
||||
}
|
||||
|
||||
destinationDir = new File(buildDir, "api")
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ the configuration are described in the following listings:
|
||||
|
||||
dependencies {
|
||||
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor:{project-version}' <2>
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc:{project-version}' <3>
|
||||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:{project-version}' <3>
|
||||
}
|
||||
|
||||
ext { <4>
|
||||
@@ -172,7 +172,7 @@ the configuration are described in the following listings:
|
||||
This will automatically configure the `snippets` attribute for use in your `.adoc`
|
||||
files to point to `build/generated-snippets`. It will also allow you to use the
|
||||
`operation` block macro.
|
||||
<3> Add a dependency on `spring-restdocs-mockmvc` in the `testCompile` configuration. If
|
||||
<3> Add a dependency on `spring-restdocs-mockmvc` in the `testImplementation` configuration. If
|
||||
you want to use `WebTestClient` or REST Assured rather than MockMvc, add a dependency
|
||||
on `spring-restdocs-webtestclient` or `spring-restdocs-restassured` respectively
|
||||
instead.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -22,12 +22,16 @@ import org.springframework.restdocs.hypermedia.LinksSnippet;
|
||||
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.linkWithRel;
|
||||
|
||||
public class Hypermedia {
|
||||
public final class Hypermedia {
|
||||
|
||||
private Hypermedia() {
|
||||
|
||||
}
|
||||
|
||||
// tag::ignore-links[]
|
||||
public static LinksSnippet links(LinkDescriptor... descriptors) {
|
||||
return HypermediaDocumentation.links(linkWithRel("self").ignored().optional(),
|
||||
linkWithRel("curies").ignored()).and(descriptors);
|
||||
return HypermediaDocumentation.links(linkWithRel("self").ignored().optional(), linkWithRel("curies").ignored())
|
||||
.and(descriptors);
|
||||
}
|
||||
// end::ignore-links[]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -27,8 +27,7 @@ public class Payload {
|
||||
@SuppressWarnings("unused")
|
||||
public void bookFieldDescriptors() {
|
||||
// tag::book-descriptors[]
|
||||
FieldDescriptor[] book = new FieldDescriptor[] {
|
||||
fieldWithPath("title").description("Title of the book"),
|
||||
FieldDescriptor[] book = new FieldDescriptor[] { fieldWithPath("title").description("Title of the book"),
|
||||
fieldWithPath("author").description("Author of the book") };
|
||||
// end::book-descriptors[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -29,6 +29,7 @@ public class SnippetReuse {
|
||||
linkWithRel("last").optional().description("The last page of results"),
|
||||
linkWithRel("next").optional().description("The next page of results"),
|
||||
linkWithRel("prev").optional().description("The previous page of results"));
|
||||
|
||||
// end::field[]
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -42,8 +42,7 @@ public class CustomDefaultOperationPreprocessors {
|
||||
public void setup() {
|
||||
// tag::custom-default-operation-preprocessors[]
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation)
|
||||
.operationPreprocessors()
|
||||
.apply(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -43,8 +43,7 @@ public class CustomDefaultSnippets {
|
||||
public void setUp() {
|
||||
// tag::custom-default-snippets[]
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation).snippets()
|
||||
.withDefaults(curlRequest()))
|
||||
.apply(documentationConfiguration(this.restDocumentation).snippets().withDefaults(curlRequest()))
|
||||
.build();
|
||||
// end::custom-default-snippets[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,6 +18,7 @@ package com.example.mockmvc;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -41,8 +42,7 @@ public class CustomEncoding {
|
||||
public void setUp() {
|
||||
// tag::custom-encoding[]
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation)
|
||||
.snippets().withEncoding("ISO-8859-1"))
|
||||
.apply(documentationConfiguration(this.restDocumentation).snippets().withEncoding("ISO-8859-1"))
|
||||
.build();
|
||||
// end::custom-encoding[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,6 +18,7 @@ package com.example.mockmvc;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
||||
import org.springframework.restdocs.templates.TemplateFormats;
|
||||
@@ -42,8 +43,8 @@ public class CustomFormat {
|
||||
public void setUp() {
|
||||
// tag::custom-format[]
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation)
|
||||
.snippets().withTemplateFormat(TemplateFormats.markdown()))
|
||||
.apply(documentationConfiguration(this.restDocumentation).snippets()
|
||||
.withTemplateFormat(TemplateFormats.markdown()))
|
||||
.build();
|
||||
// end::custom-format[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,6 +18,7 @@ package com.example.mockmvc;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -41,10 +42,8 @@ public class CustomUriConfiguration {
|
||||
public void setUp() {
|
||||
// tag::custom-uri-configuration[]
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation).uris()
|
||||
.withScheme("https")
|
||||
.withHost("example.com")
|
||||
.withPort(443))
|
||||
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https")
|
||||
.withHost("example.com").withPort(443))
|
||||
.build();
|
||||
// end::custom-uri-configuration[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,6 +18,7 @@ package com.example.mockmvc;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
@@ -45,20 +46,17 @@ public class EveryTestPreprocessing {
|
||||
@Before
|
||||
public void setup() {
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
.apply(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
}
|
||||
// end::setup[]
|
||||
|
||||
public void use() throws Exception {
|
||||
// tag::use[]
|
||||
this.mockMvc.perform(get("/"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("index",
|
||||
links(linkWithRel("self").description("Canonical self link"))
|
||||
));
|
||||
this.mockMvc.perform(get("/")).andExpect(status().isOk())
|
||||
.andDo(document("index", links(linkWithRel("self").description("Canonical self link"))));
|
||||
// end::use[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -35,8 +35,7 @@ public class ExampleApplicationJUnit5Tests {
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(WebApplicationContext webApplicationContext,
|
||||
RestDocumentationContextProvider restDocumentation) {
|
||||
public void setUp(WebApplicationContext webApplicationContext, RestDocumentationContextProvider restDocumentation) {
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
|
||||
.apply(documentationConfiguration(restDocumentation)) // <1>
|
||||
.build();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,31 +18,32 @@ package com.example.mockmvc;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.restdocs.ManualRestDocumentation;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
|
||||
|
||||
public class ExampleApplicationTestNgTests {
|
||||
|
||||
public final ManualRestDocumentation restDocumentation = new ManualRestDocumentation();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
// tag::setup[]
|
||||
private MockMvc mockMvc;
|
||||
|
||||
|
||||
@Autowired
|
||||
private WebApplicationContext context;
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp(Method method) {
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation))
|
||||
.build();
|
||||
.apply(documentationConfiguration(this.restDocumentation)).build();
|
||||
this.restDocumentation.beforeTest(getClass(), method.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -31,20 +31,17 @@ public class HttpHeaders {
|
||||
|
||||
public void headers() throws Exception {
|
||||
// tag::headers[]
|
||||
this.mockMvc
|
||||
.perform(get("/people").header("Authorization", "Basic dXNlcjpzZWNyZXQ=")) // <1>
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("headers",
|
||||
requestHeaders( // <2>
|
||||
headerWithName("Authorization").description(
|
||||
"Basic auth credentials")), // <3>
|
||||
responseHeaders( // <4>
|
||||
headerWithName("X-RateLimit-Limit").description(
|
||||
"The total number of requests permitted per period"),
|
||||
headerWithName("X-RateLimit-Remaining").description(
|
||||
"Remaining requests permitted in current period"),
|
||||
headerWithName("X-RateLimit-Reset").description(
|
||||
"Time at which the rate limit period will reset"))));
|
||||
this.mockMvc.perform(get("/people").header("Authorization", "Basic dXNlcjpzZWNyZXQ=")) // <1>
|
||||
.andExpect(status().isOk()).andDo(document("headers", requestHeaders(// <2>
|
||||
headerWithName("Authorization").description("Basic auth credentials")), // <3>
|
||||
responseHeaders(// <4>
|
||||
headerWithName("X-RateLimit-Limit")
|
||||
.description("The total number of requests permitted per period"),
|
||||
headerWithName("X-RateLimit-Remaining")
|
||||
.description("Remaining requests permitted in current period"),
|
||||
headerWithName("X-RateLimit-Reset")
|
||||
.description("Time at which the rate limit period will reset"))));
|
||||
// end::headers[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -16,39 +16,36 @@
|
||||
|
||||
package com.example.mockmvc;
|
||||
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.linkWithRel;
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.links;
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.halLinks;
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.halLinks;
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.linkWithRel;
|
||||
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.links;
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
public class Hypermedia {
|
||||
|
||||
private MockMvc mockMvc;
|
||||
|
||||
public void defaultExtractor() throws Exception {
|
||||
// tag::links[]
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("index", links( // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))); // <3>
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("index", links(// <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))); // <3>
|
||||
// end::links[]
|
||||
}
|
||||
|
||||
public void explicitExtractor() throws Exception {
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
//tag::explicit-extractor[]
|
||||
.andDo(document("index", links(halLinks(), // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
// end::explicit-extractor[]
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
// tag::explicit-extractor[]
|
||||
.andDo(document("index", links(halLinks(), // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
// end::explicit-extractor[]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package com.example.mockmvc;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
public class InvokeService {
|
||||
|
||||
private MockMvc mockMvc;
|
||||
@@ -30,8 +30,8 @@ public class InvokeService {
|
||||
public void invokeService() throws Exception {
|
||||
// tag::invoke-service[]
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON)) // <1>
|
||||
.andExpect(status().isOk()) // <2>
|
||||
.andDo(document("index")); // <3>
|
||||
.andExpect(status().isOk()) // <2>
|
||||
.andDo(document("index")); // <3>
|
||||
// end::invoke-service[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -32,11 +32,10 @@ public class MockMvcSnippetReuse extends SnippetReuse {
|
||||
|
||||
public void documentation() throws Exception {
|
||||
// tag::use[]
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("example", this.pagingLinks.and( // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("example", this.pagingLinks.and(// <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
// end::use[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,6 +18,7 @@ package com.example.mockmvc;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
@@ -40,8 +41,8 @@ public class ParameterizedOutput {
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation))
|
||||
.alwaysDo(document("{method-name}/{step}/")).build();
|
||||
.apply(documentationConfiguration(this.restDocumentation)).alwaysDo(document("{method-name}/{step}/"))
|
||||
.build();
|
||||
}
|
||||
// end::parameterized-output[]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package com.example.mockmvc;
|
||||
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
|
||||
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
|
||||
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
public class PathParameters {
|
||||
|
||||
private MockMvc mockMvc;
|
||||
@@ -31,11 +31,10 @@ public class PathParameters {
|
||||
public void pathParametersSnippet() throws Exception {
|
||||
// tag::path-parameters[]
|
||||
this.mockMvc.perform(get("/locations/{latitude}/{longitude}", 51.5072, 0.1275)) // <1>
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("locations", pathParameters( // <2>
|
||||
parameterWithName("latitude").description("The location's latitude"), // <3>
|
||||
parameterWithName("longitude").description("The location's longitude") // <4>
|
||||
)));
|
||||
.andExpect(status().isOk()).andDo(document("locations", pathParameters(// <2>
|
||||
parameterWithName("latitude").description("The location's latitude"), // <3>
|
||||
parameterWithName("longitude").description("The location's longitude") // <4>
|
||||
)));
|
||||
// end::path-parameters[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -40,91 +40,69 @@ public class Payload {
|
||||
|
||||
public void response() throws Exception {
|
||||
// tag::response[]
|
||||
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("index",
|
||||
responseFields( // <1>
|
||||
fieldWithPath("contact.email")
|
||||
.description("The user's email address"), // <2>
|
||||
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("index", responseFields(// <1>
|
||||
fieldWithPath("contact.email").description("The user's email address"), // <2>
|
||||
fieldWithPath("contact.name").description("The user's name")))); // <3>
|
||||
// end::response[]
|
||||
}
|
||||
|
||||
public void subsection() throws Exception {
|
||||
// tag::subsection[]
|
||||
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("index",
|
||||
responseFields( // <1>
|
||||
subsectionWithPath("contact")
|
||||
.description("The user's contact details")))); // <1>
|
||||
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("index", responseFields(// <1>
|
||||
subsectionWithPath("contact").description("The user's contact details")))); // <1>
|
||||
// end::subsection[]
|
||||
}
|
||||
|
||||
public void explicitType() throws Exception {
|
||||
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
// tag::explicit-type[]
|
||||
.andDo(document("index",
|
||||
responseFields(
|
||||
fieldWithPath("contact.email").type(JsonFieldType.STRING) // <1>
|
||||
.description("The user's email address"))));
|
||||
.andDo(document("index", responseFields(fieldWithPath("contact.email").type(JsonFieldType.STRING) // <1>
|
||||
.description("The user's email address"))));
|
||||
// end::explicit-type[]
|
||||
}
|
||||
|
||||
public void constraints() throws Exception {
|
||||
this.mockMvc.perform(post("/users/").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
this.mockMvc.perform(post("/users/").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
// tag::constraints[]
|
||||
.andDo(document("create-user", requestFields(
|
||||
attributes(key("title").value("Fields for user creation")), // <1>
|
||||
.andDo(document("create-user", requestFields(attributes(key("title").value("Fields for user creation")), // <1>
|
||||
fieldWithPath("name").description("The user's name")
|
||||
.attributes(key("constraints")
|
||||
.value("Must not be null. Must not be empty")), // <2>
|
||||
.attributes(key("constraints").value("Must not be null. Must not be empty")), // <2>
|
||||
fieldWithPath("email").description("The user's email address")
|
||||
.attributes(key("constraints")
|
||||
.value("Must be a valid email address"))))); // <3>
|
||||
.attributes(key("constraints").value("Must be a valid email address"))))); // <3>
|
||||
// end::constraints[]
|
||||
}
|
||||
|
||||
public void descriptorReuse() throws Exception {
|
||||
FieldDescriptor[] book = new FieldDescriptor[] {
|
||||
fieldWithPath("title").description("Title of the book"),
|
||||
FieldDescriptor[] book = new FieldDescriptor[] { fieldWithPath("title").description("Title of the book"),
|
||||
fieldWithPath("author").description("Author of the book") };
|
||||
|
||||
// tag::single-book[]
|
||||
this.mockMvc.perform(get("/books/1").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andDo(document("book", responseFields(book))); // <1>
|
||||
this.mockMvc.perform(get("/books/1").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("book", responseFields(book))); // <1>
|
||||
// end::single-book[]
|
||||
|
||||
// tag::book-array[]
|
||||
this.mockMvc.perform(get("/books").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("book",
|
||||
responseFields(
|
||||
fieldWithPath("[]").description("An array of books")) // <1>
|
||||
.andWithPrefix("[].", book))); // <2>
|
||||
this.mockMvc.perform(get("/books").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("book", responseFields(fieldWithPath("[]").description("An array of books")) // <1>
|
||||
.andWithPrefix("[].", book))); // <2>
|
||||
// end::book-array[]
|
||||
}
|
||||
|
||||
public void fieldsSubsection() throws Exception {
|
||||
// tag::fields-subsection[]
|
||||
this.mockMvc.perform(get("/locations/1").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("location",
|
||||
responseFields(beneathPath("weather.temperature"), // <1>
|
||||
fieldWithPath("high").description(
|
||||
"The forecast high in degrees celcius"), // <2>
|
||||
fieldWithPath("low")
|
||||
.description("The forecast low in degrees celcius"))));
|
||||
this.mockMvc.perform(get("/locations/1").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("location", responseFields(beneathPath("weather.temperature"), // <1>
|
||||
fieldWithPath("high").description("The forecast high in degrees celcius"), // <2>
|
||||
fieldWithPath("low").description("The forecast low in degrees celcius"))));
|
||||
// end::fields-subsection[]
|
||||
}
|
||||
|
||||
public void bodySubsection() throws Exception {
|
||||
// tag::body-subsection[]
|
||||
this.mockMvc.perform(get("/locations/1").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andDo(document("location",
|
||||
responseBody(beneathPath("weather.temperature")))); // <1>
|
||||
this.mockMvc.perform(get("/locations/1").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
|
||||
.andDo(document("location", responseBody(beneathPath("weather.temperature")))); // <1>
|
||||
|
||||
// end::body-subsection[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -33,8 +33,8 @@ public class PerTestPreprocessing {
|
||||
public void general() throws Exception {
|
||||
// tag::preprocessing[]
|
||||
this.mockMvc.perform(get("/")).andExpect(status().isOk())
|
||||
.andDo(document("index", preprocessRequest(removeHeaders("Foo")), // <1>
|
||||
preprocessResponse(prettyPrint()))); // <2>
|
||||
.andDo(document("index", preprocessRequest(removeHeaders("Foo")), // <1>
|
||||
preprocessResponse(prettyPrint()))); // <2>
|
||||
// end::preprocessing[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.example.mockmvc;
|
||||
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
|
||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
|
||||
@@ -23,8 +25,6 @@ import static org.springframework.restdocs.request.RequestDocumentation.paramete
|
||||
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
public class RequestParameters {
|
||||
|
||||
private MockMvc mockMvc;
|
||||
@@ -32,21 +32,18 @@ public class RequestParameters {
|
||||
public void getQueryStringSnippet() throws Exception {
|
||||
// tag::request-parameters-query-string[]
|
||||
this.mockMvc.perform(get("/users?page=2&per_page=100")) // <1>
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("users", requestParameters( // <2>
|
||||
parameterWithName("page").description("The page to retrieve"), // <3>
|
||||
parameterWithName("per_page").description("Entries per page") // <4>
|
||||
)));
|
||||
.andExpect(status().isOk()).andDo(document("users", requestParameters(// <2>
|
||||
parameterWithName("page").description("The page to retrieve"), // <3>
|
||||
parameterWithName("per_page").description("Entries per page") // <4>
|
||||
)));
|
||||
// end::request-parameters-query-string[]
|
||||
}
|
||||
|
||||
public void postFormDataSnippet() throws Exception {
|
||||
// tag::request-parameters-form-data[]
|
||||
this.mockMvc.perform(post("/users").param("username", "Tester")) // <1>
|
||||
.andExpect(status().isCreated())
|
||||
.andDo(document("create-user", requestParameters(
|
||||
parameterWithName("username").description("The user's username")
|
||||
)));
|
||||
.andExpect(status().isCreated()).andDo(document("create-user",
|
||||
requestParameters(parameterWithName("username").description("The user's username"))));
|
||||
// end::request-parameters-form-data[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -33,30 +33,24 @@ public class RequestPartPayload {
|
||||
|
||||
public void fields() throws Exception {
|
||||
// tag::fields[]
|
||||
MockMultipartFile image = new MockMultipartFile("image", "image.png", "image/png",
|
||||
"<<png data>>".getBytes());
|
||||
MockMultipartFile metadata = new MockMultipartFile("metadata", "",
|
||||
"application/json", "{ \"version\": \"1.0\"}".getBytes());
|
||||
MockMultipartFile image = new MockMultipartFile("image", "image.png", "image/png", "<<png data>>".getBytes());
|
||||
MockMultipartFile metadata = new MockMultipartFile("metadata", "", "application/json",
|
||||
"{ \"version\": \"1.0\"}".getBytes());
|
||||
|
||||
this.mockMvc.perform(fileUpload("/images").file(image).file(metadata)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("image-upload", requestPartFields("metadata", // <1>
|
||||
fieldWithPath("version").description("The version of the image")))); // <2>
|
||||
this.mockMvc.perform(fileUpload("/images").file(image).file(metadata).accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andDo(document("image-upload", requestPartFields("metadata", // <1>
|
||||
fieldWithPath("version").description("The version of the image")))); // <2>
|
||||
// end::fields[]
|
||||
}
|
||||
|
||||
public void body() throws Exception {
|
||||
// tag::body[]
|
||||
MockMultipartFile image = new MockMultipartFile("image", "image.png", "image/png",
|
||||
"<<png data>>".getBytes());
|
||||
MockMultipartFile metadata = new MockMultipartFile("metadata", "",
|
||||
"application/json", "{ \"version\": \"1.0\"}".getBytes());
|
||||
MockMultipartFile image = new MockMultipartFile("image", "image.png", "image/png", "<<png data>>".getBytes());
|
||||
MockMultipartFile metadata = new MockMultipartFile("metadata", "", "application/json",
|
||||
"{ \"version\": \"1.0\"}".getBytes());
|
||||
|
||||
this.mockMvc.perform(fileUpload("/images").file(image).file(metadata)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("image-upload", requestPartBody("metadata"))); // <1>
|
||||
this.mockMvc.perform(fileUpload("/images").file(image).file(metadata).accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andDo(document("image-upload", requestPartBody("metadata"))); // <1>
|
||||
// end::body[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -31,10 +31,9 @@ public class RequestParts {
|
||||
public void upload() throws Exception {
|
||||
// tag::request-parts[]
|
||||
this.mockMvc.perform(multipart("/upload").file("file", "example".getBytes())) // <1>
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("upload", requestParts( // <2>
|
||||
partWithName("file").description("The file to upload")) // <3>
|
||||
));
|
||||
.andExpect(status().isOk()).andDo(document("upload", requestParts(// <2>
|
||||
partWithName("file").description("The file to upload")) // <3>
|
||||
));
|
||||
// end::request-parts[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -39,10 +39,10 @@ public class CustomDefaultOperationPreprocessors {
|
||||
public void setup() {
|
||||
// tag::custom-default-operation-preprocessors[]
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
// end::custom-default-operation-preprocessors[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -38,8 +38,7 @@ public class CustomDefaultSnippets {
|
||||
public void setUp() {
|
||||
// tag::custom-default-snippets[]
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).snippets()
|
||||
.withDefaults(curlRequest()))
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).snippets().withDefaults(curlRequest()))
|
||||
.build();
|
||||
// end::custom-default-snippets[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -37,8 +37,7 @@ public class CustomEncoding {
|
||||
public void setUp() {
|
||||
// tag::custom-encoding[]
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(this.restDocumentation)
|
||||
.snippets().withEncoding("ISO-8859-1"))
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).snippets().withEncoding("ISO-8859-1"))
|
||||
.build();
|
||||
// end::custom-encoding[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -37,10 +37,8 @@ public class CustomFormat {
|
||||
@Before
|
||||
public void setUp() {
|
||||
// tag::custom-format[]
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(this.restDocumentation)
|
||||
.snippets().withTemplateFormat(TemplateFormats.markdown()))
|
||||
.build();
|
||||
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(this.restDocumentation).snippets()
|
||||
.withTemplateFormat(TemplateFormats.markdown())).build();
|
||||
// end::custom-format[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -43,20 +43,18 @@ public class EveryTestPreprocessing {
|
||||
@Before
|
||||
public void setup() {
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
.addFilter(documentationConfiguration(this.restDocumentation).operationPreprocessors()
|
||||
.withRequestDefaults(removeHeaders("Foo")) // <1>
|
||||
.withResponseDefaults(prettyPrint())) // <2>
|
||||
.build();
|
||||
}
|
||||
// end::setup[]
|
||||
|
||||
public void use() throws Exception {
|
||||
// tag::use[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("index",
|
||||
links(linkWithRel("self").description("Canonical self link"))))
|
||||
.when().get("/")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("index", links(linkWithRel("self").description("Canonical self link")))).when()
|
||||
.get("/").then().assertThat().statusCode(is(200));
|
||||
// end::use[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -35,9 +35,9 @@ public class ExampleApplicationJUnit5Tests {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(RestDocumentationContextProvider restDocumentation) {
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(restDocumentation)) // <1>
|
||||
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(restDocumentation)) // <1>
|
||||
.build();
|
||||
}
|
||||
// end::setup[]
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -37,9 +37,7 @@ public class ExampleApplicationTestNgTests {
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp(Method method) {
|
||||
this.spec = new RequestSpecBuilder().addFilter(
|
||||
documentationConfiguration(this.restDocumentation))
|
||||
.build();
|
||||
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(this.restDocumentation)).build();
|
||||
this.restDocumentation.beforeTest(getClass(), method.getName());
|
||||
}
|
||||
|
||||
@@ -51,4 +49,5 @@ public class ExampleApplicationTestNgTests {
|
||||
this.restDocumentation.afterTest();
|
||||
}
|
||||
// end::teardown[]
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -36,9 +36,9 @@ public class ExampleApplicationTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.spec = new RequestSpecBuilder().addFilter(
|
||||
documentationConfiguration(this.restDocumentation)) // <1>
|
||||
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(this.restDocumentation)) // <1>
|
||||
.build();
|
||||
}
|
||||
// end::setup[]
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -31,21 +31,18 @@ public class HttpHeaders {
|
||||
|
||||
public void headers() throws Exception {
|
||||
// tag::headers[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("headers",
|
||||
requestHeaders( // <1>
|
||||
headerWithName("Authorization").description(
|
||||
"Basic auth credentials")), // <2>
|
||||
responseHeaders( // <3>
|
||||
headerWithName("X-RateLimit-Limit").description(
|
||||
"The total number of requests permitted per period"),
|
||||
headerWithName("X-RateLimit-Remaining").description(
|
||||
"Remaining requests permitted in current period"),
|
||||
headerWithName("X-RateLimit-Reset").description(
|
||||
"Time at which the rate limit period will reset"))))
|
||||
.header("Authorization", "Basic dXNlcjpzZWNyZXQ=") // <4>
|
||||
.when().get("/people")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).filter(document("headers", requestHeaders(// <1>
|
||||
headerWithName("Authorization").description("Basic auth credentials")), // <2>
|
||||
responseHeaders(// <3>
|
||||
headerWithName("X-RateLimit-Limit")
|
||||
.description("The total number of requests permitted per period"),
|
||||
headerWithName("X-RateLimit-Remaining")
|
||||
.description("Remaining requests permitted in current period"),
|
||||
headerWithName("X-RateLimit-Reset")
|
||||
.description("Time at which the rate limit period will reset"))))
|
||||
.header("Authorization", "Basic dXNlcjpzZWNyZXQ=") // <4>
|
||||
.when().get("/people").then().assertThat().statusCode(is(200));
|
||||
// end::headers[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -31,24 +31,21 @@ public class Hypermedia {
|
||||
|
||||
public void defaultExtractor() throws Exception {
|
||||
// tag::links[]
|
||||
RestAssured.given(this.spec)
|
||||
.accept("application/json")
|
||||
.filter(document("index", links( // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))) // <3>
|
||||
.get("/").then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).accept("application/json").filter(document("index", links(// <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))) // <3>
|
||||
.get("/").then().assertThat().statusCode(is(200));
|
||||
// end::links[]
|
||||
}
|
||||
|
||||
public void explicitExtractor() throws Exception {
|
||||
RestAssured.given(this.spec)
|
||||
.accept("application/json")
|
||||
// tag::explicit-extractor[]
|
||||
.filter(document("index", links(halLinks(), // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))))
|
||||
// end::explicit-extractor[]
|
||||
.get("/").then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
// tag::explicit-extractor[]
|
||||
.filter(document("index", links(halLinks(), // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))))
|
||||
// end::explicit-extractor[]
|
||||
.get("/").then().assertThat().statusCode(is(200));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -35,4 +35,5 @@ public class InvokeService {
|
||||
.then().assertThat().statusCode(is(200)); // <5>
|
||||
// end::invoke-service[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -37,8 +37,7 @@ public class ParameterizedOutput {
|
||||
// tag::parameterized-output[]
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.spec = new RequestSpecBuilder()
|
||||
.addFilter(documentationConfiguration(this.restDocumentation))
|
||||
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(this.restDocumentation))
|
||||
.addFilter(document("{method-name}/{step}")).build();
|
||||
}
|
||||
// end::parameterized-output[]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -30,12 +30,12 @@ public class PathParameters {
|
||||
|
||||
public void pathParametersSnippet() throws Exception {
|
||||
// tag::path-parameters[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("locations", pathParameters( // <1>
|
||||
parameterWithName("latitude").description("The location's latitude"), // <2>
|
||||
parameterWithName("longitude").description("The location's longitude")))) // <3>
|
||||
.when().get("/locations/{latitude}/{longitude}", 51.5072, 0.1275) // <4>
|
||||
.then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).filter(document("locations", pathParameters(// <1>
|
||||
parameterWithName("latitude").description("The location's latitude"), // <2>
|
||||
parameterWithName("longitude").description("The location's longitude")))) // <3>
|
||||
.when().get("/locations/{latitude}/{longitude}", 51.5072, 0.1275) // <4>
|
||||
.then().assertThat().statusCode(is(200));
|
||||
// end::path-parameters[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -39,92 +39,76 @@ public class Payload {
|
||||
|
||||
public void response() throws Exception {
|
||||
// tag::response[]
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("user", responseFields( // <1>
|
||||
fieldWithPath("contact.name").description("The user's name"), // <2>
|
||||
fieldWithPath("contact.email").description("The user's email address")))) // <3>
|
||||
.when().get("/user/5")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).accept("application/json").filter(document("user", responseFields(// <1>
|
||||
fieldWithPath("contact.name").description("The user's name"), // <2>
|
||||
fieldWithPath("contact.email").description("The user's email address")))) // <3>
|
||||
.when().get("/user/5").then().assertThat().statusCode(is(200));
|
||||
// end::response[]
|
||||
}
|
||||
|
||||
public void subsection() throws Exception {
|
||||
// tag::subsection[]
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("user", responseFields(
|
||||
subsectionWithPath("contact").description("The user's contact details")))) // <1>
|
||||
.when().get("/user/5")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("user",
|
||||
responseFields(subsectionWithPath("contact").description("The user's contact details")))) // <1>
|
||||
.when().get("/user/5").then().assertThat().statusCode(is(200));
|
||||
// end::subsection[]
|
||||
}
|
||||
|
||||
public void explicitType() throws Exception {
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
// tag::explicit-type[]
|
||||
.filter(document("user", responseFields(
|
||||
fieldWithPath("contact.email")
|
||||
.type(JsonFieldType.STRING) // <1>
|
||||
.description("The user's email address"))))
|
||||
// end::explicit-type[]
|
||||
.when().get("/user/5")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
// tag::explicit-type[]
|
||||
.filter(document("user", responseFields(fieldWithPath("contact.email").type(JsonFieldType.STRING) // <1>
|
||||
.description("The user's email address"))))
|
||||
// end::explicit-type[]
|
||||
.when().get("/user/5").then().assertThat().statusCode(is(200));
|
||||
}
|
||||
|
||||
public void constraints() throws Exception {
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
// tag::constraints[]
|
||||
.filter(document("create-user", requestFields(
|
||||
attributes(key("title").value("Fields for user creation")), // <1>
|
||||
fieldWithPath("name").description("The user's name")
|
||||
.attributes(key("constraints")
|
||||
.value("Must not be null. Must not be empty")), // <2>
|
||||
fieldWithPath("email").description("The user's email address")
|
||||
.attributes(key("constraints")
|
||||
.value("Must be a valid email address"))))) // <3>
|
||||
// end::constraints[]
|
||||
.when().post("/users")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
// tag::constraints[]
|
||||
.filter(document("create-user",
|
||||
requestFields(attributes(key("title").value("Fields for user creation")), // <1>
|
||||
fieldWithPath("name").description("The user's name")
|
||||
.attributes(key("constraints").value("Must not be null. Must not be empty")), // <2>
|
||||
fieldWithPath("email").description("The user's email address")
|
||||
.attributes(key("constraints").value("Must be a valid email address"))))) // <3>
|
||||
// end::constraints[]
|
||||
.when().post("/users").then().assertThat().statusCode(is(200));
|
||||
}
|
||||
|
||||
public void descriptorReuse() throws Exception {
|
||||
FieldDescriptor[] book = new FieldDescriptor[] {
|
||||
fieldWithPath("title").description("Title of the book"),
|
||||
FieldDescriptor[] book = new FieldDescriptor[] { fieldWithPath("title").description("Title of the book"),
|
||||
fieldWithPath("author").description("Author of the book") };
|
||||
|
||||
// tag::single-book[]
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("book", responseFields(book))) // <1>
|
||||
.when().get("/books/1")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).accept("application/json").filter(document("book", responseFields(book))) // <1>
|
||||
.when().get("/books/1").then().assertThat().statusCode(is(200));
|
||||
// end::single-book[]
|
||||
|
||||
// tag::book-array[]
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("books", responseFields(
|
||||
fieldWithPath("[]").description("An array of books")) // <1>
|
||||
.andWithPrefix("[].", book))) // <2>
|
||||
.when().get("/books")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("books", responseFields(fieldWithPath("[]").description("An array of books")) // <1>
|
||||
.andWithPrefix("[].", book))) // <2>
|
||||
.when().get("/books").then().assertThat().statusCode(is(200));
|
||||
// end::book-array[]
|
||||
}
|
||||
|
||||
public void fieldsSubsection() throws Exception {
|
||||
// tag::fields-subsection[]
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("location", responseFields(beneathPath("weather.temperature"), // <1>
|
||||
fieldWithPath("high").description("The forecast high in degrees celcius"), // <2>
|
||||
fieldWithPath("low").description("The forecast low in degrees celcius"))))
|
||||
.when().get("/locations/1")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("location", responseFields(beneathPath("weather.temperature"), // <1>
|
||||
fieldWithPath("high").description("The forecast high in degrees celcius"), // <2>
|
||||
fieldWithPath("low").description("The forecast low in degrees celcius"))))
|
||||
.when().get("/locations/1").then().assertThat().statusCode(is(200));
|
||||
// end::fields-subsection[]
|
||||
}
|
||||
|
||||
public void bodySubsection() throws Exception {
|
||||
// tag::body-subsection[]
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("location", responseBody(beneathPath("weather.temperature")))) // <1>
|
||||
.when().get("/locations/1")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("location", responseBody(beneathPath("weather.temperature")))) // <1>
|
||||
.when().get("/locations/1").then().assertThat().statusCode(is(200));
|
||||
// end::body-subsection[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -32,11 +32,9 @@ public class PerTestPreprocessing {
|
||||
|
||||
public void general() throws Exception {
|
||||
// tag::preprocessing[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("index", preprocessRequest(removeHeaders("Foo")), // <1>
|
||||
preprocessResponse(prettyPrint()))) // <2>
|
||||
.when().get("/")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).filter(document("index", preprocessRequest(removeHeaders("Foo")), // <1>
|
||||
preprocessResponse(prettyPrint()))) // <2>
|
||||
.when().get("/").then().assertThat().statusCode(is(200));
|
||||
// end::preprocessing[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -30,23 +30,22 @@ public class RequestParameters {
|
||||
|
||||
public void getQueryStringSnippet() throws Exception {
|
||||
// tag::request-parameters-query-string[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("users", requestParameters( // <1>
|
||||
parameterWithName("page").description("The page to retrieve"), // <2>
|
||||
parameterWithName("per_page").description("Entries per page")))) // <3>
|
||||
.when().get("/users?page=2&per_page=100") // <4>
|
||||
.then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).filter(document("users", requestParameters(// <1>
|
||||
parameterWithName("page").description("The page to retrieve"), // <2>
|
||||
parameterWithName("per_page").description("Entries per page")))) // <3>
|
||||
.when().get("/users?page=2&per_page=100") // <4>
|
||||
.then().assertThat().statusCode(is(200));
|
||||
// end::request-parameters-query-string[]
|
||||
}
|
||||
|
||||
public void postFormDataSnippet() throws Exception {
|
||||
// tag::request-parameters-form-data[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("create-user", requestParameters(
|
||||
parameterWithName("username").description("The user's username"))))
|
||||
.formParam("username", "Tester") // <1>
|
||||
.when().post("/users") // <2>
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("create-user",
|
||||
requestParameters(parameterWithName("username").description("The user's username"))))
|
||||
.formParam("username", "Tester") // <1>
|
||||
.when().post("/users") // <2>
|
||||
.then().assertThat().statusCode(is(200));
|
||||
// end::request-parameters-form-data[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -38,11 +38,10 @@ public class RequestPartPayload {
|
||||
Map<String, String> metadata = new HashMap<>();
|
||||
metadata.put("version", "1.0");
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("image-upload", requestPartFields("metadata", // <1>
|
||||
fieldWithPath("version").description("The version of the image")))) // <2>
|
||||
.when().multiPart("image", new File("image.png"), "image/png")
|
||||
.multiPart("metadata", metadata).post("images")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("image-upload", requestPartFields("metadata", // <1>
|
||||
fieldWithPath("version").description("The version of the image")))) // <2>
|
||||
.when().multiPart("image", new File("image.png"), "image/png").multiPart("metadata", metadata)
|
||||
.post("images").then().assertThat().statusCode(is(200));
|
||||
// end::fields[]
|
||||
}
|
||||
|
||||
@@ -51,10 +50,9 @@ public class RequestPartPayload {
|
||||
Map<String, String> metadata = new HashMap<>();
|
||||
metadata.put("version", "1.0");
|
||||
RestAssured.given(this.spec).accept("application/json")
|
||||
.filter(document("image-upload", requestPartBody("metadata"))) // <1>
|
||||
.when().multiPart("image", new File("image.png"), "image/png")
|
||||
.multiPart("metadata", metadata).post("images")
|
||||
.then().assertThat().statusCode(is(200));
|
||||
.filter(document("image-upload", requestPartBody("metadata"))) // <1>
|
||||
.when().multiPart("image", new File("image.png"), "image/png").multiPart("metadata", metadata)
|
||||
.post("images").then().assertThat().statusCode(is(200));
|
||||
// end::body[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -30,12 +30,11 @@ public class RequestParts {
|
||||
|
||||
public void upload() throws Exception {
|
||||
// tag::request-parts[]
|
||||
RestAssured.given(this.spec)
|
||||
.filter(document("users", requestParts( // <1>
|
||||
partWithName("file").description("The file to upload")))) // <2>
|
||||
.multiPart("file", "example") // <3>
|
||||
.when().post("/upload") // <4>
|
||||
.then().statusCode(is(200));
|
||||
RestAssured.given(this.spec).filter(document("users", requestParts(// <1>
|
||||
partWithName("file").description("The file to upload")))) // <2>
|
||||
.multiPart("file", "example") // <3>
|
||||
.when().post("/upload") // <4>
|
||||
.then().statusCode(is(200));
|
||||
// end::request-parts[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -30,12 +30,10 @@ public class RestAssuredSnippetReuse extends SnippetReuse {
|
||||
|
||||
public void documentation() throws Exception {
|
||||
// tag::use[]
|
||||
RestAssured.given(this.spec)
|
||||
.accept("application/json")
|
||||
.filter(document("example", this.pagingLinks.and( // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))))
|
||||
.get("/").then().assertThat().statusCode(is(200));
|
||||
RestAssured.given(this.spec).accept("application/json").filter(document("example", this.pagingLinks.and(// <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))).get("/").then().assertThat()
|
||||
.statusCode(is(200));
|
||||
// end::use[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -40,10 +40,9 @@ public class CustomUriConfiguration {
|
||||
// tag::custom-uri-configuration[]
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
|
||||
.configureClient()
|
||||
.baseUrl("https://api.example.com") // <1>
|
||||
.filter(documentationConfiguration(this.restDocumentation)).build();
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
|
||||
.baseUrl("https://api.example.com") // <1>
|
||||
.filter(documentationConfiguration(this.restDocumentation)).build();
|
||||
}
|
||||
// end::custom-uri-configuration[]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -34,10 +34,8 @@ public class ExampleApplicationJUnit5Tests {
|
||||
private WebTestClient webTestClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(ApplicationContext applicationContext,
|
||||
RestDocumentationContextProvider restDocumentation) {
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(applicationContext)
|
||||
.configureClient()
|
||||
public void setUp(ApplicationContext applicationContext, RestDocumentationContextProvider restDocumentation) {
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(applicationContext).configureClient()
|
||||
.filter(documentationConfiguration(restDocumentation)) // <1>
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -41,8 +41,7 @@ public class ExampleApplicationTestNgTests {
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp(Method method) {
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
|
||||
.configureClient()
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
|
||||
.filter(documentationConfiguration(this.restDocumentation)) // <1>
|
||||
.build();
|
||||
this.restDocumentation.beforeTest(getClass(), method.getName());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -40,8 +40,7 @@ public class ExampleApplicationTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
|
||||
.configureClient()
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
|
||||
.filter(documentationConfiguration(this.restDocumentation)) // <1>
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ public class HttpHeaders {
|
||||
.get().uri("/people").header("Authorization", "Basic dXNlcjpzZWNyZXQ=") // <1>
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("headers",
|
||||
requestHeaders( // <2>
|
||||
requestHeaders(// <2>
|
||||
headerWithName("Authorization").description("Basic auth credentials")), // <3>
|
||||
responseHeaders( // <4>
|
||||
responseHeaders(// <4>
|
||||
headerWithName("X-RateLimit-Limit")
|
||||
.description("The total number of requests permitted per period"),
|
||||
headerWithName("X-RateLimit-Remaining")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -30,21 +30,20 @@ public class Hypermedia {
|
||||
|
||||
public void defaultExtractor() throws Exception {
|
||||
// tag::links[]
|
||||
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange()
|
||||
.expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("index",links( // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))); // <3>
|
||||
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
|
||||
.expectBody().consumeWith(document("index", links(// <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
|
||||
linkWithRel("bravo").description("Link to the bravo resource")))); // <3>
|
||||
// end::links[]
|
||||
}
|
||||
|
||||
public void explicitExtractor() throws Exception {
|
||||
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange()
|
||||
.expectStatus().isOk().expectBody()
|
||||
// tag::explicit-extractor[]
|
||||
.consumeWith(document("index",links(halLinks(), // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
|
||||
.expectBody()
|
||||
// tag::explicit-extractor[]
|
||||
.consumeWith(document("index", links(halLinks(), // <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
// end::explicit-extractor[]
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PathParameters {
|
||||
this.webTestClient.get().uri("/locations/{latitude}/{longitude}", 51.5072, 0.1275) // <1>
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("locations",
|
||||
pathParameters( // <2>
|
||||
pathParameters(// <2>
|
||||
parameterWithName("latitude").description("The location's latitude"), // <3>
|
||||
parameterWithName("longitude").description("The location's longitude")))); // <4>
|
||||
// end::path-parameters[]
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Payload {
|
||||
this.webTestClient.get().uri("user/5").accept(MediaType.APPLICATION_JSON)
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("user",
|
||||
responseFields( // <1>
|
||||
responseFields(// <1>
|
||||
fieldWithPath("contact.email").description("The user's email address"), // <2>
|
||||
fieldWithPath("contact.name").description("The user's name")))); // <3>
|
||||
// end::response[]
|
||||
|
||||
@@ -35,7 +35,7 @@ public class RequestParameters {
|
||||
// tag::request-parameters-query-string[]
|
||||
this.webTestClient.get().uri("/users?page=2&per_page=100") // <1>
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("users", requestParameters( // <2>
|
||||
.consumeWith(document("users", requestParameters(// <2>
|
||||
parameterWithName("page").description("The page to retrieve"), // <3>
|
||||
parameterWithName("per_page").description("Entries per page") // <4>
|
||||
)));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RequestParts {
|
||||
multipartData.add("file", "example".getBytes());
|
||||
this.webTestClient.post().uri("/upload").body(BodyInserters.fromMultipartData(multipartData)) // <1>
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("upload", requestParts( // <2>
|
||||
.consumeWith(document("upload", requestParts(// <2>
|
||||
partWithName("file").description("The file to upload")) // <3>
|
||||
));
|
||||
// end::request-parts[]
|
||||
|
||||
@@ -34,7 +34,7 @@ public class WebTestClientSnippetReuse extends SnippetReuse {
|
||||
// tag::use[]
|
||||
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange()
|
||||
.expectStatus().isOk().expectBody()
|
||||
.consumeWith(document("example", this.pagingLinks.and( // <1>
|
||||
.consumeWith(document("example", this.pagingLinks.and(// <1>
|
||||
linkWithRel("alpha").description("Link to the alpha resource"),
|
||||
linkWithRel("bravo").description("Link to the bravo resource"))));
|
||||
// end::use[]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
org.gradle.daemon=false
|
||||
version=2.0.6.BUILD-SNAPSHOT
|
||||
|
||||
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
|
||||
asciidoctorj15Version=1.5.8.1
|
||||
asciidoctorj16Version=1.6.2
|
||||
asciidoctorj20Version=2.0.0
|
||||
@@ -9,4 +11,5 @@ asciidoctorj22Version=2.2.0
|
||||
asciidoctorj23Version=2.3.0
|
||||
asciidoctorj24Version=2.4.2
|
||||
|
||||
javaFormatVersion=0.0.15
|
||||
javaFormatVersion=0.0.27
|
||||
jmustacheVersion=1.12
|
||||
|
||||
@@ -1,45 +1,49 @@
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
customizePom(pom, project)
|
||||
plugins.withType(MavenPublishPlugin) {
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) { publication ->
|
||||
from components.java
|
||||
versionMapping {
|
||||
usage("java-api") {
|
||||
fromResolutionResult()
|
||||
}
|
||||
usage("java-runtime") {
|
||||
fromResolutionResult()
|
||||
}
|
||||
}
|
||||
pom {
|
||||
name = project.provider { project.description }
|
||||
description = project.provider { project.description }
|
||||
url = "https://github.com/spring-projects/spring-restdocs"
|
||||
organization {
|
||||
name = "Spring IO"
|
||||
url = "https://projects.spring.io/spring-restdocs"
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name = "The Apache Software License, Version 2.0"
|
||||
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
distribution = "repo"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = "https://github.com/spring-projects/spring-restdocs"
|
||||
connection = "scm:git:git://github.com/spring-projects/spring-restdocs"
|
||||
developerConnection = "scm:git:git://github.com/spring-projects/spring-restdocs"
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "awilkinson"
|
||||
name = "Andy Wilkinson"
|
||||
email = "awilkinson@pivotal.io"
|
||||
}
|
||||
}
|
||||
issueManagement {
|
||||
system = "GitHub"
|
||||
url = "https://github.com/spring-projects/spring-restdocs/issues"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def customizePom(pom, gradleProject) {
|
||||
pom.whenConfigured { generatedPom ->
|
||||
generatedPom.dependencies.removeAll { dep ->
|
||||
dep.scope == "test"
|
||||
}
|
||||
generatedPom.project {
|
||||
name = gradleProject.description
|
||||
description = gradleProject.description
|
||||
url = "https://github.com/spring-projects/spring-restdocs"
|
||||
organization {
|
||||
name = "Spring IO"
|
||||
url = "https://projects.spring.io/spring-restdocs"
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name "The Apache Software License, Version 2.0"
|
||||
url "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
distribution "repo"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = "https://github.com/spring-projects/spring-restdocs"
|
||||
connection = "scm:git:git://github.com/spring-projects/spring-restdocs"
|
||||
developerConnection = "scm:git:git://github.com/spring-projects/spring-restdocs"
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "awilkinson"
|
||||
name = "Andy Wilkinson"
|
||||
email = "awilkinson@pivotal.io"
|
||||
}
|
||||
}
|
||||
issueManagement {
|
||||
system = "GitHub"
|
||||
url = "https://github.com/spring-projects/spring-restdocs/issues"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
||||
#Wed Aug 01 14:27:17 BST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
59
gradlew
vendored
59
gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,35 +156,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
43
gradlew.bat
vendored
43
gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.asciidoctor.convert" version "1.5.9.2"
|
||||
id "org.asciidoctor.jvm.convert" version "3.3.2"
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
@@ -18,7 +18,8 @@ apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -33,17 +34,21 @@ ext {
|
||||
|
||||
ext['spring-restdocs.version'] = '2.0.6.BUILD-SNAPSHOT'
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
|
||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
|
||||
testCompile('org.springframework.boot:spring-boot-starter-test') {
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-test') {
|
||||
exclude group: 'junit', module: 'junit;'
|
||||
}
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
testCompile 'org.junit.jupiter:junit-jupiter-api'
|
||||
testRuntime 'org.junit.jupiter:junit-jupiter-engine'
|
||||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -52,6 +57,7 @@ test {
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
configurations "asciidoctorExtensions"
|
||||
inputs.dir snippetsDir
|
||||
dependsOn test
|
||||
}
|
||||
|
||||
BIN
samples/junit5/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
samples/junit5/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
53
samples/junit5/gradlew
vendored
53
samples/junit5/gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,19 +156,19 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -159,14 +177,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
22
samples/junit5/gradlew.bat
vendored
22
samples/junit5/gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
|
||||
0
samples/junit5/settings.gradle
Normal file
0
samples/junit5/settings.gradle
Normal file
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.asciidoctor.convert" version "1.5.9.2"
|
||||
id "org.asciidoctor.jvm.convert" version "3.3.2"
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
@@ -18,7 +18,8 @@ apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -33,12 +34,18 @@ ext {
|
||||
|
||||
ext['spring-restdocs.version'] = '2.0.6.BUILD-SNAPSHOT'
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||
testCompile 'io.rest-assured:rest-assured:3.0.2'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-restassured'
|
||||
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
|
||||
testImplementation 'io.rest-assured:rest-assured:3.0.2'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'org.springframework.restdocs:spring-restdocs-restassured'
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -46,6 +53,7 @@ test {
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
configurations "asciidoctorExtensions"
|
||||
inputs.dir snippetsDir
|
||||
dependsOn test
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
#Wed Aug 08 09:59:27 BST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
59
samples/rest-assured/gradlew
vendored
59
samples/rest-assured/gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,35 +156,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
22
samples/rest-assured/gradlew.bat
vendored
22
samples/rest-assured/gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
|
||||
0
samples/rest-assured/settings.gradle
Normal file
0
samples/rest-assured/settings.gradle
Normal file
@@ -14,7 +14,8 @@ apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -30,15 +31,15 @@ ext {
|
||||
ext['spring-restdocs.version'] = '2.0.6.BUILD-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-rest'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
|
||||
|
||||
runtime 'com.h2database:h2'
|
||||
runtime 'org.atteo:evo-inflector:1.2.1'
|
||||
runtimeOnly 'com.h2database:h2'
|
||||
runtimeOnly 'org.atteo:evo-inflector:1.2.1'
|
||||
|
||||
testCompile 'com.jayway.jsonpath:json-path'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
testImplementation 'com.jayway.jsonpath:json-path'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
#Wed Aug 08 10:00:04 BST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
59
samples/rest-notes-slate/gradlew
vendored
59
samples/rest-notes-slate/gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,35 +156,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
43
samples/rest-notes-slate/gradlew.bat
vendored
43
samples/rest-notes-slate/gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
0
samples/rest-notes-slate/settings.gradle
Normal file
0
samples/rest-notes-slate/settings.gradle
Normal file
@@ -124,20 +124,36 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot</url>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot</url>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
|
||||
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.asciidoctor.convert" version "1.5.9.2"
|
||||
id "org.asciidoctor.jvm.convert" version "3.3.2"
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
@@ -18,7 +18,8 @@ apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -33,16 +34,23 @@ ext {
|
||||
|
||||
ext['spring-restdocs.version'] = '2.0.6.BUILD-SNAPSHOT'
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
compile 'org.springframework.boot:spring-boot-starter-hateoas'
|
||||
runtime 'com.h2database:h2'
|
||||
runtime 'org.atteo:evo-inflector:1.2.1'
|
||||
testCompile 'com.jayway.jsonpath:json-path'
|
||||
testCompile 'org.assertj:assertj-core'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
|
||||
|
||||
runtimeOnly 'com.h2database:h2'
|
||||
runtimeOnly 'org.atteo:evo-inflector:1.2.1'
|
||||
|
||||
testImplementation 'com.jayway.jsonpath:json-path'
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -50,6 +58,7 @@ test {
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
configurations "asciidoctorExtensions"
|
||||
inputs.dir snippetsDir
|
||||
dependsOn test
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
#Wed Aug 08 10:00:26 BST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
59
samples/rest-notes-spring-hateoas/gradlew
vendored
59
samples/rest-notes-spring-hateoas/gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,35 +156,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
43
samples/rest-notes-spring-hateoas/gradlew.bat
vendored
43
samples/rest-notes-spring-hateoas/gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
0
samples/rest-notes-spring-hateoas/settings.gradle
Normal file
0
samples/rest-notes-spring-hateoas/settings.gradle
Normal file
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.asciidoctor.convert" version "1.5.9.2"
|
||||
id "org.asciidoctor.jvm.convert" version "3.3.2"
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
@@ -18,7 +18,8 @@ apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -33,14 +34,18 @@ ext {
|
||||
|
||||
ext['spring-restdocs.version'] = '2.0.6.BUILD-SNAPSHOT'
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||
testCompile('org.springframework.boot:spring-boot-starter-test') {
|
||||
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-test') {
|
||||
exclude group: 'junit', module: 'junit;'
|
||||
}
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
testCompile 'org.testng:testng:6.9.10'
|
||||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
|
||||
testImplementation 'org.testng:testng:6.9.10'
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -49,6 +54,7 @@ test {
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
configurations "asciidoctorExtensions"
|
||||
inputs.dir snippetsDir
|
||||
dependsOn test
|
||||
}
|
||||
|
||||
BIN
samples/testng/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
samples/testng/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
#Wed Aug 08 10:00:39 BST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
59
samples/testng/gradlew
vendored
59
samples/testng/gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,35 +156,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
43
samples/testng/gradlew.bat
vendored
43
samples/testng/gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
0
samples/testng/settings.gradle
Normal file
0
samples/testng/settings.gradle
Normal file
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "org.asciidoctor.convert" version "1.5.9.2"
|
||||
id "org.asciidoctor.jvm.convert" version "3.3.2"
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
@@ -7,7 +7,8 @@ apply plugin: 'eclipse'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -22,14 +23,20 @@ ext {
|
||||
|
||||
ext['spring-restdocs.version'] = '2.0.6.BUILD-SNAPSHOT'
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'io.projectreactor.ipc:reactor-netty:0.7.1.RELEASE'
|
||||
compile 'org.springframework:spring-context:5.0.1.RELEASE'
|
||||
compile 'org.springframework:spring-webflux:5.0.1.RELEASE'
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.springframework:spring-test:5.0.1.RELEASE'
|
||||
testCompile "org.springframework.restdocs:spring-restdocs-webtestclient:${project.ext['spring-restdocs.version']}"
|
||||
asciidoctor "org.springframework.restdocs:spring-restdocs-asciidoctor:${project.ext['spring-restdocs.version']}"
|
||||
asciidoctorExtensions "org.springframework.restdocs:spring-restdocs-asciidoctor:${project.ext['spring-restdocs.version']}"
|
||||
|
||||
implementation 'io.projectreactor.ipc:reactor-netty:0.7.1.RELEASE'
|
||||
implementation 'org.springframework:spring-context:5.0.1.RELEASE'
|
||||
implementation 'org.springframework:spring-webflux:5.0.1.RELEASE'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.springframework:spring-test:5.0.1.RELEASE'
|
||||
testImplementation "org.springframework.restdocs:spring-restdocs-webtestclient:${project.ext['spring-restdocs.version']}"
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -37,6 +44,7 @@ test {
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
configurations "asciidoctorExtensions"
|
||||
inputs.dir snippetsDir
|
||||
dependsOn test
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user