Search in sources :

Example 1 with AzureEnvironmentNetworkConverter

use of com.sequenceiq.environment.network.v1.converter.AzureEnvironmentNetworkConverter in project cloudbreak by hortonworks.

the class EnvironmentNetworkServiceTest method testCreateProviderSpecificNetworkResources.

@Test
void testCreateProviderSpecificNetworkResources() {
    EnvironmentDto environmentDto = EnvironmentDto.builder().withCloudPlatform(CLOUD_PLATFORM).withCreator(USER_CRN).build();
    NetworkResourcesCreationRequest networkResourcesCreationRequest = new NetworkResourcesCreationRequest.Builder().build();
    AzureEnvironmentNetworkConverter networkConverter = mock(AzureEnvironmentNetworkConverter.class);
    BaseNetwork baseNetwork = getNetwork();
    when(cloudConnector.networkConnector()).thenReturn(networkConnector);
    when(networkCreationRequestFactory.createProviderSpecificNetworkResources(environmentDto, baseNetwork)).thenReturn(networkResourcesCreationRequest);
    when(environmentNetworkConverterMap.get(CloudPlatform.valueOf(CLOUD_PLATFORM))).thenReturn(networkConverter);
    underTest.createProviderSpecificNetworkResources(environmentDto, baseNetwork);
    verify(cloudConnector).networkConnector();
    verify(cloudPlatformConnectors).get(any(CloudPlatformVariant.class));
    verify(networkCreationRequestFactory).createProviderSpecificNetworkResources(environmentDto, baseNetwork);
    verify(networkConnector).createProviderSpecificNetworkResources(networkResourcesCreationRequest);
}
Also used : BaseNetwork(com.sequenceiq.environment.network.dao.domain.BaseNetwork) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) AzureEnvironmentNetworkConverter(com.sequenceiq.environment.network.v1.converter.AzureEnvironmentNetworkConverter) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) NetworkResourcesCreationRequest(com.sequenceiq.cloudbreak.cloud.model.network.NetworkResourcesCreationRequest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)1 NetworkResourcesCreationRequest (com.sequenceiq.cloudbreak.cloud.model.network.NetworkResourcesCreationRequest)1 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)1 BaseNetwork (com.sequenceiq.environment.network.dao.domain.BaseNetwork)1 AzureEnvironmentNetworkConverter (com.sequenceiq.environment.network.v1.converter.AzureEnvironmentNetworkConverter)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1