use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class AzureIDBrokerObjectStorageValidatorTest method testValidateObjectStorageWhenLoggerResourceGroupScopeThenNoError.
@Test
public void testValidateObjectStorageWhenLoggerResourceGroupScopeThenNoError() {
SpiFileSystem fileSystem = setupSpiFileSystem(false);
new RoleASsignmentBuilder(client).withAssignment(ASSUMER_IDENTITY_PRINCIPAL_ID, SUBSCRIPTION_FULL_ID).withAssignment(LOG_IDENTITY_PRINCIPAL_ID, STORAGE_RESOURCE_GROUP_NAME);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateObjectStorage(client, fileSystem, "", null, null, resultBuilder);
ValidationResult validationResult = resultBuilder.build();
assertFalse(validationResult.hasError());
}
use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class AzureIDBrokerObjectStorageValidatorTest method testValidateObjectStorageWhenLoggerSubscriptionScopeThenNoError.
@Test
public void testValidateObjectStorageWhenLoggerSubscriptionScopeThenNoError() {
SpiFileSystem fileSystem = setupSpiFileSystem(false);
new RoleASsignmentBuilder(client).withAssignment(ASSUMER_IDENTITY_PRINCIPAL_ID, SUBSCRIPTION_FULL_ID).withAssignment(LOG_IDENTITY_PRINCIPAL_ID, STORAGE_RESOURCE_GROUP_NAME);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateObjectStorage(client, fileSystem, "", null, null, resultBuilder);
ValidationResult validationResult = resultBuilder.build();
assertFalse(validationResult.hasError());
}
use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class AzureIDBrokerObjectStorageValidatorTest method testValidateObjectStorageWithNoStorageAccountScopeRoleAssignment.
@Test
public void testValidateObjectStorageWithNoStorageAccountScopeRoleAssignment() {
SpiFileSystem fileSystem = setupSpiFileSystem(false);
new RoleASsignmentBuilder(client).withAssignment(ASSUMER_IDENTITY_PRINCIPAL_ID, SUBSCRIPTION_FULL_ID);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateObjectStorage(client, fileSystem, STORAGE_LOCATION_RANGER, null, null, resultBuilder);
ValidationResult validationResult = resultBuilder.build();
assertTrue(validationResult.hasError());
assertEquals(1, validationResult.getErrors().size());
String actual = validationResult.getErrors().get(0);
assertEquals(actual, String.format("Identity with id %s has no role assignment on scope(s) [%s, %s, %s]. " + "Please check if you've used the correct Identity when setting up Logs-Storage and Audit.", LOG_IDENTITY, ABFS_STORAGE_ACCOUNT_NAME, STORAGE_RESOURCE_GROUP_NAME, SUBSCRIPTION_ID));
}
use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class AzureIDBrokerObjectStorageValidatorTest method testValidateObjectStorageNonExistingLoggerIdentity.
@Test
public void testValidateObjectStorageNonExistingLoggerIdentity() {
SpiFileSystem fileSystem = setupSpiFileSystem(false);
new RoleASsignmentBuilder(client).withAssignment(ASSUMER_IDENTITY_PRINCIPAL_ID, SUBSCRIPTION_FULL_ID);
when(client.getIdentityById(LOG_IDENTITY)).thenReturn(null);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateObjectStorage(client, fileSystem, "", null, null, resultBuilder);
ValidationResult validationResult = resultBuilder.build();
assertTrue(validationResult.hasError());
assertEquals(1, validationResult.getErrors().size());
String actual = validationResult.getErrors().get(0);
assertEquals(actual, String.format("Log Identity with id %s does not exist in the given Azure subscription. " + "Please check if you've used the correct Identity when setting up Logs-Storage and Audit.", LOG_IDENTITY));
}
use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class AzureIDBrokerObjectStorageValidatorTest method testValidateObjectStorageMappingCaseSensitivityCB6600.
@Test
public void testValidateObjectStorageMappingCaseSensitivityCB6600() {
SpiFileSystem fileSystem = setupSpiFileSystem(true);
PagedList<Identity> identityPagedList = Mockito.spy(PagedList.class);
when(assumer.id()).thenReturn(USER_IDENTITY_1);
when(logger.id()).thenReturn(GROUP_IDENTITY_1);
identityPagedList.add(assumer);
identityPagedList.add(logger);
when(client.listIdentities()).thenReturn(identityPagedList);
new RoleASsignmentBuilder(client).withAssignment(ASSUMER_IDENTITY_PRINCIPAL_ID, SUBSCRIPTION_FULL_ID).withAssignment(LOG_IDENTITY_PRINCIPAL_ID, STORAGE_RESOURCE_GROUP_NAME);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateObjectStorage(client, fileSystem, "", null, null, resultBuilder);
ValidationResult validationResult = resultBuilder.build();
assertFalse(validationResult.hasError());
}
Aggregations