TSK-1125: distributiontargets now produce application/hal-json

This commit is contained in:
Holger Hagen 2020-02-13 16:01:11 +01:00 committed by Jörg Heffner
parent 5c7d38451c
commit f64053ec4e
2 changed files with 18 additions and 1 deletions

View File

@ -253,7 +253,8 @@ public class WorkbasketController extends AbstractPagingController {
return response;
}
@GetMapping(path = Mapping.URL_WORKBASKET_ID_DISTRIBUTION)
@GetMapping(path = Mapping.URL_WORKBASKET_ID_DISTRIBUTION,
produces = MediaTypes.HAL_JSON_UTF8_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<DistributionTargetListResource> getDistributionTargets(
@PathVariable(value = "workbasketId") String workbasketId)

View File

@ -235,4 +235,20 @@ class WorkbasketControllerIntTest {
.isEqualTo(MediaTypes.HAL_JSON_UTF8_VALUE);
assertThat(response.getBody().getContent()).hasSize(3);
}
@Test
void testGetWorkbasketDistributionTargets() {
ResponseEntity<DistributionTargetListResource> response =
template.exchange(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION, "WBI:100000000000000000000000000000000001"),
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(DistributionTargetListResource.class));
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
assertThat(response.getHeaders().getContentType().toString())
.isEqualTo(MediaTypes.HAL_JSON_UTF8_VALUE);
assertThat(response.getBody().getContent()).hasSize(4);
}
}