private List<Target> assignWithoutMaintenanceWindow(final DistributionSet distributionSet, final Target savedTarget, final boolean timeforced) { return timeforced ? assignDistributionSetTimeForced(distributionSet, savedTarget).getAssignedEntity() : assignDistributionSet(distributionSet, savedTarget).getAssignedEntity(); }
private List<Target> assignWithMaintenanceWindow(final DistributionSet distributionSet, final Target savedTarget, final boolean timeforced, final String maintenanceWindowSchedule, final String maintenanceWindowDuration, final String maintenanceWindowTimeZone) { return timeforced ? assignDistributionSetWithMaintenanceWindowTimeForced(distributionSet.getId(), savedTarget.getControllerId(), maintenanceWindowSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone).getAssignedEntity() : assignDistributionSetWithMaintenanceWindow(distributionSet.getId(), savedTarget.getControllerId(), maintenanceWindowSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone) .getAssignedEntity(); }
protected Action prepareFinishedUpdate(final String controllerId, final String distributionSet, final boolean isRequiredMigrationStep) { final DistributionSet ds = testdataFactory.createDistributionSet(distributionSet, isRequiredMigrationStep); Target savedTarget = testdataFactory.createTarget(controllerId); savedTarget = assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getAssignedEntity().iterator() .next(); Action savedAction = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId()) .getContent().get(0); savedAction = controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.RUNNING)); return controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.FINISHED)); }
protected Action prepareFinishedUpdate(final String controllerId, final String distributionSet, final boolean isRequiredMigrationStep) { final DistributionSet ds = testdataFactory.createDistributionSet(distributionSet, isRequiredMigrationStep); Target savedTarget = testdataFactory.createTarget(controllerId); savedTarget = assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getAssignedEntity().iterator() .next(); Action savedAction = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId()) .getContent().get(0); savedAction = controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.RUNNING)); return controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.FINISHED)); }
@Test @Description("Handles the GET request for retrieving assigned targets of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets which controllerID starts with 'target'. Required Permission: " + SpPermission.READ_REPOSITORY + " and " + SpPermission.READ_TARGET) public void getAssignedTargetsWithParameters() throws Exception { final DistributionSet set = testdataFactory.createUpdatedDistributionSet(); assignDistributionSet(set, testdataFactory.createTargets(5, "targetMisc", "Test targets for query")) .getAssignedEntity(); mockMvc.perform( get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedTargets") .param("offset", "1").param("limit", "2").param("sort", "name:DESC") .param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andDo(this.document.document(requestParameters( parameterWithName("limit").attributes(key("type").value("query")) .description(ApiModelPropertiesGeneric.LIMIT), parameterWithName("sort").description(ApiModelPropertiesGeneric.SORT), parameterWithName("offset").description(ApiModelPropertiesGeneric.OFFSET), parameterWithName("q").description(ApiModelPropertiesGeneric.FIQL)))); }
@Test @Description("Handles the GET request for retrieving installed targets of a single distribution set with a defined page size and offset, sortet by name in descending order and filtered down to all targets which controllerID starts with 'target'. Required Permission: " + SpPermission.READ_REPOSITORY + " and " + SpPermission.READ_TARGET) public void getInstalledTargetsWithParameters() throws Exception { final DistributionSet set = testdataFactory.createUpdatedDistributionSet(); final List<Target> targets = assignDistributionSet(set, testdataFactory.createTargets(5, "targetMisc", "Test targets for query")).getAssignedEntity(); testdataFactory.sendUpdateActionStatusToTargets(targets, Status.FINISHED, "some message"); mockMvc.perform( get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/installedTargets") .param("offset", "1").param("limit", "2").param("sort", "name:DESC") .param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andDo(this.document.document(requestParameters( parameterWithName("limit").attributes(key("type").value("query")) .description(ApiModelPropertiesGeneric.LIMIT), parameterWithName("sort").description(ApiModelPropertiesGeneric.SORT), parameterWithName("offset").description(ApiModelPropertiesGeneric.OFFSET), parameterWithName("q").description(ApiModelPropertiesGeneric.FIQL)))); }