Allign MGMT Rest APIs -> return 204 NO_CONTENT w/o body where success… (#2793)

* Allign MGMT Rest APIs -> return 204 NO_CONTENT w/o body where success w/o body is intended

# Conflicts:
#	hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java

* Fix File download wrong no_content, Fix Tests

* Fix ApiResponses where missed 200->204

---------

Co-authored-by: vasilchev <vasil.ilchev@bosch.com>
This commit is contained in:
Vasil Ilchev
2025-11-17 12:53:44 +02:00
committed by GitHub
parent 1268d12495
commit 76a77f85e2
39 changed files with 228 additions and 230 deletions

View File

@@ -74,7 +74,7 @@ public class MgmtActionResource implements MgmtActionRestApi {
@AuditLog(entity = "Actions",type = AuditLog.Type.DELETE, description = "Delete Action", logResponse = true)
public ResponseEntity<Void> deleteAction(Long actionId) {
deploymentManagement.deleteAction(actionId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -95,7 +95,7 @@ public class MgmtActionResource implements MgmtActionRestApi {
throw new IllegalArgumentException("Either action id list or rsql filter should be provided.");
}
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
private MgmtRepresentationMode getRepresentationModeFromString(final String representationModeParam) {

View File

@@ -176,7 +176,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
@AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Distribution Set")
public ResponseEntity<Void> deleteDistributionSet(final Long distributionSetId) {
distributionSetManagement.delete(distributionSetId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -267,8 +267,9 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
}
@Override
public void createMetadata(final Long distributionSetId, final List<MgmtMetadata> metadataRest) {
public ResponseEntity<Void> createMetadata(final Long distributionSetId, final List<MgmtMetadata> metadataRest) {
distributionSetManagement.createMetadata(distributionSetId, MgmtDistributionSetMapper.fromRequestDsMetadata(metadataRest));
return ResponseEntity.status(HttpStatus.CREATED).build();
}
@Override
@@ -287,13 +288,15 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
}
@Override
public void updateMetadata(final Long distributionSetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
public ResponseEntity<Void> updateMetadata(final Long distributionSetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
distributionSetManagement.createMetadata(distributionSetId, metadataKey, metadata.getValue());
return ResponseEntity.noContent().build();
}
@Override
public void deleteMetadata(final Long distributionSetId, final String metadataKey) {
public ResponseEntity<Void> deleteMetadata(final Long distributionSetId, final String metadataKey) {
distributionSetManagement.deleteMetadata(distributionSetId, metadataKey);
return ResponseEntity.noContent().build();
}
@Override
@@ -304,14 +307,14 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
softwareModuleIDs.stream()
.map(MgmtSoftwareModuleAssignment::getId)
.toList());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Assigned Distribution Set")
public ResponseEntity<Void> deleteAssignSoftwareModules(final Long distributionSetId, final Long softwareModuleId) {
distributionSetManagement.unassignSoftwareModule(distributionSetId, softwareModuleId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -365,6 +368,6 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
distributionSetInvalidationManagement.invalidateDistributionSet(new DistributionSetInvalidation(
List.of(distributionSetId),
MgmtRestModelMapper.convertCancelationType(invalidateRequestBody.getActionCancelationType())));
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
}

View File

@@ -108,7 +108,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
public ResponseEntity<Void> deleteDistributionSetTag(final Long distributionsetTagId) {
log.debug("Delete {} distribution set tag", distributionsetTagId);
distributionSetTagManagement.delete(distributionsetTagId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -131,7 +131,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
public ResponseEntity<Void> assignDistributionSet(final Long distributionSetTagId, final Long distributionSetId) {
log.debug("Assign ds {} for ds tag {}", distributionSetId, distributionSetTagId);
this.distributionSetManagement.assignTag(List.of(distributionSetId), distributionSetTagId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -139,7 +139,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
log.debug("Assign DistributionSet {} for ds tag {}", distributionSetIds.size(), distributionSetTagId);
final List<? extends DistributionSet> assignedDs = this.distributionSetManagement.assignTag(distributionSetIds, distributionSetTagId);
log.debug("Assigned DistributionSet {}", assignedDs.size());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -147,7 +147,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
public ResponseEntity<Void> unassignDistributionSet(final Long distributionsetTagId, final Long distributionsetId) {
log.debug("Unassign ds {} for ds tag {}", distributionsetId, distributionsetTagId);
this.distributionSetManagement.unassignTag(List.of(distributionsetId), distributionsetTagId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -156,7 +156,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
log.debug("Unassign DistributionSet {} for ds tag {}", distributionsetIds.size(), distributionsetTagId);
final List<? extends DistributionSet> assignedDs = this.distributionSetManagement.unassignTag(distributionsetIds, distributionsetTagId);
log.debug("Unassigned DistributionSet {}", assignedDs.size());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
private DistributionSetTag findDistributionTagById(final Long distributionsetTagId) {

View File

@@ -89,8 +89,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
@AuditLog(entity = "DistributionSetType", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Type")
public ResponseEntity<Void> deleteDistributionSetType(final Long distributionSetTypeId) {
distributionSetTypeManagement.delete(distributionSetTypeId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -157,7 +156,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
@AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Remove Mandatory Module From Distribution Set Type")
public ResponseEntity<Void> removeMandatoryModule(final Long distributionSetTypeId, final Long softwareModuleTypeId) {
distributionSetTypeManagement.unassignSoftwareModuleType(distributionSetTypeId, softwareModuleTypeId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -169,14 +168,13 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
@AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Add Mandatory Module From Distribution Set Type")
public ResponseEntity<Void> addMandatoryModule(final Long distributionSetTypeId, final MgmtId smtId) {
distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
public ResponseEntity<Void> addOptionalModule(final Long distributionSetTypeId, final MgmtId smtId) {
distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
private DistributionSetType findDistributionSetTypeWithExceptionIfNotFound(final Long distributionSetTypeId) {

View File

@@ -159,48 +159,48 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
@Override
public ResponseEntity<Void> approve(final Long rolloutId, final String remark) {
rolloutManagement.approveOrDeny(rolloutId, Rollout.ApprovalDecision.APPROVED, remark);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
public ResponseEntity<Void> deny(final Long rolloutId, final String remark) {
rolloutManagement.approveOrDeny(rolloutId, Rollout.ApprovalDecision.DENIED, remark);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Start Rollout")
public ResponseEntity<Void> start(final Long rolloutId) {
this.rolloutManagement.start(rolloutId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Pause Rollout")
public ResponseEntity<Void> pause(final Long rolloutId) {
this.rolloutManagement.pauseRollout(rolloutId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Stop Rollout")
public ResponseEntity<Void> stop(Long rolloutId) {
this.rolloutManagement.stop(rolloutId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Rollout", type = AuditLog.Type.DELETE, description = "Delete Rollout")
public ResponseEntity<Void> delete(final Long rolloutId) {
this.rolloutManagement.delete(rolloutId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Resume Rollout")
public ResponseEntity<Void> resume(final Long rolloutId) {
this.rolloutManagement.resumeRollout(rolloutId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -264,7 +264,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Trigger Next Rollout Group")
public ResponseEntity<Void> triggerNextGroup(final Long rolloutId) {
rolloutManagement.triggerNextGroup(rolloutId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override

View File

@@ -159,7 +159,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, artifactId);
artifactManagement.delete(artifactId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -234,12 +234,13 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
softwareModuleManagement.delete(module.getId());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
public void createMetadata(final Long softwareModuleId, final List<MgmtSoftwareModuleMetadata> metadataRest) {
public ResponseEntity<Void> createMetadata(final Long softwareModuleId, final List<MgmtSoftwareModuleMetadata> metadataRest) {
softwareModuleManagement.createMetadata(softwareModuleId, MgmtSoftwareModuleMapper.fromRequestSwMetadata(metadataRest));
return ResponseEntity.status(HttpStatus.CREATED).build();
}
@Override
@@ -262,15 +263,17 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
}
@Override
public void updateMetadata(final Long softwareModuleId, final String metadataKey, final MgmtSoftwareModuleMetadataBodyPut metadata) {
public ResponseEntity<Void> updateMetadata(final Long softwareModuleId, final String metadataKey, final MgmtSoftwareModuleMetadataBodyPut metadata) {
softwareModuleManagement.createMetadata(
softwareModuleId, metadataKey, new MetadataValueCreate(metadata.getValue(), metadata.getTargetVisible()));
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, description = "Delete Software Module Metadata")
public void deleteMetadata(final Long softwareModuleId, final String metadataKey) {
public ResponseEntity<Void> deleteMetadata(final Long softwareModuleId, final String metadataKey) {
softwareModuleManagement.deleteMetadata(softwareModuleId, metadataKey);
return ResponseEntity.noContent().build();
}
private static MgmtRepresentationMode parseRepresentationMode(final String representationModeParam) {

View File

@@ -71,7 +71,7 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes
@AuditLog(entity = "SoftwareModuleType", type = AuditLog.Type.DELETE, description = "Delete Software Module Type")
public ResponseEntity<Void> deleteSoftwareModuleType(final Long softwareModuleTypeId) {
softwareModuleTypeManagement.delete(softwareModuleTypeId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override

View File

@@ -119,7 +119,7 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA
public ResponseEntity<Void> deleteFilter(final Long filterId) {
filterManagement.delete(filterId);
log.debug("{} target filter query deleted, return status {}", filterId, HttpStatus.OK);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override

View File

@@ -83,7 +83,7 @@ public class MgmtTargetGroupResource implements MgmtTargetGroupRestApi {
@Override
public ResponseEntity<Void> unassignTargetsFromGroup(final List<String> controllerIds) {
targetManagement.assignTargetsWithGroup(null, controllerIds);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -104,11 +104,11 @@ public class MgmtTargetGroupResource implements MgmtTargetGroupRestApi {
private ResponseEntity<Void> assignTargets(final String group, final List<String> controllerIds) {
targetManagement.assignTargetsWithGroup(group, controllerIds);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
private ResponseEntity<Void> assignTargetsToGroupWithRsql0(final String group, final String rsql) {
targetManagement.assignTargetGroupWithRsql(group, rsql);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
}

View File

@@ -177,21 +177,21 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
public ResponseEntity<Void> deleteTarget(final String targetId) {
this.targetManagement.deleteByControllerId(targetId);
log.debug("{} target deleted, return status {}", targetId, HttpStatus.OK);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Unassign Target Type")
public ResponseEntity<Void> unassignTargetType(final String targetId) {
this.targetManagement.unassignType(targetId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Assign Target")
public ResponseEntity<Void> assignTargetType(final String targetId, final MgmtId targetTypeId) {
this.targetManagement.assignType(targetId, targetTypeId.getId());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -244,7 +244,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
deploymentManagement.deleteOldestTargetActions(targetId, keepLast);
}
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -326,7 +326,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
confirmationManagement.denyAction(actionId, actionConfirmation.getCode(), actionConfirmation.getDetails());
break;
}
return new ResponseEntity<>(HttpStatus.OK);
return ResponseEntity.noContent().build();
} catch (final InvalidConfirmationFeedbackException e) {
if (e.getReason() == InvalidConfirmationFeedbackException.Reason.ACTION_CLOSED) {
log.warn("Updating action {} with confirmation {} not possible since action not active anymore.",
@@ -429,8 +429,9 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
}
@Override
public void createMetadata(final String targetId, final List<MgmtMetadata> metadataRest) {
public ResponseEntity<Void> createMetadata(final String targetId, final List<MgmtMetadata> metadataRest) {
targetManagement.createMetadata(targetId, MgmtTargetMapper.fromRequestMetadata(metadataRest));
return ResponseEntity.status(HttpStatus.CREATED).build();
}
@Override
@@ -449,14 +450,16 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
}
@Override
public void updateMetadata(final String targetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
public ResponseEntity<Void> updateMetadata(final String targetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
targetManagement.createMetadata(targetId, metadataKey, metadata.getValue());
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Target", type = AuditLog.Type.DELETE, description = "Delete Target Metadata")
public void deleteMetadata(final String targetId, final String metadataKey) {
public ResponseEntity<Void> deleteMetadata(final String targetId, final String metadataKey) {
targetManagement.deleteMetadata(targetId, metadataKey);
return ResponseEntity.noContent().build();
}
@Override
@@ -472,14 +475,14 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
final String initiator = getNullIfEmpty(update, MgmtTargetAutoConfirmUpdate::getInitiator);
final String remark = getNullIfEmpty(update, MgmtTargetAutoConfirmUpdate::getRemark);
confirmationManagement.activateAutoConfirmation(targetId, initiator, remark);
return new ResponseEntity<>(HttpStatus.OK);
return ResponseEntity.noContent().build();
}
@Override
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Deactivate Target Auto Confirmation")
public ResponseEntity<Void> deactivateAutoConfirm(final String targetId) {
confirmationManagement.deactivateAutoConfirmation(targetId);
return new ResponseEntity<>(HttpStatus.OK);
return ResponseEntity.noContent().build();
}
private <T, R> R getNullIfEmpty(final T object, final Function<T, R> extractMethod) {

View File

@@ -114,7 +114,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
this.tagManagement.delete(targetTag.getId());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -137,7 +137,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
public ResponseEntity<Void> assignTarget(final Long targetTagId, final String controllerId) {
log.debug("Assign target {} for target tag {}", controllerId, targetTagId);
this.targetManagement.assignTag(List.of(controllerId), targetTagId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -154,7 +154,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
throw new EntityNotFoundException(Target.class, notFound.get());
}
}
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -162,7 +162,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
public ResponseEntity<Void> unassignTarget(final Long targetTagId, final String controllerId) {
log.debug("Unassign target {} for target tag {}", controllerId, targetTagId);
targetManagement.unassignTag(List.of(controllerId), targetTagId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -180,7 +180,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
throw new EntityNotFoundException(Target.class, notFound.get());
}
}
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
private TargetTag findTargetTagById(final Long targetTagId) {

View File

@@ -79,7 +79,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
public ResponseEntity<Void> deleteTargetType(final Long targetTypeId) {
log.debug("Delete {} target type", targetTypeId);
targetTypeManagement.delete(targetTypeId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -109,7 +109,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
@AuditLog(entity = "TargetType", type = AuditLog.Type.DELETE, description = "Remove Compatible Distribution Set From Target Type")
public ResponseEntity<Void> removeCompatibleDistributionSet(final Long targetTypeId, final Long distributionSetTypeId) {
targetTypeManagement.unassignDistributionSetType(targetTypeId, distributionSetTypeId);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override
@@ -118,7 +118,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
final Long targetTypeId, final List<MgmtDistributionSetTypeAssignment> distributionSetTypeIds) {
targetTypeManagement.assignCompatibleDistributionSetTypes(
targetTypeId, distributionSetTypeIds.stream().map(MgmtDistributionSetTypeAssignment::getId).toList());
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
private TargetType findTargetTypeWithExceptionIfNotFound(final Long targetTypeId) {

View File

@@ -84,7 +84,7 @@ public class MgmtTenantManagementResource implements MgmtTenantManagementRestApi
tenantConfigurationManagement.deleteConfiguration(keyName);
log.debug("{} config value deleted, return status {}", keyName, HttpStatus.OK);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
@Override

View File

@@ -516,7 +516,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete(ACTION_V1_REQUEST_MAPPING + "/" + action1.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + action1.getId()))
.andDo(MockMvcResultPrinter.print())
@@ -542,8 +542,9 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
final long deletedActionId2 = assignmentResults.get(3).getAssignedEntity().get(0).getId();
actionIdsToDelete.add(deletedActionId2);
mvc.perform(delete(ACTION_V1_REQUEST_MAPPING).content(toJson(actionIdsToDelete)).contentType(APPLICATION_JSON))
.andExpect(status().isOk());
mvc.perform(delete(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING)
.content(toJson(actionIdsToDelete)).contentType(APPLICATION_JSON))
.andExpect(status().isNoContent());
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + deletedActionId1))
.andDo(MockMvcResultPrinter.print())
@@ -554,8 +555,9 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
final Action deletedAction3 = assignmentResults.get(1).getAssignedEntity().get(0);
final String rsql = "target.name==" + deletedAction3.getTarget().getName();
mvc.perform(delete(ACTION_V1_REQUEST_MAPPING).param(REQUEST_PARAMETER_SEARCH, rsql).contentType(APPLICATION_JSON))
.andExpect(status().isOk());
mvc.perform(delete(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING)
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, rsql).contentType(APPLICATION_JSON))
.andExpect(status().isNoContent());
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + deletedAction3.getId()))
.andDo(MockMvcResultPrinter.print())

View File

@@ -140,7 +140,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
.contentType(APPLICATION_JSON).content(smList.toString()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// create targets and assign DisSet to target
final String[] knownTargetIds = new String[] { "1", "2" };
@@ -184,7 +184,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
.contentType(APPLICATION_JSON).content(smList.toString()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// create Targets
final String[] knownTargetIds = new String[] { "1", "2" };
@@ -232,7 +232,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
.contentType(APPLICATION_JSON).content(toJson(smIDs.stream().map(MgmtId::new).toList())))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// Test if size is 3
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM"))
.andDo(MockMvcResultPrinter.print())
@@ -251,7 +251,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
.contentType(APPLICATION_JSON).content(jsonIDs))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// test if size corresponds with quota
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM?limit={limit}", maxSoftwareModules * 2))
.andDo(MockMvcResultPrinter.print())
@@ -299,7 +299,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
for (final SoftwareModule softwareModule : set.getModules()) {
final Long smId = softwareModule.getId();
mvc.perform(delete(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM/" + smId))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -976,7 +976,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
// perform request
mvc.perform(delete("/rest/v1/distributionsets/{smId}", set.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// check repository content
assertThat(distributionSetManagement.findAll(PAGE)).isEmpty();
@@ -1014,7 +1014,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(delete("/rest/v1/distributionsets/{dsId}", set.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get("/rest/v1/distributionsets/{dsId}", set.getId()))
.andDo(MockMvcResultPrinter.print())
@@ -1214,7 +1214,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.contentType(APPLICATION_JSON)
.content(jsonObject.toString()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(distributionSetManagement.getMetadata(testDS.getId()).get(knownKey)).isEqualTo(updateValue);
}
@@ -1233,7 +1233,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(delete("/rest/v1/distributionsets/{dsId}/metadata/{key}", testDS.getId(), knownKey))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// already deleted
mvc.perform(delete("/rest/v1/distributionsets/{dsId}/metadata/{key}", testDS.getId(), knownKey))
@@ -1693,7 +1693,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post("/rest/v1/distributionsets/{ds}/invalidate", distributionSet.getId())
.contentType(APPLICATION_JSON)
.content(jsonObject.toString()))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetFilterQueryManagement.find(targetFilterQuery.getId()).get().getAutoAssignDistributionSet())
.isNull();
@@ -1728,7 +1728,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post("/rest/v1/distributionsets/{ds}/invalidate", distributionSet.getId())
.content(jsonObject.toString()).contentType(APPLICATION_JSON))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetFilterQueryManagement.find(targetFilterQuery.getId()).get().getAutoAssignDistributionSet()).isNull();
final Long rolloutId = rollout.getId();
@@ -1761,7 +1761,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
mvc.perform(post("/rest/v1/distributionsets/{ds}/invalidate", distributionSet.getId())
.content(jsonObject.toString()).contentType(APPLICATION_JSON))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(rolloutManagement.get(rollout.getId()).getStatus()).isIn(RolloutStatus.RUNNING);

View File

@@ -257,7 +257,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + original.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(distributionSetTagManagement.find(original.getId())).isNotPresent();
}
@@ -350,7 +350,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
set.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<? extends DistributionSet> updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(DistributionSet::getId).toList()).containsOnly(set.getId());
@@ -372,7 +372,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.content(toJson(sets.stream().map(DistributionSet::getId).toList()))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<? extends DistributionSet> updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(DistributionSet::getId).toList())
@@ -399,7 +399,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
unassigned.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<? extends DistributionSet> updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(DistributionSet::getId).toList())
@@ -427,7 +427,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.content(toJson(List.of(unassigned0.getId(), unassigned1.getId())))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<? extends DistributionSet> updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(DistributionSet::getId).toList())

View File

@@ -179,7 +179,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
.contentType(MediaType.APPLICATION_JSON)
.content("{\"id\":" + osType.getId() + "}"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = distributionSetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo("uploadTester");
@@ -205,7 +205,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
.contentType(MediaType.APPLICATION_JSON)
.content("{\"id\":" + osType.getId() + "}"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = distributionSetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo("uploadTester");
@@ -239,7 +239,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
mvc.perform(post("/rest/v1/distributionsettypes/{dstID}/optionalmoduletypes", testType.getId())
.content("{\"id\":" + moduleTypeIds.get(i) + "}").contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
}
mvc.perform(post("/rest/v1/distributionsettypes/{dstID}/optionalmoduletypes", testType.getId())
@@ -261,7 +261,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
mvc.perform(post("/rest/v1/distributionsettypes/{dstID}/mandatorymoduletypes", testType2.getId())
.content("{\"id\":" + moduleTypeIds.get(i) + "}").contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
}
mvc.perform(post("/rest/v1/distributionsettypes/{dstID}/mandatorymoduletypes", testType2.getId())
@@ -364,7 +364,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
mvc.perform(delete("/rest/v1/distributionsettypes/{dstID}/mandatorymoduletypes/{smtId}", testType.getId(),
osType.getId()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = distributionSetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo("uploadTester");
@@ -383,7 +383,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
mvc.perform(delete("/rest/v1/distributionsettypes/{dstID}/optionalmoduletypes/{smtId}", testType.getId(),
appType.getId()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = distributionSetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo("uploadTester");
@@ -440,7 +440,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
mvc.perform(delete("/rest/v1/distributionsettypes/{dsId}", testType.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(distributionSetTypeManagement.count()).isEqualTo(DEFAULT_DS_TYPES);
}
@@ -480,7 +480,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
mvc.perform(delete("/rest/v1/distributionsettypes/{dstId}", testType.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get("/rest/v1/distributionsettypes/{dstId}", testType.getId()))
.andDo(MockMvcResultPrinter.print())

View File

@@ -168,7 +168,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/approve", rollout.getId())
.accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
} finally {
approvalStrategy.setApprovalNeeded(false);
}
@@ -187,7 +187,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deny", rollout.getId())
.accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
} finally {
approvalStrategy.setApprovalNeeded(false);
}
@@ -1113,7 +1113,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// starting rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/start", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// check rollout is in starting state
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
@@ -1151,7 +1151,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// starting rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/start", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// Run here, because scheduler is disabled during tests
rolloutHandler.handleAll();
@@ -1159,7 +1159,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// pausing rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/pause", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// check rollout is in running state
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
@@ -1186,7 +1186,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// starting rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/start", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// Run here, because scheduler is disabled during tests
rolloutHandler.handleAll();
@@ -1194,12 +1194,12 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// pausing rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/pause", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// resume rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/resume", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// check rollout is in running state
mvc.perform(get("/rest/v1/rollouts/{rolloutId}", rollout.getId()).accept(MediaType.APPLICATION_JSON))
@@ -1226,7 +1226,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// starting rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/start", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// Run here, because scheduler is disabled during tests
rolloutHandler.handleAll();
@@ -1274,7 +1274,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// starting rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/start", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// Run here, because scheduler is disabled during tests
rolloutHandler.handleAll();
@@ -1429,7 +1429,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// starting rollout
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/start", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// Run here, because scheduler is disabled during tests
rolloutHandler.handleAll();
@@ -1452,7 +1452,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete("/rest/v1/rollouts/{rolloutid}", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertStatusIs(rollout, RolloutStatus.DELETING);
}
@@ -1489,7 +1489,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
final Rollout rollout = testdataFactory.createAndStartRollout();
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/stop", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get("/rest/v1/rollouts/{rolloutid}", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
@@ -1716,7 +1716,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/triggerNextGroup", rollout.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<RolloutGroupStatus> groupStatus = rolloutGroupManagement.findByRollout(rollout.getId(), PAGE)
.getContent().stream().map(RolloutGroup::getStatus).toList();
@@ -1747,14 +1747,14 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
// RUNNING state
rolloutHandler.handleAll();
triggerNextGroupAndExpect(rollout, status().isOk());
triggerNextGroupAndExpect(rollout, status().isNoContent());
// PAUSED state
rolloutManagement.pauseRollout(rollout.getId());
triggerNextGroupAndExpect(rollout, status().isBadRequest());
rolloutManagement.resumeRollout(rollout.getId());
triggerNextGroupAndExpect(rollout, status().isOk());
triggerNextGroupAndExpect(rollout, status().isNoContent());
// last group already running
triggerNextGroupAndExpect(rollout, status().isBadRequest());

View File

@@ -965,7 +965,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
// delete
mvc.perform(delete("/rest/v1/softwaremodules/{smId}/artifacts/{artId}", moduleId, artifact.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// check that only one artifact is still alive and still assigned
assertThat(softwareModuleManagement.findAll(PAGE)).as("After the sm should be marked as deleted").hasSize(1);
@@ -1353,7 +1353,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
mvc.perform(delete("/rest/v1/softwaremodules/{smId}", sm.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(softwareModuleManagement.findAll(PAGE)).as("After delete no softwarmodule should be available").isEmpty();
assertThatExceptionOfType(EntityNotFoundException.class) // sm doesn't exists
@@ -1388,7 +1388,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
mvc.perform(delete("/rest/v1/softwaremodules/{smId}", appTypeSmId))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get("/rest/v1/softwaremodules/{smId}", appTypeSmId))
.andDo(MockMvcResultPrinter.print())
@@ -1463,7 +1463,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
mvc.perform(put("/rest/v1/softwaremodules/{swId}/metadata/{key}", sm.getId(), knownKey)
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON).content(jsonObject.toString()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final MetadataValue assertDS = softwareModuleManagement.getMetadata(sm.getId(), knownKey);
assertThat(assertDS.getValue()).as("Metadata is wrong").isEqualTo(updateValue);
@@ -1484,7 +1484,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
mvc.perform(delete("/rest/v1/softwaremodules/{swId}/metadata/{key}", smId, knownKey))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThatExceptionOfType(EntityNotFoundException.class)
.isThrownBy(() -> softwareModuleManagement.getMetadata(smId, knownKey));

View File

@@ -266,7 +266,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
mvc.perform(delete("/rest/v1/softwaremoduletypes/{smId}", testType.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(softwareModuleTypeManagement.count()).isEqualTo(3);
}
@@ -300,7 +300,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
mvc.perform(delete("/rest/v1/softwaremoduletypes/{smtId}", testType.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get("/rest/v1/softwaremoduletypes/{smtId}", testType.getId()))
.andDo(MockMvcResultPrinter.print())

View File

@@ -142,7 +142,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
mvc.perform(delete(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId()))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetFilterQueryManagement.find(filterQuery.getId())).isNotPresent();
}

View File

@@ -91,7 +91,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/newGroup/assigned")
.contentType(MediaType.APPLICATION_JSON)
.content(toJson(Arrays.asList("target1", "target2", "target3"))))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/newGroup/assigned")
@@ -122,7 +122,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
.contentType(MediaType.APPLICATION_JSON)
.content(toJson(Arrays.asList("target1", "target2", "target3")))
.param("group", "Europe/East"))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
@@ -151,7 +151,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/C")
.contentType(MediaType.APPLICATION_JSON)
.param("q", "controllerId==target*"))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
@@ -171,7 +171,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
mvc.perform(delete(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
.contentType(MediaType.APPLICATION_JSON)
.content(toJson(Arrays.asList("target1", "target2"))))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
@@ -196,7 +196,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
mvc.perform(delete(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
.contentType(MediaType.APPLICATION_JSON)
.param("q", "controllerId==target*"))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
@@ -219,7 +219,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
.contentType(MediaType.APPLICATION_JSON)
.param("group", "Europe/East")
.param("q", "controllerId==target*"))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
.param("group", "Europe/East")

View File

@@ -253,7 +253,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
testTarget.getControllerId())
.content(objectMapper.writeValueAsString(body)).contentType(APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
}
/**
@@ -267,7 +267,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(post(TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + TARGET_V1_AUTO_CONFIRM + "/" + TARGET_V1_DEACTIVATE_AUTO_CONFIRM,
testTarget.getControllerId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
}
/**
@@ -281,7 +281,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
final Status expectedStatusAfterActionConfirmationCall = Status.RUNNING;
final long actionId = doAssignmentAndTestConfirmation("targetId");
testActionConfirmation("targetId", actionId, MgmtActionConfirmationRequestBodyPut.Confirmation.CONFIRMED, expectedStatusCode,
new String[] { expectedStatusMessage1, expectedStatusMessage2 }, HttpStatus.OK, expectedStatusAfterActionConfirmationCall);
new String[] { expectedStatusMessage1, expectedStatusMessage2 }, HttpStatus.NO_CONTENT, expectedStatusAfterActionConfirmationCall);
}
/**
@@ -295,7 +295,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
final Status expectedStatusAfterActionConfirmationCall = Status.WAIT_FOR_CONFIRMATION;
final long actionId = doAssignmentAndTestConfirmation("targetId");
testActionConfirmation("targetId", actionId, MgmtActionConfirmationRequestBodyPut.Confirmation.DENIED, expectedStatusCode,
new String[] { expectedStatusMessage1, expectedStatusMessage2 }, HttpStatus.OK, expectedStatusAfterActionConfirmationCall);
new String[] { expectedStatusMessage1, expectedStatusMessage2 }, HttpStatus.NO_CONTENT, expectedStatusAfterActionConfirmationCall);
}
/**
@@ -355,7 +355,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
final List<ActionStatus> actionStatuses = new ArrayList<>(jpaAction.getActionStatus());
// confirmation call was successful, check if Action status ,status code and messages are updated appropriately
if (expectedHttpResponseStatus == HttpStatus.OK) {
if (expectedHttpResponseStatus == HttpStatus.NO_CONTENT) {
assertThat(jpaAction.getStatus()).isEqualTo(expectedGeneratedStatus);
assertThat(jpaAction.getLastActionStatusCode()).hasValue(payloadCode);
@@ -598,7 +598,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
final String knownControllerId = "knownControllerIdDelete";
testdataFactory.createTarget(knownControllerId);
mvc.perform(delete(TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId)).andExpect(status().isOk());
mvc.perform(delete(TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId)).andExpect(status().isNoContent());
assertThat(targetManagement.findByControllerId(knownControllerId)).isNotPresent();
}
@@ -2061,8 +2061,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
.accept(APPLICATION_JSON).contentType(APPLICATION_JSON)
.content(jsonObject.toString()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
.andExpect(content().string(""));
.andExpect(status().isNoContent());
assertThat(targetManagement.getMetadata(knownControllerId).get(KNOWN_KEY)).isEqualTo(updateValue);
}
@@ -2078,7 +2077,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete("/rest/v1/targets/{targetId}/metadata/{key}", knownControllerId, KNOWN_KEY))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
// already deleted
mvc.perform(delete("/rest/v1/targets/{targetId}/metadata/{key}", knownControllerId, KNOWN_KEY))
@@ -2503,7 +2502,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(post(TARGET_V1_REQUEST_MAPPING + "/" + targetControllerId + "/targettype")
.content("{\"id\":" + targetType.getId() + "}").contentType(APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetManagement.getByControllerId(targetControllerId).getTargetType().getId()).isEqualTo(targetType.getId());
}
@@ -2560,7 +2559,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
// unassign target type over rest resource
mvc.perform(delete(TARGET_V1_REQUEST_MAPPING + "/" + targetControllerId + "/targettype").contentType(APPLICATION_JSON))
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetManagement.getByControllerId(targetControllerId).getTargetType()).isNull();
}
@@ -2748,7 +2747,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete(TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions", testTarget.getControllerId()).param("keepLast", "5"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
//the last 5 actions should be left
List<Action> actions = deploymentManagement.findActionsByTarget(testTarget.getControllerId(), PAGE).getContent();
@@ -2794,7 +2793,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
.content(toJson(evenActionIds))
.contentType(APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
long remaining = actionRepository.countByTargetId(testTarget.getId());
Assertions.assertEquals(10 - evenActionIds.size(), remaining);

View File

@@ -223,7 +223,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + original.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetTagManagement.find(original.getId())).isNotPresent();
}
@@ -316,7 +316,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
mvc.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
assigned.getControllerId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<Target> updated = targetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(Target::getControllerId).toList()).containsOnly(assigned.getControllerId());
@@ -340,7 +340,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
.content(toJson(List.of(assigned0.getControllerId(), assigned1.getControllerId())))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<Target> updated = targetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(Target::getControllerId).toList())
@@ -462,7 +462,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
.content(toJson(withMissing))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetManagement.findByTag(tag.getId(), PAGE).getContent().stream().map(Target::getControllerId).sorted().toList())
.isEqualTo(targets.stream().sorted().toList());
}
@@ -486,7 +486,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
unassigned.getControllerId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<Target> updated = targetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(Target::getControllerId).toList())
@@ -514,7 +514,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
.content(toJson(Arrays.asList(unassigned0.getControllerId(), unassigned1.getControllerId())))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
final List<Target> updated = targetManagement.findByTag(tag.getId(), PAGE).getContent();
assertThat(updated.stream().map(Target::getControllerId).toList())
@@ -643,7 +643,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
.content(toJson(withMissing))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetManagement.findByTag(tag.getId(), PAGE).getContent()).isEmpty();
}
}

View File

@@ -349,7 +349,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(post(TARGETTYPE_DSTYPES_ENDPOINT, testType.getId())
.content("[{\"id\":" + standardDsType.getId() + "}]").contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = targetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
@@ -405,7 +405,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete(TARGETTYPE_DSTYPE_SINGLE_ENDPOINT, testType.getId(), standardDsType.getId())
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = targetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
@@ -425,7 +425,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/" + standardDsType.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
testType = targetTypeManagement.find(testType.getId()).get();
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
@@ -447,7 +447,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
mvc.perform(delete(TARGETTYPE_SINGLE_ENDPOINT, testType.getId()))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
assertThat(targetTypeManagement.count()).isZero();
}
@@ -646,7 +646,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
.content(toJson(dsTypeIds.subList(0, dsTypeIds.size() - 1).stream().map(MgmtId::new).toList()))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
mvc.perform(post(TARGETTYPE_DSTYPES_ENDPOINT, testType.getId())
.content("[{\"id\":" + dsTypeIds.get(dsTypeIds.size() - 1) + "}]")

View File

@@ -287,7 +287,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
mvc.perform(delete(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
.andExpect(status().isNoContent());
}
/**