@Test void testSetProviderSpecificNetworkShouldPopulateTheExistingNetworkWithTheNewNetworkData() { AzureNetwork azureNetwork = new AzureNetwork(); Set<CreatedSubnet> createdSubnets = createCreatedSubnets(); Map<String, Object> properties = Map.of("resourceGroupName", RESOURCE_GROUP_NAME); CreatedCloudNetwork createdCloudNetwork = new CreatedCloudNetwork("network-1", NETWORK_ID, createdSubnets, properties); AzureNetwork actual = (AzureNetwork) underTest.setCreatedCloudNetwork(azureNetwork, createdCloudNetwork); assertEquals(createdCloudNetwork.getStackName(), actual.getName()); assertEquals(NETWORK_ID, actual.getNetworkId()); assertEquals(RESOURCE_GROUP_NAME, actual.getResourceGroupName()); assertTrue(SUBNET_IDS.containsAll(actual.getSubnetMetas().keySet())); assertEquals(SUBNET_1, actual.getSubnetMetas().get(SUBNET_1).getId()); assertEquals(SUBNET_1, actual.getSubnetMetas().get(SUBNET_1).getName()); assertEquals(AZ_1, actual.getSubnetMetas().get(SUBNET_1).getAvailabilityZone()); assertEquals(SUBNET_CIDR_1, actual.getSubnetMetas().get(SUBNET_1).getCidr()); assertTrue(actual.getSubnetMetas().get(SUBNET_1).isPrivateSubnet()); assertEquals(SUBNET_2, actual.getSubnetMetas().get(SUBNET_2).getId()); assertEquals(SUBNET_2, actual.getSubnetMetas().get(SUBNET_2).getName()); assertEquals(AZ_2, actual.getSubnetMetas().get(SUBNET_2).getAvailabilityZone()); assertEquals(SUBNET_CIDR_2, actual.getSubnetMetas().get(SUBNET_2).getCidr()); assertTrue(actual.getSubnetMetas().get(SUBNET_2).isPrivateSubnet()); assertEquals(SUBNET_3, actual.getSubnetMetas().get(SUBNET_3).getId()); assertEquals(SUBNET_3, actual.getSubnetMetas().get(SUBNET_3).getName()); assertEquals(AZ_3, actual.getSubnetMetas().get(SUBNET_3).getAvailabilityZone()); assertEquals(SUBNET_CIDR_3, actual.getSubnetMetas().get(SUBNET_3).getCidr()); assertTrue(actual.getSubnetMetas().get(SUBNET_3).isPrivateSubnet()); }
@Override public BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork) { AzureNetwork azureNetwork = (AzureNetwork) baseNetwork; azureNetwork.setName(createdCloudNetwork.getStackName()); azureNetwork.setNetworkId(createdCloudNetwork.getNetworkId()); azureNetwork.setResourceGroupName(String.valueOf(createdCloudNetwork.getProperties().get("resourceGroupName"))); azureNetwork.setSubnetMetas(createdCloudNetwork.getSubnets().stream() .collect(Collectors.toMap(CreatedSubnet::getSubnetId, subnet -> new CloudSubnet( subnet.getSubnetId(), subnet.getSubnetId(), subnet.getAvailabilityZone(), subnet.getCidr(), subnet.isPublicSubnet(), subnet.isMapPublicIpOnLaunch(), subnet.isIgwAvailable(), subnet.getType()) ) ) ); return azureNetwork; }
AzureEnvironmentNetworkConverter extends EnvironmentBaseNetworkConverter { @Override public BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork) { AzureNetwork azureNetwork = (AzureNetwork) baseNetwork; azureNetwork.setName(createdCloudNetwork.getStackName()); azureNetwork.setNetworkId(createdCloudNetwork.getNetworkId()); azureNetwork.setResourceGroupName(String.valueOf(createdCloudNetwork.getProperties().get("resourceGroupName"))); azureNetwork.setSubnetMetas(createdCloudNetwork.getSubnets().stream() .collect(Collectors.toMap(CreatedSubnet::getSubnetId, subnet -> new CloudSubnet( subnet.getSubnetId(), subnet.getSubnetId(), subnet.getAvailabilityZone(), subnet.getCidr(), subnet.isPublicSubnet(), subnet.isMapPublicIpOnLaunch(), subnet.isIgwAvailable(), subnet.getType()) ) ) ); return azureNetwork; } }
AzureEnvironmentNetworkConverter extends EnvironmentBaseNetworkConverter { @Override public BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork) { AzureNetwork azureNetwork = (AzureNetwork) baseNetwork; azureNetwork.setName(createdCloudNetwork.getStackName()); azureNetwork.setNetworkId(createdCloudNetwork.getNetworkId()); azureNetwork.setResourceGroupName(String.valueOf(createdCloudNetwork.getProperties().get("resourceGroupName"))); azureNetwork.setSubnetMetas(createdCloudNetwork.getSubnets().stream() .collect(Collectors.toMap(CreatedSubnet::getSubnetId, subnet -> new CloudSubnet( subnet.getSubnetId(), subnet.getSubnetId(), subnet.getAvailabilityZone(), subnet.getCidr(), subnet.isPublicSubnet(), subnet.isMapPublicIpOnLaunch(), subnet.isIgwAvailable(), subnet.getType()) ) ) ); return azureNetwork; } AzureEnvironmentNetworkConverter(EnvironmentViewConverter environmentViewConverter,
        AzureRegistrationTypeResolver azureRegistrationTypeResolver); }
