Search in sources :

Example 11 with ImageCatalogTestDto

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

the class StackMatrixAction method action.

@Override
public StackMatrixTestDto action(TestContext testContext, StackMatrixTestDto testDto, CloudbreakClient cloudbreakClient) throws Exception {
    ImageCatalogTestDto imageCatalogTestDto = testContext.get(ImageCatalogTestDto.class);
    testDto.setResponse(cloudbreakClient.getDefaultClient().utilV4Endpoint().getStackMatrix(imageCatalogTestDto != null ? imageCatalogTestDto.getName() : null, testDto.getCloudPlatform().name(), false));
    Log.whenJson(LOGGER, "Obtaining stack matrix response:\n", testDto.getResponse());
    return testDto;
}
Also used : ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)

Example 12 with ImageCatalogTestDto

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

the class StackTestDtoBase method withImageSettings.

public StackTestDtoBase<T> withImageSettings(ImageSettingsTestDto 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 13 with ImageCatalogTestDto

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

the class StackTestDtoBase method withCatalog.

public StackTestDtoBase<T> withCatalog(Class<ImageCatalogTestDto> catalogKey) {
    ImageCatalogTestDto catalog = getTestContext().get(catalogKey);
    if (catalog == null) {
        throw new IllegalArgumentException("Catalog is null with given key: " + catalogKey);
    }
    getRequest().getImage().setCatalog(catalog.getName());
    return this;
}
Also used : ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)

Example 14 with ImageCatalogTestDto

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

the class StackTestDtoBase method withEveryProperties.

public StackTestDtoBase<T> withEveryProperties() {
    ImageCatalogTestDto imgCat = getTestContext().get(ImageCatalogTestDto.class);
    getTestContext().given("network", NetworkV4TestDto.class).withSubnetCIDR("10.10.0.0/16").given("securityRulesWorker", SecurityRulesEntity.class).withPorts("55", "66", "77").withProtocol("ftp").withSubnet("10.0.0.0/32").given("securityGroupMaster", SecurityGroupTestDto.class).withSecurityGroupIds("scgId1", "scgId2").given("securityGroupWorker", SecurityGroupTestDto.class).withSecurityRules("securityRulesWorker").given("master", InstanceGroupTestDto.class).withHostGroup(MASTER).withRecipes("mock-test-recipe").withSecurityGroup("securityGroupMaster").given("worker", InstanceGroupTestDto.class).withHostGroup(WORKER).withSecurityGroup("securityGroupWorker").given("compute", InstanceGroupTestDto.class).withHostGroup(COMPUTE).given("gatewayTopology", GatewayTopologyTestDto.class).withExposedServices("AMBARI").withTopologyName("proxy-name").given("gateway", GatewayTestDto.class).withTopologies("gatewayTopology").given("cluster", ClusterTestDto.class).withRdsConfigNames("mock-test-rds").withGateway("gateway").given("imageSettings", ImageSettingsTestDto.class).withImageId("f6e778fc-7f17-4535-9021-515351df3691").withImageCatalog(imgCat.getName());
    return withNetwork("network").withInstanceGroups("master", "worker", "compute").withCluster("cluster").withUserDefinedTags(Map.of("some-tag", "custom-tag")).withInputs(Map.of("some-input", "custom-input")).withImageSettings("imageSettings");
}
Also used : SecurityGroupTestDto(com.sequenceiq.it.cloudbreak.dto.SecurityGroupTestDto) NetworkV4TestDto(com.sequenceiq.it.cloudbreak.dto.NetworkV4TestDto) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) GatewayTestDto(com.sequenceiq.it.cloudbreak.dto.GatewayTestDto) SecurityRulesEntity(com.sequenceiq.it.cloudbreak.SecurityRulesEntity) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto)

Example 15 with ImageCatalogTestDto

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

the class ChangeImageCatalogTest method testChangeDataLakeImageCatalog.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running DataLake 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 right can perform the operation")
public void testChangeDataLakeImageCatalog(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 DL image catalog in case of DL 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(SdxInternalTestDto.class).when(sdxTestClient.createInternal()).await(SdxClusterStatusResponse.RUNNING).when(sdxTestClient.detailedDescribeInternal()).given(SdxChangeImageCatalogTestDto.class).withImageCatalog(imageCatalog1.getName()).when(sdxTestClient.changeImageCatalog()).validate();
    // ACCOUNT_ADMIN can change DL image catalog in case of DL and target image catalog are created by ENV_CREATOR_A
    useRealUmsUser(testContext, AuthUserKeys.ACCOUNT_ADMIN);
    testContext.given(SdxChangeImageCatalogTestDto.class).withImageCatalog(imageCatalog2.getName()).when(sdxTestClient.changeImageCatalog()).validate();
    // ENV_CREATOR_B can change DL image catalog in case of DL 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(EnvironmentTestDto.class.getSimpleName()).withEnvironmentAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).given(UmsTestDto.class).assignTarget(imageCatalog3.getName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).given(SdxChangeImageCatalogTestDto.class).withImageCatalog(imageCatalog3.getName()).when(sdxTestClient.changeImageCatalog()).validate();
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) 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) SdxChangeImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxChangeImageCatalogTestDto) UmsTestDto(com.sequenceiq.it.cloudbreak.dto.ums.UmsTestDto) 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