From 6a00ee767487651af95ea501c7994b8b604684e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:31:34 +0200 Subject: [PATCH 1/8] Bump org.junit.vintage:junit-vintage-engine from 5.9.1 to 5.9.3 (#1974) Bumps [org.junit.vintage:junit-vintage-engine](https://github.com/junit-team/junit5) from 5.9.1 to 5.9.3. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.1...r5.9.3) --- updated-dependencies: - dependency-name: org.junit.vintage:junit-vintage-engine dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9215e3766d..90f27d19cc 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ 1 2.27.0 - 5.9.1 + 5.9.3 5.9.3 1.12.1 From 661452caa04772abd69c34b097b2fddf111cc04e Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Mon, 25 Sep 2023 14:04:46 +0200 Subject: [PATCH 2/8] Fixed readme import --- docs/src/main/asciidoc/README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 75103b9504..0c8889dcfe 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -12,6 +12,6 @@ You can read more about Spring Cloud Contract by going to https://spring.io/proj == Contributing -include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/contributing.adoc[] +include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/3.1.x/docs/src/main/asciidoc/contributing.adoc[] include::_building.adoc[] From 0fdfadd4df99c368044c1fd9045a79c7aec385a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:56:02 +0200 Subject: [PATCH 3/8] Bump com.google.inject:guice from 5.0.0 to 5.0.1 (#1982) Bumps [com.google.inject:guice](https://github.com/google/guice) from 5.0.0 to 5.0.1. - [Release notes](https://github.com/google/guice/releases) - [Commits](https://github.com/google/guice/compare/5.0.0...5.0.1) --- updated-dependencies: - dependency-name: com.google.inject:guice dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spring-cloud-contract-shade/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-contract-shade/pom.xml b/spring-cloud-contract-shade/pom.xml index 7311f2a39e..98c885743f 100644 --- a/spring-cloud-contract-shade/pom.xml +++ b/spring-cloud-contract-shade/pom.xml @@ -7,7 +7,7 @@ 0.3.5 0.3.4 4.2.0 - 5.0.0 + 5.0.1 30.0-jre 9.0 3.6.1 From 50b58651d5d1388fa070b366de4027043b49e6b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:56:28 +0200 Subject: [PATCH 4/8] Bump spock-spring.version from 2.0-M5-groovy-3.0 to 2.0-groovy-3.0 (#1983) Bumps `spock-spring.version` from 2.0-M5-groovy-3.0 to 2.0-groovy-3.0. Updates `org.spockframework:spock-spring` from 2.0-M5-groovy-3.0 to 2.0-groovy-3.0 Updates `org.spockframework:spock-core` from 2.0-M5-groovy-3.0 to 2.0-groovy-3.0 Updates `org.spockframework:spock-junit4` from 2.0-M5-groovy-3.0 to 2.0-groovy-3.0 --- updated-dependencies: - dependency-name: org.spockframework:spock-spring dependency-type: direct:production - dependency-name: org.spockframework:spock-core dependency-type: direct:production - dependency-name: org.spockframework:spock-junit4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 90f27d19cc..5a463abcb1 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 3.0.6.RELEASE 5.0.4 3.2.11 - 2.0-M5-groovy-3.0 + 2.0-groovy-3.0 0.2.2 1.10.0 4.3.1 From 9fb2772b7f089e7867ed5528c808e1a9add3b3e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:56:58 +0200 Subject: [PATCH 5/8] Bump org.eclipse.sisu:org.eclipse.sisu.plexus from 0.3.4 to 0.3.5 (#1984) Bumps org.eclipse.sisu:org.eclipse.sisu.plexus from 0.3.4 to 0.3.5. --- updated-dependencies: - dependency-name: org.eclipse.sisu:org.eclipse.sisu.plexus dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spring-cloud-contract-shade/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-contract-shade/pom.xml b/spring-cloud-contract-shade/pom.xml index 98c885743f..ac2c27584e 100644 --- a/spring-cloud-contract-shade/pom.xml +++ b/spring-cloud-contract-shade/pom.xml @@ -5,7 +5,7 @@ 4.0.0 0.3.5 - 0.3.4 + 0.3.5 4.2.0 5.0.1 30.0-jre From f50195a7a7df753354a41b27c7880d6c1e2add37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:57:17 +0200 Subject: [PATCH 6/8] Bump com.example.github:github-webhook (#1985) Bumps com.example.github:github-webhook from 1.0.0.M1-190120_193303-VERSION to 1.0.0.M1-20180806_102441-VERSION. --- updated-dependencies: - dependency-name: com.example.github:github-webhook dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spring-cloud-contract-wiremock/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-contract-wiremock/pom.xml b/spring-cloud-contract-wiremock/pom.xml index ec4e4a3bc0..19d76250cf 100644 --- a/spring-cloud-contract-wiremock/pom.xml +++ b/spring-cloud-contract-wiremock/pom.xml @@ -110,7 +110,7 @@ com.example.github github-webhook stubs - 1.0.0.M1-190120_193303-VERSION + 1.0.0.M1-20180806_102441-VERSION test From dfceec38bacc9ecc8ad45f78b4488d2ae07a7216 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:55:00 +0200 Subject: [PATCH 7/8] Bump cglib:cglib from 3.2.11 to 3.2.12 (#1986) Bumps [cglib:cglib](https://github.com/cglib/cglib) from 3.2.11 to 3.2.12. - [Release notes](https://github.com/cglib/cglib/releases) - [Commits](https://github.com/cglib/cglib/commits) --- updated-dependencies: - dependency-name: cglib:cglib dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5a463abcb1..cb6bd7d10c 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 3.1.8-SNAPSHOT 3.0.6.RELEASE 5.0.4 - 3.2.11 + 3.2.12 2.0-groovy-3.0 0.2.2 1.10.0 From 0ca1a20940e88466a26b4844295abdef7067ea13 Mon Sep 17 00:00:00 2001 From: Paulius Paplauskas Date: Tue, 26 Sep 2023 15:21:16 +0200 Subject: [PATCH 8/8] Use prepareTestInstance phase instead of beforeTestClass phase (#1996) * use prepareTestInstance phase instead of beforeTestClass phase to check wiremock config * code style changes --- .../WireMockTestExecutionListener.java | 2 +- ...nListenerAllowsOtherBeforeActionsTest.java | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/TestExecutionListenerAllowsOtherBeforeActionsTest.java diff --git a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockTestExecutionListener.java b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockTestExecutionListener.java index c463b8133a..db7c2c099f 100644 --- a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockTestExecutionListener.java +++ b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockTestExecutionListener.java @@ -39,7 +39,7 @@ public final class WireMockTestExecutionListener extends AbstractTestExecutionLi private static final Log log = LogFactory.getLog(WireMockTestExecutionListener.class); @Override - public void beforeTestClass(TestContext testContext) throws Exception { + public void prepareTestInstance(TestContext testContext) throws Exception { if (applicationContextBroken(testContext) || wireMockConfigurationMissing(testContext) || annotationMissing(testContext)) { return; diff --git a/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/TestExecutionListenerAllowsOtherBeforeActionsTest.java b/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/TestExecutionListenerAllowsOtherBeforeActionsTest.java new file mode 100644 index 0000000000..1bbdcd2b32 --- /dev/null +++ b/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/TestExecutionListenerAllowsOtherBeforeActionsTest.java @@ -0,0 +1,75 @@ +/* + * Copyright 2013-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.contract.wiremock; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +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.context.ApplicationListener; +import org.springframework.context.annotation.Import; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.test.annotation.DirtiesContext; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest(classes = WiremockTestsApplication.class, + properties = "app.baseUrl=http://localhost:${wiremock.server.port}", webEnvironment = WebEnvironment.NONE) +@AutoConfigureWireMock(port = 0) +@DirtiesContext +@Import(TestExecutionListenerAllowsOtherBeforeActionsTest.ApplicationEventListener.class) +class TestExecutionListenerAllowsOtherBeforeActionsTest { + + private static boolean beforeAllRunSuccessful; + + private static boolean applicationContextInitialized; + + @Autowired + private Service service; + + @BeforeAll + static void checkIfApplicationContextNotInitialized() { + beforeAllRunSuccessful = !applicationContextInitialized; + } + + @Test + void should_run_before_all_action_before_application_context_is_available() { + // check that beforeAll method was actually run before the application context was + // initialized + assertThat(beforeAllRunSuccessful).isTrue(); + // check that wiremock instance is running + stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("Hello World!"))); + assertThat(this.service.go()).isEqualTo("Hello World!"); + } + + public static class ApplicationEventListener implements ApplicationListener { + + @Override + public void onApplicationEvent(ContextRefreshedEvent event) { + applicationContextInitialized = true; + } + + } + +}