@Test public void testGetVirtualMachinesByIdShouldReturnTheVirtualMachines() { Set<String> privateInstanceIds = createPrivateInstanceIds(); PagedList<VirtualMachine> virtualMachines = createPagedList(); when(azureClient.getVirtualMachines(RESOURCE_GROUP)).thenReturn(virtualMachines); Map<String, VirtualMachine> actual = underTest.getVirtualMachinesByName(azureClient, RESOURCE_GROUP, privateInstanceIds); assertEquals(INSTANCE_1, actual.get(INSTANCE_1).name()); assertEquals(INSTANCE_2, actual.get(INSTANCE_2).name()); assertEquals(INSTANCE_3, actual.get(INSTANCE_3).name()); }
@Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) public Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds) { LOGGER.debug("Starting to retrieve vm metadata from Azure for ids: {}", privateInstanceIds); PagedList<VirtualMachine> virtualMachines = azureClient.getVirtualMachines(resourceGroup); while (hasMissingVm(virtualMachines, privateInstanceIds) && virtualMachines.hasNextPage()) { virtualMachines.loadNextPage(); } validateResponse(virtualMachines, privateInstanceIds); return collectVirtualMachinesByName(privateInstanceIds, virtualMachines); }
AzureVirtualMachineService { @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) public Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds) { LOGGER.debug("Starting to retrieve vm metadata from Azure for ids: {}", privateInstanceIds); PagedList<VirtualMachine> virtualMachines = azureClient.getVirtualMachines(resourceGroup); while (hasMissingVm(virtualMachines, privateInstanceIds) && virtualMachines.hasNextPage()) { virtualMachines.loadNextPage(); } validateResponse(virtualMachines, privateInstanceIds); return collectVirtualMachinesByName(privateInstanceIds, virtualMachines); } }
AzureVirtualMachineService { @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) public Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds) { LOGGER.debug("Starting to retrieve vm metadata from Azure for ids: {}", privateInstanceIds); PagedList<VirtualMachine> virtualMachines = azureClient.getVirtualMachines(resourceGroup); while (hasMissingVm(virtualMachines, privateInstanceIds) && virtualMachines.hasNextPage()) { virtualMachines.loadNextPage(); } validateResponse(virtualMachines, privateInstanceIds); return collectVirtualMachinesByName(privateInstanceIds, virtualMachines); }  }
AzureVirtualMachineService { @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) public Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds) { LOGGER.debug("Starting to retrieve vm metadata from Azure for ids: {}", privateInstanceIds); PagedList<VirtualMachine> virtualMachines = azureClient.getVirtualMachines(resourceGroup); while (hasMissingVm(virtualMachines, privateInstanceIds) && virtualMachines.hasNextPage()) { virtualMachines.loadNextPage(); } validateResponse(virtualMachines, privateInstanceIds); return collectVirtualMachinesByName(privateInstanceIds, virtualMachines); }  @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Map<String, VirtualMachine> getVmsFromAzureAndFillStatuses(AuthenticatedContext ac, List<CloudInstance> cloudInstances,
            List<CloudVmInstanceStatus> statuses); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void refreshInstanceViews(Map<String, VirtualMachine> virtualMachines); }
AzureVirtualMachineService { @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) public Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds) { LOGGER.debug("Starting to retrieve vm metadata from Azure for ids: {}", privateInstanceIds); PagedList<VirtualMachine> virtualMachines = azureClient.getVirtualMachines(resourceGroup); while (hasMissingVm(virtualMachines, privateInstanceIds) && virtualMachines.hasNextPage()) { virtualMachines.loadNextPage(); } validateResponse(virtualMachines, privateInstanceIds); return collectVirtualMachinesByName(privateInstanceIds, virtualMachines); }  @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) Map<String, VirtualMachine> getVmsFromAzureAndFillStatuses(AuthenticatedContext ac, List<CloudInstance> cloudInstances,
            List<CloudVmInstanceStatus> statuses); @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5) void refreshInstanceViews(Map<String, VirtualMachine> virtualMachines);  }