diff --git a/.github/actions/scan-with-sonar/action.yml b/.github/actions/scan-with-sonar/action.yml index 9201134..1b7a12e 100644 --- a/.github/actions/scan-with-sonar/action.yml +++ b/.github/actions/scan-with-sonar/action.yml @@ -80,7 +80,7 @@ runs: -Dsonar.projectKey=com.sap.cds.cds-ai -Dsonar.projectVersion=${{ steps.get-revision.outputs.REVISION }} -Dsonar.qualitygate.wait=true - -Dsonar.java.source=17 + -Dsonar.java.source=21 -Dsonar.exclusions=**/samples/**,**/integration-tests/** -Dsonar.coverage.jacoco.xmlReportPaths=${{ github.workspace }}/cds-feature-ai-core/target/site/jacoco/jacoco.xml,${{ github.workspace }}/cds-feature-recommendations/target/site/jacoco/jacoco.xml,${{ github.workspace }}/integration-tests/spring/target/site/jacoco/jacoco.xml,${{ github.workspace }}/coverage-report/target/site/jacoco-aggregate/jacoco.xml -Dsonar.coverage.exclusions=**/src/test/**,**/src/gen/** diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 2671fb0..44b8ac6 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - java-version: [17, 21] + java-version: [21, 25] steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - java-version: [17, 21] + java-version: [21, 25] steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 @@ -74,7 +74,7 @@ jobs: strategy: fail-fast: false matrix: - java-version: [17, 21] + java-version: [21, 25] steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 @@ -119,7 +119,7 @@ jobs: continue-on-error: true uses: ./.github/actions/scan-with-sonar with: - java-version: '17' + java-version: '21' maven-version: ${{ env.MAVEN_VERSION }} sonarq-token: ${{ secrets.SONARQ_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -144,7 +144,7 @@ jobs: - name: CodeQL Analysis uses: cap-java/.github/actions/scan-with-codeql@296573b55e906f5c77a1855bcfe4285cbbc5cac4 # main with: - java-version: '17' + java-version: '21' maven-version: ${{ env.MAVEN_VERSION }} language: ${{ matrix.language }} queries: security-extended diff --git a/integration-tests/mtx-local/srv/pom.xml b/integration-tests/mtx-local/srv/pom.xml index a4af600..2ee1530 100644 --- a/integration-tests/mtx-local/srv/pom.xml +++ b/integration-tests/mtx-local/srv/pom.xml @@ -63,6 +63,12 @@ test + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + org.springframework.security spring-security-test diff --git a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/MtxLifecycleTest.java b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/MtxLifecycleTest.java index 30e5a4d..c119fff 100644 --- a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/MtxLifecycleTest.java +++ b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/MtxLifecycleTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; -import com.fasterxml.jackson.databind.ObjectMapper; import com.sap.cds.feature.aicore.generated.cds4j.aicore.AICore_; import com.sap.cds.feature.aicore.api.ResourceGroupContext; import com.sap.cds.feature.aicore.itest.mt.utils.SubscriptionEndpointClient; @@ -16,7 +15,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; @@ -30,14 +29,13 @@ class MtxLifecycleTest { private static final String TENANT = "tenant-3"; @Autowired MockMvc client; - @Autowired ObjectMapper objectMapper; @Autowired CdsRuntime runtime; SubscriptionEndpointClient subscriptionEndpointClient; @BeforeEach void setup() { - subscriptionEndpointClient = new SubscriptionEndpointClient(objectMapper, client); + subscriptionEndpointClient = new SubscriptionEndpointClient(client); } @AfterEach diff --git a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/SubscribeUnsubscribeTest.java b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/SubscribeUnsubscribeTest.java index 185d387..fe21365 100644 --- a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/SubscribeUnsubscribeTest.java +++ b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/SubscribeUnsubscribeTest.java @@ -8,7 +8,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import com.fasterxml.jackson.databind.ObjectMapper; import com.sap.cds.feature.aicore.generated.cds4j.aicore.AICore_; import com.sap.cds.feature.aicore.api.ResourceGroupContext; import com.sap.cds.feature.aicore.itest.mt.utils.SubscriptionEndpointClient; @@ -18,7 +17,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; @@ -31,14 +30,13 @@ class SubscribeUnsubscribeTest { private static final String PRODUCTS_URL = "/odata/v4/MtTestService/Products"; @Autowired MockMvc client; - @Autowired ObjectMapper objectMapper; @Autowired CdsRuntime runtime; SubscriptionEndpointClient subscriptionEndpointClient; @BeforeEach void setup() { - subscriptionEndpointClient = new SubscriptionEndpointClient(objectMapper, client); + subscriptionEndpointClient = new SubscriptionEndpointClient(client); } @Test diff --git a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/TenantIsolationTest.java b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/TenantIsolationTest.java index d30830f..e90158f 100644 --- a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/TenantIsolationTest.java +++ b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/TenantIsolationTest.java @@ -5,7 +5,6 @@ import static org.assertj.core.api.Assertions.assertThat; -import com.fasterxml.jackson.databind.ObjectMapper; import com.sap.cds.feature.aicore.generated.cds4j.aicore.AICore_; import com.sap.cds.feature.aicore.api.ResourceGroupContext; import com.sap.cds.feature.aicore.core.AICoreConfig; @@ -17,7 +16,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; @@ -28,14 +27,13 @@ class TenantIsolationTest { @Autowired MockMvc client; - @Autowired ObjectMapper objectMapper; @Autowired CdsRuntime runtime; SubscriptionEndpointClient subscriptionEndpointClient; @BeforeEach void setup() { - subscriptionEndpointClient = new SubscriptionEndpointClient(objectMapper, client); + subscriptionEndpointClient = new SubscriptionEndpointClient(client); } @Test diff --git a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/utils/SubscriptionEndpointClient.java b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/utils/SubscriptionEndpointClient.java index d87d599..2d08235 100644 --- a/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/utils/SubscriptionEndpointClient.java +++ b/integration-tests/mtx-local/srv/src/test/java/com/sap/cds/feature/aicore/itest/mt/utils/SubscriptionEndpointClient.java @@ -18,13 +18,12 @@ public class SubscriptionEndpointClient { private static final String MT_SUBSCRIPTIONS_TENANTS = "/mt/v1.0/subscriptions/tenants/"; - private final ObjectMapper objectMapper; + private final ObjectMapper objectMapper = new ObjectMapper(); private final MockMvc client; private final String credentials = "Basic " + Base64.getEncoder().encodeToString("privileged:".getBytes(StandardCharsets.UTF_8)); - public SubscriptionEndpointClient(ObjectMapper objectMapper, MockMvc client) { - this.objectMapper = objectMapper; + public SubscriptionEndpointClient(MockMvc client) { this.client = client; } diff --git a/integration-tests/spring/pom.xml b/integration-tests/spring/pom.xml index 9d3a1b7..2a16e34 100644 --- a/integration-tests/spring/pom.xml +++ b/integration-tests/spring/pom.xml @@ -61,6 +61,12 @@ test + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + org.springframework.security spring-security-test diff --git a/integration-tests/spring/src/test/java/com/sap/cds/feature/aicore/itest/BaseIntegrationTest.java b/integration-tests/spring/src/test/java/com/sap/cds/feature/aicore/itest/BaseIntegrationTest.java index ea356aa..19a1372 100644 --- a/integration-tests/spring/src/test/java/com/sap/cds/feature/aicore/itest/BaseIntegrationTest.java +++ b/integration-tests/spring/src/test/java/com/sap/cds/feature/aicore/itest/BaseIntegrationTest.java @@ -22,7 +22,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.servlet.MockMvc; diff --git a/pom.xml b/pom.xml index 75a5bc7..6a43487 100644 --- a/pom.xml +++ b/pom.xml @@ -59,20 +59,20 @@ - 0.0.1-alpha + 0.0.2-alpha **/Mock*.java - 17 + 21 - 4.9.0 + 5.0.0 1.19.0 - 3.4.5 + 4.1.0 0.8.15 diff --git a/samples/bookshop/pom.xml b/samples/bookshop/pom.xml index 10a7823..32a66ff 100644 --- a/samples/bookshop/pom.xml +++ b/samples/bookshop/pom.xml @@ -18,9 +18,9 @@ 1.0.0-SNAPSHOT - 17 - 4.9.0 - 3.5.6 + 21 + 5.0.0 + 4.1.0 0.0.1-alpha 0.0.1-alpha 1.5.0 diff --git a/samples/bookshop/srv/pom.xml b/samples/bookshop/srv/pom.xml index a360e21..69ae9e9 100644 --- a/samples/bookshop/srv/pom.xml +++ b/samples/bookshop/srv/pom.xml @@ -33,6 +33,12 @@ test + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + com.sap.cds cds-adapter-odata-v4 diff --git a/samples/bookshop/srv/src/test/java/customer/bookshop/ApplicationTest.java b/samples/bookshop/srv/src/test/java/customer/bookshop/ApplicationTest.java index 9672588..510bdeb 100644 --- a/samples/bookshop/srv/src/test/java/customer/bookshop/ApplicationTest.java +++ b/samples/bookshop/srv/src/test/java/customer/bookshop/ApplicationTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext;