use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse in project cloudbreak by hortonworks.
the class StackToDescribeFreeIpaResponseConverterTest method initInstanceGroupResponse.
@BeforeEach
void initInstanceGroupResponse() {
InstanceMetaDataResponse instanceMetaDataResponse = new InstanceMetaDataResponse();
instanceMetaDataResponse.setPrivateIp(SERVER_IP);
INSTANCE_GROUP_RESPONSE.setMetaData(Set.of(instanceMetaDataResponse));
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse in project cloudbreak by hortonworks.
the class FreeIpaConfigProviderTest method createInstanceMetadata.
private InstanceMetaDataResponse createInstanceMetadata(String fqdn, InstanceStatus status) {
InstanceMetaDataResponse response = new InstanceMetaDataResponse();
response.setDiscoveryFQDN(fqdn);
response.setInstanceStatus(status);
return response;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse in project cloudbreak by hortonworks.
the class FreeIpaConfigProviderTest method testPgwChosen.
@Test
public void testPgwChosen() {
DescribeFreeIpaResponse freeIpaResponse = new DescribeFreeIpaResponse();
InstanceGroupResponse instanceGroupResponse = new InstanceGroupResponse();
InstanceMetaDataResponse pgw = createInstanceMetadata("d", CREATED);
pgw.setInstanceType(InstanceMetadataType.GATEWAY_PRIMARY);
instanceGroupResponse.setMetaData(Set.of(createInstanceMetadata("b", TERMINATED), createInstanceMetadata("a", REQUESTED), createInstanceMetadata("f", CREATED), pgw, createInstanceMetadata("c", CREATED)));
freeIpaResponse.setInstanceGroups(List.of(instanceGroupResponse));
when(freeipaClient.findByEnvironmentCrn(ENVIRONMENT_CRN)).thenReturn(Optional.of(freeIpaResponse));
Map<String, Object> result = underTest.createFreeIpaConfig(ENVIRONMENT_CRN);
assertEquals(1, result.size());
assertEquals("d", result.get("host"));
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse in project cloudbreak by hortonworks.
the class InstanceMetaDataToInstanceMetaDataResponseConverterTest method convertTest.
@ParameterizedTest(name = "{0}")
@MethodSource("convertTestDataProvider")
void convertTest(String testCaseName, String publicIp, String privateIp, String publicIpExpected) {
InstanceMetaData instanceMetaData = createInstanceMetaData(publicIp, privateIp);
InstanceMetaDataResponse result = underTest.convert(instanceMetaData);
assertThat(result).isNotNull();
assertThat(result.getPrivateIp()).isEqualTo(privateIp);
assertThat(result.getPublicIp()).isEqualTo(publicIpExpected);
assertThat(result.getSshPort()).isEqualTo(SSH_PORT);
assertThat(result.getInstanceId()).isEqualTo(INSTANCE_ID);
assertThat(result.getDiscoveryFQDN()).isEqualTo(DISCOVERY_FQDN);
assertThat(result.getInstanceGroup()).isEqualTo(INSTANCE_GROUP);
assertThat(result.getSubnetId()).isEqualTo(SUBNET_ID);
assertThat(result.getAvailabilityZone()).isEqualTo(AVAILABILITY_ZONE);
assertThat(result.getInstanceStatus()).isEqualTo(INSTANCE_STATUS);
assertThat(result.getInstanceType()).isEqualTo(INSTANCE_METADATA_TYPE);
assertThat(result.getLifeCycle()).isEqualTo(LIFE_CYCLE);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse in project cloudbreak by hortonworks.
the class FreeIpaScalingTests method getInstanceMetaDataResponses.
private Set<InstanceMetaDataResponse> getInstanceMetaDataResponses(String environmentCrn, FreeIpaClient client) {
DescribeFreeIpaResponse describeFreeIpaResponse = client.getDefaultClient().getFreeIpaV1Endpoint().describe(environmentCrn);
Set<InstanceMetaDataResponse> instanceMetaDataResponses = describeFreeIpaResponse.getInstanceGroups().stream().map(InstanceGroupResponse::getMetaData).flatMap(Set::stream).collect(Collectors.toSet());
return instanceMetaDataResponses;
}
Aggregations