use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class EndpointGatewayNetworkValidatorTest method validateProvidedEndpointGatwaySubnets.
@Test
public void validateProvidedEndpointGatwaySubnets() {
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED);
CloudSubnet publicSubnet = getPublicCloudSubnet(PUBLIC_ID_1, AZ_1);
network.setGatewayEndpointSubnetMetas(Map.of(KEY, publicSubnet));
when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.of(getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1)));
when(subnetSelector.chooseSubnetForEndpointGateway(any(), anyString())).thenReturn(Optional.of(publicSubnet));
ValidationResult result = underTest.validate(new ImmutablePair<>(PRIVATE_ID_1, network));
assertNoError(result);
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class EndpointGatewayNetworkValidatorTest method validateNoBaseSubnetId.
@Test
public void validateNoBaseSubnetId() {
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED);
ValidationResult result = underTest.validate(new ImmutablePair<>("", network));
assert result.hasError();
assertEquals(NO_BASE_SUBNET, result.getErrors().get(0));
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class EndpointGatewayNetworkValidatorTest method validateEndpointGatewayDisabled.
@Test
public void validateEndpointGatewayDisabled() {
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.DISABLED);
ValidationResult result = underTest.validate(new ImmutablePair<>("", network));
assertNoError(result);
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class EndpointGatewayNetworkValidatorTest method validateProvidedClusterSubnets.
@Test
public void validateProvidedClusterSubnets() {
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED);
CloudSubnet publicSubnet = getPublicCloudSubnet(PUBLIC_ID_1, AZ_1);
CloudSubnet privateSubnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
network.setSubnetMetas(Map.of(KEY, privateSubnet, KEY + '2', publicSubnet));
when(subnetSelector.findSubnetById(anyMap(), anyString())).thenReturn(Optional.of(privateSubnet));
when(subnetSelector.chooseSubnetForEndpointGateway(any(), anyString())).thenReturn(Optional.of(publicSubnet));
ValidationResult result = underTest.validate(new ImmutablePair<>(PRIVATE_ID_1, network));
assertNoError(result);
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class EndpointGatewayNetworkValidatorTest method validateNoBaseSubnetMeta.
@Test
public void validateNoBaseSubnetMeta() {
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED);
when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.empty());
ValidationResult result = underTest.validate(new ImmutablePair<>(PRIVATE_ID_1, network));
assert result.hasError();
assertEquals(String.format(NO_BASE_SUBNET_META, PRIVATE_ID_1), result.getErrors().get(0));
}
Aggregations