diff --git a/.gitignore b/.gitignore index 8aaf8a6d5d1..eacf8371526 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/libraries +.idea/jarRepositories.xml .idea/tasks.xml .idea/workspace.xml target/ @@ -6,4 +7,5 @@ bin/ .project .classpath .settings/ -.factorypath \ No newline at end of file +.factorypath +.gradle diff --git a/.idea/compiler.xml b/.idea/compiler.xml index a2e78351cc9..891206729d3 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -6,12 +6,13 @@ + - + - + @@ -22,6 +23,7 @@ + diff --git a/.idea/encodings.xml b/.idea/encodings.xml index e7d4e98aec0..f939b983d38 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -2,10 +2,20 @@ + + + + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 3ccb27b15ba..fc9aaf441c7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,10 +8,13 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 00000000000..797acea53eb --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 4b080365fdd..99a540d3159 100644 --- a/README.md +++ b/README.md @@ -8,24 +8,14 @@ | `cloudfoundry-operations` | [![javadoc](https://javadoc.io/badge2/org.cloudfoundry/cloudfoundry-operations/javadoc.svg)](https://javadoc.io/doc/org.cloudfoundry/cloudfoundry-operations) | `cloudfoundry-util` | [![javadoc](https://javadoc.io/badge2/org.cloudfoundry/cloudfoundry-util/javadoc.svg)](https://javadoc.io/doc/org.cloudfoundry/cloudfoundry-util) -| Job | Status -| --- | ------ -| `unit-test` | [![unit-test-master](https://java-experience.ci.springapps.io/api/v1/teams/java-experience/pipelines/java-client/jobs/unit-test-master/badge)](https://java-experience.ci.springapps.io/teams/java-experience/pipelines/java-client/jobs/unit-test-master) -| `integration-test-2.5` | [![integration-test-2.5-master](https://java-experience.ci.springapps.io/api/v1/teams/java-experience/pipelines/java-client/jobs/integration-test-2.5-master/badge)](https://java-experience.ci.springapps.io/teams/java-experience/pipelines/java-client/jobs/integration-test-2.5-master) -| `integration-test-2.6` | [![integration-test-2.6-master](https://java-experience.ci.springapps.io/api/v1/teams/java-experience/pipelines/java-client/jobs/integration-test-2.6-master/badge)](https://java-experience.ci.springapps.io/teams/java-experience/pipelines/java-client/jobs/integration-test-2.6-master) -| `integration-test-2.7` | [![integration-test-2.7-master](https://java-experience.ci.springapps.io/api/v1/teams/java-experience/pipelines/java-client/jobs/integration-test-2.7-master/badge)](https://java-experience.ci.springapps.io/teams/java-experience/pipelines/java-client/jobs/integration-test-2.7-master) -| `integration-test-2.8` | [![integration-test-2.8-master](https://java-experience.ci.springapps.io/api/v1/teams/java-experience/pipelines/java-client/jobs/integration-test-2.8-master/badge)](https://java-experience.ci.springapps.io/teams/java-experience/pipelines/java-client/jobs/integration-test-2.8-master) -| `deploy` | [![deploy-master](https://java-experience.ci.springapps.io/api/v1/teams/java-experience/pipelines/java-client/jobs/deploy-master/badge)](https://java-experience.ci.springapps.io/teams/java-experience/pipelines/java-client/jobs/deploy-master) - - The `cf-java-client` project is a Java language binding for interacting with a Cloud Foundry instance. The project is broken up into a number of components that expose different levels of abstraction depending on need. * `cloudfoundry-client` – Interfaces, request, and response objects mapping to the [Cloud Foundry REST APIs][a]. This project has no implementation and therefore cannot connect to a Cloud Foundry instance on its own. -* `cloudfoundry-client-reactor` – The default implementation of the `cloudfoundry-client` project. This implementation is based on the Reactor Netty [`HttpClient`][h]. +* `cloudfoundry-client-reactor` – The default implementation of the `cloudfoundry-client` project. This implementation is based on Reactor Netty [`HttpClient`][h]. * `cloudfoundry-operations` – An API and implementation that corresponds to the [Cloud Foundry CLI][c] operations. This project builds on the `cloudfoundry-client` and therefore has a single implementation. ## Versions -The Cloud Foundry Java Client has two active versions. The `4.x` line uses Spring Boot `2.2.x` just to manage its dependencies, while the `3.x` line uses Spring Boot `2.1.x`. Unless you have a specific dependency-related reason for using the older version we recommend you adopt the `4.x` line. +The Cloud Foundry Java Client has two active versions. The `5.x` line is compatible with Spring Boot `2.4.x - 2.6.x` just to manage its dependencies, while the `4.x` line uses Spring Boot `2.3.x`. ## Dependencies Most projects will need two dependencies; the Operations API and an implementation of the Client API. For Maven, the dependencies would be defined like this: @@ -35,13 +25,12 @@ Most projects will need two dependencies; the Operations API and an implementati org.cloudfoundry cloudfoundry-client-reactor - 4.3.0.RELEASE + latest.RELEASE org.cloudfoundry cloudfoundry-operations - 4.3.0.RELEASE - + latest.RELEASE ... @@ -67,8 +56,8 @@ For Gradle, the dependencies would be defined like this: ```groovy dependencies { - compile 'org.cloudfoundry:cloudfoundry-client-reactor:4.3.0.RELEASE' - compile 'org.cloudfoundry:cloudfoundry-operations:4.3.0.RELEASE' + compile 'org.cloudfoundry:cloudfoundry-client-reactor:.RELEASE' + compile 'org.cloudfoundry:cloudfoundry-operations:.RELEASE' ... } ``` @@ -208,7 +197,7 @@ Once you've got a reference to the `CloudFoundryOperations`, it's time to start 1. Requests a list of all organizations 1. Extracts the name of each organization -1. Prints the name of the each organization to `System.out` +1. Prints the name of each organization to `System.out` ```java cloudFoundryOperations.organizations() @@ -245,6 +234,24 @@ The above example is more complicated: 1. `.flatMapIterable(...)` – Substitutes the original `Mono` with a `Flux` of the `Resource`s returned by the requested page. 1. `.map(...)` – Maps the `Resource` to an `OrganizationSummary` type. +## Troubleshooting + +If you are having issues with the cf-java-client in your applications... + +First, [read this article on debugging reactive applications](https://spring.io/blog/2019/03/28/reactor-debugging-experience) and watch this [Spring Tips Video](https://spring.io/blog/2019/05/29/spring-tips-debugging-reactor-applications) also on debugging reactive apps. + +Beyond that, it is helpful to capture the following information: + +1. The version of cf-java-client you are using +2. If you are using Spring Boot & if so, the version +3. A description of the problem behavior. +4. A list of things, if any, you have recently changed in your project (even if seemingly unrelated) +5. If you are getting failures with an operation or client request, capture the request and response information. + - You may capture basic request and response information by setting the log level for `cloudfoundry-client` to `DEBUG`. For example with Spring Boot, set `logging.level.cloudfoundry-client=debug`. + - You may perform a wire capture by setting the log level for `cloudfoundry-client.wire` to `TRACE`. For example with Spring Boot, set `logging.level.cloudfoundry-client.wire=trace`. + +If you open a Github issue with a request for help, please include as much of the information above as possible and do not forget to sanitize any request/response data posted. + ## Development The project depends on Java 8. To build from source and install to your local Maven cache, run the following: @@ -261,8 +268,20 @@ To run the integration tests, run the following: $ ./mvnw -Pintegration-test clean test ``` +To run a specific integration test, run the following replacing with `-Dtest=org.cloudfoundry.TestClass#test-method` (`#test-method` is optional): + +```shell +./mvnw -Pintegration-test clean test -Dtest=org.cloudfoundry.client.v3.ServiceBrokersTest#update +``` + +To run tests & enable HTTP trace output, execute: + +```shell +CLIENT_LOGGING_LEVEL=trace ./mvnw -Pintegration-test clean test +``` + **IMPORTANT** -Integration tests should be run against an empty Cloud Foundry instance. The integration tests are destructive, affecting nearly everything on an instance given the chance. +Integration tests require admin access and should be run against an empty Cloud Foundry instance. The integration tests are destructive, affecting nearly everything on an instance given the chance. The integration tests require a running instance of Cloud Foundry to test against. To configure the integration tests with the appropriate connection information use the following environment variables: @@ -279,6 +298,14 @@ Name | Description `TEST_PROXY_USERNAME` | _(Optional)_ The username for a proxy to route all requests through `TEST_SKIPSSLVALIDATION` | _(Optional)_ Whether to skip SSL validation when connecting to the Cloud Foundry instance. Defaults to `false`. +If you do not have access to a CloudFoundry instance with admin access, you can run one locally using [bosh-deployment](https://github.com/cloudfoundry/bosh-deployment) & [cf-deployment](https://github.com/cloudfoundry/cf-deployment/) and Virtualbox. + +For instructions installing Bosh in VirtualBox using `bosh-deployment`, see the [Install Section to install Bosh](https://bosh.io/docs/bosh-lite/). + +With Bosh installed, follow the [deployment guide to get CF installed](https://github.com/cloudfoundry/cf-deployment/blob/main/texts/deployment-guide.md). You can skip to step 4, since you're installing into VirtualBox. Be sure to read the entire document before you begin, however pay specific attention to [this section which has specific instructions for running locally](https://github.com/cloudfoundry/cf-deployment/blob/main/texts/deployment-guide.md#for-operators-deploying-cf-to-local-bosh-lite). + +Lastly before running the tests, it is strongly recommended that you take a snapshot of the VMs in the environment. This allows for the quick rollback of the environment should the tests break something (they don't generally, integration tests should clean up after themselves). + ## Contributing [Pull requests][u] and [Issues][e] are welcome. diff --git a/ci/Dockerfile b/ci/Dockerfile index 527e21c2527..b0c3f729a78 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,7 +1,14 @@ -FROM ubuntu:bionic +ARG base_image=openjdk:8-jre +FROM ${base_image} + +ADD https://repo.spring.io/libs-release/io/spring/concourse/releasescripts/concourse-release-scripts/0.3.2/concourse-release-scripts-0.3.2.jar /opt/concourse-release-scripts.jar RUN apt-get update && apt-get install --no-install-recommends -y \ ca-certificates \ curl \ jq \ - && rm -rf /var/lib/apt/lists/* + gnupg \ + && rm -rf /var/lib/apt/lists/* + +RUN curl -fL https://getcli.jfrog.io | sh && \ + mv jfrog /usr/local/bin/ \ No newline at end of file diff --git a/ci/builder.yml b/ci/builder.yml deleted file mode 100644 index 3f637a2ffa0..00000000000 --- a/ci/builder.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -platform: linux - -image_resource: - type: registry-image - source: - repository: concourse/builder - -inputs: -- name: builder - -outputs: -- name: image - -caches: -- path: cache - -run: - path: build - -params: - CONTEXT: builder/ci diff --git a/ci/claim-environment.sh b/ci/claim-environment.sh new file mode 100755 index 00000000000..b5311f4d1de --- /dev/null +++ b/ci/claim-environment.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/../..) + +if [[ -d "${ROOT}"/om ]]; then + printf "➜ Expanding om\n" + tar xzf "${ROOT}"/om/om-linux-*.tar.gz -C "${ROOT}"/om + export PATH="${ROOT}"/om:${PATH} +fi + +printf "Claiming environment from %s\n" "${POOL}" + +CLAIM=$(curl \ + --fail \ + --location \ + --show-error \ + --silent \ + --header 'Accept: application/json' \ + --request "POST" \ + "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${API_TOKEN}&pool_name=${POOL}¬es=Claimed%20by%20Java%20Buildpack%20CI") + +printf "Claimed %s\n" "$(jq -n -r --argjson claim "${CLAIM}" '$claim.name')" + +CREDENTIALS=$(om \ + --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ + --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ + --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ + credentials \ + --product-name cf \ + --credential-reference .uaa.admin_credentials \ + --format json) + + jq \ + -n -r \ + --argjson claim "${CLAIM}" \ + --argjson credentials "${CREDENTIALS}" \ + '{ name: $claim.name, username: $credentials.identity, password: $credentials.password }' \ + > "${ROOT}"/environment/cf-creds.json + + +CREDENTIALS=$(om \ + --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ + --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ + --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ + credentials \ + --product-name cf \ + --credential-reference .uaa.admin_client_credentials \ + --format json) + + jq \ + -n -r \ + --argjson claim "${CLAIM}" \ + --argjson credentials "${CREDENTIALS}" \ + '{ client: $credentials.identity, secret: $credentials.password }' \ + > "${ROOT}"/environment/uaa-creds.json + +printf "Patching for TCP Routing Support\n" + +om \ + --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ + --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ + --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ + staged-config \ + --product-name cf > /tmp/cf.yml + +TCP_ROUTES_LB="$(jq -n -r --argjson claim "${CLAIM}" '$claim.tcp_router_pool')" + +om \ + --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ + --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ + --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ + configure-product \ + --config /tmp/cf.yml \ + --ops-file cf-java-client/ci/tcp-routes.yml \ + --var TCP_ROUTES_LB="tcp:${TCP_ROUTES_LB}" + +om \ + --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ + --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ + --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ + apply-changes \ + -n cf + +printf "Environment updated with TCP Routes\n" diff --git a/ci/deploy.sh b/ci/deploy.sh index f785039a1f7..bb4e47d7fc4 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -4,6 +4,28 @@ set -euo pipefail [[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 +function clean_gpg { + FINGERPRINT=$(gpg --list-keys | head -4 | tail -1 | tr -d ' ') + gpg --batch --yes --delete-secret-keys "$FINGERPRINT" + gpg --batch --yes --delete-keys "$FINGERPRINT" +} + +trap clean_gpg EXIT +gpg --batch --import-options import-show --import <(echo "$MAVEN_GPG_PRIVATE_KEY") + +mkdir -p ~/.m2 +cat < ~/.m2/settings.xml + + + + gpg.passphrase + ${MAVEN_GPG_PASSPHRASE} + + + +EOF + cd cf-java-client ./mvnw -q -Dmaven.test.skip=true deploy -cp target/build-info.json ../build-info/build-info.json diff --git a/ci/deploy.yml b/ci/deploy.yml deleted file mode 100644 index d25f1bd364f..00000000000 --- a/ci/deploy.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -platform: linux - -image_resource: - type: registry-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: cf-java-client - -outputs: -- name: build-info - -caches: -- path: maven - -run: - path: cf-java-client/ci/deploy.sh - -params: - ARTIFACTORY_USERNAME: - ARTIFACTORY_PASSWORD: diff --git a/ci/integration-test.sh b/ci/integration-test.sh index c861effe39a..789f612213d 100755 --- a/ci/integration-test.sh +++ b/ci/integration-test.sh @@ -2,7 +2,37 @@ set -euo pipefail +# update & install jq +apt-get update && apt-get -y install jq + [[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 +ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/../..) + +if [[ -d "${ROOT}"/om ]]; then + printf "➜ Expanding om\n" + tar xzf "${ROOT}"/om/om-linux-*.tar.gz -C "${ROOT}"/om + export PATH="${ROOT}"/om:${PATH} +fi + +CF_CREDS=$(cat "${ROOT}"/environment/cf-creds.json) + +TEST_APIHOST=$(jq -n -r --argjson credentials "${CF_CREDS}" '"api.sys.\($credentials.name).cf-app.com"') +export TEST_APIHOST + +TEST_ADMIN_USERNAME=$(jq -n -r --argjson credentials "${CF_CREDS}" '$credentials.username') +export TEST_ADMIN_USERNAME + +TEST_ADMIN_PASSWORD=$(jq -n -r --argjson credentials "${CF_CREDS}" '$credentials.password') +export TEST_ADMIN_PASSWORD + +UAA_CREDS=$(cat "${ROOT}"/environment/uaa-creds.json) + +TEST_ADMIN_CLIENTID=$(jq -n -r --argjson credentials "${UAA_CREDS}" '$credentials.client') +export TEST_ADMIN_CLIENTID + +TEST_ADMIN_CLIENTSECRET=$(jq -n -r --argjson credentials "${UAA_CREDS}" '$credentials.secret') +export TEST_ADMIN_CLIENTSECRET + cd cf-java-client ./mvnw -q -P integration-test test diff --git a/ci/integration-test.yml b/ci/integration-test.yml deleted file mode 100644 index cdd0eb8cf39..00000000000 --- a/ci/integration-test.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -platform: linux - -image_resource: - type: registry-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: cf-java-client - -caches: -- path: maven - -run: - path: cf-java-client/ci/integration-test.sh - -params: - TEST_ADMIN_CLIENTID: - TEST_ADMIN_CLIENTSECRET: - TEST_ADMIN_PASSWORD: - TEST_ADMIN_USERNAME: - TEST_APIHOST: - TEST_SKIPSSLVALIDATION: diff --git a/ci/promote-to-bintray.sh b/ci/promote-to-bintray.sh deleted file mode 100755 index bb91d57917b..00000000000 --- a/ci/promote-to-bintray.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -NAME=$(jq -r .name build-info/build-info.json) -NUMBER=$(jq -r .number build-info/build-info.json) - -## Promote to Bintray -curl --request "POST" "https://repo.spring.io/api/build/distribute/$NAME/$NUMBER" \ - --header "Content-Type: application/json; charset=utf-8" \ - --user $ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD \ - --data "{ \"sourceRepos\": [ \"$SOURCE_REPOSITORY\" ], \"targetRepo\": \"$TARGET_REPOSITORY\" }" \ - --fail diff --git a/ci/promote-to-bintray.yml b/ci/promote-to-bintray.yml deleted file mode 100644 index 4fe9e5e20c0..00000000000 --- a/ci/promote-to-bintray.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -platform: linux - -image_resource: - type: registry-image - source: - repository: cfje/cf-java-client - -inputs: -- name: build-info -- name: cf-java-client - -run: - path: cf-java-client/ci/promote-to-bintray.sh - -params: - ARTIFACTORY_USERNAME: - ARTIFACTORY_PASSWORD: - SOURCE_REPOSITORY: libs-release-local - TARGET_REPOSITORY: spring-distributions diff --git a/ci/promote-to-maven-central.sh b/ci/promote-to-maven-central.sh index 59959bda662..9ed1a9515b0 100755 --- a/ci/promote-to-maven-central.sh +++ b/ci/promote-to-maven-central.sh @@ -2,12 +2,8 @@ set -euo pipefail -GROUP_ID=$(jq -r .modules[0].id build-info/build-info.json | cut -d ':' -f 1) -VERSION=$(jq -r .modules[0].id build-info/build-info.json | cut -d ':' -f 3) - -## Promote to Maven Central -curl --request "POST" "https://api.bintray.com/maven_central_sync/spring/jars/$GROUP_ID/versions/$VERSION" \ - --header "Content-Type: application/json; charset=utf-8" \ - --user $BINTRAY_USERNAME:$BINTRAY_API_KEY \ - --data "{ \"username\": \"$MAVEN_CENTRAL_USERNAME\", \"password\": \"$MAVEN_CENTRAL_PASSWORD\" }" \ - --fail +export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json + +java -jar /opt/concourse-release-scripts.jar publishToCentral 'RELEASE' "$BUILD_INFO_LOCATION" artifactory-repo + +echo "Sync complete" diff --git a/ci/promote-to-maven-central.yml b/ci/promote-to-maven-central.yml deleted file mode 100644 index e2700c89d88..00000000000 --- a/ci/promote-to-maven-central.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -platform: linux - -image_resource: - type: registry-image - source: - repository: cfje/cf-java-client - -inputs: -- name: build-info -- name: cf-java-client - -run: - path: cf-java-client/ci/promote-to-maven-central.sh - -params: - BINTRAY_API_KEY: - BINTRAY_USERNAME: - MAVEN_CENTRAL_PASSWORD: - MAVEN_CENTRAL_USERNAME: diff --git a/ci/tcp-routes.yml b/ci/tcp-routes.yml new file mode 100644 index 00000000000..eeda8a78507 --- /dev/null +++ b/ci/tcp-routes.yml @@ -0,0 +1,20 @@ +--- +- type: replace + path: /product-properties/.properties.tcp_routing + value: + selected_option: enable + value: enable +- type: replace + path: /product-properties/.properties.tcp_routing.enable.request_timeout_in_seconds? + value: + value: 300 +- type: replace + path: /product-properties/.properties.tcp_routing.enable.reservable_ports? + value: + value: 1024-1123 +- type: replace + path: /resource-config/tcp_router/elb_names/- + value: "((TCP_ROUTES_LB))" +- type: replace + path: /resource-config/tcp_router/instances + value: automatic diff --git a/ci/unclaim-environment.sh b/ci/unclaim-environment.sh new file mode 100755 index 00000000000..9427782dbad --- /dev/null +++ b/ci/unclaim-environment.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/../..) + +CREDENTIALS=$(cat "${ROOT}"/environment/cf-creds.json) + +printf "Unclaiming %s\n" "$(jq -n -r --argjson credentials "${CREDENTIALS}" '$credentials.name')" + +curl \ + --fail \ + --location \ + --show-error \ + --silent \ + --request "POST" \ + "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/unclaim?api_token=${API_TOKEN}&name=$(jq -n -r --argjson credentials "${CREDENTIALS}" '$credentials.name')" diff --git a/ci/unit-test.yml b/ci/unit-test.yml deleted file mode 100644 index 9991bd29894..00000000000 --- a/ci/unit-test.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -platform: linux - -image_resource: - type: registry-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: cf-java-client - -caches: -- path: maven - -run: - path: cf-java-client/ci/unit-test.sh diff --git a/cloudfoundry-client-reactor/pom.xml b/cloudfoundry-client-reactor/pom.xml index 63eff560cc5..7f04c824f29 100644 --- a/cloudfoundry-client-reactor/pom.xml +++ b/cloudfoundry-client-reactor/pom.xml @@ -1,6 +1,6 @@ - + 4.0.0 @@ -26,7 +23,7 @@ cloudfoundry-java-client Cloud Foundry Java Client Parent A Java language binding for interacting with a Cloud Foundry instance - 4.6.0.BUILD-SNAPSHOT + 5.10.0.BUILD-SNAPSHOT pom https://github.com/cloudfoundry/cf-java-client @@ -43,9 +40,9 @@ - Pivotal - info@pivotal.io - Pivotal Software, Inc. + VMware + info@vmware.com + VMware, Inc. https://www.cloudfoundry.org @@ -58,13 +55,12 @@ - 1.20 - 2.2.5.RELEASE - 1.2.2 - 2.8.3 + 1.21 + 2.4.2 + 1.3 + 2.8.8 0.9.0 - 0.9.1 - 3.14.7 + 0.11.2 UTF-8 2.2.0 @@ -84,11 +80,6 @@ java-semver ${java-semver.version} - - com.squareup.okhttp3 - mockwebserver - ${okhttp3.version} - com.squareup.wire wire-runtime @@ -96,8 +87,20 @@ io.jsonwebtoken - jjwt + jjwt-api + ${jjwt.version} + + + io.jsonwebtoken + jjwt-impl + ${jjwt.version} + runtime + + + io.jsonwebtoken + jjwt-jackson ${jjwt.version} + runtime org.apache.commons @@ -150,6 +153,11 @@ 1.8 + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + org.apache.maven.plugins maven-deploy-plugin @@ -158,12 +166,13 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.2.0 https://projectreactor.io/docs/core/release/api/ true + 8 @@ -223,6 +232,26 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + @@ -231,9 +260,9 @@ false - central - bintray-plugins - https://jcenter.bintray.com + jfrog-jars + jfrog-jars + https://oss.jfrog.org/artifactory/jfrog-jars/ @@ -257,6 +286,13 @@ + + test-logcache + + + test-log-cache + + test-service-broker diff --git a/test-log-cache/README.md b/test-log-cache/README.md new file mode 100644 index 00000000000..1007971fcb4 --- /dev/null +++ b/test-log-cache/README.md @@ -0,0 +1,2 @@ +Application for testing [Log Cache](https://github.com/cloudfoundry/log-cache-release) client. This application uses +[Metric Registrar](https://docs.pivotal.io/platform/application-service/2-9/metric-registrar/using.html) to produce different types of metrics. \ No newline at end of file diff --git a/test-log-cache/pom.xml b/test-log-cache/pom.xml new file mode 100644 index 00000000000..4552df9daf3 --- /dev/null +++ b/test-log-cache/pom.xml @@ -0,0 +1,86 @@ + + + + + + 4.0.0 + + + org.cloudfoundry + cloudfoundry-java-client + 5.10.0.BUILD-SNAPSHOT + + + test-log-cache + Test Log Cache App + jar + + + + org.immutables + value + provided + + + org.springframework.boot + spring-boot-starter-web + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + + true + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + test-log-cache + ${project.parent.basedir}/integration-test/src/test/resources + + + + + + diff --git a/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/LogCacheTestApplication.java b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/LogCacheTestApplication.java new file mode 100644 index 00000000000..37860a0082a --- /dev/null +++ b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/LogCacheTestApplication.java @@ -0,0 +1,85 @@ +/* + * Copyright 2013-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 + * + * http://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.cloudfoundry.logcachetest; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@SpringBootApplication +@RestController +public class LogCacheTestApplication { + + private final ObjectMapper objectMapper; + + @Autowired + public LogCacheTestApplication(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public static void main(String[] args) { + SpringApplication.run(LogCacheTestApplication.class, args); + } + + @RequestMapping("/counter") + public String counter(@RequestParam("name") String name, @RequestParam("delta") Long delta) throws Exception { + final String json = this.objectMapper.writeValueAsString(Counter.builder() + .name(name) + .delta(delta) + .build()); + System.out.println(json); + return json; + } + + @RequestMapping("/event") + public String event(@RequestParam("title") String title, @RequestParam("body") String body) throws Exception { + final String json = this.objectMapper.writeValueAsString(Event.builder() + .title(title) + .body(body) + .build()); + System.out.println(json); + return json; + } + + @RequestMapping("/gauge") + public String gauge(@RequestParam("name") String name, @RequestParam("value") Double value) throws Exception { + final String json = this.objectMapper.writeValueAsString(Gauge.builder() + .name(name) + .value(value) + .build()); + System.out.println(json); + return json; + } + + @RequestMapping("/log") + public String log(@RequestParam("message") String message) { + System.out.println(message); + return message; + } + + @RequestMapping("/test") + public String test() { + final String output = "{\"type\":\"event\",\"title\":\"Test Title\",\"body\":\"Test Body\"}"; + System.out.println(output); + return output; + } + +} diff --git a/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Counter.java b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Counter.java new file mode 100644 index 00000000000..6b147bb1e2f --- /dev/null +++ b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Counter.java @@ -0,0 +1,36 @@ +/* + * Copyright 2013-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 + * + * http://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.cloudfoundry.logcachetest; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.immutables.value.Value; + +@Value.Immutable +abstract class _Counter { + + @JsonProperty("type") + public String getType() { + return "counter"; + } + + @JsonProperty("delta") + abstract Long getDelta(); + + @JsonProperty("name") + abstract String getName(); + +} diff --git a/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Event.java b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Event.java new file mode 100644 index 00000000000..6270ba6cafa --- /dev/null +++ b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Event.java @@ -0,0 +1,36 @@ +/* + * Copyright 2013-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 + * + * http://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.cloudfoundry.logcachetest; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.immutables.value.Value; + +@Value.Immutable +abstract class _Event { + + @JsonProperty("type") + public String getType() { + return "event"; + } + + @JsonProperty("body") + abstract String getBody(); + + @JsonProperty("title") + abstract String getTitle(); + +} diff --git a/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Gauge.java b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Gauge.java new file mode 100644 index 00000000000..fc160cb0c93 --- /dev/null +++ b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/_Gauge.java @@ -0,0 +1,36 @@ +/* + * Copyright 2013-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 + * + * http://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.cloudfoundry.logcachetest; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.immutables.value.Value; + +@Value.Immutable +abstract class _Gauge { + + @JsonProperty("type") + public String getType() { + return "gauge"; + } + + @JsonProperty("name") + abstract String getName(); + + @JsonProperty("value") + abstract Double getValue(); + +} diff --git a/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/package-info.java b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/package-info.java new file mode 100644 index 00000000000..d1daa10d1d0 --- /dev/null +++ b/test-log-cache/src/main/java/org/cloudfoundry/logcachetest/package-info.java @@ -0,0 +1,28 @@ +/* + * Copyright 2013-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 + * + * http://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. + */ + +@Value.Style( + add = "*", + defaults = @Value.Immutable(copy = false), + depluralize = true, + jdkOnly = true, + put = "*", + typeAbstract = "_*", + typeImmutable = "*" +) +package org.cloudfoundry.logcachetest; + +import org.immutables.value.Value; diff --git a/test-service-broker/pom.xml b/test-service-broker/pom.xml index 0a6da9231ae..40d0850995f 100644 --- a/test-service-broker/pom.xml +++ b/test-service-broker/pom.xml @@ -1,6 +1,6 @@