use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request in project cloudbreak by hortonworks.
the class ImageCatalogTest method testUpdateImageCatalog.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "image catalog update request", when = "calling update request with new url", then = "the image catalog list should contains the new url")
public void testUpdateImageCatalog(MockedTestContext testContext) {
String imgCatalogName = resourcePropertyProvider().getName();
testContext.given(imgCatalogName, ImageCatalogTestDto.class).withName(imgCatalogName).withUrl(getImageCatalogMockServerSetup().getImageCatalogUrl()).when(imageCatalogTestClient.createV4(), key(imgCatalogName)).select(ImageCatalogTestDto::getResponse, key(imgCatalogName)).when((testContext1, entity, cloudbreakClient) -> {
ImageCatalogV4Response originalResponse = entity.getResponse();
UpdateImageCatalogV4Request updateRequest = new UpdateImageCatalogV4Request();
updateRequest.setCrn(originalResponse.getCrn());
updateRequest.setName(originalResponse.getName());
updateRequest.setUrl(IMG_CATALOG_URL);
ImageCatalogV4Response updateResponse = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().update(cloudbreakClient.getWorkspaceId(), updateRequest);
entity.setResponse(updateResponse);
return entity;
}, key(imgCatalogName)).then((testContext1, entity, cloudbreakClient) -> {
ImageCatalogV4Response originalRepsonse = testContext1.getSelected(imgCatalogName);
if (originalRepsonse.getUrl().equals(entity.getResponse().getUrl())) {
throw new IllegalArgumentException("The catalog URL should not be the same after update.");
}
return entity;
}, key(imgCatalogName)).validate();
}
Aggregations