Merge branch '2.0.x' into 2.1.x

This commit is contained in:
Spencer Gibb
2019-04-01 12:52:55 -04:00
8 changed files with 323 additions and 187 deletions

View File

@@ -28,7 +28,7 @@ added after the original pull request but before a merge.
you can import formatter settings using the you can import formatter settings using the
`eclipse-code-formatter.xml` file from the `eclipse-code-formatter.xml` file from the
[Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the [Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the
[Eclipse Code Formatter Plugin](http://plugins.jetbrains.com/plugin/6546) to import the same file. [Eclipse Code Formatter Plugin](https://plugins.jetbrains.com/plugin/6546) to import the same file.
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an * Make sure all new `.java` files to have a simple Javadoc class comment with at least an
`@author` tag identifying you, and preferably at least a paragraph on what the class is `@author` tag identifying you, and preferably at least a paragraph on what the class is
for. for.
@@ -40,6 +40,6 @@ added after the original pull request but before a merge.
* A few unit tests would help a lot as well -- someone has to do it. * A few unit tests would help a lot as well -- someone has to do it.
* If no-one else is using your branch, please rebase it against the current master (or * If no-one else is using your branch, please rebase it against the current master (or
other target branch in the main project). other target branch in the main project).
* When writing a commit message please follow [these conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), * When writing a commit message please follow [these conventions](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
message (where XXXX is the issue number). message (where XXXX is the issue number).

View File

@@ -1,4 +1,8 @@
// Do not edit this file (e.g. go instead to src/main/asciidoc) ////
DO NOT EDIT THIS FILE. IT WAS GENERATED.
Manual changes to this file will be lost when it is generated again.
Edit the files in the src/main/asciidoc/ directory instead.
////
= Spring Cloud for Cloudfoundry = Spring Cloud for Cloudfoundry
@@ -65,7 +69,7 @@ credentials and you already have those.
The projects that require middleware generally include a The projects that require middleware generally include a
`docker-compose.yml`, so consider using `docker-compose.yml`, so consider using
http://compose.docker.io/[Docker Compose] to run the middeware servers https://docs.docker.com/compose/[Docker Compose] to run the middeware servers
in Docker containers. See the README in the in Docker containers. See the README in the
https://github.com/spring-cloud-samples/scripts[scripts demo https://github.com/spring-cloud-samples/scripts[scripts demo
repository] for specific instructions about the common cases of mongo, repository] for specific instructions about the common cases of mongo,
@@ -87,13 +91,13 @@ a modified file in the correct place. Just commit it and push the change.
=== Working with the code === Working with the code
If you don't have an IDE preference we would recommend that you use If you don't have an IDE preference we would recommend that you use
http://www.springsource.com/developer/sts[Spring Tools Suite] or https://www.springsource.com/developer/sts[Spring Tools Suite] or
http://eclipse.org[Eclipse] when working with the code. We use the https://eclipse.org[Eclipse] when working with the code. We use the
http://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools
should also work without issue as long as they use Maven 3.3.3 or better. should also work without issue as long as they use Maven 3.3.3 or better.
==== Importing into eclipse with m2eclipse ==== Importing into eclipse with m2eclipse
We recommend the http://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with
eclipse. If you don't already have m2eclipse installed it is available from the "eclipse eclipse. If you don't already have m2eclipse installed it is available from the "eclipse
marketplace". marketplace".
@@ -149,7 +153,7 @@ added after the original pull request but before a merge.
`eclipse-code-formatter.xml` file from the `eclipse-code-formatter.xml` file from the
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring
Cloud Build] project. If using IntelliJ, you can use the Cloud Build] project. If using IntelliJ, you can use the
http://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter
Plugin] to import the same file. Plugin] to import the same file.
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an * Make sure all new `.java` files to have a simple Javadoc class comment with at least an
`@author` tag identifying you, and preferably at least a paragraph on what the class is `@author` tag identifying you, and preferably at least a paragraph on what the class is
@@ -162,6 +166,138 @@ added after the original pull request but before a merge.
* A few unit tests would help a lot as well -- someone has to do it. * A few unit tests would help a lot as well -- someone has to do it.
* If no-one else is using your branch, please rebase it against the current master (or * If no-one else is using your branch, please rebase it against the current master (or
other target branch in the main project). other target branch in the main project).
* When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], * When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
message (where XXXX is the issue number). message (where XXXX is the issue number).
=== Checkstyle
Spring Cloud Build comes with a set of checkstyle rules. You can find them in the `spring-cloud-build-tools` module. The most notable files under the module are:
.spring-cloud-build-tools/
----
└── src
   ├── checkstyle
   │   └── checkstyle-suppressions.xml <3>
   └── main
   └── resources
   ├── checkstyle-header.txt <2>
   └── checkstyle.xml <1>
