@Test public void validateStorageTypeForGroupWhenPremiumStorageConfiguredAndFlavorNotPremiumThenShouldThrowCloudConnectorException() { thrown.expect(CloudConnectorException.class); String flavor = "Standard_A10"; AzureDiskType azureDiskType = AzureDiskType.PREMIUM_LOCALLY_REDUNDANT; when(azurePremiumValidatorService.premiumDiskTypeConfigured(azureDiskType)).thenReturn(true); when(azurePremiumValidatorService.validPremiumConfiguration(flavor)).thenReturn(false); underTest.validateStorageTypeForGroup(azureDiskType, flavor); verify(azurePremiumValidatorService, times(1)).premiumDiskTypeConfigured(azureDiskType); verify(azurePremiumValidatorService, times(1)).validPremiumConfiguration(flavor); }
public void validateStorageTypeForGroup(AzureDiskType diskType, String flavor) { if (azurePremiumValidatorService.premiumDiskTypeConfigured(diskType)) { if (!azurePremiumValidatorService.validPremiumConfiguration(flavor)) { throw new CloudConnectorException("Only the DS instance types supports the premium storage."); } } }
AzureUtils { public void validateStorageTypeForGroup(AzureDiskType diskType, String flavor) { if (azurePremiumValidatorService.premiumDiskTypeConfigured(diskType)) { if (!azurePremiumValidatorService.validPremiumConfiguration(flavor)) { throw new CloudConnectorException("Only the DS instance types supports the premium storage."); } } } }
AzureUtils { public void validateStorageTypeForGroup(AzureDiskType diskType, String flavor) { if (azurePremiumValidatorService.premiumDiskTypeConfigured(diskType)) { if (!azurePremiumValidatorService.validPremiumConfiguration(flavor)) { throw new CloudConnectorException("Only the DS instance types supports the premium storage."); } } }  }
AzureUtils { public void validateStorageTypeForGroup(AzureDiskType diskType, String flavor) { if (azurePremiumValidatorService.premiumDiskTypeConfigured(diskType)) { if (!azurePremiumValidatorService.validPremiumConfiguration(flavor)) { throw new CloudConnectorException("Only the DS instance types supports the premium storage."); } } }  CloudResource getTemplateResource(Iterable<CloudResource> resourceList); static String getGroupName(String group); static void removeBlankSpace(StringBuilder sb); String getLoadBalancerId(String stackName); String getPrivateInstanceId(String stackName, String groupName, String privateId); String getStackName(CloudContext cloudContext); String generateResourceGroupNameByNameAndId(String name, String id); CloudResourceStatus getTemplateStatus(CloudResource resource, Deployment templateDeployment, AzureClient access, String stackName); boolean isExistingNetwork(Network network); String getInstanceName(CloudResource resource); boolean isPrivateIp(Network network); List<CloudInstance> getInstanceList(CloudStack stack); String getCustomNetworkId(Network network); String getCustomResourceGroupName(Network network); List<String> getCustomSubnetIds(Network network); void validateSubnet(AzureClient client, Network network); void validateStorageType(CloudStack stack); void validateStorageTypeForGroup(AzureDiskType diskType, String flavor); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) List<CloudVmInstanceStatus> deallocateInstances(AuthenticatedContext ac, List<CloudInstance> vms); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) List<CloudVmInstanceStatus> deleteInstances(AuthenticatedContext ac, List<CloudInstance> vms); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void waitForDetachNetworkInterfaces(AuthenticatedContext authenticatedContext, AzureClient azureClient, String resourceGroupName,
            Collection<String> networkInterfaceNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteNetworkInterfaces(AzureClient azureClient, String resourceGroupName, Collection<String> networkInterfaceNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deletePublicIps(AzureClient azureClient, String resourceGroupName, Collection<String> publicIpNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteAvailabilitySets(AzureClient azureClient, String resourceGroupName, Collection<String> availabilitySetNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteSecurityGroups(AzureClient azureClient, Collection<String> securityGroupIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteNetworks(AzureClient azureClient, Collection<String> networkIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteStorageAccounts(AzureClient azureClient, Collection<String> accountIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteImages(AzureClient azureClient, Collection<String> imageIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Optional<String> deleteDatabaseServer(AzureClient azureClient, String databaseServerId, boolean cancelException); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Optional<String> deleteResourceGroup(AzureClient azureClient, String resourceGroupId, boolean cancelException); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteManagedDisks(AzureClient azureClient, Collection<String> managedDiskIds); void checkResourceGroupExistence(AzureClient client, String resourceGroupName); CloudConnectorException convertToCloudConnectorException(CloudException e, String actionDescription); }
AzureUtils { public void validateStorageTypeForGroup(AzureDiskType diskType, String flavor) { if (azurePremiumValidatorService.premiumDiskTypeConfigured(diskType)) { if (!azurePremiumValidatorService.validPremiumConfiguration(flavor)) { throw new CloudConnectorException("Only the DS instance types supports the premium storage."); } } }  CloudResource getTemplateResource(Iterable<CloudResource> resourceList); static String getGroupName(String group); static void removeBlankSpace(StringBuilder sb); String getLoadBalancerId(String stackName); String getPrivateInstanceId(String stackName, String groupName, String privateId); String getStackName(CloudContext cloudContext); String generateResourceGroupNameByNameAndId(String name, String id); CloudResourceStatus getTemplateStatus(CloudResource resource, Deployment templateDeployment, AzureClient access, String stackName); boolean isExistingNetwork(Network network); String getInstanceName(CloudResource resource); boolean isPrivateIp(Network network); List<CloudInstance> getInstanceList(CloudStack stack); String getCustomNetworkId(Network network); String getCustomResourceGroupName(Network network); List<String> getCustomSubnetIds(Network network); void validateSubnet(AzureClient client, Network network); void validateStorageType(CloudStack stack); void validateStorageTypeForGroup(AzureDiskType diskType, String flavor); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) List<CloudVmInstanceStatus> deallocateInstances(AuthenticatedContext ac, List<CloudInstance> vms); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) List<CloudVmInstanceStatus> deleteInstances(AuthenticatedContext ac, List<CloudInstance> vms); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void waitForDetachNetworkInterfaces(AuthenticatedContext authenticatedContext, AzureClient azureClient, String resourceGroupName,
            Collection<String> networkInterfaceNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteNetworkInterfaces(AzureClient azureClient, String resourceGroupName, Collection<String> networkInterfaceNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deletePublicIps(AzureClient azureClient, String resourceGroupName, Collection<String> publicIpNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteAvailabilitySets(AzureClient azureClient, String resourceGroupName, Collection<String> availabilitySetNames); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteSecurityGroups(AzureClient azureClient, Collection<String> securityGroupIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteNetworks(AzureClient azureClient, Collection<String> networkIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteStorageAccounts(AzureClient azureClient, Collection<String> accountIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteImages(AzureClient azureClient, Collection<String> imageIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Optional<String> deleteDatabaseServer(AzureClient azureClient, String databaseServerId, boolean cancelException); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Optional<String> deleteResourceGroup(AzureClient azureClient, String resourceGroupId, boolean cancelException); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void deleteManagedDisks(AzureClient azureClient, Collection<String> managedDiskIds); void checkResourceGroupExistence(AzureClient client, String resourceGroupName); CloudConnectorException convertToCloudConnectorException(CloudException e, String actionDescription); static final String RG_NAME; static final String NETWORK_ID; }