Search in sources :

Example 6 with InstanceMetaDataResponse

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));
}
Also used : InstanceMetaDataResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with 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;
}
Also used : InstanceMetaDataResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse)

Example 8 with InstanceMetaDataResponse

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"));
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) InstanceGroupResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse) InstanceMetaDataResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse) Test(org.junit.jupiter.api.Test)

Example 9 with InstanceMetaDataResponse

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);
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) InstanceMetaDataResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with InstanceMetaDataResponse

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;
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) InstanceMetaDataResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse) InstanceGroupResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse)

Aggregations

InstanceMetaDataResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse)8 InstanceGroupResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse)5 DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)4 Test (org.junit.jupiter.api.Test)2 RepairInstancesRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.repair.RepairInstancesRequest)1 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)1 ArrayList (java.util.ArrayList)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1