diff --git a/docs/src/main/asciidoc/_attributes.adoc b/docs/src/main/asciidoc/_attributes.adoc index 0f0e53e5a8..1a246251b8 100644 --- a/docs/src/main/asciidoc/_attributes.adoc +++ b/docs/src/main/asciidoc/_attributes.adoc @@ -26,8 +26,8 @@ :verifier_core_path: {verifier_root_path} :stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner :standalone_samples_path: {samples_path}/standalone/dsl -:standalone_messaging_samples_path: {samples_path}/standalone/messaging -:standalone_pact_path: {samples_path}/standalone/pact +:standalone_messaging_samples_path: {samples_path}/standalone/dsl +:standalone_pact_path: {samples_path}/standalone/dsl :standalone_restdocs_path: {samples_path}/standalone/restdocs :tests_path: {core_path}/tests :samples_branch: 2.2.x diff --git a/docs/src/main/asciidoc/getting-started.adoc b/docs/src/main/asciidoc/getting-started.adoc index 57c841e0d1..62094e0147 100644 --- a/docs/src/main/asciidoc/getting-started.adoc +++ b/docs/src/main/asciidoc/getting-started.adoc @@ -126,7 +126,7 @@ include::{introduction_url}/samples/standalone/dsl/http-server/src/test/resource [source,yaml,indent=0,role="secondary"] .yaml ---- -include::{introduction_url}/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.yml[] +include::{introduction_url}/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsFraud.yml[] ---- ==== @@ -983,7 +983,7 @@ include::{introduction_url}/samples/standalone/dsl/http-server/src/test/resource [source,yaml,indent=0,role="secondary"] .yaml ---- -include::{introduction_url}/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.yml[] +include::{introduction_url}/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsFraud.yml[] ---- ==== diff --git a/docs/src/main/asciidoc/howto.adoc b/docs/src/main/asciidoc/howto.adoc index 97205525d8..9cfbb76ee1 100644 --- a/docs/src/main/asciidoc/howto.adoc +++ b/docs/src/main/asciidoc/howto.adoc @@ -846,7 +846,7 @@ Spring Cloud Contract can read the Pact JSON definition. You can place the file ==== [source,javascript,indent=0] ---- -include::{standalone_pact_path}/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.json[indent=0] +include::{standalone_pact_path}/http-server/src/test/resources/contracts/pact/shouldMarkClientAsFraud.json[indent=0] ---- ==== @@ -862,13 +862,13 @@ Maven and Gradle: [source,xml,indent=0,subs="verbatim,attributes",role="primary"] .Maven ---- -include::{standalone_pact_path}/pact-http-server/pom.xml[tags=pact_dependency,indent=0] +include::{standalone_pact_path}/http-server/pom.xml[tags=pact_dependency,indent=0] ---- [source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle ---- -include::{standalone_pact_path}/pact-http-server/build.gradle[tags=pact_dependency,indent=0] +include::{standalone_pact_path}/http-server/build.gradle[tags=pact_dependency,indent=0] ---- ==== @@ -945,13 +945,13 @@ Maven and Gradle: [source,xml,indent=0,subs="verbatim,attributes",role="primary"] .Maven ---- -include::{standalone_pact_path}/pact-http-client/pom.xml[tags=pact_dependency,indent=0] +include::{standalone_pact_path}/http-client/pom.xml[tags=pact_dependency,indent=0] ---- [source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle ---- -include::{standalone_pact_path}/pact-http-client/build.gradle[tags=pact_dependency,indent=0] +include::{standalone_pact_path}/http-client/build.gradle[tags=pact_dependency,indent=0] ---- ==== diff --git a/samples/standalone/dsl/http-client/pom.xml b/samples/standalone/dsl/http-client/pom.xml index 1eae476bf2..04cf44f981 100644 --- a/samples/standalone/dsl/http-client/pom.xml +++ b/samples/standalone/dsl/http-client/pom.xml @@ -38,6 +38,16 @@ org.apache.httpcomponents httpclient + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + + + org.springframework.cloud + spring-cloud-stream-test-support + test + diff --git a/samples/standalone/messaging/stream-sink/src/main/java/com/example/sink/ContractVerifierSampleStreamSinkApplication.java b/samples/standalone/dsl/http-client/src/main/java/com/example/sink/ContractVerifierSampleStreamSinkApplication.java similarity index 100% rename from samples/standalone/messaging/stream-sink/src/main/java/com/example/sink/ContractVerifierSampleStreamSinkApplication.java rename to samples/standalone/dsl/http-client/src/main/java/com/example/sink/ContractVerifierSampleStreamSinkApplication.java diff --git a/samples/standalone/messaging/stream-sink/src/main/java/com/example/sink/SensorData.java b/samples/standalone/dsl/http-client/src/main/java/com/example/sink/SensorData.java similarity index 100% rename from samples/standalone/messaging/stream-sink/src/main/java/com/example/sink/SensorData.java rename to samples/standalone/dsl/http-client/src/main/java/com/example/sink/SensorData.java diff --git a/samples/standalone/messaging/stream-sink/src/test/java/com/example/sink/ContractVerifierSampleStreamSinkApplicationTests.java b/samples/standalone/dsl/http-client/src/test/java/com/example/sink/ContractVerifierSampleStreamSinkApplicationTests.java similarity index 100% rename from samples/standalone/messaging/stream-sink/src/test/java/com/example/sink/ContractVerifierSampleStreamSinkApplicationTests.java rename to samples/standalone/dsl/http-client/src/test/java/com/example/sink/ContractVerifierSampleStreamSinkApplicationTests.java diff --git a/samples/standalone/messaging/stream-sink/src/test/java/com/example/sink/MessageConsumedTests.java b/samples/standalone/dsl/http-client/src/test/java/com/example/sink/MessageConsumedTests.java similarity index 100% rename from samples/standalone/messaging/stream-sink/src/test/java/com/example/sink/MessageConsumedTests.java rename to samples/standalone/dsl/http-client/src/test/java/com/example/sink/MessageConsumedTests.java diff --git a/samples/standalone/dsl/http-server/build.gradle b/samples/standalone/dsl/http-server/build.gradle index c6bc9c685b..ffbdadf3d2 100644 --- a/samples/standalone/dsl/http-server/build.gradle +++ b/samples/standalone/dsl/http-server/build.gradle @@ -11,6 +11,10 @@ buildscript { dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" + //tag::pact_dependency[] + // if additional dependencies are needed e.g. for Pact + classpath "org.springframework.cloud:spring-cloud-contract-pact:${findProperty('verifierVersion') ?: verifierVersion}" + //end::pact_dependency[] } } @@ -47,8 +51,10 @@ contracts { dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.boot:spring-boot-starter-actuator") + compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit") testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier' + testCompile "org.springframework.cloud:spring-cloud-stream-test-support" } test { diff --git a/samples/standalone/dsl/http-server/pom.xml b/samples/standalone/dsl/http-server/pom.xml index 214312a2f6..b7777485b1 100644 --- a/samples/standalone/dsl/http-server/pom.xml +++ b/samples/standalone/dsl/http-server/pom.xml @@ -41,6 +41,15 @@ spring-boot-starter-test test + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + + org.springframework.cloud + spring-cloud-stream-test-support + test + @@ -79,8 +88,16 @@ true com.example.fraud - true + + + + + org.springframework.cloud + spring-cloud-contract-pact + ${spring-cloud-contract.version} + + diff --git a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/Application.java b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/Application.java index 8aed3b447a..c06527998d 100644 --- a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/Application.java +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/Application.java @@ -17,13 +17,14 @@ package com.example.fraud; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.stream.annotation.EnableBinding; +import org.springframework.cloud.stream.messaging.Source; import org.springframework.context.annotation.Configuration; @Configuration -@EnableAutoConfiguration -@ComponentScan +@SpringBootApplication +@EnableBinding({ Source.class, MyProcessor.class }) public class Application { public static void main(String[] args) { diff --git a/samples/standalone/messaging/stream-source/src/main/java/com/example/source/FooController.java b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FooController.java similarity index 96% rename from samples/standalone/messaging/stream-source/src/main/java/com/example/source/FooController.java rename to samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FooController.java index 4789424f63..084b24e42a 100644 --- a/samples/standalone/messaging/stream-source/src/main/java/com/example/source/FooController.java +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FooController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.source; +package com.example.fraud; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudDetectionController.java b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudDetectionController.java index 7652f55cc3..288fadf264 100644 --- a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudDetectionController.java +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudDetectionController.java @@ -51,6 +51,16 @@ public class FraudDetectionController { // end::initial_impl[] } + @RequestMapping(value = "/pactfraudcheck", method = PUT) + public FraudCheckResult pactFraudCheck(@RequestBody FraudCheck fraudCheck) { + return fraudCheck(fraudCheck); + } + + @RequestMapping(value = "/yamlfraudcheck", method = PUT) + public FraudCheckResult yamlFraudCheck(@RequestBody FraudCheck fraudCheck) { + return fraudCheck(fraudCheck); + } + private boolean amountGreaterThanThreshold(FraudCheck fraudCheck) { return MAX_AMOUNT.compareTo(fraudCheck.getLoanAmount()) < 0; } diff --git a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudNameController.java b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudNameController.java index db3dae321f..16269218ad 100644 --- a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudNameController.java +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudNameController.java @@ -16,6 +16,7 @@ package com.example.fraud; +import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -56,6 +57,17 @@ class FraudNameController { return value + " " + value2; } + @PutMapping(value = "/yamlfrauds/name") + public NameResponse yamlCheckByName(@RequestBody NameRequest request) { + return checkByName(request); + } + + @GetMapping(value = "/yamlfrauds/name") + public String yamlCheckByName(@CookieValue("name") String value, + @CookieValue("name2") String value2) { + return checkByName(value, value2); + } + } class NameRequest { @@ -99,3 +111,12 @@ class NameResponse { } } + +@Component +class DefaultFraudVerifier implements FraudVerifier { + + @Override + public boolean isFraudByName(String name) { + return true; + } +} \ No newline at end of file diff --git a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudStatsController.java b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudStatsController.java index f54667c620..2d5da2a6f6 100644 --- a/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudStatsController.java +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/FraudStatsController.java @@ -16,6 +16,7 @@ package com.example.fraud; +import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -45,11 +46,31 @@ public class FraudStatsController { return new Response(this.statsProvider.count(FraudType.ALL)); } + @GetMapping(value = "/pactfrauds") + public Response countAllPactFrauds() { + return countAllFrauds(); + } + + @GetMapping(value = "/yamlfrauds") + public Response countAllYamlFrauds() { + return countAllFrauds(); + } + @GetMapping(value = "/drunks") public Response countAllDrunks() { return new Response(this.statsProvider.count(FraudType.DRUNKS)); } + @GetMapping(value = "/pactdrunks") + public Response countAllPactDrunks() { + return countAllDrunks(); + } + + @GetMapping(value = "/yamldrunks") + public Response countAllYamlDrunks() { + return countAllDrunks(); + } + } class Response { @@ -72,3 +93,12 @@ class Response { } } + +@Component +class DefaultStatsProvider implements StatsProvider { + + @Override + public int count(FraudType fraudType) { + return 0; + } +} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/FraudnameBase.kt b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MessagePoller.java similarity index 60% rename from samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/FraudnameBase.kt rename to samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MessagePoller.java index 88b949471f..41c7a9281b 100644 --- a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/FraudnameBase.kt +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MessagePoller.java @@ -16,18 +16,20 @@ package com.example.fraud; -import io.restassured.module.mockmvc.RestAssuredMockMvc; -import org.junit.Before; +import org.springframework.cloud.stream.messaging.Source; +import org.springframework.integration.support.MessageBuilder; +import org.springframework.stereotype.Component; -open class FraudnameBase { +@Component +class MessagePoller { + private final Source source; - @Before - fun setup() { - RestAssuredMockMvc.standaloneSetup(FraudNameController(object : FraudVerifier { - override fun isFraudByName(name: String): Boolean { - return "fraud" == name - } - })) + MessagePoller(Source source) { + this.source = source; } + public void poll() { + this.source.output().send(MessageBuilder + .withPayload("{\"id\":\"99\",\"temperature\":\"123.45\"}").build()); + } } diff --git a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/MultipartBase.kt b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MyProcessor.java similarity index 69% rename from samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/MultipartBase.kt rename to samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MyProcessor.java index 534be86f19..eef2f4ab91 100644 --- a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/MultipartBase.kt +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MyProcessor.java @@ -16,14 +16,15 @@ package com.example.fraud; -import io.restassured.module.mockmvc.RestAssuredMockMvc; -import org.junit.Before; +import org.springframework.cloud.stream.annotation.Output; +import org.springframework.cloud.stream.messaging.Sink; +import org.springframework.messaging.MessageChannel; -open class MultipartBase { +interface MyProcessor extends Sink { - @Before - fun setUp() { - RestAssuredMockMvc.standaloneSetup(TestController()) - } + String MY_OUTPUT = "my_output"; + + @Output("my_output") + MessageChannel output(); } diff --git a/samples/standalone/messaging/stream-source/src/main/java/com/example/source/ContractVerifierSampleStreamSourceApplication.java b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MyProcessorListener.java similarity index 63% rename from samples/standalone/messaging/stream-source/src/main/java/com/example/source/ContractVerifierSampleStreamSourceApplication.java rename to samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MyProcessorListener.java index aa42a2e78b..9d98b44e25 100644 --- a/samples/standalone/messaging/stream-source/src/main/java/com/example/source/ContractVerifierSampleStreamSourceApplication.java +++ b/samples/standalone/dsl/http-server/src/main/java/com/example/fraud/MyProcessorListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.source; +package com.example.fraud; import java.io.File; import java.io.IOException; @@ -26,45 +26,11 @@ import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.stream.annotation.EnableBinding; -import org.springframework.cloud.stream.annotation.Output; import org.springframework.cloud.stream.annotation.StreamListener; import org.springframework.cloud.stream.messaging.Sink; -import org.springframework.cloud.stream.messaging.Source; import org.springframework.integration.support.MessageBuilder; -import org.springframework.messaging.MessageChannel; import org.springframework.stereotype.Component; -interface MyProcessor extends Sink { - - String MY_OUTPUT = "my_output"; - - @Output("my_output") - MessageChannel output(); - -} - -@SpringBootApplication -@EnableBinding({ Source.class, MyProcessor.class }) -public class ContractVerifierSampleStreamSourceApplication { - - @Autowired - Source source; - - public static void main(String[] args) { - SpringApplication.run(ContractVerifierSampleStreamSourceApplication.class, args); - } - - public void poll() { - this.source.output().send(MessageBuilder - .withPayload("{\"id\":\"99\",\"temperature\":\"123.45\"}").build()); - } - -} - @Component class MyProcessorListener { @@ -78,8 +44,8 @@ class MyProcessorListener { MyProcessorListener(MyProcessor processor) { this.processor = processor; - this.expectedInput = forFile("/contracts/input.pdf"); - this.expectedOutput = forFile("/contracts/output.pdf"); + this.expectedInput = forFile("/contracts/messaging/input.pdf"); + this.expectedOutput = forFile("/contracts/messaging/output.pdf"); } private byte[] forFile(String relative) { diff --git a/samples/standalone/messaging/stream-source/src/main/resources/application.properties b/samples/standalone/dsl/http-server/src/main/resources/application.properties similarity index 100% rename from samples/standalone/messaging/stream-source/src/main/resources/application.properties rename to samples/standalone/dsl/http-server/src/main/resources/application.properties diff --git a/samples/standalone/dsl/http-server/src/main/resources/application.yml b/samples/standalone/dsl/http-server/src/main/resources/application.yml deleted file mode 100644 index 1c421cf2b7..0000000000 --- a/samples/standalone/dsl/http-server/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port=0 \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/src/test/java/com/example/source/SensorSourceTestBase.java b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/MessagingBase.java similarity index 77% rename from samples/standalone/messaging/stream-source/src/test/java/com/example/source/SensorSourceTestBase.java rename to samples/standalone/dsl/http-server/src/test/java/com/example/fraud/MessagingBase.java index d35e48c49b..ea6b004166 100644 --- a/samples/standalone/messaging/stream-source/src/test/java/com/example/source/SensorSourceTestBase.java +++ b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/MessagingBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.source; +package com.example.fraud; import io.restassured.module.mockmvc.RestAssuredMockMvc; import org.junit.Before; @@ -23,7 +23,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; /** @@ -33,13 +33,13 @@ import org.springframework.web.context.WebApplicationContext; * * @author Marius Bogoevici */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = ContractVerifierSampleStreamSourceApplication.class, properties = "spring.cloud.stream.bindings.output.destination=sensor-data") +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, properties = "spring.cloud.stream.bindings.output.destination=sensor-data") @AutoConfigureMessageVerifier -public abstract class SensorSourceTestBase { +public abstract class MessagingBase { @Autowired - ContractVerifierSampleStreamSourceApplication application; + MessagePoller poller; @Autowired WebApplicationContext context; @@ -50,7 +50,7 @@ public abstract class SensorSourceTestBase { } public void createSensorData() { - application.poll(); + poller.poll(); } } diff --git a/samples/standalone/yml/http-server/src/test/java/com/example/fraud/FraudBase.java b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/PactBase.java similarity index 97% rename from samples/standalone/yml/http-server/src/test/java/com/example/fraud/FraudBase.java rename to samples/standalone/dsl/http-server/src/test/java/com/example/fraud/PactBase.java index fe572a8d5a..9472d63402 100644 --- a/samples/standalone/yml/http-server/src/test/java/com/example/fraud/FraudBase.java +++ b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/PactBase.java @@ -19,7 +19,7 @@ package com.example.fraud; import io.restassured.module.mockmvc.RestAssuredMockMvc; import org.junit.Before; -public class FraudBase { +public class PactBase { @Before public void setup() { diff --git a/samples/standalone/pact/pact-http-server/src/test/java/com/example/fraud/FraudBase.java b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/YmlFraudBase.java similarity index 97% rename from samples/standalone/pact/pact-http-server/src/test/java/com/example/fraud/FraudBase.java rename to samples/standalone/dsl/http-server/src/test/java/com/example/fraud/YmlFraudBase.java index fe572a8d5a..49ea65d601 100644 --- a/samples/standalone/pact/pact-http-server/src/test/java/com/example/fraud/FraudBase.java +++ b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/YmlFraudBase.java @@ -19,7 +19,7 @@ package com.example.fraud; import io.restassured.module.mockmvc.RestAssuredMockMvc; import org.junit.Before; -public class FraudBase { +public class YmlFraudBase { @Before public void setup() { diff --git a/samples/standalone/yml/http-server/src/test/java/com/example/fraud/FraudnameBase.java b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/YmlFraudnameBase.java similarity index 96% rename from samples/standalone/yml/http-server/src/test/java/com/example/fraud/FraudnameBase.java rename to samples/standalone/dsl/http-server/src/test/java/com/example/fraud/YmlFraudnameBase.java index 947233c44c..046003f07b 100644 --- a/samples/standalone/yml/http-server/src/test/java/com/example/fraud/FraudnameBase.java +++ b/samples/standalone/dsl/http-server/src/test/java/com/example/fraud/YmlFraudnameBase.java @@ -19,7 +19,7 @@ package com.example.fraud; import io.restassured.module.mockmvc.RestAssuredMockMvc; import org.junit.Before; -public class FraudnameBase { +public class YmlFraudnameBase { private static final String FRAUD_NAME = "fraud"; diff --git a/samples/standalone/messaging/stream-source/src/test/resources/contracts/input.pdf b/samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/input.pdf similarity index 100% rename from samples/standalone/messaging/stream-source/src/test/resources/contracts/input.pdf rename to samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/input.pdf diff --git a/samples/standalone/messaging/stream-source/src/test/resources/contracts/output.pdf b/samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/output.pdf similarity index 100% rename from samples/standalone/messaging/stream-source/src/test/resources/contracts/output.pdf rename to samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/output.pdf diff --git a/samples/standalone/messaging/stream-source/src/test/resources/contracts/shouldProduceValidSensorData.groovy b/samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/shouldProduceValidSensorData.groovy similarity index 100% rename from samples/standalone/messaging/stream-source/src/test/resources/contracts/shouldProduceValidSensorData.groovy rename to samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/shouldProduceValidSensorData.groovy diff --git a/samples/standalone/messaging/stream-source/src/test/resources/contracts/shouldReturnOkWhenServiceIsHealthy.yml b/samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/shouldReturnOkWhenServiceIsHealthy.yml similarity index 100% rename from samples/standalone/messaging/stream-source/src/test/resources/contracts/shouldReturnOkWhenServiceIsHealthy.yml rename to samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/shouldReturnOkWhenServiceIsHealthy.yml diff --git a/samples/standalone/messaging/stream-source/src/test/resources/contracts/shouldWorkWithInputOutputBinary.groovy b/samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/shouldWorkWithInputOutputBinary.groovy similarity index 100% rename from samples/standalone/messaging/stream-source/src/test/resources/contracts/shouldWorkWithInputOutputBinary.groovy rename to samples/standalone/dsl/http-server/src/test/resources/contracts/messaging/shouldWorkWithInputOutputBinary.groovy diff --git a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.json b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldMarkClientAsFraud.json similarity index 84% rename from samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.json rename to samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldMarkClientAsFraud.json index 4539a5feba..b4073fb820 100644 --- a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.json +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldMarkClientAsFraud.json @@ -10,9 +10,9 @@ "description": "", "request": { "method": "PUT", - "path": "/fraudcheck", + "path": "/pactfraudcheck", "headers": { - "Content-Type": "application/vnd.fraud.v1+json" + "Content-Type": "application/json" }, "body": { "clientId": "1234567890", @@ -32,7 +32,7 @@ "matchers": [ { "match": "regex", - "regex": "application/vnd\\.fraud\\.v1\\+json.*" + "regex": "application/json.*" } ], "combine": "AND" @@ -54,11 +54,11 @@ "response": { "status": 200, "headers": { - "Content-Type": "application/vnd.fraud.v1+json" + "Content-Type": "application/json" }, "body": { "fraudCheckStatus": "FRAUD", - "rejectionReason": "Amount too high" + "rejection.reason": "Amount too high" }, "matchingRules": { "header": { @@ -66,7 +66,7 @@ "matchers": [ { "match": "regex", - "regex": "application/vnd\\.fraud\\.v1\\+json.*" + "regex": "application/json.*" } ], "combine": "AND" diff --git a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.json b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldMarkClientAsNotFraud.json similarity index 77% rename from samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.json rename to samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldMarkClientAsNotFraud.json index 094a024381..ab3d88211c 100644 --- a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.json +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldMarkClientAsNotFraud.json @@ -10,9 +10,9 @@ "description": "", "request": { "method": "PUT", - "path": "/fraudcheck", + "path": "/pactfraudcheck", "headers": { - "Content-Type": "application/vnd.fraud.v1+json" + "Content-Type": "application/json" }, "body": { "clientId": "1234567890", @@ -22,11 +22,11 @@ "response": { "status": 200, "headers": { - "Content-Type": "application/vnd.fraud.v1+json" + "Content-Type": "application/json" }, "body": { "fraudCheckStatus": "OK", - "rejectionReason": null + "rejection.reason": null } } } diff --git a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldReturnDrunksStats.json b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldReturnDrunksStats.json similarity index 89% rename from samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldReturnDrunksStats.json rename to samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldReturnDrunksStats.json index 76456c8563..34e1ab1b41 100644 --- a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldReturnDrunksStats.json +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldReturnDrunksStats.json @@ -15,7 +15,7 @@ "response": { "status": 200, "headers": { - "Content-Type": "application/vnd.fraud.v1+json" + "Content-Type": "application/json" }, "body": { "count": 100 diff --git a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.json b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldReturnFraudStats.json similarity index 84% rename from samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.json rename to samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldReturnFraudStats.json index 616d2da583..8fb16e519e 100644 --- a/samples/standalone/pact/pact-http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.json +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/pact/shouldReturnFraudStats.json @@ -10,12 +10,12 @@ "description": "", "request": { "method": "GET", - "path": "/frauds" + "path": "/pactfrauds" }, "response": { "status": 200, "headers": { - "Content-Type": "application/vnd.fraud.v1+json" + "Content-Type": "application/json" }, "body": { "count": 200 diff --git a/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.yml b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsFraud.yml similarity index 94% rename from samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.yml rename to samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsFraud.yml index c34a150b9a..eb0656569e 100644 --- a/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.yml +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsFraud.yml @@ -1,6 +1,6 @@ request: # (1) method: PUT # (2) - url: /fraudcheck # (3) + url: /yamlfraudcheck # (3) body: # (4) "client.id": 1234567890 loanAmount: 99999 @@ -24,7 +24,7 @@ response: # (7) # #(1) - If the consumer sends a request #(2) - With the "PUT" method -#(3) - to the URL "/fraudcheck" +#(3) - to the URL "/yamlfraudcheck" #(4) - with the JSON body that # * has a field `client.id` # * has a field `loanAmount` that is equal to `99999` @@ -40,7 +40,7 @@ response: # (7) # #(1) - A request will be sent to the producer #(2) - With the "PUT" method -#(3) - to the URL "/fraudcheck" +#(3) - to the URL "/yamlfraudcheck" #(4) - with the JSON body that # * has a field `client.id` `1234567890` # * has a field `loanAmount` that is equal to `99999` diff --git a/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.yaml b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsNotFraud.yaml similarity index 95% rename from samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.yaml rename to samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsNotFraud.yaml index 519edf03b8..550322aa86 100644 --- a/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.yaml +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldMarkClientAsNotFraud.yaml @@ -1,6 +1,6 @@ request: method: PUT - url: /fraudcheck + url: /yamlfraudcheck body: "client.id": 1234567890 loanAmount: 123.123 diff --git a/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.yml b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldReturnFraudStats.yml similarity index 93% rename from samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.yml rename to samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldReturnFraudStats.yml index f32a269226..6502368fd1 100644 --- a/samples/standalone/yml/http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.yml +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraud/shouldReturnFraudStats.yml @@ -2,7 +2,7 @@ name: "should count all frauds" request: method: GET - url: /frauds + url: /yamlfrauds response: status: 200 body: diff --git a/samples/standalone/yml/http-server/src/test/resources/contracts/fraudname/shouldReturnAFraudForTheName.yml b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraudname/shouldReturnAFraudForTheName.yml similarity index 92% rename from samples/standalone/yml/http-server/src/test/resources/contracts/fraudname/shouldReturnAFraudForTheName.yml rename to samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraudname/shouldReturnAFraudForTheName.yml index 66c3cd6f4f..5e06866b80 100644 --- a/samples/standalone/yml/http-server/src/test/resources/contracts/fraudname/shouldReturnAFraudForTheName.yml +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraudname/shouldReturnAFraudForTheName.yml @@ -2,7 +2,7 @@ priority: 1 request: method: PUT - url: /frauds/name + url: /yamlfrauds/name body: name: "fraud" headers: diff --git a/samples/standalone/yml/http-server/src/test/resources/contracts/fraudname/shouldReturnNonFraudForTheName.yml b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraudname/shouldReturnNonFraudForTheName.yml similarity index 94% rename from samples/standalone/yml/http-server/src/test/resources/contracts/fraudname/shouldReturnNonFraudForTheName.yml rename to samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraudname/shouldReturnNonFraudForTheName.yml index 5424f1f239..c0a8e14a07 100644 --- a/samples/standalone/yml/http-server/src/test/resources/contracts/fraudname/shouldReturnNonFraudForTheName.yml +++ b/samples/standalone/dsl/http-server/src/test/resources/contracts/yml/fraudname/shouldReturnNonFraudForTheName.yml @@ -1,6 +1,6 @@ request: method: PUT - url: /frauds/name + url: /yamlfrauds/name body: name: "non fraud" headers: diff --git a/samples/standalone/kotlin/http-client/.gitignore b/samples/standalone/kotlin/http-client/.gitignore deleted file mode 100644 index b05ba7bd6d..0000000000 --- a/samples/standalone/kotlin/http-client/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -target/ - -.gradle -build/ - diff --git a/samples/standalone/kotlin/http-client/.mvn/jvm.config b/samples/standalone/kotlin/http-client/.mvn/jvm.config deleted file mode 100644 index 894bef17a5..0000000000 --- a/samples/standalone/kotlin/http-client/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/.mvn/maven.config b/samples/standalone/kotlin/http-client/.mvn/maven.config deleted file mode 100644 index affad39a42..0000000000 --- a/samples/standalone/kotlin/http-client/.mvn/maven.config +++ /dev/null @@ -1 +0,0 @@ --T2 \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/kotlin/http-client/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/kotlin/http-client/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/kotlin/http-client/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/kotlin/http-client/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/kotlin/http-client/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/kotlin/http-client/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/kotlin/http-client/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/kotlin/http-client/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/README.adoc b/samples/standalone/kotlin/http-client/README.adoc deleted file mode 100644 index 8d085bf557..0000000000 --- a/samples/standalone/kotlin/http-client/README.adoc +++ /dev/null @@ -1,26 +0,0 @@ -= Http Client - -== Prerequisites - -First, you have to publish to Maven Local the stubs of the *http-server* module. - -== How to run it? - -Run - -[source=groovy] --------- -./gradlew clean build --------- - -or - --------- -./mvnw clean package --------- - -To - -- build the app -- use spring-cloud-contract-stub-runner-spring[Stub Runner Spring] to download the stub of `Http Server` -- run the tests against stubbed server \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/build.gradle.kts b/samples/standalone/kotlin/http-client/build.gradle.kts deleted file mode 100644 index 3f5b4d062e..0000000000 --- a/samples/standalone/kotlin/http-client/build.gradle.kts +++ /dev/null @@ -1,77 +0,0 @@ -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - id("org.springframework.boot") - id("io.spring.dependency-management") version "1.0.7.RELEASE" - id("maven-publish") - kotlin("jvm") version "1.3.41" - kotlin("plugin.spring") version "1.3.41" -} - -group = "com.example" -version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_1_8 - -// tag::deps_repos[] -repositories { - mavenCentral() - mavenLocal() - maven { url = uri("https://repo.spring.io/release") } - maven { url = uri("https://repo.spring.io/milestone") } - maven { url = uri("https://repo.spring.io/snapshot") } -} -// end::deps_repos[] - -// tag::dep_mgmt[] -dependencyManagement { - - val BOM_VERSION: String by project - - imports { - mavenBom("org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION") - } -} -// end::dep_mgmt[] - -// tag::deps[] -dependencies { - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - testImplementation("org.springframework.cloud:spring-cloud-starter-contract-stub-runner") - // for easier testing of multipart - testImplementation("org.springframework.cloud:spring-cloud-starter-contract-verifier") - testImplementation("org.springframework.boot:spring-boot-starter-test") { - exclude(group = "org.junit.vintage", module = "junit-vintage-engine") - exclude(group = "junit", module = "junit") - } -} -// end::deps[] - -tasks.withType { - useJUnitPlatform() - systemProperty("spring.profiles.active", "gradle") - testLogging { - exceptionFormat = TestExceptionFormat.FULL - } - afterSuite(KotlinClosure2({ desc: TestDescriptor, result: TestResult -> - if (desc.parent == null) { - if (result.testCount == 0L) { - throw IllegalStateException("No tests were found. Failing the build") - } - else { - println("Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)") - } - } else { /* Nothing to do here */ } - })) -} - -tasks.withType { - kotlinOptions { - freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = "1.8" - } -} diff --git a/samples/standalone/kotlin/http-client/gradle.properties b/samples/standalone/kotlin/http-client/gradle.properties deleted file mode 100644 index 6b3c50fd63..0000000000 --- a/samples/standalone/kotlin/http-client/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.daemon=false -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/kotlin/http-client/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/kotlin/http-client/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/kotlin/http-client/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/kotlin/http-client/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/kotlin/http-client/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/kotlin/http-client/gradlew b/samples/standalone/kotlin/http-client/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/kotlin/http-client/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/kotlin/http-client/gradlew.bat b/samples/standalone/kotlin/http-client/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/kotlin/http-client/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/kotlin/http-client/mvnw b/samples/standalone/kotlin/http-client/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/kotlin/http-client/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/kotlin/http-client/mvnw.cmd b/samples/standalone/kotlin/http-client/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/kotlin/http-client/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/kotlin/http-client/pom.xml b/samples/standalone/kotlin/http-client/pom.xml deleted file mode 100644 index b865bfadaf..0000000000 --- a/samples/standalone/kotlin/http-client/pom.xml +++ /dev/null @@ -1,295 +0,0 @@ - - - 4.0.0 - - com.example - http-client-kotlin - 0.0.1-SNAPSHOT - - Spring Cloud Contract Verifier Http Client Kotlin Sample - Spring Cloud Contract Verifier Http Client Kotlin Sample - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.M5 - - - - - UTF-8 - 1.8 - Hoxton.BUILD-SNAPSHOT - 1.3.41 - - - - - org.springframework.boot - spring-boot-starter-web - - - com.fasterxml.jackson.module - jackson-module-kotlin - - - org.jetbrains.kotlin - kotlin-reflect - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} - - - org.springframework.boot - spring-boot-starter-actuator - - - org.apache.httpcomponents - httpclient - - - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner - test - - - - - - org.springframework.cloud - spring-cloud-starter-contract-verifier - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-release.version} - pom - import - - - - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - org.springframework.boot - spring-boot-maven-plugin - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - -Xjsr305=strict - - - spring - - 1.8 - - - - org.jetbrains.kotlin - kotlin-maven-allopen - ${kotlin.version} - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - - - default-compile - none - - - - default-testCompile - none - - - java-compile - compile - - compile - - - - java-test-compile - test-compile - - testCompile - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - - diff --git a/samples/standalone/kotlin/http-client/settings.gradle.kts b/samples/standalone/kotlin/http-client/settings.gradle.kts deleted file mode 100644 index 8bf301bc86..0000000000 --- a/samples/standalone/kotlin/http-client/settings.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -pluginManagement { - repositories { - mavenCentral() - mavenLocal() - maven { url = uri("https://repo.spring.io/release") } - maven { url = uri("https://repo.spring.io/milestone") } - maven { url = uri("https://repo.spring.io/snapshot") } - gradlePluginPortal() - } - resolutionStrategy { - val bootVersion: String by settings - eachPlugin { - if (requested.id.id == "org.springframework.boot") { - useModule("org.springframework.boot:spring-boot-gradle-plugin:$bootVersion") - } - } - } -} -rootProject.name = "http-client-kotlin-gradle" diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/Application.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/Application.kt deleted file mode 100644 index 96ca0a92a3..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/Application.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication - -@SpringBootApplication -open class Application - -fun main(args: Array) { - runApplication(*args) -} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/LoanApplicationService.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/LoanApplicationService.kt deleted file mode 100644 index 1cb694bb33..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/LoanApplicationService.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan - -import com.example.loan.model.FraudCheckStatus -import com.example.loan.model.FraudServiceRequest -import com.example.loan.model.FraudServiceResponse -import com.example.loan.model.LoanApplication -import com.example.loan.model.LoanApplicationResult -import com.example.loan.model.LoanApplicationStatus -import com.example.loan.model.Response -import org.springframework.beans.factory.annotation.Autowired - -import org.springframework.boot.web.client.RestTemplateBuilder -import org.springframework.http.HttpEntity -import org.springframework.http.HttpHeaders -import org.springframework.http.HttpMethod -import org.springframework.http.MediaType -import org.springframework.stereotype.Service -import org.springframework.web.client.RestTemplate - -@Service -class LoanApplicationService { - - private var port = 6565 - private val restTemplate: RestTemplate - - @Autowired - constructor(builder: RestTemplateBuilder) : this(builder.build()) - - constructor(restTemplate: RestTemplate) { - this.restTemplate = restTemplate - } - - fun loanApplication(loanApplication: LoanApplication): LoanApplicationResult? { - val request = FraudServiceRequest(loanApplication) - val response = sendRequestToFraudDetectionService(request) - return buildResponseFromFraudResult(response) - } - - private fun sendRequestToFraudDetectionService(request: FraudServiceRequest): FraudServiceResponse? { - val httpHeaders = HttpHeaders() - httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - - // tag::client_call_server[] - val response = restTemplate.exchange("http://localhost:$port/fraudcheck", - HttpMethod.PUT, HttpEntity(request, httpHeaders), FraudServiceResponse::class.java) - // end::client_call_server[] - - return response.body - } - - private fun buildResponseFromFraudResult(response: FraudServiceResponse?): LoanApplicationResult? { - return response?.let { - val applicationStatus = when(response.fraudCheckStatus) { - FraudCheckStatus.OK -> LoanApplicationStatus.LOAN_APPLIED - FraudCheckStatus.FRAUD -> LoanApplicationStatus.LOAN_APPLICATION_REJECTED - } - LoanApplicationResult(applicationStatus, response.rejectionReason) - } - } - - fun countAllFrauds(): Int? { - val httpHeaders = HttpHeaders() - httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - val response = restTemplate.exchange("http://localhost:$port/frauds", - HttpMethod.GET, HttpEntity(httpHeaders), Response::class.java) - return response.body?.count - } - - fun countDrunks(): Int? { - val httpHeaders = HttpHeaders() - httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - val response = restTemplate.exchange("http://localhost:$port/drunks", - HttpMethod.GET, HttpEntity(httpHeaders), Response::class.java) - return response.body?.count - } - - fun getCookies(): String? { - val httpHeaders = HttpHeaders() - httpHeaders.add("Cookie", "name=foo") - httpHeaders.add("Cookie", "name2=bar") - val response = restTemplate.exchange("http://localhost:$port/frauds/name", - HttpMethod.GET, HttpEntity(httpHeaders), String::class.java) - return response.body - } - - fun setPort(port: Int) { - this.port = port - } - -} diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/Client.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/Client.kt deleted file mode 100644 index 57ec827e94..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/Client.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -data class Client(val pesel: String) \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudCheckStatus.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudCheckStatus.kt deleted file mode 100644 index a07f2323a5..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudCheckStatus.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -enum class FraudCheckStatus { - OK, - FRAUD, - ; -} diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudServiceRequest.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudServiceRequest.kt deleted file mode 100644 index 4641306c9e..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudServiceRequest.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -import com.fasterxml.jackson.annotation.JsonProperty - -data class FraudServiceRequest(@JsonProperty("client.id") val clientId: String, val loanAmount: Double) { - - constructor(loanApplication: LoanApplication): this(loanApplication.client.pesel, loanApplication.amount) - -} diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudServiceResponse.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudServiceResponse.kt deleted file mode 100644 index fb6b4f320d..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/FraudServiceResponse.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -import com.fasterxml.jackson.annotation.JsonProperty - -data class FraudServiceResponse(val fraudCheckStatus: FraudCheckStatus, - @JsonProperty("rejection.reason") val rejectionReason: String?) \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplication.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplication.kt deleted file mode 100644 index 11146a9c8f..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplication.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -data class LoanApplication(val client: Client, val amount: Double) { - - var loanApplicationId: String? = null - -} diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplicationResult.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplicationResult.kt deleted file mode 100644 index 1a77332cfe..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplicationResult.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -data class LoanApplicationResult(val loanApplicationStatus: LoanApplicationStatus, - val rejectionReason: String?) \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplicationStatus.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplicationStatus.kt deleted file mode 100644 index 0e8655e982..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/LoanApplicationStatus.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -enum class LoanApplicationStatus { - LOAN_APPLIED, - LOAN_APPLICATION_REJECTED, - ; -} diff --git a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/Response.kt b/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/Response.kt deleted file mode 100644 index eda9b096ef..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/kotlin/com/example/loan/model/Response.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model - -data class Response(val count: Int) \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/src/main/resources/application.yml b/samples/standalone/kotlin/http-client/src/main/resources/application.yml deleted file mode 100644 index 4b7fe13158..0000000000 --- a/samples/standalone/kotlin/http-client/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port: 8090 \ No newline at end of file diff --git a/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/GoodbyeWorldTests.kt b/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/GoodbyeWorldTests.kt deleted file mode 100644 index f6941bcb1e..0000000000 --- a/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/GoodbyeWorldTests.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerPort -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties -import org.springframework.test.context.junit.jupiter.SpringExtension -import org.springframework.web.client.RestTemplate -import org.springframework.web.client.getForObject - -// tag::autoconfigure_stubrunner[] -@ExtendWith(SpringExtension::class) -@SpringBootTest(webEnvironment = WebEnvironment.NONE) -@AutoConfigureStubRunner(ids = ["com.example:http-server-kotlin"], - repositoryRoot = "stubs://classpath:contractsAtRuntime/", - stubsMode = StubRunnerProperties.StubsMode.LOCAL, - generateStubs = true) -class GoodbyeWorldTests { -// end::autoconfigure_stubrunner[] - - @StubRunnerPort("http-server-kotlin") - var port: Int? = null - - @Test - fun shouldGenerateStubsAtRuntime() { - // when: - val response: String = RestTemplate().getForObject("http://localhost:" + this.port + "/goodbye", String::class) - // then: - assertThat(response).isEqualTo("Goodbye World!") - } - -} diff --git a/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/LoanApplicationServiceContextPathTests.kt b/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/LoanApplicationServiceContextPathTests.kt deleted file mode 100644 index 78c34c13b4..0000000000 --- a/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/LoanApplicationServiceContextPathTests.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan - -import com.example.loan.model.Client -import com.example.loan.model.LoanApplication -import com.example.loan.model.LoanApplicationStatus -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties -import org.springframework.test.context.junit.jupiter.SpringExtension - -@ExtendWith(SpringExtension::class) -@SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = ["server.context-path=/app"]) -@AutoConfigureStubRunner(ids = ["com.example:http-server-kotlin:+:stubs:6565"], - stubsMode = StubRunnerProperties.StubsMode.LOCAL) -class LoanApplicationServiceContextPathTests { - - @Autowired - lateinit var service: LoanApplicationService - - @Test - fun shouldSuccessfullyApplyForLoan() { - // given: - val application = LoanApplication(Client("1234567890"), 123.123) - // when: - val loanApplication = service.loanApplication(application) - // then: - assertThat(loanApplication?.loanApplicationStatus) - .isEqualTo(LoanApplicationStatus.LOAN_APPLIED) - assertThat(loanApplication?.rejectionReason).isNull() - } - - @Test - fun shouldBeRejectedDueToAbnormalLoanAmount() { - // given: - val application = LoanApplication(Client("1234567890"), 99999.0) - // when: - val loanApplication = service.loanApplication(application) - // then: - assertThat(loanApplication?.loanApplicationStatus) - .isEqualTo(LoanApplicationStatus.LOAN_APPLICATION_REJECTED) - assertThat(loanApplication?.rejectionReason).isEqualTo("Amount too high") - } - -} diff --git a/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/LoanApplicationServiceTests.kt b/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/LoanApplicationServiceTests.kt deleted file mode 100644 index f6d6147334..0000000000 --- a/samples/standalone/kotlin/http-client/src/test/kotlin/com/example/loan/LoanApplicationServiceTests.kt +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan - -import java.io.File -import java.net.URI -import java.nio.file.Files - -import com.example.loan.model.Client -import com.example.loan.model.LoanApplication -import com.example.loan.model.LoanApplicationStatus -import com.fasterxml.jackson.annotation.JsonProperty -import com.jayway.jsonpath.JsonPath -import com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson -import io.restassured.RestAssured -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties -import org.springframework.http.RequestEntity -import org.springframework.http.ResponseEntity -import org.springframework.test.context.junit.jupiter.SpringExtension -import org.springframework.web.client.RestTemplate - -// tag::autoconfigure_stubrunner[] -@ExtendWith(SpringExtension::class) -@SpringBootTest(webEnvironment = WebEnvironment.NONE) -@AutoConfigureStubRunner(ids = ["com.example:http-server-kotlin:+:stubs:6565"], - stubsMode = StubRunnerProperties.StubsMode.LOCAL) -class LoanApplicationServiceTests { -// end::autoconfigure_stubrunner[] - - @Autowired - lateinit var service: LoanApplicationService - - @Test - fun shouldSuccessfullyApplyForLoan() { - // given: - val application = LoanApplication(Client("1234567890"), 123.123) - // when: - val loanApplication = service.loanApplication(application) - // then: - assertThat(loanApplication?.loanApplicationStatus).isEqualTo(LoanApplicationStatus.LOAN_APPLIED) - assertThat(loanApplication?.rejectionReason).isNull() - } - - // tag::client_tdd[] - @Test - fun shouldBeRejectedDueToAbnormalLoanAmount() { - // given: - val application = LoanApplication(Client("1234567890"), 99999.0) - // when: - val loanApplication = service.loanApplication(application) - // then: - assertThat(loanApplication?.loanApplicationStatus) - .isEqualTo(LoanApplicationStatus.LOAN_APPLICATION_REJECTED) - assertThat(loanApplication?.rejectionReason).isEqualTo("Amount too high") - } - // end::client_tdd[] - - @Test - fun shouldSuccessfullyGetAllFrauds() { - // when: - val count = service.countAllFrauds() - // then: - assertThat(count).isGreaterThanOrEqualTo(200) - } - - @Test - fun shouldSuccessfullyGetAllDrunks() { - // when: - val count = service.countDrunks() - // then: - assertThat(count).isEqualTo(100) - } - - @Test - @Suppress("UsePropertyAccessSyntax") - fun shouldSuccessfullyGetCookies() { - // when: - val cookies = service.getCookies() - // then: - assertThat(cookies).isEqualTo("foo bar") - } - - @Test - fun shouldSuccessfullyWorkWithMultipart() { - // given: - val request = RestAssured.given() - .baseUri("http://localhost:6565/") - .header("Content-Type", "multipart/form-data") - .multiPart("file1", "filename1", "content1".toByteArray()) - .multiPart("file2", "filename1", "content2".toByteArray()) - .multiPart("test", "filename1", "{\n \"status\": \"test\"\n}".toByteArray(), - "application/json") - - // when: - val response = RestAssured.given().spec(request).post("/tests") - - // then: - assertThat(response.statusCode).isEqualTo(200) - assertThat(response.header("Content-Type")).matches("application/json.*") - // and: - val parsedJson = JsonPath.parse(response.body.asString()) - assertThatJson(parsedJson).field("['status']").isEqualTo("ok") - } - - @Test - fun shouldSuccessfullyWorkWithBinary() { - // given: - val request = File(javaClass.getResource("/binary/request.pdf").file) - val response = File(javaClass.getResource("/binary/response.pdf").file) - - - // when: - val exchange: ResponseEntity = RestTemplate().exchange( - RequestEntity.put(URI.create("http://localhost:6565/1")) - .header("Content-Type", "application/octet-stream") - .body(Files.readAllBytes(request.toPath())), - ByteArray::class.java) - - // then: - assertThat(exchange.statusCodeValue).isEqualTo(200) - assertThat(exchange.headers["Content-Type"]?.get(0)) - .isEqualTo("application/octet-stream") - // and: - assertThat(exchange.body).isEqualTo(Files.readAllBytes(response.toPath())) - } - - @Test - fun shouldSuccessfullyReturnRequestDataInResponse() { - // when: - val exchange: ResponseEntity = RestTemplate().exchange( - RequestEntity.put(URI.create("http://localhost:6565/frauds/name")) - .header("Content-Type", "application/json") - .body(FraudCheckRequest("Tim")), - FraudCheckResponse::class.java) - // then: - assertThat(exchange.statusCodeValue).isEqualTo(200) - assertThat(exchange.headers["Content-Type"]?.get(0)) - .isEqualTo("application/json") - // and: - assertThat(exchange.body?.message).isEqualTo("Don't worry Tim you're not a fraud") - } - -} - -data class FraudCheckRequest(@JsonProperty("name") val name: String) -data class FraudCheckResponse(@JsonProperty("result") val message: String) diff --git a/samples/standalone/kotlin/http-client/src/test/resources/application-gradle.yaml b/samples/standalone/kotlin/http-client/src/test/resources/application-gradle.yaml deleted file mode 100644 index 16c52af94d..0000000000 --- a/samples/standalone/kotlin/http-client/src/test/resources/application-gradle.yaml +++ /dev/null @@ -1,3 +0,0 @@ -stubrunner: - stubs-mode: local - stubs.ids: 'com.example:http-server-kotlin-gradle:+:stubs:6569' diff --git a/samples/standalone/kotlin/http-client/src/test/resources/application.yaml b/samples/standalone/kotlin/http-client/src/test/resources/application.yaml deleted file mode 100644 index 1f9fed43b3..0000000000 --- a/samples/standalone/kotlin/http-client/src/test/resources/application.yaml +++ /dev/null @@ -1,2 +0,0 @@ -server: - port: 6569 diff --git a/samples/standalone/kotlin/http-client/src/test/resources/binary/request.pdf b/samples/standalone/kotlin/http-client/src/test/resources/binary/request.pdf deleted file mode 100644 index 69503635d8..0000000000 Binary files a/samples/standalone/kotlin/http-client/src/test/resources/binary/request.pdf and /dev/null differ diff --git a/samples/standalone/kotlin/http-client/src/test/resources/binary/response.pdf b/samples/standalone/kotlin/http-client/src/test/resources/binary/response.pdf deleted file mode 100644 index c3b233056b..0000000000 Binary files a/samples/standalone/kotlin/http-client/src/test/resources/binary/response.pdf and /dev/null differ diff --git a/samples/standalone/kotlin/http-client/src/test/resources/contractsAtRuntime/goodbyeWorld.kts b/samples/standalone/kotlin/http-client/src/test/resources/contractsAtRuntime/goodbyeWorld.kts deleted file mode 100644 index e7b56e99d0..0000000000 --- a/samples/standalone/kotlin/http-client/src/test/resources/contractsAtRuntime/goodbyeWorld.kts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2013-2019 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. - */ - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpMethods -import org.springframework.cloud.contract.spec.internal.HttpStatus - -contract { - request { - url = url("/goodbye") - method = GET - } - response { - status = OK - body = body("Goodbye World!") - } -} diff --git a/samples/standalone/kotlin/http-server/.gitignore b/samples/standalone/kotlin/http-server/.gitignore deleted file mode 100644 index b05ba7bd6d..0000000000 --- a/samples/standalone/kotlin/http-server/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -target/ - -.gradle -build/ - diff --git a/samples/standalone/kotlin/http-server/README.adoc b/samples/standalone/kotlin/http-server/README.adoc deleted file mode 100644 index 2fd3fbc40d..0000000000 --- a/samples/standalone/kotlin/http-server/README.adoc +++ /dev/null @@ -1,20 +0,0 @@ -= Http Server - -Run - -[source=groovy] --------- -./gradlew clean build publishToMavenLocal --------- - -or - --------- -./mvnw clean install --------- - -To - -- build the app -- generate and run Spring Cloud Contract Verifier tests -- publish the fatJar and the stubs to Maven Local \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/build.gradle.kts b/samples/standalone/kotlin/http-server/build.gradle.kts deleted file mode 100644 index fa2f4ccca6..0000000000 --- a/samples/standalone/kotlin/http-server/build.gradle.kts +++ /dev/null @@ -1,94 +0,0 @@ -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - id("org.springframework.boot") - id("io.spring.dependency-management") version "1.0.7.RELEASE" - id("spring-cloud-contract") - id("maven-publish") - kotlin("jvm") version "1.3.41" - kotlin("plugin.spring") version "1.3.41" -} - -group = "com.example" -version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_1_8 - -// tag::deps_repos[] -repositories { - mavenCentral() - mavenLocal() - maven { url = uri("https://repo.spring.io/release") } - maven { url = uri("https://repo.spring.io/milestone") } - maven { url = uri("https://repo.spring.io/snapshot") } -} -// end::deps_repos[] - -// tag::dep_mgmt[] -dependencyManagement { - - val BOM_VERSION: String by project - - imports { - mavenBom("org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION") - } -} -// end::dep_mgmt[] - -// tag::deps[] -dependencies { - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - implementation("org.jetbrains.kotlin:kotlin-reflect") - testImplementation("org.springframework.cloud:spring-cloud-contract-gradle-plugin") - testImplementation("org.springframework.cloud:spring-cloud-starter-contract-verifier") - testImplementation("io.rest-assured:rest-assured") - testImplementation("io.rest-assured:spring-mock-mvc") - testImplementation("io.rest-assured:spring-web-test-client") { - exclude(group = "org.springframework", module = "spring-context") - exclude(group = "org.springframework", module = "spring-webflux") - } - testImplementation("org.springframework.boot:spring-boot-starter-test") { - exclude(group = "org.junit.vintage", module = "junit-vintage-engine") - exclude(group = "junit", module = "junit") - } -} -// end::deps[] - -// tag::contract_dsl[] -contracts { - packageWithBaseClasses.set("com.example.fraud") -} -// end::contract_dsl[] - -tasks.withType { - doFirst { - delete("~/.m2/repository/com/example/http-server-kotlin-gradle") - } -} - -tasks.withType { - useJUnitPlatform() - systemProperty("spring.profiles.active", "gradle") - testLogging { - exceptionFormat = TestExceptionFormat.FULL - } - afterSuite(KotlinClosure2({ desc: TestDescriptor, result: TestResult -> - if (desc.parent == null) { - if (result.testCount == 0L) { - throw IllegalStateException("No tests were found. Failing the build") - } - else { - println("Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)") - } - } else { /* Nothing to do here */ } - })) -} - -tasks.withType { - kotlinOptions { - freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = "1.8" - } -} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/gradle.properties b/samples/standalone/kotlin/http-server/gradle.properties deleted file mode 100644 index 4e2909074c..0000000000 --- a/samples/standalone/kotlin/http-server/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.daemon=false -verifierVersion=2.2.0.BUILD-SNAPSHOT -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/kotlin/http-server/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/kotlin/http-server/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/kotlin/http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/kotlin/http-server/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/kotlin/http-server/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/kotlin/http-server/gradlew b/samples/standalone/kotlin/http-server/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/kotlin/http-server/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/kotlin/http-server/gradlew.bat b/samples/standalone/kotlin/http-server/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/kotlin/http-server/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/kotlin/http-server/mvnw b/samples/standalone/kotlin/http-server/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/kotlin/http-server/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/kotlin/http-server/mvnw.cmd b/samples/standalone/kotlin/http-server/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/kotlin/http-server/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/kotlin/http-server/pom.xml b/samples/standalone/kotlin/http-server/pom.xml deleted file mode 100644 index 1a42bc5ace..0000000000 --- a/samples/standalone/kotlin/http-server/pom.xml +++ /dev/null @@ -1,362 +0,0 @@ - - - 4.0.0 - - com.example - http-server-kotlin - 0.0.1-SNAPSHOT - - Spring Cloud Contract Verifier Http Server Kotlin Sample - Spring Cloud Contract Verifier Http Server Kotlin Sample - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.M5 - - - - - UTF-8 - 1.8 - 2.2.0.BUILD-SNAPSHOT - Hoxton.BUILD-SNAPSHOT - 3.2.0 - 1.3.41 - - - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-reflect - ${kotlin.version} - - - org.springframework.boot - spring-boot-starter-web - - - com.fasterxml.jackson.module - jackson-module-kotlin - - - - - org.springframework.cloud - spring-cloud-starter-contract-verifier - test - - - - io.rest-assured - spring-mock-mvc - ${rest-assured.version} - test - - - spring-web - org.springframework - - - spring-webmvc - org.springframework - - - spring-test - org.springframework - - - - - io.rest-assured - spring-web-test-client - ${rest-assured.version} - test - - - spring-context - org.springframework - - - spring-webflux - org.springframework - - - - - io.rest-assured - rest-assured - ${rest-assured.version} - test - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-release.version} - pom - import - - - - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - org.springframework.boot - spring-boot-maven-plugin - - - org.jetbrains.kotlin - kotlin-maven-plugin - ${kotlin.version} - - - -Xjsr305=strict - - 1.8 - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - - - default-compile - none - - - - default-testCompile - none - - - java-compile - compile - - compile - - - - java-test-compile - test-compile - - testCompile - - - - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - ${spring-cloud-contract.version} - true - - com.example.fraud - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - - - [${spring-cloud-contract.version},) - - - convert - generateTests - - - - - - - - - - - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - diff --git a/samples/standalone/kotlin/http-server/settings.gradle.kts b/samples/standalone/kotlin/http-server/settings.gradle.kts deleted file mode 100644 index 34bf28a9e3..0000000000 --- a/samples/standalone/kotlin/http-server/settings.gradle.kts +++ /dev/null @@ -1,23 +0,0 @@ -pluginManagement { - repositories { - mavenCentral() - mavenLocal() - maven { url = uri("https://repo.spring.io/release") } - maven { url = uri("https://repo.spring.io/milestone") } - maven { url = uri("https://repo.spring.io/snapshot") } - gradlePluginPortal() - } - resolutionStrategy { - val bootVersion: String by settings - val verifierVersion: String by settings - eachPlugin { - if (requested.id.id == "org.springframework.boot") { - useModule("org.springframework.boot:spring-boot-gradle-plugin:$bootVersion") - } - if (requested.id.id == "spring-cloud-contract") { - useModule("org.springframework.cloud:spring-cloud-contract-gradle-plugin:$verifierVersion") - } - } - } -} -rootProject.name = "http-server-kotlin-gradle" diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/Application.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/Application.kt deleted file mode 100644 index 8a57bf9c51..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/Application.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication - -@SpringBootApplication -open class Application - -fun main(args: Array) { - runApplication(*args) -} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudDetectionController.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudDetectionController.kt deleted file mode 100644 index c5a04af197..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudDetectionController.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import com.example.fraud.model.FraudCheck -import com.example.fraud.model.FraudCheckResult -import com.example.fraud.model.FraudCheckStatus -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RestController -import java.math.BigDecimal - -@RestController -class FraudDetectionController { - - private val maxAmount = BigDecimal("5000") - - // tag::server_api[] - @PutMapping("/fraudcheck") - fun fraudCheck(@RequestBody fraudCheck: FraudCheck): FraudCheckResult { - // end::server_api[] - // tag::new_impl[] - if (amountGreaterThanThreshold(fraudCheck)) { - return FraudCheckResult(FraudCheckStatus.FRAUD, "Amount too high") - } - // end::new_impl[] - // tag::initial_impl[] - return FraudCheckResult(FraudCheckStatus.OK) - // end::initial_impl[] - } - - fun amountGreaterThanThreshold(fraudCheck: FraudCheck): Boolean { - return maxAmount < fraudCheck.loanAmount; - } - -} diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudNameController.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudNameController.kt deleted file mode 100644 index cda4b5808e..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudNameController.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.web.bind.annotation.CookieValue -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -interface FraudVerifier { - fun isFraudByName(name: String): Boolean -} - -data class NameRequest(val name: String) - -data class NameResponse(val result: String) - -@RestController -class FraudNameController constructor(val fraudVerifier: FraudVerifier) { - - @PutMapping("/frauds/name") - fun checkByName(@RequestBody request: NameRequest): NameResponse { - val fraud = this.fraudVerifier.isFraudByName(request.name); - if (fraud) { - return NameResponse("Sorry " + request.name + " but you're a fraud"); - } - return NameResponse("Don't worry " + request.name + " you're not a fraud"); - } - - @GetMapping("/frauds/name") - fun checkByName(@CookieValue("name") value: String, - @CookieValue("name2") value2: String): String { - return "$value $value2" - } - -} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudStatsController.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudStatsController.kt deleted file mode 100644 index 51d8c31795..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/FraudStatsController.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -enum class FraudType { - DRUNKS, ALL; -} - -interface StatsProvider { - fun count(fraudType: FraudType): Int -} - -data class Response(val count: Int) - -@RestController -class FraudStatsController constructor(val statsProvider: StatsProvider) { - - @GetMapping("/frauds") - fun countAllFrauds(): Response { - return Response(this.statsProvider.count(FraudType.ALL)); - } - - @GetMapping("/drunks") - fun countAllDrunks(): Response { - return Response(this.statsProvider.count(FraudType.DRUNKS)); - } - -} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/TestController.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/TestController.kt deleted file mode 100644 index c2c409b862..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/TestController.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.http.MediaType -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RestController -import org.springframework.web.multipart.MultipartFile -import java.io.File -import java.net.URL -import java.nio.file.Files -import java.util.* - -fun URL.toByte(): ByteArray { - return Files.readAllBytes(File(toURI()).toPath()) -} - -data class Test(val status: String) - -@RestController -class TestController { - - private val request: ByteArray = javaClass.getResource("/contracts/binary/request.pdf").toByte() - private val response: ByteArray = javaClass.getResource("/contracts/binary/response.pdf").toByte() - - @PostMapping("/tests") - fun createNew(@RequestPart file1: MultipartFile, - @RequestPart file2: MultipartFile, - @RequestPart test: Test): Test { - return Test("ok"); - } - - @PutMapping("/1", consumes = [MediaType.APPLICATION_OCTET_STREAM_VALUE], produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE]) - fun response(@RequestBody requestBody: ByteArray): ByteArray { - if (!Arrays.equals(this.request, requestBody)) { - throw IllegalStateException("Invalid request body"); - } - return response; - } - -} \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheck.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheck.kt deleted file mode 100644 index b16e078162..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheck.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonProperty; - -data class FraudCheck constructor(@JsonProperty("client.id") val clientId: String, val loanAmount: BigDecimal) diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheckResult.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheckResult.kt deleted file mode 100644 index df0bdf0e2b..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheckResult.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -data class FraudCheckResult constructor(val fraudCheckStatus: FraudCheckStatus, @JsonProperty("rejection.reason") var rejectionReason: String? = null) \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheckStatus.kt b/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheckStatus.kt deleted file mode 100644 index 08f342a604..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/kotlin/com/example/fraud/model/FraudCheckStatus.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -enum class FraudCheckStatus { - OK, FRAUD; -} diff --git a/samples/standalone/kotlin/http-server/src/main/resources/application.yml b/samples/standalone/kotlin/http-server/src/main/resources/application.yml deleted file mode 100644 index 1c421cf2b7..0000000000 --- a/samples/standalone/kotlin/http-server/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port=0 \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/BinaryBase.kt b/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/BinaryBase.kt deleted file mode 100644 index 4a49ea7462..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/BinaryBase.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import io.restassured.module.mockmvc.RestAssuredMockMvc; -import org.junit.Before; - -open class BinaryBase { - - @Before - fun setUp() { - RestAssuredMockMvc.standaloneSetup(TestController()); - } - -} diff --git a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/FraudBase.kt b/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/FraudBase.kt deleted file mode 100644 index eebe7967e5..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/kotlin/com/example/fraud/FraudBase.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import io.restassured.module.mockmvc.RestAssuredMockMvc; -import org.junit.Before; - -open class FraudBase { - - @Before - fun setup() { - RestAssuredMockMvc.standaloneSetup(FraudDetectionController(), - FraudStatsController(stubbedStatsProvider())) - } - - private fun stubbedStatsProvider(): StatsProvider { - return object : StatsProvider { - override fun count(fraudType: FraudType): Int { - return when (fraudType) { - FraudType.DRUNKS -> 100 - FraudType.ALL -> 200 - else -> 0 - } - } - } - } - - fun assertThatRejectionReasonIsNull(rejectionReason: Any?) { - assert(rejectionReason == null) - } - -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/request.pdf b/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/request.pdf deleted file mode 100644 index 69503635d8..0000000000 Binary files a/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/request.pdf and /dev/null differ diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/response.pdf b/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/response.pdf deleted file mode 100644 index c3b233056b..0000000000 Binary files a/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/response.pdf and /dev/null differ diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/shouldWorkWithBinaryPayload.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/shouldWorkWithBinaryPayload.kts deleted file mode 100644 index 0ca206b333..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/binary/shouldWorkWithBinaryPayload.kts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2013-2019 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 binary - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpMethods - -contract { - request { - url = url("/1") - method = PUT - headers { - contentType = APPLICATION_OCTET_STREAM - } - body = bodyFromFileAsBytes("request.pdf") - } - response { - status = OK - body = bodyFromFileAsBytes("response.pdf") - headers { - contentType = APPLICATION_OCTET_STREAM - } - } -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.kts deleted file mode 100644 index 8d6ef23d23..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.kts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2013-2019 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 fraud - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpStatus - -contract { - request { // (1) - method = PUT // (2) - url = url("/fraudcheck") // (3) - body = body(// (4) - "client.id" to value(regex("[0-9]{10}")), - "loanAmount" to 99999) - headers { // (5) - contentType = "application/json" - } - } - response { // (6) - status = OK // (7) - body = body( // (8) - "fraudCheckStatus" to "FRAUD", - "rejection.reason" to "Amount too high") - headers { // (9) - contentType = "application/json" - } - } -} - -/* -From the Consumer perspective, when shooting a request in the integration test: - -(1) - If the consumer sends a request -(2) - With the "PUT" method -(3) - to the URL "/fraudcheck" -(4) - with the JSON body that - * has a field `client.id` that matches a regular expression `[0-9]{10}` - * has a field `loanAmount` that is equal to `99999` -(5) - with header `Content-Type` equal to `application/json` -(6) - then the response will be sent with -(7) - status equal `200` -(8) - and JSON body equal to - { "fraudCheckStatus": "FRAUD", "rejectionReason": "Amount too high" } -(9) - with header `Content-Type` equal to `application/json` - -From the Producer perspective, in the autogenerated producer-side test: - -(1) - A request will be sent to the producer -(2) - With the "PUT" method -(3) - to the URL "/fraudcheck" -(4) - with the JSON body that - * has a field `client.id` that will have a generated value that matches a regular expression `[0-9]{10}` - * has a field `loanAmount` that is equal to `99999` -(5) - with header `Content-Type` equal to `application/json` -(6) - then the test will assert if the response has been sent with -(7) - status equal `200` -(8) - and JSON body equal to - { "fraudCheckStatus": "FRAUD", "rejectionReason": "Amount too high" } -(9) - with header `Content-Type` matching `application/json.*` - */ diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.kts deleted file mode 100644 index 081e7d89fc..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsNotFraud.kts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2013-2019 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 fraud - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpStatus - -// tag::contract[] -contract { - request { - method = PUT - url = url("/fraudcheck") - body = body( - "client.id" to value(consumer(regex("[0-9]{10}")), producer("1234567890")), - "loanAmount" to 123.123) - headers { - contentType = "application/json" - } - } - response { - status = OK - body = body( - "fraudCheckStatus" to "OK", - "rejection.reason" to value(consumer(null), producer(execute("assertThatRejectionReasonIsNull(\$it)"))) - ) - headers { - contentType = "application/json" - } - } -} -// end::contract[] diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.kts deleted file mode 100644 index 44e675f808..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraud/shouldReturnFraudStats.kts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2013-2019 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 fraud - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpMethods -import org.springframework.cloud.contract.spec.internal.HttpStatus - -listOf( - contract { - name = "should count all frauds" - request { - method = GET - url = url("/frauds") - } - response { - status = OK - body = body( - "count" to value(regex("[2-9][0-9][0-9]")) - ) - headers { - contentType = "application/json" - } - } - }, - contract { - request { - method = GET - url = url("/drunks") - } - response { - status = OK - body = body( - "count" to 100 - ) - headers { - contentType = "application/json" - } - } - } -) \ No newline at end of file diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnACookie.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnACookie.kts deleted file mode 100644 index 98f6d253db..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnACookie.kts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2013-2019 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 fraudname - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpMethods - -contract { - request { - method = GET - url = url("/frauds/name") - cookies { - cookie("name", "foo") - cookie("name2", "bar") - } - } - response { - status = OK - body = body("foo bar") - } -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnAFraudForTheName.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnAFraudForTheName.kts deleted file mode 100644 index b486db8848..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnAFraudForTheName.kts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2013-2019 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 fraudname - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract - -contract { - // highest priority - priority = 1 - request { - method = PUT - url = url("/frauds/name") - body = body("name" to "fraud") - headers { - contentType = "application/json" - } - } - response { - status = OK - body = body("result" to "Sorry ${fromRequest().body("$.name")} but you're a fraud") - headers { - contentType = fromRequest().header(CONTENT_TYPE) - } - } -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnNonFraudForTheName.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnNonFraudForTheName.kts deleted file mode 100644 index 0939a92183..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/fraudname/shouldReturnNonFraudForTheName.kts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013-2019 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 fraudname - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract - -contract { - request { - method = PUT - url = url("/frauds/name") - body = body("name" to value(anyAlphaUnicode)) - headers { - contentType = "application/json" - } - } - response { - status = OK - body = body("result" to "Don't worry ${fromRequest().body("$.name")} you're not a fraud") - headers { - contentType = fromRequest().header(CONTENT_TYPE) - } - } -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/shouldWorkForMultipartAsBytesWithContentType.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/shouldWorkForMultipartAsBytesWithContentType.kts deleted file mode 100644 index d4275cb8ca..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/shouldWorkForMultipartAsBytesWithContentType.kts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013-2019 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 multipart - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpMethods - -contract { - request { - method = POST - url = url("/tests") - multipart { - field("file1", named( - value(consumer(regex(nonEmpty)), producer("filename1")), - value(consumer(regex(nonEmpty)), producer("content1")))) - field("file2", named( - value(consumer(regex(nonEmpty)), producer("filename2")), - value(consumer(regex(nonEmpty)), producer("content2")))) - field("test", named( - value(consumer(regex(nonEmpty)), producer("filename3")), - value(consumer(regex(nonEmpty)), producer(fileAsBytes("test.json"))), - value("application/json"))) - } - headers { - contentType = "multipart/form-data" - } - } - response { - status = OK - body = body("status" to "ok") - headers { - contentType = "application/json" - } - } -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/shouldWorkForMultipartWithContentType.kts b/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/shouldWorkForMultipartWithContentType.kts deleted file mode 100644 index 053106d150..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/shouldWorkForMultipartWithContentType.kts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013-2019 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 multipart - -import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract -import org.springframework.cloud.contract.spec.internal.HttpMethods - -contract { - request { - method = POST - url = url("/tests") - multipart { - field("file1", named( - value(consumer(regex(nonEmpty)), producer("filename1")), - value(consumer(regex(nonEmpty)), producer("content1")))) - field("file2", named( - value(consumer(regex(nonEmpty)), producer("filename2")), - value(consumer(regex(nonEmpty)), producer("content2")))) - field("test", named( - value(consumer(regex(nonEmpty)), producer("filename3")), - value(consumer(regex(nonEmpty)), producer(file("test.json"))), - value("application/json"))) - } - headers { - contentType = "multipart/form-data" - } - } - response { - status = OK - body = body("status" to "ok") - headers { - contentType = "application/json" - } - } -} diff --git a/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/test.json b/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/test.json deleted file mode 100644 index 984c08fbdf..0000000000 --- a/samples/standalone/kotlin/http-server/src/test/resources/contracts/multipart/test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "status": "test" -} diff --git a/samples/standalone/kotlin/pom.xml b/samples/standalone/kotlin/pom.xml deleted file mode 100644 index 5303170231..0000000000 --- a/samples/standalone/kotlin/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - - org.springframework.cloud - spring-cloud-contract-samples-standalone - 2.2.0.BUILD-SNAPSHOT - .. - - - spring-cloud-contract-samples-kotlin - pom - - Spring Cloud Contract Standalone Dsl Test Samples - Spring Cloud Contract Standalone Test Samples used for end to end tests - - - - 2.2.0.BUILD-SNAPSHOT - - - - http-server - http-client - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - - - diff --git a/samples/standalone/messaging/pom.xml b/samples/standalone/messaging/pom.xml deleted file mode 100644 index d3ab24ee0f..0000000000 --- a/samples/standalone/messaging/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - - org.springframework.cloud - spring-cloud-contract-samples-standalone - 2.2.0.BUILD-SNAPSHOT - .. - - - spring-cloud-contract-samples-messaging - pom - - Spring Cloud Contract Standalone Dsl Test Samples With Messaging - Spring Cloud Contract Standalone Test Samples used for end to end tests - - - - 2.2.0.BUILD-SNAPSHOT - - - - stream-source - stream-sink - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - - - diff --git a/samples/standalone/messaging/stream-sink/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/messaging/stream-sink/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/messaging/stream-sink/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/messaging/stream-sink/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/messaging/stream-sink/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/messaging/stream-sink/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/messaging/stream-sink/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/messaging/stream-sink/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/messaging/stream-sink/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/README.adoc b/samples/standalone/messaging/stream-sink/README.adoc deleted file mode 100644 index 99ab003a42..0000000000 --- a/samples/standalone/messaging/stream-sink/README.adoc +++ /dev/null @@ -1,26 +0,0 @@ -= Stream Sink - -== Prerequisites - -First you have to publish to Maven Local the stubs of the *contract-verifier-sample-stream-source* stubs - -== How to run it? - -Run - -[source=groovy] --------- -./gradlew clean build --------- - -or - --------- -./mvnw clean package --------- - -To - -- build the app -- use spring-cloud-contract-stub-runner-stream[Stub Runner Spring] to download the stub of `contract-verifier-sample-stream-source` -- run the tests against stubbed producer \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/build.gradle b/samples/standalone/messaging/stream-sink/build.gradle deleted file mode 100644 index 862b9c36c6..0000000000 --- a/samples/standalone/messaging/stream-sink/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" - } -} - -group = 'com.example' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } -} - -apply plugin: 'groovy' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' -apply plugin: 'maven-publish' - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" - mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${project.findProperty('verifierVersion') ?: verifierVersion}" - } -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.springframework.boot:spring-boot-starter-actuator") - compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit") - - testCompile "org.springframework.cloud:spring-cloud-starter-contract-stub-runner" - testCompile "org.springframework.cloud:spring-cloud-stream-test-support" -} - -test { - systemProperty 'spring.profiles.active', 'gradle' - testLogging { - exceptionFormat = 'full' - } - afterSuite { desc, result -> - if (!desc.parent) { - println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - if (result.testCount == 0) { - throw new IllegalStateException("No tests were found. Failing the build") - } - } - } -} - -task resolveDependencies { - doLast { - project.rootProject.allprojects.each { subProject -> - subProject.buildscript.configurations.each { configuration -> - configuration.resolve() - } - subProject.configurations.each { configuration -> - configuration.resolve() - } - } - } -} \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/gradle.properties b/samples/standalone/messaging/stream-sink/gradle.properties deleted file mode 100644 index 4e2909074c..0000000000 --- a/samples/standalone/messaging/stream-sink/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.daemon=false -verifierVersion=2.2.0.BUILD-SNAPSHOT -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/messaging/stream-sink/gradlew b/samples/standalone/messaging/stream-sink/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/messaging/stream-sink/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/messaging/stream-sink/gradlew.bat b/samples/standalone/messaging/stream-sink/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/messaging/stream-sink/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/messaging/stream-sink/mvnw b/samples/standalone/messaging/stream-sink/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/messaging/stream-sink/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/messaging/stream-sink/mvnw.cmd b/samples/standalone/messaging/stream-sink/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/messaging/stream-sink/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/messaging/stream-sink/pom.xml b/samples/standalone/messaging/stream-sink/pom.xml deleted file mode 100644 index 7ef541b9b4..0000000000 --- a/samples/standalone/messaging/stream-sink/pom.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - 4.0.0 - - com.example - stream-sink - 0.0.1-SNAPSHOT - jar - - Stream Sink Sample - Spring Cloud Contract Verifier Stream Sink Sample - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT - - - - - UTF-8 - 1.8 - 2.2.0.BUILD-SNAPSHOT - - - - - - org.springframework.cloud - spring-cloud-starter-stream-rabbit - - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner - test - - - org.springframework.cloud - spring-cloud-stream-test-support - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Hoxton.BUILD-SNAPSHOT - pom - import - - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - diff --git a/samples/standalone/messaging/stream-sink/settings.gradle b/samples/standalone/messaging/stream-sink/settings.gradle deleted file mode 100644 index 6cac6f4dc1..0000000000 --- a/samples/standalone/messaging/stream-sink/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'stream-sink-gradle' diff --git a/samples/standalone/messaging/stream-sink/src/test/resources/application-gradle.yml b/samples/standalone/messaging/stream-sink/src/test/resources/application-gradle.yml deleted file mode 100644 index e6dd107c89..0000000000 --- a/samples/standalone/messaging/stream-sink/src/test/resources/application-gradle.yml +++ /dev/null @@ -1,3 +0,0 @@ -stubrunner: - work-offline: true - stubs.ids: 'com.example:stream-source-gradle' \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/src/test/resources/application.yml b/samples/standalone/messaging/stream-sink/src/test/resources/application.yml deleted file mode 100644 index 8082d660f8..0000000000 --- a/samples/standalone/messaging/stream-sink/src/test/resources/application.yml +++ /dev/null @@ -1,4 +0,0 @@ -stubrunner: - work-offline: true - ids: 'com.example:stream-source' -server.port: 0 \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/messaging/stream-source/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/messaging/stream-source/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/messaging/stream-source/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/messaging/stream-source/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/messaging/stream-source/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/messaging/stream-source/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/messaging/stream-source/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/messaging/stream-source/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/README.adoc b/samples/standalone/messaging/stream-source/README.adoc deleted file mode 100644 index 4b6b6a49d8..0000000000 --- a/samples/standalone/messaging/stream-source/README.adoc +++ /dev/null @@ -1,20 +0,0 @@ -= Stream Source - -Run - -[source=groovy] --------- -./gradlew clean build publishToMavenLocal --------- - -or - --------- -./mvnw clean install --------- - -To - -- build the app -- generate and run Spring Cloud Contract Verifier tests -- publish the fatJar and the stubs to Maven Local \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/build.gradle b/samples/standalone/messaging/stream-source/build.gradle deleted file mode 100644 index f92bb7ecc4..0000000000 --- a/samples/standalone/messaging/stream-source/build.gradle +++ /dev/null @@ -1,113 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" - classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" -// Example of using Rest Assured 3.x. If you don't add this section Rest Assured 2.9.0 will be used -// classpath "com.jayway.restassured:rest-assured:2.9.0" -// classpath "com.jayway.restassured:spring-mock-mvc:2.9.0" - } -} - -group = 'com.example' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } -} - -apply plugin: 'groovy' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' -apply plugin: 'spring-cloud-contract' -apply plugin: 'maven-publish' - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" - } -} - -ext { - stubsOutputDirRoot = file("${project.buildDir}/stubs/") -} - -contracts { - baseClassMappings { - baseClassMapping('.*', 'com.example.source.SensorSourceTestBase') - } - stubsOutputDir = stubsOutputDirRoot -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.springframework.boot:spring-boot-starter-actuator") - compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit") - - testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier' - testCompile "org.springframework.cloud:spring-cloud-stream-test-support" - // Example of using Rest Assured 3.x. If you don't add this section Rest Assured 2.9.0 will be used - // testCompile "com.jayway.restassured:rest-assured:2.9.0" - // testCompile "com.jayway.restassured:spring-mock-mvc:2.9.0" -} - -task stubsJar(type: Jar, dependsOn: "generateClientStubs") { - baseName = "${project.name}" - classifier = "stubs" - from stubsOutputDirRoot -} - -artifacts { - archives stubsJar -} - -publishing { - publications { - stubs(MavenPublication) { - artifactId "${project.name}" - artifact stubsJar - } - } -} - -test { - systemProperty 'spring.profiles.active', 'gradle' - testLogging { - exceptionFormat = 'full' - } - afterSuite { desc, result -> - if (!desc.parent) { - println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - if (result.testCount == 0) { - throw new IllegalStateException("No tests were found. Failing the build") - } - } - } -} - -clean.doFirst { - delete "~/.m2/repository/com/example/stream-source-gradle" -} - -task resolveDependencies { - doLast { - project.rootProject.allprojects.each { subProject -> - subProject.buildscript.configurations.each { configuration -> - configuration.resolve() - } - subProject.configurations.each { configuration -> - configuration.resolve() - } - } - } -} \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/gradle.properties b/samples/standalone/messaging/stream-source/gradle.properties deleted file mode 100644 index 4e2909074c..0000000000 --- a/samples/standalone/messaging/stream-source/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.daemon=false -verifierVersion=2.2.0.BUILD-SNAPSHOT -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/messaging/stream-source/gradlew b/samples/standalone/messaging/stream-source/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/messaging/stream-source/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/messaging/stream-source/gradlew.bat b/samples/standalone/messaging/stream-source/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/messaging/stream-source/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/messaging/stream-source/mvnw b/samples/standalone/messaging/stream-source/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/messaging/stream-source/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/messaging/stream-source/mvnw.cmd b/samples/standalone/messaging/stream-source/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/messaging/stream-source/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/messaging/stream-source/pom.xml b/samples/standalone/messaging/stream-source/pom.xml deleted file mode 100644 index 42eade8927..0000000000 --- a/samples/standalone/messaging/stream-source/pom.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - 4.0.0 - - com.example - stream-source - 0.0.1-SNAPSHOT - jar - - Stream Source Sample - Spring Cloud Contract Verifier Stream Source Sample - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT - - - - - UTF-8 - 1.8 - 2.2.0.BUILD-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.cloud - spring-cloud-starter-stream-rabbit - - - org.springframework.cloud - spring-cloud-stream-test-support - test - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-starter-contract-verifier - test - - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Hoxton.BUILD-SNAPSHOT - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - ${spring-cloud-contract.version} - true - - - - .* - com.example.source.SensorSourceTestBase - - - - - - - - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - maven-surefire-plugin - - true - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - - - [${spring-cloud-contract.version},) - - - convert - generateTests - - - - - - - - - - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - diff --git a/samples/standalone/messaging/stream-source/settings.gradle b/samples/standalone/messaging/stream-source/settings.gradle deleted file mode 100644 index a1970d8283..0000000000 --- a/samples/standalone/messaging/stream-source/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'stream-source-gradle' diff --git a/samples/standalone/messaging/stream-source/src/test/java/com/example/source/ContractVerifierSampleStreamSourceApplicationTests.java b/samples/standalone/messaging/stream-source/src/test/java/com/example/source/ContractVerifierSampleStreamSourceApplicationTests.java deleted file mode 100644 index 49537bd6c4..0000000000 --- a/samples/standalone/messaging/stream-source/src/test/java/com/example/source/ContractVerifierSampleStreamSourceApplicationTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.source; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest -public class ContractVerifierSampleStreamSourceApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/samples/standalone/pact/pact-http-client/.gitignore b/samples/standalone/pact/pact-http-client/.gitignore deleted file mode 100644 index b05ba7bd6d..0000000000 --- a/samples/standalone/pact/pact-http-client/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -target/ - -.gradle -build/ - diff --git a/samples/standalone/pact/pact-http-client/.mvn/jvm.config b/samples/standalone/pact/pact-http-client/.mvn/jvm.config deleted file mode 100644 index 894bef17a5..0000000000 --- a/samples/standalone/pact/pact-http-client/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/.mvn/maven.config b/samples/standalone/pact/pact-http-client/.mvn/maven.config deleted file mode 100644 index affad39a42..0000000000 --- a/samples/standalone/pact/pact-http-client/.mvn/maven.config +++ /dev/null @@ -1 +0,0 @@ --T2 \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/pact/pact-http-client/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/pact/pact-http-client/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/pact/pact-http-client/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/pact/pact-http-client/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/pact/pact-http-client/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/pact/pact-http-client/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/pact/pact-http-client/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/pact/pact-http-client/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/README.adoc b/samples/standalone/pact/pact-http-client/README.adoc deleted file mode 100644 index 021bcdcdb5..0000000000 --- a/samples/standalone/pact/pact-http-client/README.adoc +++ /dev/null @@ -1,26 +0,0 @@ -= Pact Http Client - -== Prerequisites - -First you have to publish to Maven Local the stubs of the *pact-http-server* module - -== How to run it? - -Run - -[source=groovy] --------- -./gradlew clean build --------- - -or - --------- -./mvnw clean package --------- - -To - -- build the app -- use spring-cloud-contract-stub-runner-spring[Stub Runner Spring] to download the stub of `Pact Http Server` -- run the tests against stubbed server \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/build.gradle b/samples/standalone/pact/pact-http-client/build.gradle deleted file mode 100644 index 4e308872f1..0000000000 --- a/samples/standalone/pact/pact-http-client/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" - } -} - -group = 'com.example' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } -} - -apply plugin: 'groovy' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' -apply plugin: 'maven-publish' - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" - } -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.springframework.boot:spring-boot-starter-actuator") - - testCompile "org.springframework.cloud:spring-cloud-starter-contract-stub-runner" - //tag::pact_dependency[] - testCompile "org.springframework.cloud:spring-cloud-contract-pact" - //end::pact_dependency[] -} - -test { - systemProperty 'spring.profiles.active', 'gradle' - testLogging { - exceptionFormat = 'full' - } - afterSuite { desc, result -> - if (!desc.parent) { - println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - if (result.testCount == 0) { - throw new IllegalStateException("No tests were found. Failing the build") - } - } - } -} - -task resolveDependencies { - doLast { - project.rootProject.allprojects.each { subProject -> - subProject.buildscript.configurations.each { configuration -> - configuration.resolve() - } - subProject.configurations.each { configuration -> - configuration.resolve() - } - } - } -} diff --git a/samples/standalone/pact/pact-http-client/gradle.properties b/samples/standalone/pact/pact-http-client/gradle.properties deleted file mode 100644 index 6b3c50fd63..0000000000 --- a/samples/standalone/pact/pact-http-client/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.daemon=false -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/pact/pact-http-client/gradlew b/samples/standalone/pact/pact-http-client/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/pact/pact-http-client/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/pact/pact-http-client/gradlew.bat b/samples/standalone/pact/pact-http-client/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/pact/pact-http-client/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/pact/pact-http-client/mvnw b/samples/standalone/pact/pact-http-client/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/pact/pact-http-client/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/pact/pact-http-client/mvnw.cmd b/samples/standalone/pact/pact-http-client/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/pact/pact-http-client/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/pact/pact-http-client/pom.xml b/samples/standalone/pact/pact-http-client/pom.xml deleted file mode 100644 index 82eef8509e..0000000000 --- a/samples/standalone/pact/pact-http-client/pom.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - 4.0.0 - - com.example - pact-http-client - 0.0.1-SNAPSHOT - - Spring Cloud Contract Verifier Http Client Sample with Pact - Spring Cloud Contract Verifier Http Client Sample with Pact - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT - - - - - UTF-8 - 1.8 - Hoxton.BUILD-SNAPSHOT - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.apache.httpcomponents - httpclient - - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner - test - - - - - org.springframework.cloud - spring-cloud-contract-pact - test - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-release-train.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - - diff --git a/samples/standalone/pact/pact-http-client/settings.gradle b/samples/standalone/pact/pact-http-client/settings.gradle deleted file mode 100644 index d351972414..0000000000 --- a/samples/standalone/pact/pact-http-client/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'pact-http-client-gradle' diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/Application.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/Application.java deleted file mode 100644 index 8c680cb15e..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/Application.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/LoanApplicationService.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/LoanApplicationService.java deleted file mode 100644 index d751ba8cc2..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/LoanApplicationService.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import com.example.loan.model.FraudCheckStatus; -import com.example.loan.model.FraudServiceRequest; -import com.example.loan.model.FraudServiceResponse; -import com.example.loan.model.LoanApplication; -import com.example.loan.model.LoanApplicationResult; -import com.example.loan.model.LoanApplicationStatus; -import com.example.loan.model.Response; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.client.RestTemplateBuilder; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class LoanApplicationService { - - private static final String FRAUD_SERVICE_JSON_VERSION_1 = "application/vnd.fraud.v1+json"; - - private final RestTemplate restTemplate; - - private int port = 6565; - - @Autowired - public LoanApplicationService(RestTemplateBuilder builder) { - this.restTemplate = builder.build(); - } - - public LoanApplicationResult loanApplication(LoanApplication loanApplication) { - FraudServiceRequest request = new FraudServiceRequest(loanApplication); - - FraudServiceResponse response = sendRequestToFraudDetectionService(request); - - return buildResponseFromFraudResult(response); - } - - private FraudServiceResponse sendRequestToFraudDetectionService( - FraudServiceRequest request) { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1); - - // tag::client_call_server[] - ResponseEntity response = restTemplate.exchange( - "http://localhost:" + port + "/fraudcheck", HttpMethod.PUT, - new HttpEntity<>(request, httpHeaders), FraudServiceResponse.class); - // end::client_call_server[] - - return response.getBody(); - } - - private LoanApplicationResult buildResponseFromFraudResult( - FraudServiceResponse response) { - LoanApplicationStatus applicationStatus = null; - if (FraudCheckStatus.OK == response.getFraudCheckStatus()) { - applicationStatus = LoanApplicationStatus.LOAN_APPLIED; - } - else if (FraudCheckStatus.FRAUD == response.getFraudCheckStatus()) { - applicationStatus = LoanApplicationStatus.LOAN_APPLICATION_REJECTED; - } - - return new LoanApplicationResult(applicationStatus, - response.getRejectionReason()); - } - - public int countAllFrauds() { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1); - ResponseEntity response = restTemplate.exchange( - "http://localhost:" + port + "/frauds", HttpMethod.GET, - new HttpEntity<>(httpHeaders), Response.class); - return response.getBody().getCount(); - } - - public int countDrunks() { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1); - ResponseEntity response = restTemplate.exchange( - "http://localhost:" + port + "/drunks", HttpMethod.GET, - new HttpEntity<>(httpHeaders), Response.class); - return response.getBody().getCount(); - } - - public void setPort(int port) { - this.port = port; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/Client.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/Client.java deleted file mode 100644 index 1378347adf..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/Client.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class Client { - - private String pesel; - - public Client() { - } - - public Client(String pesel) { - this.pesel = pesel; - } - - public String getPesel() { - return pesel; - } - - public void setPesel(String pesel) { - this.pesel = pesel; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudCheckStatus.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudCheckStatus.java deleted file mode 100644 index 541dabb3e5..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudCheckStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public enum FraudCheckStatus { - - OK, FRAUD - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudServiceRequest.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudServiceRequest.java deleted file mode 100644 index 715051e584..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudServiceRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -import java.math.BigDecimal; - -public class FraudServiceRequest { - - private String clientId; - - private BigDecimal loanAmount; - - public FraudServiceRequest() { - } - - public FraudServiceRequest(LoanApplication loanApplication) { - this.clientId = loanApplication.getClient().getPesel(); - this.loanAmount = loanApplication.getAmount(); - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public BigDecimal getLoanAmount() { - return loanAmount; - } - - public void setLoanAmount(BigDecimal loanAmount) { - this.loanAmount = loanAmount; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudServiceResponse.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudServiceResponse.java deleted file mode 100644 index 175f9a7bee..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/FraudServiceResponse.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class FraudServiceResponse { - - private FraudCheckStatus fraudCheckStatus; - - private String rejectionReason; - - public FraudServiceResponse() { - } - - public FraudCheckStatus getFraudCheckStatus() { - return fraudCheckStatus; - } - - public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) { - this.fraudCheckStatus = fraudCheckStatus; - } - - public String getRejectionReason() { - return rejectionReason; - } - - public void setRejectionReason(String rejectionReason) { - this.rejectionReason = rejectionReason; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplication.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplication.java deleted file mode 100644 index 546cbb7f27..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplication.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -import java.math.BigDecimal; - -public class LoanApplication { - - private Client client; - - private BigDecimal amount; - - private String loanApplicationId; - - public LoanApplication() { - } - - public LoanApplication(Client client, double amount) { - this.client = client; - this.amount = BigDecimal.valueOf(amount); - } - - public Client getClient() { - return client; - } - - public void setClient(Client client) { - this.client = client; - } - - public BigDecimal getAmount() { - return amount; - } - - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - public String getLoanApplicationId() { - return loanApplicationId; - } - - public void setLoanApplicationId(String loanApplicationId) { - this.loanApplicationId = loanApplicationId; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplicationResult.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplicationResult.java deleted file mode 100644 index b128078bda..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplicationResult.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class LoanApplicationResult { - - private LoanApplicationStatus loanApplicationStatus; - - private String rejectionReason; - - public LoanApplicationResult() { - } - - public LoanApplicationResult(LoanApplicationStatus loanApplicationStatus, - String rejectionReason) { - this.loanApplicationStatus = loanApplicationStatus; - this.rejectionReason = rejectionReason; - } - - public LoanApplicationStatus getLoanApplicationStatus() { - return loanApplicationStatus; - } - - public void setLoanApplicationStatus(LoanApplicationStatus loanApplicationStatus) { - this.loanApplicationStatus = loanApplicationStatus; - } - - public String getRejectionReason() { - return rejectionReason; - } - - public void setRejectionReason(String rejectionReason) { - this.rejectionReason = rejectionReason; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplicationStatus.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplicationStatus.java deleted file mode 100644 index f400dd9c5f..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/LoanApplicationStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public enum LoanApplicationStatus { - - LOAN_APPLIED, LOAN_APPLICATION_REJECTED - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/Response.java b/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/Response.java deleted file mode 100644 index 89dbdd8524..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/java/com/example/loan/model/Response.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class Response { - - private int count; - - public Response(int count) { - this.count = count; - } - - public Response() { - } - - public int getCount() { - return this.count; - } - - public void setCount(int count) { - this.count = count; - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/main/resources/application.yml b/samples/standalone/pact/pact-http-client/src/main/resources/application.yml deleted file mode 100644 index 4b7fe13158..0000000000 --- a/samples/standalone/pact/pact-http-client/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port: 8090 \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/src/test/java/com/example/loan/LoanApplicationServiceTests.java b/samples/standalone/pact/pact-http-client/src/test/java/com/example/loan/LoanApplicationServiceTests.java deleted file mode 100644 index f55e58969a..0000000000 --- a/samples/standalone/pact/pact-http-client/src/test/java/com/example/loan/LoanApplicationServiceTests.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import com.example.loan.model.Client; -import com.example.loan.model.LoanApplication; -import com.example.loan.model.LoanApplicationResult; -import com.example.loan.model.LoanApplicationStatus; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties; -import org.springframework.core.env.Environment; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.NONE) -@AutoConfigureStubRunner(ids = { - "com.example:pact-http-server:+:stubs" }, stubsMode = StubRunnerProperties.StubsMode.LOCAL) -public class LoanApplicationServiceTests { - - @Autowired - private LoanApplicationService service; - - @Autowired - private Environment environment; - - @Before - public void setup() { - this.service.setPort(this.environment.getProperty( - "stubrunner.runningstubs.pact-http-server.port", Integer.class)); - } - - @Test - public void shouldSuccessfullyApplyForLoan() { - // given: - LoanApplication application = new LoanApplication(new Client("1234567890"), - 123.123); - // when: - LoanApplicationResult loanApplication = service.loanApplication(application); - // then: - assertThat(loanApplication.getLoanApplicationStatus()) - .isEqualTo(LoanApplicationStatus.LOAN_APPLIED); - assertThat(loanApplication.getRejectionReason()).isNull(); - } - - @Test - public void shouldBeRejectedDueToAbnormalLoanAmount() { - // given: - LoanApplication application = new LoanApplication(new Client("1234567890"), - 99999); - // when: - LoanApplicationResult loanApplication = service.loanApplication(application); - // then: - assertThat(loanApplication.getLoanApplicationStatus()) - .isEqualTo(LoanApplicationStatus.LOAN_APPLICATION_REJECTED); - assertThat(loanApplication.getRejectionReason()).isEqualTo("Amount too high"); - } - - @Test - public void shouldSuccessfullyGetAllFrauds() { - // when: - int count = service.countAllFrauds(); - // then: - assertThat(count).isEqualTo(200); - } - - @Test - public void shouldSuccessfullyGetAllDrunks() { - // when: - int count = service.countDrunks(); - // then: - assertThat(count).isEqualTo(100); - } - -} diff --git a/samples/standalone/pact/pact-http-client/src/test/resources/application-gradle.yaml b/samples/standalone/pact/pact-http-client/src/test/resources/application-gradle.yaml deleted file mode 100644 index 81833e733d..0000000000 --- a/samples/standalone/pact/pact-http-client/src/test/resources/application-gradle.yaml +++ /dev/null @@ -1,3 +0,0 @@ -stubrunner: - work-offline: true - stubs.ids: 'com.example:pact-http-server-gradle:+:stubs' diff --git a/samples/standalone/pact/pact-http-client/src/test/resources/application.yaml b/samples/standalone/pact/pact-http-client/src/test/resources/application.yaml deleted file mode 100644 index b4e8858671..0000000000 --- a/samples/standalone/pact/pact-http-client/src/test/resources/application.yaml +++ /dev/null @@ -1,2 +0,0 @@ -server: - port: 0 diff --git a/samples/standalone/pact/pact-http-server/.gitignore b/samples/standalone/pact/pact-http-server/.gitignore deleted file mode 100644 index b05ba7bd6d..0000000000 --- a/samples/standalone/pact/pact-http-server/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -target/ - -.gradle -build/ - diff --git a/samples/standalone/pact/pact-http-server/.mvn/jvm.config b/samples/standalone/pact/pact-http-server/.mvn/jvm.config deleted file mode 100644 index 894bef17a5..0000000000 --- a/samples/standalone/pact/pact-http-server/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-server/.mvn/maven.config b/samples/standalone/pact/pact-http-server/.mvn/maven.config deleted file mode 100644 index 7681bc67b9..0000000000 --- a/samples/standalone/pact/pact-http-server/.mvn/maven.config +++ /dev/null @@ -1 +0,0 @@ --T2 diff --git a/samples/standalone/pact/pact-http-server/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/pact/pact-http-server/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/pact/pact-http-server/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/pact/pact-http-server/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/pact/pact-http-server/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/pact/pact-http-server/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/pact/pact-http-server/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/pact/pact-http-server/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/pact/pact-http-server/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-server/README.adoc b/samples/standalone/pact/pact-http-server/README.adoc deleted file mode 100644 index 336b774815..0000000000 --- a/samples/standalone/pact/pact-http-server/README.adoc +++ /dev/null @@ -1,20 +0,0 @@ -= Pact Http Server - -Run - -[source=groovy] --------- -./gradlew clean build publishToMavenLocal --------- - -or - --------- -./mvnw clean install --------- - -To - -- build the app -- generate and run Spring Cloud Contract Verifier tests -- publish the fatJar and the stubs to Maven Local \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-server/build.gradle b/samples/standalone/pact/pact-http-server/build.gradle deleted file mode 100644 index caf21cf721..0000000000 --- a/samples/standalone/pact/pact-http-server/build.gradle +++ /dev/null @@ -1,82 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" - classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" - //tag::pact_dependency[] - classpath "org.springframework.cloud:spring-cloud-contract-pact:${findProperty('verifierVersion') ?: verifierVersion}" - //end::pact_dependency[] - } -} - -group = 'com.example' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } -} - -apply plugin: 'groovy' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' -apply plugin: 'spring-cloud-contract' -apply plugin: 'maven-publish' - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" - } -} - -contracts { - packageWithBaseClasses = 'com.example.fraud' -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.springframework.boot:spring-boot-starter-actuator") - - testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier' -} - -test { - systemProperty 'spring.profiles.active', 'gradle' - testLogging { - exceptionFormat = 'full' - } - afterSuite { desc, result -> - if (!desc.parent) { - println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - if (result.testCount == 0) { - throw new IllegalStateException("No tests were found. Failing the build") - } - } - } -} - -clean.doFirst { - delete "~/.m2/repository/com/example/http-server-pact-gradle" -} - -task resolveDependencies { - doLast { - project.rootProject.allprojects.each { subProject -> - subProject.buildscript.configurations.each { configuration -> - configuration.resolve() - } - subProject.configurations.each { configuration -> - configuration.resolve() - } - } - } -} diff --git a/samples/standalone/pact/pact-http-server/gradle.properties b/samples/standalone/pact/pact-http-server/gradle.properties deleted file mode 100644 index 4e2909074c..0000000000 --- a/samples/standalone/pact/pact-http-server/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.daemon=false -verifierVersion=2.2.0.BUILD-SNAPSHOT -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/pact/pact-http-server/gradlew b/samples/standalone/pact/pact-http-server/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/pact/pact-http-server/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/pact/pact-http-server/gradlew.bat b/samples/standalone/pact/pact-http-server/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/pact/pact-http-server/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/pact/pact-http-server/mvnw b/samples/standalone/pact/pact-http-server/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/pact/pact-http-server/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/pact/pact-http-server/mvnw.cmd b/samples/standalone/pact/pact-http-server/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/pact/pact-http-server/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/pact/pact-http-server/pom.xml b/samples/standalone/pact/pact-http-server/pom.xml deleted file mode 100644 index d8e5e94361..0000000000 --- a/samples/standalone/pact/pact-http-server/pom.xml +++ /dev/null @@ -1,272 +0,0 @@ - - - 4.0.0 - - com.example - pact-http-server - 0.0.1-SNAPSHOT - - Spring Cloud Contract Verifier Http Server Sample with Pact - Spring Cloud Contract Verifier Http Server Sample with Pact - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT - - - - - UTF-8 - 1.8 - 2.2.0.BUILD-SNAPSHOT - Hoxton.BUILD-SNAPSHOT - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.springframework.cloud - spring-cloud-starter-contract-verifier - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-release.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - ${spring-cloud-contract.version} - true - - com.example.fraud - - - - org.springframework.cloud - spring-cloud-contract-pact - ${spring-cloud-contract.version} - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - - - [${spring-cloud-contract.version},) - - - convert - generateTests - - - - - - - - - - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - diff --git a/samples/standalone/pact/pact-http-server/settings.gradle b/samples/standalone/pact/pact-http-server/settings.gradle deleted file mode 100644 index 9c202c3e04..0000000000 --- a/samples/standalone/pact/pact-http-server/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'pact-http-server-gradle' diff --git a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/Application.java b/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/Application.java deleted file mode 100644 index 8aed3b447a..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/Application.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@EnableAutoConfiguration -@ComponentScan -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/FraudDetectionController.java b/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/FraudDetectionController.java deleted file mode 100644 index eead83c103..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/FraudDetectionController.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import java.math.BigDecimal; - -import com.example.fraud.model.FraudCheck; -import com.example.fraud.model.FraudCheckResult; -import com.example.fraud.model.FraudCheckStatus; - -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import static org.springframework.web.bind.annotation.RequestMethod.PUT; - -@RestController -public class FraudDetectionController { - - private static final String FRAUD_SERVICE_JSON_VERSION_1 = "application/vnd.fraud.v1+json"; - - private static final String NO_REASON = null; - - private static final String AMOUNT_TOO_HIGH = "Amount too high"; - - private static final BigDecimal MAX_AMOUNT = new BigDecimal("5000"); - - @RequestMapping(value = "/fraudcheck", method = PUT, consumes = FRAUD_SERVICE_JSON_VERSION_1, produces = FRAUD_SERVICE_JSON_VERSION_1) - public FraudCheckResult fraudCheck(@RequestBody FraudCheck fraudCheck) { - if (amountGreaterThanThreshold(fraudCheck)) { - return new FraudCheckResult(FraudCheckStatus.FRAUD, AMOUNT_TOO_HIGH); - } - return new FraudCheckResult(FraudCheckStatus.OK, NO_REASON); - } - - private boolean amountGreaterThanThreshold(FraudCheck fraudCheck) { - return MAX_AMOUNT.compareTo(fraudCheck.getLoanAmount()) < 0; - } - -} diff --git a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/FraudStatsController.java b/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/FraudStatsController.java deleted file mode 100644 index 251a1bd8b8..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/FraudStatsController.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -enum FraudType { - - DRUNKS, ALL - -} - -interface StatsProvider { - - int count(FraudType fraudType); - -} - -@RestController -public class FraudStatsController { - - private static final String FRAUD_SERVICE_JSON_VERSION_1 = "application/vnd.fraud.v1+json"; - - private final StatsProvider statsProvider; - - public FraudStatsController(StatsProvider statsProvider) { - this.statsProvider = statsProvider; - } - - @GetMapping(value = "/frauds", produces = FRAUD_SERVICE_JSON_VERSION_1) - public Response countAllFrauds() { - return new Response(this.statsProvider.count(FraudType.ALL)); - } - - @GetMapping(value = "/drunks", produces = FRAUD_SERVICE_JSON_VERSION_1) - public Response countAllDrunks() { - return new Response(this.statsProvider.count(FraudType.DRUNKS)); - } - -} - -class Response { - - private int count; - - public Response(int count) { - this.count = count; - } - - public Response() { - } - - public int getCount() { - return this.count; - } - - public void setCount(int count) { - this.count = count; - } - -} diff --git a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheck.java b/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheck.java deleted file mode 100644 index 58063b98bd..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheck.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -import java.math.BigDecimal; - -public class FraudCheck { - - private String clientId; - - private BigDecimal loanAmount; - - public FraudCheck() { - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public BigDecimal getLoanAmount() { - return loanAmount; - } - - public void setLoanAmount(BigDecimal loanAmount) { - this.loanAmount = loanAmount; - } - -} diff --git a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheckResult.java b/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheckResult.java deleted file mode 100644 index 0027c6155f..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheckResult.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -public class FraudCheckResult { - - private FraudCheckStatus fraudCheckStatus; - - private String rejectionReason; - - public FraudCheckResult() { - } - - public FraudCheckResult(FraudCheckStatus fraudCheckStatus, String rejectionReason) { - this.fraudCheckStatus = fraudCheckStatus; - this.rejectionReason = rejectionReason; - } - - public FraudCheckStatus getFraudCheckStatus() { - return fraudCheckStatus; - } - - public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) { - this.fraudCheckStatus = fraudCheckStatus; - } - - public String getRejectionReason() { - return rejectionReason; - } - - public void setRejectionReason(String rejectionReason) { - this.rejectionReason = rejectionReason; - } - -} diff --git a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheckStatus.java b/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheckStatus.java deleted file mode 100644 index cf4b371f35..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/java/com/example/fraud/model/FraudCheckStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -public enum FraudCheckStatus { - - OK, FRAUD - -} diff --git a/samples/standalone/pact/pact-http-server/src/main/resources/application.yml b/samples/standalone/pact/pact-http-server/src/main/resources/application.yml deleted file mode 100644 index 24466e50d4..0000000000 --- a/samples/standalone/pact/pact-http-server/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port: 0 \ No newline at end of file diff --git a/samples/standalone/pact/pom.xml b/samples/standalone/pact/pom.xml deleted file mode 100644 index f5f8cbe87b..0000000000 --- a/samples/standalone/pact/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - - org.springframework.cloud - spring-cloud-contract-samples-standalone - 2.2.0.BUILD-SNAPSHOT - .. - - - spring-cloud-contract-samples-pact - pom - - Spring Cloud Contract Standalone Pact Test Samples - Spring Cloud Contract Standalone Test Samples used for end to end tests - with Pact - - - - 2.2.0.BUILD-SNAPSHOT - - - - pact-http-server - pact-http-client - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - - - diff --git a/samples/standalone/pom.xml b/samples/standalone/pom.xml index bcc27de7f0..049736b89a 100644 --- a/samples/standalone/pom.xml +++ b/samples/standalone/pom.xml @@ -26,11 +26,7 @@ contracts restdocs dsl - messaging - pact webclient - yml - kotlin diff --git a/samples/standalone/yml/http-client/.gitignore b/samples/standalone/yml/http-client/.gitignore deleted file mode 100644 index b05ba7bd6d..0000000000 --- a/samples/standalone/yml/http-client/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -target/ - -.gradle -build/ - diff --git a/samples/standalone/yml/http-client/.mvn/jvm.config b/samples/standalone/yml/http-client/.mvn/jvm.config deleted file mode 100644 index 894bef17a5..0000000000 --- a/samples/standalone/yml/http-client/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/samples/standalone/yml/http-client/.mvn/maven.config b/samples/standalone/yml/http-client/.mvn/maven.config deleted file mode 100644 index affad39a42..0000000000 --- a/samples/standalone/yml/http-client/.mvn/maven.config +++ /dev/null @@ -1 +0,0 @@ --T2 \ No newline at end of file diff --git a/samples/standalone/yml/http-client/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/yml/http-client/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/yml/http-client/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/yml/http-client/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/yml/http-client/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/yml/http-client/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/yml/http-client/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/yml/http-client/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/yml/http-client/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/yml/http-client/README.adoc b/samples/standalone/yml/http-client/README.adoc deleted file mode 100644 index cdcb0e4a56..0000000000 --- a/samples/standalone/yml/http-client/README.adoc +++ /dev/null @@ -1,26 +0,0 @@ -= Http Client - -== Prerequisites - -First you have to publish to Maven Local the stubs of the *http-server* module - -== How to run it? - -Run - -[source=groovy] --------- -./gradlew clean build --------- - -or - --------- -./mvnw clean package --------- - -To - -- build the app -- use spring-cloud-contract-stub-runner-spring[Stub Runner Spring] to download the stub of `Http Server` -- run the tests against stubbed server \ No newline at end of file diff --git a/samples/standalone/yml/http-client/build.gradle b/samples/standalone/yml/http-client/build.gradle deleted file mode 100644 index bcade39777..0000000000 --- a/samples/standalone/yml/http-client/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" - } -} - -group = 'com.example' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } -} - -apply plugin: 'groovy' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' -apply plugin: 'maven-publish' - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" - } -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.springframework.boot:spring-boot-starter-actuator") - - testCompile "org.springframework.cloud:spring-cloud-starter-contract-stub-runner" -} - -test { - systemProperty 'spring.profiles.active', 'gradle' - testLogging { - exceptionFormat = 'full' - } - afterSuite { desc, result -> - if (!desc.parent) { - println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - if (result.testCount == 0) { - throw new IllegalStateException("No tests were found. Failing the build") - } - } - } -} - -task resolveDependencies { - doLast { - project.rootProject.allprojects.each { subProject -> - subProject.buildscript.configurations.each { configuration -> - configuration.resolve() - } - subProject.configurations.each { configuration -> - configuration.resolve() - } - } - } -} diff --git a/samples/standalone/yml/http-client/gradle.properties b/samples/standalone/yml/http-client/gradle.properties deleted file mode 100644 index f2aac84e71..0000000000 --- a/samples/standalone/yml/http-client/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.daemon=false -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT diff --git a/samples/standalone/yml/http-client/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/yml/http-client/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/yml/http-client/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/yml/http-client/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/yml/http-client/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/yml/http-client/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/yml/http-client/gradlew b/samples/standalone/yml/http-client/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/yml/http-client/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/yml/http-client/gradlew.bat b/samples/standalone/yml/http-client/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/yml/http-client/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/yml/http-client/mvnw b/samples/standalone/yml/http-client/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/yml/http-client/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/yml/http-client/mvnw.cmd b/samples/standalone/yml/http-client/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/yml/http-client/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/yml/http-client/pom.xml b/samples/standalone/yml/http-client/pom.xml deleted file mode 100644 index 999a5f3413..0000000000 --- a/samples/standalone/yml/http-client/pom.xml +++ /dev/null @@ -1,222 +0,0 @@ - - - 4.0.0 - - com.example - http-client-yml - 0.0.1-SNAPSHOT - - Spring Cloud Contract Verifier Http Client YAML Sample - Spring Cloud Contract Verifier Http Client YAML Sample - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT - - - - - UTF-8 - 1.8 - Hoxton.BUILD-SNAPSHOT - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.apache.httpcomponents - httpclient - - - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner - test - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-release.version} - pom - import - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - - diff --git a/samples/standalone/yml/http-client/settings.gradle b/samples/standalone/yml/http-client/settings.gradle deleted file mode 100644 index e12fd21d66..0000000000 --- a/samples/standalone/yml/http-client/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'http-client-yml-gradle' diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/Application.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/Application.java deleted file mode 100644 index 8c680cb15e..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/Application.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/LoanApplicationService.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/LoanApplicationService.java deleted file mode 100644 index 3b6f34f39a..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/LoanApplicationService.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import com.example.loan.model.FraudCheckStatus; -import com.example.loan.model.FraudServiceRequest; -import com.example.loan.model.FraudServiceResponse; -import com.example.loan.model.LoanApplication; -import com.example.loan.model.LoanApplicationResult; -import com.example.loan.model.LoanApplicationStatus; -import com.example.loan.model.Response; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.client.RestTemplateBuilder; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class LoanApplicationService { - - private final RestTemplate restTemplate; - - private int port = 6569; - - @Autowired - public LoanApplicationService(RestTemplateBuilder builder) { - this.restTemplate = builder.build(); - } - - public LoanApplicationResult loanApplication(LoanApplication loanApplication) { - FraudServiceRequest request = new FraudServiceRequest(loanApplication); - - FraudServiceResponse response = sendRequestToFraudDetectionService(request); - - return buildResponseFromFraudResult(response); - } - - private FraudServiceResponse sendRequestToFraudDetectionService( - FraudServiceRequest request) { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); - - // tag::client_call_server[] - ResponseEntity response = restTemplate.exchange( - "http://localhost:" + port + "/fraudcheck", HttpMethod.PUT, - new HttpEntity<>(request, httpHeaders), FraudServiceResponse.class); - // end::client_call_server[] - - return response.getBody(); - } - - private LoanApplicationResult buildResponseFromFraudResult( - FraudServiceResponse response) { - LoanApplicationStatus applicationStatus = null; - if (FraudCheckStatus.OK == response.getFraudCheckStatus()) { - applicationStatus = LoanApplicationStatus.LOAN_APPLIED; - } - else if (FraudCheckStatus.FRAUD == response.getFraudCheckStatus()) { - applicationStatus = LoanApplicationStatus.LOAN_APPLICATION_REJECTED; - } - - return new LoanApplicationResult(applicationStatus, - response.getRejectionReason()); - } - - public int countAllFrauds() { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); - ResponseEntity response = restTemplate.exchange( - "http://localhost:" + port + "/frauds", HttpMethod.GET, - new HttpEntity<>(httpHeaders), Response.class); - return response.getBody().getCount(); - } - - public int countDrunks() { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); - ResponseEntity response = restTemplate.exchange( - "http://localhost:" + port + "/drunks", HttpMethod.GET, - new HttpEntity<>(httpHeaders), Response.class); - return response.getBody().getCount(); - } - - public void setPort(int port) { - this.port = port; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/Client.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/Client.java deleted file mode 100644 index 1378347adf..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/Client.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class Client { - - private String pesel; - - public Client() { - } - - public Client(String pesel) { - this.pesel = pesel; - } - - public String getPesel() { - return pesel; - } - - public void setPesel(String pesel) { - this.pesel = pesel; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudCheckStatus.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudCheckStatus.java deleted file mode 100644 index 541dabb3e5..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudCheckStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public enum FraudCheckStatus { - - OK, FRAUD - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudServiceRequest.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudServiceRequest.java deleted file mode 100644 index b40922782a..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudServiceRequest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class FraudServiceRequest { - - @JsonProperty("client.id") - private String clientId; - - private BigDecimal loanAmount; - - public FraudServiceRequest() { - } - - public FraudServiceRequest(LoanApplication loanApplication) { - this.clientId = loanApplication.getClient().getPesel(); - this.loanAmount = loanApplication.getAmount(); - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public BigDecimal getLoanAmount() { - return loanAmount; - } - - public void setLoanAmount(BigDecimal loanAmount) { - this.loanAmount = loanAmount; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudServiceResponse.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudServiceResponse.java deleted file mode 100644 index 0e83564468..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/FraudServiceResponse.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class FraudServiceResponse { - - private FraudCheckStatus fraudCheckStatus; - - @JsonProperty("rejection.reason") - private String rejectionReason; - - public FraudServiceResponse() { - } - - public FraudCheckStatus getFraudCheckStatus() { - return fraudCheckStatus; - } - - public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) { - this.fraudCheckStatus = fraudCheckStatus; - } - - public String getRejectionReason() { - return rejectionReason; - } - - public void setRejectionReason(String rejectionReason) { - this.rejectionReason = rejectionReason; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplication.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplication.java deleted file mode 100644 index 546cbb7f27..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplication.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -import java.math.BigDecimal; - -public class LoanApplication { - - private Client client; - - private BigDecimal amount; - - private String loanApplicationId; - - public LoanApplication() { - } - - public LoanApplication(Client client, double amount) { - this.client = client; - this.amount = BigDecimal.valueOf(amount); - } - - public Client getClient() { - return client; - } - - public void setClient(Client client) { - this.client = client; - } - - public BigDecimal getAmount() { - return amount; - } - - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - public String getLoanApplicationId() { - return loanApplicationId; - } - - public void setLoanApplicationId(String loanApplicationId) { - this.loanApplicationId = loanApplicationId; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplicationResult.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplicationResult.java deleted file mode 100644 index b128078bda..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplicationResult.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class LoanApplicationResult { - - private LoanApplicationStatus loanApplicationStatus; - - private String rejectionReason; - - public LoanApplicationResult() { - } - - public LoanApplicationResult(LoanApplicationStatus loanApplicationStatus, - String rejectionReason) { - this.loanApplicationStatus = loanApplicationStatus; - this.rejectionReason = rejectionReason; - } - - public LoanApplicationStatus getLoanApplicationStatus() { - return loanApplicationStatus; - } - - public void setLoanApplicationStatus(LoanApplicationStatus loanApplicationStatus) { - this.loanApplicationStatus = loanApplicationStatus; - } - - public String getRejectionReason() { - return rejectionReason; - } - - public void setRejectionReason(String rejectionReason) { - this.rejectionReason = rejectionReason; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplicationStatus.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplicationStatus.java deleted file mode 100644 index f400dd9c5f..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/LoanApplicationStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public enum LoanApplicationStatus { - - LOAN_APPLIED, LOAN_APPLICATION_REJECTED - -} diff --git a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/Response.java b/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/Response.java deleted file mode 100644 index 89dbdd8524..0000000000 --- a/samples/standalone/yml/http-client/src/main/java/com/example/loan/model/Response.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan.model; - -public class Response { - - private int count; - - public Response(int count) { - this.count = count; - } - - public Response() { - } - - public int getCount() { - return this.count; - } - - public void setCount(int count) { - this.count = count; - } - -} diff --git a/samples/standalone/yml/http-client/src/main/resources/application.yml b/samples/standalone/yml/http-client/src/main/resources/application.yml deleted file mode 100644 index 4b7fe13158..0000000000 --- a/samples/standalone/yml/http-client/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port: 8090 \ No newline at end of file diff --git a/samples/standalone/yml/http-client/src/test/java/com/example/loan/LoanApplicationServiceContextPathTests.java b/samples/standalone/yml/http-client/src/test/java/com/example/loan/LoanApplicationServiceContextPathTests.java deleted file mode 100644 index 88920c1ec3..0000000000 --- a/samples/standalone/yml/http-client/src/test/java/com/example/loan/LoanApplicationServiceContextPathTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import com.example.loan.model.Client; -import com.example.loan.model.LoanApplication; -import com.example.loan.model.LoanApplicationResult; -import com.example.loan.model.LoanApplicationStatus; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = "server.context-path=/app") -@AutoConfigureStubRunner(ids = { - "com.example:http-server-yml:+:stubs:6569" }, stubsMode = StubRunnerProperties.StubsMode.LOCAL) -public class LoanApplicationServiceContextPathTests { - - @Autowired - private LoanApplicationService service; - - @Test - public void shouldSuccessfullyApplyForLoan() { - // given: - LoanApplication application = new LoanApplication(new Client("1234567890"), - 123.123); - // when: - LoanApplicationResult loanApplication = service.loanApplication(application); - // then: - assertThat(loanApplication.getLoanApplicationStatus()) - .isEqualTo(LoanApplicationStatus.LOAN_APPLIED); - assertThat(loanApplication.getRejectionReason()).isNull(); - } - - @Test - public void shouldBeRejectedDueToAbnormalLoanAmount() { - // given: - LoanApplication application = new LoanApplication(new Client("1234567890"), - 99999); - // when: - LoanApplicationResult loanApplication = service.loanApplication(application); - // then: - assertThat(loanApplication.getLoanApplicationStatus()) - .isEqualTo(LoanApplicationStatus.LOAN_APPLICATION_REJECTED); - assertThat(loanApplication.getRejectionReason()).isEqualTo("Amount too high"); - } - -} diff --git a/samples/standalone/yml/http-client/src/test/java/com/example/loan/LoanApplicationServiceTests.java b/samples/standalone/yml/http-client/src/test/java/com/example/loan/LoanApplicationServiceTests.java deleted file mode 100644 index a9ac042f74..0000000000 --- a/samples/standalone/yml/http-client/src/test/java/com/example/loan/LoanApplicationServiceTests.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.loan; - -import com.example.loan.model.Client; -import com.example.loan.model.LoanApplication; -import com.example.loan.model.LoanApplicationResult; -import com.example.loan.model.LoanApplicationStatus; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; -import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -// tag::autoconfigure_stubrunner[] -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.NONE) -@AutoConfigureStubRunner(ids = { - "com.example:http-server-yml:+:stubs:6569" }, stubsMode = StubRunnerProperties.StubsMode.LOCAL) -public class LoanApplicationServiceTests { - - // end::autoconfigure_stubrunner[] - - @Autowired - private LoanApplicationService service; - - @Test - public void shouldSuccessfullyApplyForLoan() { - // given: - LoanApplication application = new LoanApplication(new Client("1234567890"), - 123.123); - // when: - LoanApplicationResult loanApplication = service.loanApplication(application); - // then: - assertThat(loanApplication.getLoanApplicationStatus()) - .isEqualTo(LoanApplicationStatus.LOAN_APPLIED); - assertThat(loanApplication.getRejectionReason()).isNull(); - } - - // tag::client_tdd[] - @Test - public void shouldBeRejectedDueToAbnormalLoanAmount() { - // given: - LoanApplication application = new LoanApplication(new Client("1234567890"), - 99999); - // when: - LoanApplicationResult loanApplication = service.loanApplication(application); - // then: - assertThat(loanApplication.getLoanApplicationStatus()) - .isEqualTo(LoanApplicationStatus.LOAN_APPLICATION_REJECTED); - assertThat(loanApplication.getRejectionReason()).isEqualTo("Amount too high"); - } - // end::client_tdd[] - - @Test - public void shouldSuccessfullyGetAllFrauds() { - // when: - int count = service.countAllFrauds(); - // then: - assertThat(count).isEqualTo(200); - } - - @Test - public void shouldSuccessfullyGetAllDrunks() { - // when: - int count = service.countDrunks(); - // then: - assertThat(count).isEqualTo(100); - } - -} diff --git a/samples/standalone/yml/http-client/src/test/resources/application-gradle.yaml b/samples/standalone/yml/http-client/src/test/resources/application-gradle.yaml deleted file mode 100644 index 504cb4ec0a..0000000000 --- a/samples/standalone/yml/http-client/src/test/resources/application-gradle.yaml +++ /dev/null @@ -1,3 +0,0 @@ -stubrunner: - stubs-mode: local - stubs.ids: 'com.example:http-server-yml-gradle:+:stubs:6569' diff --git a/samples/standalone/yml/http-client/src/test/resources/application.yaml b/samples/standalone/yml/http-client/src/test/resources/application.yaml deleted file mode 100644 index 1f9fed43b3..0000000000 --- a/samples/standalone/yml/http-client/src/test/resources/application.yaml +++ /dev/null @@ -1,2 +0,0 @@ -server: - port: 6569 diff --git a/samples/standalone/yml/http-server/.gitignore b/samples/standalone/yml/http-server/.gitignore deleted file mode 100644 index b05ba7bd6d..0000000000 --- a/samples/standalone/yml/http-server/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -target/ - -.gradle -build/ - diff --git a/samples/standalone/yml/http-server/.mvn/jvm.config b/samples/standalone/yml/http-server/.mvn/jvm.config deleted file mode 100644 index 894bef17a5..0000000000 --- a/samples/standalone/yml/http-server/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/samples/standalone/yml/http-server/.mvn/maven.config b/samples/standalone/yml/http-server/.mvn/maven.config deleted file mode 100644 index 7681bc67b9..0000000000 --- a/samples/standalone/yml/http-server/.mvn/maven.config +++ /dev/null @@ -1 +0,0 @@ --T2 diff --git a/samples/standalone/yml/http-server/.mvn/wrapper/MavenWrapperDownloader.java b/samples/standalone/yml/http-server/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100755 index 959fea7b14..0000000000 --- a/samples/standalone/yml/http-server/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ - -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is - * provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl - * property to use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for - * the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a - // custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, - MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream( - mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } - catch (IOException e) { - System.out.println( - "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } - finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } - catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), - MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println("- ERROR creating output direcrory '" - + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } - catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) - throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/samples/standalone/yml/http-server/.mvn/wrapper/maven-wrapper.jar b/samples/standalone/yml/http-server/.mvn/wrapper/maven-wrapper.jar deleted file mode 100755 index 08ebbb67f0..0000000000 Binary files a/samples/standalone/yml/http-server/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/samples/standalone/yml/http-server/.mvn/wrapper/maven-wrapper.properties b/samples/standalone/yml/http-server/.mvn/wrapper/maven-wrapper.properties deleted file mode 100755 index a5fcc11920..0000000000 --- a/samples/standalone/yml/http-server/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file diff --git a/samples/standalone/yml/http-server/README.adoc b/samples/standalone/yml/http-server/README.adoc deleted file mode 100644 index 2fd3fbc40d..0000000000 --- a/samples/standalone/yml/http-server/README.adoc +++ /dev/null @@ -1,20 +0,0 @@ -= Http Server - -Run - -[source=groovy] --------- -./gradlew clean build publishToMavenLocal --------- - -or - --------- -./mvnw clean install --------- - -To - -- build the app -- generate and run Spring Cloud Contract Verifier tests -- publish the fatJar and the stubs to Maven Local \ No newline at end of file diff --git a/samples/standalone/yml/http-server/build.gradle b/samples/standalone/yml/http-server/build.gradle deleted file mode 100644 index f48ea44f52..0000000000 --- a/samples/standalone/yml/http-server/build.gradle +++ /dev/null @@ -1,84 +0,0 @@ -// tag::repos[] -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } - } -// end::repos[] - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" - classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" - } -} - -group = 'com.example' -version = '0.0.1-SNAPSHOT' - -// tag::deps_repos[] -repositories { - mavenCentral() - mavenLocal() - maven { url "https://repo.spring.io/snapshot" } - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/release" } -} -// end::deps_repos[] - -apply plugin: 'groovy' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' -apply plugin: 'spring-cloud-contract' -apply plugin: 'maven-publish' -apply plugin: 'maven' - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" - } -} - -contracts { - packageWithBaseClasses = 'com.example.fraud' -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.springframework.boot:spring-boot-starter-actuator") - - testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier' -} - -test { - systemProperty 'spring.profiles.active', 'gradle' - testLogging { - exceptionFormat = 'full' - } - afterSuite { desc, result -> - if (!desc.parent) { - println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - if (result.testCount == 0) { - throw new IllegalStateException("No tests were found. Failing the build") - } - } - } -} - -clean.doFirst { - delete "~/.m2/repository/com/example/http-server-dsl-gradle" -} - -task resolveDependencies { - doLast { - project.rootProject.allprojects.each { subProject -> - subProject.buildscript.configurations.each { configuration -> - configuration.resolve() - } - subProject.configurations.each { configuration -> - configuration.resolve() - } - } - } -} diff --git a/samples/standalone/yml/http-server/gradle.properties b/samples/standalone/yml/http-server/gradle.properties deleted file mode 100644 index b15537ccf7..0000000000 --- a/samples/standalone/yml/http-server/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.daemon=false -verifierVersion=2.2.0.BUILD-SNAPSHOT -BOM_VERSION=Hoxton.BUILD-SNAPSHOT -bootVersion=2.2.0.BUILD-SNAPSHOT diff --git a/samples/standalone/yml/http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/yml/http-server/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/samples/standalone/yml/http-server/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/standalone/yml/http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/yml/http-server/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b0acbdcd73..0000000000 --- a/samples/standalone/yml/http-server/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/standalone/yml/http-server/gradlew b/samples/standalone/yml/http-server/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/samples/standalone/yml/http-server/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -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 - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -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 - 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -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" "$@" diff --git a/samples/standalone/yml/http-server/gradlew.bat b/samples/standalone/yml/http-server/gradlew.bat deleted file mode 100644 index 0f8d5937c4..0000000000 --- a/samples/standalone/yml/http-server/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@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="-Xmx64m" - -@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 - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -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% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/standalone/yml/http-server/mvnw b/samples/standalone/yml/http-server/mvnw deleted file mode 100755 index 1d5ace7fc1..0000000000 --- a/samples/standalone/yml/http-server/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/standalone/yml/http-server/mvnw.cmd b/samples/standalone/yml/http-server/mvnw.cmd deleted file mode 100755 index 080c510d2b..0000000000 --- a/samples/standalone/yml/http-server/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@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 -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@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_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 e.g. to debug Maven itself, use -@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 ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@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.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -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 location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@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 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@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. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@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% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@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.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/samples/standalone/yml/http-server/pom.xml b/samples/standalone/yml/http-server/pom.xml deleted file mode 100644 index 079a1af92e..0000000000 --- a/samples/standalone/yml/http-server/pom.xml +++ /dev/null @@ -1,312 +0,0 @@ - - - 4.0.0 - - com.example - http-server-yml - 0.0.1-SNAPSHOT - - Spring Cloud Contract Verifier Http Server YAML Sample - Spring Cloud Contract Verifier Http Server YAML Sample - - - org.springframework.boot - spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT - - - - - UTF-8 - 1.8 - 2.2.0.BUILD-SNAPSHOT - Hoxton.BUILD-SNAPSHOT - - 3.2.0 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-test - test - - - - io.rest-assured - spring-mock-mvc - ${rest-assured.version} - - - spring-web - org.springframework - - - spring-webmvc - org.springframework - - - spring-test - org.springframework - - - - - io.rest-assured - spring-web-test-client - ${rest-assured.version} - - - spring-context - org.springframework - - - spring-webflux - org.springframework - - - - - io.rest-assured - rest-assured - ${rest-assured.version} - - - - - org.springframework.cloud - spring-cloud-starter-contract-verifier - test - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-release.version} - pom - import - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - ${spring-cloud-contract.version} - true - - com.example.fraud - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - org.apache.maven.plugins - maven-clean-plugin - 3.0.0 - - - - build - - - target - - - - - - maven-surefire-plugin - - true - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - - - [${spring-cloud-contract.version},) - - - convert - generateTests - - - - - - - - - - - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - - - integration - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - ./gradlew - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - windows - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - gradle - test - - gradlew.bat - - clean - build - publishToMavenLocal - - -PverifierVersion=${spring-cloud-contract.version} - - - - - exec - - - - - - - - - diff --git a/samples/standalone/yml/http-server/settings.gradle b/samples/standalone/yml/http-server/settings.gradle deleted file mode 100644 index c2d11e3eb9..0000000000 --- a/samples/standalone/yml/http-server/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'http-server-yml-gradle' diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/Application.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/Application.java deleted file mode 100644 index 8aed3b447a..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/Application.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@EnableAutoConfiguration -@ComponentScan -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudDetectionController.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudDetectionController.java deleted file mode 100644 index 7652f55cc3..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudDetectionController.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import java.math.BigDecimal; - -import com.example.fraud.model.FraudCheck; -import com.example.fraud.model.FraudCheckResult; -import com.example.fraud.model.FraudCheckStatus; - -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import static org.springframework.web.bind.annotation.RequestMethod.PUT; - -@RestController -public class FraudDetectionController { - - private static final String NO_REASON = null; - - private static final String AMOUNT_TOO_HIGH = "Amount too high"; - - private static final BigDecimal MAX_AMOUNT = new BigDecimal("5000"); - - // tag::server_api[] - @RequestMapping(value = "/fraudcheck", method = PUT) - public FraudCheckResult fraudCheck(@RequestBody FraudCheck fraudCheck) { - // end::server_api[] - // tag::new_impl[] - if (amountGreaterThanThreshold(fraudCheck)) { - return new FraudCheckResult(FraudCheckStatus.FRAUD, AMOUNT_TOO_HIGH); - } - // end::new_impl[] - // tag::initial_impl[] - return new FraudCheckResult(FraudCheckStatus.OK, NO_REASON); - // end::initial_impl[] - } - - private boolean amountGreaterThanThreshold(FraudCheck fraudCheck) { - return MAX_AMOUNT.compareTo(fraudCheck.getLoanAmount()) < 0; - } - -} diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudNameController.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudNameController.java deleted file mode 100644 index 9d5db11ac9..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudNameController.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -interface FraudVerifier { - - boolean isFraudByName(String name); - -} - -/** - * @author Marcin Grzejszczak - */ -@RestController -class FraudNameController { - - private final FraudVerifier fraudVerifier; - - FraudNameController(FraudVerifier fraudVerifier) { - this.fraudVerifier = fraudVerifier; - } - - @PutMapping(value = "/frauds/name") - public NameResponse checkByName(@RequestBody NameRequest request) { - boolean fraud = this.fraudVerifier.isFraudByName(request.getName()); - if (fraud) { - return new NameResponse("Sorry " + request.getName() + " but you're a fraud"); - } - return new NameResponse( - "Don't worry " + request.getName() + " you're not a fraud"); - } - -} - -class NameRequest { - - private String name; - - public NameRequest(String name) { - this.name = name; - } - - public NameRequest() { - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - -} - -class NameResponse { - - private String result; - - public NameResponse(String result) { - this.result = result; - } - - public NameResponse() { - } - - public String getResult() { - return this.result; - } - - public void setResult(String result) { - this.result = result; - } - -} diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudStatsController.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudStatsController.java deleted file mode 100644 index f54667c620..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/FraudStatsController.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -enum FraudType { - - DRUNKS, ALL - -} - -interface StatsProvider { - - int count(FraudType fraudType); - -} - -@RestController -public class FraudStatsController { - - private final StatsProvider statsProvider; - - public FraudStatsController(StatsProvider statsProvider) { - this.statsProvider = statsProvider; - } - - @GetMapping(value = "/frauds") - public Response countAllFrauds() { - return new Response(this.statsProvider.count(FraudType.ALL)); - } - - @GetMapping(value = "/drunks") - public Response countAllDrunks() { - return new Response(this.statsProvider.count(FraudType.DRUNKS)); - } - -} - -class Response { - - private int count; - - public Response(int count) { - this.count = count; - } - - public Response() { - } - - public int getCount() { - return this.count; - } - - public void setCount(int count) { - this.count = count; - } - -} diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheck.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheck.java deleted file mode 100644 index 92fee9d93a..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheck.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class FraudCheck { - - @JsonProperty("client.id") - private String clientId; - - private BigDecimal loanAmount; - - public FraudCheck() { - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public BigDecimal getLoanAmount() { - return loanAmount; - } - - public void setLoanAmount(BigDecimal loanAmount) { - this.loanAmount = loanAmount; - } - -} diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheckResult.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheckResult.java deleted file mode 100644 index 3023f07e61..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheckResult.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class FraudCheckResult { - - private FraudCheckStatus fraudCheckStatus; - - @JsonProperty("rejection.reason") - private String rejectionReason; - - public FraudCheckResult() { - } - - public FraudCheckResult(FraudCheckStatus fraudCheckStatus, String rejectionReason) { - this.fraudCheckStatus = fraudCheckStatus; - this.rejectionReason = rejectionReason; - } - - public FraudCheckStatus getFraudCheckStatus() { - return fraudCheckStatus; - } - - public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) { - this.fraudCheckStatus = fraudCheckStatus; - } - - public String getRejectionReason() { - return rejectionReason; - } - - public void setRejectionReason(String rejectionReason) { - this.rejectionReason = rejectionReason; - } - -} diff --git a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheckStatus.java b/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheckStatus.java deleted file mode 100644 index cf4b371f35..0000000000 --- a/samples/standalone/yml/http-server/src/main/java/com/example/fraud/model/FraudCheckStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2019 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 com.example.fraud.model; - -public enum FraudCheckStatus { - - OK, FRAUD - -} diff --git a/samples/standalone/yml/http-server/src/main/resources/application.yml b/samples/standalone/yml/http-server/src/main/resources/application.yml deleted file mode 100644 index 1c421cf2b7..0000000000 --- a/samples/standalone/yml/http-server/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -server.port=0 \ No newline at end of file diff --git a/samples/standalone/yml/pom.xml b/samples/standalone/yml/pom.xml deleted file mode 100644 index 8f7a8764c6..0000000000 --- a/samples/standalone/yml/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - - org.springframework.cloud - spring-cloud-contract-samples-standalone - 2.2.0.BUILD-SNAPSHOT - .. - - - spring-cloud-contract-samples-yml - pom - - Spring Cloud Contract Standalone Dsl Test Samples - Spring Cloud Contract Standalone Test Samples used for end to end tests - - - - 2.2.0.BUILD-SNAPSHOT - - - - http-server - http-client - - - - - - maven-deploy-plugin - 2.8.2 - - true - - - - - -