Search in sources :

Example 11 with AzurePrivateDnsZoneServiceEnum

use of com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum in project cloudbreak by hortonworks.

the class AzureExistingPrivateDnsZoneValidatorServiceTest method testValidateWhenInvalidPrivateDnsZoneResourceId.

@Test
void testValidateWhenInvalidPrivateDnsZoneResourceId() {
    ValidationResult.ValidationResultBuilder resultBuilder = new ValidationResult.ValidationResultBuilder();
    String privateDnsZoneId = "invalidPrivateDnsZoneId";
    Map<AzurePrivateDnsZoneServiceEnum, String> serviceToPrivateDnsZoneId = Map.of(AzurePrivateDnsZoneServiceEnum.POSTGRES, privateDnsZoneId);
    resultBuilder = underTest.validate(azureClient, NETWORK_RESOURCE_GROUP_NAME, NETWORK_NAME, serviceToPrivateDnsZoneId, resultBuilder);
    ValidationTestUtil.checkErrorsPresent(resultBuilder, List.of("The provided private DNS zone id invalidPrivateDnsZoneId for service " + "Microsoft.DBforPostgreSQL/servers is not a valid azure resource id."));
    verify(azurePrivateDnsZoneValidatorService, never()).existingPrivateDnsZoneNameIsSupported(any(), any(), eq(resultBuilder));
    verify(azurePrivateDnsZoneValidatorService, never()).privateDnsZoneExists(any(), any(), any());
    verify(azurePrivateDnsZoneValidatorService, never()).privateDnsZoneConnectedToNetwork(any(), anyString(), anyString(), any(), any());
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) AzurePrivateDnsZoneServiceEnum(com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum) Test(org.junit.jupiter.api.Test)

Example 12 with AzurePrivateDnsZoneServiceEnum

use of com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum in project cloudbreak by hortonworks.

the class AzureExistingPrivateDnsZoneValidatorServiceTest method testValidate.

@Test
void testValidate() {
    ValidationResult.ValidationResultBuilder resultBuilder = new ValidationResult.ValidationResultBuilder();
    ResourceId privateDnsZoneId = getPrivateDnsZoneResourceId();
    Map<AzurePrivateDnsZoneServiceEnum, String> serviceToPrivateDnsZoneId = Map.of(AzurePrivateDnsZoneServiceEnum.POSTGRES, privateDnsZoneId.id());
    resultBuilder = underTest.validate(azureClient, NETWORK_RESOURCE_GROUP_NAME, NETWORK_NAME, serviceToPrivateDnsZoneId, resultBuilder);
    assertFalse(resultBuilder.build().hasError());
    verify(azurePrivateDnsZoneValidatorService).existingPrivateDnsZoneNameIsSupported(eq(AzurePrivateDnsZoneServiceEnum.POSTGRES), any(), eq(resultBuilder));
    verify(azurePrivateDnsZoneValidatorService).privateDnsZoneExists(eq(azureClient), any(), eq(resultBuilder));
    verify(azurePrivateDnsZoneValidatorService).privateDnsZoneConnectedToNetwork(eq(azureClient), eq(NETWORK_RESOURCE_GROUP_NAME), eq(NETWORK_NAME), any(), eq(resultBuilder));
}
Also used : PrivateDnsZoneValidationTestConstants.getPrivateDnsZoneResourceId(com.sequenceiq.cloudbreak.cloud.azure.validator.privatedns.PrivateDnsZoneValidationTestConstants.getPrivateDnsZoneResourceId) ResourceId(com.microsoft.azure.arm.resources.ResourceId) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) AzurePrivateDnsZoneServiceEnum(com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum) Test(org.junit.jupiter.api.Test)

Aggregations

AzurePrivateDnsZoneServiceEnum (com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum)12 Test (org.junit.jupiter.api.Test)7 PrivateZone (com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone)3 VirtualNetworkLinkInner (com.microsoft.azure.management.privatedns.v2018_09_01.implementation.VirtualNetworkLinkInner)3 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)3 ResourceStatus (com.sequenceiq.cloudbreak.cloud.model.ResourceStatus)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 Strings (com.google.common.base.Strings)2 CloudException (com.microsoft.azure.CloudException)2 PagedList (com.microsoft.azure.PagedList)2 Azure (com.microsoft.azure.management.Azure)2 AvailabilitySet (com.microsoft.azure.management.compute.AvailabilitySet)2 CachingTypes (com.microsoft.azure.management.compute.CachingTypes)2 Disk (com.microsoft.azure.management.compute.Disk)2 DiskEncryptionSetIdentityType (com.microsoft.azure.management.compute.DiskEncryptionSetIdentityType)2 DiskEncryptionSetType (com.microsoft.azure.management.compute.DiskEncryptionSetType)2 DiskSkuTypes (com.microsoft.azure.management.compute.DiskSkuTypes)2 PREMIUM_LRS (com.microsoft.azure.management.compute.DiskSkuTypes.PREMIUM_LRS)2 STANDARD_LRS (com.microsoft.azure.management.compute.DiskSkuTypes.STANDARD_LRS)2 STANDARD_SSD_LRS (com.microsoft.azure.management.compute.DiskSkuTypes.STANDARD_SSD_LRS)2