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));
}
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());
}
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());
}
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());
}
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());
}
Aggregations