@Override public ResponseEntity<List<MgmtDistributionSet>> assignDistributionSets( @PathVariable("distributionsetTagId") final Long distributionsetTagId, @RequestBody final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies) { LOG.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId); final List<DistributionSet> assignedDs = this.distributionSetManagement .assignTag(findDistributionSetIds(assignedDSRequestBodies), distributionsetTagId); LOG.debug("Assignd DistributionSet {}", assignedDs.size()); return ResponseEntity.ok(MgmtDistributionSetMapper.toResponseDistributionSets(assignedDs)); }
@Test @Description("Handles the GET request of retrieving all assigned distribution sets by the given tag id.") public void getAssignedDistributionSets() throws Exception { final DistributionSetTag tag = createDistributionSetTag(); distributionSetManagement.assignTag(Arrays.asList(distributionSet.getId()), tag.getId()); arrayPrefix = "content[]."; this.mockMvc .perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tag.getId()) .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()).andDo(MockMvcResultPrinter.print()) .andDo(this.document.document( pathParameters(parameterWithName("distributionsetTagId") .description(ApiModelPropertiesGeneric.ITEM_ID)), getResponseFieldsDistributionSet(true, fieldWithPath("size").type(JsonFieldType.NUMBER) .description(ApiModelPropertiesGeneric.SIZE), fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), fieldWithPath("content").description(MgmtApiModelProperties.TARGET_LIST)))); }