From 6c9de85cdf6a0788504575462fe25238f6839bb2 Mon Sep 17 00:00:00 2001 From: fernando Date: Sun, 22 Oct 2023 14:14:10 +0200 Subject: [PATCH] trying to upgrade project to java jdk 17 and spring boot 3 --- .github/workflows/PR-pipeline.yml | 6 +-- base-domain/pom.xml | 8 ++-- inventory/pom.xml | 47 ++++--------------- .../contract/InventoryProviderPact.java | 7 +-- 4 files changed, 18 insertions(+), 50 deletions(-) diff --git a/.github/workflows/PR-pipeline.yml b/.github/workflows/PR-pipeline.yml index 7758104..28a779f 100644 --- a/.github/workflows/PR-pipeline.yml +++ b/.github/workflows/PR-pipeline.yml @@ -18,7 +18,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'adopt' - name: Cache Maven packages uses: actions/cache@v3 @@ -49,7 +49,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'adopt' - name: Cache SonarCloud packages uses: actions/cache@v3 @@ -86,7 +86,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'adopt' - name: Cache uses: actions/cache@v3.3.1 diff --git a/base-domain/pom.xml b/base-domain/pom.xml index 630c7dc..21676cb 100644 --- a/base-domain/pom.xml +++ b/base-domain/pom.xml @@ -49,7 +49,7 @@ spring-boot-starter-data-mongodb org.springframework.boot - 2.7.14 + 3.1.2 de.flapdoodle.embed.mongo @@ -73,9 +73,9 @@ - 11 - 11 - 11 + 17 + 17 + 17 UTF-8 VERBOSE 1.0.0-SNAPSHOT diff --git a/inventory/pom.xml b/inventory/pom.xml index a0ee319..5e29992 100644 --- a/inventory/pom.xml +++ b/inventory/pom.xml @@ -8,7 +8,6 @@ com.diffplug.spotless spotless-maven-plugin - 2.22.1 apply @@ -40,13 +39,11 @@ org.springframework.boot spring-boot-maven-plugin - 2.3.2.RELEASE org.apache.maven.plugins maven-compiler-plugin - 3.10.1 ${java.version} ${java.version} @@ -150,12 +147,10 @@ spring-boot-starter-actuator org.springframework.boot - 2.7.14 spring-boot-starter-web org.springframework.boot - 2.7.14 @@ -167,55 +162,31 @@ org.springframework.boot - 3.1.2 test - - persistence-api - javax.persistence - 1.0.2 - spring-boot-starter-data-mongodb org.springframework.boot - 3.1.2 - - - de.flapdoodle.embed.mongo - de.flapdoodle.embed - test - 2.2.0 + 3.1.2 + + de.flapdoodle.embed.mongo + de.flapdoodle.embed + test + 3.5.4 + org.projectlombok lombok 1.18.24 - - javax.validation - validation-api - 2.0.1.Final - - io.springfox springfox-swagger2 3.0.0 - - io.springfox - springfox-boot-starter - 3.0.0 - - - - io.springfox - springfox-swagger-ui - 3.0.0 - - au.com.dius.pact.provider junit5spring @@ -243,11 +214,11 @@ spring-boot-starter-parent org.springframework.boot - 2.3.2.RELEASE + 3.1.2 - 11 + 17 ${project.basedir}/../inventory/target/site/jacoco/jacoco.xml diff --git a/inventory/src/test/java/com/ecommerceapp/inventory/contract/InventoryProviderPact.java b/inventory/src/test/java/com/ecommerceapp/inventory/contract/InventoryProviderPact.java index 432981d..e77402f 100644 --- a/inventory/src/test/java/com/ecommerceapp/inventory/contract/InventoryProviderPact.java +++ b/inventory/src/test/java/com/ecommerceapp/inventory/contract/InventoryProviderPact.java @@ -24,11 +24,10 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.web.server.LocalServerPort; import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) @Provider("InventoryModule") @PactBroker( url = "${PACT_BROKER_URL}", @@ -38,13 +37,11 @@ @IgnoreNoPactsToVerify class InventoryProviderPact { - @LocalServerPort private int localServerPort; - @MockBean private InventoryService inventoryService; @BeforeEach void setUp(PactVerificationContext context) throws MalformedURLException { - context.setTarget(HttpTestTarget.fromUrl(new URL("http://localhost:" + localServerPort))); + context.setTarget(HttpTestTarget.fromUrl(new URL("http://localhost:" + 7080))); } @TestTemplate