Search in sources :

Example 6 with InstanceGroupResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse in project cloudbreak by hortonworks.

the class FreeIpaConfigProviderTest method testNonCreatedChoosen.

@Test
public void testNonCreatedChoosen() {
    DescribeFreeIpaResponse freeIpaResponse = new DescribeFreeIpaResponse();
    InstanceGroupResponse instanceGroupResponse = new InstanceGroupResponse();
    instanceGroupResponse.setMetaData(Set.of(createInstanceMetadata("b", TERMINATED), createInstanceMetadata("a", REQUESTED)));
    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("a", 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) Test(org.junit.jupiter.api.Test)

Example 7 with InstanceGroupResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse in project cloudbreak by hortonworks.

the class FreeIpaConfigProviderTest method testCreatedChoosen.

@Test
public void testCreatedChoosen() {
    DescribeFreeIpaResponse freeIpaResponse = new DescribeFreeIpaResponse();
    InstanceGroupResponse instanceGroupResponse = new InstanceGroupResponse();
    instanceGroupResponse.setMetaData(Set.of(createInstanceMetadata("b", TERMINATED), createInstanceMetadata("a", REQUESTED), createInstanceMetadata("f", CREATED), 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("c", 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) Test(org.junit.jupiter.api.Test)

Example 8 with InstanceGroupResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse 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 InstanceGroupResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse 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

InstanceGroupResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse)9 DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)7 Test (org.junit.jupiter.api.Test)5 InstanceMetaDataResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse)3 RepairInstancesRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.repair.RepairInstancesRequest)1 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)1