Skip to content

Commit

Permalink
Update versions for Skipper.
Browse files Browse the repository at this point in the history
Change rest docs usage.
  • Loading branch information
corneil authored and jvalkeal committed Apr 8, 2024
1 parent da89b69 commit 047b373
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 42 deletions.
2 changes: 1 addition & 1 deletion spring-cloud-dataflow-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 8 additions & 14 deletions spring-cloud-skipper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,24 @@
<spring-statemachine.version>4.0.0</spring-statemachine.version>
<spring-cloud-deployer.version>3.0.0-SNAPSHOT</spring-cloud-deployer.version>

<zeroturnaround.version>1.15</zeroturnaround.version>
<spring-restdocs.version>2.0.7.RELEASE</spring-restdocs.version>
<java-semver.version>0.9.0</java-semver.version>
<zeroturnaround.version>1.17</zeroturnaround.version>
<spring-restdocs.version>3.0.1</spring-restdocs.version>
<java-semver.version>0.10.2</java-semver.version>

<equalverifier.version>3.14.1</equalverifier.version>
<hibernate.jpa.version>1.0.0.Final</hibernate.jpa.version>
<equalverifier.version>3.15.8</equalverifier.version>

<jacoco-maven-plugin.version>0.8.7</jacoco-maven-plugin.version>
<sonar-maven-plugin.version>3.0.2</sonar-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<sonar-maven-plugin.version>3.11.0.3922</sonar-maven-plugin.version>
<javadoc.opts>-Xdoclint:none</javadoc.opts>

<jmockit.version>1.24</jmockit.version>

<commons-compress.version>1.24.0</commons-compress.version>
<commons-compress.version>1.26.1</commons-compress.version>
<asciidoctor.maven.plugin.version>2.2.4</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>2.3.7</asciidoctorj.pdf.version>
<asciidoctorj.version>2.5.7</asciidoctorj.version>
<jruby.version>9.2.11.1</jruby.version>
<maven-antrun-plugin.version>17</maven-antrun-plugin.version>
<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
<ant-contrib.version>1.0b3</ant-contrib.version>
<ant-nodeps.version>1.8.1</ant-nodeps.version>
<antelopetasks.version>3.2.10</antelopetasks.version>
Expand Down Expand Up @@ -193,11 +192,6 @@
<artifactId>spring-restdocs-core</artifactId>
<version>${spring-restdocs.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>${hibernate.jpa.version}</version>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions spring-cloud-skipper/spring-cloud-skipper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-keyvalue</artifactId>
Expand Down

0 comments on commit 047b373

Please sign in to comment.