Search in sources :

Example 51 with DescribeFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.

the class FreeIpaConfigProviderTest method testNoChoosenIfInsanceGroupEmpty.

@Test
public void testNoChoosenIfInsanceGroupEmpty() {
    DescribeFreeIpaResponse freeIpaResponse = new DescribeFreeIpaResponse();
    freeIpaResponse.setInstanceGroups(List.of());
    when(freeipaClient.findByEnvironmentCrn(ENVIRONMENT_CRN)).thenReturn(Optional.of(freeIpaResponse));
    Map<String, Object> result = underTest.createFreeIpaConfig(ENVIRONMENT_CRN);
    assertTrue(result.isEmpty());
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) Test(org.junit.jupiter.api.Test)

Example 52 with DescribeFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse 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 53 with DescribeFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse 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 54 with DescribeFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse 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 55 with DescribeFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.

the class FreeipaServiceTest method testCheckFreeipaRunningWhenFreeIpaStatusIsNullThenThrowsException.

@Test
void testCheckFreeipaRunningWhenFreeIpaStatusIsNullThenThrowsException() {
    DescribeFreeIpaResponse freeipa = new DescribeFreeIpaResponse();
    when(freeipaClientService.getByEnvironmentCrn(ENV_CRN)).thenReturn(freeipa);
    CloudbreakServiceException exception = Assertions.assertThrows(CloudbreakServiceException.class, () -> underTest.checkFreeipaRunning(ENV_CRN));
    assertEquals("Freeipa availability cannot be determined currently.", exception.getMessage());
}
Also used : DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)60 Test (org.junit.jupiter.api.Test)32 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)17 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)8 EnumSource (org.junit.jupiter.params.provider.EnumSource)8 DistroXV1Request (com.sequenceiq.distrox.api.v1.distrox.model.DistroXV1Request)7 InstanceGroupResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupResponse)7 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)6 AttemptResults (com.dyngr.core.AttemptResults)5 Stack (com.sequenceiq.freeipa.entity.Stack)5 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)4 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)3 EnvironmentDeletionDto (com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto)3 FreeIpaOperationFailedException (com.sequenceiq.environment.exception.FreeIpaOperationFailedException)3 BaseNamedFlowEvent (com.sequenceiq.flow.reactor.api.event.BaseNamedFlowEvent)3 InstanceMetaDataResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetaDataResponse)3 CreateFreeIpaRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.CreateFreeIpaRequest)3 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)3 ImageEntity (com.sequenceiq.freeipa.entity.ImageEntity)3 Environment (com.sequenceiq.environment.environment.domain.Environment)2