From 047b37322339d9cc1dea79ec97fff05bf1c3b761 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Wed, 20 Mar 2024 17:02:48 +0200 Subject: [PATCH] Update versions for Skipper. Change rest docs usage. --- spring-cloud-dataflow-build/pom.xml | 2 +- .../ComposedBatchConfigurer.java | 2 +- spring-cloud-skipper/pom.xml | 22 +++++++------------ .../controller/docs/BaseDocumentation.java | 7 +++--- .../docs/PackageMetadataDocumentation.java | 10 ++++++--- .../statemachine/StateMachineTests.java | 21 +++++------------- .../migration/AbstractSkipperSmokeTest.java | 3 ++- .../spring-cloud-skipper/pom.xml | 4 ---- 8 files changed, 29 insertions(+), 42 deletions(-) diff --git a/spring-cloud-dataflow-build/pom.xml b/spring-cloud-dataflow-build/pom.xml index bd13882baf..a3b3e1f880 100644 --- a/spring-cloud-dataflow-build/pom.xml +++ b/spring-cloud-dataflow-build/pom.xml @@ -51,7 +51,7 @@ 3.4.1 3.0.1 3.3.0 - 1.8 + 3.1.0 3.0.0 1.6.0 3.3.1 diff --git a/spring-cloud-dataflow-composed-task-runner/src/main/java/org/springframework/cloud/dataflow/composedtaskrunner/ComposedBatchConfigurer.java b/spring-cloud-dataflow-composed-task-runner/src/main/java/org/springframework/cloud/dataflow/composedtaskrunner/ComposedBatchConfigurer.java index f98b372ce9..12f2118cf0 100644 --- a/spring-cloud-dataflow-composed-task-runner/src/main/java/org/springframework/cloud/dataflow/composedtaskrunner/ComposedBatchConfigurer.java +++ b/spring-cloud-dataflow-composed-task-runner/src/main/java/org/springframework/cloud/dataflow/composedtaskrunner/ComposedBatchConfigurer.java @@ -25,7 +25,7 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; -import org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer; + import org.springframework.boot.autoconfigure.batch.BatchProperties; import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; import org.springframework.cloud.dataflow.composedtaskrunner.properties.ComposedTaskProperties; diff --git a/spring-cloud-skipper/pom.xml b/spring-cloud-skipper/pom.xml index 43871c8a22..1914e1db5e 100644 --- a/spring-cloud-skipper/pom.xml +++ b/spring-cloud-skipper/pom.xml @@ -27,25 +27,24 @@ 4.0.0 3.0.0-SNAPSHOT - 1.15 - 2.0.7.RELEASE - 0.9.0 + 1.17 + 3.0.1 + 0.10.2 - 3.14.1 - 1.0.0.Final + 3.15.8 - 0.8.7 - 3.0.2 + 0.8.11 + 3.11.0.3922 -Xdoclint:none 1.24 - 1.24.0 + 1.26.1 2.2.4 2.3.7 2.5.7 9.2.11.1 - 17 + 3.1.0 1.0b3 1.8.1 3.2.10 @@ -193,11 +192,6 @@ spring-restdocs-core ${spring-restdocs.version} - - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - ${hibernate.jpa.version} - nl.jqno.equalsverifier equalsverifier diff --git a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/BaseDocumentation.java b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/BaseDocumentation.java index 5bc782fd9b..b8271f6670 100644 --- a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/BaseDocumentation.java +++ b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/BaseDocumentation.java @@ -61,7 +61,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationResultHandler; import org.springframework.restdocs.payload.FieldDescriptor; import org.springframework.restdocs.payload.ResponseFieldsSnippet; -import org.springframework.restdocs.request.RequestParametersSnippet; +import org.springframework.restdocs.request.QueryParametersSnippet; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @@ -77,7 +77,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; + /** * Sets up Spring Rest Docs via {@link #setupMocks()} and also provides common snippets to @@ -154,7 +155,7 @@ public abstract class BaseDocumentation { /** * Snippet for common pagination-related request parameters. */ - protected final RequestParametersSnippet paginationRequestParameterProperties = requestParameters( + protected final QueryParametersSnippet paginationRequestParameterProperties = queryParameters( parameterWithName("page").description("The zero-based page number (optional)"), parameterWithName("size").description("The requested page size (optional)")); protected RestDocumentationResultHandler documentationHandler; diff --git a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/PackageMetadataDocumentation.java b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/PackageMetadataDocumentation.java index 7432c221c5..a5632615d3 100644 --- a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/PackageMetadataDocumentation.java +++ b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/controller/docs/PackageMetadataDocumentation.java @@ -31,7 +31,7 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -159,7 +159,9 @@ public void getPackageMetadataSearchFindByName() throws Exception { .andDo(print()) .andExpect(status().isOk()) .andDo(this.documentationHandler.document( - requestParameters(parameterWithName("name").description("The name of the Package")), + queryParameters( + parameterWithName("name").description("The name of the Package") + ), responseFields( fieldWithPath("_embedded.packageMetadata[].apiVersion") .description("The Package Index spec version this file is based on"), @@ -204,7 +206,9 @@ public void getPackageMetadataSearchFindByNameContainingIgnoreCase() throws Exce .andDo(print()) .andExpect(status().isOk()) .andDo(this.documentationHandler.document( - requestParameters(parameterWithName("name").description("The name of the Package")), + queryParameters( + parameterWithName("name").description("The name of the Package") + ), responseFields( fieldWithPath("_embedded.packageMetadata[].apiVersion") .description("The Package Index spec version this file is based on"), diff --git a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/statemachine/StateMachineTests.java b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/statemachine/StateMachineTests.java index db8019269b..6b0c89d692 100644 --- a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/statemachine/StateMachineTests.java +++ b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/test/java/org/springframework/cloud/skipper/server/statemachine/StateMachineTests.java @@ -16,7 +16,6 @@ package org.springframework.cloud.skipper.server.statemachine; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.util.ArrayList; import org.junit.Ignore; @@ -27,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.cloud.skipper.domain.AbstractEntity; import org.springframework.cloud.skipper.domain.DeleteProperties; import org.springframework.cloud.skipper.domain.Info; import org.springframework.cloud.skipper.domain.InstallProperties; @@ -598,7 +598,7 @@ private Package createPkg() { PackageMetadata packageMetadata1 = new PackageMetadata(); packageMetadata1.setApiVersion("skipper.spring.io/v1"); packageMetadata1.setKind("SpringCloudDeployerApplication"); - setId(PackageMetadata.class, packageMetadata1, "id", 1L); + setId(AbstractEntity.class, packageMetadata1, "id", 1L); packageMetadata1.setRepositoryId(1L); packageMetadata1.setName("package1"); packageMetadata1.setVersion("1.0.0"); @@ -608,19 +608,10 @@ private Package createPkg() { } private static void setId(Class clazz, Object instance, String fieldName, Object value) { - try { - Field field = ReflectionUtils.findField(clazz, fieldName); - field.setAccessible(true); - int modifiers = field.getModifiers(); - Field modifierField = field.getClass().getDeclaredField("modifiers"); - modifiers = modifiers & ~Modifier.FINAL; - modifierField.setAccessible(true); - modifierField.setInt(field, modifiers); - ReflectionUtils.setField(field, instance, value); - } - catch (ReflectiveOperationException e) { - throw new IllegalArgumentException(e); - } + Field field = ReflectionUtils.findField(clazz, fieldName); + assertThat(field).isNotNull(); + field.setAccessible(true); + ReflectionUtils.setField(field, instance, value); } @Test diff --git a/spring-cloud-skipper/spring-cloud-skipper-server/src/test/java/org/springframework/cloud/skipper/server/db/migration/AbstractSkipperSmokeTest.java b/spring-cloud-skipper/spring-cloud-skipper-server/src/test/java/org/springframework/cloud/skipper/server/db/migration/AbstractSkipperSmokeTest.java index 82c3f4da0e..37f78d7607 100644 --- a/spring-cloud-skipper/spring-cloud-skipper-server/src/test/java/org/springframework/cloud/skipper/server/db/migration/AbstractSkipperSmokeTest.java +++ b/spring-cloud-skipper/spring-cloud-skipper-server/src/test/java/org/springframework/cloud/skipper/server/db/migration/AbstractSkipperSmokeTest.java @@ -16,8 +16,9 @@ package org.springframework.cloud.skipper.server.db.migration; import java.util.Collections; -import javax.persistence.EntityManagerFactory; + +import jakarta.persistence.EntityManagerFactory; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-cloud-skipper/spring-cloud-skipper/pom.xml b/spring-cloud-skipper/spring-cloud-skipper/pom.xml index 6a466cd29d..803929b8cc 100644 --- a/spring-cloud-skipper/spring-cloud-skipper/pom.xml +++ b/spring-cloud-skipper/spring-cloud-skipper/pom.xml @@ -27,10 +27,6 @@ org.springframework.boot spring-boot-starter-validation - - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - org.springframework.data spring-data-keyvalue