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;
}
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;
}
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;
}
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");
}
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();
}
Aggregations