Search in sources :

Example 16 with ImageCatalogTestDto

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

the class ChangeImageCatalogTest method testChangeDataHubImageCatalog.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running DataHub and image catalogs created by ENV_CREATOR_A", when = "a change image catalog request is sent to use an image catalog created by ENV_CREATOR_A", then = "ENV_CREATOR_A, ACCOUNT_ADMIN and ENV_CREATOR_B with shared resource user and environment admin rights can perform the operation")
public void testChangeDataHubImageCatalog(MockedTestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.ENV_CREATOR_A);
    createDefaultImageCatalog(testContext);
    ImageCatalogTestDto imageCatalog1 = resourceCreator.createNewImageCatalog(testContext);
    ImageCatalogTestDto imageCatalog2 = resourceCreator.createNewImageCatalog(testContext);
    ImageCatalogTestDto imageCatalog3 = resourceCreator.createNewImageCatalog(testContext);
    // ENV_CREATOR_A can change DH image catalog in case of DH and target image catalog are created by ENV_CREATOR_A
    testContext.given(CredentialTestDto.class).when(credentialTestClient.create()).given(EnvironmentTestDto.class).when(environmentTestClient.create()).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).when(freeIpaTestClient.create()).await(Status.AVAILABLE).given(SdxInternalTestDto.class).when(sdxTestClient.createInternal()).await(SdxClusterStatusResponse.RUNNING).when(sdxTestClient.detailedDescribeInternal()).given(DistroXTestDto.class).when(distroXClient.create()).await(STACK_AVAILABLE, RunningParameter.who(cloudbreakActor.useRealUmsUser(AuthUserKeys.ACCOUNT_ADMIN))).given(DistroXChangeImageCatalogTestDto.class).withImageCatalog(imageCatalog1.getName()).when(distroXClient.changeImageCatalog()).validate();
    // ENV_CREATOR_B can change DH image catalog in case of DH and target image catalog are created by ENV_CREATOR_A and
    // ENV_CREATOR_B has environment admin right in terms of the environment created by ENV_CREATOR_A and
    // ENV_CREATOR_B has shared resource right in terms of the image catalog created by ENV_CREATOR_A
    useRealUmsUser(testContext, AuthUserKeys.ENV_CREATOR_B);
    testContext.given(UmsTestDto.class).assignTarget(imageCatalog2.getName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).given(DistroXChangeImageCatalogTestDto.class).withImageCatalog(imageCatalog2.getName()).when(distroXClient.changeImageCatalog()).validate();
    // ACCOUNT_ADMIN can change DH image catalog in case of DH and target image catalog are created by ENV_CREATOR_A
    useRealUmsUser(testContext, AuthUserKeys.ACCOUNT_ADMIN);
    testContext.given(DistroXChangeImageCatalogTestDto.class).withImageCatalog(imageCatalog3.getName()).when(distroXClient.changeImageCatalog()).validate();
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) FreeipaChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaChangeImageCatalogTestDto) DistroXChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXChangeImageCatalogTestDto) SdxChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxChangeImageCatalogTestDto) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) UmsTestDto(com.sequenceiq.it.cloudbreak.dto.ums.UmsTestDto) DistroXChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXChangeImageCatalogTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

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