Search in sources :

Example 1 with S3GuardTableCreation

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);
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) LocationAwareCredential(com.sequenceiq.environment.environment.domain.LocationAwareCredential) S3GuardTableCreation(com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation) NoSqlTableMetadataResponse(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataResponse) Test(org.junit.jupiter.api.Test)

Example 2 with S3GuardTableCreation

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);
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) LocationAwareCredential(com.sequenceiq.environment.environment.domain.LocationAwareCredential) S3GuardTableCreation(com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation) NoSqlTableMetadataResponse(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataResponse) Test(org.junit.jupiter.api.Test)

Example 3 with S3GuardTableCreation

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);
}
Also used : S3GuardTableCreation(com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation) LocationAwareCredential(com.sequenceiq.environment.environment.domain.LocationAwareCredential)

Aggregations

LocationAwareCredential (com.sequenceiq.environment.environment.domain.LocationAwareCredential)3 S3GuardTableCreation (com.sequenceiq.environment.parameter.dto.s3guard.S3GuardTableCreation)3 NoSqlTableMetadataResponse (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataResponse)2 Credential (com.sequenceiq.environment.credential.domain.Credential)2 Test (org.junit.jupiter.api.Test)2