Search in sources :

Example 6 with ParametersDto

use of com.sequenceiq.environment.parameter.dto.ParametersDto in project cloudbreak by hortonworks.

the class GcpEnvironmentParametersConverter method postConvert.

@Override
protected void postConvert(BaseParameters baseParameters, Environment environment, ParametersDto parametersDto) {
    super.postConvert(baseParameters, environment, parametersDto);
    GcpParameters gcpParameters = (GcpParameters) baseParameters;
    Optional<GcpParametersDto> gcpParametersDto = Optional.of(parametersDto).map(ParametersDto::getGcpParametersDto);
    gcpParameters.setEncryptionKey(gcpParametersDto.map(GcpParametersDto::getGcpResourceEncryptionParametersDto).map(GcpResourceEncryptionParametersDto::getEncryptionKey).orElse(null));
}
Also used : GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) ParametersDto(com.sequenceiq.environment.parameter.dto.ParametersDto) GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) GcpParameters(com.sequenceiq.environment.parameters.dao.domain.GcpParameters)

Example 7 with ParametersDto

use of com.sequenceiq.environment.parameter.dto.ParametersDto in project cloudbreak by hortonworks.

the class EnvironmentDetailsToCDPEnvironmentDetailsConverterTest method testConversionSingleResourceGroupWhenAzureNOTUsingSingleResourceGroupShouldReturnSingleResourceGroupFalse.

@Test
public void testConversionSingleResourceGroupWhenAzureNOTUsingSingleResourceGroupShouldReturnSingleResourceGroupFalse() {
    ParametersDto parametersDto = ParametersDto.builder().withAzureParameters(AzureParametersDto.builder().withResourceGroup(AzureResourceGroupDto.builder().withResourceGroupUsagePattern(ResourceGroupUsagePattern.USE_MULTIPLE).build()).build()).build();
    when(environmentDetails.getParameters()).thenReturn(parametersDto);
    UsageProto.CDPEnvironmentDetails cdpEnvironmentDetails = underTest.convert(environmentDetails);
    Assertions.assertFalse(cdpEnvironmentDetails.getAzureDetails().getSingleResourceGroup());
}
Also used : GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) AwsDiskEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AwsDiskEncryptionParametersDto) ParametersDto(com.sequenceiq.environment.parameter.dto.ParametersDto) AzureParametersDto(com.sequenceiq.environment.parameter.dto.AzureParametersDto) AwsParametersDto(com.sequenceiq.environment.parameter.dto.AwsParametersDto) AzureResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 8 with ParametersDto

use of com.sequenceiq.environment.parameter.dto.ParametersDto in project cloudbreak by hortonworks.

the class EnvironmentDetailsToCDPEnvironmentDetailsConverterTest method testConversionSingleResourceGroupWhenAzureUsingSingleResourceGroupShouldReturnSingleResourceGroupTrue.

@Test
public void testConversionSingleResourceGroupWhenAzureUsingSingleResourceGroupShouldReturnSingleResourceGroupTrue() {
    ParametersDto parametersDto = ParametersDto.builder().withAzureParameters(AzureParametersDto.builder().withResourceGroup(AzureResourceGroupDto.builder().withResourceGroupUsagePattern(ResourceGroupUsagePattern.USE_SINGLE).build()).build()).build();
    when(environmentDetails.getParameters()).thenReturn(parametersDto);
    UsageProto.CDPEnvironmentDetails cdpEnvironmentDetails = underTest.convert(environmentDetails);
    Assertions.assertTrue(cdpEnvironmentDetails.getAzureDetails().getSingleResourceGroup());
}
Also used : GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) AwsDiskEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AwsDiskEncryptionParametersDto) ParametersDto(com.sequenceiq.environment.parameter.dto.ParametersDto) AzureParametersDto(com.sequenceiq.environment.parameter.dto.AzureParametersDto) AwsParametersDto(com.sequenceiq.environment.parameter.dto.AwsParametersDto) AzureResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 9 with ParametersDto

use of com.sequenceiq.environment.parameter.dto.ParametersDto in project cloudbreak by hortonworks.

