use of com.azure.core.management.exception.ManagementError in project terra-workspace-manager by DataBiosphere.
the class GetAzureStorageStepTest method setup.
@BeforeEach
public void setup() {
when(mockAzureCloudContext.getAzureResourceGroupId()).thenReturn(STUB_STRING_RETURN);
when(mockCrlService.getStorageManager(mockAzureCloudContext, mockAzureConfig)).thenReturn(mockStorageManager);
when(mockStorageManager.storageAccounts()).thenReturn(mockStorageAccounts);
when(mockException.getValue()).thenReturn(new ManagementError("ResourceNotFound", "Resource was not found."));
when(mockFlightContext.getWorkingMap()).thenReturn(mockWorkingMap);
when(mockWorkingMap.get(ControlledResourceKeys.AZURE_CLOUD_CONTEXT, AzureCloudContext.class)).thenReturn(mockAzureCloudContext);
}
use of com.azure.core.management.exception.ManagementError in project terra-workspace-manager by DataBiosphere.
the class CreateAzureDiskStepTest method setup.
@BeforeEach
public void setup() {
// PublicIpAddresses mocks
when(mockAzureCloudContext.getAzureTenantId()).thenReturn(STUB_STRING_RETURN);
when(mockAzureCloudContext.getAzureSubscriptionId()).thenReturn(STUB_STRING_RETURN);
when(mockAzureCloudContext.getAzureResourceGroupId()).thenReturn(STUB_STRING_RETURN);
when(mockCrlService.getComputeManager(mockAzureCloudContext, mockAzureConfig)).thenReturn(mockComputeManager);
when(mockComputeManager.disks()).thenReturn(mockDisks);
// Creation stages mocks
when(mockDisks.define(anyString())).thenReturn(mockDiskStage1);
when(mockDiskStage1.withRegion(anyString())).thenReturn(mockDiskStage2);
when(mockDiskStage2.withExistingResourceGroup(anyString())).thenReturn(mockDiskStage3);
when(mockDiskStage3.withData()).thenReturn(mockDiskStage4);
when(mockDiskStage4.withSizeInGB(anyInt())).thenReturn(mockDiskStage5);
when(mockDiskStage5.withTag(anyString(), anyString())).thenReturn(mockDiskStage6);
when(mockDiskStage6.withTag(anyString(), anyString())).thenReturn(mockDiskStage7);
when(mockDiskStage7.create(any(Context.class))).thenReturn(mockDisk);
// Deletion mocks
// Exception mock
when(mockException.getValue()).thenReturn(new ManagementError("Conflict", "Resource already exists."));
when(mockFlightContext.getWorkingMap()).thenReturn(mockWorkingMap);
when(mockWorkingMap.get(ControlledResourceKeys.AZURE_CLOUD_CONTEXT, AzureCloudContext.class)).thenReturn(mockAzureCloudContext);
}
use of com.azure.core.management.exception.ManagementError in project terra-workspace-manager by DataBiosphere.
the class CreateAzureIpStepTest method setup.
@BeforeEach
public void setup() {
// PublicIpAddresses mocks
when(mockAzureCloudContext.getAzureResourceGroupId()).thenReturn(STUB_STRING_RETURN);
when(mockAzureCloudContext.getAzureTenantId()).thenReturn(STUB_STRING_RETURN);
when(mockAzureCloudContext.getAzureSubscriptionId()).thenReturn(STUB_STRING_RETURN);
when(mockCrlService.getComputeManager(mockAzureCloudContext, mockAzureConfig)).thenReturn(mockComputeManager);
when(mockComputeManager.networkManager()).thenReturn(mockNetworkManager);
when(mockNetworkManager.publicIpAddresses()).thenReturn(mockPublicIpAddresses);
// Creation stages mocks
when(mockPublicIpAddresses.define(anyString())).thenReturn(mockIpStage1);
when(mockIpStage1.withRegion(anyString())).thenReturn(mockIpStage2);
when(mockIpStage2.withExistingResourceGroup(anyString())).thenReturn(mockIpStage3);
when(mockIpStage3.withDynamicIP()).thenReturn(mockIpStage3);
when(mockIpStage3.withTag(anyString(), anyString())).thenReturn(mockIpStage3);
when(mockIpStage3.create(any(Context.class))).thenReturn(mockPublicIpAddress);
// Deletion mocks
doNothing().when(mockPublicIpAddresses).deleteByResourceGroup(anyString(), anyString());
// Exception mock
when(mockException.getValue()).thenReturn(new ManagementError("Conflict", "Resource already exists."));
when(mockFlightContext.getWorkingMap()).thenReturn(mockWorkingMap);
when(mockWorkingMap.get(ControlledResourceKeys.AZURE_CLOUD_CONTEXT, AzureCloudContext.class)).thenReturn(mockAzureCloudContext);
}
use of com.azure.core.management.exception.ManagementError in project terra-workspace-manager by DataBiosphere.
the class GetAzureDiskStepTest method setup.
@BeforeEach
public void setup() {
// PublicIpAddresses mocks
when(mockAzureCloudContext.getAzureResourceGroupId()).thenReturn(STUB_STRING_RETURN);
when(mockCrlService.getComputeManager(mockAzureCloudContext, mockAzureConfig)).thenReturn(mockComputeManager);
when(mockComputeManager.disks()).thenReturn(mockDisks);
when(mockException.getValue()).thenReturn(new ManagementError("ResourceNotFound", "Resource was not found."));
when(mockFlightContext.getWorkingMap()).thenReturn(mockWorkingMap);
when(mockWorkingMap.get(ControlledResourceKeys.AZURE_CLOUD_CONTEXT, AzureCloudContext.class)).thenReturn(mockAzureCloudContext);
}
use of com.azure.core.management.exception.ManagementError in project terra-workspace-manager by DataBiosphere.
the class GetAzureIpStepTest method setup.
@BeforeEach
public void setup() {
// PublicIpAddresses mocks
when(mockAzureCloudContext.getAzureResourceGroupId()).thenReturn(STUB_STRING_RETURN);
when(mockCrlService.getComputeManager(mockAzureCloudContext, mockAzureConfig)).thenReturn(mockComputeManager);
when(mockComputeManager.networkManager()).thenReturn(mockNetworkManager);
when(mockNetworkManager.publicIpAddresses()).thenReturn(mockPublicIpAddresses);
when(mockException.getValue()).thenReturn(new ManagementError("ResourceNotFound", "Resource was not found."));
when(mockFlightContext.getWorkingMap()).thenReturn(mockWorkingMap);
when(mockWorkingMap.get(ControlledResourceKeys.AZURE_CLOUD_CONTEXT, AzureCloudContext.class)).thenReturn(mockAzureCloudContext);
}
Aggregations