Repository API query signatures Entity free (#403)
* Migrated target management queries to IDs inetsead of full entities Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Added missing comment. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * refactored target,DS,cont,deploy,rg mangement. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Adde versioning documentation. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Rollout, Dist and Software mgmt refactored Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Readded line that was remove by incident. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed broken tests. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Query management refactored Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix bug of auto assign DS delete Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Switch to collection Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed compile error Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Small glitches Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed test after merge Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -137,10 +137,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> deleteDistributionSet(@PathVariable("distributionSetId") final Long distributionSetId) {
|
||||
final DistributionSet set = findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
|
||||
distributionSetManagement.deleteDistributionSet(set);
|
||||
|
||||
distributionSetManagement.deleteDistributionSet(distributionSetId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -222,21 +219,13 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
@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,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam) {
|
||||
final DistributionSet distributionSet = findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||
final Sort sorting = PagingUtility.sanitizeTargetFilterQuerySortParam(sortParam);
|
||||
|
||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
||||
final Page<TargetFilterQuery> targetFilterQueries;
|
||||
if (rsqlParam != null) {
|
||||
targetFilterQueries = targetFilterQueryManagement.findTargetFilterQueryByAutoAssignDS(pageable,
|
||||
distributionSet, rsqlParam);
|
||||
} else {
|
||||
targetFilterQueries = targetFilterQueryManagement.findTargetFilterQueryByAutoAssignDS(pageable,
|
||||
distributionSet);
|
||||
}
|
||||
final Page<TargetFilterQuery> targetFilterQueries = targetFilterQueryManagement
|
||||
.findTargetFilterQueryByAutoAssignDS(pageable, distributionSetId, rsqlParam);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new PagedList<>(MgmtTargetFilterQueryMapper.toResponse(targetFilterQueries.getContent()),
|
||||
@@ -340,7 +329,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
@RequestBody final List<MgmtSoftwareModuleAssigment> softwareModuleIDs) {
|
||||
|
||||
distributionSetManagement.assignSoftwareModules(distributionSetId,
|
||||
softwareModuleIDs.stream().map(module -> module.getId()).collect(Collectors.toList()));
|
||||
softwareModuleIDs.stream().map(MgmtSoftwareModuleAssigment::getId).collect(Collectors.toList()));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -360,13 +349,13 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam) {
|
||||
// check if distribution set exists otherwise throw exception
|
||||
// immediately
|
||||
final DistributionSet foundDs = findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||
final Sort sorting = PagingUtility.sanitizeSoftwareModuleSortParam(sortParam);
|
||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
||||
final Page<SoftwareModule> softwaremodules = softwareManagement.findSoftwareModuleByAssignedTo(pageable,
|
||||
foundDs);
|
||||
distributionSetId);
|
||||
return new ResponseEntity<>(new PagedList<>(MgmtSoftwareModuleMapper.toResponse(softwaremodules.getContent()),
|
||||
softwaremodules.getTotalElements()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -167,10 +167,8 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
||||
@RequestBody final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies) {
|
||||
LOG.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId);
|
||||
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
|
||||
|
||||
final List<DistributionSet> assignedDs = this.distributionSetManagement
|
||||
.assignTag(findDistributionSetIds(assignedDSRequestBodies), tag);
|
||||
.assignTag(findDistributionSetIds(assignedDSRequestBodies), distributionsetTagId);
|
||||
LOG.debug("Assignd DistributionSet {}", assignedDs.size());
|
||||
return new ResponseEntity<>(MgmtDistributionSetMapper.toResponseDistributionSets(assignedDs), HttpStatus.OK);
|
||||
}
|
||||
@@ -179,14 +177,9 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
||||
public ResponseEntity<Void> unassignDistributionSets(
|
||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId) {
|
||||
LOG.debug("Unassign all DS for ds tag {}", distributionsetTagId);
|
||||
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
|
||||
if (tag.getAssignedToDistributionSet() == null) {
|
||||
LOG.debug("No assigned ds founded");
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
final List<DistributionSet> distributionSets = this.distributionSetManagement
|
||||
.unAssignAllDistributionSetsByTag(tag);
|
||||
.unAssignAllDistributionSetsByTag(distributionsetTagId);
|
||||
LOG.debug("Unassigned ds {}", distributionSets.size());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@@ -196,8 +189,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
||||
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
|
||||
@PathVariable("distributionsetId") final Long distributionsetId) {
|
||||
LOG.debug("Unassign ds {} for ds tag {}", distributionsetId, distributionsetTagId);
|
||||
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
|
||||
this.distributionSetManagement.unAssignTag(distributionsetId, tag);
|
||||
this.distributionSetManagement.unAssignTag(distributionsetId, distributionsetTagId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,8 +101,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
||||
public ResponseEntity<Void> deleteDistributionSetType(
|
||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId) {
|
||||
|
||||
final DistributionSetType module = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
||||
distributionSetManagement.deleteDistributionSetType(module);
|
||||
distributionSetManagement.deleteDistributionSetType(distributionSetTypeId);
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class MgmtDownloadArtifactResource implements MgmtDownloadArtifactRestApi
|
||||
}
|
||||
|
||||
final Artifact artifact = module.getArtifact(artifactId).get();
|
||||
final DbArtifact file = artifactManagement.loadArtifactBinary(artifact);
|
||||
final DbArtifact file = artifactManagement.loadArtifactBinary(artifact.getId());
|
||||
final HttpServletRequest request = requestResponseContextHolder.getHttpServletRequest();
|
||||
final String ifMatch = request.getHeader("If-Match");
|
||||
if (ifMatch != null && !RestResourceConversionHelper.matchesHttpHeader(ifMatch, artifact.getSha1Hash())) {
|
||||
|
||||
@@ -188,8 +188,6 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam) {
|
||||
findRolloutOrThrowException(rolloutId);
|
||||
final RolloutGroup rolloutGroup = findRolloutGroupOrThrowException(groupId);
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||
final Sort sorting = PagingUtility.sanitizeTargetSortParam(sortParam);
|
||||
@@ -198,11 +196,9 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
|
||||
final Page<Target> rolloutGroupTargets;
|
||||
if (rsqlParam != null) {
|
||||
rolloutGroupTargets = this.rolloutGroupManagement.findRolloutGroupTargets(rolloutGroup, rsqlParam,
|
||||
pageable);
|
||||
rolloutGroupTargets = this.rolloutGroupManagement.findRolloutGroupTargets(groupId, rsqlParam, pageable);
|
||||
} else {
|
||||
final Page<Target> pageTargets = this.rolloutGroupManagement.findRolloutGroupTargets(rolloutGroup,
|
||||
pageable);
|
||||
final Page<Target> pageTargets = this.rolloutGroupManagement.findRolloutGroupTargets(groupId, pageable);
|
||||
rolloutGroupTargets = pageTargets;
|
||||
}
|
||||
final List<MgmtTarget> rest = MgmtTargetMapper.toResponse(rolloutGroupTargets.getContent());
|
||||
|
||||
@@ -87,10 +87,7 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes
|
||||
@Override
|
||||
public ResponseEntity<Void> deleteSoftwareModuleType(
|
||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) {
|
||||
final SoftwareModuleType module = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId);
|
||||
|
||||
softwareManagement.deleteSoftwareModuleType(module);
|
||||
|
||||
softwareManagement.deleteSoftwareModuleType(softwareModuleTypeId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> deleteTarget(@PathVariable("controllerId") final String controllerId) {
|
||||
final Target target = findTargetWithExceptionIfNotFound(controllerId);
|
||||
this.targetManagement.deleteTargets(target.getId());
|
||||
this.targetManagement.deleteTarget(controllerId);
|
||||
LOG.debug("{} target deleted, return status {}", controllerId, HttpStatus.OK);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@@ -158,7 +157,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam) {
|
||||
|
||||
final Target foundTarget = findTargetWithExceptionIfNotFound(controllerId);
|
||||
findTargetWithExceptionIfNotFound(controllerId);
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||
@@ -168,11 +167,11 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
final Slice<Action> activeActions;
|
||||
final Long totalActionCount;
|
||||
if (rsqlParam != null) {
|
||||
activeActions = this.deploymentManagement.findActionsByTarget(rsqlParam, foundTarget, pageable);
|
||||
totalActionCount = this.deploymentManagement.countActionsByTarget(rsqlParam, foundTarget);
|
||||
activeActions = this.deploymentManagement.findActionsByTarget(rsqlParam, controllerId, pageable);
|
||||
totalActionCount = this.deploymentManagement.countActionsByTarget(rsqlParam, controllerId);
|
||||
} else {
|
||||
activeActions = this.deploymentManagement.findActionsByTarget(foundTarget, pageable);
|
||||
totalActionCount = this.deploymentManagement.countActionsByTarget(foundTarget);
|
||||
activeActions = this.deploymentManagement.findActionsByTarget(controllerId, pageable);
|
||||
totalActionCount = this.deploymentManagement.countActionsByTarget(controllerId);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(
|
||||
@@ -184,11 +183,10 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
@Override
|
||||
public ResponseEntity<MgmtAction> getAction(@PathVariable("controllerId") final String controllerId,
|
||||
@PathVariable("actionId") final Long actionId) {
|
||||
final Target target = findTargetWithExceptionIfNotFound(controllerId);
|
||||
|
||||
final Action action = findActionWithExceptionIfNotFound(actionId);
|
||||
if (!action.getTarget().getId().equals(target.getId())) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", action.getId(), target.getId());
|
||||
if (!action.getTarget().getControllerId().equals(controllerId)) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", action.getId(), controllerId);
|
||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@@ -215,13 +213,17 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
public ResponseEntity<Void> cancelAction(@PathVariable("controllerId") final String controllerId,
|
||||
@PathVariable("actionId") final Long actionId,
|
||||
@RequestParam(value = "force", required = false, defaultValue = "false") final boolean force) {
|
||||
final Target target = findTargetWithExceptionIfNotFound(controllerId);
|
||||
final Action action = findActionWithExceptionIfNotFound(actionId);
|
||||
|
||||
if (!action.getTarget().getControllerId().equals(controllerId)) {
|
||||
LOG.warn("given action ({}) is not assigned to given target ({}).", actionId, controllerId);
|
||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
if (force) {
|
||||
this.deploymentManagement.forceQuitAction(action);
|
||||
this.deploymentManagement.forceQuitAction(actionId);
|
||||
} else {
|
||||
this.deploymentManagement.cancelAction(action, target);
|
||||
this.deploymentManagement.cancelAction(actionId);
|
||||
}
|
||||
// both functions will throw an exception, when action is in wrong
|
||||
// state, which is mapped by MgmtResponseExceptionHandler.
|
||||
@@ -249,7 +251,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
final Sort sorting = PagingUtility.sanitizeActionStatusSortParam(sortParam);
|
||||
|
||||
final Page<ActionStatus> statusList = this.deploymentManagement.findActionStatusByActionWithMessages(
|
||||
new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting), action);
|
||||
new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting), action.getId());
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new PagedList<>(MgmtTargetMapper.toActionStatusRestResponse(statusList.getContent()),
|
||||
|
||||
@@ -152,21 +152,16 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
public ResponseEntity<List<MgmtTarget>> assignTargets(@PathVariable("targetTagId") final Long targetTagId,
|
||||
@RequestBody final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies) {
|
||||
LOG.debug("Assign Targets {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId);
|
||||
final TargetTag targetTag = findTargetTagById(targetTagId);
|
||||
final List<Target> assignedTarget = this.targetManagement
|
||||
.assignTag(findTargetControllerIds(assignedTargetRequestBodies), targetTag);
|
||||
.assignTag(findTargetControllerIds(assignedTargetRequestBodies), targetTagId);
|
||||
return new ResponseEntity<>(MgmtTargetMapper.toResponseWithLinksAndPollStatus(assignedTarget), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> unassignTargets(@PathVariable("targetTagId") final Long targetTagId) {
|
||||
LOG.debug("Unassign all Targets for target tag {}", targetTagId);
|
||||
final TargetTag targetTag = findTargetTagById(targetTagId);
|
||||
if (targetTag.getAssignedToTargets() == null) {
|
||||
LOG.debug("No assigned targets found");
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
this.targetManagement.unAssignAllTargetsByTag(targetTag);
|
||||
|
||||
this.targetManagement.unAssignAllTargetsByTag(targetTagId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -174,8 +169,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
public ResponseEntity<Void> unassignTarget(@PathVariable("targetTagId") final Long targetTagId,
|
||||
@PathVariable("controllerId") final String controllerId) {
|
||||
LOG.debug("Unassign target {} for target tag {}", controllerId, targetTagId);
|
||||
final TargetTag targetTag = findTargetTagById(targetTagId);
|
||||
this.targetManagement.unAssignTag(controllerId, targetTag);
|
||||
this.targetManagement.unAssignTag(controllerId, targetTagId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -189,7 +183,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
|
||||
private List<String> findTargetControllerIds(
|
||||
final List<MgmtAssignedTargetRequestBody> assignedTargetRequestBodies) {
|
||||
return assignedTargetRequestBodies.stream().map(request -> request.getControllerId())
|
||||
return assignedTargetRequestBodies.stream().map(MgmtAssignedTargetRequestBody::getControllerId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
||||
|
||||
// binary
|
||||
try (InputStream fileInputStream = artifactManagement
|
||||
.loadArtifactBinary(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts().get(0))
|
||||
.loadArtifactBinary(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts().get(0).getId())
|
||||
.getFileInputStream()) {
|
||||
assertTrue("Wrong artifact content",
|
||||
IOUtils.contentEquals(new ByteArrayInputStream(random), fileInputStream));
|
||||
@@ -689,9 +689,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
||||
.andExpect(jsonPath("[1].createdAt", not(equalTo(0)))).andReturn();
|
||||
|
||||
final SoftwareModule osCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name1", "version1",
|
||||
osType);
|
||||
osType.getId());
|
||||
final SoftwareModule appCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name3", "version3",
|
||||
appType);
|
||||
appType.getId());
|
||||
|
||||
assertThat(
|
||||
JsonPath.compile("[0]_links.self.href").read(mvcResult.getResponse().getContentAsString()).toString())
|
||||
|
||||
@@ -110,8 +110,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
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 ActionStatus status = deploymentManagement
|
||||
.findActionsByTarget(pageRequest, targetManagement.findTargetByControllerID(knownTargetId)).getContent()
|
||||
final ActionStatus status = deploymentManagement.findActionsByTarget(knownTargetId, pageRequest).getContent()
|
||||
.get(0).getActionStatus().stream().sorted((e1, e2) -> Long.compare(e2.getId(), e1.getId()))
|
||||
.collect(Collectors.toList()).get(0);
|
||||
|
||||
@@ -247,10 +246,10 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
// cancel the active action
|
||||
deploymentManagement.cancelAction(tA.getActions().get(0), tA);
|
||||
deploymentManagement.cancelAction(tA.getActions().get(0).getId());
|
||||
|
||||
// find the current active action
|
||||
final List<Action> cancelActions = deploymentManagement.findActionsByTarget(new PageRequest(0, 100), tA)
|
||||
final List<Action> cancelActions = deploymentManagement.findActionsByTarget(tA.getControllerId(), pageReq)
|
||||
.getContent().stream().filter(action -> action.isCancelingOrCanceled()).collect(Collectors.toList());
|
||||
assertThat(cancelActions).hasSize(1);
|
||||
|
||||
@@ -267,11 +266,11 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
// cancel the active action
|
||||
deploymentManagement.cancelAction(tA.getActions().get(0), tA);
|
||||
deploymentManagement.cancelAction(tA.getActions().get(0).getId());
|
||||
|
||||
// find the current active action
|
||||
final List<Action> cancelActions = deploymentManagement.findActionsByTarget(pageReq, tA).getContent().stream()
|
||||
.filter(Action::isCancelingOrCanceled).collect(Collectors.toList());
|
||||
final List<Action> cancelActions = deploymentManagement.findActionsByTarget(tA.getControllerId(), pageReq)
|
||||
.getContent().stream().filter(Action::isCancelingOrCanceled).collect(Collectors.toList());
|
||||
assertThat(cancelActions).hasSize(1);
|
||||
assertThat(cancelActions.get(0).isCancelingOrCanceled()).isTrue();
|
||||
|
||||
@@ -1045,7 +1044,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
assignDistributionSet(two, updatedTargets);
|
||||
|
||||
// two updates, one cancellation
|
||||
final List<Action> actions = deploymentManagement.findActionsByTarget(target);
|
||||
final List<Action> actions = deploymentManagement.findActionsByTarget(target.getControllerId(), pageReq)
|
||||
.getContent();
|
||||
|
||||
assertThat(actions).hasSize(2);
|
||||
return actions;
|
||||
@@ -1096,7 +1096,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
|
||||
final List<Action> findActiveActionsByTarget = deploymentManagement.findActiveActionsByTarget(target);
|
||||
final List<Action> findActiveActionsByTarget = deploymentManagement
|
||||
.findActiveActionsByTarget(target.getControllerId());
|
||||
assertThat(findActiveActionsByTarget).hasSize(1);
|
||||
assertThat(findActiveActionsByTarget.get(0).getActionType()).isEqualTo(ActionType.TIMEFORCED);
|
||||
assertThat(findActiveActionsByTarget.get(0).getForcedTime()).isEqualTo(forceTime);
|
||||
@@ -1276,7 +1277,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
// assign a distribution set so we get an active update action
|
||||
assignDistributionSet(dsA, Lists.newArrayList(tA));
|
||||
// verify active action
|
||||
final Slice<Action> actionsByTarget = deploymentManagement.findActionsByTarget(new PageRequest(0, 100), tA);
|
||||
final Slice<Action> actionsByTarget = deploymentManagement.findActionsByTarget(tA.getControllerId(), pageReq);
|
||||
assertThat(actionsByTarget.getContent()).hasSize(1);
|
||||
return targetManagement.findTargetByControllerID(tA.getControllerId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user