use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaDescribeService method describe.
public DescribeFreeIpaResponse describe(String environmentCrn, String accountId) {
Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithLists(environmentCrn, accountId);
DescribeFreeIpaResponse response = getResponseForStack(stack, false);
LOGGER.trace("FreeIPA describe response: {}", response);
return response;
}
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(underTest.describe(ENV_CRN)).thenReturn(freeipa);
ServiceUnavailableException exception = Assertions.assertThrows(ServiceUnavailableException.class, () -> underTest.checkFreeipaRunning(ENV_CRN));
assertEquals("Freeipa availability cannot be determined currently.", exception.getMessage());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeipaServiceTest method testCheckFreeipaRunningWhenFreeIpaAvailableThenPass.
@Test
void testCheckFreeipaRunningWhenFreeIpaAvailableThenPass() {
DescribeFreeIpaResponse freeipa = new DescribeFreeIpaResponse();
freeipa.setStatus(Status.AVAILABLE);
freeipa.setAvailabilityStatus(AvailabilityStatus.AVAILABLE);
when(underTest.describe(ENV_CRN)).thenReturn(freeipa);
Assertions.assertDoesNotThrow(() -> underTest.checkFreeipaRunning(ENV_CRN));
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeipaServiceTest method testCheckFreeipaRunningWhenFreeIpaStoppedThenThrowsException.
@Test
void testCheckFreeipaRunningWhenFreeIpaStoppedThenThrowsException() {
DescribeFreeIpaResponse freeipa = new DescribeFreeIpaResponse();
freeipa.setStatus(Status.STOPPED);
freeipa.setAvailabilityStatus(AvailabilityStatus.UNAVAILABLE);
when(underTest.describe(ENV_CRN)).thenReturn(freeipa);
BadRequestException exception = Assertions.assertThrows(BadRequestException.class, () -> underTest.checkFreeipaRunning(ENV_CRN));
assertEquals("Freeipa should be in Available state but currently is " + Status.STOPPED, exception.getMessage());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeipaService method checkFreeipaRunning.
public void checkFreeipaRunning(String envCrn) {
DescribeFreeIpaResponse freeipa = describe(envCrn);
if (freeipa != null && freeipa.getAvailabilityStatus() != null) {
if (!freeipa.getAvailabilityStatus().isAvailable()) {
String message = "Freeipa should be in Available state but currently is " + freeipa.getStatus().name();
LOGGER.info(message);
throw new BadRequestException(message);
}
} else {
String message = "Freeipa availability cannot be determined currently.";
LOGGER.warn(message);
throw new ServiceUnavailableException(message);
}
}
Aggregations