Spring Boot 2.0 (#721)
* Migration to Boot 2.0. Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import org.eclipse.hawkbit.rest.RestConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Controller;
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@Import(RestConfiguration.class)
|
||||
@PropertySource("classpath:/hawkbit-mgmt-api-defaults.properties")
|
||||
public class MgmtApiConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -66,29 +65,36 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtDistributionSetResource.class);
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleManagement softwareModuleManagement;
|
||||
private final SoftwareModuleManagement softwareModuleManagement;
|
||||
|
||||
@Autowired
|
||||
private TargetManagement targetManagement;
|
||||
private final TargetManagement targetManagement;
|
||||
|
||||
@Autowired
|
||||
private TargetFilterQueryManagement targetFilterQueryManagement;
|
||||
private final TargetFilterQueryManagement targetFilterQueryManagement;
|
||||
|
||||
@Autowired
|
||||
private DeploymentManagement deployManagament;
|
||||
private final DeploymentManagement deployManagament;
|
||||
|
||||
@Autowired
|
||||
private SystemManagement systemManagement;
|
||||
private final SystemManagement systemManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
private final DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Autowired
|
||||
private SystemSecurityContext systemSecurityContext;
|
||||
private final SystemSecurityContext systemSecurityContext;
|
||||
|
||||
MgmtDistributionSetResource(final SoftwareModuleManagement softwareModuleManagement,
|
||||
final TargetManagement targetManagement, final TargetFilterQueryManagement targetFilterQueryManagement,
|
||||
final DeploymentManagement deployManagament, final SystemManagement systemManagement,
|
||||
final EntityFactory entityFactory, final DistributionSetManagement distributionSetManagement,
|
||||
final SystemSecurityContext systemSecurityContext) {
|
||||
this.softwareModuleManagement = softwareModuleManagement;
|
||||
this.targetManagement = targetManagement;
|
||||
this.targetFilterQueryManagement = targetFilterQueryManagement;
|
||||
this.deployManagament = deployManagament;
|
||||
this.systemManagement = systemManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
this.distributionSetManagement = distributionSetManagement;
|
||||
this.systemSecurityContext = systemSecurityContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtDistributionSet>> getDistributionSets(
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -50,14 +49,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtDistributionSetTagResource.class);
|
||||
|
||||
@Autowired
|
||||
private DistributionSetTagManagement distributionSetTagManagement;
|
||||
private final DistributionSetTagManagement distributionSetTagManagement;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
private final DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtDistributionSetTagResource(final DistributionSetTagManagement distributionSetTagManagement,
|
||||
final DistributionSetManagement distributionSetManagement, final EntityFactory entityFactory) {
|
||||
this.distributionSetTagManagement = distributionSetTagManagement;
|
||||
this.distributionSetManagement = distributionSetManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
||||
@@ -140,7 +143,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
||||
public ResponseEntity<List<MgmtDistributionSet>> getAssignedDistributionSets(
|
||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId) {
|
||||
return ResponseEntity.ok(MgmtDistributionSetMapper.toResponseDistributionSets(distributionSetManagement
|
||||
.findByTag(new PageRequest(0, MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT),
|
||||
.findByTag(PageRequest.of(0, MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT),
|
||||
distributionsetTagId)
|
||||
.getContent()));
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.rest.data.ResponseList;
|
||||
|
||||
/**
|
||||
* A mapper which maps repository model to RESTful model representation and
|
||||
@@ -66,20 +67,13 @@ final class MgmtDistributionSetTypeMapper {
|
||||
.orElse(Collections.emptyList());
|
||||
}
|
||||
|
||||
static List<MgmtDistributionSetType> toTypesResponse(final List<DistributionSetType> types) {
|
||||
if (types == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return types.stream().map(MgmtDistributionSetTypeMapper::toResponse).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
static List<MgmtDistributionSetType> toListResponse(final List<DistributionSetType> types) {
|
||||
if (types == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return types.stream().map(MgmtDistributionSetTypeMapper::toResponse).collect(Collectors.toList());
|
||||
return new ResponseList<>(
|
||||
types.stream().map(MgmtDistributionSetTypeMapper::toResponse).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
static MgmtDistributionSetType toResponse(final DistributionSetType type) {
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -48,14 +47,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeRestApi {
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
private final SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetTypeManagement distributionSetTypeManagement;
|
||||
private final DistributionSetTypeManagement distributionSetTypeManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtDistributionSetTypeResource(final SoftwareModuleTypeManagement softwareModuleTypeManagement,
|
||||
final DistributionSetTypeManagement distributionSetTypeManagement, final EntityFactory entityFactory) {
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
||||
@@ -127,7 +130,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
||||
.create(MgmtDistributionSetTypeMapper.smFromRequest(entityFactory, distributionSetTypes));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(MgmtDistributionSetTypeMapper.toTypesResponse(createdSoftwareModules));
|
||||
.body(MgmtDistributionSetTypeMapper.toListResponse(createdSoftwareModules));
|
||||
}
|
||||
|
||||
private DistributionSetType findDistributionSetTypeWithExceptionIfNotFound(final Long distributionSetTypeId) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.eclipse.hawkbit.rest.util.FileStreamingUtil;
|
||||
import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -37,14 +36,18 @@ public class MgmtDownloadResource implements MgmtDownloadRestApi {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MgmtDownloadResource.class);
|
||||
|
||||
@Autowired
|
||||
private ArtifactRepository artifactRepository;
|
||||
private final ArtifactRepository artifactRepository;
|
||||
|
||||
@Autowired
|
||||
private DownloadIdCache downloadIdCache;
|
||||
private final DownloadIdCache downloadIdCache;
|
||||
|
||||
@Autowired
|
||||
private RequestResponseContextHolder requestResponseContextHolder;
|
||||
private final RequestResponseContextHolder requestResponseContextHolder;
|
||||
|
||||
MgmtDownloadResource(final ArtifactRepository artifactRepository, final DownloadIdCache downloadIdCache,
|
||||
final RequestResponseContextHolder requestResponseContextHolder) {
|
||||
this.artifactRepository = artifactRepository;
|
||||
this.downloadIdCache = downloadIdCache;
|
||||
this.requestResponseContextHolder = requestResponseContextHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ResponseBody
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -51,20 +50,25 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
@Autowired
|
||||
private RolloutManagement rolloutManagement;
|
||||
private final RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupManagement rolloutGroupManagement;
|
||||
private final RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
private final DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Autowired
|
||||
private TargetFilterQueryManagement targetFilterQueryManagement;
|
||||
private final TargetFilterQueryManagement targetFilterQueryManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtRolloutResource(final RolloutManagement rolloutManagement, final RolloutGroupManagement rolloutGroupManagement,
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement, final EntityFactory entityFactory) {
|
||||
this.rolloutManagement = rolloutManagement;
|
||||
this.rolloutGroupManagement = rolloutGroupManagement;
|
||||
this.distributionSetManagement = distributionSetManagement;
|
||||
this.targetFilterQueryManagement = targetFilterQueryManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtRolloutResponseBody>> getRollouts(
|
||||
@@ -119,8 +123,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
rollout = rolloutManagement.create(create, rolloutGroups, rolloutGroupConditions);
|
||||
|
||||
} else if (rolloutRequestBody.getAmountGroups() != null) {
|
||||
rollout = rolloutManagement.create(create, rolloutRequestBody.getAmountGroups(),
|
||||
rolloutGroupConditions);
|
||||
rollout = rolloutManagement.create(create, rolloutRequestBody.getAmountGroups(), rolloutGroupConditions);
|
||||
|
||||
} else {
|
||||
throw new ValidationException("Either 'amountGroups' or 'groups' must be defined in the request");
|
||||
@@ -222,7 +225,8 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
|
||||
final Page<Target> rolloutGroupTargets;
|
||||
if (rsqlParam != null) {
|
||||
rolloutGroupTargets = this.rolloutGroupManagement.findTargetsOfRolloutGroupByRsql(pageable, groupId, rsqlParam);
|
||||
rolloutGroupTargets = this.rolloutGroupManagement.findTargetsOfRolloutGroupByRsql(pageable, groupId,
|
||||
rsqlParam);
|
||||
} else {
|
||||
final Page<Target> pageTargets = this.rolloutGroupManagement.findTargetsOfRolloutGroup(pageable, groupId);
|
||||
rolloutGroupTargets = pageTargets;
|
||||
@@ -232,9 +236,8 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
}
|
||||
|
||||
private DistributionSet findDistributionSetOrThrowException(final MgmtRolloutRestRequestBody rolloutRequestBody) {
|
||||
return this.distributionSetManagement.get(rolloutRequestBody.getDistributionSetId())
|
||||
.orElseThrow(() -> new EntityNotFoundException(DistributionSet.class,
|
||||
rolloutRequestBody.getDistributionSetId()));
|
||||
return this.distributionSetManagement.get(rolloutRequestBody.getDistributionSetId()).orElseThrow(
|
||||
() -> new EntityNotFoundException(DistributionSet.class, rolloutRequestBody.getDistributionSetId()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -43,6 +42,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -56,18 +56,22 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtSoftwareModuleResource.class);
|
||||
|
||||
@Autowired
|
||||
private ArtifactManagement artifactManagement;
|
||||
private final ArtifactManagement artifactManagement;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleManagement softwareModuleManagement;
|
||||
private final SoftwareModuleManagement softwareModuleManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtSoftwareModuleResource(final ArtifactManagement artifactManagement,
|
||||
final SoftwareModuleManagement softwareModuleManagement, final EntityFactory entityFactory) {
|
||||
this.artifactManagement = artifactManagement;
|
||||
this.softwareModuleManagement = softwareModuleManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MgmtArtifact> uploadArtifact(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@RequestParam("file") final MultipartFile file,
|
||||
@RequestPart("file") final MultipartFile file,
|
||||
@RequestParam(value = "filename", required = false) final String optionalFileName,
|
||||
@RequestParam(value = "md5sum", required = false) final String md5Sum,
|
||||
@RequestParam(value = "sha1sum", required = false) final String sha1Sum) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -42,11 +41,16 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRestApi {
|
||||
@Autowired
|
||||
private SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final SoftwareModuleTypeManagement softwareModuleTypeManagement;
|
||||
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtSoftwareModuleTypeResource(final SoftwareModuleTypeManagement softwareModuleTypeManagement,
|
||||
final EntityFactory entityFactory) {
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
||||
@@ -96,10 +100,9 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes
|
||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId,
|
||||
@RequestBody final MgmtSoftwareModuleTypeRequestBodyPut restSoftwareModuleType) {
|
||||
|
||||
final SoftwareModuleType updatedSoftwareModuleType = softwareModuleTypeManagement
|
||||
.update(entityFactory.softwareModuleType().update(softwareModuleTypeId)
|
||||
.description(restSoftwareModuleType.getDescription())
|
||||
.colour(restSoftwareModuleType.getColour()));
|
||||
final SoftwareModuleType updatedSoftwareModuleType = softwareModuleTypeManagement.update(entityFactory
|
||||
.softwareModuleType().update(softwareModuleTypeId).description(restSoftwareModuleType.getDescription())
|
||||
.colour(restSoftwareModuleType.getColour()));
|
||||
|
||||
return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toResponse(updatedSoftwareModuleType));
|
||||
}
|
||||
@@ -108,8 +111,8 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes
|
||||
public ResponseEntity<List<MgmtSoftwareModuleType>> createSoftwareModuleTypes(
|
||||
@RequestBody final List<MgmtSoftwareModuleTypeRequestBodyPost> softwareModuleTypes) {
|
||||
|
||||
final List<SoftwareModuleType> createdSoftwareModules = softwareModuleTypeManagement.create(
|
||||
MgmtSoftwareModuleTypeMapper.smFromRequest(entityFactory, softwareModuleTypes));
|
||||
final List<SoftwareModuleType> createdSoftwareModules = softwareModuleTypeManagement
|
||||
.create(MgmtSoftwareModuleTypeMapper.smFromRequest(entityFactory, softwareModuleTypes));
|
||||
|
||||
return new ResponseEntity<>(MgmtSoftwareModuleTypeMapper.toTypesResponse(createdSoftwareModules),
|
||||
HttpStatus.CREATED);
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.repository.report.model.SystemUsageReportWithTenants;
|
||||
import org.eclipse.hawkbit.repository.report.model.TenantUsage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -40,11 +39,14 @@ public class MgmtSystemManagementResource implements MgmtSystemManagementRestApi
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MgmtSystemManagementResource.class);
|
||||
|
||||
@Autowired
|
||||
private SystemManagement systemManagement;
|
||||
private final SystemManagement systemManagement;
|
||||
|
||||
@Autowired
|
||||
private CacheManager cacheManager;
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
MgmtSystemManagementResource(final SystemManagement systemManagement, final CacheManager cacheManager) {
|
||||
this.systemManagement = systemManagement;
|
||||
this.cacheManager = cacheManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the tenant data of a given tenant. USE WITH CARE!
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -44,11 +43,15 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestApi {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtTargetFilterQueryResource.class);
|
||||
|
||||
@Autowired
|
||||
private TargetFilterQueryManagement filterManagement;
|
||||
private final TargetFilterQueryManagement filterManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtTargetFilterQueryResource(final TargetFilterQueryManagement filterManagement,
|
||||
final EntityFactory entityFactory) {
|
||||
this.filterManagement = filterManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MgmtTargetFilterQuery> getFilter(@PathVariable("filterId") final Long filterId) {
|
||||
|
||||
@@ -192,7 +192,7 @@ public final class MgmtTargetMapper {
|
||||
|
||||
return actionStatus.stream().map(status -> toResponse(status,
|
||||
deploymentManagement.findMessagesByActionStatusId(
|
||||
new PageRequest(0, MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT), status.getId())
|
||||
PageRequest.of(0, MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT), status.getId())
|
||||
.getContent()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ import org.eclipse.hawkbit.repository.model.TargetMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -61,16 +60,22 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
private static final String ACTION_TARGET_MISSING_ASSIGN_WARN = "given action ({}) is not assigned to given target ({}).";
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtTargetResource.class);
|
||||
|
||||
@Autowired
|
||||
private TargetManagement targetManagement;
|
||||
private final TargetManagement targetManagement;
|
||||
|
||||
@Autowired
|
||||
private DeploymentManagement deploymentManagement;
|
||||
private final DeploymentManagement deploymentManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtTargetResource(final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
|
||||
final EntityFactory entityFactory) {
|
||||
this.targetManagement = targetManagement;
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MgmtTarget> getTarget(@PathVariable("targetId") final String targetId) {
|
||||
@@ -163,8 +168,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
||||
@PathVariable("targetId") final String targetId,
|
||||
public ResponseEntity<PagedList<MgmtAction>> getActionHistory(@PathVariable("targetId") final String targetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
|
||||
@@ -188,8 +192,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(
|
||||
new PagedList<>(MgmtTargetMapper.toResponse(targetId, activeActions.getContent()),
|
||||
totalActionCount));
|
||||
new PagedList<>(MgmtTargetMapper.toResponse(targetId, activeActions.getContent()), totalActionCount));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,7 +202,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
final Action action = deploymentManagement.findAction(actionId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
if (!action.getTarget().getControllerId().equals(targetId)) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", action.getId(), targetId);
|
||||
LOG.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, action.getId(), targetId);
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@@ -214,7 +217,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
|
||||
if (!action.getTarget().getControllerId().equals(targetId)) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", actionId, targetId);
|
||||
LOG.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, actionId, targetId);
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@@ -242,7 +245,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
|
||||
if (!action.getTarget().getId().equals(target.getId())) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", action.getId(), target.getId());
|
||||
LOG.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, action.getId(), target.getId());
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@@ -278,8 +281,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MgmtTargetAssignmentResponseBody> postAssignedDistributionSet(
|
||||
@PathVariable("targetId") final String targetId,
|
||||
@RequestBody final MgmtDistributionSetAssignment dsId,
|
||||
@PathVariable("targetId") final String targetId, @RequestBody final MgmtDistributionSetAssignment dsId,
|
||||
@RequestParam(value = "offline", required = false) final boolean offline) {
|
||||
|
||||
if (offline) {
|
||||
@@ -340,7 +342,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
Action action = deploymentManagement.findAction(actionId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
if (!action.getTarget().getControllerId().equals(targetId)) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", action.getId(), targetId);
|
||||
LOG.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, action.getId(), targetId);
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -49,14 +48,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtTargetTagResource.class);
|
||||
|
||||
@Autowired
|
||||
private TargetTagManagement tagManagement;
|
||||
private final TargetTagManagement tagManagement;
|
||||
|
||||
@Autowired
|
||||
private TargetManagement targetManagement;
|
||||
private final TargetManagement targetManagement;
|
||||
|
||||
@Autowired
|
||||
private EntityFactory entityFactory;
|
||||
private final EntityFactory entityFactory;
|
||||
|
||||
MgmtTargetTagResource(final TargetTagManagement tagManagement, final TargetManagement targetManagement,
|
||||
final EntityFactory entityFactory) {
|
||||
this.tagManagement = tagManagement;
|
||||
this.targetManagement = targetManagement;
|
||||
this.entityFactory = entityFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
||||
@@ -131,7 +134,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
public ResponseEntity<List<MgmtTarget>> getAssignedTargets(@PathVariable("targetTagId") final Long targetTagId) {
|
||||
|
||||
return ResponseEntity.ok(MgmtTargetMapper.toResponse(targetManagement
|
||||
.findByTag(new PageRequest(0, MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT), targetTagId)
|
||||
.findByTag(PageRequest.of(0, MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT), targetTagId)
|
||||
.getContent()));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -37,7 +36,6 @@ public class MgmtTenantManagementResource implements MgmtTenantManagementRestApi
|
||||
private final TenantConfigurationManagement tenantConfigurationManagement;
|
||||
private final TenantConfigurationProperties tenantConfigurationProperties;
|
||||
|
||||
@Autowired
|
||||
MgmtTenantManagementResource(final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
final TenantConfigurationProperties tenantConfigurationProperties) {
|
||||
this.tenantConfigurationManagement = tenantConfigurationManagement;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (c) 2018 Microsoft and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
# Upload of large files
|
||||
spring.servlet.multipart.max-file-size=1024MB
|
||||
spring.servlet.multipart.max-request-size=-1
|
||||
spring.servlet.multipart.file-size-threshold=1MB
|
||||
@@ -12,16 +12,23 @@ import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
|
||||
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.test.TestConfiguration;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.eclipse.hawkbit.rest.RestConfiguration;
|
||||
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.web.servlet.ResultMatcher;
|
||||
|
||||
@SpringApplicationConfiguration(classes = { MgmtApiConfiguration.class })
|
||||
@ContextConfiguration(classes = { MgmtApiConfiguration.class, RestConfiguration.class,
|
||||
RepositoryApplicationConfiguration.class, TestConfiguration.class, TestSupportBinderAutoConfiguration.class })
|
||||
@TestPropertySource(locations = "classpath:/mgmt-test.properties")
|
||||
public abstract class AbstractManagementApiIntegrationTest extends AbstractRestIntegrationTest {
|
||||
|
||||
protected static ResultMatcher applyBaseEntityMatcherOnArrayResult(final BaseEntity entity,
|
||||
@@ -41,13 +48,13 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
|
||||
protected static ResultMatcher applyTargetEntityMatcherOnArrayResult(final Target entity, final String arrayElement)
|
||||
throws Exception {
|
||||
return mvcResult -> {
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].createdBy",
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].createdBy",
|
||||
contains(entity.getCreatedBy())).match(mvcResult);
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].createdAt",
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].createdAt",
|
||||
contains(entity.getCreatedAt())).match(mvcResult);
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedBy",
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedBy",
|
||||
contains(entity.getLastModifiedBy())).match(mvcResult);
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedAt",
|
||||
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedAt",
|
||||
contains(entity.getLastModifiedAt())).match(mvcResult);
|
||||
};
|
||||
}
|
||||
@@ -104,13 +111,13 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
|
||||
|
||||
protected static ResultMatcher applyTargetEntityMatcherOnArrayResult(final Target entity) throws Exception {
|
||||
return mvcResult -> {
|
||||
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].createdBy",
|
||||
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].createdBy",
|
||||
contains(entity.getCreatedBy())).match(mvcResult);
|
||||
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].createdAt",
|
||||
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].createdAt",
|
||||
contains(entity.getCreatedAt())).match(mvcResult);
|
||||
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedBy",
|
||||
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedBy",
|
||||
contains(entity.getLastModifiedBy())).match(mvcResult);
|
||||
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedAt",
|
||||
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedAt",
|
||||
contains(entity.getLastModifiedAt())).match(mvcResult);
|
||||
};
|
||||
}
|
||||
@@ -119,8 +126,8 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
|
||||
return mvcResult -> {
|
||||
applyBaseEntityMatcherOnPagedResult(entity);
|
||||
|
||||
jsonPath("$.[?(@.id==" + entity.getId() + ")].name", contains(entity.getName())).match(mvcResult);
|
||||
jsonPath("$.[?(@.id==" + entity.getId() + ")].description", contains(entity.getDescription()))
|
||||
jsonPath("$.[?(@.id=='" + entity.getId() + "')].name", contains(entity.getName())).match(mvcResult);
|
||||
jsonPath("$.[?(@.id=='" + entity.getId() + "')].description", contains(entity.getDescription()))
|
||||
.match(mvcResult);
|
||||
};
|
||||
}
|
||||
@@ -130,7 +137,7 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
|
||||
return mvcResult -> {
|
||||
applyNamedEntityMatcherOnPagedResult(entity);
|
||||
|
||||
jsonPath("$.[?(@.id==" + entity.getId() + ")].version", contains(entity.getVersion())).match(mvcResult);
|
||||
jsonPath("$.[?(@.id=='" + entity.getId() + "')].version", contains(entity.getVersion())).match(mvcResult);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -138,14 +145,14 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
|
||||
return mvcResult -> {
|
||||
applyNamedEntityMatcherOnPagedResult(entity);
|
||||
|
||||
jsonPath("$.[?(@.id==" + entity.getId() + ")].colour", contains(entity.getColour())).match(mvcResult);
|
||||
jsonPath("$.[?(@.id=='" + entity.getId() + "')].colour", contains(entity.getColour())).match(mvcResult);
|
||||
};
|
||||
}
|
||||
|
||||
protected static ResultMatcher applySelfLinkMatcherOnArrayResult(final BaseEntity entity, final String link)
|
||||
throws Exception {
|
||||
return mvcResult -> {
|
||||
jsonPath("$.[?(@.id==" + entity.getId() + ")]._links.self.href", contains(link)).match(mvcResult);
|
||||
jsonPath("$.[?(@.id=='" + entity.getId() + "')]._links.self.href", contains(link)).match(mvcResult);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@@ -305,7 +305,13 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet();
|
||||
|
||||
final JSONArray payload = new JSONArray();
|
||||
targets.forEach(trg -> payload.put(new JSONObject().put("id", trg.getId())));
|
||||
targets.forEach(trg -> {
|
||||
try {
|
||||
payload.put(new JSONObject().put("id", trg.getId()));
|
||||
} catch (final JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + ds.getId() + "/assignedTargets")
|
||||
.contentType(MediaType.APPLICATION_JSON).content(payload.toString())).andExpect(status().isForbidden());
|
||||
@@ -344,7 +350,13 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
final List<Target> targets = testdataFactory.createTargets(5);
|
||||
final JSONArray list = new JSONArray();
|
||||
targets.forEach(target -> list.put(new JSONObject().put("id", target.getControllerId())));
|
||||
targets.forEach(target -> {
|
||||
try {
|
||||
list.put(new JSONObject().put("id", target.getControllerId()));
|
||||
} catch (final JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), targets.get(0).getControllerId());
|
||||
@@ -373,7 +385,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
for (final String targetId : knownTargetIds) {
|
||||
testdataFactory.createTarget(targetId);
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
|
||||
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(0), "", "")));
|
||||
new JSONObject().put("schedule", getTestSchedule(0))));
|
||||
}
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
@@ -396,7 +408,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
for (final String targetId : knownTargetIds) {
|
||||
testdataFactory.createTarget(targetId);
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
|
||||
AbstractIntegrationTest.getMaintenanceWindow("", AbstractIntegrationTest.getTestDuration(10), "")));
|
||||
new JSONObject().put("duration", getTestDuration(10))));
|
||||
}
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
@@ -419,8 +431,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
for (final String targetId : knownTargetIds) {
|
||||
testdataFactory.createTarget(targetId);
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
|
||||
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(10),
|
||||
AbstractIntegrationTest.getTestDuration(10), AbstractIntegrationTest.getTestTimeZone())));
|
||||
new JSONObject().put("schedule", getTestSchedule(10)).put("duration", getTestDuration(10))
|
||||
.put("timezone", getTestTimeZone())));
|
||||
}
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
@@ -443,8 +455,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
for (final String targetId : knownTargetIds) {
|
||||
testdataFactory.createTarget(targetId);
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
|
||||
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(-30),
|
||||
AbstractIntegrationTest.getTestDuration(5), AbstractIntegrationTest.getTestTimeZone())));
|
||||
new JSONObject().put("schedule", getTestSchedule(-30)).put("duration", getTestDuration(5))
|
||||
.put("timezone", getTestTimeZone())));
|
||||
}
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
@@ -468,9 +480,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
testdataFactory.createTarget(targetId);
|
||||
if (Integer.parseInt(targetId) % 2 == 0) {
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
|
||||
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(10),
|
||||
AbstractIntegrationTest.getTestDuration(5),
|
||||
AbstractIntegrationTest.getTestTimeZone())));
|
||||
new JSONObject().put("schedule", getTestSchedule(10)).put("duration", getTestDuration(5))
|
||||
.put("timezone", getTestTimeZone())));
|
||||
} else {
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)));
|
||||
}
|
||||
@@ -690,11 +701,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
.andExpect(jsonPath("$.content.[0].lastModifiedBy", equalTo(set.getLastModifiedBy())))
|
||||
.andExpect(jsonPath("$.content.[0].lastModifiedAt", equalTo(set.getLastModifiedAt())))
|
||||
.andExpect(jsonPath("$.content.[0].version", equalTo(set.getVersion())))
|
||||
.andExpect(jsonPath("$.content.[0].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.content.[0].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
|
||||
contains(set.findFirstModuleByType(runtimeType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("$.content.[0].modules.[?(@.type==" + appType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.content.[0].modules.[?(@.type=='" + appType.getKey() + "')].id",
|
||||
contains(set.findFirstModuleByType(appType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("$.content.[0].modules.[?(@.type==" + osType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.content.[0].modules.[?(@.type=='" + osType.getKey() + "')].id",
|
||||
contains(getOsModule(set).intValue())));
|
||||
}
|
||||
|
||||
@@ -722,11 +733,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
.andExpect(jsonPath("$.lastModifiedBy", equalTo(set.getLastModifiedBy())))
|
||||
.andExpect(jsonPath("$.lastModifiedAt", equalTo(set.getLastModifiedAt())))
|
||||
.andExpect(jsonPath("$.version", equalTo(set.getVersion())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
|
||||
contains(set.findFirstModuleByType(runtimeType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].id",
|
||||
contains(set.findFirstModuleByType(appType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].id",
|
||||
contains(getOsModule(set).intValue())));
|
||||
|
||||
}
|
||||
@@ -808,11 +819,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
.andExpect(jsonPath("[0]version", equalTo(one.getVersion())))
|
||||
.andExpect(jsonPath("[0]complete", equalTo(Boolean.TRUE)))
|
||||
.andExpect(jsonPath("[0]requiredMigrationStep", equalTo(one.isRequiredMigrationStep())))
|
||||
.andExpect(jsonPath("[0].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[0].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
|
||||
contains(one.findFirstModuleByType(runtimeType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[0].modules.[?(@.type==" + appType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[0].modules.[?(@.type=='" + appType.getKey() + "')].id",
|
||||
contains(one.findFirstModuleByType(appType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[0].modules.[?(@.type==" + osType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[0].modules.[?(@.type=='" + osType.getKey() + "')].id",
|
||||
contains(one.findFirstModuleByType(osType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[1]name", equalTo(two.getName())))
|
||||
.andExpect(jsonPath("[1]description", equalTo(two.getDescription())))
|
||||
@@ -820,11 +831,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
.andExpect(jsonPath("[1]type", equalTo(standardDsType.getKey())))
|
||||
.andExpect(jsonPath("[1]createdBy", equalTo("uploadTester")))
|
||||
.andExpect(jsonPath("[1]version", equalTo(two.getVersion())))
|
||||
.andExpect(jsonPath("[1].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[1].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
|
||||
contains(two.findFirstModuleByType(runtimeType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[1].modules.[?(@.type==" + appType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[1].modules.[?(@.type=='" + appType.getKey() + "')].id",
|
||||
contains(two.findFirstModuleByType(appType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[1].modules.[?(@.type==" + osType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[1].modules.[?(@.type=='" + osType.getKey() + "')].id",
|
||||
contains(two.findFirstModuleByType(osType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[1]requiredMigrationStep", equalTo(two.isRequiredMigrationStep())))
|
||||
.andExpect(jsonPath("[2]name", equalTo(three.getName())))
|
||||
@@ -833,11 +844,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
.andExpect(jsonPath("[2]type", equalTo(standardDsType.getKey())))
|
||||
.andExpect(jsonPath("[2]createdBy", equalTo("uploadTester")))
|
||||
.andExpect(jsonPath("[2]version", equalTo(three.getVersion())))
|
||||
.andExpect(jsonPath("[2].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[2].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
|
||||
contains(three.findFirstModuleByType(runtimeType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[2].modules.[?(@.type==" + appType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[2].modules.[?(@.type=='" + appType.getKey() + "')].id",
|
||||
contains(three.findFirstModuleByType(appType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[2].modules.[?(@.type==" + osType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("[2].modules.[?(@.type=='" + osType.getKey() + "')].id",
|
||||
contains(three.findFirstModuleByType(osType).get().getId().intValue())))
|
||||
.andExpect(jsonPath("[2]requiredMigrationStep", equalTo(three.isRequiredMigrationStep()))).andReturn();
|
||||
}
|
||||
@@ -1045,7 +1056,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
// verify that the number of meta data entries has not changed
|
||||
// (we cannot use the PAGE constant here as it tries to sort by ID)
|
||||
assertThat(distributionSetManagement
|
||||
.findMetaDataByDistributionSetId(new PageRequest(0, Integer.MAX_VALUE), testDS.getId())
|
||||
.findMetaDataByDistributionSetId(PageRequest.of(0, Integer.MAX_VALUE), testDS.getId())
|
||||
.getTotalElements()).isEqualTo(metaData1.length());
|
||||
|
||||
}
|
||||
|
||||
@@ -72,22 +72,22 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
|
||||
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + standardDsType.getKey() + ")]$..name",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].name",
|
||||
contains(standardDsType.getName())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + standardDsType.getKey() + ")]$..description",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].description",
|
||||
contains(standardDsType.getDescription())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + standardDsType.getKey() + ")]$..key",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].key",
|
||||
contains(standardDsType.getKey())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..id", contains(testType.getId().intValue())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..name", contains("TestName123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..description", contains("Desc1234")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..createdBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..createdAt", contains(testType.getCreatedAt())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..lastModifiedBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..lastModifiedAt",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].id", contains(testType.getId().intValue())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].name", contains("TestName123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].description", contains("Desc1234")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdAt", contains(testType.getCreatedAt())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedAt",
|
||||
contains(testType.getLastModifiedAt())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..key", contains("test123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)]$.._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].key", contains("test123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')]._links.self.href",
|
||||
contains("http://localhost/rest/v1/distributionsettypes/" + testType.getId())))
|
||||
.andExpect(jsonPath("$.total", equalTo(5)));
|
||||
}
|
||||
|
||||
@@ -625,9 +625,9 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, "100").build());
|
||||
|
||||
final RolloutGroup firstGroup = rolloutGroupManagement
|
||||
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
final RolloutGroup secondGroup = rolloutGroupManagement
|
||||
.findByRollout(new PageRequest(1, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
.findByRollout(PageRequest.of(1, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
|
||||
retrieveAndVerifyRolloutGroupInCreating(rollout, firstGroup);
|
||||
retrieveAndVerifyRolloutGroupInReady(rollout, firstGroup);
|
||||
@@ -720,7 +720,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
||||
final Rollout rollout = createRollout("rollout1", 2, dsA.getId(), "controllerId==rollout*");
|
||||
|
||||
final RolloutGroup firstGroup = rolloutGroupManagement
|
||||
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
|
||||
// retrieve targets from the first rollout group with known ID
|
||||
mvc.perform(
|
||||
@@ -743,7 +743,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
||||
final Rollout rollout = createRollout("rollout1", 2, dsA.getId(), "controllerId==rollout*");
|
||||
|
||||
final RolloutGroup firstGroup = rolloutGroupManagement
|
||||
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
|
||||
final String targetInGroup = rolloutGroupManagement.findTargetsOfRolloutGroup(PAGE, firstGroup.getId())
|
||||
.getContent().get(0).getControllerId();
|
||||
@@ -774,7 +774,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
||||
rolloutManagement.handleRollouts();
|
||||
|
||||
final RolloutGroup firstGroup = rolloutGroupManagement
|
||||
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
|
||||
|
||||
// retrieve targets from the first rollout group with known ID
|
||||
mvc.perform(
|
||||
|
||||
@@ -53,6 +53,7 @@ import org.json.JSONObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
@@ -294,10 +295,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
||||
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
|
||||
|
||||
// upload
|
||||
mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file)
|
||||
.param("filename", "customFilename").accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||
mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file).param("filename",
|
||||
"customFilename")).andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
|
||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
|
||||
.andExpect(jsonPath("$.providedFilename", equalTo("customFilename"))).andExpect(status().isCreated());
|
||||
|
||||
// check result in db...
|
||||
@@ -979,7 +979,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
||||
// verify that the number of meta data entries has not changed
|
||||
// (we cannot use the PAGE constant here as it tries to sort by ID)
|
||||
assertThat(softwareModuleManagement
|
||||
.findMetaDataBySoftwareModuleId(new PageRequest(0, Integer.MAX_VALUE), sm.getId()).getTotalElements())
|
||||
.findMetaDataBySoftwareModuleId(PageRequest.of(0, Integer.MAX_VALUE), sm.getId()).getTotalElements())
|
||||
.isEqualTo(metaData1.length());
|
||||
|
||||
}
|
||||
|
||||
@@ -59,33 +59,34 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].name", contains(osType.getName())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].description",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].name", contains(osType.getName())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].description",
|
||||
contains(osType.getDescription())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].maxAssignments", contains(1)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].key", contains("os")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].name",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].maxAssignments", contains(1)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].key", contains("os")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].name",
|
||||
contains(runtimeType.getName())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].description",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].description",
|
||||
contains(runtimeType.getDescription())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].maxAssignments", contains(1)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].key", contains("runtime")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].name", contains(appType.getName())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].description",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].maxAssignments", contains(1)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].key", contains("runtime")))
|
||||
.andExpect(
|
||||
jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].name", contains(appType.getName())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].description",
|
||||
contains(appType.getDescription())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].maxAssignments",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].maxAssignments",
|
||||
contains(Integer.MAX_VALUE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].key", contains("application")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].id", contains(testType.getId().intValue())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].name", contains("TestName123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].description", contains("Desc1234")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].createdBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].createdAt", contains(testType.getCreatedAt())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].lastModifiedBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].lastModifiedAt",
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].key", contains("application")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].id", contains(testType.getId().intValue())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].name", contains("TestName123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].description", contains("Desc1234")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdAt", contains(testType.getCreatedAt())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedBy", contains("uploadTester")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedAt",
|
||||
contains(testType.getLastModifiedAt())))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].maxAssignments", contains(5)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key==test123)].key", contains("test123")))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].maxAssignments", contains(5)))
|
||||
.andExpect(jsonPath("$.content.[?(@.key=='test123')].key", contains("test123")))
|
||||
.andExpect(jsonPath("$.total", equalTo(4)));
|
||||
}
|
||||
|
||||
|
||||
@@ -164,14 +164,14 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(knownTargetAmount)))
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(knownTargetAmount)))
|
||||
// idA
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].query", contains(testQuery)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].query", contains(testQuery)))
|
||||
// idB
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].name", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].query", contains(testQuery)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].name", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].query", contains(testQuery)))
|
||||
// idC
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].query", contains(testQuery)));
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].query", contains(testQuery)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -195,8 +195,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(limitSize)))
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)))
|
||||
// idA
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].query", contains(testQuery)));
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].query", contains(testQuery)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -224,14 +224,14 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(expectedSize)))
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)))
|
||||
// idA
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].query", contains(testQuery)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].query", contains(testQuery)))
|
||||
// idB
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].name", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].query", contains(testQuery)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].name", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].query", contains(testQuery)))
|
||||
// idC
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].name", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].query", contains(testQuery)));
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].name", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].query", contains(testQuery)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -119,7 +119,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
controllerManagement.addUpdateActionStatus(
|
||||
entityFactory.actionStatus().create(actions.get(0).getId()).status(Status.FINISHED).message("test"));
|
||||
|
||||
final PageRequest pageRequest = new PageRequest(0, 1000, Direction.ASC, ActionFields.ID.getFieldName());
|
||||
final PageRequest pageRequest = PageRequest.of(0, 1000, Direction.ASC, ActionFields.ID.getFieldName());
|
||||
final Action action = deploymentManagement.findActionsByTarget(knownTargetId, pageRequest).getContent().get(0);
|
||||
|
||||
final ActionStatus status = deploymentManagement.findActionStatusByAction(PAGE, action.getId()).getContent()
|
||||
@@ -179,13 +179,13 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk()).andExpect(jsonPath("total", equalTo(2)))
|
||||
.andExpect(jsonPath("size", equalTo(2)))
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId1 + ")].ipAddress",
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId1 + "')].ipAddress",
|
||||
contains("127.0.0.1")))
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId2 + ")].ipAddress",
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId2 + "')].ipAddress",
|
||||
contains("127.0.0.1")))
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId1 + ")].address",
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId1 + "')].address",
|
||||
contains(IpUtil.createHttpUri("127.0.0.1").toString())))
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId2 + ")].address",
|
||||
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId2 + "')].address",
|
||||
contains(IpUtil.createHttpUri("127.0.0.1").toString())));
|
||||
}
|
||||
|
||||
@@ -443,32 +443,32 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(knownTargetAmount)))
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(knownTargetAmount)))
|
||||
// idA
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].description", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].controllerId", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].lastControllerRequestAt", notNullValue()))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].description", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].controllerId", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].lastControllerRequestAt", notNullValue()))
|
||||
// idB
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].name", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].description", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].controllerId", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].lastControllerRequestAt", notNullValue()))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].name", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].description", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].controllerId", contains(idB)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].lastControllerRequestAt", notNullValue()))
|
||||
// idC
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].description", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].controllerId", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].lastControllerRequestAt", notNullValue()));
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].description", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].controllerId", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].lastControllerRequestAt", notNullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -487,13 +487,13 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(limitSize)))
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)))
|
||||
// idA
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].description", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].controllerId", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].updateStatus", contains("registered")));
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].description", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].controllerId", contains(idA)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].updateStatus", contains("registered")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -516,29 +516,29 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(expectedSize)))
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)))
|
||||
// idA
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].description", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].controllerId", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].description", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].controllerId", contains(idC)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].updateStatus", contains("registered")))
|
||||
// idB
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].name", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].description", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].controllerId", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].updateStatus", contains("registered")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].name", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].description", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].controllerId", contains(idD)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].updateStatus", contains("registered")))
|
||||
// idC
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")]._links.self.href",
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')]._links.self.href",
|
||||
contains(linksHrefPrefix + idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].name", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].description", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].controllerId", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].updateStatus", contains("registered")));
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].name", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].description", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].controllerId", contains(idE)))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].createdBy", contains("bumlux")))
|
||||
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].updateStatus", contains("registered")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -617,38 +617,39 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
.andExpect(jsonPath(JSON_PATH_NAME, equalTo(ds.getName())))
|
||||
.andExpect(jsonPath(JSON_PATH_DESCRIPTION, equalTo(ds.getDescription())))
|
||||
// os
|
||||
.andExpect(
|
||||
jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].id", contains(os.getId().intValue())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].name", contains(os.getName())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].description",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].id",
|
||||
contains(os.getId().intValue())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].name", contains(os.getName())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].description",
|
||||
contains(os.getDescription())))
|
||||
.andExpect(
|
||||
jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].version", contains(os.getVersion())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].vendor", contains(os.getVendor())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].type", contains("os")))
|
||||
jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].version", contains(os.getVersion())))
|
||||
.andExpect(
|
||||
jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].vendor", contains(os.getVendor())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].type", contains("os")))
|
||||
// jvm
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
|
||||
contains(jvm.getId().intValue())))
|
||||
.andExpect(
|
||||
jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].name", contains(jvm.getName())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].description",
|
||||
jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].name", contains(jvm.getName())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].description",
|
||||
contains(jvm.getDescription())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].version",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].version",
|
||||
contains(jvm.getVersion())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].vendor",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].vendor",
|
||||
contains(jvm.getVendor())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].type", contains("runtime")))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].type", contains("runtime")))
|
||||
// baseApp
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].id",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].id",
|
||||
contains(bApp.getId().intValue())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].name", contains(bApp.getName())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].description",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].name", contains(bApp.getName())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].description",
|
||||
contains(bApp.getDescription())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].version",
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].version",
|
||||
contains(bApp.getVersion())))
|
||||
.andExpect(
|
||||
jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].vendor", contains(bApp.getVendor())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].type", contains("application")));
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].vendor",
|
||||
contains(bApp.getVendor())))
|
||||
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].type", contains("application")));
|
||||
|
||||
}
|
||||
|
||||
@@ -808,7 +809,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().is2xxSuccessful());
|
||||
|
||||
final Slice<Target> findTargetsAll = targetManagement.findAll(new PageRequest(0, 100));
|
||||
final Slice<Target> findTargetsAll = targetManagement.findAll(PageRequest.of(0, 100));
|
||||
final Target target = findTargetsAll.getContent().get(0);
|
||||
assertThat(targetManagement.count()).isEqualTo(1);
|
||||
assertThat(target.getControllerId()).isEqualTo(knownControllerId);
|
||||
@@ -1348,7 +1349,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
|
||||
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
|
||||
.put("maintenanceWindow", getMaintenanceWindow(getTestSchedule(0), "", "")).toString();
|
||||
.put("maintenanceWindow", new JSONObject().put("schedule", getTestSchedule(0))).toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
|
||||
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
@@ -1363,7 +1364,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
|
||||
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
|
||||
.put("maintenanceWindow", getMaintenanceWindow("", getTestDuration(10), "")).toString();
|
||||
.put("maintenanceWindow", new JSONObject().put("duration", getTestDuration(10))).toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
|
||||
.content(body).contentType(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print())
|
||||
@@ -1378,8 +1379,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
|
||||
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("forcetime", "0")
|
||||
.put("maintenanceWindow",
|
||||
getMaintenanceWindow(getTestSchedule(10), getTestDuration(10), getTestTimeZone()))
|
||||
.put("maintenanceWindow", new JSONObject().put("schedule", getTestSchedule(10))
|
||||
.put("duration", getTestDuration(10)).put("timezone", getTestTimeZone()))
|
||||
.toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
|
||||
@@ -1395,9 +1396,9 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
final long nextExecutionStart = System.currentTimeMillis();
|
||||
|
||||
final String body = new JSONObject().put("id", set.getId())
|
||||
.put("maintenanceWindow", getMaintenanceWindowWithNextStart(getTestSchedule(10), getTestDuration(10),
|
||||
getTestTimeZone(), nextExecutionStart))
|
||||
final String body = new JSONObject().put("id", set.getId()).put("maintenanceWindow",
|
||||
new JSONObject().put("schedule", getTestSchedule(10)).put("duration", getTestDuration(10))
|
||||
.put("timezone", getTestTimeZone()).put("nextStartAt", String.valueOf(nextExecutionStart)))
|
||||
.toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
|
||||
@@ -1416,8 +1417,10 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final Target target = testdataFactory.createTarget("fsdfsd");
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
|
||||
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("maintenanceWindow",
|
||||
getMaintenanceWindow(getTestSchedule(-30), getTestDuration(5), getTestTimeZone())).toString();
|
||||
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
|
||||
.put("maintenanceWindow", new JSONObject().put("schedule", getTestSchedule(-30))
|
||||
.put("duration", getTestDuration(5)).put("timezone", getTestTimeZone()))
|
||||
.toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
|
||||
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2018 Microsoft and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
# Logging START - activate to see request/response details
|
||||
#logging.level.org.eclipse.hawkbit.rest.util.MockMvcResultPrinter=DEBUG
|
||||
# Logging END
|
||||
Reference in New Issue
Block a user