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 <ammar.bikic@bosch.io>
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>docs</artifactId>
|
<artifactId>docs</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-artifact-repository-filesystem</artifactId>
|
<artifactId>hawkbit-artifact-repository-filesystem</artifactId>
|
||||||
<name>hawkBit :: Artifact Repository :: Filesystem</name>
|
<name>hawkBit :: Artifact Repository :: Filesystem</name>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-autoconfigure</artifactId>
|
<artifactId>hawkbit-autoconfigure</artifactId>
|
||||||
<name>hawkBit :: Spring Boot Autoconfigure</name>
|
<name>hawkBit :: Spring Boot Autoconfigure</name>
|
||||||
|
|||||||
@@ -523,9 +523,8 @@ public class SecurityManagedConfiguration {
|
|||||||
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
|
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
|
||||||
}
|
}
|
||||||
|
|
||||||
httpSec.authorizeRequests().anyRequest().authenticated()
|
httpSec.authorizeRequests().antMatchers(MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/**")
|
||||||
.antMatchers(MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/**")
|
.hasAnyAuthority(SpPermission.SYSTEM_ADMIN).anyRequest().authenticated();
|
||||||
.hasAnyAuthority(SpPermission.SYSTEM_ADMIN);
|
|
||||||
|
|
||||||
if (oidcBearerTokenAuthenticationFilter != null) {
|
if (oidcBearerTokenAuthenticationFilter != null) {
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-core</artifactId>
|
<artifactId>hawkbit-core</artifactId>
|
||||||
<name>hawkBit :: Core</name>
|
<name>hawkBit :: Core</name>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.api.URLPlaceholder.SoftwareData;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import io.qameta.allure.Description;
|
import io.qameta.allure.Description;
|
||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith;
|
|||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Captor;
|
import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
import org.springframework.cache.support.SimpleValueWrapper;
|
import org.springframework.cache.support.SimpleValueWrapper;
|
||||||
|
|||||||
@@ -15,13 +15,12 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-dmf-parent</artifactId>
|
<artifactId>hawkbit-dmf-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-dmf-amqp</artifactId>
|
<artifactId>hawkbit-dmf-amqp</artifactId>
|
||||||
<name>hawkBit :: DMF :: AMQP 0.9 Implementation</name>
|
<name>hawkBit :: DMF :: AMQP 0.9 Implementation</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-api</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
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.Message;
|
||||||
import org.springframework.amqp.core.MessageProperties;
|
import org.springframework.amqp.core.MessageProperties;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.dmf.json.model.DmfSoftwareModule;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.hamcrest.BaseMatcher;
|
import org.hamcrest.BaseMatcher;
|
||||||
import org.hamcrest.Description;
|
import org.hamcrest.Description;
|
||||||
import org.hamcrest.Factory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set matcher for {@link SoftwareModule} and a list of
|
* Set matcher for {@link SoftwareModule} and a list of
|
||||||
@@ -44,7 +43,6 @@ public final class SoftwareModuleJsonMatcher {
|
|||||||
* @param expectedModules
|
* @param expectedModules
|
||||||
* the json sofware modules.
|
* the json sofware modules.
|
||||||
*/
|
*/
|
||||||
@Factory
|
|
||||||
public static SoftwareModulesMatcher containsExactly(final List<DmfSoftwareModule> expectedModules) {
|
public static SoftwareModulesMatcher containsExactly(final List<DmfSoftwareModule> expectedModules) {
|
||||||
return new SoftwareModulesMatcher(expectedModules);
|
return new SoftwareModulesMatcher(expectedModules);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-dmf-parent</artifactId>
|
<artifactId>hawkbit-dmf-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-dmf-api</artifactId>
|
<artifactId>hawkbit-dmf-api</artifactId>
|
||||||
<name>hawkBit :: DMF :: API</name>
|
<name>hawkBit :: DMF :: API</name>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-dmf-parent</artifactId>
|
<artifactId>hawkbit-dmf-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-dmf-rabbitmq-test</artifactId>
|
<artifactId>hawkbit-dmf-rabbitmq-test</artifactId>
|
||||||
<name>hawkBit :: DMF :: RabbitMq Test module</name>
|
<name>hawkBit :: DMF :: RabbitMq Test module</name>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-dmf-parent</artifactId>
|
<artifactId>hawkbit-dmf-parent</artifactId>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-http-security</artifactId>
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.Arrays;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
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.BadCredentialsException;
|
||||||
import org.springframework.security.authentication.InsufficientAuthenticationException;
|
import org.springframework.security.authentication.InsufficientAuthenticationException;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository</artifactId>
|
<artifactId>hawkbit-repository</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-repository-api</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<name>hawkBit :: Repository :: API</name>
|
<name>hawkBit :: Repository :: API</name>
|
||||||
@@ -25,6 +25,10 @@
|
|||||||
<artifactId>hawkbit-security-core</artifactId>
|
<artifactId>hawkbit-security-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import org.eclipse.hawkbit.repository.model.ArtifactUpload;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.hateoas.Identifiable;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +69,7 @@ public interface ArtifactManagement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Garbage collects artifact binaries if only referenced by given
|
* 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.
|
* as deleted.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -98,7 +97,7 @@ public interface ArtifactManagement {
|
|||||||
void delete(long id);
|
void delete(long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for {@link Artifact} with given {@link Identifiable}.
|
* Searches for {@link Artifact} with given {@link Long}.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* to search for
|
* to search for
|
||||||
|
|||||||
@@ -11,18 +11,21 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.springframework.hateoas.Identifiable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core information of all entities.
|
* Core information of all entities.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface BaseEntity extends Serializable, Identifiable<Long> {
|
public interface BaseEntity extends Serializable {
|
||||||
|
|
||||||
static Long getIdOrNull(final BaseEntity entity) {
|
static Long getIdOrNull(final BaseEntity entity) {
|
||||||
return entity == null ? null : entity.getId();
|
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}
|
* @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity}
|
||||||
* was created.
|
* was created.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class MaintenanceScheduleHelperTest {
|
|||||||
final String duration = "10";
|
final String duration = "10";
|
||||||
assertThatThrownBy(() -> MaintenanceScheduleHelper.validateDuration(duration))
|
assertThatThrownBy(() -> MaintenanceScheduleHelper.validateDuration(duration))
|
||||||
.isInstanceOf(InvalidMaintenanceScheduleException.class).hasMessage("Provided duration is not valid")
|
.isInstanceOf(InvalidMaintenanceScheduleException.class).hasMessage("Provided duration is not valid")
|
||||||
.extracting("durationErrorIndex").containsExactly(2);
|
.extracting("durationErrorIndex").isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository</artifactId>
|
<artifactId>hawkbit-repository</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-repository-core</artifactId>
|
<artifactId>hawkbit-repository-core</artifactId>
|
||||||
<name>hawkBit :: Repository :: Core Implementation Support</name>
|
<name>hawkBit :: Repository :: Core Implementation Support</name>
|
||||||
|
|||||||
@@ -8,15 +8,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.builder;
|
package org.eclipse.hawkbit.repository.builder;
|
||||||
|
|
||||||
import org.springframework.hateoas.Identifiable;
|
public abstract class AbstractBaseEntityBuilder {
|
||||||
|
|
||||||
public abstract class AbstractBaseEntityBuilder implements Identifiable<Long> {
|
|
||||||
|
|
||||||
protected Long id;
|
protected Long id;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
<artifactId>hawkbit-repository</artifactId>
|
<artifactId>hawkbit-repository</artifactId>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
|||||||
@@ -914,7 +914,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
|
|||||||
? RepositoryConstants.MAX_ACTION_HISTORY_MSG_COUNT
|
? RepositoryConstants.MAX_ACTION_HISTORY_MSG_COUNT
|
||||||
: messageCount;
|
: 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<String> messages = actionStatusRepository.findMessagesByActionIdAndMessageNotLike(pageable, actionId,
|
final Page<String> messages = actionStatusRepository.findMessagesByActionIdAndMessageNotLike(pageable, actionId,
|
||||||
RepositoryConstants.SERVER_MESSAGE_PREFIX + "%");
|
RepositoryConstants.SERVER_MESSAGE_PREFIX + "%");
|
||||||
|
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
|||||||
LOGGER.debug("handleCreateRollout called for rollout {}", rollout.getId());
|
LOGGER.debug("handleCreateRollout called for rollout {}", rollout.getId());
|
||||||
|
|
||||||
final List<RolloutGroup> rolloutGroups = rolloutGroupManagement.findByRollout(
|
final List<RolloutGroup> 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();
|
rollout.getId()).getContent();
|
||||||
|
|
||||||
int readyGroups = 0;
|
int readyGroups = 0;
|
||||||
|
|||||||
@@ -145,9 +145,8 @@ import com.google.common.collect.Maps;
|
|||||||
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
||||||
|
|
||||||
protected RepositoryApplicationConfiguration(final DataSource dataSource, final JpaProperties properties,
|
protected RepositoryApplicationConfiguration(final DataSource dataSource, final JpaProperties properties,
|
||||||
final ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider,
|
final ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
|
||||||
final ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
super(dataSource, properties, jtaTransactionManagerProvider);
|
||||||
super(dataSource, properties, jtaTransactionManagerProvider, transactionManagerCustomizers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -410,12 +409,12 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
|||||||
/**
|
/**
|
||||||
* {@link MultiTenantJpaTransactionManager} bean.
|
* {@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}
|
* @return a new {@link PlatformTransactionManager}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Bean
|
@Bean
|
||||||
public PlatformTransactionManager transactionManager() {
|
public PlatformTransactionManager transactionManager(ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
||||||
return new MultiTenantJpaTransactionManager();
|
return new MultiTenantJpaTransactionManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
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
|
* 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}
|
* @return the {@link Target} {@link Specification}
|
||||||
*/
|
*/
|
||||||
public static Specification<JpaTarget> likeIdOrNameOrDescriptionOrAttributeValue(final String searchText) {
|
public static Specification<JpaTarget> likeIdOrNameOrDescriptionOrAttributeValue(final String searchText) {
|
||||||
return Specifications.where(likeIdOrNameOrDescription(searchText)).or(likeAttributeValue(searchText));
|
return Specification.where(likeIdOrNameOrDescription(searchText)).or(likeAttributeValue(searchText));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ spring.main.allow-bean-definition-overriding=true
|
|||||||
### JPA / Datasource - START
|
### JPA / Datasource - START
|
||||||
spring.jpa.database=H2
|
spring.jpa.database=H2
|
||||||
spring.jpa.show-sql=false
|
spring.jpa.show-sql=false
|
||||||
|
spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL;
|
||||||
# Logging
|
# Logging
|
||||||
spring.datasource.eclipselink.logging.logger=JavaLogger
|
spring.datasource.eclipselink.logging.logger=JavaLogger
|
||||||
spring.jpa.properties.eclipselink.logging.level=off
|
spring.jpa.properties.eclipselink.logging.level=off
|
||||||
|
|||||||
@@ -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.SoftwareModuleCreatedEvent;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
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.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||||
import org.eclipse.hawkbit.repository.exception.MultiAssignmentIsNotEnabledException;
|
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.exception.RolloutIllegalStateException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
@@ -239,13 +239,13 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
// verify first group is running
|
// verify first group is running
|
||||||
final RolloutGroup firstGroup = rolloutGroupManagement
|
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);
|
.getContent().get(0);
|
||||||
assertThat(firstGroup.getStatus()).isEqualTo(RolloutGroupStatus.RUNNING);
|
assertThat(firstGroup.getStatus()).isEqualTo(RolloutGroupStatus.RUNNING);
|
||||||
|
|
||||||
// verify other groups are scheduled
|
// verify other groups are scheduled
|
||||||
final List<RolloutGroup> scheduledGroups = rolloutGroupManagement.findByRollout(
|
final List<RolloutGroup> 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)
|
scheduledGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED)
|
||||||
.as("group which should be in scheduled state is in " + group.getStatus() + " state"));
|
.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
|
// 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
|
// verify that now the first and the second group are in running state
|
||||||
final List<RolloutGroup> runningRolloutGroups = rolloutGroupManagement
|
final List<RolloutGroup> 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();
|
.getContent();
|
||||||
runningRolloutGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.RUNNING)
|
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()
|
.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
|
// verify that the other groups are still in schedule state
|
||||||
final List<RolloutGroup> scheduledRolloutGroups = rolloutGroupManagement
|
final List<RolloutGroup> 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();
|
.getContent();
|
||||||
scheduledRolloutGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED)
|
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 "
|
.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) {
|
private void checkSecondGroupStatusIsRunning(final Rollout createdRollout) {
|
||||||
rolloutManagement.handleRollouts();
|
rolloutManagement.handleRollouts();
|
||||||
final List<RolloutGroup> runningRolloutGroups = rolloutGroupManagement
|
final List<RolloutGroup> 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();
|
.getContent();
|
||||||
assertThat(runningRolloutGroups.get(0).getStatus()).isEqualTo(RolloutGroupStatus.FINISHED);
|
assertThat(runningRolloutGroups.get(0).getStatus()).isEqualTo(RolloutGroupStatus.FINISHED);
|
||||||
assertThat(runningRolloutGroups.get(1).getStatus()).isEqualTo(RolloutGroupStatus.RUNNING);
|
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
|
// the first rollout group should be in error state
|
||||||
final List<RolloutGroup> errorGroup = rolloutGroupManagement
|
final List<RolloutGroup> 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();
|
.getContent();
|
||||||
assertThat(errorGroup).hasSize(1);
|
assertThat(errorGroup).hasSize(1);
|
||||||
assertThat(errorGroup.get(0).getStatus()).isEqualTo(RolloutGroupStatus.ERROR);
|
assertThat(errorGroup.get(0).getStatus()).isEqualTo(RolloutGroupStatus.ERROR);
|
||||||
|
|
||||||
// all other groups should still be in scheduled state
|
// all other groups should still be in scheduled state
|
||||||
final List<RolloutGroup> scheduleGroups = rolloutGroupManagement.findByRollout(
|
final List<RolloutGroup> 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));
|
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
|
// all other groups should still be in scheduled state
|
||||||
final List<RolloutGroup> scheduleGroups = rolloutGroupManagement.findByRollout(
|
final List<RolloutGroup> 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));
|
scheduleGroups.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.SCHEDULED));
|
||||||
|
|
||||||
// resume the rollout again after it gets paused by error action
|
// 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
|
// next group should be running again after resuming the rollout
|
||||||
final List<RolloutGroup> resumedGroups = rolloutGroupManagement
|
final List<RolloutGroup> 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();
|
.getContent();
|
||||||
assertThat(resumedGroups).hasSize(1);
|
assertThat(resumedGroups).hasSize(1);
|
||||||
assertThat(resumedGroups.get(0).getStatus()).isEqualTo(RolloutGroupStatus.RUNNING);
|
assertThat(resumedGroups.get(0).getStatus()).isEqualTo(RolloutGroupStatus.RUNNING);
|
||||||
@@ -522,7 +522,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
// verify all groups are in finished state
|
// verify all groups are in finished state
|
||||||
rolloutGroupManagement
|
rolloutGroupManagement
|
||||||
.findByRollout(new OffsetBasedPageRequest(0, 100, new Sort(Direction.ASC, "id")),
|
.findByRollout(new OffsetBasedPageRequest(0, 100, Sort.by(Direction.ASC, "id")),
|
||||||
createdRollout.getId())
|
createdRollout.getId())
|
||||||
.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.FINISHED));
|
.forEach(group -> assertThat(group.getStatus()).isEqualTo(RolloutGroupStatus.FINISHED));
|
||||||
|
|
||||||
@@ -998,7 +998,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
rolloutManagement.handleRollouts();
|
rolloutManagement.handleRollouts();
|
||||||
|
|
||||||
final Page<Rollout> rolloutPage = rolloutManagement
|
final Page<Rollout> 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<Rollout> rolloutList = rolloutPage.getContent();
|
final List<Rollout> rolloutList = rolloutPage.getContent();
|
||||||
|
|
||||||
// validate rolloutA -> 6 running and 6 ready
|
// validate rolloutA -> 6 running and 6 ready
|
||||||
@@ -1084,7 +1084,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Slice<Rollout> rollout = rolloutManagement.findByFiltersWithDetailedStatus(
|
final Slice<Rollout> 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<Rollout> rolloutList = rollout.getContent();
|
final List<Rollout> rolloutList = rollout.getContent();
|
||||||
assertThat(rolloutList.size()).isEqualTo(5);
|
assertThat(rolloutList.size()).isEqualTo(5);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class SpecificationsBuilderTest {
|
|||||||
|
|
||||||
when(criteriaBuilder.equal(any(Path.class), eq("testValue1"))).thenReturn(equalPredicate1);
|
when(criteriaBuilder.equal(any(Path.class), eq("testValue1"))).thenReturn(equalPredicate1);
|
||||||
when(criteriaBuilder.equal(any(Path.class), eq("testValue2"))).thenReturn(equalPredicate2);
|
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("field1")).thenReturn(field1);
|
||||||
when(root.get("field2")).thenReturn(field2);
|
when(root.get("field2")).thenReturn(field2);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository</artifactId>
|
<artifactId>hawkbit-repository</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-repository-test</artifactId>
|
<artifactId>hawkbit-repository-test</artifactId>
|
||||||
<name>hawkBit :: Repository :: Test Utilities</name>
|
<name>hawkBit :: Repository :: Test Utilities</name>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
package org.eclipse.hawkbit.repository.test.matcher;
|
package org.eclipse.hawkbit.repository.test.matcher;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
import org.hamcrest.Factory;
|
|
||||||
import org.hamcrest.FeatureMatcher;
|
import org.hamcrest.FeatureMatcher;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
@@ -22,7 +21,6 @@ public final class BaseEntityMatcher {
|
|||||||
private BaseEntityMatcher() {
|
private BaseEntityMatcher() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Factory
|
|
||||||
public static Matcher<BaseEntity> hasId(final Long id) {
|
public static Matcher<BaseEntity> hasId(final Long id) {
|
||||||
return new HasIdMatcher(Matchers.equalTo(id));
|
return new HasIdMatcher(Matchers.equalTo(id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ import com.google.common.io.Files;
|
|||||||
public abstract class AbstractIntegrationTest {
|
public abstract class AbstractIntegrationTest {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractIntegrationTest.class);
|
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");
|
protected static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.springframework.data.domain.Sort.Direction;
|
|||||||
public class JpaTestRepositoryManagement {
|
public class JpaTestRepositoryManagement {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(JpaTestRepositoryManagement.class);
|
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;
|
private final TenantAwareCacheManager cacheManager;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-repository</artifactId>
|
<artifactId>hawkbit-repository</artifactId>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-ddi-api</artifactId>
|
<artifactId>hawkbit-ddi-api</artifactId>
|
||||||
<name>hawkBit :: REST :: DDI API</name>
|
<name>hawkBit :: REST :: DDI API</name>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ddi.json.model;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
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.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
* .
|
* .
|
||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class DdiArtifact extends ResourceSupport {
|
public class DdiArtifact extends RepresentationModel<DdiArtifact> {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ddi.json.model;
|
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.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
*/
|
*/
|
||||||
@JsonInclude(Include.NON_NULL)
|
@JsonInclude(Include.NON_NULL)
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class DdiControllerBase extends ResourceSupport {
|
public class DdiControllerBase extends RepresentationModel<DdiControllerBase> {
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private DdiConfig config;
|
private DdiConfig config;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ddi.json.model;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
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.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
|||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@JsonPropertyOrder({ "id", "deployment", "actionHistory" })
|
@JsonPropertyOrder({ "id", "deployment", "actionHistory" })
|
||||||
public class DdiDeploymentBase extends ResourceSupport {
|
public class DdiDeploymentBase extends RepresentationModel<DdiDeploymentBase> {
|
||||||
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -60,7 +60,10 @@ public final class DdiRestConstants {
|
|||||||
* Media type for CBOR content with strings encoded as UTF-8. Technically
|
* Media type for CBOR content with strings encoded as UTF-8. Technically
|
||||||
* redundant since CBOR always uses UTF-8, but Spring will append it
|
* redundant since CBOR always uses UTF-8, but Spring will append it
|
||||||
* regardless.
|
* 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";
|
public static final String MEDIA_TYPE_CBOR_UTF8 = "application/cbor;charset=UTF-8";
|
||||||
|
|
||||||
private DdiRestConstants() {
|
private DdiRestConstants() {
|
||||||
|
|||||||
@@ -9,17 +9,18 @@
|
|||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<parent>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<parent>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
</parent>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
<artifactId>hawkbit-ddi-resource</artifactId>
|
</parent>
|
||||||
<name>hawkBit :: REST :: DDI Resources</name>
|
<artifactId>hawkbit-ddi-resource</artifactId>
|
||||||
|
<name>hawkBit :: REST :: DDI Resources</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
@@ -39,7 +40,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.plugin</groupId>
|
<groupId>org.springframework.plugin</groupId>
|
||||||
<artifactId>spring-plugin-core</artifactId>
|
<artifactId>spring-plugin-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
@@ -49,10 +50,10 @@
|
|||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-test</artifactId>
|
<artifactId>hawkbit-repository-test</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
@@ -107,10 +108,10 @@
|
|||||||
<artifactId>allure-junit4</artifactId>
|
<artifactId>allure-junit4</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
import org.eclipse.hawkbit.rest.data.ResponseList;
|
import org.eclipse.hawkbit.rest.data.ResponseList;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.springframework.hateoas.Link;
|
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.http.HttpRequest;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -115,8 +115,8 @@ public final class DataConversionHelper {
|
|||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
if (action.isCancelingOrCanceled()) {
|
if (action.isCancelingOrCanceled()) {
|
||||||
result.add(ControllerLinkBuilder
|
result.add(WebMvcLinkBuilder
|
||||||
.linkTo(ControllerLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||||
.getControllerCancelAction(tenantAware.getCurrentTenant(), target.getControllerId(),
|
.getControllerCancelAction(tenantAware.getCurrentTenant(), target.getControllerId(),
|
||||||
action.getId()))
|
action.getId()))
|
||||||
.withRel(DdiRestConstants.CANCEL_ACTION));
|
.withRel(DdiRestConstants.CANCEL_ACTION));
|
||||||
@@ -126,8 +126,8 @@ public final class DataConversionHelper {
|
|||||||
// have changed from 'soft' to 'forced' type and we need to
|
// have changed from 'soft' to 'forced' type and we need to
|
||||||
// change the payload of the
|
// change the payload of the
|
||||||
// response because of eTags.
|
// response because of eTags.
|
||||||
result.add(ControllerLinkBuilder
|
result.add(WebMvcLinkBuilder
|
||||||
.linkTo(ControllerLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||||
.getControllerBasedeploymentAction(tenantAware.getCurrentTenant(),
|
.getControllerBasedeploymentAction(tenantAware.getCurrentTenant(),
|
||||||
target.getControllerId(), action.getId(), calculateEtag(action), null))
|
target.getControllerId(), action.getId(), calculateEtag(action), null))
|
||||||
.withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
|
.withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
|
||||||
@@ -135,8 +135,8 @@ public final class DataConversionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target.isRequestControllerAttributes()) {
|
if (target.isRequestControllerAttributes()) {
|
||||||
result.add(ControllerLinkBuilder
|
result.add(WebMvcLinkBuilder
|
||||||
.linkTo(ControllerLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||||
.putConfigData(null, tenantAware.getCurrentTenant(), target.getControllerId()))
|
.putConfigData(null, tenantAware.getCurrentTenant(), target.getControllerId()))
|
||||||
.withRel(DdiRestConstants.CONFIG_DATA_ACTION));
|
.withRel(DdiRestConstants.CONFIG_DATA_ACTION));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final byte[] result = mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
final byte[] result = mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction.getId(), tenantAware.getCurrentTenant()).accept(DdiRestConstants.MEDIA_TYPE_CBOR))
|
+ cancelAction.getId(), tenantAware.getCurrentTenant()).accept(DdiRestConstants.MEDIA_TYPE_CBOR))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR_UTF8))
|
.andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR))
|
||||||
.andReturn().getResponse().getContentAsByteArray();
|
.andReturn().getResponse().getContentAsByteArray();
|
||||||
assertThat(JsonPathUtils.<String>evaluate(cborToJson(result), "$.id")).isEqualTo(String.valueOf(cancelAction.getId()));
|
assertThat(JsonPathUtils.<String>evaluate(cborToJson(result), "$.id")).isEqualTo(String.valueOf(cancelAction.getId()));
|
||||||
assertThat(JsonPathUtils.<String>evaluate(cborToJson(result), "$.cancelAction.stopId")).isEqualTo(String.valueOf(actionId));
|
assertThat(JsonPathUtils.<String>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,
|
get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/" + actionId,
|
||||||
tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(String.valueOf(actionId))))
|
||||||
.andExpect(jsonPath("$.deployment.download", equalTo("forced")))
|
.andExpect(jsonPath("$.deployment.download", equalTo("forced")))
|
||||||
.andExpect(jsonPath("$.deployment.update", equalTo("forced")))
|
.andExpect(jsonPath("$.deployment.update", equalTo("forced")))
|
||||||
@@ -139,9 +139,9 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
long current = System.currentTimeMillis();
|
long current = System.currentTimeMillis();
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
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())
|
.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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.deploymentBase.href",
|
.andExpect(jsonPath("$._links.deploymentBase.href",
|
||||||
startsWith("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
startsWith("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
||||||
@@ -174,7 +174,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
current = System.currentTimeMillis();
|
current = System.currentTimeMillis();
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
||||||
TestdataFactory.DEFAULT_CONTROLLER_ID)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.cancelAction.href",
|
.andExpect(jsonPath("$._links.cancelAction.href",
|
||||||
equalTo("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
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/"
|
mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
+ cancelAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(String.valueOf(cancelAction.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId))));
|
||||||
assertThat(targetManagement.getByControllerID(TestdataFactory.DEFAULT_CONTROLLER_ID).get().getLastTargetQuery())
|
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/"
|
mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
+ cancelAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(String.valueOf(cancelAction.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId))));
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(6);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(6);
|
||||||
|
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(),
|
mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(),
|
||||||
TestdataFactory.DEFAULT_CONTROLLER_ID)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.cancelAction.href",
|
.andExpect(jsonPath("$._links.cancelAction.href",
|
||||||
equalTo("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
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/"
|
mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction2.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
+ cancelAction2.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(String.valueOf(cancelAction2.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId2))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId2))));
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(8);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(8);
|
||||||
|
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
||||||
TestdataFactory.DEFAULT_CONTROLLER_ID)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.cancelAction.href",
|
.andExpect(jsonPath("$._links.cancelAction.href",
|
||||||
equalTo("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
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/"
|
mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction3.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
+ cancelAction3.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(String.valueOf(cancelAction3.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId3))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId3))));
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(12);
|
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/"
|
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction3.getId() + "/feedback", tenantAware.getCurrentTenant())
|
+ cancelAction3.getId() + "/feedback", tenantAware.getCurrentTenant())
|
||||||
.content(JsonBuilder.cancelActionFeedback(cancelAction3.getId().toString(), "closed"))
|
.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());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(13);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(13);
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ public class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
mvc.perform(
|
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())
|
.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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.configData.href", equalTo(
|
.andExpect(jsonPath("$._links.configData.href", equalTo(
|
||||||
"http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/4712/configData")));
|
"http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/4712/configData")));
|
||||||
@@ -103,9 +103,9 @@ public class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
|||||||
assertThat(updateControllerAttributes.isRequestControllerAttributes()).isFalse();
|
assertThat(updateControllerAttributes.isRequestControllerAttributes()).isFalse();
|
||||||
|
|
||||||
mvc.perform(
|
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())
|
.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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.configData.href").doesNotExist());
|
.andExpect(jsonPath("$._links.configData.href").doesNotExist());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get();
|
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(),
|
artifactSignature, action.getId(),
|
||||||
findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced");
|
findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced");
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get();
|
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",
|
visibleMetadataOsKey, visibleMetadataOsValue, artifact, artifactSignature, action.getId(), "attempt",
|
||||||
"attempt", getOsModule(findDistributionSetByAction));
|
"attempt", getOsModule(findDistributionSetByAction));
|
||||||
|
|
||||||
@@ -347,11 +347,11 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get();
|
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(),
|
artifactSignature, action.getId(),
|
||||||
findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced");
|
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(),
|
artifactSignature, action.getId(),
|
||||||
findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced");
|
findDistributionSetByAction.findFirstModuleByType(osType).get().getId(), "forced", "forced");
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final DistributionSet findDistributionSetByAction = distributionSetManagement.getByAction(action.getId()).get();
|
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",
|
"withValue", artifact, artifactSignature, action.getId(), "forced", "skip",
|
||||||
getOsModule(findDistributionSetByAction));
|
getOsModule(findDistributionSetByAction));
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
public void rootPollResourceCbor() throws Exception {
|
public void rootPollResourceCbor() throws Exception {
|
||||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
||||||
.accept(DdiRestConstants.MEDIA_TYPE_CBOR)).andDo(MockMvcResultPrinter.print())
|
.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
|
@Test
|
||||||
@@ -96,7 +96,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
public void apiReturnsJSONByDefault() throws Exception {
|
public void apiReturnsJSONByDefault() throws Exception {
|
||||||
final MvcResult result = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
final MvcResult result = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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
|
// verify that we did not specify a content-type in the request, in case
|
||||||
// there are any default values
|
// there are any default values
|
||||||
@@ -176,7 +176,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
|
|
||||||
mvc.perform(get("/default-tenant/controller/v1/4711")).andDo(MockMvcResultPrinter.print())
|
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")));
|
.andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00")));
|
||||||
assertThat(targetManagement.getByControllerID("4711").get().getLastTargetQuery())
|
assertThat(targetManagement.getByControllerID("4711").get().getLastTargetQuery())
|
||||||
.isGreaterThanOrEqualTo(current);
|
.isGreaterThanOrEqualTo(current);
|
||||||
@@ -210,7 +210,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
securityRule.runAs(WithSpringAuthorityRule.withUser("controller", CONTROLLER_ROLE_ANONYMOUS), () -> {
|
securityRule.runAs(WithSpringAuthorityRule.withUser("controller", CONTROLLER_ROLE_ANONYMOUS), () -> {
|
||||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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")));
|
.andExpect(jsonPath("$.config.polling.sleep", equalTo("00:02:00")));
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@@ -229,7 +229,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
public void rootRsNotModified() throws Exception {
|
public void rootRsNotModified() throws Exception {
|
||||||
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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()
|
.andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00"))).andReturn().getResponse()
|
||||||
.getHeader("ETag");
|
.getHeader("ETag");
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
||||||
.header("If-None-Match", etag).accept(MediaType.APPLICATION_JSON))
|
.header("If-None-Match", etag).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.deploymentBase.href",
|
.andExpect(jsonPath("$._links.deploymentBase.href",
|
||||||
startsWith("http://localhost/" + tenantAware.getCurrentTenant()
|
startsWith("http://localhost/" + tenantAware.getCurrentTenant()
|
||||||
@@ -278,7 +278,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
||||||
.header("If-None-Match", etagWithFirstUpdate).accept(MediaType.APPLICATION_JSON))
|
.header("If-None-Match", etagWithFirstUpdate).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.deploymentBase.href",
|
.andExpect(jsonPath("$._links.deploymentBase.href",
|
||||||
startsWith("http://localhost/" + tenantAware.getCurrentTenant()
|
startsWith("http://localhost/" + tenantAware.getCurrentTenant()
|
||||||
@@ -300,7 +300,7 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.config.polling.sleep", equalTo("00:01:00")));
|
||||||
|
|
||||||
assertThat(targetManagement.getByControllerID("4711").get().getLastTargetQuery())
|
assertThat(targetManagement.getByControllerID("4711").get().getLastTargetQuery())
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-mgmt-api</artifactId>
|
<artifactId>hawkbit-mgmt-api</artifactId>
|
||||||
<name>hawkBit :: REST :: Management API</name>
|
<name>hawkBit :: REST :: Management API</name>
|
||||||
@@ -24,6 +24,10 @@
|
|||||||
<groupId>org.springframework.hateoas</groupId>
|
<groupId>org.springframework.hateoas</groupId>
|
||||||
<artifactId>spring-hateoas</artifactId>
|
<artifactId>spring-hateoas</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-webmvc</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-json</artifactId>
|
<artifactId>spring-boot-starter-json</artifactId>
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.json.model;
|
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.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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.
|
* A json annotated rest model for BaseEntity to RESTful API representation.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class MgmtBaseEntity extends ResourceSupport {
|
public abstract class MgmtBaseEntity extends RepresentationModel<MgmtBaseEntity> {
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
@@ -31,6 +32,16 @@ public abstract class MgmtBaseEntity extends ResourceSupport {
|
|||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Long lastModifiedAt;
|
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
|
* @return the createdBy
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
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.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
@@ -32,7 +32,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@JsonInclude(Include.NON_NULL)
|
@JsonInclude(Include.NON_NULL)
|
||||||
public class PagedList<T> extends ResourceSupport {
|
public class PagedList<T> extends RepresentationModel<PagedList<T>> {
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private final List<T> content;
|
private final List<T> content;
|
||||||
|
|||||||
@@ -8,24 +8,24 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.json.model.distributionset;
|
package org.eclipse.hawkbit.mgmt.json.model.distributionset;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
|
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.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
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
|
* Representation of an Action Id as a Json Object with link to the Action resource
|
||||||
*/
|
*/
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class MgmtActionId extends ResourceSupport {
|
public class MgmtActionId extends RepresentationModel<MgmtActionId> {
|
||||||
|
|
||||||
private long actionId;
|
private long actionId;
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ package org.eclipse.hawkbit.mgmt.json.model.distributionset;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.springframework.hateoas.RepresentationModel;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.springframework.hateoas.ResourceSupport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response Body of Target for assignment operations.
|
* Response Body of Target for assignment operations.
|
||||||
@@ -25,7 +26,7 @@ import org.springframework.hateoas.ResourceSupport;
|
|||||||
*/
|
*/
|
||||||
@JsonInclude(Include.NON_NULL)
|
@JsonInclude(Include.NON_NULL)
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class MgmtTargetAssignmentResponseBody extends ResourceSupport {
|
public class MgmtTargetAssignmentResponseBody extends RepresentationModel<MgmtTargetAssignmentResponseBody> {
|
||||||
|
|
||||||
private int alreadyAssigned;
|
private int alreadyAssigned;
|
||||||
private List<MgmtActionId> assignedActions;
|
private List<MgmtActionId> assignedActions;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
package org.eclipse.hawkbit.mgmt.json.model.system;
|
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.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
|||||||
*/
|
*/
|
||||||
@JsonInclude(Include.NON_NULL)
|
@JsonInclude(Include.NON_NULL)
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class MgmtSystemTenantConfigurationValue extends ResourceSupport {
|
public class MgmtSystemTenantConfigurationValue extends RepresentationModel<MgmtSystemTenantConfigurationValue> {
|
||||||
|
|
||||||
@JsonInclude(Include.ALWAYS)
|
@JsonInclude(Include.ALWAYS)
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-mgmt-resource</artifactId>
|
<artifactId>hawkbit-mgmt-resource</artifactId>
|
||||||
<name>hawkBit :: REST :: Management Resources</name>
|
<name>hawkBit :: REST :: Management Resources</name>
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.plugin</groupId>
|
<groupId>org.springframework.plugin</groupId>
|
||||||
<artifactId>spring-plugin-core</artifactId>
|
<artifactId>spring-plugin-core</artifactId>
|
||||||
|
<version>${spring.plugin.core.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|||||||
@@ -56,106 +56,106 @@ public final class PagingUtility {
|
|||||||
static Sort sanitizeTargetSortParam(final String sortParam) {
|
static Sort sanitizeTargetSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeTagSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeTargetFilterQuerySortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeSoftwareModuleSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeSoftwareModuleTypeSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeDistributionSetSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeDistributionSetTypeSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeActionSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default sort is DESC in case of action to match behavior
|
// default sort is DESC in case of action to match behavior
|
||||||
// of management UI (last entry on top)
|
// 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) {
|
static Sort sanitizeActionStatusSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default sort is DESC in case of action status to match behavior
|
// default sort is DESC in case of action status to match behavior
|
||||||
// of management UI (last entry on top)
|
// 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) {
|
static Sort sanitizeDistributionSetMetadataSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeSoftwareModuleMetadataSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeRolloutSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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) {
|
static Sort sanitizeRolloutGroupSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -694,7 +694,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
|||||||
// perform request
|
// perform request
|
||||||
mvc.perform(get("/rest/v1/distributionsets").accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/distributionsets").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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",
|
.andExpect(jsonPath("$.content.[0]._links.self.href",
|
||||||
equalTo("http://localhost/rest/v1/distributionsets/" + set.getId())))
|
equalTo("http://localhost/rest/v1/distributionsets/" + set.getId())))
|
||||||
.andExpect(jsonPath("$.content.[0].id", equalTo(set.getId().intValue())))
|
.andExpect(jsonPath("$.content.[0].id", equalTo(set.getId().intValue())))
|
||||||
@@ -725,7 +725,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
|||||||
// perform request
|
// perform request
|
||||||
mvc.perform(get("/rest/v1/distributionsets/{dsId}", set.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/distributionsets/{dsId}", set.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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",
|
.andExpect(jsonPath("$._links.self.href",
|
||||||
equalTo("http://localhost/rest/v1/distributionsets/" + set.getId())))
|
equalTo("http://localhost/rest/v1/distributionsets/" + set.getId())))
|
||||||
.andExpect(jsonPath("$.id", equalTo(set.getId().intValue())))
|
.andExpect(jsonPath("$.id", equalTo(set.getId().intValue())))
|
||||||
@@ -818,7 +818,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
|||||||
.content(JsonBuilder.distributionSets(Arrays.asList(one, two, three)))
|
.content(JsonBuilder.distributionSets(Arrays.asList(one, two, three)))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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]name", equalTo(one.getName())))
|
||||||
.andExpect(jsonPath("[0]description", equalTo(one.getDescription())))
|
.andExpect(jsonPath("[0]description", equalTo(one.getDescription())))
|
||||||
.andExpect(jsonPath("[0]type", equalTo(standardDsType.getKey())))
|
.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)
|
mvc.perform(post("/rest/v1/distributionsets/{dsId}/metadata", testDS.getId()).accept(MediaType.APPLICATION_JSON)
|
||||||
.contentType(MediaType.APPLICATION_JSON).content(metaData1.toString()))
|
.contentType(MediaType.APPLICATION_JSON).content(metaData1.toString()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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]key", equalTo(knownKey1))).andExpect(jsonPath("[0]value", equalTo(knownValue1)))
|
||||||
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
||||||
.andExpect(jsonPath("[1]value", equalTo(knownValue2)));
|
.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)
|
mvc.perform(put("/rest/v1/distributionsets/{dsId}/metadata/{key}", testDS.getId(), knownKey)
|
||||||
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
|
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(jsonObject.toString())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
|
||||||
|
|
||||||
final DistributionSetMetadata assertDS = distributionSetManagement
|
final DistributionSetMetadata assertDS = distributionSetManagement
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
|||||||
|
|
||||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(assigned))
|
||||||
.andExpect(applyBaseEntityMatcherOnPagedResult(unassigned))
|
.andExpect(applyBaseEntityMatcherOnPagedResult(unassigned))
|
||||||
.andExpect(applySelfLinkMatcherOnPagedResult(assigned, DISTRIBUTIONSETTAGS_ROOT + assigned.getId()))
|
.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())
|
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(applyTagMatcherOnSingleResult(assigned))
|
||||||
.andExpect(applySelfLinkMatcherOnSingleResult(DISTRIBUTIONSETTAGS_ROOT + assigned.getId()))
|
.andExpect(applySelfLinkMatcherOnSingleResult(DISTRIBUTIONSETTAGS_ROOT + assigned.getId()))
|
||||||
.andExpect(jsonPath("_links.assignedDistributionSets.href",
|
.andExpect(jsonPath("_links.assignedDistributionSets.href",
|
||||||
@@ -103,7 +103,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
|||||||
.content(JsonBuilder.tags(Arrays.asList(tagOne, tagTwo)))
|
.content(JsonBuilder.tags(Arrays.asList(tagOne, tagTwo)))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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);
|
final Tag createdOne = distributionSetTagManagement.findByRsql(PAGE, "name==thetest1").getContent().get(0);
|
||||||
assertThat(createdOne.getName()).isEqualTo(tagOne.getName());
|
assertThat(createdOne.getName()).isEqualTo(tagOne.getName());
|
||||||
@@ -133,7 +133,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
|||||||
.content(JsonBuilder.tag(update)).contentType(MediaType.APPLICATION_JSON)
|
.content(JsonBuilder.tag(update)).contentType(MediaType.APPLICATION_JSON)
|
||||||
.accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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);
|
final Tag updated = distributionSetTagManagement.findByRsql(PAGE, "name==updatedName").getContent().get(0);
|
||||||
assertThat(updated.getName()).isEqualTo(update.getName());
|
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())))
|
JsonBuilder.ids(sets.stream().map(DistributionSet::getId).collect(Collectors.toList())))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -280,7 +280,7 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
|||||||
.ids(sets.stream().map(DistributionSet::getId).collect(Collectors.toList())))
|
.ids(sets.stream().map(DistributionSet::getId).collect(Collectors.toList())))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
|
||||||
|
|
||||||
final List<DistributionSet> updated = distributionSetManagement.findByTag(PAGE, tag.getId()).getContent();
|
final List<DistributionSet> updated = distributionSetManagement.findByTag(PAGE, tag.getId()).getContent();
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
|
|||||||
// generated in this test)
|
// generated in this test)
|
||||||
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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",
|
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].name",
|
||||||
contains(standardDsType.getName())))
|
contains(standardDsType.getName())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].description",
|
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].description",
|
||||||
@@ -106,7 +106,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
|
|||||||
// descending
|
// descending
|
||||||
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)
|
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "KEY:DESC")).andDo(MockMvcResultPrinter.print())
|
.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].id", equalTo(testType.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.content.[0].name", equalTo("TestName123")))
|
.andExpect(jsonPath("$.content.[0].name", equalTo("TestName123")))
|
||||||
.andExpect(jsonPath("$.content.[0].description", equalTo("Desc1234")))
|
.andExpect(jsonPath("$.content.[0].description", equalTo("Desc1234")))
|
||||||
@@ -120,7 +120,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
|
|||||||
// ascending
|
// ascending
|
||||||
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)
|
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "KEY:ASC")).andDo(MockMvcResultPrinter.print())
|
.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].id", equalTo(testType.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.content.[4].name", equalTo("TestName123")))
|
.andExpect(jsonPath("$.content.[4].name", equalTo("TestName123")))
|
||||||
.andExpect(jsonPath("$.content.[4].description", equalTo("Desc1234")))
|
.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))
|
.perform(post("/rest/v1/distributionsettypes/").content(JsonBuilder.distributionSetTypes(types))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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].name", equalTo("TestName1")))
|
||||||
.andExpect(jsonPath("[0].key", equalTo("testKey1")))
|
.andExpect(jsonPath("[0].key", equalTo("testKey1")))
|
||||||
.andExpect(jsonPath("[0].description", equalTo("Desc1")))
|
.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())
|
mvc.perform(get("/rest/v1/distributionsettypes/{dstID}/mandatorymoduletypes", testType.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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].name", equalTo(osType.getName())))
|
||||||
.andExpect(jsonPath("[0].description", equalTo(osType.getDescription())))
|
.andExpect(jsonPath("[0].description", equalTo(osType.getDescription())))
|
||||||
.andExpect(jsonPath("[0].maxAssignments", equalTo(1))).andExpect(jsonPath("[0].key", equalTo("os")));
|
.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())
|
mvc.perform(get("/rest/v1/distributionsettypes/{dstID}/optionalmoduletypes", testType.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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].name", equalTo(appType.getName())))
|
||||||
.andExpect(jsonPath("[0].description", equalTo(appType.getDescription())))
|
.andExpect(jsonPath("[0].description", equalTo(appType.getDescription())))
|
||||||
.andExpect(jsonPath("[0].maxAssignments", equalTo(Integer.MAX_VALUE)))
|
.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))
|
mvc.perform(get("/rest/v1/distributionsettypes/{dstId}", testType.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.name", equalTo("TestName123")))
|
||||||
.andExpect(jsonPath("$.description", equalTo("Desc1234")))
|
.andExpect(jsonPath("$.description", equalTo("Desc1234")))
|
||||||
.andExpect(jsonPath("$.createdBy", equalTo("uploadTester")))
|
.andExpect(jsonPath("$.createdBy", equalTo("uploadTester")))
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
@Description("Testing the empty list is returned if no rollout exists")
|
@Description("Testing the empty list is returned if no rollout exists")
|
||||||
public void noRolloutReturnsEmptyList() throws Exception {
|
public void noRolloutReturnsEmptyList() throws Exception {
|
||||||
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
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)));
|
.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))
|
mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("running")))
|
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("running")))
|
||||||
.andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(5)))
|
.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))
|
mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("starting")))
|
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("starting")))
|
||||||
.andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(0)))
|
.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))
|
mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("ready")))
|
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("ready")))
|
||||||
.andExpect(jsonPath("$.lastModifiedBy", equalTo("bumlux")))
|
.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 {
|
private void retrieveAndVerifyRolloutInCreating(final DistributionSet dsA, final Rollout rollout) throws Exception {
|
||||||
mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/rollouts/" + rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("creating")))
|
.andExpect(jsonPath("$.name", equalTo("rollout1"))).andExpect(jsonPath("$.status", equalTo("creating")))
|
||||||
.andExpect(jsonPath("$.targetFilterQuery", equalTo("controllerId==rollout*")))
|
.andExpect(jsonPath("$.targetFilterQuery", equalTo("controllerId==rollout*")))
|
||||||
@@ -375,7 +375,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
rolloutManagement.handleRollouts();
|
rolloutManagement.handleRollouts();
|
||||||
|
|
||||||
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
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", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2)))
|
||||||
.andExpect(jsonPath("content[0].name", equalTo("rollout1")))
|
.andExpect(jsonPath("content[0].name", equalTo("rollout1")))
|
||||||
.andExpect(jsonPath("content[0].status", equalTo("ready")))
|
.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))
|
mvc.perform(get("/rest/v1/rollouts?limit=1").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +436,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
mvc.perform(
|
mvc.perform(
|
||||||
get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", hasSize(4))).andExpect(jsonPath("$.total", equalTo(4)))
|
||||||
.andExpect(jsonPath("$.content[0].status", equalTo("ready")))
|
.andExpect(jsonPath("$.content[0].status", equalTo("ready")))
|
||||||
.andExpect(jsonPath("$.content[1].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
|
// check rollout is in starting state
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("status", equalTo("starting")));
|
.andExpect(jsonPath("status", equalTo("starting")));
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
// check rollout is in running state
|
// check rollout is in running state
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("status", equalTo("running")));
|
.andExpect(jsonPath("status", equalTo("running")));
|
||||||
}
|
}
|
||||||
@@ -502,7 +502,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
// check rollout is in running state
|
// check rollout is in running state
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("status", equalTo("paused")));
|
.andExpect(jsonPath("status", equalTo("paused")));
|
||||||
}
|
}
|
||||||
@@ -536,7 +536,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
// check rollout is in running state
|
// check rollout is in running state
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("id", equalTo(rollout.getId().intValue())))
|
||||||
.andExpect(jsonPath("status", equalTo("running")));
|
.andExpect(jsonPath("status", equalTo("running")));
|
||||||
}
|
}
|
||||||
@@ -604,7 +604,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
// (amountTargets / groupSize = 2)
|
// (amountTargets / groupSize = 2)
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups?sort=ID:ASC", rollout.getId())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups?sort=ID:ASC", rollout.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2)))
|
||||||
.andExpect(jsonPath("$.content[0].status", equalTo("running")))
|
.andExpect(jsonPath("$.content[0].status", equalTo("running")))
|
||||||
.andExpect(jsonPath("$.content[1].status", equalTo("scheduled")));
|
.andExpect(jsonPath("$.content[1].status", equalTo("scheduled")));
|
||||||
@@ -642,7 +642,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
rolloutManagement.handleRollouts();
|
rolloutManagement.handleRollouts();
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("status", equalTo("running")))
|
||||||
.andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(5)))
|
.andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(5)))
|
||||||
.andExpect(jsonPath("$.totalTargetsPerStatus.notstarted", equalTo(0)))
|
.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())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), secondGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("status", equalTo("scheduled")))
|
||||||
.andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(0)))
|
.andExpect(jsonPath("$.totalTargetsPerStatus.running", equalTo(0)))
|
||||||
.andExpect(jsonPath("$.totalTargetsPerStatus.notstarted", equalTo(0)))
|
.andExpect(jsonPath("$.totalTargetsPerStatus.notstarted", equalTo(0)))
|
||||||
@@ -669,7 +669,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
rolloutManagement.handleRollouts();
|
rolloutManagement.handleRollouts();
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("status", equalTo("ready")))
|
||||||
.andExpect(jsonPath("$.lastModifiedBy", equalTo("bumlux")))
|
.andExpect(jsonPath("$.lastModifiedBy", equalTo("bumlux")))
|
||||||
.andExpect(jsonPath("$.lastModifiedAt", not(equalTo(0))))
|
.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())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("id", equalTo(firstGroup.getId().intValue())))
|
||||||
.andExpect(jsonPath("status", equalTo("creating"))).andExpect(jsonPath("name", endsWith("1")))
|
.andExpect(jsonPath("status", equalTo("creating"))).andExpect(jsonPath("name", endsWith("1")))
|
||||||
.andExpect(jsonPath("description", 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())
|
get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.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())
|
get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON).param("q", "controllerId==" + targetInGroup))
|
.accept(MediaType.APPLICATION_JSON).param("q", "controllerId==" + targetInGroup))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", 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())
|
get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.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")
|
mvc.perform(get("/rest/v1/rollouts").param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==*2")
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1)))
|
||||||
.andExpect(jsonPath("$.content[0].name", equalTo(rollout2.getName())));
|
.andExpect(jsonPath("$.content[0].name", equalTo(rollout2.getName())));
|
||||||
|
|
||||||
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)
|
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==rollout*"))
|
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==rollout*"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.andExpect(jsonPath("$.content", hasSize(3))).andExpect(jsonPath("$.total", equalTo(3)));
|
||||||
|
|
||||||
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)
|
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==*1")).andDo(MockMvcResultPrinter.print())
|
.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)));
|
.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())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON).param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group-1"))
|
.accept(MediaType.APPLICATION_JSON).param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group-1"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1)))
|
||||||
.andExpect(jsonPath("$.content[0].name", equalTo("group-1")));
|
.andExpect(jsonPath("$.content[0].name", equalTo("group-1")));
|
||||||
|
|
||||||
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId())
|
mvc.perform(get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON).param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group*"))
|
.accept(MediaType.APPLICATION_JSON).param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group*"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", hasSize(4))).andExpect(jsonPath("$.total", equalTo(4)));
|
||||||
|
|
||||||
mvc.perform(
|
mvc.perform(
|
||||||
get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()).accept(MediaType.APPLICATION_JSON)
|
get("/rest/v1/rollouts/{rolloutId}/deploygroups", rollout.getId()).accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group-1,name==group-2"))
|
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "name==group-1,name==group-2"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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", hasSize(2))).andExpect(jsonPath("$.total", equalTo(2)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import static org.hamcrest.Matchers.containsString;
|
|||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.junit.Assert.assertTrue;
|
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.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.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.post;
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||||
@@ -170,10 +170,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
// upload
|
// upload
|
||||||
final MvcResult mvcResult = mvc
|
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))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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.md5", equalTo(md5sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
||||||
@@ -207,7 +207,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, randomBytes);
|
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, randomBytes);
|
||||||
|
|
||||||
// try to upload
|
// 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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isForbidden())
|
.andExpect(status().isForbidden())
|
||||||
.andExpect(jsonPath("$.exceptionClass", equalTo(FileSizeQuotaExceededException.class.getName())))
|
.andExpect(jsonPath("$.exceptionClass", equalTo(FileSizeQuotaExceededException.class.getName())))
|
||||||
@@ -223,7 +223,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final byte[] randomBytes = randomBytes(5 * 1024);
|
final byte[] randomBytes = randomBytes(5 * 1024);
|
||||||
final MockMultipartFile file = new MockMultipartFile("file", illegalFilename, null, randomBytes);
|
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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isBadRequest())
|
.andExpect(status().isBadRequest())
|
||||||
.andExpect(jsonPath("$.message", containsString("Invalid characters in string")));
|
.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]);
|
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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isBadRequest());
|
.andExpect(status().isBadRequest());
|
||||||
}
|
}
|
||||||
@@ -283,15 +283,15 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final String sha256sum = HashGeneratorUtils.generateSHA256(random);
|
final String sha256sum = HashGeneratorUtils.generateSHA256(random);
|
||||||
final MockMultipartFile file = new MockMultipartFile("file", "orig", null, 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())
|
.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.md5", equalTo(md5sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
||||||
.andExpect(jsonPath("$.providedFilename", equalTo("orig"))).andExpect(status().isCreated());
|
.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());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isConflict());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,9 +306,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
||||||
|
|
||||||
// upload
|
// 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())
|
"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());
|
.andExpect(jsonPath("$.providedFilename", equalTo("customFilename"))).andExpect(status().isCreated());
|
||||||
|
|
||||||
// check result in db...
|
// check result in db...
|
||||||
@@ -335,7 +335,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
// upload
|
// upload
|
||||||
// wrong sha1
|
// wrong sha1
|
||||||
MvcResult mvcResult = mvc
|
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))
|
.param("md5sum", md5sum).param("sha1sum", "afsdff").param("sha256sum", sha256sum))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn();
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn();
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
// wrong sha256
|
// wrong sha256
|
||||||
mvcResult = mvc
|
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"))
|
.param("md5sum", md5sum).param("sha1sum", sha1sum).param("sha256sum", "jdshfsd"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn();
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn();
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
// wrong md5
|
// wrong md5
|
||||||
mvcResult = mvc
|
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))
|
.param("md5sum", "sdfsdfs").param("sha1sum", sha1sum).param("sha256sum", sha256sum))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest()).andReturn();
|
.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")
|
assertThat(exceptionInfo.getErrorCode()).as("Exception contains wrong error code")
|
||||||
.isEqualTo(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH.getKey());
|
.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())
|
.param("md5sum", md5sum).param("sha1sum", sha1sum)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isCreated());
|
.andExpect(status().isCreated());
|
||||||
|
|
||||||
@@ -389,10 +389,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final MockMultipartFile file = new MockMultipartFile("file", "origFilename" + i, null, random);
|
final MockMultipartFile file = new MockMultipartFile("file", "origFilename" + i, null, random);
|
||||||
|
|
||||||
// upload
|
// 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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isCreated())
|
.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.md5", equalTo(md5sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
.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);
|
final MockMultipartFile file = new MockMultipartFile("file", "origFilename_final", null, random);
|
||||||
|
|
||||||
// upload
|
// 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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isForbidden())
|
.andExpect(status().isForbidden())
|
||||||
.andExpect(jsonPath("$.exceptionClass", equalTo(AssignmentQuotaExceededException.class.getName())))
|
.andExpect(jsonPath("$.exceptionClass", equalTo(AssignmentQuotaExceededException.class.getName())))
|
||||||
@@ -433,10 +433,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
// upload
|
// upload
|
||||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs("sm" + i);
|
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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isCreated())
|
.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.md5", equalTo(md5sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
|
||||||
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
.andExpect(jsonPath("$.hashes.sha256", equalTo(sha256sum)))
|
||||||
@@ -450,7 +450,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
// upload
|
// upload
|
||||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs("sm" + numArtifacts);
|
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())
|
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isForbidden())
|
.andExpect(status().isForbidden())
|
||||||
.andExpect(jsonPath("$.exceptionClass", equalTo(StorageQuotaExceededException.class.getName())))
|
.andExpect(jsonPath("$.exceptionClass", equalTo(StorageQuotaExceededException.class.getName())))
|
||||||
@@ -504,7 +504,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
// perform test
|
// perform test
|
||||||
mvc.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}", sm.getId(), artifact.getId())
|
mvc.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}", sm.getId(), artifact.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.id", equalTo(artifact.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.size", equalTo(random.length)))
|
.andExpect(jsonPath("$.size", equalTo(random.length)))
|
||||||
.andExpect(jsonPath("$.hashes.md5", equalTo(artifact.getMd5Hash())))
|
.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))
|
mvc.perform(get("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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].id", equalTo(artifact.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.[0].size", equalTo(random.length)))
|
.andExpect(jsonPath("$.[0].size", equalTo(random.length)))
|
||||||
.andExpect(jsonPath("$.[0].hashes.md5", equalTo(artifact.getMd5Hash())))
|
.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())
|
mvc.perform(get("/rest/v1/softwaremodules/1234567890/artifacts")).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isNotFound());
|
.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());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||||
|
|
||||||
// bad request - no content
|
// 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());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest());
|
||||||
|
|
||||||
// not allowed methods
|
// not allowed methods
|
||||||
@@ -689,7 +689,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
mvc.perform(get("/rest/v1/softwaremodules").accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/softwaremodules").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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() + ")].name", contains(os.getName())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + os.getId() + ")].version", contains(os.getVersion())))
|
.andExpect(jsonPath("$.content.[?(@.id==" + os.getId() + ")].version", contains(os.getVersion())))
|
||||||
.andExpect(
|
.andExpect(
|
||||||
@@ -727,7 +727,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
// only by name, only one exists per name
|
// only by name, only one exists per name
|
||||||
mvc.perform(get("/rest/v1/softwaremodules?q=name==" + os1.getName()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/softwaremodules?q=name==" + os1.getName()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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() + ")].name", contains(os1.getName())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].version", contains(os1.getVersion())))
|
.andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].version", contains(os1.getVersion())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].description",
|
.andExpect(jsonPath("$.content.[?(@.id==" + os1.getId() + ")].description",
|
||||||
@@ -739,7 +739,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
// by type, 2 software modules per type exists
|
// by type, 2 software modules per type exists
|
||||||
mvc.perform(get("/rest/v1/softwaremodules?q=type==" + Constants.SMT_DEFAULT_APP_KEY)
|
mvc.perform(get("/rest/v1/softwaremodules?q=type==" + Constants.SMT_DEFAULT_APP_KEY)
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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() + ")].name", contains(app1.getName())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].version", contains(app1.getVersion())))
|
.andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].version", contains(app1.getVersion())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].description",
|
.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())
|
"/rest/v1/softwaremodules?q=type==" + Constants.SMT_DEFAULT_APP_KEY + ";version==" + app1.getVersion())
|
||||||
.accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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() + ")].name", contains(app1.getName())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].version", contains(app1.getVersion())))
|
.andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].version", contains(app1.getVersion())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.id==" + app1.getId() + ")].description",
|
.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))
|
mvc.perform(get("/rest/v1/softwaremodules/{smId}", os.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.name", equalTo(os.getName())))
|
||||||
.andExpect(jsonPath("$.version", equalTo(os.getVersion())))
|
.andExpect(jsonPath("$.version", equalTo(os.getVersion())))
|
||||||
.andExpect(jsonPath("$.description", equalTo(os.getDescription())))
|
.andExpect(jsonPath("$.description", equalTo(os.getDescription())))
|
||||||
@@ -830,10 +830,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
|
|
||||||
final MvcResult mvcResult = mvc
|
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))
|
.content(JsonBuilder.softwareModules(modules)).contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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].name", equalTo("name1")))
|
||||||
.andExpect(jsonPath("[0].version", equalTo("version1")))
|
.andExpect(jsonPath("[0].version", equalTo("version1")))
|
||||||
.andExpect(jsonPath("[0].description", equalTo("description1")))
|
.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)
|
mvc.perform(post("/rest/v1/softwaremodules/{swId}/metadata", sm.getId()).accept(MediaType.APPLICATION_JSON)
|
||||||
.contentType(MediaType.APPLICATION_JSON).content(metaData1.toString()))
|
.contentType(MediaType.APPLICATION_JSON).content(metaData1.toString()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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]key", equalTo(knownKey1))).andExpect(jsonPath("[0]value", equalTo(knownValue1)))
|
||||||
.andExpect(jsonPath("[0]targetVisible", equalTo(false)))
|
.andExpect(jsonPath("[0]targetVisible", equalTo(false)))
|
||||||
.andExpect(jsonPath("[1]key", equalTo(knownKey2))).andExpect(jsonPath("[1]value", equalTo(knownValue2)))
|
.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)
|
mvc.perform(put("/rest/v1/softwaremodules/{swId}/metadata/{key}", sm.getId(), knownKey)
|
||||||
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
|
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(jsonObject.toString())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
|
||||||
|
|
||||||
final SoftwareModuleMetadata assertDS = softwareModuleManagement
|
final SoftwareModuleMetadata assertDS = softwareModuleManagement
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
|||||||
|
|
||||||
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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() + "')].name", contains(osType.getName())))
|
||||||
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].description",
|
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].description",
|
||||||
contains(osType.getDescription())))
|
contains(osType.getDescription())))
|
||||||
@@ -109,7 +109,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
|||||||
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON)
|
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:DESC"))
|
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:DESC"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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].id", equalTo(testType.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.content.[1].name", equalTo("TestName123")))
|
.andExpect(jsonPath("$.content.[1].name", equalTo("TestName123")))
|
||||||
.andExpect(jsonPath("$.content.[1].description", equalTo("Desc1234")))
|
.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)
|
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON)
|
||||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:ASC"))
|
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:ASC"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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].id", equalTo(testType.getId().intValue())))
|
||||||
.andExpect(jsonPath("$.content.[2].name", equalTo("TestName123")))
|
.andExpect(jsonPath("$.content.[2].name", equalTo("TestName123")))
|
||||||
.andExpect(jsonPath("$.content.[2].description", equalTo("Desc1234")))
|
.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))
|
.perform(post("/rest/v1/softwaremoduletypes/").content(JsonBuilder.softwareModuleTypes(types))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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].name", equalTo("TestName1"))).andExpect(jsonPath("[0].key", equalTo("test1")))
|
||||||
.andExpect(jsonPath("[0].description", equalTo("Desc1")))
|
.andExpect(jsonPath("[0].description", equalTo("Desc1")))
|
||||||
.andExpect(jsonPath("[0].createdBy", equalTo("uploadTester")))
|
.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))
|
mvc.perform(get("/rest/v1/softwaremoduletypes/{smtId}", testType.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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("$.name", equalTo("TestName123")))
|
||||||
.andExpect(jsonPath("$.description", equalTo("Desc1234")))
|
.andExpect(jsonPath("$.description", equalTo("Desc1234")))
|
||||||
.andExpect(jsonPath("$.maxAssignments", equalTo(5)))
|
.andExpect(jsonPath("$.maxAssignments", equalTo(5)))
|
||||||
|
|||||||
@@ -776,7 +776,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
|||||||
.perform(post("/rest/v1/targets/").content(JsonBuilder.targets(targets, true))
|
.perform(post("/rest/v1/targets/").content(JsonBuilder.targets(targets, true))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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].name", equalTo("testname1")))
|
||||||
.andExpect(jsonPath("[0].controllerId", equalTo("id1")))
|
.andExpect(jsonPath("[0].controllerId", equalTo("id1")))
|
||||||
.andExpect(jsonPath("[0].description", equalTo("testid1")))
|
.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)
|
mvc.perform(post("/rest/v1/targets/{targetId}/metadata", knownControllerId).accept(MediaType.APPLICATION_JSON)
|
||||||
.contentType(MediaType.APPLICATION_JSON).content(metaData1.toString()))
|
.contentType(MediaType.APPLICATION_JSON).content(metaData1.toString()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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]key", equalTo(knownKey1))).andExpect(jsonPath("[0]value", equalTo(knownValue1)))
|
||||||
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
||||||
.andExpect(jsonPath("[1]value", equalTo(knownValue2)));
|
.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)
|
mvc.perform(put("/rest/v1/targets/{targetId}/metadata/{key}", knownControllerId, knownKey)
|
||||||
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
|
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(jsonObject.toString())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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)));
|
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
|
||||||
|
|
||||||
final TargetMetadata updatedTargetMetadata = targetManagement
|
final TargetMetadata updatedTargetMetadata = targetManagement
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
|
|
||||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(applyTagMatcherOnPagedResult(assigned)).andExpect(applyTagMatcherOnPagedResult(unassigned))
|
||||||
.andExpect(applySelfLinkMatcherOnPagedResult(assigned, TARGETTAGS_ROOT + assigned.getId()))
|
.andExpect(applySelfLinkMatcherOnPagedResult(assigned, TARGETTAGS_ROOT + assigned.getId()))
|
||||||
.andExpect(applySelfLinkMatcherOnPagedResult(unassigned, TARGETTAGS_ROOT + unassigned.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())
|
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(applyTagMatcherOnSingleResult(assigned))
|
||||||
.andExpect(applySelfLinkMatcherOnSingleResult(TARGETTAGS_ROOT + assigned.getId()))
|
.andExpect(applySelfLinkMatcherOnSingleResult(TARGETTAGS_ROOT + assigned.getId()))
|
||||||
.andExpect(jsonPath("_links.assignedTargets.href",
|
.andExpect(jsonPath("_links.assignedTargets.href",
|
||||||
@@ -106,7 +106,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
.content(JsonBuilder.tags(Arrays.asList(tagOne, tagTwo)))
|
.content(JsonBuilder.tags(Arrays.asList(tagOne, tagTwo)))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.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);
|
final Tag createdOne = targetTagManagement.findByRsql(PAGE, "name==thetest1").getContent().get(0);
|
||||||
assertThat(createdOne.getName()).isEqualTo(tagOne.getName());
|
assertThat(createdOne.getName()).isEqualTo(tagOne.getName());
|
||||||
@@ -136,7 +136,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
.content(JsonBuilder.tag(update)).contentType(MediaType.APPLICATION_JSON)
|
.content(JsonBuilder.tag(update)).contentType(MediaType.APPLICATION_JSON)
|
||||||
.accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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);
|
final Tag updated = targetTagManagement.findByRsql(PAGE, "name==updatedName").getContent().get(0);
|
||||||
assertThat(updated.getName()).isEqualTo(update.getName());
|
assertThat(updated.getName()).isEqualTo(update.getName());
|
||||||
@@ -258,7 +258,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
targets.stream().map(Target::getControllerId).collect(Collectors.toList())))
|
targets.stream().map(Target::getControllerId).collect(Collectors.toList())))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -276,7 +276,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
targets.stream().map(Target::getControllerId).collect(Collectors.toList())))
|
targets.stream().map(Target::getControllerId).collect(Collectors.toList())))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE));
|
||||||
|
|
||||||
final List<Target> updated = targetManagement.findByTag(PAGE, tag.getId()).getContent();
|
final List<Target> updated = targetManagement.findByTag(PAGE, tag.getId()).getContent();
|
||||||
|
|
||||||
|
|||||||
@@ -10,3 +10,4 @@
|
|||||||
# Logging START - activate to see request/response details
|
# Logging START - activate to see request/response details
|
||||||
#logging.level.org.eclipse.hawkbit.rest.util.MockMvcResultPrinter=DEBUG
|
#logging.level.org.eclipse.hawkbit.rest.util.MockMvcResultPrinter=DEBUG
|
||||||
# Logging END
|
# Logging END
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
<name>hawkBit :: REST :: Core</name>
|
<name>hawkBit :: REST :: Core</name>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
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
|
* List that extends ResourceSupport to ensure that links in content are in HAL
|
||||||
@@ -22,7 +22,7 @@ import org.springframework.hateoas.ResourceSupport;
|
|||||||
* @param <T>
|
* @param <T>
|
||||||
* of the response content
|
* of the response content
|
||||||
*/
|
*/
|
||||||
public class ResponseList<T> extends ResourceSupport implements List<T> {
|
public class ResponseList<T> extends RepresentationModel<ResponseList<T>> implements List<T> {
|
||||||
|
|
||||||
private final List<T> content;
|
private final List<T> content;
|
||||||
|
|
||||||
|
|||||||
@@ -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.DefaultMockMvcBuilder;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
import org.springframework.web.filter.CharacterEncodingFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Test for Rest tests.
|
* Abstract Test for Rest tests.
|
||||||
@@ -38,6 +39,9 @@ public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTes
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FilterHttpResponse filterHttpResponse;
|
private FilterHttpResponse filterHttpResponse;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CharacterEncodingFilter characterEncodingFilter;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected WebApplicationContext webApplicationContext;
|
protected WebApplicationContext webApplicationContext;
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTes
|
|||||||
protected DefaultMockMvcBuilder createMvcWebAppContext(final WebApplicationContext context) {
|
protected DefaultMockMvcBuilder createMvcWebAppContext(final WebApplicationContext context) {
|
||||||
final DefaultMockMvcBuilder createMvcWebAppContext = MockMvcBuilders.webAppContextSetup(context);
|
final DefaultMockMvcBuilder createMvcWebAppContext = MockMvcBuilders.webAppContextSetup(context);
|
||||||
|
|
||||||
|
createMvcWebAppContext.addFilter(characterEncodingFilter);
|
||||||
createMvcWebAppContext.addFilter(
|
createMvcWebAppContext.addFilter(
|
||||||
new ExcludePathAwareShallowETagFilter("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download",
|
new ExcludePathAwareShallowETagFilter("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download",
|
||||||
"/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/**",
|
"/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/**",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
|
|||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
import io.qameta.allure.Story;
|
import io.qameta.allure.Story;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-rest-docs</artifactId>
|
<artifactId>hawkbit-rest-docs</artifactId>
|
||||||
<name>hawkbit :: REST :: Documentation</name>
|
<name>hawkbit :: REST :: Documentation</name>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
final String json = mapper.writeValueAsString(Arrays.asList(bodyPut));
|
final String json = mapper.writeValueAsString(Arrays.asList(bodyPut));
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).content(json)
|
.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())
|
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(getRequestFieldsTag(true), getResponseFieldsTag(true)));
|
.andDo(this.document.document(getRequestFieldsTag(true), getResponseFieldsTag(true)));
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(
|
.perform(
|
||||||
put(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}", tagId)
|
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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionsetTagId")
|
pathParameters(parameterWithName("distributionsetTagId")
|
||||||
@@ -146,7 +146,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
final Long tagId = createDistributionSetTagId();
|
final Long tagId = createDistributionSetTagId();
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}",
|
.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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID))));
|
parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID))));
|
||||||
@@ -162,7 +162,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tag.getId())
|
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tag.getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionsetTagId")
|
pathParameters(parameterWithName("distributionsetTagId")
|
||||||
@@ -187,7 +187,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionsetTagId")
|
pathParameters(parameterWithName("distributionsetTagId")
|
||||||
@@ -210,7 +210,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tagId).content(json)
|
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tagId).content(json)
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionsetTagId")
|
pathParameters(parameterWithName("distributionsetTagId")
|
||||||
@@ -227,7 +227,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
|
|||||||
.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING
|
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING
|
||||||
+ "/{distributionsetId}", tagId, distributionSet.getId())
|
+ "/{distributionsetId}", tagId, distributionSet.getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(
|
mockMvc.perform(
|
||||||
get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(jsonPath("$.total", equalTo(4)))
|
.andExpect(jsonPath("$.total", equalTo(4)))
|
||||||
.andDo(this.document.document(responseFields(
|
.andDo(this.document.document(responseFields(
|
||||||
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
|
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)
|
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*"))
|
.param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==a*"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(getFilterRequestParamter()));
|
.andDo(this.document.document(getFilterRequestParamter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
|
|
||||||
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
|
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
|
||||||
.content(JsonBuilder.distributionSetTypesCreateValidFieldsOnly(types))
|
.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(
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()).andDo(
|
||||||
this.document.document(
|
this.document.document(
|
||||||
requestFields(
|
requestFields(
|
||||||
@@ -213,7 +213,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
|
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(put(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
|
.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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionSetTypeId")
|
pathParameters(parameterWithName("distributionSetTypeId")
|
||||||
@@ -249,7 +249,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
|
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionSetTypeId")
|
pathParameters(parameterWithName("distributionSetTypeId")
|
||||||
@@ -281,7 +281,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
|
|
||||||
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId())
|
+ "/{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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionSetTypeId")
|
pathParameters(parameterWithName("distributionSetTypeId")
|
||||||
@@ -299,7 +299,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(delete(
|
mockMvc.perform(delete(
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}",
|
+ "/{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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
@@ -317,7 +317,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(get(
|
mockMvc.perform(get(
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}",
|
+ "/{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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
@@ -346,7 +346,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
|
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionSetTypeId")
|
pathParameters(parameterWithName("distributionSetTypeId")
|
||||||
.description(ApiModelPropertiesGeneric.ITEM_ID)),
|
.description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -375,7 +375,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1"));
|
entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1"));
|
||||||
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId())
|
+ "/{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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("distributionSetTypeId")
|
pathParameters(parameterWithName("distributionSetTypeId")
|
||||||
@@ -394,7 +394,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(delete(
|
mockMvc.perform(delete(
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}",
|
+ "/{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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
@@ -411,7 +411,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
|
|||||||
mockMvc.perform(get(
|
mockMvc.perform(get(
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}",
|
+ "/{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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
|
|
||||||
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId())
|
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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))
|
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(responseFields(
|
.andDo(this.document.document(responseFields(
|
||||||
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
||||||
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
|
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")
|
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).param("offset", "1").param("limit", "2")
|
||||||
.param("sort", "version:DESC").param("q", "name==testDS*").accept(MediaType.APPLICATION_JSON))
|
.param("sort", "version:DESC").param("q", "name==testDS*").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(getFilterRequestParamter()));
|
.andDo(this.document.document(getFilterRequestParamter()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/")
|
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/")
|
||||||
.content(JsonBuilder.distributionSetsCreateValidFieldsOnly(sets))
|
.content(JsonBuilder.distributionSetsCreateValidFieldsOnly(sets))
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
|
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
|
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())
|
mockMvc.perform(put(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId())
|
||||||
.content(JsonBuilder.distributionSetUpdateValidFieldsOnly(update))
|
.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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -217,7 +217,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
|
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
|
||||||
set.getId()).accept(MediaType.APPLICATION_JSON))
|
set.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -242,7 +242,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
mockMvc.perform(get(
|
mockMvc.perform(get(
|
||||||
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/autoAssignTargetFilters",
|
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/autoAssignTargetFilters",
|
||||||
set.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
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(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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")
|
.param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==*1")
|
||||||
.accept(MediaType.APPLICATION_JSON))
|
.accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(requestParameters(
|
.andDo(this.document.document(requestParameters(
|
||||||
parameterWithName("limit").attributes(key("type").value("query"))
|
parameterWithName("limit").attributes(key("type").value("query"))
|
||||||
.description(ApiModelPropertiesGeneric.LIMIT),
|
.description(ApiModelPropertiesGeneric.LIMIT),
|
||||||
@@ -291,7 +291,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
|
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
|
||||||
.param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON))
|
.param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(requestParameters(
|
.andDo(this.document.document(requestParameters(
|
||||||
parameterWithName("limit").attributes(key("type").value("query"))
|
parameterWithName("limit").attributes(key("type").value("query"))
|
||||||
.description(ApiModelPropertiesGeneric.LIMIT),
|
.description(ApiModelPropertiesGeneric.LIMIT),
|
||||||
@@ -317,7 +317,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
|
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
|
||||||
.param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON))
|
.param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(requestParameters(
|
.andDo(this.document.document(requestParameters(
|
||||||
parameterWithName("limit").attributes(key("type").value("query"))
|
parameterWithName("limit").attributes(key("type").value("query"))
|
||||||
.description(ApiModelPropertiesGeneric.LIMIT),
|
.description(ApiModelPropertiesGeneric.LIMIT),
|
||||||
@@ -342,7 +342,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/installedTargets",
|
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/installedTargets",
|
||||||
set.getId()).accept(MediaType.APPLICATION_JSON))
|
set.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -376,7 +376,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(
|
.perform(post(
|
||||||
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
|
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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
@@ -432,7 +432,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
|
|
||||||
// post assignment
|
// post assignment
|
||||||
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
@@ -450,7 +450,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING
|
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING
|
||||||
+ "/{distributionSetId}/assignedSM/{softwareModuleId}",
|
+ "/{distributionSetId}/assignedSM/{softwareModuleId}",
|
||||||
set.getId(), set.findFirstModuleByType(osType).get().getId())
|
set.getId(), set.findFirstModuleByType(osType).get().getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
@@ -467,7 +467,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
// post assignment
|
// post assignment
|
||||||
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
||||||
set.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
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(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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")
|
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*")
|
.param("offset", "1").param("limit", "2").param("sort", "version:DESC").param("q", "name==one*")
|
||||||
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(
|
.andDo(this.document.document(requestParameters(
|
||||||
parameterWithName("limit").attributes(key("type").value("query"))
|
parameterWithName("limit").attributes(key("type").value("query"))
|
||||||
.description(ApiModelPropertiesGeneric.LIMIT),
|
.description(ApiModelPropertiesGeneric.LIMIT),
|
||||||
@@ -525,7 +525,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
|
|
||||||
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
||||||
testDS.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
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(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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())
|
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*"))
|
.param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
requestParameters(
|
requestParameters(
|
||||||
parameterWithName("limit").attributes(key("type").value("query"))
|
parameterWithName("limit").attributes(key("type").value("query"))
|
||||||
@@ -610,7 +610,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
|
|
||||||
mockMvc.perform(put(
|
mockMvc.perform(put(
|
||||||
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadatakey}",
|
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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
@@ -662,9 +662,9 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
|
|||||||
jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2));
|
jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2));
|
||||||
|
|
||||||
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
|
|
||||||
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON_VALUE))
|
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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,
|
.andDo(this.document.document(getRolloutResponseFields(true, false,
|
||||||
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
||||||
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
|
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")
|
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))
|
.param("sort", "id:DESC").param("q", "name==exampleRollout*").accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(getFilterRequestParamter()));
|
.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())
|
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}", rollout.getId())
|
||||||
.accept(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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),
|
.andDo(this.document.document(getRolloutResponseFields(false, true),
|
||||||
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID))));
|
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID))));
|
||||||
}
|
}
|
||||||
@@ -195,9 +195,9 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING)
|
post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING)
|
||||||
.content(JsonBuilder.rollout(name, description, groupSize, dsId, targetFilter,
|
.content(JsonBuilder.rollout(name, description, groupSize, dsId, targetFilter,
|
||||||
rolloutGroupConditions, type))
|
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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(requestFields(
|
.andDo(this.document.document(requestFields(
|
||||||
requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
|
requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
|
||||||
requestFieldWithPathMandatoryInMultiAssignMode("weight").type(JsonFieldType.NUMBER)
|
requestFieldWithPathMandatoryInMultiAssignMode("weight").type(JsonFieldType.NUMBER)
|
||||||
@@ -285,7 +285,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
rolloutGroupConditions, rolloutGroups))
|
rolloutGroupConditions, rolloutGroups))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaTypes.HAL_JSON_VALUE))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
requestFields(requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
|
requestFields(requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
|
||||||
requestFieldWithPathMandatoryInMultiAssignMode("weight")
|
requestFieldWithPathMandatoryInMultiAssignMode("weight")
|
||||||
@@ -448,7 +448,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
|
|
||||||
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups", rollout.getId())
|
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups", rollout.getId())
|
||||||
.accept(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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(
|
.andDo(this.document.document(
|
||||||
getRolloutDeployGroupResponseFields(true, false,
|
getRolloutDeployGroupResponseFields(true, false,
|
||||||
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
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}",
|
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}",
|
||||||
rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE))
|
rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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),
|
.andDo(this.document.document(getRolloutDeployGroupResponseFields(false, true),
|
||||||
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
parameterWithName("deployGroupId").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())
|
.param("sort", "id:DESC").param("q", "id==" + firstRolloutGroup.getId())
|
||||||
.accept(MediaTypes.HAL_JSON_VALUE))
|
.accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
parameterWithName("deployGroupId").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",
|
get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}/targets",
|
||||||
rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE))
|
rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
parameterWithName("deployGroupId").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")
|
.param("sort", "name:ASC").param("q", "controllerId==exampleTarget0")
|
||||||
.accept(MediaTypes.HAL_JSON_VALUE))
|
.accept(MediaTypes.HAL_JSON_VALUE))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
|
.perform(post(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
|
||||||
.content(JsonBuilder.softwareModuleTypesCreatableFieldsOnly(types))
|
.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(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
requestFields(
|
requestFields(
|
||||||
@@ -194,7 +194,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
|
|||||||
|
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(put(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeID}",
|
.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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("softwareModuleTypeID")
|
pathParameters(parameterWithName("softwareModuleTypeID")
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
.update(entityFactory.softwareModule().update(sm2.getId()).description("a description"));
|
.update(entityFactory.softwareModule().update(sm2.getId()).description("a description"));
|
||||||
|
|
||||||
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
|
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(
|
.andDo(this.document.document(responseFields(
|
||||||
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
||||||
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
|
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*"))
|
.param("limit", "2").param("sort", "version:DESC").param("q", "name==SM*"))
|
||||||
|
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(getFilterRequestParamter()));
|
.andDo(this.document.document(getFilterRequestParamter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,9 +130,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
final List<SoftwareModule> modules = Arrays.asList(os, ah);
|
final List<SoftwareModule> modules = Arrays.asList(os, ah);
|
||||||
|
|
||||||
mockMvc.perform(post(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
|
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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
|
requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
|
||||||
optionalRequestFieldWithPath("[]description")
|
optionalRequestFieldWithPath("[]description")
|
||||||
@@ -179,7 +179,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
|
|
||||||
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}", sm.getId()))
|
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}", sm.getId()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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();
|
.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())
|
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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -251,7 +251,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
mockMvc.perform(
|
mockMvc.perform(
|
||||||
get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()))
|
get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -282,11 +282,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
final byte random[] = RandomStringUtils.random(5).getBytes();
|
final byte random[] = RandomStringUtils.random(5).getBytes();
|
||||||
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
||||||
|
|
||||||
mockMvc.perform(
|
mockMvc.perform(fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()).file(file))
|
||||||
fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
|
||||||
sm.getId()).file(file))
|
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -318,12 +316,11 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
final byte random[] = RandomStringUtils.random(5).getBytes();
|
final byte random[] = RandomStringUtils.random(5).getBytes();
|
||||||
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
||||||
|
|
||||||
mockMvc.perform(
|
mockMvc.perform(fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
||||||
fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
|
||||||
sm.getId()).file(file).param("filename", "filename").param("file", "s")
|
sm.getId()).file(file).param("filename", "filename").param("file", "s")
|
||||||
.param("md5sum", "md5sum").param("sha1sum", "sha1sum"))
|
.param("md5sum", "md5sum").param("sha1sum", "sha1sum"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(this.document.document(requestParameters(
|
.andDo(this.document.document(requestParameters(
|
||||||
parameterWithName("filename").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILENAME),
|
parameterWithName("filename").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILENAME),
|
||||||
parameterWithName("file").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILE),
|
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}",
|
get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||||
sm.getId(), artifact.getId()))
|
sm.getId(), artifact.getId()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
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",
|
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||||
module.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
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(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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",
|
module.getId()).param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q",
|
||||||
"key==known*"))
|
"key==known*"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
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));
|
jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2).put("targetVisible", true));
|
||||||
|
|
||||||
mockMvc.perform(post(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(
|
pathParameters(
|
||||||
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -569,7 +566,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
|
|||||||
|
|
||||||
mockMvc.perform(
|
mockMvc.perform(
|
||||||
put(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}",
|
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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("softwareModuleId")
|
pathParameters(parameterWithName("softwareModuleId")
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
|||||||
final String target = createTargetJsonForPostRequest("123456", "controllerId", "test");
|
final String target = createTargetJsonForPostRequest("123456", "controllerId", "test");
|
||||||
|
|
||||||
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
|
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(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(requestFields(
|
.andDo(this.document.document(requestFields(
|
||||||
requestFieldWithPath("[]controllerId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
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");
|
final String targetAsJson = createJsonTarget(targetId, "newTargetName", "I've been updated");
|
||||||
|
|
||||||
mockMvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}", target.getControllerId())
|
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(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -414,7 +414,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
|||||||
mockMvc.perform(
|
mockMvc.perform(
|
||||||
put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + MgmtRestConstants.TARGET_V1_ACTIONS
|
put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + MgmtRestConstants.TARGET_V1_ACTIONS
|
||||||
+ "/{actionId}", targetId, actionId).content(this.objectMapper.writeValueAsString(body))
|
+ "/{actionId}", targetId, actionId).content(this.objectMapper.writeValueAsString(body))
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
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}/"
|
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/"
|
||||||
+ MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET, targetId).content(body)
|
+ 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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -558,7 +558,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
|||||||
enableMultiAssignments();
|
enableMultiAssignments();
|
||||||
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/"
|
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/"
|
||||||
+ MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET, targetId).content(body.toString())
|
+ 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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -649,7 +649,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
|||||||
mockMvc.perform(
|
mockMvc.perform(
|
||||||
get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId()))
|
get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
responseFields(fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
|
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())
|
get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId())
|
||||||
.param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*"))
|
.param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*"))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
requestParameters(
|
requestParameters(
|
||||||
parameterWithName("limit").attributes(key("type").value("query"))
|
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}",
|
mockMvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadatakey}",
|
||||||
testTarget.getControllerId(), knownKey)
|
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(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
@@ -782,9 +782,9 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
|||||||
|
|
||||||
mockMvc.perform(
|
mockMvc.perform(
|
||||||
post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId())
|
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())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
.andExpect(content().contentType(MediaTypes.HAL_JSON))
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
requestFields(requestFieldWithPath("[]key").description(MgmtApiModelProperties.META_DATA_KEY),
|
requestFields(requestFieldWithPath("[]key").description(MgmtApiModelProperties.META_DATA_KEY),
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
final String json = mapper.writeValueAsString(Arrays.asList(bodyPut));
|
final String json = mapper.writeValueAsString(Arrays.asList(bodyPut));
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).content(json)
|
.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())
|
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(getRequestFieldsTargetTag(true), getResponseFieldTargetTag(true)));
|
.andDo(this.document.document(getRequestFieldsTargetTag(true), getResponseFieldTargetTag(true)));
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
|
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(put(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}", tagId).content(json)
|
.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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -142,7 +142,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
final Long tagId = createTargetTagId();
|
final Long tagId = createTargetTagId();
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}", tagId)
|
.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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(pathParameters(
|
.andDo(this.document.document(pathParameters(
|
||||||
parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID))));
|
parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID))));
|
||||||
@@ -159,7 +159,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tag.getId())
|
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tag.getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -185,7 +185,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/toggleTagAssignment", tagId)
|
+ 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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -208,7 +208,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tagId).content(json)
|
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tagId).content(json)
|
||||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||||
@@ -225,7 +225,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
|
|||||||
.perform(delete(
|
.perform(delete(
|
||||||
MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
|
||||||
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/{controllerId}",
|
+ 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())
|
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
|
||||||
.andDo(this.document.document(
|
.andDo(this.document.document(
|
||||||
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-rest-parent</artifactId>
|
<artifactId>hawkbit-rest-parent</artifactId>
|
||||||
<name>hawkBit :: REST</name>
|
<name>hawkBit :: REST</name>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-runtime-parent</artifactId>
|
<artifactId>hawkbit-runtime-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-update-server</artifactId>
|
<artifactId>hawkbit-update-server</artifactId>
|
||||||
<name>hawkBit :: Runtime :: Update Server</name>
|
<name>hawkBit :: Runtime :: Update Server</name>
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ spring.security.user.name=admin
|
|||||||
spring.security.user.password={noop}admin
|
spring.security.user.password={noop}admin
|
||||||
spring.main.allow-bean-definition-overriding=true
|
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
|
# DDI authentication configuration
|
||||||
hawkbit.server.ddi.security.authentication.anonymous.enabled=false
|
hawkbit.server.ddi.security.authentication.anonymous.enabled=false
|
||||||
hawkbit.server.ddi.security.authentication.targettoken.enabled=true
|
hawkbit.server.ddi.security.authentication.targettoken.enabled=true
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.security.test.context.support.WithUserDetails;
|
import org.springframework.security.test.context.support.WithUserDetails;
|
||||||
import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers;
|
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.TestExecutionListeners;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
@@ -38,8 +39,9 @@ import io.qameta.allure.Story;
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(properties = {"hawkbit.dmf.rabbitmq.enabled=false", "hawkbit.server.security.cors.enabled=true",
|
@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})
|
"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)
|
mergeMode = MergeMode.MERGE_WITH_DEFAULTS)
|
||||||
|
@DirtiesContext
|
||||||
@Feature("Integration Test - Security")
|
@Feature("Integration Test - Security")
|
||||||
@Story("CORS")
|
@Story("CORS")
|
||||||
public class CorsTest {
|
public class CorsTest {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>hawkbit-runtime-parent</artifactId>
|
<artifactId>hawkbit-runtime-parent</artifactId>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-security-core</artifactId>
|
<artifactId>hawkbit-security-core</artifactId>
|
||||||
<name>hawkBit :: Core Security</name>
|
<name>hawkBit :: Core Security</name>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.eclipse.hawkbit.security.HawkbitSecurityProperties.Clients;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import io.qameta.allure.Description;
|
import io.qameta.allure.Description;
|
||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-parent</artifactId>
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-security-integration</artifactId>
|
<artifactId>hawkbit-security-integration</artifactId>
|
||||||
<name>hawkBit :: Security Integration</name>
|
<name>hawkBit :: Security Integration</name>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
|
||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import io.qameta.allure.Description;
|
import io.qameta.allure.Description;
|
||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-starters</artifactId>
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-boot-starter-ddi-api</artifactId>
|
<artifactId>hawkbit-boot-starter-ddi-api</artifactId>
|
||||||
<name>hawkBit :: Spring Boot Starter DDI API</name>
|
<name>hawkBit :: Spring Boot Starter DDI API</name>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-starters</artifactId>
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-boot-starter-dmf-api</artifactId>
|
<artifactId>hawkbit-boot-starter-dmf-api</artifactId>
|
||||||
<name>hawkBit :: Spring Boot Starter DMF API</name>
|
<name>hawkBit :: Spring Boot Starter DMF API</name>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-starters</artifactId>
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-boot-starter-mgmt-api</artifactId>
|
<artifactId>hawkbit-boot-starter-mgmt-api</artifactId>
|
||||||
<name>hawkBit :: Spring Boot Starter Management API</name>
|
<name>hawkBit :: Spring Boot Starter Management API</name>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-starters</artifactId>
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-boot-starter-mgmt-ui</artifactId>
|
<artifactId>hawkbit-boot-starter-mgmt-ui</artifactId>
|
||||||
<name>hawkBit :: Spring Boot Starter Management UI</name>
|
<name>hawkBit :: Spring Boot Starter Management UI</name>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-starters</artifactId>
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
<version>0.3.0-SNAPSHOT</version>
|
<version>0.4.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-boot-starter</artifactId>
|
<artifactId>hawkbit-boot-starter</artifactId>
|
||||||
<name>hawkBit :: Spring Boot Starter</name>
|
<name>hawkBit :: Spring Boot Starter</name>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user