use of com.sequenceiq.environment.network.dao.domain.AwsNetwork in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkConverterTest method createAwsNetwork.
private AwsNetwork createAwsNetwork() {
AwsNetwork awsNetwork = new AwsNetwork();
awsNetwork.setId(1L);
awsNetwork.setName("network-1");
awsNetwork.setSubnetMetas(createSubnetMetas());
awsNetwork.setNetworkCidr(NETWORK_CIDR);
awsNetwork.setResourceCrn("crn");
awsNetwork.setVpcId(VPC_ID);
return awsNetwork;
}
use of com.sequenceiq.environment.network.dao.domain.AwsNetwork in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkConverterTest method createEnvironment.
private Environment createEnvironment() {
Environment environment = new Environment();
environment.setName(ENV_NAME);
environment.setId(1L);
environment.setAccountId("2");
environment.setDescription("description");
environment.setCloudPlatform("AWS");
environment.setCredential(new Credential());
environment.setLatitude(2.4);
environment.setLongitude(3.5);
environment.setLocation(LOCATION);
environment.setLocationDisplayName("London");
environment.setNetwork(new AwsNetwork());
environment.setRegions(Collections.singleton(new Region()));
return environment;
}
use of com.sequenceiq.environment.network.dao.domain.AwsNetwork in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkConverterTest method testConvertShouldCreateABaseNetworkFromAnEnvironmentAndANetworkDtoWhenOptionalFieldsAreNotPresent.
@Test
void testConvertShouldCreateABaseNetworkFromAnEnvironmentAndANetworkDtoWhenOptionalFieldsAreNotPresent() {
Environment environment = createEnvironment();
NetworkDto networkDto = NetworkDto.builder().withNetworkCidr(NETWORK_CIDR).withSubnetMetas(createSubnetMetas()).build();
AwsNetwork actual = (AwsNetwork) underTest.convert(environment, networkDto, Map.of(), Map.of());
assertEquals(environment.getName(), actual.getName());
assertNull(actual.getVpcId());
assertEquals(NETWORK_CIDR, actual.getNetworkCidr());
assertEquals(RegistrationType.CREATE_NEW, actual.getRegistrationType());
assertTrue(SUBNET_IDS.containsAll(actual.getSubnetMetas().keySet()));
verify(environmentViewConverter).convert(environment);
}
use of com.sequenceiq.environment.network.dao.domain.AwsNetwork in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkConverterTest method testConvertToNetwork.
@Test
void testConvertToNetwork() {
EnvironmentView environment = new EnvironmentView();
environment.setLocation(LOCATION);
AwsNetwork awsNetwork = new AwsNetwork();
awsNetwork.setVpcId(VPC_ID);
awsNetwork.setEnvironments(Set.of(environment));
Network network = underTest.convertToNetwork(awsNetwork);
assertEquals(VPC_ID, network.getStringParameter(NetworkConstants.VPC_ID));
}
use of com.sequenceiq.environment.network.dao.domain.AwsNetwork in project cloudbreak by hortonworks.
the class EnvironmentResourceServiceTest method createAndSetNetwork.
@Test
void createAndSetNetwork() {
Environment environment = new Environment();
NetworkDto networkDto = null;
BaseNetwork network = new AwsNetwork();
when(networkService.saveNetwork(eq(environment), eq(networkDto), eq(ACCOUNT_ID), any(), any())).thenReturn(network);
assertEquals(network, environmentResourceServiceUnderTest.createAndSetNetwork(environment, networkDto, ACCOUNT_ID, Map.of(), Map.of()));
}
Aggregations