public MirrorResourceListResponse setMirrors(String repositoryId, MirrorResourceListRequest resourceRequest)
throws IOException
{
XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);
String serviceURI = "service/local/repository_mirrors/" + repositoryId;
representation.setPayload(resourceRequest);
String responseText = RequestFacade.doPostForText(serviceURI, representation, isSuccessful());
LOG.debug(" getResourceFromResponse: " + responseText);
representation = new XStreamRepresentation(xstream, responseText, mediaType);
MirrorResourceListResponse resourceResponse =
(MirrorResourceListResponse) representation.getPayload(new MirrorResourceListResponse());
Assert.assertNotNull("Resource Response shouldn't be null", resourceResponse);
for (MirrorResource resource : (List<MirrorResource>) resourceResponse.getData()) {
Assert.assertNotNull(resource.getId(), "Id shouldn't be null");
}
for (int i = 0; i < resourceResponse.getData().size(); i++) {
Assert.assertEquals(((MirrorResource) resourceRequest.getData().get(i)).getUrl(),
((MirrorResource) resourceResponse.getData().get(i)).getUrl());
}
return resourceResponse;
}