@Test public void testDeleteNetworkWithSubNetsShouldNotDeleteResourceGroupWhenSingleResourceGroup() { NetworkDeletionRequest networkDeletionRequest = createNetworkDeletionRequest(false, true); when(azureClientService.getClient(networkDeletionRequest.getCloudCredential())).thenReturn(azureClient); underTest.deleteNetworkWithSubnets(networkDeletionRequest); verify(azureClient).deleteTemplateDeployment(RESOURCE_GROUP, STACK); verify(azureClient).deleteNetworkInResourceGroup(RESOURCE_GROUP, NETWORK_ID); verify(azureClient, never()).deleteResourceGroup(RESOURCE_GROUP); }
@Override public void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest) { if (StringUtils.isEmpty(networkDeletionRequest.getResourceGroup())) { LOGGER.debug("The deletable network does not contain a valid resource group name, it is null or empty!"); return; } if (networkDeletionRequest.isExisting()) { LOGGER.debug("The network was provided by the user, deleting nothing."); return; } if (networkDeletionRequest.isSingleResourceGroup()) { deleteResources(networkDeletionRequest); } else { deleteNetworkResourceGroup(networkDeletionRequest); } }
AzureNetworkConnector implements NetworkConnector { @Override public void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest) { if (StringUtils.isEmpty(networkDeletionRequest.getResourceGroup())) { LOGGER.debug("The deletable network does not contain a valid resource group name, it is null or empty!"); return; } if (networkDeletionRequest.isExisting()) { LOGGER.debug("The network was provided by the user, deleting nothing."); return; } if (networkDeletionRequest.isSingleResourceGroup()) { deleteResources(networkDeletionRequest); } else { deleteNetworkResourceGroup(networkDeletionRequest); } } }
AzureNetworkConnector implements NetworkConnector { @Override public void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest) { if (StringUtils.isEmpty(networkDeletionRequest.getResourceGroup())) { LOGGER.debug("The deletable network does not contain a valid resource group name, it is null or empty!"); return; } if (networkDeletionRequest.isExisting()) { LOGGER.debug("The network was provided by the user, deleting nothing."); return; } if (networkDeletionRequest.isSingleResourceGroup()) { deleteResources(networkDeletionRequest); } else { deleteNetworkResourceGroup(networkDeletionRequest); } }  }
AzureNetworkConnector implements NetworkConnector { @Override public void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest) { if (StringUtils.isEmpty(networkDeletionRequest.getResourceGroup())) { LOGGER.debug("The deletable network does not contain a valid resource group name, it is null or empty!"); return; } if (networkDeletionRequest.isExisting()) { LOGGER.debug("The network was provided by the user, deleting nothing."); return; } if (networkDeletionRequest.isSingleResourceGroup()) { deleteResources(networkDeletionRequest); } else { deleteNetworkResourceGroup(networkDeletionRequest); } }  @Override CreatedCloudNetwork createNetworkWithSubnets(NetworkCreationRequest networkRequest); @Override void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest); @Override NetworkCidr getNetworkCidr(Network network, CloudCredential credential); @Override SubnetSelectionResult chooseSubnets(Collection<CloudSubnet> subnetMetas, SubnetSelectionParameters subnetSelectionParameters); @Override Platform platform(); @Override Variant variant(); }
AzureNetworkConnector implements NetworkConnector { @Override public void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest) { if (StringUtils.isEmpty(networkDeletionRequest.getResourceGroup())) { LOGGER.debug("The deletable network does not contain a valid resource group name, it is null or empty!"); return; } if (networkDeletionRequest.isExisting()) { LOGGER.debug("The network was provided by the user, deleting nothing."); return; } if (networkDeletionRequest.isSingleResourceGroup()) { deleteResources(networkDeletionRequest); } else { deleteNetworkResourceGroup(networkDeletionRequest); } }  @Override CreatedCloudNetwork createNetworkWithSubnets(NetworkCreationRequest networkRequest); @Override void deleteNetworkWithSubnets(NetworkDeletionRequest networkDeletionRequest); @Override NetworkCidr getNetworkCidr(Network network, CloudCredential credential); @Override SubnetSelectionResult chooseSubnets(Collection<CloudSubnet> subnetMetas, SubnetSelectionParameters subnetSelectionParameters); @Override Platform platform(); @Override Variant variant();  }