Search in sources :

Example 6 with ApiAzureNetworkCreationParameters

use of bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters in project terra-workspace-manager by DataBiosphere.

the class CreateAzureNetworkStepTest method deleteNetwork.

@Test
public void deleteNetwork() throws InterruptedException {
    final ApiAzureNetworkCreationParameters creationParameters = ControlledResourceFixtures.getAzureNetworkCreationParameters();
    CreateAzureNetworkStep createAzureNetworkStep = new CreateAzureNetworkStep(mockAzureConfig, mockCrlService, ControlledResourceFixtures.getAzureNetwork(creationParameters));
    final StepResult stepResult = createAzureNetworkStep.undoStep(mockFlightContext);
    // Verify step returns success
    assertThat(stepResult, equalTo(StepResult.getStepResultSuccess()));
    // Verify Azure deletion was called
    verify(mockNetworks).deleteByResourceGroup(mockAzureCloudContext.getAzureResourceGroupId(), creationParameters.getName());
}
Also used : ApiAzureNetworkCreationParameters(bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters) StepResult(bio.terra.stairway.StepResult) Test(org.junit.jupiter.api.Test) BaseAzureTest(bio.terra.workspace.common.BaseAzureTest)

Example 7 with ApiAzureNetworkCreationParameters

use of bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters in project terra-workspace-manager by DataBiosphere.

the class GetAzureNetworkStepTest method getNetwork_alreadyExists.

@Test
public void getNetwork_alreadyExists() throws InterruptedException {
    final ApiAzureNetworkCreationParameters creationParams = ControlledResourceFixtures.getAzureNetworkCreationParameters();
    GetAzureNetworkStep step = new GetAzureNetworkStep(mockAzureConfig, mockCrlService, ControlledResourceFixtures.getAzureNetwork(creationParams));
    when(mockNetworks.getByResourceGroup(mockAzureCloudContext.getAzureResourceGroupId(), creationParams.getName())).thenReturn(mockNetwork);
    final StepResult stepResult = step.doStep(mockFlightContext);
    // Verify step returns error
    assertThat(stepResult.getStepStatus(), equalTo(StepStatus.STEP_RESULT_FAILURE_FATAL));
    assertThat(stepResult.getException().get(), instanceOf(DuplicateResourceException.class));
}
Also used : ApiAzureNetworkCreationParameters(bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters) StepResult(bio.terra.stairway.StepResult) DuplicateResourceException(bio.terra.workspace.service.resource.exception.DuplicateResourceException) Test(org.junit.jupiter.api.Test) BaseAzureTest(bio.terra.workspace.common.BaseAzureTest)

Example 8 with ApiAzureNetworkCreationParameters

use of bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters in project terra-workspace-manager by DataBiosphere.

the class GetAzureNetworkStepTest method getNetwork_doesNotExist.

@Test
public void getNetwork_doesNotExist() throws InterruptedException {
    final ApiAzureNetworkCreationParameters creationParams = ControlledResourceFixtures.getAzureNetworkCreationParameters();
    GetAzureNetworkStep step = new GetAzureNetworkStep(mockAzureConfig, mockCrlService, ControlledResourceFixtures.getAzureNetwork(creationParams));
    when(mockNetworks.getByResourceGroup(mockAzureCloudContext.getAzureResourceGroupId(), creationParams.getName())).thenThrow(mockException);
    final StepResult stepResult = step.doStep(mockFlightContext);
    // Verify step returns success
    assertThat(stepResult, equalTo(StepResult.getStepResultSuccess()));
}
Also used : ApiAzureNetworkCreationParameters(bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters) StepResult(bio.terra.stairway.StepResult) Test(org.junit.jupiter.api.Test) BaseAzureTest(bio.terra.workspace.common.BaseAzureTest)

Aggregations

ApiAzureNetworkCreationParameters (bio.terra.workspace.generated.model.ApiAzureNetworkCreationParameters)8 Test (org.junit.jupiter.api.Test)7 BaseAzureTest (bio.terra.workspace.common.BaseAzureTest)6 StepResult (bio.terra.stairway.StepResult)5 ControlledAzureNetworkResource (bio.terra.workspace.service.resource.controlled.cloud.azure.network.ControlledAzureNetworkResource)3 UUID (java.util.UUID)3 FlightContext (bio.terra.stairway.FlightContext)2 FlightState (bio.terra.stairway.FlightState)2 AuthenticatedUserRequest (bio.terra.workspace.service.iam.AuthenticatedUserRequest)2 AzureCloudContext (bio.terra.workspace.service.workspace.model.AzureCloudContext)2 Context (com.azure.core.util.Context)2 CreateNetworkRequestData (bio.terra.cloudres.azure.resourcemanager.compute.data.CreateNetworkRequestData)1 BaseConnectedTest (bio.terra.workspace.common.BaseConnectedTest)1 ApiAzureDiskCreationParameters (bio.terra.workspace.generated.model.ApiAzureDiskCreationParameters)1 ApiAzureIpCreationParameters (bio.terra.workspace.generated.model.ApiAzureIpCreationParameters)1 ApiAzureVmCreationParameters (bio.terra.workspace.generated.model.ApiAzureVmCreationParameters)1 ControlledAzureDiskResource (bio.terra.workspace.service.resource.controlled.cloud.azure.disk.ControlledAzureDiskResource)1 ControlledAzureIpResource (bio.terra.workspace.service.resource.controlled.cloud.azure.ip.ControlledAzureIpResource)1 ControlledAzureVmResource (bio.terra.workspace.service.resource.controlled.cloud.azure.vm.ControlledAzureVmResource)1 ControlledResource (bio.terra.workspace.service.resource.controlled.model.ControlledResource)1