use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.MockNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4Converter method convertToMockNetworkParams.
private MockNetworkV4Parameters convertToMockNetworkParams(Pair<MockNetworkV1Parameters, EnvironmentNetworkResponse> source) {
EnvironmentNetworkResponse value = source.getValue();
MockNetworkV1Parameters key = source.getKey();
MockNetworkV4Parameters params = new MockNetworkV4Parameters();
if (key != null) {
String subnetId = key.getSubnetId();
if (value != null) {
evaluateIfTrueDoOtherwise(subnetId, StringUtils::isNotEmpty, params::setSubnetId, s -> params.setSubnetId(value.getPreferedSubnetId()));
}
params.setInternetGatewayId(key.getInternetGatewayId());
params.setVpcId(key.getVpcId());
}
return params;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.MockNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method testConvertToNetworkV4RequestWhenMockNetworkKeyIsNullThenBasicSettingShouldHappen.
@Test
void testConvertToNetworkV4RequestWhenMockNetworkKeyIsNullThenBasicSettingShouldHappen() {
DetailedEnvironmentResponse input = createMockEnvironment();
NetworkV4Request result = underTest.convertToNetworkV4Request(new ImmutablePair<>(null, input));
Assertions.assertNotNull(result);
MockNetworkV4Parameters mockNetworkResult = result.getMock();
Assertions.assertNotNull(mockNetworkResult);
Assertions.assertNull(mockNetworkResult.getVpcId());
Assertions.assertNull(mockNetworkResult.getInternetGatewayId());
assertTrue(StringUtils.isNotEmpty(mockNetworkResult.getSubnetId()));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.MockNetworkV4Parameters in project cloudbreak by hortonworks.
the class TestUtil method networkV4RequestForMock.
public static NetworkV4Request networkV4RequestForMock() {
NetworkV4Request r = new NetworkV4Request();
r.setMock(mockNetworkV4Parameters());
r.setCloudPlatform(CloudPlatform.MOCK);
r.setSubnetCIDR("0.0.0.0/0");
return r;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.MockNetworkV4Parameters in project cloudbreak by hortonworks.
the class TestUtil method mockNetworkV4Parameters.
public static MockNetworkV4Parameters mockNetworkV4Parameters() {
MockNetworkV4Parameters p = new MockNetworkV4Parameters();
p.setSubnetId("someMockSubnet");
p.setVpcId("someMockVpc");
p.setInternetGatewayId("someMockInternetGatewayId");
return p;
}
Aggregations