use of bio.terra.cloudres.azure.resourcemanager.relay.data.CreateRelayRequestData in project terra-workspace-manager by DataBiosphere.
the class CreateAzureRelayNamespaceStepTest method createRelayNamespace.
@Test
void createRelayNamespace() throws InterruptedException {
final ApiAzureRelayNamespaceCreationParameters creationParameters = ControlledResourceFixtures.getAzureRelayNamespaceCreationParameters();
CreateAzureRelayNamespaceStep createAzureIpStep = new CreateAzureRelayNamespaceStep(mockAzureConfig, mockCrlService, ControlledResourceFixtures.getAzureRelayNamespace(creationParameters.getNamespaceName(), creationParameters.getRegion()));
final StepResult stepResult = createAzureIpStep.doStep(mockFlightContext);
// Verify step returns success
assertThat(stepResult, equalTo(StepResult.getStepResultSuccess()));
// Verify Azure create call was made correctly
verify(mockStage3).create(contextCaptor.capture());
Context context = contextCaptor.getValue();
Optional<CreateRelayRequestData> requestDataOpt = context.getValues().values().stream().filter(CreateRelayRequestData.class::isInstance).map(CreateRelayRequestData.class::cast).findFirst();
CreateRelayRequestData expected = CreateRelayRequestData.builder().setName(creationParameters.getNamespaceName()).setRegion(Region.fromName(creationParameters.getRegion())).setTenantId(dummyAzureCloudContext.getAzureTenantId()).setSubscriptionId(dummyAzureCloudContext.getAzureSubscriptionId()).setResourceGroupName(dummyAzureCloudContext.getAzureResourceGroupId()).build();
assertThat(requestDataOpt, equalTo(Optional.of(expected)));
}
use of bio.terra.cloudres.azure.resourcemanager.relay.data.CreateRelayRequestData in project terra-cloud-resource-lib by DataBiosphere.
the class RelayManagerRequestDataTest method serializeCreateAzureRelay.
@Test
public void serializeCreateAzureRelay() {
CreateRelayRequestData create = CreateRelayRequestData.builder().setName("my-relay").setTenantId("my-tenant").setSubscriptionId("my-sub").setResourceGroupName("my-rg").setRegion(Region.US_EAST).build();
assertEquals(RelayManagerOperation.AZURE_CREATE_RELAY, create.cloudOperation());
assertEquals("{\"tenantId\":\"my-tenant\",\"subscriptionId\":\"my-sub\",\"resourceGroupName\":\"my-rg\",\"name\":\"my-relay\",\"region\":\"eastus\"}", create.serialize().toString());
}
use of bio.terra.cloudres.azure.resourcemanager.relay.data.CreateRelayRequestData in project terra-cloud-resource-lib by DataBiosphere.
the class RelayManagerRequestDataTest method serializeCreateAzureRelayHybridConnection.
@Test
public void serializeCreateAzureRelayHybridConnection() {
CreateRelayRequestData create = CreateRelayRequestData.builder().setName("my-relay-hc").setTenantId("my-tenant").setSubscriptionId("my-sub").setResourceGroupName("my-rg").setRegion(Region.US_EAST).build();
assertEquals(RelayManagerOperation.AZURE_CREATE_RELAY, create.cloudOperation());
assertEquals("{\"tenantId\":\"my-tenant\",\"subscriptionId\":\"my-sub\",\"resourceGroupName\":\"my-rg\",\"name\":\"my-relay-hc\",\"region\":\"eastus\"}", create.serialize().toString());
}
Aggregations