Search in sources :

Example 6 with ImageCatalogTestDto

use of com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto in project cloudbreak by hortonworks.

the class ImageCatalogListFilteringTest method testImageCatalogListFiltering.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are image catalogs", when = "users share with each other", then = "they see the other's image catalog in the list")
public void testImageCatalogListFiltering(TestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
    ImageCatalogTestDto imageCatalogA = resourceCreator.createDefaultImageCatalog(testContext);
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
    ImageCatalogTestDto imageCatalogB = resourceCreator.createNewImageCatalog(testContext);
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, imageCatalogA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, imageCatalogB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, imageCatalogA.getName(), imageCatalogB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, imageCatalogB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, imageCatalogA.getName());
    testContext.given(UmsTestDto.class).assignTarget(ImageCatalogTestDto.class.getSimpleName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    testContext.given(UmsTestDto.class).assignTarget(imageCatalogB.getName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, imageCatalogA.getName(), imageCatalogB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, imageCatalogA.getName(), imageCatalogB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, imageCatalogA.getName(), imageCatalogB.getName());
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Example 7 with ImageCatalogTestDto

use of com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto in project cloudbreak by hortonworks.

the class DistroXTestDtoBase method withImageSettings.

public DistroXTestDtoBase<T> withImageSettings(DistroXImageTestDto imageSettings) {
    getRequest().setImage(imageSettings.getRequest());
    ImageCatalogTestDto imageCatalogTestDto = getTestContext().get(ImageCatalogTestDto.class);
    if (imageCatalogTestDto != null) {
        getRequest().getImage().setCatalog(imageCatalogTestDto.getName());
    }
    return this;
}
Also used : ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)

Example 8 with ImageCatalogTestDto

use of com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto in project cloudbreak by hortonworks.

the class SdxCustomTestDto method valid.

@Override
public SdxCustomTestDto valid() {
    ImageSettingsTestDto imageSettingsTestDto = getCloudProvider().imageSettings(getTestContext().init(ImageSettingsTestDto.class));
    ImageSettingsV4Request imageSettingsV4Request = imageSettingsTestDto.getRequest();
    ImageCatalogTestDto imageCatalogTestDto = getTestContext().get(ImageCatalogTestDto.class);
    withName(getResourcePropertyProvider().getName(getCloudPlatform())).withEnvironmentName(getTestContext().get(EnvironmentTestDto.class).getRequest().getName()).withClusterShape(getCloudProvider().getClusterShape()).withTags(getCloudProvider().getTags()).withImageCatalogNameAndImageId(imageCatalogTestDto.getName(), imageSettingsV4Request.getId());
    return getCloudProvider().sdxCustom(this);
}
Also used : ImageSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request) ImageSettingsTestDto(com.sequenceiq.it.cloudbreak.dto.ImageSettingsTestDto) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)

Example 9 with ImageCatalogTestDto

use of com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto in project cloudbreak by hortonworks.

the class ImageCatalogTest method testGetImageCatalogsRequestFromExistingImageCatalog.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "image catalog get request", when = "calling get request on catalog endpoint", then = "getting back the catalog request")
public void testGetImageCatalogsRequestFromExistingImageCatalog(MockedTestContext testContext) {
    String imgCatalogName = resourcePropertyProvider().getName();
    testContext.given(imgCatalogName, ImageCatalogTestDto.class).withName(imgCatalogName).withUrl(getImageCatalogMockServerSetup().getImageCatalogUrl()).when(imageCatalogTestClient.createV4(), key(imgCatalogName)).select(ImageCatalogTestDto::getRequest, key(imgCatalogName)).when((testContext1, entity, cloudbreakClient) -> {
        ImageCatalogV4Request request = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().getRequest(cloudbreakClient.getWorkspaceId(), imgCatalogName);
        entity.setRequest(request);
        return entity;
    }).then((testContext1, entity, cloudbreakClient) -> {
        ImageCatalogV4Request imgCatReq = testContext1.getSelected(imgCatalogName);
        if (entity.getRequest().equals(imgCatReq)) {
            throw new IllegalArgumentException("The requests are not identical.");
        }
        return entity;
    }).validate();
}
Also used : ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) ImageCatalogV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Responses) UpdateImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request) StackTestClient(com.sequenceiq.it.cloudbreak.client.StackTestClient) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) NotFoundException(javax.ws.rs.NotFoundException) ImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.ImageCatalogV4Request) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) ImageCatalogV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) ImageCatalogGetImagesByNameAction(com.sequenceiq.it.cloudbreak.action.v4.imagecatalog.ImageCatalogGetImagesByNameAction) BadRequestException(javax.ws.rs.BadRequestException) ImagesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response) RunningParameter.expectedMessage(com.sequenceiq.it.cloudbreak.context.RunningParameter.expectedMessage) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) UpdateImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request) ImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.ImageCatalogV4Request) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 10 with ImageCatalogTestDto

use of com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto 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();
}
Also used : UpdateImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request) ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) ImageCatalogV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Responses) UpdateImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request) StackTestClient(com.sequenceiq.it.cloudbreak.client.StackTestClient) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) NotFoundException(javax.ws.rs.NotFoundException) ImageCatalogV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.ImageCatalogV4Request) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) ImageCatalogV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) ImageCatalogGetImagesByNameAction(com.sequenceiq.it.cloudbreak.action.v4.imagecatalog.ImageCatalogGetImagesByNameAction) BadRequestException(javax.ws.rs.BadRequestException) ImagesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response) RunningParameter.expectedMessage(com.sequenceiq.it.cloudbreak.context.RunningParameter.expectedMessage) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) ImageCatalogV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Aggregations

ImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)16 Description (com.sequenceiq.it.cloudbreak.context.Description)8 Test (org.testng.annotations.Test)8 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)5 DistroXChangeImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXChangeImageCatalogTestDto)4 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)4 FreeipaChangeImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaChangeImageCatalogTestDto)4 SdxChangeImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxChangeImageCatalogTestDto)4 UmsTestDto (com.sequenceiq.it.cloudbreak.dto.ums.UmsTestDto)4 ImageCatalogTestClient (com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient)3 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)3 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)3 Inject (javax.inject.Inject)3 ImageCatalogV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.ImageCatalogV4Request)2 UpdateImageCatalogV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.UpdateImageCatalogV4Request)2 ImageCatalogV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Response)2 ImageCatalogV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageCatalogV4Responses)2 ImagesV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response)2 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)2 ImageCatalogGetImagesByNameAction (com.sequenceiq.it.cloudbreak.action.v4.imagecatalog.ImageCatalogGetImagesByNameAction)2