Add POST REST method for assigning tag to multiple DS (#2280)
!!! the PUT method is deprecated for removal Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -25,6 +25,8 @@ import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -159,6 +161,13 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger("DEPRECATED_USAGE");
|
||||
@Override
|
||||
public ResponseEntity<Void> assignDistributionSetsPut(final Long distributionsetTagId, final List<Long> distributionsetIds) {
|
||||
LOGGER.debug("[DEPRECATED] Deprecated usage of assignDistributionSetsPut. Use assignDistributionSets (POST) instead.");
|
||||
return assignDistributionSets(distributionsetTagId, distributionsetIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> unassignDistributionSet(
|
||||
final Long distributionsetTagId,
|
||||
|
||||
@@ -344,10 +344,9 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final DistributionSetTag tag = testdataFactory.createDistributionSetTags(1).get(0);
|
||||
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(2);
|
||||
|
||||
mvc.perform(
|
||||
put(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
.content(JsonBuilder.toArray(sets.stream().map(DistributionSet::getId).toList()))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
.content(JsonBuilder.toArray(sets.stream().map(DistributionSet::getId).toList()))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user