use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class EnvironmentDetailsToCDPEnvironmentDetailsConverterTest method testSettingAvailabilityZonesWhenSubnetMetasIsEmpty.
@Test
public void testSettingAvailabilityZonesWhenSubnetMetasIsEmpty() {
NetworkDto networkDto = NetworkDto.builder().withRegistrationType(RegistrationType.EXISTING).withServiceEndpointCreation(ServiceEndpointCreation.ENABLED).withSubnetMetas(null).build();
when(environmentDetails.getNetwork()).thenReturn(networkDto);
UsageProto.CDPEnvironmentDetails cdpEnvironmentDetails = underTest.convert(environmentDetails);
Assertions.assertEquals(0, cdpEnvironmentDetails.getNumberOfAvailabilityZones());
Assertions.assertEquals("", cdpEnvironmentDetails.getAvailabilityZones());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class EnvironmentDetailsToCDPEnvironmentDetailsConverterTest method testSettingAvailabilityZonesWhenSubnetAvailabilityZoneIsEmpty.
@Test
public void testSettingAvailabilityZonesWhenSubnetAvailabilityZoneIsEmpty() {
CloudSubnet publicSubnet = new CloudSubnet();
NetworkDto networkDto = NetworkDto.builder().withRegistrationType(RegistrationType.EXISTING).withServiceEndpointCreation(ServiceEndpointCreation.ENABLED).withSubnetMetas(Map.of("1", publicSubnet)).build();
when(environmentDetails.getNetwork()).thenReturn(networkDto);
UsageProto.CDPEnvironmentDetails cdpEnvironmentDetails = underTest.convert(environmentDetails);
Assertions.assertEquals(-1, cdpEnvironmentDetails.getNumberOfAvailabilityZones());
Assertions.assertEquals("", cdpEnvironmentDetails.getAvailabilityZones());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class EnvironmentDetailsToCDPNetworkDetailsConverterTest method testConversionPublicEndpointAccessGateway.
@Test
public void testConversionPublicEndpointAccessGateway() {
NetworkDto networkDto = NetworkDto.builder().withRegistrationType(RegistrationType.EXISTING).withServiceEndpointCreation(ServiceEndpointCreation.ENABLED).withUsePublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED).build();
when(environmentDetails.getNetwork()).thenReturn(networkDto);
UsageProto.CDPNetworkDetails networkDetails = underTest.convert(environmentDetails);
Assert.assertEquals("ENABLED", networkDetails.getPublicEndpointAccessGateway());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class EnvironmentDetailsToCDPNetworkDetailsConverterTest method testSettingSubnetNumbersWhenSubnetMetasIsNull.
@Test
public void testSettingSubnetNumbersWhenSubnetMetasIsNull() {
NetworkDto networkDto = NetworkDto.builder().withRegistrationType(RegistrationType.EXISTING).withServiceEndpointCreation(ServiceEndpointCreation.ENABLED).build();
networkDto.setSubnetMetas(null);
when(environmentDetails.getNetwork()).thenReturn(networkDto);
UsageProto.CDPNetworkDetails networkDetails = underTest.convert(environmentDetails);
assertEquals(-1, networkDetails.getNumberPrivateSubnets());
assertEquals(-1, networkDetails.getNumberPublicSubnets());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class EnvironmentDetailsToCDPNetworkDetailsConverterTest method testSetOwnDnsZoneWhenAzurePrivateDnsZonePresent.
@Test
public void testSetOwnDnsZoneWhenAzurePrivateDnsZonePresent() {
NetworkDto networkDto = NetworkDto.builder().withAzure(AzureParams.builder().withDatabasePrivateDnsZoneId("privateDnsZoneId").build()).withRegistrationType(RegistrationType.EXISTING).withServiceEndpointCreation(ServiceEndpointCreation.ENABLED_PRIVATE_ENDPOINT).build();
when(environmentDetails.getNetwork()).thenReturn(networkDto);
when(environmentDetails.getCloudPlatform()).thenReturn("AZURE");
UsageProto.CDPNetworkDetails networkDetails = underTest.convert(environmentDetails);
assertNotNull(networkDetails.getOwnDnsZones());
assertTrue(networkDetails.getOwnDnsZones().getPostgres());
}
Aggregations