the class EnvironmentDetailsToCDPEnvironmentDetailsConverterTest method testConversionResourceEncryptionEnabledWhenGcpNOTResourceEncryptionEnabledShouldReturnResourceEncryptionEnabledFalse.

@Test
public void testConversionResourceEncryptionEnabledWhenGcpNOTResourceEncryptionEnabledShouldReturnResourceEncryptionEnabledFalse() {
    ParametersDto parametersDto = ParametersDto.builder().build();
    when(environmentDetails.getParameters()).thenReturn(parametersDto);
    UsageProto.CDPEnvironmentDetails cdpEnvironmentDetails = underTest.convert(environmentDetails);
    Assertions.assertFalse(cdpEnvironmentDetails.getGcpDetails().getResourceEncryptionEnabled());
}
Also used : GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) AwsDiskEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AwsDiskEncryptionParametersDto) ParametersDto(com.sequenceiq.environment.parameter.dto.ParametersDto) AzureParametersDto(com.sequenceiq.environment.parameter.dto.AzureParametersDto) AwsParametersDto(com.sequenceiq.environment.parameter.dto.AwsParametersDto) AzureResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 10 with ParametersDto

use of com.sequenceiq.environment.parameter.dto.ParametersDto in project cloudbreak by hortonworks.

the class EnvironmentDetailsToCDPEnvironmentDetailsConverterTest method testConversionResourceEncryptionEnabledWhenAzureUsingResourceEncryptionEnabledShouldReturnResourceEncryptionEnabledTrue.

@Test
public void testConversionResourceEncryptionEnabledWhenAzureUsingResourceEncryptionEnabledShouldReturnResourceEncryptionEnabledTrue() {
    ParametersDto parametersDto = ParametersDto.builder().withAzureParameters(AzureParametersDto.builder().withResourceGroup(AzureResourceGroupDto.builder().withResourceGroupUsagePattern(ResourceGroupUsagePattern.USE_SINGLE).build()).withEncryptionParameters(AzureResourceEncryptionParametersDto.builder().withEncryptionKeyUrl("dummyEncryptionKeyUrl").build()).build()).build();
    when(environmentDetails.getParameters()).thenReturn(parametersDto);
    UsageProto.CDPEnvironmentDetails cdpEnvironmentDetails = underTest.convert(environmentDetails);
    Assertions.assertTrue(cdpEnvironmentDetails.getAzureDetails().getResourceEncryptionEnabled());
}
Also used : GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) AwsDiskEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AwsDiskEncryptionParametersDto) ParametersDto(com.sequenceiq.environment.parameter.dto.ParametersDto) AzureParametersDto(com.sequenceiq.environment.parameter.dto.AzureParametersDto) AwsParametersDto(com.sequenceiq.environment.parameter.dto.AwsParametersDto) AzureResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Aggregations

ParametersDto (com.sequenceiq.environment.parameter.dto.ParametersDto)38 Test (org.junit.jupiter.api.Test)30 AwsParametersDto (com.sequenceiq.environment.parameter.dto.AwsParametersDto)28 AzureResourceEncryptionParametersDto (com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto)24 AwsDiskEncryptionParametersDto (com.sequenceiq.environment.parameter.dto.AwsDiskEncryptionParametersDto)23 GcpParametersDto (com.sequenceiq.environment.parameter.dto.GcpParametersDto)19 GcpResourceEncryptionParametersDto (com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto)19 AzureParametersDto (com.sequenceiq.environment.parameter.dto.AzureParametersDto)18 Environment (com.sequenceiq.environment.environment.domain.Environment)16 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)12 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)9 BaseParameters (com.sequenceiq.environment.parameters.dao.domain.BaseParameters)9 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)8 Credential (com.sequenceiq.environment.credential.domain.Credential)8 EnvironmentEditDto (com.sequenceiq.environment.environment.dto.EnvironmentEditDto)7 EnvironmentCreationDto (com.sequenceiq.environment.environment.dto.EnvironmentCreationDto)6 AwsParameters (com.sequenceiq.environment.parameters.dao.domain.AwsParameters)6 EnvironmentAuthentication (com.sequenceiq.environment.environment.domain.EnvironmentAuthentication)5 GcpParameters (com.sequenceiq.environment.parameters.dao.domain.GcpParameters)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5