----
<1> Default Checkstyle rules
<2> File header setup
<3> Default suppression rules
==== Checkstyle configuration
Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins.
.pom.xml
----
<properties>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> <1>
<maven-checkstyle-plugin.failsOnViolation>true
</maven-checkstyle-plugin.failsOnViolation> <2>
<maven-checkstyle-plugin.includeTestSourceDirectory>true
</maven-checkstyle-plugin.includeTestSourceDirectory> <3>
</properties>
<build>
<plugins>
<plugin> <4>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
</plugin>
<plugin> <5>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
<reporting>
<plugins>
<plugin> <5>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</build>
----
<1> Fails the build upon Checkstyle errors
<2> Fails the build upon Checkstyle violations
<3> Checkstyle analyzes also the test sources
<4> Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules
<5> Add checkstyle plugin to your build and reporting phases
If you need to suppress some rules (e.g. line length needs to be longer), then it's enough for you to define a file under `${project.root}/src/checkstyle/checkstyle-suppressions.xml` with your suppressions. Example:
.projectRoot/src/checkstyle/checkstyle-suppresions.xml
----
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
</suppressions>
----
It's advisable to copy the `${spring-cloud-build.rootFolder}/.editorconfig` and `${spring-cloud-build.rootFolder}/.springformat` to your project. That way, some default formatting rules will be applied. You can do so by running this script:
```bash
$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/.editorconfig -o .editorconfig
$ touch .springformat
```
=== IDE setup
==== Intellij IDEA
In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin.
.spring-cloud-build-tools/
----
└── src
   ├── checkstyle
   │   └── checkstyle-suppressions.xml <3>
   └── main
   └── resources
   ├── checkstyle-header.txt <2>
   ├── checkstyle.xml <1>
   └── intellij
      ├── Intellij_Project_Defaults.xml <4>
      └── Intellij_Spring_Boot_Java_Conventions.xml <5>
