diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0fa19e0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -sudo: false -cache: - directories: - - $HOME/.m2 -language: java -jdk: # TODO: should work with java 1.7 - - oraclejdk8 -install: -- ./mvnw install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true -script: -- './mvnw install -nsu -Dmaven.test.redirectTestOutputToFile=true' diff --git a/README.adoc b/README.adoc index fff47bc..4f72ee6 100644 --- a/README.adoc +++ b/README.adoc @@ -1,6 +1,6 @@ // Do not edit this file (e.g. go instead to src/main/asciidoc) -image::https://travis-ci.org/spring-cloud/spring-cloud-cli.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-cli] +image:https://circleci.com/gh/spring-cloud/spring-cloud-cli.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-cli"] Spring Boot CLI provides http://projects.spring.io/spring-boot[Spring Boot] command line features for https://github.com/spring-cloud[Spring @@ -21,20 +21,20 @@ https://github.com/spring-projects/spring-boot[Spring Boot CLI] (1.5.2 or better): $ spring version - Spring CLI v1.5.3.RELEASE + Spring CLI v1.5.4.RELEASE E.g. for SDKMan users ``` -$ sdk install springboot 1.5.3.RELEASE -$ sdk use springboot 1.5.3.RELEASE +$ sdk install springboot 1.5.4.RELEASE +$ sdk use springboot 1.5.4.RELEASE ``` and install the Spring Cloud plugin ``` $ mvn install -$ spring install org.springframework.cloud:spring-cloud-cli:1.3.4.BUILD-SNAPSHOT +$ spring install org.springframework.cloud:spring-cloud-cli:1.4.1.BUILD-SNAPSHOT ``` IMPORTANT: **Prerequisites:** to use the encryption and decryption features diff --git a/docs/pom.xml b/docs/pom.xml index b7182a7..1725382 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 org.springframework.cloud spring-cloud-cli-docs @@ -12,43 +13,51 @@ Spring Cloud Cli Docs Spring Cloud Docs - spring-cloud-cli + spring-cloud-cli ${basedir}/.. - 1.0.x + 1.0.x,1.1.x,1.2.x,1.3.x - + - - - maven-deploy-plugin - - true - - + + + maven-deploy-plugin + + true + + - + docs - - - - org.asciidoctor - asciidoctor-maven-plugin - false - - - org.apache.maven.plugins - maven-antrun-plugin - false - - - org.codehaus.mojo - build-helper-maven-plugin - false - - - + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.asciidoctor + asciidoctor-maven-plugin + false + + + com.agilejava.docbkx + docbkx-maven-plugin + + + org.apache.maven.plugins + maven-antrun-plugin + false + + + org.codehaus.mojo + build-helper-maven-plugin + false + + + - + diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index e81a787..d973af4 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -1,4 +1,4 @@ -image::https://travis-ci.org/spring-cloud/spring-cloud-cli.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-cli] +image:https://circleci.com/gh/spring-cloud/spring-cloud-cli.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-cli"] include::intro.adoc[] diff --git a/docs/src/main/asciidoc/install.adoc b/docs/src/main/asciidoc/install.adoc index 36ea57d..856f207 100644 --- a/docs/src/main/asciidoc/install.adoc +++ b/docs/src/main/asciidoc/install.adoc @@ -4,20 +4,20 @@ https://github.com/spring-projects/spring-boot[Spring Boot CLI] (1.5.2 or better): $ spring version - Spring CLI v1.5.3.RELEASE + Spring CLI v1.5.8.RELEASE E.g. for SDKMan users ``` -$ sdk install springboot 1.5.3.RELEASE -$ sdk use springboot 1.5.3.RELEASE +$ sdk install springboot 1.5.8.RELEASE +$ sdk use springboot 1.5.8.RELEASE ``` and install the Spring Cloud plugin ``` $ mvn install -$ spring install org.springframework.cloud:spring-cloud-cli:1.3.4.BUILD-SNAPSHOT +$ spring install org.springframework.cloud:spring-cloud-cli:1.4.1.BUILD-SNAPSHOT ``` IMPORTANT: **Prerequisites:** to use the encryption and decryption features diff --git a/docs/src/main/asciidoc/spring-cloud-cli.adoc b/docs/src/main/asciidoc/spring-cloud-cli.adoc index ea05e9e..51ee3e5 100644 --- a/docs/src/main/asciidoc/spring-cloud-cli.adoc +++ b/docs/src/main/asciidoc/spring-cloud-cli.adoc @@ -21,7 +21,7 @@ of services just `spring cloud`. To choose the services to deploy, just list them on the command line, e.g. ---- -$ spring cloud eureka configserver h2 kafka zipkin +$ spring cloud eureka configserver h2 kafka stubrunner zipkin ---- Summary of supported deployables: @@ -50,6 +50,9 @@ Summary of supported deployables: |zipkin | Zipkin Server | http://localhost:9411 | Zipkin Server with UI for visualizing traces. Stores span data in memory and accepts them via HTTP POST of JSON data. + +|stubrunner | Stub Runner Boot | http://localhost:8750 +| Downloads WireMock stubs, starts WireMock and feeds the started servers with stored stubs. Pass `stubrunner.ids` to pass stub coordinates and then go to `http://localhost:8750/stubs`. |=== Each of these apps can be configured using a local YAML file with the same name (in the current @@ -69,6 +72,17 @@ spring: uri: file://${user.home}/dev/demo/config-repo ---- +E.g. in Stub Runner app you could fetch stubs from your local `.m2` in the following way. + +.stubrunner.yml +[source,yaml,indent=0] +---- +stubrunner: + workOffline: true + ids: + - com.example:beer-api-producer:+:9876 +---- + === Adding Additional Applications Additional applications can be added to `./config/cloud.yml` (not @@ -94,7 +108,7 @@ when you list the apps: [source] ---- $ spring cloud --list -source sink configserver dataflow eureka h2 hystrixdashboard kafka zipkin +source sink configserver dataflow eureka h2 hystrixdashboard kafka stubrunner zipkin ---- (notice the additional apps at the start of the list). diff --git a/pom.xml b/pom.xml index d6b36aa..cd1ffb8 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ cli spring-cloud-cli ${basedir}/.. - 2.0.0.M2 + 2.0.0.M6 Finchley.BUILD-SNAPSHOT diff --git a/spring-cloud-cli-integration-tests/pom.xml b/spring-cloud-cli-integration-tests/pom.xml index c92d8ea..5dfe32f 100644 --- a/spring-cloud-cli-integration-tests/pom.xml +++ b/spring-cloud-cli-integration-tests/pom.xml @@ -54,6 +54,24 @@ true + + maven-jar-plugin + + true + + + + maven-install-plugin + + true + + + + maven-gpg-plugin + + true + + diff --git a/spring-cloud-cli-integration-tests/samples/stubrunner.groovy b/spring-cloud-cli-integration-tests/samples/stubrunner.groovy new file mode 100644 index 0000000..992ad99 --- /dev/null +++ b/spring-cloud-cli-integration-tests/samples/stubrunner.groovy @@ -0,0 +1,6 @@ +package org.test + +@EnableStubRunnerServer +class Example { +} + diff --git a/spring-cloud-cli-integration-tests/src/test/java/org/springframework/cloud/cli/SampleIntegrationTests.java b/spring-cloud-cli-integration-tests/src/test/java/org/springframework/cloud/cli/SampleIntegrationTests.java index eeb0d6f..743d555 100644 --- a/spring-cloud-cli-integration-tests/src/test/java/org/springframework/cloud/cli/SampleIntegrationTests.java +++ b/spring-cloud-cli-integration-tests/src/test/java/org/springframework/cloud/cli/SampleIntegrationTests.java @@ -76,4 +76,11 @@ public class SampleIntegrationTests { output.contains("[/routes || /routes.json],methods=[GET]")); } + @Test + public void stubRunnerSample() throws Exception { + String output = this.cli.run("stubrunner.groovy"); + assertTrue("Wrong output: " + output, + output.contains("[/stubs],produces=[application/json]")); + } + } diff --git a/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/StubRunnerCompilerAutoConfiguration.java b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/StubRunnerCompilerAutoConfiguration.java new file mode 100644 index 0000000..3e4ba5d --- /dev/null +++ b/spring-cloud-cli/src/main/java/org/springframework/cloud/cli/compiler/StubRunnerCompilerAutoConfiguration.java @@ -0,0 +1,48 @@ +/* + * Copyright 2013-2014 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.springframework.cloud.cli.compiler; + +import org.codehaus.groovy.ast.ClassNode; +import org.codehaus.groovy.control.CompilationFailedException; +import org.codehaus.groovy.control.customizers.ImportCustomizer; +import org.springframework.boot.cli.compiler.AstUtils; +import org.springframework.boot.cli.compiler.CompilerAutoConfiguration; +import org.springframework.boot.cli.compiler.DependencyCustomizer; + +/** + * @author Marcin Grzejszczak + * + */ +public class StubRunnerCompilerAutoConfiguration extends CompilerAutoConfiguration { + + @Override + public boolean matches(ClassNode classNode) { + return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableStubRunnerServer"); + } + + @Override + public void applyDependencies(DependencyCustomizer dependencies) { + dependencies + .ifAnyMissingClasses("org.springframework.cloud.contract.stubrunner.server.EnableStubRunnerServer") + .add("spring-cloud-starter-contract-stub-runner"); + } + + @Override + public void applyImports(ImportCustomizer imports) throws CompilationFailedException { + imports.addImports("org.springframework.cloud.contract.stubrunner.server.EnableStubRunnerServer"); + } + +} diff --git a/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration b/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration index 4dfc5d6..902572a 100644 --- a/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration +++ b/spring-cloud-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration @@ -8,4 +8,5 @@ org.springframework.cloud.cli.compiler.OAuth2LoadBalancedCompilerAutoConfigurati org.springframework.cloud.cli.compiler.RibbonClientCompilerAutoConfiguration org.springframework.cloud.cli.compiler.StreamKafkaCompilerAutoConfiguration org.springframework.cloud.cli.compiler.StreamRabbitCompilerAutoConfiguration +org.springframework.cloud.cli.compiler.StubRunnerCompilerAutoConfiguration org.springframework.cloud.cli.compiler.ZuulCompilerAutoConfiguration diff --git a/spring-cloud-launcher/pom.xml b/spring-cloud-launcher/pom.xml index 4659cf5..c9c6734 100644 --- a/spring-cloud-launcher/pom.xml +++ b/spring-cloud-launcher/pom.xml @@ -18,7 +18,7 @@ - 1.0.5.RELEASE + 1.0.7.RELEASE @@ -30,6 +30,7 @@ spring-cloud-launcher-h2 spring-cloud-launcher-hystrixdashboard spring-cloud-launcher-kafka + spring-cloud-launcher-stubrunner spring-cloud-launcher-zipkin diff --git a/spring-cloud-launcher/spring-cloud-launcher-dataflow/pom.xml b/spring-cloud-launcher/spring-cloud-launcher-dataflow/pom.xml index cc29ab1..b0147fe 100644 --- a/spring-cloud-launcher/spring-cloud-launcher-dataflow/pom.xml +++ b/spring-cloud-launcher/spring-cloud-launcher-dataflow/pom.xml @@ -17,19 +17,11 @@ - 1.1.4.RELEASE - 1.4.4.RELEASE + 1.2.3.RELEASE - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - org.springframework.cloud spring-cloud-dataflow-dependencies diff --git a/spring-cloud-launcher/spring-cloud-launcher-deployer/pom.xml b/spring-cloud-launcher/spring-cloud-launcher-deployer/pom.xml index fbdff1b..893b4d7 100644 --- a/spring-cloud-launcher/spring-cloud-launcher-deployer/pom.xml +++ b/spring-cloud-launcher/spring-cloud-launcher-deployer/pom.xml @@ -17,8 +17,8 @@ - 1.1.4.RELEASE - 1.0.5.RELEASE + 1.2.2.RELEASE + 1.0.7.RELEASE diff --git a/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/resources/cloud.yml b/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/resources/cloud.yml index b649079..b31de48 100644 --- a/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/resources/cloud.yml +++ b/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/resources/cloud.yml @@ -79,6 +79,16 @@ spring: spring.cloud.deployer.local.javaOpts: ${dt.opts} application-properties: management.security.enabled: false + stubrunner: + coordinates: ${dt.pre}stubrunner:${dt.ver} + port: 8750 + message: To see the registered stubs open http://localhost:8750/stubs + order: 0 + properties: + spring.cloud.deployer.memory: ${dt.mem} + spring.cloud.deployer.local.javaOpts: ${dt.opts} + application-properties: + management.security.enabled: false zipkin: coordinates: ${dt.pre}zipkin:${dt.ver} port: 9411 @@ -121,6 +131,11 @@ spring: spring.cloud.deployer.thin.profile: rabbit application-properties: spring.cloud.bus.enabled: true + stubrunner: + properties: + spring.cloud.deployer.thin.profile: rabbit + application-properties: + spring.cloud.bus.enabled: true zipkin: properties: spring.cloud.deployer.thin.profile: rabbit diff --git a/spring-cloud-launcher/spring-cloud-launcher-stubrunner/pom.xml b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/pom.xml new file mode 100644 index 0000000..dbf6179 --- /dev/null +++ b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + org.springframework.cloud.launcher + spring-cloud-launcher-stubrunner + jar + + spring-cloud-launcher-stubrunner + Spring Cloud Launcher Stub Runner + + + org.springframework.cloud + spring-cloud-launcher + 1.4.1.BUILD-SNAPSHOT + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.cloud + spring-cloud-starter-contract-stub-runner + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/java/org/springframework/cloud/launcher/stubrunner/StubRunnerApplication.java b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/java/org/springframework/cloud/launcher/stubrunner/StubRunnerApplication.java new file mode 100644 index 0000000..6353115 --- /dev/null +++ b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/java/org/springframework/cloud/launcher/stubrunner/StubRunnerApplication.java @@ -0,0 +1,32 @@ +/* + * Copyright 2013-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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.springframework.cloud.launcher.stubrunner; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.contract.stubrunner.server.EnableStubRunnerServer; + +/** + * @author Marcin Grzejszczak + */ +@EnableStubRunnerServer +@SpringBootApplication +public class StubRunnerApplication { + public static void main(String[] args) { + SpringApplication.run(StubRunnerApplication.class, args); + } +} diff --git a/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/META-INF/thin-rabbit.properties b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/META-INF/thin-rabbit.properties new file mode 100644 index 0000000..0343528 --- /dev/null +++ b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/META-INF/thin-rabbit.properties @@ -0,0 +1,2 @@ +exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka +dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp diff --git a/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/application.yml b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/application.yml new file mode 100644 index 0000000..d65102d --- /dev/null +++ b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/application.yml @@ -0,0 +1,11 @@ +spring: + application: + name: stubrunner + +server: + port: 8750 + +info: + artifactId: "@project.artifactId@" + description: "@project.description@" + version: "@project.version@" \ No newline at end of file diff --git a/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/launcher/application.yml b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/launcher/application.yml new file mode 100644 index 0000000..2fcfda4 --- /dev/null +++ b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/main/resources/launcher/application.yml @@ -0,0 +1,30 @@ +info: + description: Spring Cloud Launcher + +eureka: + client: + instance-info-replication-interval-seconds: 5 + initial-instance-info-replication-interval-seconds: 5 + serviceUrl: + defaultZone: http://localhost:8761/eureka/ + +endpoints: + restart: + enabled: true + +ribbon: + ConnectTimeout: 3000 + ReadTimeout: 60000 + +h2.datasource.url: jdbc:h2:tcp://localhost:9096/./target/test +#spring: +# datasource: +# url: ${h2.datasource.url} + +logging: + level: + kafka: WARN + org.apache.zookeeper: WARN + org.apache.zookeeper.ClientCnxn: ERROR + org.apache.kafka: WARN + org.I0Itec: WARN diff --git a/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/test/java/org/springframework/cloud/launcher/stubrunner/DeployerApplicationTests.java b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/test/java/org/springframework/cloud/launcher/stubrunner/DeployerApplicationTests.java new file mode 100644 index 0000000..96f9c04 --- /dev/null +++ b/spring-cloud-launcher/spring-cloud-launcher-stubrunner/src/test/java/org/springframework/cloud/launcher/stubrunner/DeployerApplicationTests.java @@ -0,0 +1,17 @@ +package org.springframework.cloud.launcher.stubrunner; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class DeployerApplicationTests { + + @Test + public void contextLoads() { + } + +}