use of com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation in project cloudbreak by hortonworks.
the class NoSqlTableCreationModeDeterminerServiceTest method determineCreationModeCreateNew.
@Test
void determineCreationModeCreateNew() {
NoSqlTableMetadataResponse metadataResponse = NoSqlTableMetadataResponse.builder().withStatus(ResponseStatus.RESOURCE_NOT_FOUND).build();
when(noSql.getNoSqlTableMetaData(any())).thenReturn(metadataResponse);
Credential credential = new Credential();
credential.setCloudPlatform("platform");
S3GuardTableCreation mode = underTest.determineCreationMode(LocationAwareCredential.builder().withLocation("location").withCredential(credential).build(), "tablename");
assertEquals(S3GuardTableCreation.CREATE_NEW, mode);
}
use of com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation in project cloudbreak by hortonworks.
the class NoSqlTableCreationModeDeterminerServiceTest method determineCreationModeExisting.
@Test
void determineCreationModeExisting() {
NoSqlTableMetadataResponse metadataResponse = NoSqlTableMetadataResponse.builder().withId("id").withStatus(ResponseStatus.OK).withTableStatus("ACTIVE").build();
when(noSql.getNoSqlTableMetaData(any())).thenReturn(metadataResponse);
Credential credential = new Credential();
credential.setCloudPlatform("platform");
S3GuardTableCreation mode = underTest.determineCreationMode(LocationAwareCredential.builder().withLocation("location").withCredential(credential).build(), "tablename");
assertEquals(S3GuardTableCreation.USE_EXISTING, mode);
}
use of com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation in project cloudbreak by hortonworks.
the class AwsParameterValidator method determineAwsParameters.
private void determineAwsParameters(EnvironmentDto environment, ParametersDto parametersDto) {
LocationAwareCredential locationAwareCredential = getLocationAwareCredential(environment);
S3GuardTableCreation dynamoDbTableCreation = noSqlTableCreationModeDeterminerService.determineCreationMode(locationAwareCredential, parametersDto.getAwsParametersDto().getS3GuardTableName());
LOGGER.debug("S3Guard table name: {}, creation: {}", parametersDto.getAwsParametersDto().getS3GuardTableName(), dynamoDbTableCreation);
parametersDto.getAwsParametersDto().setDynamoDbTableCreation(dynamoDbTableCreation);
parametersService.saveParameters(environment.getId(), parametersDto);
}
Aggregations