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