From 76a77f85e2aff50c5c4683f4374f82cbd50c7252 Mon Sep 17 00:00:00 2001 From: Vasil Ilchev Date: Mon, 17 Nov 2025 12:53:44 +0200 Subject: [PATCH] =?UTF-8?q?Allign=20MGMT=20Rest=20APIs=20->=20return=20204?= =?UTF-8?q?=20NO=5FCONTENT=20w/o=20body=20where=20success=E2=80=A6=20(#279?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../mgmt/rest/api/MgmtActionRestApi.java | 6 ++-- .../rest/api/MgmtDistributionSetRestApi.java | 30 ++++++++--------- .../api/MgmtDistributionSetTagRestApi.java | 10 +++--- .../api/MgmtDistributionSetTypeRestApi.java | 10 +++--- .../mgmt/rest/api/MgmtRolloutRestApi.java | 16 ++++----- .../rest/api/MgmtSoftwareModuleRestApi.java | 17 ++++------ .../api/MgmtSoftwareModuleTypeRestApi.java | 2 +- .../api/MgmtTargetFilterQueryRestApi.java | 4 +-- .../mgmt/rest/api/MgmtTargetGroupRestApi.java | 14 ++++---- .../mgmt/rest/api/MgmtTargetRestApi.java | 33 +++++++++---------- .../mgmt/rest/api/MgmtTargetTagRestApi.java | 12 +++---- .../mgmt/rest/api/MgmtTargetTypeRestApi.java | 8 ++--- .../rest/api/MgmtTenantManagementRestApi.java | 2 +- .../rest/resource/MgmtActionResource.java | 4 +-- .../resource/MgmtDistributionSetResource.java | 17 ++++++---- .../MgmtDistributionSetTagResource.java | 10 +++--- .../MgmtDistributionSetTypeResource.java | 10 +++--- .../rest/resource/MgmtRolloutResource.java | 16 ++++----- .../resource/MgmtSoftwareModuleResource.java | 13 +++++--- .../MgmtSoftwareModuleTypeResource.java | 2 +- .../MgmtTargetFilterQueryResource.java | 2 +- .../resource/MgmtTargetGroupResource.java | 6 ++-- .../rest/resource/MgmtTargetResource.java | 23 +++++++------ .../rest/resource/MgmtTargetTagResource.java | 10 +++--- .../rest/resource/MgmtTargetTypeResource.java | 6 ++-- .../MgmtTenantManagementResource.java | 2 +- .../rest/resource/MgmtActionResourceTest.java | 12 ++++--- .../MgmtDistributionSetResourceTest.java | 24 +++++++------- .../MgmtDistributionSetTagResourceTest.java | 10 +++--- .../MgmtDistributionSetTypeResourceTest.java | 16 ++++----- .../resource/MgmtRolloutResourceTest.java | 32 +++++++++--------- .../MgmtSoftwareModuleResourceTest.java | 10 +++--- .../MgmtSoftwareModuleTypeResourceTest.java | 4 +-- .../MgmtTargetFilterQueryResourceTest.java | 2 +- .../resource/MgmtTargetGroupResourceTest.java | 12 +++---- .../rest/resource/MgmtTargetResourceTest.java | 25 +++++++------- .../resource/MgmtTargetTagResourceTest.java | 14 ++++---- .../resource/MgmtTargetTypeResourceTest.java | 10 +++--- .../MgmtTenantManagementResourceTest.java | 2 +- 39 files changed, 228 insertions(+), 230 deletions(-) diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtActionRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtActionRestApi.java index 1953609e7..3e76d9f66 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtActionRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtActionRestApi.java @@ -137,7 +137,8 @@ public interface MgmtActionRestApi { * @return status OK if delete as successful. */ @Operation(summary = "Delete a single action by id", description = "Handles the DELETE request for single action within Bosch IoT Rollouts. Required Permission: DELETE_REPOSITORY") - @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or data volume restriction applies.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @@ -156,7 +157,8 @@ public interface MgmtActionRestApi { * @return status OK if delete as successful. */ @Operation(summary = "Delete multiple actions by list OR rsql filter", description = "Handles the DELETE request for multiple actions within Bosch IoT Rollouts. Either action id list OR rsql filter SHOULD be provided. Required Permission: DELETE_REPOSITORY") - @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @ApiResponse(responseCode = "403", description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or data volume restriction applies.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java index b2f4829b5..8c755fc5a 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java @@ -40,7 +40,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery; import org.eclipse.hawkbit.rest.OpenApi; import org.eclipse.hawkbit.rest.json.model.ExceptionInfo; import org.springframework.hateoas.MediaTypes; -import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; @@ -50,7 +49,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseStatus; /** * REST Resource handling for DistributionSet CRUD operations. @@ -194,7 +192,7 @@ public interface MgmtDistributionSetRestApi { @Operation(summary = "Delete Distribution Set by Id", description = "Handles the DELETE request for a single " + "Distribution Set. Required permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -447,7 +445,7 @@ public interface MgmtDistributionSetRestApi { "target IDs. Non-existing targets are silently ignored resulting in a valid response. " + "Required permissions: READ_REPOSITORY and UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "200", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -513,8 +511,7 @@ public interface MgmtDistributionSetRestApi { }) @PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata", consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE }) - @ResponseStatus(HttpStatus.CREATED) - void createMetadata( + ResponseEntity createMetadata( @PathVariable("distributionSetId") Long distributionSetId, @RequestBody List metadataRest); @@ -593,7 +590,7 @@ public interface MgmtDistributionSetRestApi { @Operation(summary = "Update single meta data value of a distribution set", description = "Update a single meta " + "data value for speficic key. Required permission: UPDATE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "200", description = "Successfully updated"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -617,9 +614,9 @@ public interface MgmtDistributionSetRestApi { "and the client has to wait another second.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) - @PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}") - @ResponseStatus(HttpStatus.OK) - void updateMetadata( + @PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}", + consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE }) + ResponseEntity updateMetadata( @PathVariable("distributionSetId") Long distributionSetId, @PathVariable("metadataKey") String metadataKey, @RequestBody MgmtMetadataBodyPut metadata); @@ -633,7 +630,7 @@ public interface MgmtDistributionSetRestApi { @Operation(summary = "Delete a single meta data entry from the distribution set", description = "Delete a single " + "meta data. Required permission: UPDATE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -652,8 +649,7 @@ public interface MgmtDistributionSetRestApi { content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}") - @ResponseStatus(HttpStatus.OK) - void deleteMetadata( + ResponseEntity deleteMetadata( @PathVariable("distributionSetId") Long distributionSetId, @PathVariable("metadataKey") String metadataKey); @@ -669,7 +665,7 @@ public interface MgmtDistributionSetRestApi { always be a list of software module IDs. Required permissions: READ_REPOSITORY and UPDATE_REPOSITORY """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -710,7 +706,7 @@ public interface MgmtDistributionSetRestApi { @Operation(summary = "Delete the assignment of the software module from the distribution set", description = "Delete an assignment. Required permission: UPDATE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -931,7 +927,7 @@ public interface MgmtDistributionSetRestApi { cancel all actions connected to this distribution set. Required permission: UPDATE_REPOSITORY, UPDATE_TARGET """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully invalidated distribution set"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -961,4 +957,4 @@ public interface MgmtDistributionSetRestApi { ResponseEntity invalidateDistributionSet( @PathVariable("distributionSetId") Long distributionSetId, @Valid @RequestBody MgmtInvalidateDistributionSetRequestBody invalidateRequestBody); -} \ No newline at end of file +} diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java index 42f4e18ba..6725430f1 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java @@ -224,7 +224,7 @@ public interface MgmtDistributionSetTagRestApi { @Operation(summary = "Delete a single distribution set tag", description = "Handles the DELETE request of deleting a single distribution set tag.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -321,7 +321,7 @@ public interface MgmtDistributionSetTagRestApi { @Operation(summary = "Assign distribution set to the given tag id", description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -359,7 +359,7 @@ public interface MgmtDistributionSetTagRestApi { @Operation(summary = "Assign distribution sets to the given tag id", description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -401,7 +401,7 @@ public interface MgmtDistributionSetTagRestApi { @Operation(summary = "Unassign one distribution set from the given tag id", description = "Handles the DELETE request of unassign the given distribution.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -436,7 +436,7 @@ public interface MgmtDistributionSetTagRestApi { @Operation(summary = "Unassign multiple distribution sets from the given tag id", description = "Handles the DELETE request of unassign the given distribution.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java index f76732b17..a231a36dd 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java @@ -147,7 +147,7 @@ public interface MgmtDistributionSetTypeRestApi { @Operation(summary = "Delete Distribution Set Type by Id", description = "Handles the DELETE request for a single" + " distribution set type. Required Permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -407,7 +407,7 @@ public interface MgmtDistributionSetTypeRestApi { description = "Handles the DELETE request for removing a software module type from a single " + "distribution set type. Required Permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully removed"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -444,7 +444,7 @@ public interface MgmtDistributionSetTypeRestApi { "Note that a DS type cannot be changed after it has been used by a DS. " + "Required Permission: UPDATE_REPOSITORY and READ_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully removed"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -481,7 +481,7 @@ public interface MgmtDistributionSetTypeRestApi { "distribution set type.Note that a DS type cannot be changed after it has been used by a DS. " + "Required Permission: UPDATE_REPOSITORY and READ_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully added"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -525,7 +525,7 @@ public interface MgmtDistributionSetTypeRestApi { "distribution set type.Note that a DS type cannot be changed after it has been used by a DS. " + "Required Permission: UPDATE_REPOSITORY and READ_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully added"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java index 634b236ca..ce2b0f539 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java @@ -231,7 +231,7 @@ public interface MgmtRolloutRestApi { "workflow is enabled in system configuration and rollout is in state WAITING_FOR_APPROVAL. " + "Required Permission: APPROVE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully approved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -265,7 +265,7 @@ public interface MgmtRolloutRestApi { "Only possible if approval workflow is enabled in system configuration and rollout is in state " + "WAITING_FOR_APPROVAL. Required Permission: APPROVE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully denied"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -297,7 +297,7 @@ public interface MgmtRolloutRestApi { @Operation(summary = "Start a Rollout", description = "Handles the POST request of starting a created rollout. " + "Required Permission: HANDLE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully started"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -327,7 +327,7 @@ public interface MgmtRolloutRestApi { @Operation(summary = "Pause a Rollout", description = "Handles the POST request of pausing a running rollout. " + "Required Permission: HANDLE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully paused"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -358,7 +358,7 @@ public interface MgmtRolloutRestApi { @Operation(summary = "Stop a Rollout", description = "Handles the POST request of stopping a running rollout. " + "Required Permission: HANDLE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully stopped"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -391,7 +391,7 @@ public interface MgmtRolloutRestApi { @Operation(summary = "Delete a Rollout", description = "Handles the DELETE request of deleting a rollout. " + "Required Permission: DELETE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -423,7 +423,7 @@ public interface MgmtRolloutRestApi { @Operation(summary = "Resume a Rollout", description = "Handles the POST request of resuming a paused rollout. " + "Required Permission: HANDLE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully resumed"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -613,7 +613,7 @@ public interface MgmtRolloutRestApi { @Operation(summary = "Force trigger processing next group of a Rollout", description = "Handles the POST request " + "of triggering the next group of a rollout. Required Permission: UPDATE_ROLLOUT") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully triggered"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java index cb5a2cf6b..2ccc8b35c 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java @@ -31,7 +31,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequ import org.eclipse.hawkbit.rest.OpenApi; import org.eclipse.hawkbit.rest.json.model.ExceptionInfo; import org.springframework.hateoas.MediaTypes; -import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; @@ -43,7 +42,6 @@ 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.ResponseStatus; import org.springframework.web.multipart.MultipartFile; /** @@ -182,7 +180,7 @@ public interface MgmtSoftwareModuleRestApi { */ @Operation(summary = "Delete artifact by Id", description = "Handles the DELETE request for a single Artifact assigned to a SoftwareModule. Required Permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -374,7 +372,7 @@ public interface MgmtSoftwareModuleRestApi { */ @Operation(summary = "Delete Software Module by Id", description = "Handles the DELETE request for a single softwaremodule within Hawkbit. Required Permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -430,8 +428,7 @@ public interface MgmtSoftwareModuleRestApi { }) @PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata", consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE }) - @ResponseStatus(HttpStatus.CREATED) - void createMetadata(@PathVariable("softwareModuleId") Long softwareModuleId, @RequestBody List metadataRest); + ResponseEntity createMetadata(@PathVariable("softwareModuleId") Long softwareModuleId, @RequestBody List metadataRest); /** * Gets a paged list of metadata for a software module. @@ -526,8 +523,7 @@ public interface MgmtSoftwareModuleRestApi { content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PutMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}") - @ResponseStatus(HttpStatus.OK) - void updateMetadata( + ResponseEntity updateMetadata( @PathVariable("softwareModuleId") Long softwareModuleId, @PathVariable("metadataKey") String metadataKey, @RequestBody MgmtSoftwareModuleMetadataBodyPut metadata); @@ -540,7 +536,7 @@ public interface MgmtSoftwareModuleRestApi { */ @Operation(summary = "Delete single metadata entry from the software module", description = "Delete a single metadata. Required Permission: UPDATE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -559,6 +555,5 @@ public interface MgmtSoftwareModuleRestApi { content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}") - @ResponseStatus(HttpStatus.OK) - void deleteMetadata(@PathVariable("softwareModuleId") Long softwareModuleId, @PathVariable("metadataKey") String metadataKey); + ResponseEntity deleteMetadata(@PathVariable("softwareModuleId") Long softwareModuleId, @PathVariable("metadataKey") String metadataKey); } \ No newline at end of file diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java index b314c7fbc..3405a5ae0 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java @@ -146,7 +146,7 @@ public interface MgmtSoftwareModuleTypeRestApi { @Operation(summary = "Delete Software Module Type by Id", description = "Handles the DELETE request for a single software module type. Required Permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetFilterQueryRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetFilterQueryRestApi.java index 2d4202327..14c449db4 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetFilterQueryRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetFilterQueryRestApi.java @@ -224,7 +224,7 @@ public interface MgmtTargetFilterQueryRestApi { */ @Operation(summary = "Delete target filter by id", description = "Handles the DELETE request of deleting a target filter query. Required permission: DELETE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -328,7 +328,7 @@ public interface MgmtTargetFilterQueryRestApi { description = "Removes the auto assign distribution set from the target filter query. " + "Required permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetGroupRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetGroupRestApi.java index d069a27ae..eddb85889 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetGroupRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetGroupRestApi.java @@ -160,7 +160,7 @@ public interface MgmtTargetGroupRestApi { description = "Handles the POST request of target assignment. Already assigned target will be ignored. " + "For complex groups use analogical method with query parameters.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully assigned"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -196,7 +196,7 @@ public interface MgmtTargetGroupRestApi { description = "Handles the PUT request of assign target group." + "Subgroups are allowed - e.g. Parent/Child") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully assigned"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -232,7 +232,7 @@ public interface MgmtTargetGroupRestApi { description = "Handles the PUT request of target group assignment." + "Subgroups are NOT allowed here - e.g. Parent/Child") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully assigned"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -265,7 +265,7 @@ public interface MgmtTargetGroupRestApi { @Operation(summary = "Unassign targets from their target groups", description = "Handles the DELETE request to unassign the given target(s).") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -292,7 +292,7 @@ public interface MgmtTargetGroupRestApi { @Operation(summary = "Unassign targets from their target groups", description = "Handles the DELETE request to unassign the given target(s).") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -339,10 +339,10 @@ public interface MgmtTargetGroupRestApi { * @param rsqlParam - rsql filter based on Target fields */ @Operation(summary = "Assign targets matching a rsql filter to provided target group", - description = "Handles the GET request of assigning targets matching a rsql filter to a provided target group" + + description = "Assign targets matching a rsql filter to a provided target group" + "Subgroups are allowed - e.g. Parent/Child") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully assigned"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java index 27bb12f09..5464f4793 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java @@ -239,7 +239,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Delete target by id", description = "Handles the DELETE request of deleting a single target. Required Permission: DELETE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -269,7 +269,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Unassign target type from target.", description = "Remove the target type from a target. The target type will be set to null. Required permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -296,7 +296,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Assign target type to a target", description = "Assign or update the target type of a target. Required permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -415,7 +415,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Deletes all actions for the provided target EXCEPT the latest N actions OR by provided action IDs list.", description = "Deletes/Purges the action history of the target except the last N actions OR deletes only the actions in the provided action ids list. Required Permission: DELETE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully deleted."), + @ApiResponse(responseCode = "204", description = "Successfully deleted."), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -484,7 +484,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Cancel action for a specific target", description = "Cancels an active action, only active actions can be deleted. Required Permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Success"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -518,7 +518,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Switch an action from soft to forced", description = "Handles the PUT request to switch an action from soft to forced. Required Permission: UPDATE_TARGET.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "200", description = "Successfully updated"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -561,7 +561,7 @@ public interface MgmtTargetRestApi { Required Permission: READ_REPOSITORY AND UPDATE_TARGET """) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully updated confirmation status of the action"), + @ApiResponse(responseCode = "204", description = "Successfully updated confirmation status of the action"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -677,7 +677,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Assigns a distribution set to a specific target", description = "Handles the POST request for assigning a distribution set to a specific target. Required Permission: READ_REPOSITORY and UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "200", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -806,8 +806,7 @@ public interface MgmtTargetRestApi { }) @PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE }) - @ResponseStatus(HttpStatus.CREATED) - void createMetadata(@PathVariable("targetId") String targetId, @RequestBody List metadataRest); + ResponseEntity createMetadata(@PathVariable("targetId") String targetId, @RequestBody List metadataRest); /** * Gets a paged list of metadata for a target. @@ -881,7 +880,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Updates a single metadata value of a target", description = "Update a single metadata value for speficic key. Required permission: UPDATE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully updated"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -905,8 +904,7 @@ public interface MgmtTargetRestApi { content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}") - @ResponseStatus(HttpStatus.OK) - void updateMetadata( + ResponseEntity updateMetadata( @PathVariable("targetId") String targetId, @PathVariable("metadataKey") String metadataKey, @RequestBody MgmtMetadataBodyPut metadata); @@ -920,7 +918,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Deletes a single metadata entry from a target", description = "Delete a single metadata. Required permission: UPDATE_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -939,8 +937,7 @@ public interface MgmtTargetRestApi { content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))) }) @DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}") - @ResponseStatus(HttpStatus.OK) - void deleteMetadata(@PathVariable("targetId") String targetId, @PathVariable("metadataKey") String metadataKey); + ResponseEntity deleteMetadata(@PathVariable("targetId") String targetId, @PathVariable("metadataKey") String metadataKey); /** * Get the current auto-confirm state for a specific target. @@ -980,7 +977,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Activate auto-confirm on a specific target", description = "Handles the POST request to activate auto-confirmation for a specific target. As a result all current active as well as future actions will automatically be confirmed by mentioning the initiator as triggered person. Actions will be automatically confirmed, as long as auto-confirmation is active. Required Permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully activated auto-confirm"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -1017,7 +1014,7 @@ public interface MgmtTargetRestApi { */ @Operation(summary = "Deactivate auto-confirm on a specific target", description = "Handles the POST request to deactivate auto-confirmation for a specific target. All active actions will remain unchanged while all future actions need to be confirmed, before processing with the deployment. Required Permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deactivated auto-confirm"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java index f7c9d0d50..5f25ad85d 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java @@ -162,7 +162,7 @@ public interface MgmtTargetTagRestApi { */ @Operation(summary = "Update target tag by id", description = "Handles the PUT request of updating a target tag.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "200", description = "Successfully updated"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -195,7 +195,7 @@ public interface MgmtTargetTagRestApi { @Operation(summary = "Delete target tag by id", description = "Handles the DELETE request of deleting a single target tag.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -274,7 +274,7 @@ public interface MgmtTargetTagRestApi { @Operation(summary = "Assign target(s) to given tagId", description = "Handles the POST request of target assignment. Already assigned target will be ignored.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully assigned"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -305,7 +305,7 @@ public interface MgmtTargetTagRestApi { @Operation(summary = "Assign target(s) to given tagId", description = "Handles the POST request of target assignment. Already assigned target will be ignored.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully assigned"), + @ApiResponse(responseCode = "204", description = "Successfully assigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -341,7 +341,7 @@ public interface MgmtTargetTagRestApi { @Operation(summary = "Unassign target from a given tagId", description = "Handles the DELETE request to unassign the given target.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), @@ -370,7 +370,7 @@ public interface MgmtTargetTagRestApi { @Operation(summary = "Unassign targets from a given tagId", description = "Handles the DELETE request to unassign the given targets.") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully unassigned"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication."), diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTypeRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTypeRestApi.java index 6febe2875..ac70c8529 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTypeRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTypeRestApi.java @@ -145,7 +145,7 @@ public interface MgmtTargetTypeRestApi { @Operation(summary = "Delete target type by id", description = "Handles the DELETE request for a single target type. Required Permission: DELETE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -177,7 +177,7 @@ public interface MgmtTargetTypeRestApi { @Operation(summary = "Update target type by id", description = "Handles the PUT request for a single target type. Required Permission: UPDATE_TARGET") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "200", description = "Successfully updated"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -294,7 +294,7 @@ public interface MgmtTargetTypeRestApi { description = "Handles the DELETE request for removing a distribution set type from a single target type. " + "Required Permission: UPDATE_TARGET and READ_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully removed"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", @@ -330,7 +330,7 @@ public interface MgmtTargetTypeRestApi { description = "Handles the POST request for adding compatible distribution set types to a target type. " + "Required Permission: UPDATE_TARGET and READ_REPOSITORY") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully added"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java index 3dd3dc007..5c1bb1583 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java @@ -85,7 +85,7 @@ public interface MgmtTenantManagementRestApi { "tenant specific configuration value for the tenant. Afterwards the global default value is used. " + "Required Permission: TENANT_CONFIGURATION") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Successfully retrieved"), + @ApiResponse(responseCode = "204", description = "Successfully deleted"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionInfo.class))), @ApiResponse(responseCode = "401", description = "The request requires user authentication.", diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResource.java index 66ad8f1a9..09518db8f 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResource.java @@ -74,7 +74,7 @@ public class MgmtActionResource implements MgmtActionRestApi { @AuditLog(entity = "Actions",type = AuditLog.Type.DELETE, description = "Delete Action", logResponse = true) public ResponseEntity 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) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java index 4b4797b42..3d7745518 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java @@ -176,7 +176,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi { @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Distribution Set") public ResponseEntity 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 metadataRest) { + public ResponseEntity createMetadata(final Long distributionSetId, final List 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 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 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 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(); } } \ No newline at end of file diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java index 5bb495b8f..b0e73542e 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java @@ -108,7 +108,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi { public ResponseEntity 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 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 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 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 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) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java index 75922721c..6dbe06882 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java @@ -89,8 +89,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Type") public ResponseEntity 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 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 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 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) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java index d1a449a23..a3422646b 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java @@ -159,48 +159,48 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi { @Override public ResponseEntity 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 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 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 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 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 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 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 triggerNextGroup(final Long rolloutId) { rolloutManagement.triggerNextGroup(rolloutId); - return ResponseEntity.ok().build(); + return ResponseEntity.noContent().build(); } @Override diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java index 5e5242ea7..760ef06d4 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java @@ -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 metadataRest) { + public ResponseEntity createMetadata(final Long softwareModuleId, final List 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 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 deleteMetadata(final Long softwareModuleId, final String metadataKey) { softwareModuleManagement.deleteMetadata(softwareModuleId, metadataKey); + return ResponseEntity.noContent().build(); } private static MgmtRepresentationMode parseRepresentationMode(final String representationModeParam) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java index 7f2d953a4..6d0d8e6bd 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java @@ -71,7 +71,7 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes @AuditLog(entity = "SoftwareModuleType", type = AuditLog.Type.DELETE, description = "Delete Software Module Type") public ResponseEntity deleteSoftwareModuleType(final Long softwareModuleTypeId) { softwareModuleTypeManagement.delete(softwareModuleTypeId); - return ResponseEntity.ok().build(); + return ResponseEntity.noContent().build(); } @Override diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java index 209b06ca9..d1b2e5b51 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java @@ -119,7 +119,7 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA public ResponseEntity 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 diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResource.java index 2225e74c9..487079e73 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResource.java @@ -83,7 +83,7 @@ public class MgmtTargetGroupResource implements MgmtTargetGroupRestApi { @Override public ResponseEntity unassignTargetsFromGroup(final List 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 assignTargets(final String group, final List controllerIds) { targetManagement.assignTargetsWithGroup(group, controllerIds); - return ResponseEntity.ok().build(); + return ResponseEntity.noContent().build(); } private ResponseEntity assignTargetsToGroupWithRsql0(final String group, final String rsql) { targetManagement.assignTargetGroupWithRsql(group, rsql); - return ResponseEntity.ok().build(); + return ResponseEntity.noContent().build(); } } \ No newline at end of file diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java index 422cafa60..6ba5c5761 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java @@ -177,21 +177,21 @@ public class MgmtTargetResource implements MgmtTargetRestApi { public ResponseEntity 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 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 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 metadataRest) { + public ResponseEntity createMetadata(final String targetId, final List 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 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 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 deactivateAutoConfirm(final String targetId) { confirmationManagement.deactivateAutoConfirmation(targetId); - return new ResponseEntity<>(HttpStatus.OK); + return ResponseEntity.noContent().build(); } private R getNullIfEmpty(final T object, final Function extractMethod) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java index b40b7044a..a200d76a9 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java @@ -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 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 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) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java index c40ca399b..76202da3a 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java @@ -79,7 +79,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi { public ResponseEntity 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 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 distributionSetTypeIds) { targetTypeManagement.assignCompatibleDistributionSetTypes( targetTypeId, distributionSetTypeIds.stream().map(MgmtDistributionSetTypeAssignment::getId).toList()); - return ResponseEntity.ok().build(); + return ResponseEntity.noContent().build(); } private TargetType findTargetTypeWithExceptionIfNotFound(final Long targetTypeId) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java index 67c9fd085..31f078d80 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java @@ -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 diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResourceTest.java index 666b92de4..2831c3de4 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtActionResourceTest.java @@ -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()) diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java index 4110159d4..4172f51b8 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResourceTest.java @@ -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); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java index 12ef50ce8..05330174e 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResourceTest.java @@ -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 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 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 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 updated = distributionSetManagement.findByTag(tag.getId(), PAGE).getContent(); assertThat(updated.stream().map(DistributionSet::getId).toList()) diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java index 9886be140..fe04dd298 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResourceTest.java @@ -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()) diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java index 1ce1068bd..579c57b41 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResourceTest.java @@ -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 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()); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java index 6fb3cdbbf..a30c0e677 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResourceTest.java @@ -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)); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java index 40ec0a3b0..a4f9d63bb 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResourceTest.java @@ -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()) diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResourceTest.java index 10d32efde..aac2368e4 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResourceTest.java @@ -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(); } diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResourceTest.java index 5a31881db..132891c9a 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetGroupResourceTest.java @@ -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") diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java index 8f378c9c7..48869ed73 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResourceTest.java @@ -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 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 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); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java index f14638419..9417f7707 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResourceTest.java @@ -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 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 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 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 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(); } } \ No newline at end of file diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResourceTest.java index 9388894c2..3c0dc870d 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResourceTest.java @@ -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) + "}]") diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResourceTest.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResourceTest.java index 32a35f25c..2399473c9 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResourceTest.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/test/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResourceTest.java @@ -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()); } /**