Search in sources :

Example 1 with RecipeTestDto

use of com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto in project cloudbreak by hortonworks.

the class DataHubCreateInternalApiTest method createInternalBlueprintsAndRecipesAndDataHubFromThem.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "internal recipes, blueprints", when = "creates datahub through internal api", then = "initiator user can do main operations on it")
public void createInternalBlueprintsAndRecipesAndDataHubFromThem(TestContext testContext) {
    String accountId = Crn.safeFromString(cloudbreakActor.useRealUmsUser(AuthUserKeys.USER_ENV_CREATOR_A).getCrn()).getAccountId();
    resourceCreator.createDefaultImageCatalog(testContext);
    RecipeTestDto recipe = resourceCreator.createDefaultRecipeInternal(testContext, accountId);
    BlueprintTestDto blueprint = resourceCreator.createDefaultBlueprintInternal(testContext, accountId, commonClusterManagerProperties().getRuntimeVersion());
    recipe.when(recipeTestClient.getV4Internal()).validate();
    blueprint.when(blueprintTestClient.getV4Internal()).validate();
    resourceCreator.createDefaultCredential(testContext);
    resourceCreator.createDefaultEnvironment(testContext);
    resourceCreator.createDefaultFreeIpa(testContext);
    resourceCreator.createDefaultDataLake(testContext);
    DistroXTestDto distroXTestDto = testContext.given(DistroXNetworkTestDto.class).given(DistroXImageTestDto.class).withImageCatalog().withImageId(IMAGE_CATALOG_ID).given(DistroXClouderaManagerTestDto.class).given(DistroXClusterTestDto.class).withBlueprintName(blueprint.getName()).withClouderaManager().given(DistroXTestDto.class).withRecipe(recipe.getName()).withInitiatorUserCrn(cloudbreakActor.useRealUmsUser(AuthUserKeys.USER_ENV_CREATOR_A).getCrn());
    distroXTestDto.withCluster().withImageSettings(testContext.given(DistroXImageTestDto.class)).withNetwork(testContext.given(DistroXNetworkTestDto.class));
    resourceCreator.createInternalAndWaitAs(distroXTestDto, Optional.of(AuthUserKeys.USER_ACCOUNT_ADMIN));
    RunningParameter envCreatorA = user(AuthUserKeys.USER_ENV_CREATOR_A);
    RunningParameter envCreatorB = user(AuthUserKeys.USER_ENV_CREATOR_B);
    RunningParameter accountAdmin = user(AuthUserKeys.USER_ACCOUNT_ADMIN);
    distroXTestDto.when(distroXTestClient.get(), envCreatorA).validate();
    distroXTestDto.when(distroXTestClient.stop(), envCreatorA).await(STACK_STOPPED, accountAdmin).validate();
    distroXTestDto.when(distroXTestClient.start(), envCreatorA).await(STACK_AVAILABLE, accountAdmin).validate();
    testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    distroXTestDto.when(distroXTestClient.get(), envCreatorB).validate();
    distroXTestDto.when(distroXTestClient.delete(), envCreatorA).await(STACK_DELETED, accountAdmin).validate();
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto) RunningParameter(com.sequenceiq.it.cloudbreak.context.RunningParameter) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) DistroXNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXNetworkTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Example 2 with RecipeTestDto

use of com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto in project cloudbreak by hortonworks.

the class RecipeListFilteringTest method testRecipeListFiltering.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are recipes", when = "users share with each other", then = "they see the other's recipe in the list")
public void testRecipeListFiltering(TestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
    RecipeTestDto recipeA = resourceCreator.createDefaultRecipe(testContext);
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
    RecipeTestDto recipeB = resourceCreator.createNewRecipe(testContext);
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, recipeA.getName(), recipeB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeA.getName());
    testContext.given(UmsTestDto.class).assignTarget(RecipeTestDto.class.getSimpleName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeA.getName(), recipeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, recipeA.getName(), recipeB.getName());
    testContext.given(UmsTestDto.class).assignTarget(recipeB.getName()).withSharedResourceUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, recipeA.getName(), recipeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, recipeA.getName(), recipeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, recipeA.getName(), recipeB.getName());
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Aggregations

Description (com.sequenceiq.it.cloudbreak.context.Description)2 RecipeTestDto (com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto)2 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)2 Test (org.testng.annotations.Test)2 RunningParameter (com.sequenceiq.it.cloudbreak.context.RunningParameter)1 BlueprintTestDto (com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto)1 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)1 DistroXClusterTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto)1 DistroXImageTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto)1 DistroXNetworkTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXNetworkTestDto)1