----
<1> Default Checkstyle rules
<2> File header setup
<3> Default suppression rules
<4> Project defaults for Intellij that apply most of Checkstyle rules
<5> Project style conventions for Intellij that apply most of Checkstyle rules
.Code style
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-code-style.png[Code style]
Go to `File` -> `Settings` -> `Editor` -> `Code style`. There click on the icon next to the `Scheme` section. There, click on the `Import Scheme` value and pick the `Intellij IDEA code style XML` option. Import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml` file.
.Inspection profiles
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-inspections.png[Code style]
Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon next to the `Profile` section. There, click on the `Import Profile` and import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml` file.
.Checkstyle
To have Intellij work with Checkstyle, you have to install the `Checkstyle` plugin. It's advisable to also install the `Assertions2Assertj` to automatically convert the JUnit assertions
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-checkstyle.png[Checkstyle]
Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on the `+` icon in the `Configuration file` section. There, you'll have to define where the checkstyle rules should be picked from. In the image above, we've picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build's GitHub repository (e.g. for the `checkstyle.xml` : `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables:
- `checkstyle.header.file` - please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/main/resources/checkstyle/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL.
- `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL.
- `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`.
IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources.

View File

@@ -40,7 +40,7 @@ function check_if_anything_to_sync() {
function retrieve_current_branch() { function retrieve_current_branch() {
# Code getting the name of the current branch. For master we want to publish as we did until now # Code getting the name of the current branch. For master we want to publish as we did until now
# http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch # https://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
# If there is a branch already passed will reuse it - otherwise will try to find it # If there is a branch already passed will reuse it - otherwise will try to find it
CURRENT_BRANCH=${BRANCH} CURRENT_BRANCH=${BRANCH}
if [[ -z "${CURRENT_BRANCH}" ]] ; then if [[ -z "${CURRENT_BRANCH}" ]] ; then
@@ -147,7 +147,7 @@ function copy_docs_for_current_version() {
COMMIT_CHANGES="yes" COMMIT_CHANGES="yes"
else else
echo -e "Current branch is [${CURRENT_BRANCH}]" echo -e "Current branch is [${CURRENT_BRANCH}]"
# http://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin # https://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin
if [[ ",${WHITELISTED_BRANCHES_VALUE}," = *",${CURRENT_BRANCH},"* ]] ; then if [[ ",${WHITELISTED_BRANCHES_VALUE}," = *",${CURRENT_BRANCH},"* ]] ; then
mkdir -p ${ROOT_FOLDER}/${CURRENT_BRANCH} mkdir -p ${ROOT_FOLDER}/${CURRENT_BRANCH}
echo -e "Branch [${CURRENT_BRANCH}] is whitelisted! Will copy the current docs to the [${CURRENT_BRANCH}] folder" echo -e "Branch [${CURRENT_BRANCH}] is whitelisted! Will copy the current docs to the [${CURRENT_BRANCH}] folder"

View File

@@ -19,7 +19,7 @@ are configured, they default per the user's profile in Cloud Foundry.
NOTE: All of the OAuth2 SSO and resource server features moved to Spring Boot NOTE: All of the OAuth2 SSO and resource server features moved to Spring Boot
in version 1.3. You can find documentation in the in version 1.3. You can find documentation in the
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/[Spring Boot user guide]. https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/[Spring Boot user guide].
This project provides automatic binding from CloudFoundry service This project provides automatic binding from CloudFoundry service
credentials to the Spring Boot features. If you have a CloudFoundry credentials to the Spring Boot features. If you have a CloudFoundry

2
mvnw vendored
View File

@@ -8,7 +8,7 @@
# "License"); you may not use this file except in compliance # "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at # with the License. You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # https://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, # Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an # software distributed under the License is distributed on an

322
mvnw.cmd vendored
View File

@@ -1,161 +1,161 @@
@REM ---------------------------------------------------------------------------- @REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one @REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file @REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information @REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file @REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the @REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance @REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at @REM with the License. You may obtain a copy of the License at
@REM @REM
@REM http://www.apache.org/licenses/LICENSE-2.0 @REM https://www.apache.org/licenses/LICENSE-2.0
@REM @REM
@REM Unless required by applicable law or agreed to in writing, @REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an @REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the @REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations @REM specific language governing permissions and limitations
@REM under the License. @REM under the License.
@REM ---------------------------------------------------------------------------- @REM ----------------------------------------------------------------------------
@REM ---------------------------------------------------------------------------- @REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script @REM Maven2 Start Up Batch script
@REM @REM
@REM Required ENV vars: @REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir @REM JAVA_HOME - location of a JDK home dir
@REM @REM
@REM Optional ENV vars @REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir @REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use @REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ---------------------------------------------------------------------------- @REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off @echo off
@REM set title of command window @REM set title of command window
title %0 title %0
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME @REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one @REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending @REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre :skipRcPre
@setlocal @setlocal
set ERROR_CODE=0 set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal @REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal @setlocal
@REM ==== START VALIDATION ==== @REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome if not "%JAVA_HOME%" == "" goto OkJHome
echo. echo.
echo Error: JAVA_HOME not found in your environment. >&2 echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2 echo location of your Java installation. >&2
echo. echo.
goto error goto error
:OkJHome :OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init if exist "%JAVA_HOME%\bin\java.exe" goto init
echo. echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2 echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2 echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2 echo location of your Java installation. >&2
echo. echo.
goto error goto error
@REM ==== END VALIDATION ==== @REM ==== END VALIDATION ====
:init :init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found. @REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD% set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR% set WDIR=%EXEC_DIR%
:findBaseDir :findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd .. cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD% set WDIR=%CD%
goto findBaseDir goto findBaseDir
:baseDirFound :baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR% set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%" cd "%EXEC_DIR%"
goto endDetectBaseDir goto endDetectBaseDir
:baseDirNotFound :baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%" cd "%EXEC_DIR%"
:endDetectBaseDir :endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion @setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig :endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
) )
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data. @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% ( if exist %WRAPPER_JAR% (
echo Found %WRAPPER_JAR% echo Found %WRAPPER_JAR%
) else ( ) else (
echo Couldn't find %WRAPPER_JAR%, downloading it ... echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL% echo Downloading from: %DOWNLOAD_URL%
powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
echo Finished downloading %WRAPPER_JAR% echo Finished downloading %WRAPPER_JAR%
) )
@REM End of extension @REM End of extension
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error if ERRORLEVEL 1 goto error
goto end goto end
:error :error
set ERROR_CODE=1 set ERROR_CODE=1
:end :end
@endlocal & set ERROR_CODE=%ERROR_CODE% @endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending @REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost :skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE% exit /B %ERROR_CODE%

View File

@@ -83,7 +83,7 @@ public class CloudFoundryDiscoveryClientTest {
ApplicationDetail applicationDetail = ApplicationDetail.builder().instances(2) ApplicationDetail applicationDetail = ApplicationDetail.builder().instances(2)
.name("my-app").stack("stack").memoryLimit(1024).id("id") .name("my-app").stack("stack").memoryLimit(1024).id("id")
.requestedState("requestedState").runningInstances(2) .requestedState("requestedState").runningInstances(2)
.url("http://my-app.cfapps.io").diskQuota(20).build(); .url("http://my-app-cfapps-io").diskQuota(20).build();
InstanceDetail instanceDetail = InstanceDetail.builder().index("0").build(); InstanceDetail instanceDetail = InstanceDetail.builder().index("0").build();
Tuple2<ApplicationDetail, InstanceDetail> tuple2 = Tuples.of(applicationDetail, Tuple2<ApplicationDetail, InstanceDetail> tuple2 = Tuples.of(applicationDetail,
instanceDetail); instanceDetail);

View File

@@ -72,56 +72,56 @@ public class VcapServiceCredentialsEnvironmentPostProcessorTests {
@Test @Test
public void addTokenUri() { public void addTokenUri() {
TestPropertyValues TestPropertyValues
.of("vcap.services.sso.credentials.accessTokenUri:http://example.com") .of("vcap.services.sso.credentials.accessTokenUri:http://exampledomain")
.applyTo(this.environment); .applyTo(this.environment);
this.listener.postProcessEnvironment(this.environment, new SpringApplication()); this.listener.postProcessEnvironment(this.environment, new SpringApplication());
assertThat(this.environment assertThat(this.environment
.resolvePlaceholders("${security.oauth2.client.access-token-uri}")) .resolvePlaceholders("${security.oauth2.client.access-token-uri}"))
.isEqualTo("http://example.com"); .isEqualTo("http://exampledomain");
} }
@Test @Test
public void addTokenUriAuthDomain() { public void addTokenUriAuthDomain() {
TestPropertyValues TestPropertyValues
.of("vcap.services.sso.credentials.auth-domain:http://example.com") .of("vcap.services.sso.credentials.auth-domain:http://exampledomain")
.applyTo(this.environment); .applyTo(this.environment);
this.listener.postProcessEnvironment(this.environment, new SpringApplication()); this.listener.postProcessEnvironment(this.environment, new SpringApplication());
assertThat(this.environment assertThat(this.environment
.resolvePlaceholders("${security.oauth2.client.access-token-uri}")) .resolvePlaceholders("${security.oauth2.client.access-token-uri}"))
.isEqualTo("http://example.com/oauth/token"); .isEqualTo("http://exampledomain/oauth/token");
} }
@Test @Test
public void addUserInfoUri() { public void addUserInfoUri() {
TestPropertyValues TestPropertyValues
.of("vcap.services.sso.credentials.userInfoUri:http://example.com") .of("vcap.services.sso.credentials.userInfoUri:http://exampledomain")
.applyTo(this.environment); .applyTo(this.environment);
this.listener.postProcessEnvironment(this.environment, new SpringApplication()); this.listener.postProcessEnvironment(this.environment, new SpringApplication());
assertThat(this.environment assertThat(this.environment
.resolvePlaceholders("${security.oauth2.resource.user-info-uri}")) .resolvePlaceholders("${security.oauth2.resource.user-info-uri}"))
.isEqualTo("http://example.com"); .isEqualTo("http://exampledomain");
} }
@Test @Test
public void addServiceId() { public void addServiceId() {
TestPropertyValues TestPropertyValues
.of("vcap.services.my.credentials.accessTokenUri:http://example.com", .of("vcap.services.my.credentials.accessTokenUri:http://exampledomain",
"security.oauth2.sso.serviceId:my") "security.oauth2.sso.serviceId:my")
.applyTo(this.environment); .applyTo(this.environment);
this.listener.postProcessEnvironment(this.environment, new SpringApplication()); this.listener.postProcessEnvironment(this.environment, new SpringApplication());
assertThat(this.environment assertThat(this.environment
.resolvePlaceholders("${security.oauth2.client.access-token-uri}")) .resolvePlaceholders("${security.oauth2.client.access-token-uri}"))
.isEqualTo("http://example.com"); .isEqualTo("http://exampledomain");
} }
@Test @Test
public void addJwtKeyUri() { public void addJwtKeyUri() {
TestPropertyValues.of("vcap.services.sso.credentials.keyUri:http://example.com") TestPropertyValues.of("vcap.services.sso.credentials.keyUri:http://exampledomain")
.applyTo(this.environment); .applyTo(this.environment);
this.listener.postProcessEnvironment(this.environment, new SpringApplication()); this.listener.postProcessEnvironment(this.environment, new SpringApplication());
assertThat(this.environment assertThat(this.environment
.resolvePlaceholders("${security.oauth2.resource.jwt.key-uri}")) .resolvePlaceholders("${security.oauth2.resource.jwt.key-uri}"))
.isEqualTo("http://example.com"); .isEqualTo("http://exampledomain");
} }
} }