use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.
the class GcpEnvironmentNetworkConverterTest method getNoPublicIpAttributeForLegacyNetwork.
@Test
void getNoPublicIpAttributeForLegacyNetwork() {
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
EnvironmentNetworkGcpParams environmentNetworkGcpParams = mock(EnvironmentNetworkGcpParams.class);
when(environmentNetworkResponse.getGcp()).thenReturn(environmentNetworkGcpParams);
when(environmentNetworkGcpParams.getNoPublicIp()).thenReturn(true);
Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
assertEquals(true, result.get("noPublicIp"));
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.
the class GcpEnvironmentNetworkConverterTest method getSharedProjectIdAttributeForLegacyNetwork.
@Test
void getSharedProjectIdAttributeForLegacyNetwork() {
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
EnvironmentNetworkGcpParams environmentNetworkGcpParams = mock(EnvironmentNetworkGcpParams.class);
when(environmentNetworkResponse.getGcp()).thenReturn(environmentNetworkGcpParams);
when(environmentNetworkGcpParams.getSharedProjectId()).thenReturn(GCP_SHARED_PROJECT_ID);
Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
assertEquals(GCP_SHARED_PROJECT_ID, result.get("sharedProjectId"));
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.
the class GcpEnvironmentNetworkConverterTest method testAllNullAttributesForLegacyNetwork.
@Test
void testAllNullAttributesForLegacyNetwork() {
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
EnvironmentNetworkGcpParams environmentNetworkGcpParams = mock(EnvironmentNetworkGcpParams.class);
when(environmentNetworkResponse.getGcp()).thenReturn(environmentNetworkGcpParams);
when(environmentNetworkGcpParams.getNetworkId()).thenReturn(null);
when(environmentNetworkGcpParams.getNoFirewallRules()).thenReturn(null);
when(environmentNetworkGcpParams.getNoPublicIp()).thenReturn(null);
when(environmentNetworkGcpParams.getSharedProjectId()).thenReturn(null);
Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
assertFalse(result.containsKey("networkId"));
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method testConvertToNetworkV4RequestWhenGcpNetworkKeyIsNullThenBasicSettingShouldHappen.
@Test
void testConvertToNetworkV4RequestWhenGcpNetworkKeyIsNullThenBasicSettingShouldHappen() {
DetailedEnvironmentResponse input = createGcpEnvironment();
NetworkV4Request result = underTest.convertToNetworkV4Request(new ImmutablePair<>(null, input));
Assertions.assertNotNull(result);
GcpNetworkV4Parameters gcpNetworkResult = result.getGcp();
EnvironmentNetworkGcpParams inputGcpNetwork = input.getNetwork().getGcp();
Assertions.assertNotNull(gcpNetworkResult);
assertEquals(inputGcpNetwork.getNetworkId(), gcpNetworkResult.getNetworkId());
assertEquals(inputGcpNetwork.getNoPublicIp(), gcpNetworkResult.getNoPublicIp());
assertEquals(inputGcpNetwork.getSharedProjectId(), gcpNetworkResult.getSharedProjectId());
assertEquals(inputGcpNetwork.getNoFirewallRules(), gcpNetworkResult.getNoFirewallRules());
}
use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method createEnvironmentNetworkGcpParams.
private EnvironmentNetworkGcpParams createEnvironmentNetworkGcpParams() {
EnvironmentNetworkGcpParams gcpParams = new EnvironmentNetworkGcpParams();
gcpParams.setSharedProjectId("someSharedProjectId");
gcpParams.setNoPublicIp(true);
gcpParams.setNoFirewallRules(true);
gcpParams.setNetworkId("someNetworkId");
return gcpParams;
}
Aggregations