From 28b65a290dab663b78b6e575c23956359cafa8cc Mon Sep 17 00:00:00 2001 From: Ammar Bikic Date: Thu, 30 Jan 2020 13:44:25 +0100 Subject: [PATCH] Update Spring Boot to 2.3.2 -Update Spring Cloud to Hoxton.SR7 -Replace ResourceSupport by RepresentationModel (Spring Hateoas 1.0) -Replace ControllerLinkBuilder by WebMvcLinkBuilder (Spring Hateoas 1.0) -Move getId() from Identifiable to BaseEntity (Spring Hateoas 1.0) -Remove hamcrest.Factory -Use static Sort.by reference -Place http security anyRequest().authenticated() -Replace MockMvcRequestBuilders.fileUpload by MockMvcRequestBuilders.multipart -Deprecate MEDIA_TYPE_CBOR_UTF8 -Replace MEDIA_TYPE_CBOR_UTF8 by MEDIA_TYPE_CBOR in tests -Replace HAL_JSON_UTF8 by HAL_JSON in tests -Replace APPLICATION_JSON_UTF8 by APPLICATION_JSON in tests -Use org.mockito.junit.MockitoJUnitRunner -Remove overridden dependency versions -Removing not needed comments in pom.xml -Downgrade flyway-core to be MySQL 5.6 compatible -Add maven-site-plugin since it was removed with spring-boot 2.3 -Set servlet encoding properties -Introducing Test that verifies the charset inside the content-type of a response -Add @DirtiesContext to CorsTest and ContentTypeTest -Add content-type mockmvc test with adapted mockmvc config -Move encoding.force property to test class -Switch expected and actual parameter values in content-type test -Delete deprecated content-type test with TestRestTemplate -Exclude JUnit5 from spring-boot-starter-test -Upgrade allure-junit4 to 2.13.5 -Add aspectjweaver 1.9.6 to surefire test execution -Add flyway-core version to property -Use getRequiredLink() within MgmtBaseEntity.getId() Signed-off-by: Ammar Bikic --- docs/pom.xml | 2 +- .../pom.xml | 2 +- hawkbit-autoconfigure/pom.xml | 2 +- .../SecurityManagedConfiguration.java | 5 +- hawkbit-core/pom.xml | 2 +- .../PropertyBasedArtifactUrlHandlerTest.java | 2 +- .../cache/DefaultDownloadIdCacheTest.java | 2 +- hawkbit-dmf/hawkbit-dmf-amqp/pom.xml | 3 +- .../hawkbit/amqp/BaseAmqpServiceTest.java | 2 +- .../matcher/SoftwareModuleJsonMatcher.java | 2 - hawkbit-dmf/hawkbit-dmf-api/pom.xml | 2 +- hawkbit-dmf/hawkbit-dmf-rabbitmq-test/pom.xml | 2 +- hawkbit-dmf/pom.xml | 2 +- hawkbit-http-security/pom.xml | 2 +- ...SourceTrustAuthenticationProviderTest.java | 2 +- .../hawkbit-repository-api/pom.xml | 6 +- .../repository/ArtifactManagement.java | 5 +- .../hawkbit/repository/model/BaseEntity.java | 9 +- .../MaintenanceScheduleHelperTest.java | 2 +- .../hawkbit-repository-core/pom.xml | 2 +- .../builder/AbstractBaseEntityBuilder.java | 6 +- .../hawkbit-repository-jpa/pom.xml | 2 +- .../jpa/JpaControllerManagement.java | 2 +- .../repository/jpa/JpaRolloutManagement.java | 2 +- .../RepositoryApplicationConfiguration.java | 9 +- .../specifications/TargetSpecifications.java | 3 +- .../resources/hawkbit-jpa-defaults.properties | 1 + .../repository/jpa/RolloutManagementTest.java | 26 +-- .../SpecificationsBuilderTest.java | 2 +- .../hawkbit-repository-test/pom.xml | 2 +- .../test/matcher/BaseEntityMatcher.java | 2 - .../test/util/AbstractIntegrationTest.java | 2 +- .../util/JpaTestRepositoryManagement.java | 2 +- hawkbit-repository/pom.xml | 2 +- hawkbit-rest/hawkbit-ddi-api/pom.xml | 2 +- .../hawkbit/ddi/json/model/DdiArtifact.java | 4 +- .../ddi/json/model/DdiControllerBase.java | 4 +- .../ddi/json/model/DdiDeploymentBase.java | 4 +- .../ddi/rest/api/DdiRestConstants.java | 3 + hawkbit-rest/hawkbit-ddi-resource/pom.xml | 37 ++-- .../rest/resource/DataConversionHelper.java | 14 +- .../rest/resource/DdiCancelActionTest.java | 24 +-- .../ddi/rest/resource/DdiConfigDataTest.java | 8 +- .../rest/resource/DdiDeploymentBaseTest.java | 10 +- .../rest/resource/DdiRootControllerTest.java | 16 +- hawkbit-rest/hawkbit-mgmt-api/pom.xml | 6 +- .../mgmt/json/model/MgmtBaseEntity.java | 15 +- .../hawkbit/mgmt/json/model/PagedList.java | 4 +- .../model/distributionset/MgmtActionId.java | 12 +- .../MgmtTargetAssignmentResponseBody.java | 5 +- .../MgmtSystemTenantConfigurationValue.java | 4 +- hawkbit-rest/hawkbit-mgmt-resource/pom.xml | 3 +- .../resource/MgmtDistributionSetMapper.java | 4 +- .../MgmtDistributionSetTypeMapper.java | 4 +- .../mgmt/rest/resource/MgmtRolloutMapper.java | 4 +- .../resource/MgmtSoftwareModuleMapper.java | 4 +- .../MgmtSoftwareModuleTypeMapper.java | 4 +- .../mgmt/rest/resource/MgmtTagMapper.java | 4 +- .../resource/MgmtTargetFilterQueryMapper.java | 4 +- .../mgmt/rest/resource/MgmtTargetMapper.java | 4 +- .../resource/MgmtTenantManagementMapper.java | 4 +- .../mgmt/rest/resource/PagingUtility.java | 52 ++--- .../rest/resource/MgmtContentTypeTest.java | 181 ++++++++++++++++++ .../MgmtDistributionSetResourceTest.java | 10 +- .../MgmtDistributionSetTagResourceTest.java | 12 +- .../MgmtDistributionSetTypeResourceTest.java | 14 +- .../resource/MgmtRolloutResourceTest.java | 52 ++--- .../MgmtSoftwareModuleResourceTest.java | 68 +++---- .../MgmtSoftwareModuleTypeResourceTest.java | 10 +- .../rest/resource/MgmtTargetResourceTest.java | 6 +- .../resource/MgmtTargetTagResourceTest.java | 12 +- .../src/test/resources/mgmt-test.properties | 1 + hawkbit-rest/hawkbit-rest-core/pom.xml | 2 +- .../hawkbit/rest/data/ResponseList.java | 4 +- .../rest/AbstractRestIntegrationTest.java | 5 + ...ExcludePathAwareShallowETagFilterTest.java | 2 +- hawkbit-rest/hawkbit-rest-docs/pom.xml | 2 +- ...butionSetTagResourceDocumentationTest.java | 14 +- ...DistributionSetTypesDocumentationTest.java | 24 +-- .../DistributionSetsDocumentationTest.java | 44 ++--- .../RolloutResourceDocumentationTest.java | 22 +-- .../SoftwaremoduleTypesDocumentationTest.java | 4 +- .../SoftwaremodulesDocumentationTest.java | 39 ++-- .../TargetResourceDocumentationTest.java | 20 +- .../TargetTagResourceDocumentationTest.java | 14 +- hawkbit-rest/pom.xml | 2 +- hawkbit-runtime/hawkbit-update-server/pom.xml | 2 +- .../src/main/resources/application.properties | 5 + .../org/eclipse/hawkbit/app/CorsTest.java | 4 +- hawkbit-runtime/pom.xml | 2 +- hawkbit-security-core/pom.xml | 2 +- .../org/eclipse/hawkbit/util/IpUtilTest.java | 2 +- hawkbit-security-integration/pom.xml | 2 +- ...PreAuthenticatedAnonymousDownloadTest.java | 2 +- ...AuthenticatedSecurityHeaderFilterTest.java | 2 +- .../hawkbit-boot-starter-ddi-api/pom.xml | 2 +- .../hawkbit-boot-starter-dmf-api/pom.xml | 2 +- .../hawkbit-boot-starter-mgmt-api/pom.xml | 2 +- .../hawkbit-boot-starter-mgmt-ui/pom.xml | 2 +- hawkbit-starters/hawkbit-boot-starter/pom.xml | 2 +- hawkbit-starters/pom.xml | 2 +- hawkbit-test-report/pom.xml | 2 +- hawkbit-ui/pom.xml | 2 +- .../common/tagdetails/AbstractTagToken.java | 7 +- .../state/ArtifactUploadStateTest.java | 2 +- pom.xml | 87 ++++++--- 106 files changed, 664 insertions(+), 419 deletions(-) create mode 100644 hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtContentTypeTest.java diff --git a/docs/pom.xml b/docs/pom.xml index 0a5c7f1da..bb420d72d 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT docs pom diff --git a/hawkbit-artifact-repository-filesystem/pom.xml b/hawkbit-artifact-repository-filesystem/pom.xml index e6d9fc090..b03de4c18 100644 --- a/hawkbit-artifact-repository-filesystem/pom.xml +++ b/hawkbit-artifact-repository-filesystem/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-artifact-repository-filesystem hawkBit :: Artifact Repository :: Filesystem diff --git a/hawkbit-autoconfigure/pom.xml b/hawkbit-autoconfigure/pom.xml index a2c0ede90..43571acc2 100644 --- a/hawkbit-autoconfigure/pom.xml +++ b/hawkbit-autoconfigure/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-autoconfigure hawkBit :: Spring Boot Autoconfigure diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java index 9b1be1ed4..d237ab18f 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java @@ -523,9 +523,8 @@ public class SecurityManagedConfiguration { httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and(); } - httpSec.authorizeRequests().anyRequest().authenticated() - .antMatchers(MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/**") - .hasAnyAuthority(SpPermission.SYSTEM_ADMIN); + httpSec.authorizeRequests().antMatchers(MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/**") + .hasAnyAuthority(SpPermission.SYSTEM_ADMIN).anyRequest().authenticated(); if (oidcBearerTokenAuthenticationFilter != null) { diff --git a/hawkbit-core/pom.xml b/hawkbit-core/pom.xml index 81fc9d559..0c6784dca 100644 --- a/hawkbit-core/pom.xml +++ b/hawkbit-core/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-core hawkBit :: Core diff --git a/hawkbit-core/src/test/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandlerTest.java b/hawkbit-core/src/test/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandlerTest.java index 463701dd1..355639d73 100644 --- a/hawkbit-core/src/test/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandlerTest.java +++ b/hawkbit-core/src/test/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandlerTest.java @@ -20,7 +20,7 @@ import org.eclipse.hawkbit.api.URLPlaceholder.SoftwareData; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import io.qameta.allure.Description; import io.qameta.allure.Feature; diff --git a/hawkbit-core/src/test/java/org/eclipse/hawkbit/cache/DefaultDownloadIdCacheTest.java b/hawkbit-core/src/test/java/org/eclipse/hawkbit/cache/DefaultDownloadIdCacheTest.java index cfb94b4a7..69c3a7a46 100644 --- a/hawkbit-core/src/test/java/org/eclipse/hawkbit/cache/DefaultDownloadIdCacheTest.java +++ b/hawkbit-core/src/test/java/org/eclipse/hawkbit/cache/DefaultDownloadIdCacheTest.java @@ -18,7 +18,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.cache.support.SimpleValueWrapper; diff --git a/hawkbit-dmf/hawkbit-dmf-amqp/pom.xml b/hawkbit-dmf/hawkbit-dmf-amqp/pom.xml index fd11410eb..c6b140b9a 100644 --- a/hawkbit-dmf/hawkbit-dmf-amqp/pom.xml +++ b/hawkbit-dmf/hawkbit-dmf-amqp/pom.xml @@ -15,13 +15,12 @@ org.eclipse.hawkbit hawkbit-dmf-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-dmf-amqp hawkBit :: DMF :: AMQP 0.9 Implementation - org.eclipse.hawkbit hawkbit-repository-api diff --git a/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java b/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java index d05fb42a1..8c16f41ef 100644 --- a/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java +++ b/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java @@ -21,7 +21,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.amqp.core.Message; import org.springframework.amqp.core.MessageProperties; import org.springframework.amqp.rabbit.core.RabbitTemplate; diff --git a/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/matcher/SoftwareModuleJsonMatcher.java b/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/matcher/SoftwareModuleJsonMatcher.java index f7cff9ed6..00d2f6031 100644 --- a/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/matcher/SoftwareModuleJsonMatcher.java +++ b/hawkbit-dmf/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/matcher/SoftwareModuleJsonMatcher.java @@ -16,7 +16,6 @@ import org.eclipse.hawkbit.dmf.json.model.DmfSoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; /** * Set matcher for {@link SoftwareModule} and a list of @@ -44,7 +43,6 @@ public final class SoftwareModuleJsonMatcher { * @param expectedModules * the json sofware modules. */ - @Factory public static SoftwareModulesMatcher containsExactly(final List expectedModules) { return new SoftwareModulesMatcher(expectedModules); } diff --git a/hawkbit-dmf/hawkbit-dmf-api/pom.xml b/hawkbit-dmf/hawkbit-dmf-api/pom.xml index 69bc7e823..a1de14683 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/pom.xml +++ b/hawkbit-dmf/hawkbit-dmf-api/pom.xml @@ -15,7 +15,7 @@ org.eclipse.hawkbit hawkbit-dmf-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-dmf-api hawkBit :: DMF :: API diff --git a/hawkbit-dmf/hawkbit-dmf-rabbitmq-test/pom.xml b/hawkbit-dmf/hawkbit-dmf-rabbitmq-test/pom.xml index ed11d6f3e..53ddb99d0 100644 --- a/hawkbit-dmf/hawkbit-dmf-rabbitmq-test/pom.xml +++ b/hawkbit-dmf/hawkbit-dmf-rabbitmq-test/pom.xml @@ -16,7 +16,7 @@ org.eclipse.hawkbit hawkbit-dmf-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-dmf-rabbitmq-test hawkBit :: DMF :: RabbitMq Test module diff --git a/hawkbit-dmf/pom.xml b/hawkbit-dmf/pom.xml index d888959d4..c00f081c1 100644 --- a/hawkbit-dmf/pom.xml +++ b/hawkbit-dmf/pom.xml @@ -13,7 +13,7 @@ 4.0.0 org.eclipse.hawkbit - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-parent hawkbit-dmf-parent diff --git a/hawkbit-http-security/pom.xml b/hawkbit-http-security/pom.xml index 3a02d2020..ef4341357 100644 --- a/hawkbit-http-security/pom.xml +++ b/hawkbit-http-security/pom.xml @@ -12,7 +12,7 @@ 4.0.0 hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT org.eclipse.hawkbit hawkbit-http-security diff --git a/hawkbit-http-security/src/test/java/org/eclipse/hawkbit/security/PreAuthTokenSourceTrustAuthenticationProviderTest.java b/hawkbit-http-security/src/test/java/org/eclipse/hawkbit/security/PreAuthTokenSourceTrustAuthenticationProviderTest.java index 8a423a920..88d9591a6 100644 --- a/hawkbit-http-security/src/test/java/org/eclipse/hawkbit/security/PreAuthTokenSourceTrustAuthenticationProviderTest.java +++ b/hawkbit-http-security/src/test/java/org/eclipse/hawkbit/security/PreAuthTokenSourceTrustAuthenticationProviderTest.java @@ -17,7 +17,7 @@ import java.util.Arrays; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.InsufficientAuthenticationException; import org.springframework.security.core.Authentication; diff --git a/hawkbit-repository/hawkbit-repository-api/pom.xml b/hawkbit-repository/hawkbit-repository-api/pom.xml index 620aa7f56..37641fb8c 100644 --- a/hawkbit-repository/hawkbit-repository-api/pom.xml +++ b/hawkbit-repository/hawkbit-repository-api/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-repository - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-repository-api hawkBit :: Repository :: API @@ -25,6 +25,10 @@ hawkbit-security-core ${project.version} + + com.fasterxml.jackson.core + jackson-annotations + javax.validation validation-api diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ArtifactManagement.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ArtifactManagement.java index 45b05718f..e27a098af 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ArtifactManagement.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ArtifactManagement.java @@ -28,7 +28,6 @@ import org.eclipse.hawkbit.repository.model.ArtifactUpload; import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.hateoas.Identifiable; import org.springframework.security.access.prepost.PreAuthorize; /** @@ -70,7 +69,7 @@ public interface ArtifactManagement { /** * Garbage collects artifact binaries if only referenced by given - * {@link SoftwareModule#getId()} or {@link SoftwareModules} that are marged + * {@link SoftwareModule#getId()} or {@link SoftwareModule}'s that are marked * as deleted. * * @@ -98,7 +97,7 @@ public interface ArtifactManagement { void delete(long id); /** - * Searches for {@link Artifact} with given {@link Identifiable}. + * Searches for {@link Artifact} with given {@link Long}. * * @param id * to search for diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/BaseEntity.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/BaseEntity.java index 7c56647f6..ed7fd3671 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/BaseEntity.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/BaseEntity.java @@ -11,18 +11,21 @@ package org.eclipse.hawkbit.repository.model; import java.io.Serializable; import java.util.concurrent.TimeUnit; -import org.springframework.hateoas.Identifiable; - /** * Core information of all entities. * */ -public interface BaseEntity extends Serializable, Identifiable { +public interface BaseEntity extends Serializable { static Long getIdOrNull(final BaseEntity entity) { return entity == null ? null : entity.getId(); } + /** + * @return the unique identifier of the {@link BaseEntity}. + */ + Long getId(); + /** * @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity} * was created. diff --git a/hawkbit-repository/hawkbit-repository-api/src/test/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelperTest.java b/hawkbit-repository/hawkbit-repository-api/src/test/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelperTest.java index e92d0f97b..d66eabda8 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/test/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelperTest.java +++ b/hawkbit-repository/hawkbit-repository-api/src/test/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelperTest.java @@ -47,7 +47,7 @@ public class MaintenanceScheduleHelperTest { final String duration = "10"; assertThatThrownBy(() -> MaintenanceScheduleHelper.validateDuration(duration)) .isInstanceOf(InvalidMaintenanceScheduleException.class).hasMessage("Provided duration is not valid") - .extracting("durationErrorIndex").containsExactly(2); + .extracting("durationErrorIndex").isEqualTo(2); } @Test diff --git a/hawkbit-repository/hawkbit-repository-core/pom.xml b/hawkbit-repository/hawkbit-repository-core/pom.xml index 87696f193..3679ab3fb 100644 --- a/hawkbit-repository/hawkbit-repository-core/pom.xml +++ b/hawkbit-repository/hawkbit-repository-core/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-repository - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-repository-core hawkBit :: Repository :: Core Implementation Support diff --git a/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/builder/AbstractBaseEntityBuilder.java b/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/builder/AbstractBaseEntityBuilder.java index 53bf9ed2e..1a76f0211 100644 --- a/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/builder/AbstractBaseEntityBuilder.java +++ b/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/builder/AbstractBaseEntityBuilder.java @@ -8,15 +8,11 @@ */ package org.eclipse.hawkbit.repository.builder; -import org.springframework.hateoas.Identifiable; - -public abstract class AbstractBaseEntityBuilder implements Identifiable { +public abstract class AbstractBaseEntityBuilder { protected Long id; - @Override public Long getId() { return id; } - } diff --git a/hawkbit-repository/hawkbit-repository-jpa/pom.xml b/hawkbit-repository/hawkbit-repository-jpa/pom.xml index 86e543cee..5c5db5718 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/pom.xml +++ b/hawkbit-repository/hawkbit-repository-jpa/pom.xml @@ -13,7 +13,7 @@ 4.0.0 org.eclipse.hawkbit - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-repository hawkbit-repository-jpa diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java index de18b4e6e..ac61e96d1 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java @@ -914,7 +914,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont ? RepositoryConstants.MAX_ACTION_HISTORY_MSG_COUNT : messageCount; - final PageRequest pageable = PageRequest.of(0, limit, new Sort(Direction.DESC, "occurredAt")); + final PageRequest pageable = PageRequest.of(0, limit, Sort.by(Direction.DESC, "occurredAt")); final Page messages = actionStatusRepository.findMessagesByActionIdAndMessageNotLike(pageable, actionId, RepositoryConstants.SERVER_MESSAGE_PREFIX + "%"); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java index 78ee099ee..2f319648e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java @@ -333,7 +333,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement { LOGGER.debug("handleCreateRollout called for rollout {}", rollout.getId()); final List rolloutGroups = rolloutGroupManagement.findByRollout( - PageRequest.of(0, quotaManagement.getMaxRolloutGroupsPerRollout(), new Sort(Direction.ASC, "id")), + PageRequest.of(0, quotaManagement.getMaxRolloutGroupsPerRollout(), Sort.by(Direction.ASC, "id")), rollout.getId()).getContent(); int readyGroups = 0; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java index 91e36f5c0..ece0e4ef0 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java @@ -145,9 +145,8 @@ import com.google.common.collect.Maps; public class RepositoryApplicationConfiguration extends JpaBaseConfiguration { protected RepositoryApplicationConfiguration(final DataSource dataSource, final JpaProperties properties, - final ObjectProvider jtaTransactionManagerProvider, - final ObjectProvider transactionManagerCustomizers) { - super(dataSource, properties, jtaTransactionManagerProvider, transactionManagerCustomizers); + final ObjectProvider jtaTransactionManagerProvider) { + super(dataSource, properties, jtaTransactionManagerProvider); } @Bean @@ -410,12 +409,12 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration { /** * {@link MultiTenantJpaTransactionManager} bean. * - * @see org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#transactionManager() + * @see org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#transactionManager(ObjectProvider) * @return a new {@link PlatformTransactionManager} */ @Override @Bean - public PlatformTransactionManager transactionManager() { + public PlatformTransactionManager transactionManager(ObjectProvider transactionManagerCustomizers) { return new MultiTenantJpaTransactionManager(); } diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/TargetSpecifications.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/TargetSpecifications.java index 5e92e5d41..f7f94682f 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/TargetSpecifications.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/TargetSpecifications.java @@ -39,7 +39,6 @@ import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.TargetTag; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.springframework.data.jpa.domain.Specification; -import org.springframework.data.jpa.domain.Specifications; /** * Specifications class for {@link Target}s. The class provides Spring Data JPQL @@ -178,7 +177,7 @@ public final class TargetSpecifications { * @return the {@link Target} {@link Specification} */ public static Specification likeIdOrNameOrDescriptionOrAttributeValue(final String searchText) { - return Specifications.where(likeIdOrNameOrDescription(searchText)).or(likeAttributeValue(searchText)); + return Specification.where(likeIdOrNameOrDescription(searchText)).or(likeAttributeValue(searchText)); } /** diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/hawkbit-jpa-defaults.properties b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/hawkbit-jpa-defaults.properties index 3adf8567f..aebd7ee5d 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/hawkbit-jpa-defaults.properties +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/resources/hawkbit-jpa-defaults.properties @@ -12,6 +12,7 @@ spring.main.allow-bean-definition-overriding=true ### JPA / Datasource - START spring.jpa.database=H2 spring.jpa.show-sql=false +spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL; # Logging spring.datasource.eclipselink.logging.logger=JavaLogger spring.jpa.properties.eclipselink.logging.level=off diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/RolloutManagementTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/RolloutManagementTest.java index 59183de64..aefcbbe3a 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/RolloutManagementTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/RolloutManagementTest.java @@ -43,10 +43,10 @@ import org.eclipse.hawkbit.repository.event.remote.entity.RolloutUpdatedEvent; import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent; import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent; import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent; +import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException; import org.eclipse.hawkbit.repository.exception.MultiAssignmentIsNotEnabledException; -import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException; import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException; import org.eclipse.hawkbit.repository.jpa.model.JpaAction; import org.eclipse.hawkbit.repository.jpa.model.JpaRollout; @@ -239,13 +239,13 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // verify first group is running final RolloutGroup firstGroup = rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(0, 1, new Sort(Direction.ASC, "id")), createdRollout.getId()) + .findByRollout(new OffsetBasedPageRequest(0, 1, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .getContent().get(0); assertThat(firstGroup.getStatus()).isEqualTo(RolloutGroupStatus.RUNNING); // verify other groups are scheduled final List scheduledGroups = rolloutGroupManagement.findByRollout( - new OffsetBasedPageRequest(1, 100, new Sort(Direction.ASC, "id")), createdRollout.getId()).getContent(); + new OffsetBasedPageRequest(1, 100, Sort.by(Direction.ASC, "id")), createdRollout.getId()).getContent(); scheduledGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED) .as("group which should be in scheduled state is in " + group.getStatus() + " state")); // verify that the first group actions has been started and are in state @@ -283,7 +283,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // verify that now the first and the second group are in running state final List runningRolloutGroups = rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(0, 2, new Sort(Direction.ASC, "id")), createdRollout.getId()) + .findByRollout(new OffsetBasedPageRequest(0, 2, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .getContent(); runningRolloutGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.RUNNING) .as("group should be in running state because it should be started but it is in " + group.getStatus() @@ -291,7 +291,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // verify that the other groups are still in schedule state final List scheduledRolloutGroups = rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(2, 10, new Sort(Direction.ASC, "id")), createdRollout.getId()) + .findByRollout(new OffsetBasedPageRequest(2, 10, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .getContent(); scheduledRolloutGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED) .as("group should be in scheduled state because it should not be started but it is in " @@ -354,7 +354,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { private void checkSecondGroupStatusIsRunning(final Rollout createdRollout) { rolloutManagement.handleRollouts(); final List runningRolloutGroups = rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(0, 10, new Sort(Direction.ASC, "id")), createdRollout.getId()) + .findByRollout(new OffsetBasedPageRequest(0, 10, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .getContent(); assertThat(runningRolloutGroups.get(0).getStatus()).isEqualTo(RolloutGroupStatus.FINISHED); assertThat(runningRolloutGroups.get(1).getStatus()).isEqualTo(RolloutGroupStatus.RUNNING); @@ -431,14 +431,14 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // the first rollout group should be in error state final List errorGroup = rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(0, 1, new Sort(Direction.ASC, "id")), createdRollout.getId()) + .findByRollout(new OffsetBasedPageRequest(0, 1, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .getContent(); assertThat(errorGroup).hasSize(1); assertThat(errorGroup.get(0).getStatus()).isEqualTo(RolloutGroupStatus.ERROR); // all other groups should still be in scheduled state final List scheduleGroups = rolloutGroupManagement.findByRollout( - new OffsetBasedPageRequest(1, 100, new Sort(Direction.ASC, "id")), createdRollout.getId()).getContent(); + new OffsetBasedPageRequest(1, 100, Sort.by(Direction.ASC, "id")), createdRollout.getId()).getContent(); scheduleGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED)); } @@ -472,7 +472,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // all other groups should still be in scheduled state final List scheduleGroups = rolloutGroupManagement.findByRollout( - new OffsetBasedPageRequest(1, 100, new Sort(Direction.ASC, "id")), createdRollout.getId()).getContent(); + new OffsetBasedPageRequest(1, 100, Sort.by(Direction.ASC, "id")), createdRollout.getId()).getContent(); scheduleGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED)); // resume the rollout again after it gets paused by error action @@ -486,7 +486,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // next group should be running again after resuming the rollout final List resumedGroups = rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(1, 1, new Sort(Direction.ASC, "id")), createdRollout.getId()) + .findByRollout(new OffsetBasedPageRequest(1, 1, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .getContent(); assertThat(resumedGroups).hasSize(1); assertThat(resumedGroups.get(0).getStatus()).isEqualTo(RolloutGroupStatus.RUNNING); @@ -522,7 +522,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { // verify all groups are in finished state rolloutGroupManagement - .findByRollout(new OffsetBasedPageRequest(0, 100, new Sort(Direction.ASC, "id")), + .findByRollout(new OffsetBasedPageRequest(0, 100, Sort.by(Direction.ASC, "id")), createdRollout.getId()) .forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.FINISHED)); @@ -998,7 +998,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { rolloutManagement.handleRollouts(); final Page rolloutPage = rolloutManagement - .findAllWithDetailedStatus(new OffsetBasedPageRequest(0, 100, new Sort(Direction.ASC, "name")), false); + .findAllWithDetailedStatus(new OffsetBasedPageRequest(0, 100, Sort.by(Direction.ASC, "name")), false); final List rolloutList = rolloutPage.getContent(); // validate rolloutA -> 6 running and 6 ready @@ -1084,7 +1084,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest { } final Slice rollout = rolloutManagement.findByFiltersWithDetailedStatus( - new OffsetBasedPageRequest(0, 100, new Sort(Direction.ASC, "name")), "Rollout%", false); + new OffsetBasedPageRequest(0, 100, Sort.by(Direction.ASC, "name")), "Rollout%", false); final List rolloutList = rollout.getContent(); assertThat(rolloutList.size()).isEqualTo(5); int i = 1; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/specifications/SpecificationsBuilderTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/specifications/SpecificationsBuilderTest.java index fa8b294ee..a153db471 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/specifications/SpecificationsBuilderTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/specifications/SpecificationsBuilderTest.java @@ -93,7 +93,7 @@ public class SpecificationsBuilderTest { when(criteriaBuilder.equal(any(Path.class), eq("testValue1"))).thenReturn(equalPredicate1); when(criteriaBuilder.equal(any(Path.class), eq("testValue2"))).thenReturn(equalPredicate2); - when(criteriaBuilder.and(eq(equalPredicate1), eq(equalPredicate2))).thenReturn(combinedPredicate); + when(criteriaBuilder.and(eq(equalPredicate2), eq(equalPredicate1))).thenReturn(combinedPredicate); when(root.get("field1")).thenReturn(field1); when(root.get("field2")).thenReturn(field2); diff --git a/hawkbit-repository/hawkbit-repository-test/pom.xml b/hawkbit-repository/hawkbit-repository-test/pom.xml index 9ac0cf751..1b576d611 100644 --- a/hawkbit-repository/hawkbit-repository-test/pom.xml +++ b/hawkbit-repository/hawkbit-repository-test/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-repository - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-repository-test hawkBit :: Repository :: Test Utilities diff --git a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/matcher/BaseEntityMatcher.java b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/matcher/BaseEntityMatcher.java index c83ae8ad1..65b6486a9 100644 --- a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/matcher/BaseEntityMatcher.java +++ b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/matcher/BaseEntityMatcher.java @@ -9,7 +9,6 @@ package org.eclipse.hawkbit.repository.test.matcher; import org.eclipse.hawkbit.repository.model.BaseEntity; -import org.hamcrest.Factory; import org.hamcrest.FeatureMatcher; import org.hamcrest.Matcher; import org.hamcrest.Matchers; @@ -22,7 +21,6 @@ public final class BaseEntityMatcher { private BaseEntityMatcher() { } - @Factory public static Matcher hasId(final Long id) { return new HasIdMatcher(Matchers.equalTo(id)); } diff --git a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java index e2c74b99d..0a0729aac 100644 --- a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java +++ b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/AbstractIntegrationTest.java @@ -112,7 +112,7 @@ import com.google.common.io.Files; public abstract class AbstractIntegrationTest { private static final Logger LOG = LoggerFactory.getLogger(AbstractIntegrationTest.class); - protected static final Pageable PAGE = PageRequest.of(0, 400, new Sort(Direction.ASC, "id")); + protected static final Pageable PAGE = PageRequest.of(0, 400, Sort.by(Direction.ASC, "id")); protected static final URI LOCALHOST = URI.create("http://127.0.0.1"); diff --git a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/JpaTestRepositoryManagement.java b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/JpaTestRepositoryManagement.java index fa69a2dfb..894e1d302 100644 --- a/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/JpaTestRepositoryManagement.java +++ b/hawkbit-repository/hawkbit-repository-test/src/main/java/org/eclipse/hawkbit/repository/test/util/JpaTestRepositoryManagement.java @@ -23,7 +23,7 @@ import org.springframework.data.domain.Sort.Direction; public class JpaTestRepositoryManagement { private static final Logger LOGGER = LoggerFactory.getLogger(JpaTestRepositoryManagement.class); - private static final Pageable PAGE = PageRequest.of(0, 400, new Sort(Direction.ASC, "id")); + private static final Pageable PAGE = PageRequest.of(0, 400, Sort.by(Direction.ASC, "id")); private final TenantAwareCacheManager cacheManager; diff --git a/hawkbit-repository/pom.xml b/hawkbit-repository/pom.xml index ec8e4e216..22030b5a0 100644 --- a/hawkbit-repository/pom.xml +++ b/hawkbit-repository/pom.xml @@ -13,7 +13,7 @@ 4.0.0 org.eclipse.hawkbit - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-parent hawkbit-repository diff --git a/hawkbit-rest/hawkbit-ddi-api/pom.xml b/hawkbit-rest/hawkbit-ddi-api/pom.xml index 5f8fd6613..d314a0db0 100644 --- a/hawkbit-rest/hawkbit-ddi-api/pom.xml +++ b/hawkbit-rest/hawkbit-ddi-api/pom.xml @@ -15,7 +15,7 @@ org.eclipse.hawkbit hawkbit-rest-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-ddi-api hawkBit :: REST :: DDI API diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java index 1f6facea6..06e75eb3f 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifact.java @@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ddi.json.model; import javax.validation.constraints.NotNull; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * . */ @JsonIgnoreProperties(ignoreUnknown = true) -public class DdiArtifact extends ResourceSupport { +public class DdiArtifact extends RepresentationModel { @NotNull @JsonProperty diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java index b20768faa..b1c86547b 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java @@ -8,7 +8,7 @@ */ package org.eclipse.hawkbit.ddi.json.model; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class DdiControllerBase extends ResourceSupport { +public class DdiControllerBase extends RepresentationModel { @JsonProperty private DdiConfig config; diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java index 331d63688..67f20af25 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java @@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ddi.json.model; import javax.validation.constraints.NotNull; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; */ @JsonIgnoreProperties(ignoreUnknown = true) @JsonPropertyOrder({ "id", "deployment", "actionHistory" }) -public class DdiDeploymentBase extends ResourceSupport { +public class DdiDeploymentBase extends RepresentationModel { @JsonProperty("id") @NotNull diff --git a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRestConstants.java b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRestConstants.java index cf04baa45..90e0b26df 100644 --- a/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRestConstants.java +++ b/hawkbit-rest/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRestConstants.java @@ -60,7 +60,10 @@ public final class DdiRestConstants { * Media type for CBOR content with strings encoded as UTF-8. Technically * redundant since CBOR always uses UTF-8, but Spring will append it * regardless. + * @deprecated Since the Spring Framework (v5.2.4.RELEASE) dropped the charset attribute + * from content type headers, please use {@link DdiRestConstants#MEDIA_TYPE_CBOR} instead. */ + @Deprecated public static final String MEDIA_TYPE_CBOR_UTF8 = "application/cbor;charset=UTF-8"; private DdiRestConstants() { diff --git a/hawkbit-rest/hawkbit-ddi-resource/pom.xml b/hawkbit-rest/hawkbit-ddi-resource/pom.xml index ce6b4f323..6e7b609e4 100644 --- a/hawkbit-rest/hawkbit-ddi-resource/pom.xml +++ b/hawkbit-rest/hawkbit-ddi-resource/pom.xml @@ -9,17 +9,18 @@ --> - - 4.0.0 - - org.eclipse.hawkbit - hawkbit-rest-parent - 0.3.0-SNAPSHOT - - hawkbit-ddi-resource - hawkBit :: REST :: DDI Resources - + + 4.0.0 + + org.eclipse.hawkbit + hawkbit-rest-parent + 0.4.0-SNAPSHOT + + hawkbit-ddi-resource + hawkBit :: REST :: DDI Resources + org.eclipse.hawkbit @@ -39,7 +40,7 @@ org.springframework.plugin spring-plugin-core - + com.google.guava guava @@ -49,10 +50,10 @@ javax.servlet-api provided - - - - + + + + org.eclipse.hawkbit hawkbit-repository-test ${project.version} @@ -107,10 +108,10 @@ allure-junit4 test - + org.springframework spring-context-support test - + diff --git a/hawkbit-rest/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java b/hawkbit-rest/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java index 1e915424d..abcb81613 100644 --- a/hawkbit-rest/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java +++ b/hawkbit-rest/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java @@ -34,7 +34,7 @@ import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.rest.data.ResponseList; import org.eclipse.hawkbit.tenancy.TenantAware; import org.springframework.hateoas.Link; -import org.springframework.hateoas.mvc.ControllerLinkBuilder; +import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder; import org.springframework.http.HttpRequest; import org.springframework.util.CollectionUtils; @@ -115,8 +115,8 @@ public final class DataConversionHelper { if (action != null) { if (action.isCancelingOrCanceled()) { - result.add(ControllerLinkBuilder - .linkTo(ControllerLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant()) + result.add(WebMvcLinkBuilder + .linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant()) .getControllerCancelAction(tenantAware.getCurrentTenant(), target.getControllerId(), action.getId())) .withRel(DdiRestConstants.CANCEL_ACTION)); @@ -126,8 +126,8 @@ public final class DataConversionHelper { // have changed from 'soft' to 'forced' type and we need to // change the payload of the // response because of eTags. - result.add(ControllerLinkBuilder - .linkTo(ControllerLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant()) + result.add(WebMvcLinkBuilder + .linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant()) .getControllerBasedeploymentAction(tenantAware.getCurrentTenant(), target.getControllerId(), action.getId(), calculateEtag(action), null)) .withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION)); @@ -135,8 +135,8 @@ public final class DataConversionHelper { } if (target.isRequestControllerAttributes()) { - result.add(ControllerLinkBuilder - .linkTo(ControllerLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant()) + result.add(WebMvcLinkBuilder + .linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant()) .putConfigData(null, tenantAware.getCurrentTenant(), target.getControllerId())) .withRel(DdiRestConstants.CONFIG_DATA_ACTION)); } diff --git a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiCancelActionTest.java b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiCancelActionTest.java index a5607db70..da488e7f6 100644 --- a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiCancelActionTest.java +++ b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiCancelActionTest.java @@ -60,7 +60,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { final byte[] result = mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/" + cancelAction.getId(), tenantAware.getCurrentTenant()).accept(DdiRestConstants.MEDIA_TYPE_CBOR)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR_UTF8)) + .andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR)) .andReturn().getResponse().getContentAsByteArray(); assertThat(JsonPathUtils.evaluate(cborToJson(result), "$.id")).isEqualTo(String.valueOf(cancelAction.getId())); assertThat(JsonPathUtils.evaluate(cborToJson(result), "$.cancelAction.stopId")).isEqualTo(String.valueOf(actionId)); @@ -99,7 +99,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/" + actionId, tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id", equalTo(String.valueOf(actionId)))) .andExpect(jsonPath("$.deployment.download", equalTo("forced"))) .andExpect(jsonPath("$.deployment.update", equalTo("forced"))) @@ -139,9 +139,9 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { long current = System.currentTimeMillis(); mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(), - TestdataFactory.DEFAULT_CONTROLLER_ID).accept(MediaTypes.HAL_JSON_UTF8)) + TestdataFactory.DEFAULT_CONTROLLER_ID).accept(MediaTypes.HAL_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.deploymentBase.href", startsWith("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/" @@ -174,7 +174,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { current = System.currentTimeMillis(); mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(), TestdataFactory.DEFAULT_CONTROLLER_ID)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.cancelAction.href", equalTo("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/" @@ -193,7 +193,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/" + cancelAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction.getId())))) .andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId)))); assertThat(targetManagement.getByControllerID(TestdataFactory.DEFAULT_CONTROLLER_ID).get().getLastTargetQuery()) @@ -359,14 +359,14 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/" + cancelAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction.getId())))) .andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId)))); assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(6); mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(), TestdataFactory.DEFAULT_CONTROLLER_ID)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.cancelAction.href", equalTo("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/" @@ -386,14 +386,14 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/" + cancelAction2.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction2.getId())))) .andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId2)))); assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(8); mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(), TestdataFactory.DEFAULT_CONTROLLER_ID)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.cancelAction.href", equalTo("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/" @@ -429,7 +429,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/" + cancelAction3.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction3.getId())))) .andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId3)))); assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(12); @@ -438,7 +438,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest { mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/" + cancelAction3.getId() + "/feedback", tenantAware.getCurrentTenant()) .content(JsonBuilder.cancelActionFeedback(cancelAction3.getId().toString(), "closed")) - .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()); assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(13); diff --git a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiConfigDataTest.java b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiConfigDataTest.java index 15c2157e5..0d9a41b64 100644 --- a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiConfigDataTest.java +++ b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiConfigDataTest.java @@ -79,9 +79,9 @@ public class DdiConfigDataTest extends AbstractDDiApiIntegrationTest { final long current = System.currentTimeMillis(); mvc.perform( - get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()).accept(MediaTypes.HAL_JSON_UTF8)) + get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()).accept(MediaTypes.HAL_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.configData.href", equalTo( "http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/4712/configData"))); @@ -103,9 +103,9 @@ public class DdiConfigDataTest extends AbstractDDiApiIntegrationTest { assertThat(updateControllerAttributes.isRequestControllerAttributes()).isFalse(); mvc.perform( - get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()).accept(MediaTypes.HAL_JSON_UTF8)) + get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()).accept(MediaTypes.HAL_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.configData.href").doesNotExist()); } diff --git a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java index a54e912bf..576caf30b 100644 --- a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java +++ b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java @@ -187,7 +187,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest { final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get(); - getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON_UTF8, ds, artifact, + getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON, ds, artifact, artifactSignature, action.getId(), findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced"); @@ -287,7 +287,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest { final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get(); - getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON_UTF8, ds, + getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON, ds, visibleMetadataOsKey, visibleMetadataOsValue, artifact, artifactSignature, action.getId(), "attempt", "attempt", getOsModule(findDistributionSetByAction)); @@ -347,11 +347,11 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest { final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get(); - getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON_UTF8, ds, artifact, + getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON, ds, artifact, artifactSignature, action.getId(), findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced"); - getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaTypes.HAL_JSON_UTF8, ds, artifact, + getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaTypes.HAL_JSON, ds, artifact, artifactSignature, action.getId(), findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced"); @@ -415,7 +415,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest { final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get(); - getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON_UTF8, ds, "metaDataVisible", + getAndVerifyDeploymentBasePayload(DEFAULT_CONTROLLER_ID, MediaType.APPLICATION_JSON, ds, "metaDataVisible", "withValue", artifact, artifactSignature, action.getId(), "forced", "skip", getOsModule(findDistributionSetByAction)); diff --git a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootControllerTest.java b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootControllerTest.java index 68849dc2e..c5a0a38d5 100644 --- a/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootControllerTest.java +++ b/hawkbit-rest/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootControllerTest.java @@ -88,7 +88,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { public void rootPollResourceCbor() throws Exception { mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()) .accept(DdiRestConstants.MEDIA_TYPE_CBOR)).andDo(MockMvcResultPrinter.print()) - .andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR_UTF8)).andExpect(status().isOk()); + .andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR)).andExpect(status().isOk()); } @Test @@ -96,7 +96,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { public void apiReturnsJSONByDefault() throws Exception { final MvcResult result = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)).andReturn(); + .andExpect(content().contentType(MediaTypes.HAL_JSON)).andReturn(); // verify that we did not specify a content-type in the request, in case // there are any default values @@ -176,7 +176,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { final long current = System.currentTimeMillis(); mvc.perform(get("/default-tenant/controller/v1/4711")).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))); assertThat(targetManagement.getByControllerID("4711").get().getLastTargetQuery()) .isGreaterThanOrEqualTo(current); @@ -210,7 +210,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { securityRule.runAs(WithSpringAuthorityRule.withUser("controller", CONTROLLER_ROLE_ANONYMOUS), () -> { mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:02:00"))); return null; }); @@ -229,7 +229,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { public void rootRsNotModified() throws Exception { final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))).andReturn().getResponse() .getHeader("ETag"); @@ -247,7 +247,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { .perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()) .header("If-None-Match", etag).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.deploymentBase.href", startsWith("http://localhost/" + tenantAware.getCurrentTenant() @@ -278,7 +278,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()) .header("If-None-Match", etagWithFirstUpdate).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))) .andExpect(jsonPath("$._links.deploymentBase.href", startsWith("http://localhost/" + tenantAware.getCurrentTenant() @@ -300,7 +300,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest { final long current = System.currentTimeMillis(); mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))); assertThat(targetManagement.getByControllerID("4711").get().getLastTargetQuery()) diff --git a/hawkbit-rest/hawkbit-mgmt-api/pom.xml b/hawkbit-rest/hawkbit-mgmt-api/pom.xml index 59defdc9d..f1b593d6d 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/pom.xml +++ b/hawkbit-rest/hawkbit-mgmt-api/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-rest-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-mgmt-api hawkBit :: REST :: Management API @@ -24,6 +24,10 @@ org.springframework.hateoas spring-hateoas + + org.springframework + spring-webmvc + org.springframework.boot spring-boot-starter-json diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java index 728734050..1013eb305 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java @@ -8,7 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.json.model; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.Link; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * A json annotated rest model for BaseEntity to RESTful API representation. * */ -public abstract class MgmtBaseEntity extends ResourceSupport { +public abstract class MgmtBaseEntity extends RepresentationModel { @JsonProperty private String createdBy; @@ -31,6 +32,16 @@ public abstract class MgmtBaseEntity extends ResourceSupport { @JsonProperty private Long lastModifiedAt; + /** + * Added for backwards compatibility + * + * @return the unique identifier of the {@link MgmtBaseEntity}. + */ + @JsonIgnore + public Link getId() { + return this.getRequiredLink("self"); + } + /** * @return the createdBy */ diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/PagedList.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/PagedList.java index 534cfa98d..a1009e9bf 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/PagedList.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/PagedList.java @@ -13,7 +13,7 @@ import java.util.List; import javax.validation.constraints.NotNull; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -32,7 +32,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; */ @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(Include.NON_NULL) -public class PagedList extends ResourceSupport { +public class PagedList extends RepresentationModel> { @JsonProperty private final List content; diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java index b0cf945bd..91f259e21 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java @@ -8,24 +8,24 @@ */ package org.eclipse.hawkbit.mgmt.json.model.distributionset; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; + +import java.util.Objects; import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; - /** * Representation of an Action Id as a Json Object with link to the Action resource */ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MgmtActionId extends ResourceSupport { +public class MgmtActionId extends RepresentationModel { private long actionId; diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentResponseBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentResponseBody.java index 04c28dc2f..c0ede3864 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentResponseBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentResponseBody.java @@ -11,11 +11,12 @@ package org.eclipse.hawkbit.mgmt.json.model.distributionset; import java.util.List; import java.util.Objects; +import org.springframework.hateoas.RepresentationModel; + import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; -import org.springframework.hateoas.ResourceSupport; /** * Response Body of Target for assignment operations. @@ -25,7 +26,7 @@ import org.springframework.hateoas.ResourceSupport; */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MgmtTargetAssignmentResponseBody extends ResourceSupport { +public class MgmtTargetAssignmentResponseBody extends RepresentationModel { private int alreadyAssigned; private List assignedActions; diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java index 776b69c09..7c2e33a0f 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.mgmt.json.model.system; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MgmtSystemTenantConfigurationValue extends ResourceSupport { +public class MgmtSystemTenantConfigurationValue extends RepresentationModel { @JsonInclude(Include.ALWAYS) private Object value; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/pom.xml b/hawkbit-rest/hawkbit-mgmt-resource/pom.xml index e78e3c98c..ece6f8591 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/pom.xml +++ b/hawkbit-rest/hawkbit-mgmt-resource/pom.xml @@ -15,7 +15,7 @@ org.eclipse.hawkbit hawkbit-rest-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-mgmt-resource hawkBit :: REST :: Management Resources @@ -40,6 +40,7 @@ org.springframework.plugin spring-plugin-core + ${spring.plugin.core.version} com.google.guava diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetMapper.java index 18127da8a..2a7bb46fb 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.ArrayList; import java.util.Collection; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeMapper.java index f6ca54b10..dfd3b2896 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Collection; import java.util.Collections; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutMapper.java index cd4c6cb28..04e99b6bf 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Collections; import java.util.List; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleMapper.java index d7f006499..027bc9a3a 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Collection; import java.util.Collections; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeMapper.java index 0b1456fc4..47900b4d2 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Collection; import java.util.Collections; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTagMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTagMapper.java index 37bfa644f..a6348973b 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTagMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTagMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.ArrayList; import java.util.Collection; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryMapper.java index 935e727d6..446458cd5 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Collections; import java.util.List; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java index 8c046c68d..1409816c1 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.net.URI; import java.time.ZoneId; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementMapper.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementMapper.java index 034a68758..f93cf0b8d 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementMapper.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.rest.resource; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Map; import java.util.stream.Collectors; diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/PagingUtility.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/PagingUtility.java index 4b357358f..b9fd6df59 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/PagingUtility.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/PagingUtility.java @@ -56,106 +56,106 @@ public final class PagingUtility { static Sort sanitizeTargetSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, TargetFields.CONTROLLERID.getFieldName()); + return Sort.by(Direction.ASC, TargetFields.CONTROLLERID.getFieldName()); } - return new Sort(SortUtility.parse(TargetFields.class, sortParam)); + return Sort.by(SortUtility.parse(TargetFields.class, sortParam)); } static Sort sanitizeTagSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, TagFields.ID.getFieldName()); + return Sort.by(Direction.ASC, TagFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(TagFields.class, sortParam)); + return Sort.by(SortUtility.parse(TagFields.class, sortParam)); } static Sort sanitizeTargetFilterQuerySortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, TargetFilterQueryFields.ID.getFieldName()); + return Sort.by(Direction.ASC, TargetFilterQueryFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(TargetFilterQueryFields.class, sortParam)); + return Sort.by(SortUtility.parse(TargetFilterQueryFields.class, sortParam)); } static Sort sanitizeSoftwareModuleSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, SoftwareModuleFields.ID.getFieldName()); + return Sort.by(Direction.ASC, SoftwareModuleFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(SoftwareModuleFields.class, sortParam)); + return Sort.by(SortUtility.parse(SoftwareModuleFields.class, sortParam)); } static Sort sanitizeSoftwareModuleTypeSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, SoftwareModuleTypeFields.ID.getFieldName()); + return Sort.by(Direction.ASC, SoftwareModuleTypeFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(SoftwareModuleTypeFields.class, sortParam)); + return Sort.by(SortUtility.parse(SoftwareModuleTypeFields.class, sortParam)); } static Sort sanitizeDistributionSetSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, DistributionSetFields.ID.getFieldName()); + return Sort.by(Direction.ASC, DistributionSetFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(DistributionSetFields.class, sortParam)); + return Sort.by(SortUtility.parse(DistributionSetFields.class, sortParam)); } static Sort sanitizeDistributionSetTypeSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, DistributionSetTypeFields.ID.getFieldName()); + return Sort.by(Direction.ASC, DistributionSetTypeFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(DistributionSetTypeFields.class, sortParam)); + return Sort.by(SortUtility.parse(DistributionSetTypeFields.class, sortParam)); } static Sort sanitizeActionSortParam(final String sortParam) { if (sortParam == null) { // default sort is DESC in case of action to match behavior // of management UI (last entry on top) - return new Sort(Direction.DESC, ActionFields.ID.getFieldName()); + return Sort.by(Direction.DESC, ActionFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(ActionFields.class, sortParam)); + return Sort.by(SortUtility.parse(ActionFields.class, sortParam)); } static Sort sanitizeActionStatusSortParam(final String sortParam) { if (sortParam == null) { // default sort is DESC in case of action status to match behavior // of management UI (last entry on top) - return new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName()); + return Sort.by(Direction.DESC, ActionStatusFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(ActionStatusFields.class, sortParam)); + return Sort.by(SortUtility.parse(ActionStatusFields.class, sortParam)); } static Sort sanitizeDistributionSetMetadataSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, DistributionSetMetadataFields.KEY.getFieldName()); + return Sort.by(Direction.ASC, DistributionSetMetadataFields.KEY.getFieldName()); } - return new Sort(SortUtility.parse(DistributionSetMetadataFields.class, sortParam)); + return Sort.by(SortUtility.parse(DistributionSetMetadataFields.class, sortParam)); } static Sort sanitizeSoftwareModuleMetadataSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, SoftwareModuleMetadataFields.KEY.getFieldName()); + return Sort.by(Direction.ASC, SoftwareModuleMetadataFields.KEY.getFieldName()); } - return new Sort(SortUtility.parse(SoftwareModuleMetadataFields.class, sortParam)); + return Sort.by(SortUtility.parse(SoftwareModuleMetadataFields.class, sortParam)); } static Sort sanitizeRolloutSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, RolloutFields.ID.getFieldName()); + return Sort.by(Direction.ASC, RolloutFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(RolloutFields.class, sortParam)); + return Sort.by(SortUtility.parse(RolloutFields.class, sortParam)); } static Sort sanitizeRolloutGroupSortParam(final String sortParam) { if (sortParam == null) { // default - return new Sort(Direction.ASC, RolloutGroupFields.ID.getFieldName()); + return Sort.by(Direction.ASC, RolloutGroupFields.ID.getFieldName()); } - return new Sort(SortUtility.parse(RolloutGroupFields.class, sortParam)); + return Sort.by(SortUtility.parse(RolloutGroupFields.class, sortParam)); } } diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtContentTypeTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtContentTypeTest.java new file mode 100644 index 000000000..4ac71895f --- /dev/null +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtContentTypeTest.java @@ -0,0 +1,181 @@ +package org.eclipse.hawkbit.mgmt.rest.resource; + +import io.qameta.allure.Description; +import io.qameta.allure.Feature; +import io.qameta.allure.Story; +import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants; +import org.eclipse.hawkbit.repository.model.DistributionSet; +import org.eclipse.hawkbit.rest.util.JsonBuilder; +import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter; +import org.junit.Before; +import org.junit.Test; +import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.web.servlet.server.Encoding; +import org.springframework.context.annotation.Import; +import org.springframework.hateoas.MediaTypes; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MvcResult; + +import java.util.Arrays; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; + +/** + * With Spring Boot 2.2.x the default charset encoding became deprecated. In + * hawkBit we want to keep the old behavior for now and still return the charset + * in the response, which is achieved through enabling {@link Encoding} via + * properties. + */ +@SpringBootTest(properties = { "server.servlet.encoding.charset=UTF-8", "server.servlet.encoding.force=true" }) +@Import(HttpEncodingAutoConfiguration.class) +@Feature("Component Tests - Management API") +@Story("Response Content-Type") +public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest { + + private DistributionSet ds; + private final String dsName = "DS-ö"; + + @Before + public void setupBeforeTest() { + ds = testdataFactory.generateDistributionSet(dsName); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(Arrays.asList(ds))) + .contentType(MediaType.APPLICATION_JSON_UTF8)).andDo(MockMvcResultPrinter.print()) + .andExpect(status().isCreated()).andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(Arrays.asList(ds))) + .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(Arrays.asList(ds))) + .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON_UTF8)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(Arrays.asList(ds))) + .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaTypes.HAL_JSON)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJson_woAccept() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(Arrays.asList(ds))) + .contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) + .andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(Arrays.asList(ds))) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJson_wAcceptJsonUtf8() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING) + .content(JsonBuilder.distributionSets(Arrays.asList(ds))).contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON_UTF8)).andDo(MockMvcResultPrinter.print()) + .andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a POST request shall contain charset=utf-8") + public void postDistributionSet_ContentTypeJson_wAcceptHalJson() throws Exception { + final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING) + .content(JsonBuilder.distributionSets(Arrays.asList(ds))).contentType(MediaType.APPLICATION_JSON) + .accept(MediaTypes.HAL_JSON)).andDo(MockMvcResultPrinter.print()) + .andExpect(status().isCreated()) + .andExpect(jsonPath("[0]name", equalTo(dsName))).andReturn(); + + assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a GET request shall contain charset=utf-8") + public void getDistributionSet_woAccept() throws Exception { + final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print()) + .andExpect(status().isOk()) + .andReturn(); + + assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a GET request shall contain charset=utf-8") + public void getDistributionSet_wAcceptJson() throws Exception { + final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) + .andReturn(); + + assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a GET request shall contain charset=utf-8") + public void getDistributionSet_wAcceptJsonUtf8() throws Exception { + final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON_UTF8)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) + .andReturn(); + + assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result)); + } + + @Test + @Description("The response of a GET request shall contain charset=utf-8") + public void getDistributionSet_wAcceptHalJson() throws Exception { + final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON)) + .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) + .andReturn(); + + assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result)); + } + + private String getResponseHeaderContentType(MvcResult result) { + return result.getResponse().getHeader("Content-Type"); + } +} diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java index 798502a2c..edf2a40c5 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java @@ -694,7 +694,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr // perform request mvc.perform(get("/rest/v1/distributionsets").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[0]._links.self.href", equalTo("http://localhost/rest/v1/distributionsets/" + set.getId()))) .andExpect(jsonPath("$.content.[0].id", equalTo(set.getId().intValue()))) @@ -725,7 +725,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr // perform request mvc.perform(get("/rest/v1/distributionsets/{dsId}", set.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$._links.self.href", equalTo("http://localhost/rest/v1/distributionsets/" + set.getId()))) .andExpect(jsonPath("$.id", equalTo(set.getId().intValue()))) @@ -818,7 +818,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr .content(JsonBuilder.distributionSets(Arrays.asList(one, two, three))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0]name", equalTo(one.getName()))) .andExpect(jsonPath("[0]description", equalTo(one.getDescription()))) .andExpect(jsonPath("[0]type", equalTo(standardDsType.getKey()))) @@ -1034,7 +1034,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr mvc.perform(post("/rest/v1/distributionsets/{dsId}/metadata", testDS.getId()).accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON).content(metaData1.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0]key", equalTo(knownKey1))).andExpect(jsonPath("[0]value", equalTo(knownValue1))) .andExpect(jsonPath("[1]key", equalTo(knownKey2))) .andExpect(jsonPath("[1]value", equalTo(knownValue2))); @@ -1083,7 +1083,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr mvc.perform(put("/rest/v1/distributionsets/{dsId}/metadata/{key}", testDS.getId(), knownKey) .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON) .content(jsonObject.toString())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue))); final DistributionSetMetadata assertDS = distributionSetManagement diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java index 11aeadeb8..8a1b35413 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java @@ -63,7 +63,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(applyBaseEntityMatcherOnPagedResult(assigned)) .andExpect(applyBaseEntityMatcherOnPagedResult(unassigned)) .andExpect(applySelfLinkMatcherOnPagedResult(assigned, DISTRIBUTIONSETTAGS_ROOT + assigned.getId())) @@ -82,7 +82,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(applyTagMatcherOnSingleResult(assigned)) .andExpect(applySelfLinkMatcherOnSingleResult(DISTRIBUTIONSETTAGS_ROOT + assigned.getId())) .andExpect(jsonPath("_links.assignedDistributionSets.href", @@ -103,7 +103,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt .content(JsonBuilder.tags(Arrays.asList(tagOne, tagTwo))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); final Tag createdOne = distributionSetTagManagement.findByRsql(PAGE, "name==thetest1").getContent().get(0); assertThat(createdOne.getName()).isEqualTo(tagOne.getName()); @@ -133,7 +133,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt .content(JsonBuilder.tag(update)).contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); final Tag updated = distributionSetTagManagement.findByRsql(PAGE, "name==updatedName").getContent().get(0); assertThat(updated.getName()).isEqualTo(update.getName()); @@ -260,7 +260,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt JsonBuilder.ids(sets.stream().map(DistributionSet::getId).collect(Collectors.toList()))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test @@ -280,7 +280,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt .ids(sets.stream().map(DistributionSet::getId).collect(Collectors.toList()))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); final List updated = distributionSetManagement.findByTag(PAGE, tag.getId()).getContent(); diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java index b813817ae..ebba9ef40 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java @@ -72,7 +72,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn // generated in this test) mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].name", contains(standardDsType.getName()))) .andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].description", @@ -106,7 +106,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn // descending mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "KEY:DESC")).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[0].id", equalTo(testType.getId().intValue()))) .andExpect(jsonPath("$.content.[0].name", equalTo("TestName123"))) .andExpect(jsonPath("$.content.[0].description", equalTo("Desc1234"))) @@ -120,7 +120,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn // ascending mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "KEY:ASC")).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[4].id", equalTo(testType.getId().intValue()))) .andExpect(jsonPath("$.content.[4].name", equalTo("TestName123"))) .andExpect(jsonPath("$.content.[4].description", equalTo("Desc1234"))) @@ -174,7 +174,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn .perform(post("/rest/v1/distributionsettypes/").content(JsonBuilder.distributionSetTypes(types)) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0].name", equalTo("TestName1"))) .andExpect(jsonPath("[0].key", equalTo("testKey1"))) .andExpect(jsonPath("[0].description", equalTo("Desc1"))) @@ -306,7 +306,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn mvc.perform(get("/rest/v1/distributionsettypes/{dstID}/mandatorymoduletypes", testType.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0].name", equalTo(osType.getName()))) .andExpect(jsonPath("[0].description", equalTo(osType.getDescription()))) .andExpect(jsonPath("[0].maxAssignments", equalTo(1))).andExpect(jsonPath("[0].key", equalTo("os"))); @@ -320,7 +320,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn mvc.perform(get("/rest/v1/distributionsettypes/{dstID}/optionalmoduletypes", testType.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0].name", equalTo(appType.getName()))) .andExpect(jsonPath("[0].description", equalTo(appType.getDescription()))) .andExpect(jsonPath("[0].maxAssignments", equalTo(Integer.MAX_VALUE))) @@ -417,7 +417,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn mvc.perform(get("/rest/v1/distributionsettypes/{dstId}", testType.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.name", equalTo("TestName123"))) .andExpect(jsonPath("$.description", equalTo("Desc1234"))) .andExpect(jsonPath("$.createdBy", equalTo("uploadTester"))) diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java index 17f2812a4..0b7b340c3 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java @@ -251,7 +251,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes @Description("Testing the empty list is returned if no rollout exists") public void noRolloutReturnsEmptyList() throws Exception { mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(0))).andExpect(jsonPath("$.total", equalTo(0))); } @@ -280,7 +280,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("running"))) .andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(5))) @@ -298,7 +298,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("starting"))) .andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(0))) @@ -316,7 +316,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("ready"))) .andExpect(jsonPath("$.lastModifiedBy", equalTo("bumlux"))) @@ -334,7 +334,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes private void retrieveAndVerifyRolloutInCreating(final DistributionSet dsA, final Rollout rollout) throws Exception { mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("creating"))) .andExpect(jsonPath("$.targetFilterQuery", equalTo("controllerId==rollout*"))) @@ -375,7 +375,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes rolloutManagement.handleRollouts(); mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2))) .andExpect(jsonPath("content[0].name", equalTo("rollout1"))) .andExpect(jsonPath("content[0].status", equalTo("ready"))) @@ -417,7 +417,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts?limit=1").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(2))); } @@ -436,7 +436,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform( get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(4))).andExpect(jsonPath("$.total", equalTo(4))) .andExpect(jsonPath("$.content[0].status", equalTo("ready"))) .andExpect(jsonPath("$.content[1].status", equalTo("ready"))) @@ -462,7 +462,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes // check rollout is in starting state mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("status", equalTo("starting"))); @@ -472,7 +472,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes // check rollout is in running state mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("status", equalTo("running"))); } @@ -502,7 +502,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes // check rollout is in running state mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("status", equalTo("paused"))); } @@ -536,7 +536,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes // check rollout is in running state mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("id", equalTo(rollout.getId().intValue()))) .andExpect(jsonPath("status", equalTo("running"))); } @@ -604,7 +604,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes // (amountTargets / groupSize = 2) mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups?sort=ID:ASC", rollout.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2))) .andExpect(jsonPath("$.content[0].status", equalTo("running"))) .andExpect(jsonPath("$.content[1].status", equalTo("scheduled"))); @@ -642,7 +642,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes rolloutManagement.handleRollouts(); mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("status", equalTo("running"))) .andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(5))) .andExpect(jsonPath("$.totalTargetsPerStatus.notstarted", equalTo(0))) @@ -653,7 +653,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), secondGroup.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("status", equalTo("scheduled"))) .andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(0))) .andExpect(jsonPath("$.totalTargetsPerStatus.notstarted", equalTo(0))) @@ -669,7 +669,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes rolloutManagement.handleRollouts(); mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("status", equalTo("ready"))) .andExpect(jsonPath("$.lastModifiedBy", equalTo("bumlux"))) .andExpect(jsonPath("$.lastModifiedAt", not(equalTo(0)))) @@ -688,7 +688,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId()) .accept(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("id", equalTo(firstGroup.getId().intValue()))) .andExpect(jsonPath("status", equalTo("creating"))).andExpect(jsonPath("name", endsWith("1"))) .andExpect(jsonPath("description", endsWith("1"))) @@ -728,7 +728,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId()) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(5))).andExpect(jsonPath("$.total", equalTo(5))); } @@ -754,7 +754,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId()) .accept(MediaType.APPLICATION_JSON).param("q", "controllerId==" + targetInGroup)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1))); } @@ -782,7 +782,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId()) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(5))).andExpect(jsonPath("$.total", equalTo(5))); } @@ -856,19 +856,19 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts").param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==*2") .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1))) .andExpect(jsonPath("$.content[0].name", equalTo(rollout2.getName()))); mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==rollout*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(3))).andExpect(jsonPath("$.total", equalTo(3))); mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==*1")).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2))); } @@ -888,21 +888,21 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()) .accept(MediaType.APPLICATION_JSON).param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group-1")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1))) .andExpect(jsonPath("$.content[0].name", equalTo("group-1"))); mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()) .accept(MediaType.APPLICATION_JSON).param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(4))).andExpect(jsonPath("$.total", equalTo(4))); mvc.perform( get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()).accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group-1,name==group-2")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2))); } diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java index 1bdac9f3b..9929b9606 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java @@ -16,8 +16,8 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasSize; import static org.junit.Assert.assertTrue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.fileUpload; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; @@ -170,10 +170,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // upload final MvcResult mvcResult = mvc - .perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + .perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.hashes.md5", equalTo(md5sum))) .andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum))) .andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum))) @@ -207,7 +207,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, randomBytes); // try to upload - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isForbidden()) .andExpect(jsonPath("$.exceptionClass", equalTo(FileSizeQuotaExceededException.class.getName()))) @@ -223,7 +223,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final byte[] randomBytes = randomBytes(5 * 1024); final MockMultipartFile file = new MockMultipartFile("file", illegalFilename, null, randomBytes); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isBadRequest()) .andExpect(jsonPath("$.message", containsString("Invalid characters in string"))); @@ -267,7 +267,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final MockMultipartFile file = new MockMultipartFile("file", "orig", null, new byte[0]); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isBadRequest()); } @@ -283,15 +283,15 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final String sha256sum = HashGeneratorUtils.generateSHA256(random); final MockMultipartFile file = new MockMultipartFile("file", "orig", null, random); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.hashes.md5", equalTo(md5sum))) .andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum))) .andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum))) .andExpect(jsonPath("$.providedFilename", equalTo("orig"))).andExpect(status().isCreated()); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file)) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isConflict()); } @@ -306,9 +306,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random); // upload - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file).param("filename", + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file).param("filename", "customFilename")).andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andExpect(jsonPath("$.providedFilename", equalTo("customFilename"))).andExpect(status().isCreated()); // check result in db... @@ -335,7 +335,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // upload // wrong sha1 MvcResult mvcResult = mvc - .perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + .perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .param("md5sum", md5sum).param("sha1sum", "afsdff").param("sha256sum", sha256sum)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn(); @@ -346,7 +346,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // wrong sha256 mvcResult = mvc - .perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + .perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .param("md5sum", md5sum).param("sha1sum", sha1sum).param("sha256sum", "jdshfsd")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn(); @@ -357,7 +357,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // wrong md5 mvcResult = mvc - .perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + .perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .param("md5sum", "sdfsdfs").param("sha1sum", sha1sum).param("sha256sum", sha256sum)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn(); @@ -366,7 +366,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra assertThat(exceptionInfo.getErrorCode()).as("Exception contains wrong error code") .isEqualTo(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH.getKey()); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .param("md5sum", md5sum).param("sha1sum", sha1sum)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isCreated()); @@ -389,10 +389,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final MockMultipartFile file = new MockMultipartFile("file", "origFilename" + i, null, random); // upload - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.hashes.md5", equalTo(md5sum))) .andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum))) .andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum))) @@ -405,7 +405,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final MockMultipartFile file = new MockMultipartFile("file", "origFilename_final", null, random); // upload - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isForbidden()) .andExpect(jsonPath("$.exceptionClass", equalTo(AssignmentQuotaExceededException.class.getName()))) @@ -433,10 +433,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // upload final SoftwareModule sm = testdataFactory.createSoftwareModuleOs("sm" + i); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.hashes.md5", equalTo(md5sum))) .andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum))) .andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum))) @@ -450,7 +450,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // upload final SoftwareModule sm = testdataFactory.createSoftwareModuleOs("sm" + numArtifacts); - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isForbidden()) .andExpect(jsonPath("$.exceptionClass", equalTo(StorageQuotaExceededException.class.getName()))) @@ -504,7 +504,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // perform test mvc.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}", sm.getId(), artifact.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id", equalTo(artifact.getId().intValue()))) .andExpect(jsonPath("$.size", equalTo(random.length))) .andExpect(jsonPath("$.hashes.md5", equalTo(artifact.getMd5Hash()))) @@ -533,7 +533,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra mvc.perform(get("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.[0].id", equalTo(artifact.getId().intValue()))) .andExpect(jsonPath("$.[0].size", equalTo(random.length))) .andExpect(jsonPath("$.[0].hashes.md5", equalTo(artifact.getMd5Hash()))) @@ -575,11 +575,11 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra mvc.perform(get("/rest/v1/softwaremodules/1234567890/artifacts")).andDo(MockMvcResultPrinter.print()) .andExpect(status().isNotFound()); - mvc.perform(fileUpload("/rest/v1/softwaremodules/1234567890/artifacts").file(file)) + mvc.perform(multipart("/rest/v1/softwaremodules/1234567890/artifacts").file(file)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound()); // bad request - no content - mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId())) + mvc.perform(multipart("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()); // not allowed methods @@ -689,7 +689,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra mvc.perform(get("/rest/v1/softwaremodules").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[?(@.id==" + os.getId() + ")].name", contains(os.getName()))) .andExpect(jsonPath("$.content.[?(@.id==" + os.getId() + ")].version", contains(os.getVersion()))) .andExpect( @@ -727,7 +727,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // only by name, only one exists per name mvc.perform(get("/rest/v1/softwaremodules?q=name==" + os1.getName()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].name", contains(os1.getName()))) .andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].version", contains(os1.getVersion()))) .andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].description", @@ -739,7 +739,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra // by type, 2 software modules per type exists mvc.perform(get("/rest/v1/softwaremodules?q=type==" + Constants.SMT_DEFAULT_APP_KEY) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].name", contains(app1.getName()))) .andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].version", contains(app1.getVersion()))) .andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].description", @@ -761,7 +761,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra "/rest/v1/softwaremodules?q=type==" + Constants.SMT_DEFAULT_APP_KEY + ";version==" + app1.getVersion()) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].name", contains(app1.getName()))) .andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].version", contains(app1.getVersion()))) .andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].description", @@ -796,7 +796,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra mvc.perform(get("/rest/v1/softwaremodules/{smId}", os.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.name", equalTo(os.getName()))) .andExpect(jsonPath("$.version", equalTo(os.getVersion()))) .andExpect(jsonPath("$.description", equalTo(os.getDescription()))) @@ -830,10 +830,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra final long current = System.currentTimeMillis(); final MvcResult mvcResult = mvc - .perform(post("/rest/v1/softwaremodules/").accept(MediaType.APPLICATION_JSON_UTF8_VALUE) + .perform(post("/rest/v1/softwaremodules/").accept(MediaType.APPLICATION_JSON_VALUE) .content(JsonBuilder.softwareModules(modules)).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0].name", equalTo("name1"))) .andExpect(jsonPath("[0].version", equalTo("version1"))) .andExpect(jsonPath("[0].description", equalTo("description1"))) @@ -976,7 +976,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra mvc.perform(post("/rest/v1/softwaremodules/{swId}/metadata", sm.getId()).accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON).content(metaData1.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0]key", equalTo(knownKey1))).andExpect(jsonPath("[0]value", equalTo(knownValue1))) .andExpect(jsonPath("[0]targetVisible", equalTo(false))) .andExpect(jsonPath("[1]key", equalTo(knownKey2))).andExpect(jsonPath("[1]value", equalTo(knownValue2))) @@ -1028,7 +1028,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra mvc.perform(put("/rest/v1/softwaremodules/{swId}/metadata/{key}", sm.getId(), knownKey) .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON) .content(jsonObject.toString())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue))); final SoftwareModuleMetadata assertDS = softwareModuleManagement diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java index 64ba7b918..69ae315df 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java @@ -59,7 +59,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].name", contains(osType.getName()))) .andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].description", contains(osType.getDescription()))) @@ -109,7 +109,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:DESC")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[1].id", equalTo(testType.getId().intValue()))) .andExpect(jsonPath("$.content.[1].name", equalTo("TestName123"))) .andExpect(jsonPath("$.content.[1].description", equalTo("Desc1234"))) @@ -125,7 +125,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON) .param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:ASC")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.content.[2].id", equalTo(testType.getId().intValue()))) .andExpect(jsonPath("$.content.[2].name", equalTo("TestName123"))) .andExpect(jsonPath("$.content.[2].description", equalTo("Desc1234"))) @@ -176,7 +176,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt .perform(post("/rest/v1/softwaremoduletypes/").content(JsonBuilder.softwareModuleTypes(types)) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0].name", equalTo("TestName1"))).andExpect(jsonPath("[0].key", equalTo("test1"))) .andExpect(jsonPath("[0].description", equalTo("Desc1"))) .andExpect(jsonPath("[0].createdBy", equalTo("uploadTester"))) @@ -216,7 +216,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt mvc.perform(get("/rest/v1/softwaremoduletypes/{smtId}", testType.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.name", equalTo("TestName123"))) .andExpect(jsonPath("$.description", equalTo("Desc1234"))) .andExpect(jsonPath("$.maxAssignments", equalTo(5))) diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java index e794f12d5..4944def1c 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java @@ -776,7 +776,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest .perform(post("/rest/v1/targets/").content(JsonBuilder.targets(targets, true)) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0].name", equalTo("testname1"))) .andExpect(jsonPath("[0].controllerId", equalTo("id1"))) .andExpect(jsonPath("[0].description", equalTo("testid1"))) @@ -1721,7 +1721,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest mvc.perform(post("/rest/v1/targets/{targetId}/metadata", knownControllerId).accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON).content(metaData1.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("[0]key", equalTo(knownKey1))).andExpect(jsonPath("[0]value", equalTo(knownValue1))) .andExpect(jsonPath("[1]key", equalTo(knownKey2))) .andExpect(jsonPath("[1]value", equalTo(knownValue2))); @@ -1768,7 +1768,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest mvc.perform(put("/rest/v1/targets/{targetId}/metadata/{key}", knownControllerId, knownKey) .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON) .content(jsonObject.toString())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue))); final TargetMetadata updatedTargetMetadata = targetManagement diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java index c155cc1bb..2c8dc1c9b 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java @@ -65,7 +65,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(applyTagMatcherOnPagedResult(assigned)).andExpect(applyTagMatcherOnPagedResult(unassigned)) .andExpect(applySelfLinkMatcherOnPagedResult(assigned, TARGETTAGS_ROOT + assigned.getId())) .andExpect(applySelfLinkMatcherOnPagedResult(unassigned, TARGETTAGS_ROOT + unassigned.getId())) @@ -84,7 +84,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(applyTagMatcherOnSingleResult(assigned)) .andExpect(applySelfLinkMatcherOnSingleResult(TARGETTAGS_ROOT + assigned.getId())) .andExpect(jsonPath("_links.assignedTargets.href", @@ -106,7 +106,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT .content(JsonBuilder.tags(Arrays.asList(tagOne, tagTwo))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); final Tag createdOne = targetTagManagement.findByRsql(PAGE, "name==thetest1").getContent().get(0); assertThat(createdOne.getName()).isEqualTo(tagOne.getName()); @@ -136,7 +136,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT .content(JsonBuilder.tag(update)).contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); final Tag updated = targetTagManagement.findByRsql(PAGE, "name==updatedName").getContent().get(0); assertThat(updated.getName()).isEqualTo(update.getName()); @@ -258,7 +258,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT targets.stream().map(Target::getControllerId).collect(Collectors.toList()))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test @@ -276,7 +276,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT targets.stream().map(Target::getControllerId).collect(Collectors.toList()))) .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); final List updated = targetManagement.findByTag(PAGE, tag.getId()).getContent(); diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/test/resources/mgmt-test.properties b/hawkbit-rest/hawkbit-mgmt-resource/src/test/resources/mgmt-test.properties index 96959921d..c69732803 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/test/resources/mgmt-test.properties +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/test/resources/mgmt-test.properties @@ -10,3 +10,4 @@ # Logging START - activate to see request/response details #logging.level.org.eclipse.hawkbit.rest.util.MockMvcResultPrinter=DEBUG # Logging END + diff --git a/hawkbit-rest/hawkbit-rest-core/pom.xml b/hawkbit-rest/hawkbit-rest-core/pom.xml index 05a245fbd..99d6ef2dc 100644 --- a/hawkbit-rest/hawkbit-rest-core/pom.xml +++ b/hawkbit-rest/hawkbit-rest-core/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-rest-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-rest-core hawkBit :: REST :: Core diff --git a/hawkbit-rest/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/data/ResponseList.java b/hawkbit-rest/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/data/ResponseList.java index def9fe8e8..a95c209bb 100644 --- a/hawkbit-rest/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/data/ResponseList.java +++ b/hawkbit-rest/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/data/ResponseList.java @@ -13,7 +13,7 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; /** * List that extends ResourceSupport to ensure that links in content are in HAL @@ -22,7 +22,7 @@ import org.springframework.hateoas.ResourceSupport; * @param * of the response content */ -public class ResponseList extends ResourceSupport implements List { +public class ResponseList extends RepresentationModel> implements List { private final List content; diff --git a/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/AbstractRestIntegrationTest.java b/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/AbstractRestIntegrationTest.java index 3801a0273..d55d864a3 100644 --- a/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/AbstractRestIntegrationTest.java +++ b/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/AbstractRestIntegrationTest.java @@ -23,6 +23,7 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.filter.CharacterEncodingFilter; /** * Abstract Test for Rest tests. @@ -38,6 +39,9 @@ public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTes @Autowired private FilterHttpResponse filterHttpResponse; + @Autowired + private CharacterEncodingFilter characterEncodingFilter; + @Autowired protected WebApplicationContext webApplicationContext; @@ -51,6 +55,7 @@ public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTes protected DefaultMockMvcBuilder createMvcWebAppContext(final WebApplicationContext context) { final DefaultMockMvcBuilder createMvcWebAppContext = MockMvcBuilders.webAppContextSetup(context); + createMvcWebAppContext.addFilter(characterEncodingFilter); createMvcWebAppContext.addFilter( new ExcludePathAwareShallowETagFilter("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", "/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/**", diff --git a/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/filter/ExcludePathAwareShallowETagFilterTest.java b/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/filter/ExcludePathAwareShallowETagFilterTest.java index eaf38be6d..ee9a23c07 100644 --- a/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/filter/ExcludePathAwareShallowETagFilterTest.java +++ b/hawkbit-rest/hawkbit-rest-core/src/test/java/org/eclipse/hawkbit/rest/filter/ExcludePathAwareShallowETagFilterTest.java @@ -26,7 +26,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import io.qameta.allure.Feature; import io.qameta.allure.Story; diff --git a/hawkbit-rest/hawkbit-rest-docs/pom.xml b/hawkbit-rest/hawkbit-rest-docs/pom.xml index 5c7de29b4..8251b5cba 100644 --- a/hawkbit-rest/hawkbit-rest-docs/pom.xml +++ b/hawkbit-rest/hawkbit-rest-docs/pom.xml @@ -15,7 +15,7 @@ org.eclipse.hawkbit hawkbit-rest-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-rest-docs hawkbit :: REST :: Documentation diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTagResourceDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTagResourceDocumentationTest.java index 459224053..27b48dcb0 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTagResourceDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTagResourceDocumentationTest.java @@ -107,7 +107,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest final String json = mapper.writeValueAsString(Arrays.asList(bodyPut)); this.mockMvc .perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).content(json) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document(getRequestFieldsTag(true), getResponseFieldsTag(true))); } @@ -123,7 +123,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest this.mockMvc .perform( put(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}", tagId) - .content(json).contentType(MediaType.APPLICATION_JSON_UTF8)) + .content(json).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("distributionsetTagId") @@ -146,7 +146,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest final Long tagId = createDistributionSetTagId(); this.mockMvc .perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}", - tagId).contentType(MediaType.APPLICATION_JSON_UTF8)) + tagId).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document(pathParameters( parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)))); @@ -162,7 +162,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest this.mockMvc .perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tag.getId()) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("distributionsetTagId") @@ -187,7 +187,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest this.mockMvc .perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING - + "/toggleTagAssignment", tagId).content(json).contentType(MediaType.APPLICATION_JSON_UTF8)) + + "/toggleTagAssignment", tagId).content(json).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("distributionsetTagId") @@ -210,7 +210,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest this.mockMvc .perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tagId).content(json) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("distributionsetTagId") @@ -227,7 +227,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest .perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING + "/{distributionsetId}", tagId, distributionSet.getId()) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document(pathParameters( parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID), diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTypesDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTypesDocumentationTest.java index b92635d44..6d16c4149 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTypesDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetTypesDocumentationTest.java @@ -71,7 +71,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform( get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.total", equalTo(4))) .andDo(this.document.document(responseFields( fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE), @@ -99,7 +99,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON) .param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==a*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(getFilterRequestParamter())); } @@ -117,7 +117,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING) .content(JsonBuilder.distributionSetTypesCreateValidFieldsOnly(types)) - .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()).andDo( this.document.document( requestFields( @@ -213,7 +213,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume this.mockMvc .perform(put(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}", - testType.getId()).content(body).contentType(MediaType.APPLICATION_JSON_UTF8)) + testType.getId()).content(body).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("distributionSetTypeId") @@ -249,7 +249,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("distributionSetTypeId") @@ -281,7 +281,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId()) - .content("{\"id\":" + osType.getId() + "}").contentType(MediaType.APPLICATION_JSON_UTF8)) + .content("{\"id\":" + osType.getId() + "}").contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("distributionSetTypeId") @@ -299,7 +299,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(delete( MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}", - testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8)) + testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document(pathParameters( parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -317,7 +317,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(get( MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}", - testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8)) + testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document(pathParameters( parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -346,7 +346,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/optionalmoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("distributionSetTypeId") .description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -375,7 +375,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")); mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/optionalmoduletypes", testType.getId()) - .content("{\"id\":" + appType.getId() + "}").contentType(MediaType.APPLICATION_JSON_UTF8)) + .content("{\"id\":" + appType.getId() + "}").contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("distributionSetTypeId") @@ -394,7 +394,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(delete( MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}", - testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8)) + testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document(pathParameters( parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -411,7 +411,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume mockMvc.perform(get( MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}", - testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8)) + testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document(pathParameters( parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID), diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetsDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetsDocumentationTest.java index 97f50126a..bb8b6ed0c 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetsDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/DistributionSetsDocumentationTest.java @@ -74,7 +74,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -88,7 +88,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(responseFields( fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE), @@ -125,7 +125,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).param("offset", "1").param("limit", "2") .param("sort", "version:DESC").param("q", "name==testDS*").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(getFilterRequestParamter())); } @@ -164,7 +164,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat this.mockMvc .perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/") .content(JsonBuilder.distributionSetsCreateValidFieldsOnly(sets)) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME), @@ -188,9 +188,9 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(put(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId()) .content(JsonBuilder.distributionSetUpdateValidFieldsOnly(update)) - .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -217,7 +217,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets", set.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -242,7 +242,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(get( MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/autoAssignTargetFilters", set.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -267,7 +267,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat .param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==*1") .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(requestParameters( parameterWithName("limit").attributes(key("type").value("query")) .description(ApiModelPropertiesGeneric.LIMIT), @@ -291,7 +291,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat .param("offset", "1").param("limit", "2").param("sort", "name:DESC") .param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(requestParameters( parameterWithName("limit").attributes(key("type").value("query")) .description(ApiModelPropertiesGeneric.LIMIT), @@ -317,7 +317,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat .param("offset", "1").param("limit", "2").param("sort", "name:DESC") .param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(requestParameters( parameterWithName("limit").attributes(key("type").value("query")) .description(ApiModelPropertiesGeneric.LIMIT), @@ -342,7 +342,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/installedTargets", set.getId()).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -376,7 +376,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat this.mockMvc .perform(post( MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets", - set.getId()).content(list.toString()).contentType(MediaType.APPLICATION_JSON_UTF8)) + set.getId()).content(list.toString()).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters( @@ -432,7 +432,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat // post assignment mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM", - disSet.getId()).contentType(MediaType.APPLICATION_JSON_UTF8).content(list.toString())) + disSet.getId()).contentType(MediaType.APPLICATION_JSON).content(list.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters( @@ -450,7 +450,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM/{softwareModuleId}", set.getId(), set.findFirstModuleByType(osType).get().getId()) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document(pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -467,7 +467,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat // post assignment mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM", set.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -501,7 +501,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM") .param("offset", "1").param("limit", "2").param("sort", "version:DESC").param("q", "name==one*") .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(requestParameters( parameterWithName("limit").attributes(key("type").value("query")) .description(ApiModelPropertiesGeneric.LIMIT), @@ -525,7 +525,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata", testDS.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -554,7 +554,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{dsId}/metadata", testDS.getId()) .param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( requestParameters( parameterWithName("limit").attributes(key("type").value("query")) @@ -610,7 +610,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat mockMvc.perform(put( MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadatakey}", - testDS.getId(), knownKey).contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonObject.toString())) + testDS.getId(), knownKey).contentType(MediaType.APPLICATION_JSON).content(jsonObject.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters( @@ -662,9 +662,9 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2)); mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata", - testDS.getId()).contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonArray.toString())) + testDS.getId()).contentType(MediaType.APPLICATION_JSON).content(jsonArray.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)), diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/RolloutResourceDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/RolloutResourceDocumentationTest.java index ab4167224..fb393cd51 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/RolloutResourceDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/RolloutResourceDocumentationTest.java @@ -86,7 +86,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(getRolloutResponseFields(true, false, fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE), @@ -102,7 +102,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING).param("offset", "0").param("limit", "2") .param("sort", "id:DESC").param("q", "name==exampleRollout*").accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(getFilterRequestParamter())); } @@ -167,7 +167,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}", rollout.getId()) .accept(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(getRolloutResponseFields(false, true), pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID)))); } @@ -195,9 +195,9 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING) .content(JsonBuilder.rollout(name, description, groupSize, dsId, targetFilter, rolloutGroupConditions, type)) - .contentType(MediaTypes.HAL_JSON_UTF8).accept(MediaTypes.HAL_JSON_VALUE)) + .contentType(MediaTypes.HAL_JSON).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(requestFields( requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME), requestFieldWithPathMandatoryInMultiAssignMode("weight").type(JsonFieldType.NUMBER) @@ -285,7 +285,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati rolloutGroupConditions, rolloutGroups)) .contentType(MediaType.APPLICATION_JSON).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( requestFields(requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME), requestFieldWithPathMandatoryInMultiAssignMode("weight") @@ -448,7 +448,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups", rollout.getId()) .accept(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( getRolloutDeployGroupResponseFields(true, false, fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), @@ -469,7 +469,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}", rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(getRolloutDeployGroupResponseFields(false, true), pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID), parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)))); @@ -557,7 +557,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati .param("sort", "id:DESC").param("q", "id==" + firstRolloutGroup.getId()) .accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID), parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -576,7 +576,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}/targets", rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID), parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -626,7 +626,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati .param("sort", "name:ASC").param("q", "controllerId==exampleTarget0") .accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID), parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)), diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremoduleTypesDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremoduleTypesDocumentationTest.java index 55cc7c47e..b41b9c6e1 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremoduleTypesDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremoduleTypesDocumentationTest.java @@ -110,7 +110,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen this.mockMvc .perform(post(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING) .content(JsonBuilder.softwareModuleTypesCreatableFieldsOnly(types)) - .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( requestFields( @@ -194,7 +194,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen this.mockMvc .perform(put(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeID}", - testType.getId()).content(body.toString()).contentType(MediaType.APPLICATION_JSON_UTF8)) + testType.getId()).content(body.toString()).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("softwareModuleTypeID") diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremodulesDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremodulesDocumentationTest.java index 778a1ce7e..099ac87f1 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremodulesDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/SoftwaremodulesDocumentationTest.java @@ -78,7 +78,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati .update(entityFactory.softwareModule().update(sm2.getId()).description("a description")); mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print()) - .andExpect(status().isOk()).andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(status().isOk()).andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(responseFields( fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE), @@ -114,7 +114,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati .param("limit", "2").param("sort", "version:DESC").param("q", "name==SM*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document(getFilterRequestParamter())); } @@ -130,9 +130,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati final List modules = Arrays.asList(os, ah); mockMvc.perform(post(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING) - .content(JsonBuilder.softwareModulesCreatableFieldsOnly(modules)).contentType(MediaTypes.HAL_JSON_UTF8)) + .content(JsonBuilder.softwareModulesCreatableFieldsOnly(modules)).contentType(MediaTypes.HAL_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME), optionalRequestFieldWithPath("[]description") @@ -179,7 +179,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}", sm.getId())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -211,9 +211,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati .vendor("another Vendor").description("a new description").type(Constants.SMT_DEFAULT_OS_KEY).build(); mockMvc.perform(put(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}", sm.getId()) - .content(JsonBuilder.softwareModuleUpdatableFieldsOnly(update)).contentType(MediaTypes.HAL_JSON_UTF8)) + .content(JsonBuilder.softwareModuleUpdatableFieldsOnly(update)).contentType(MediaTypes.HAL_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -251,7 +251,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform( get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -282,11 +282,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati final byte random[] = RandomStringUtils.random(5).getBytes(); final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random); - mockMvc.perform( - fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", - sm.getId()).file(file)) + mockMvc.perform(fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()).file(file)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -318,12 +316,11 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati final byte random[] = RandomStringUtils.random(5).getBytes(); final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random); - mockMvc.perform( - fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", + mockMvc.perform(fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()).file(file).param("filename", "filename").param("file", "s") .param("md5sum", "md5sum").param("sha1sum", "sha1sum")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andDo(this.document.document(requestParameters( parameterWithName("filename").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILENAME), parameterWithName("file").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILE), @@ -365,7 +362,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}", sm.getId(), artifact.getId())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -424,7 +421,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata", module.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -456,7 +453,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati module.getId()).param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -485,9 +482,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2).put("targetVisible", true)); mockMvc.perform(post(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata", - module.getId()).contentType(MediaTypes.HAL_JSON_UTF8).content(jsonArray.toString())) + module.getId()).contentType(MediaTypes.HAL_JSON).content(jsonArray.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters( parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -569,7 +566,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati mockMvc.perform( put(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}", - module.getId(), knownKey).contentType(MediaTypes.HAL_JSON_UTF8).content(jsonObject.toString())) + module.getId(), knownKey).contentType(MediaTypes.HAL_JSON).content(jsonObject.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("softwareModuleId") diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetResourceDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetResourceDocumentationTest.java index 189b801ad..e55129c32 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetResourceDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetResourceDocumentationTest.java @@ -124,7 +124,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio final String target = createTargetJsonForPostRequest("123456", "controllerId", "test"); mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING) - .contentType(MediaType.APPLICATION_JSON_UTF8).content(target)).andExpect(status().isCreated()) + .contentType(MediaType.APPLICATION_JSON).content(target)).andExpect(status().isCreated()) .andDo(MockMvcResultPrinter.print()) .andDo(this.document.document(requestFields( requestFieldWithPath("[]controllerId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -183,7 +183,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio final String targetAsJson = createJsonTarget(targetId, "newTargetName", "I've been updated"); mockMvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}", target.getControllerId()) - .contentType(MediaType.APPLICATION_JSON_UTF8).content(targetAsJson)).andExpect(status().isOk()) + .contentType(MediaType.APPLICATION_JSON).content(targetAsJson)).andExpect(status().isOk()) .andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -414,7 +414,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio mockMvc.perform( put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + MgmtRestConstants.TARGET_V1_ACTIONS + "/{actionId}", targetId, actionId).content(this.objectMapper.writeValueAsString(body)) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -514,7 +514,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET, targetId).content(body) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -558,7 +558,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio enableMultiAssignments(); mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET, targetId).content(body.toString()) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -649,7 +649,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio mockMvc.perform( get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)), responseFields(fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), @@ -678,7 +678,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId()) .param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( requestParameters( parameterWithName("limit").attributes(key("type").value("query")) @@ -732,7 +732,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio mockMvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadatakey}", testTarget.getControllerId(), knownKey) - .contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonObject.toString())) + .contentType(MediaType.APPLICATION_JSON).content(jsonObject.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID), @@ -782,9 +782,9 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio mockMvc.perform( post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId()) - .contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonArray.toString())) + .contentType(MediaType.APPLICATION_JSON).content(jsonArray.toString())) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) + .andExpect(content().contentType(MediaTypes.HAL_JSON)) .andDo(this.document.document( pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)), requestFields(requestFieldWithPath("[]key").description(MgmtApiModelProperties.META_DATA_KEY), diff --git a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetTagResourceDocumentationTest.java b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetTagResourceDocumentationTest.java index c0a0f5cea..ea444e823 100644 --- a/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetTagResourceDocumentationTest.java +++ b/hawkbit-rest/hawkbit-rest-docs/src/test/java/org/eclipse/hawkbit/rest/mgmt/documentation/TargetTagResourceDocumentationTest.java @@ -110,7 +110,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta final String json = mapper.writeValueAsString(Arrays.asList(bodyPut)); this.mockMvc .perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).content(json) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document(getRequestFieldsTargetTag(true), getResponseFieldTargetTag(true))); } @@ -128,7 +128,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta this.mockMvc .perform(put(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}", tagId).content(json) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -142,7 +142,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta final Long tagId = createTargetTagId(); this.mockMvc .perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}", tagId) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document(pathParameters( parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)))); @@ -159,7 +159,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta this.mockMvc .perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tag.getId()) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -185,7 +185,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta this.mockMvc .perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/toggleTagAssignment", tagId) - .content(json).contentType(MediaType.APPLICATION_JSON_UTF8)) + .content(json).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -208,7 +208,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta this.mockMvc .perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tagId).content(json) - .contentType(MediaType.APPLICATION_JSON_UTF8)) + .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)), @@ -225,7 +225,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta .perform(delete( MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/{controllerId}", - tagId, target.getControllerId()).contentType(MediaType.APPLICATION_JSON_UTF8)) + tagId, target.getControllerId()).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID), diff --git a/hawkbit-rest/pom.xml b/hawkbit-rest/pom.xml index 5682dc27a..7239bcde2 100644 --- a/hawkbit-rest/pom.xml +++ b/hawkbit-rest/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-rest-parent hawkBit :: REST diff --git a/hawkbit-runtime/hawkbit-update-server/pom.xml b/hawkbit-runtime/hawkbit-update-server/pom.xml index e1aaf2ad5..11c198b1e 100644 --- a/hawkbit-runtime/hawkbit-update-server/pom.xml +++ b/hawkbit-runtime/hawkbit-update-server/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-runtime-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-update-server hawkBit :: Runtime :: Update Server diff --git a/hawkbit-runtime/hawkbit-update-server/src/main/resources/application.properties b/hawkbit-runtime/hawkbit-update-server/src/main/resources/application.properties index 468eb4793..1d63f7742 100644 --- a/hawkbit-runtime/hawkbit-update-server/src/main/resources/application.properties +++ b/hawkbit-runtime/hawkbit-update-server/src/main/resources/application.properties @@ -12,6 +12,11 @@ spring.security.user.name=admin spring.security.user.password={noop}admin spring.main.allow-bean-definition-overriding=true +# Http Encoding +server.servlet.encoding.charset=UTF-8 +server.servlet.encoding.enabled=true +server.servlet.encoding.force=true + # DDI authentication configuration hawkbit.server.ddi.security.authentication.anonymous.enabled=false hawkbit.server.ddi.security.authentication.targettoken.enabled=true diff --git a/hawkbit-runtime/hawkbit-update-server/src/test/java/org/eclipse/hawkbit/app/CorsTest.java b/hawkbit-runtime/hawkbit-update-server/src/test/java/org/eclipse/hawkbit/app/CorsTest.java index 42fe538d8..3b877340d 100644 --- a/hawkbit-runtime/hawkbit-update-server/src/test/java/org/eclipse/hawkbit/app/CorsTest.java +++ b/hawkbit-runtime/hawkbit-update-server/src/test/java/org/eclipse/hawkbit/app/CorsTest.java @@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @@ -38,8 +39,9 @@ import io.qameta.allure.Story; @RunWith(SpringRunner.class) @SpringBootTest(properties = {"hawkbit.dmf.rabbitmq.enabled=false", "hawkbit.server.security.cors.enabled=true", "hawkbit.server.security.cors.allowedOrigins=" + CorsTest.ALLOWED_ORIGIN_FIRST + "," + CorsTest.ALLOWED_ORIGIN_SECOND}) -@TestExecutionListeners(listeners = { MySqlTestDatabase.class, MsSqlTestDatabase.class }, +@TestExecutionListeners(listeners = { MySqlTestDatabase.class, MsSqlTestDatabase.class }, mergeMode = MergeMode.MERGE_WITH_DEFAULTS) +@DirtiesContext @Feature("Integration Test - Security") @Story("CORS") public class CorsTest { diff --git a/hawkbit-runtime/pom.xml b/hawkbit-runtime/pom.xml index df36a3c0d..dec633916 100644 --- a/hawkbit-runtime/pom.xml +++ b/hawkbit-runtime/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-runtime-parent diff --git a/hawkbit-security-core/pom.xml b/hawkbit-security-core/pom.xml index 023bbc25d..d82bbede7 100644 --- a/hawkbit-security-core/pom.xml +++ b/hawkbit-security-core/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-security-core hawkBit :: Core Security diff --git a/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java b/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java index fcf409fdf..7934fcd21 100644 --- a/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java +++ b/hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java @@ -27,7 +27,7 @@ import org.eclipse.hawkbit.security.HawkbitSecurityProperties.Clients; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import io.qameta.allure.Description; import io.qameta.allure.Feature; diff --git a/hawkbit-security-integration/pom.xml b/hawkbit-security-integration/pom.xml index bd9bddf1c..0c9091def 100644 --- a/hawkbit-security-integration/pom.xml +++ b/hawkbit-security-integration/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-security-integration hawkBit :: Security Integration diff --git a/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedAnonymousDownloadTest.java b/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedAnonymousDownloadTest.java index 90e692e25..13e4a933f 100644 --- a/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedAnonymousDownloadTest.java +++ b/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedAnonymousDownloadTest.java @@ -17,7 +17,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.security.core.authority.SimpleGrantedAuthority; import io.qameta.allure.Feature; diff --git a/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedSecurityHeaderFilterTest.java b/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedSecurityHeaderFilterTest.java index 2f2aa5c1d..405f7be73 100644 --- a/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedSecurityHeaderFilterTest.java +++ b/hawkbit-security-integration/src/test/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedSecurityHeaderFilterTest.java @@ -23,7 +23,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import io.qameta.allure.Description; import io.qameta.allure.Feature; diff --git a/hawkbit-starters/hawkbit-boot-starter-ddi-api/pom.xml b/hawkbit-starters/hawkbit-boot-starter-ddi-api/pom.xml index 9c01c7d17..0c89d7ff1 100644 --- a/hawkbit-starters/hawkbit-boot-starter-ddi-api/pom.xml +++ b/hawkbit-starters/hawkbit-boot-starter-ddi-api/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-starters - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-boot-starter-ddi-api hawkBit :: Spring Boot Starter DDI API diff --git a/hawkbit-starters/hawkbit-boot-starter-dmf-api/pom.xml b/hawkbit-starters/hawkbit-boot-starter-dmf-api/pom.xml index 31a6fd4e2..572c0bc68 100644 --- a/hawkbit-starters/hawkbit-boot-starter-dmf-api/pom.xml +++ b/hawkbit-starters/hawkbit-boot-starter-dmf-api/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-starters - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-boot-starter-dmf-api hawkBit :: Spring Boot Starter DMF API diff --git a/hawkbit-starters/hawkbit-boot-starter-mgmt-api/pom.xml b/hawkbit-starters/hawkbit-boot-starter-mgmt-api/pom.xml index 4b9ed1afa..84a679540 100644 --- a/hawkbit-starters/hawkbit-boot-starter-mgmt-api/pom.xml +++ b/hawkbit-starters/hawkbit-boot-starter-mgmt-api/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-starters - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-boot-starter-mgmt-api hawkBit :: Spring Boot Starter Management API diff --git a/hawkbit-starters/hawkbit-boot-starter-mgmt-ui/pom.xml b/hawkbit-starters/hawkbit-boot-starter-mgmt-ui/pom.xml index 9a73d4b94..b48ca01fb 100644 --- a/hawkbit-starters/hawkbit-boot-starter-mgmt-ui/pom.xml +++ b/hawkbit-starters/hawkbit-boot-starter-mgmt-ui/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-starters - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-boot-starter-mgmt-ui hawkBit :: Spring Boot Starter Management UI diff --git a/hawkbit-starters/hawkbit-boot-starter/pom.xml b/hawkbit-starters/hawkbit-boot-starter/pom.xml index 5c4ad1ad0..26476fe14 100644 --- a/hawkbit-starters/hawkbit-boot-starter/pom.xml +++ b/hawkbit-starters/hawkbit-boot-starter/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-starters - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-boot-starter hawkBit :: Spring Boot Starter diff --git a/hawkbit-starters/pom.xml b/hawkbit-starters/pom.xml index c1afe97bf..06e417859 100644 --- a/hawkbit-starters/pom.xml +++ b/hawkbit-starters/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-starters hawkBit :: Spring Boot Starters diff --git a/hawkbit-test-report/pom.xml b/hawkbit-test-report/pom.xml index 41efdd219..e5aa039b3 100644 --- a/hawkbit-test-report/pom.xml +++ b/hawkbit-test-report/pom.xml @@ -14,7 +14,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-test-report hawkBit :: Test Report diff --git a/hawkbit-ui/pom.xml b/hawkbit-ui/pom.xml index c19f550f2..ba8becc02 100644 --- a/hawkbit-ui/pom.xml +++ b/hawkbit-ui/pom.xml @@ -13,7 +13,7 @@ org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT hawkbit-ui hawkBit :: Mgmt UI diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/tagdetails/AbstractTagToken.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/tagdetails/AbstractTagToken.java index f0105105d..78cfec91b 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/tagdetails/AbstractTagToken.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/tagdetails/AbstractTagToken.java @@ -21,7 +21,6 @@ import org.eclipse.hawkbit.ui.common.layout.MasterEntityAwareComponent; import org.eclipse.hawkbit.ui.common.tagdetails.TagPanelLayout.TagAssignmentListener; import org.eclipse.hawkbit.ui.utils.UINotification; import org.eclipse.hawkbit.ui.utils.VaadinMessageSource; -import org.springframework.hateoas.Identifiable; import org.springframework.util.CollectionUtils; import org.vaadin.spring.events.EventBus.UIEventBus; @@ -98,10 +97,10 @@ public abstract class AbstractTagToken tagPanelLayout.tagDeleted(tagId); } - protected boolean checkAssignmentResult(final List> assignedEntities, + protected boolean checkAssignmentResult(final List assignedEntities, final Long expectedAssignedEntityId) { if (!CollectionUtils.isEmpty(assignedEntities) && expectedAssignedEntityId != null) { - final List assignedDsIds = assignedEntities.stream().map(Identifiable::getId) + final List assignedDsIds = assignedEntities.stream().map(BaseEntity::getId) .collect(Collectors.toList()); if (assignedDsIds.contains(expectedAssignedEntityId)) { return true; @@ -110,7 +109,7 @@ public abstract class AbstractTagToken return false; } - protected boolean checkUnassignmentResult(final Identifiable unAssignedEntity, + protected boolean checkUnassignmentResult(final BaseEntity unAssignedEntity, final Long expectedUnAssignedEntityId) { return unAssignedEntity != null && expectedUnAssignedEntityId != null && unAssignedEntity.getId().equals(expectedUnAssignedEntityId); diff --git a/hawkbit-ui/src/test/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadStateTest.java b/hawkbit-ui/src/test/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadStateTest.java index 211b6ee16..386a5cf82 100644 --- a/hawkbit-ui/src/test/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadStateTest.java +++ b/hawkbit-ui/src/test/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadStateTest.java @@ -18,7 +18,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import io.qameta.allure.Feature; import io.qameta.allure.Story; diff --git a/pom.xml b/pom.xml index cadb4ef79..5bac38c2e 100644 --- a/pom.xml +++ b/pom.xml @@ -16,12 +16,12 @@ org.springframework.boot spring-boot-starter-parent - 2.1.4.RELEASE + 2.3.2.RELEASE org.eclipse.hawkbit hawkbit-parent - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT pom hawkBit :: Parent @@ -128,8 +128,9 @@ 1.8 - 2.1.4.RELEASE - Greenwich.RELEASE + 2.3.2.RELEASE + Hoxton.SR7 + 2.0.0.RELEASE true @@ -137,13 +138,11 @@ upgrade) - START --> - 2.1.0.RELEASE - - - 3.7 - 1.3.4 - - 4.5.6 + 3.5.0.RELEASE + + 6.0.20.Final + + 5.2.4 @@ -151,6 +150,8 @@ 3.2.1 2.0.0.RELEASE ${vaadin.version} + 7.6.1.3 + 2.2.0 3.0.1 1.3.0 2.8.2 @@ -158,12 +159,13 @@ 3.3.3 1.11.1 + 3.9.0 5.0.5 1.11.2 - 2.7.0 - 2.7.3 + 2.13.5 + 2.7.6 1.1.8 25.0-jre 2.2.4 @@ -198,8 +200,9 @@ ${project.basedir}/../hawkbit-test-report/target/jacoco-aggregate/jacoco.xml, ${project.basedir}/../../hawkbit-test-report/target/jacoco-aggregate/jacoco.xml - + + -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" @@ -373,7 +376,7 @@ - + @@ -408,9 +411,7 @@ false true ${surefire.forkcount} - - ${jacoco.agent.ut.arg} - + ${jacoco.agent.ut.arg} ${aspectj-weaver.arg} listener @@ -426,6 +427,13 @@ **/Abstract*.java + + + org.aspectj + aspectjweaver + ${aspectj.version} + + org.apache.maven.plugins @@ -433,7 +441,7 @@ false ${surefire.forkcount} - -Xmx1024m ${jacoco.agent.ut.arg} + -Xmx1024m ${jacoco.agent.ut.arg} ${aspectj-weaver.arg} listener @@ -441,6 +449,13 @@ + + + org.aspectj + aspectjweaver + ${aspectj.version} + + integration-test @@ -454,6 +469,7 @@ org.apache.maven.plugins maven-site-plugin + ${maven.site.plugin.version} true true @@ -554,7 +570,7 @@ com.vaadin vaadin-server - + org.vaadin.spring.addons @@ -575,7 +591,7 @@ com.vaadin vaadin-spring - + @@ -589,7 +605,11 @@ - + + org.flywaydb + flyway-core + ${flyway-core.version} + com.rabbitmq @@ -645,9 +665,9 @@ javax.validation validation-api - + - + org.springframework.cloud @@ -724,6 +744,11 @@ org.eclipse.persistence.jpa ${eclipselink.version} + + org.springframework.plugin + spring-plugin-core + ${spring.plugin.core.version} + @@ -757,6 +782,20 @@ org.springframework.boot spring-boot-starter-logging + + + org.junit.jupiter + junit-jupiter + + + + org.junit.vintage + junit-vintage-engine + + + org.mockito + mockito-junit-jupiter +