Search in sources :

Example 6 with PrivateZone

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());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) PrivateZone(com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with PrivateZone

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());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) TestPagedList(com.sequenceiq.cloudbreak.cloud.azure.validator.privatedns.PrivateDnsZoneValidationTestConstants.TestPagedList) PrivateZone(com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with PrivateZone

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());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) PrivateZone(com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with PrivateZone

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());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) PrivateZone(com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with PrivateZone

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;
}
Also used : com.microsoft.azure.management.privatedns.v2018_09_01.implementation.privatednsManager(com.microsoft.azure.management.privatedns.v2018_09_01.implementation.privatednsManager) PrivateZone(com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone)

Aggregations

PrivateZone (com.microsoft.azure.management.privatedns.v2018_09_01.PrivateZone)13 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 Test (org.junit.jupiter.api.Test)6 VirtualNetworkLinkInner (com.microsoft.azure.management.privatedns.v2018_09_01.implementation.VirtualNetworkLinkInner)4 com.microsoft.azure.management.privatedns.v2018_09_01.implementation.privatednsManager (com.microsoft.azure.management.privatedns.v2018_09_01.implementation.privatednsManager)4 AzurePrivateDnsZoneServiceEnum (com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum)4 PagedList (com.microsoft.azure.PagedList)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 Strings (com.google.common.base.Strings)2 CloudException (com.microsoft.azure.CloudException)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