AzureEnvironmentNetworkConverter extends EnvironmentBaseNetworkConverter { @Override public BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork) { AzureNetwork azureNetwork = (AzureNetwork) baseNetwork; azureNetwork.setName(createdCloudNetwork.getStackName()); azureNetwork.setNetworkId(createdCloudNetwork.getNetworkId()); azureNetwork.setResourceGroupName(String.valueOf(createdCloudNetwork.getProperties().get("resourceGroupName"))); azureNetwork.setSubnetMetas(createdCloudNetwork.getSubnets().stream() .collect(Collectors.toMap(CreatedSubnet::getSubnetId, subnet -> new CloudSubnet( subnet.getSubnetId(), subnet.getSubnetId(), subnet.getAvailabilityZone(), subnet.getCidr(), subnet.isPublicSubnet(), subnet.isMapPublicIpOnLaunch(), subnet.isIgwAvailable(), subnet.getType()) ) ) ); return azureNetwork; } AzureEnvironmentNetworkConverter(EnvironmentViewConverter environmentViewConverter,
        AzureRegistrationTypeResolver azureRegistrationTypeResolver); @Override BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork); @Override CloudPlatform getCloudPlatform(); @Override boolean isApplicableForDwx(CloudSubnet cloudSubnet); @Override boolean isApplicableForMlx(CloudSubnet cloudSubnet); @Override Network convertToNetwork(BaseNetwork baseNetwork); }
AzureEnvironmentNetworkConverter extends EnvironmentBaseNetworkConverter { @Override public BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork) { AzureNetwork azureNetwork = (AzureNetwork) baseNetwork; azureNetwork.setName(createdCloudNetwork.getStackName()); azureNetwork.setNetworkId(createdCloudNetwork.getNetworkId()); azureNetwork.setResourceGroupName(String.valueOf(createdCloudNetwork.getProperties().get("resourceGroupName"))); azureNetwork.setSubnetMetas(createdCloudNetwork.getSubnets().stream() .collect(Collectors.toMap(CreatedSubnet::getSubnetId, subnet -> new CloudSubnet( subnet.getSubnetId(), subnet.getSubnetId(), subnet.getAvailabilityZone(), subnet.getCidr(), subnet.isPublicSubnet(), subnet.isMapPublicIpOnLaunch(), subnet.isIgwAvailable(), subnet.getType()) ) ) ); return azureNetwork; } AzureEnvironmentNetworkConverter(EnvironmentViewConverter environmentViewConverter,
        AzureRegistrationTypeResolver azureRegistrationTypeResolver); @Override BaseNetwork setCreatedCloudNetwork(BaseNetwork baseNetwork, CreatedCloudNetwork createdCloudNetwork); @Override CloudPlatform getCloudPlatform(); @Override boolean isApplicableForDwx(CloudSubnet cloudSubnet); @Override boolean isApplicableForMlx(CloudSubnet cloudSubnet); @Override Network convertToNetwork(BaseNetwork baseNetwork);  }