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());
}
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"));
}
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"));
}
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"));
}
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());
}
Aggregations