use of com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone in project cloudbreak by hortonworks.
the class AzurePrivateDnsZoneValidatorServiceTest method testPrivateDnsZonesNotConnectedToNetworkWhenZoneInSingleRG.
@Test
void testPrivateDnsZonesNotConnectedToNetworkWhenZoneInSingleRG() {
ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder();
PagedList<PrivateZone> privateDnsZoneList = getPrivateDnsZones(SINGLE_RESOURCE_GROUP_NAME, List.of(""), null);
ValidationResult result = underTest.privateDnsZonesNotConnectedToNetwork(azureClient, NETWORK_NAME, SINGLE_RESOURCE_GROUP_NAME, ZONE_NAME_POSTGRES, resultBuilder, privateDnsZoneList);
assertFalse(result.hasError());
verify(azureClient, never()).getNetworkLinkByPrivateDnsZone(anyString(), anyString(), anyString());
}
use of com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone in project cloudbreak by hortonworks.
the class AzurePrivateDnsZoneValidatorServiceTest method testPrivateDnsZonesNotConnectedToNetworkWhenNoZonesFound.
@Test
void testPrivateDnsZonesNotConnectedToNetworkWhenNoZonesFound() {
ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder();
PagedList<PrivateZone> privateDnsZoneList = new TestPagedList<>();
ValidationResult result = underTest.privateDnsZonesNotConnectedToNetwork(azureClient, NETWORK_NAME, A_RESOURCE_GROUP_NAME, ZONE_NAME_POSTGRES, resultBuilder, privateDnsZoneList);
assertFalse(result.hasError());
verify(azureClient, never()).getNetworkLinkByPrivateDnsZone(anyString(), anyString(), anyString());
}
use of com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone in project cloudbreak by hortonworks.
the class AzurePrivateDnsZoneValidatorServiceTest method testPrivateDnsZonesNotConnectedToNetworkWhenZoneNotConnected.
@Test
void testPrivateDnsZonesNotConnectedToNetworkWhenZoneNotConnected() {
ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder();
PagedList<PrivateZone> privateDnsZoneList = getPrivateDnsZones(A_RESOURCE_GROUP_NAME, List.of(ZONE_NAME_POSTGRES), ProvisioningState.SUCCEEDED);
when(azureClient.getNetworkLinkByPrivateDnsZone(A_RESOURCE_GROUP_NAME, ZONE_NAME_POSTGRES, NETWORK_NAME)).thenReturn(null);
ValidationResult result = underTest.privateDnsZonesNotConnectedToNetwork(azureClient, NETWORK_NAME, SINGLE_RESOURCE_GROUP_NAME, ZONE_NAME_POSTGRES, resultBuilder, privateDnsZoneList);
assertFalse(result.hasError());
}
use of com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone in project cloudbreak by hortonworks.
the class AzurePrivateDnsZoneValidatorServiceTest method testPrivateDnsZonesNotConnectedToNetworkWhenZoneNameIsNotSupported.
@Test
void testPrivateDnsZonesNotConnectedToNetworkWhenZoneNameIsNotSupported() {
ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder();
PagedList<PrivateZone> privateDnsZoneList = getPrivateDnsZones(A_RESOURCE_GROUP_NAME, List.of("unrelated.zone"), null);
ValidationResult result = underTest.privateDnsZonesNotConnectedToNetwork(azureClient, NETWORK_NAME, SINGLE_RESOURCE_GROUP_NAME, ZONE_NAME_POSTGRES, resultBuilder, privateDnsZoneList);
assertFalse(result.hasError());
verify(azureClient, never()).getNetworkLinkByPrivateDnsZone(anyString(), anyString(), anyString());
}
use of com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone in project cloudbreak by hortonworks.
the class AzureClient method getPrivateDnsZones.
private PagedList<PrivateZone> getPrivateDnsZones(String subscriptionId) {
privatednsManager dnsManager = azureClientCredentials.getPrivateDnsManagerWithAnotherSubscription(subscriptionId);
PagedList<PrivateZone> privateDnsZones = dnsManager.privateZones().list();
privateDnsZones.loadAll();
return privateDnsZones;
}
Aggregations