Search in sources :

Example 1 with CredentialTestDto

use of com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto in project cloudbreak by hortonworks.

the class CredentialListFilteringTest method testCredentialListFiltering.

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

Example 2 with CredentialTestDto

use of com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto in project cloudbreak by hortonworks.

the class FreeIpaListFilteringTest method testFreeIpaListFiltering.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are freeipas", when = "users share with each other", then = "they see the other's freeipa in the list")
public void testFreeIpaListFiltering(TestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
    resourceCreator.createDefaultCredential(testContext);
    EnvironmentTestDto environmentA = resourceCreator.createDefaultEnvironment(testContext);
    resourceCreator.createDefaultFreeIpa(testContext);
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
    CredentialTestDto credential = resourceCreator.createNewCredential(testContext);
    EnvironmentTestDto environmentB = resourceCreator.createNewEnvironment(testContext, credential);
    resourceCreator.createNewFreeIpa(testContext, environmentB);
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentA.getCrn());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentB.getCrn());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, environmentA.getCrn(), environmentB.getCrn());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentB.getCrn());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentA.getCrn());
    testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    testContext.given(UmsTestDto.class).assignTarget(environmentB.getName()).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentA.getCrn(), environmentB.getCrn());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentA.getCrn(), environmentB.getCrn());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, environmentA.getCrn(), environmentB.getCrn());
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) CredentialTestDto(com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) AbstractMockTest(com.sequenceiq.it.cloudbreak.testcase.mock.AbstractMockTest) Test(org.testng.annotations.Test)

Example 3 with CredentialTestDto

use of com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto in project cloudbreak by hortonworks.

the class DataLakeListFilteringTest method testDataLakeListFiltering.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are datalakes", when = "users share with each other", then = "they see the other's datalake in the list")
public void testDataLakeListFiltering(TestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
    resourceCreator.createDefaultCredential(testContext);
    resourceCreator.createDefaultEnvironment(testContext);
    SdxInternalTestDto dataLakeA = resourceCreator.createDefaultDataLake(testContext);
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
    CredentialTestDto credential = resourceCreator.createNewCredential(testContext);
    EnvironmentTestDto environmentB = resourceCreator.createNewEnvironment(testContext, credential);
    SdxInternalTestDto dataLakeB = resourceCreator.createNewDataLake(testContext, environmentB);
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, dataLakeA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, dataLakeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, dataLakeA.getName(), dataLakeB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, dataLakeB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, dataLakeA.getName());
    testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    testContext.given(UmsTestDto.class).assignTarget(environmentB.getName()).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, dataLakeA.getName(), dataLakeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, dataLakeA.getName(), dataLakeB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, dataLakeA.getName(), dataLakeB.getName());
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) CredentialTestDto(com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Example 4 with CredentialTestDto

use of com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto in project cloudbreak by hortonworks.

the class EnvironmentListFilteringTest method testEnvironmentListFiltering.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are environments", when = "users share with each other", then = "they see the other's environment in the list")
public void testEnvironmentListFiltering(TestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
    resourceCreator.createDefaultCredential(testContext);
    EnvironmentTestDto environmentA = resourceCreator.createDefaultEnvironment(testContext);
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
    CredentialTestDto credential = resourceCreator.createNewCredential(testContext);
    EnvironmentTestDto environmentB = resourceCreator.createNewEnvironment(testContext, credential);
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, environmentA.getName(), environmentB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentB.getName());
    assertUserDoesNotSeeAnyOf(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentA.getName());
    testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withEnvironmentAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    testContext.given(UmsTestDto.class).assignTarget(environmentB.getName()).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_A, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, environmentA.getName(), environmentB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, environmentA.getName(), environmentB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, environmentA.getName(), environmentB.getName());
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) CredentialTestDto(com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto) 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)4 CredentialTestDto (com.sequenceiq.it.cloudbreak.dto.credential.CredentialTestDto)4 Test (org.testng.annotations.Test)4 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)3 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)3 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)1 AbstractMockTest (com.sequenceiq.it.cloudbreak.testcase.mock.AbstractMockTest)1