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());
}
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));
}
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()));
}
Aggregations