use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkConverterTest method testGetAttributesForLegacyNetwork.
@Test
void testGetAttributesForLegacyNetwork() {
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
EnvironmentNetworkAzureParams azure = mock(EnvironmentNetworkAzureParams.class);
when(environmentNetworkResponse.getAzure()).thenReturn(azure);
when(azure.getNetworkId()).thenReturn("my_network_id");
when(azure.getResourceGroupName()).thenReturn("my_resource_group");
when(azure.getNoPublicIp()).thenReturn(true);
Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
assertEquals("my_network_id", result.get("networkId"));
assertEquals("my_resource_group", result.get("resourceGroupName"));
assertEquals(true, result.get("noPublicIp"));
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method createAzureParams.
private EnvironmentNetworkAzureParams createAzureParams() {
EnvironmentNetworkAzureParams azureParams = new EnvironmentNetworkAzureParams();
azureParams.setNetworkId(NETWORK_ID);
azureParams.setResourceGroupName("resource-group");
azureParams.setNoPublicIp(true);
return azureParams;
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkConverterTest method testConvertToLegacyNetworkWithPublicEndpointAccessGatewayEnabled.
@Test
void testConvertToLegacyNetworkWithPublicEndpointAccessGatewayEnabled() {
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
EnvironmentNetworkAzureParams azure = mock(EnvironmentNetworkAzureParams.class);
CloudSubnet cloudSubnet = mock(CloudSubnet.class);
when(environmentNetworkResponse.getPublicEndpointAccessGateway()).thenReturn(PublicEndpointAccessGateway.ENABLED);
when(subnetSelector.chooseSubnet(any(), any(), any(), any())).thenReturn(Optional.of(cloudSubnet));
when(cloudSubnet.getId()).thenReturn("my_cloud_subnet");
when(environmentNetworkResponse.getAzure()).thenReturn(azure);
when(azure.getNetworkId()).thenReturn("my_network_id");
when(azure.getResourceGroupName()).thenReturn("my_resource_group");
when(azure.getNoPublicIp()).thenReturn(true);
Network result = converter.convertToLegacyNetwork(environmentNetworkResponse, "my-az");
assertEquals(CloudPlatform.AZURE.toString(), result.getAttributes().getMap().get(CLOUD_PLATFORM).toString());
assertFalse(result.getAttributes().getMap().containsKey(ENDPOINT_GATEWAY_SUBNET_ID));
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method azureEnvironmentNetwork.
private DetailedEnvironmentResponse azureEnvironmentNetwork() {
DetailedEnvironmentResponse der = new DetailedEnvironmentResponse();
der.setCloudPlatform("AZURE");
EnvironmentNetworkResponse environmentNetworkResponse = new EnvironmentNetworkResponse();
environmentNetworkResponse.setSubnetIds(SUBNET_IDS);
environmentNetworkResponse.setPreferedSubnetId(SUBNET_ID);
EnvironmentNetworkAzureParams environmentNetworkAzureParams = new EnvironmentNetworkAzureParams();
environmentNetworkAzureParams.setNetworkId(VPC_ID);
environmentNetworkAzureParams.setResourceGroupName(GROUP_NAME);
environmentNetworkResponse.setAzure(environmentNetworkAzureParams);
der.setNetwork(environmentNetworkResponse);
return der;
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams in project cloudbreak by hortonworks.
the class AzureCloudProvider method environmentNetworkParameters.
private EnvironmentNetworkAzureParams environmentNetworkParameters() {
EnvironmentNetworkAzureParams environmentNetworkAzureParams = new EnvironmentNetworkAzureParams();
AzureProperties.Network network = azureProperties.getNetwork();
environmentNetworkAzureParams.setNetworkId(network.getNetworkId());
environmentNetworkAzureParams.setNoPublicIp(network.getNoPublicIp());
environmentNetworkAzureParams.setResourceGroupName(network.getResourceGroupName());
environmentNetworkAzureParams.setDatabasePrivateDnsZoneId(network.getDatabasePrivateDnsZoneId());
return environmentNetworkAzureParams;
}
Aggregations