use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class DiiagnosticsCollectionValidatorTest method createStackWithTelemetry.
private Stack createStackWithTelemetry(Telemetry telemetry) {
Stack stack = new Stack();
StackStatus status = new StackStatus();
status.setStatus(Status.AVAILABLE);
stack.setStackStatus(status);
stack.setTelemetry(telemetry);
stack.setAppVersion("2.35.0-b48");
stack.setResourceCrn("stackCrn");
stack.setName("stackCrn");
return stack;
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class FreeIpaClientFactoryTest method getFreeIpaClientForStackShouldThrowExceptionWhenStackStatusIsUnreachable.
@Test
void getFreeIpaClientForStackShouldThrowExceptionWhenStackStatusIsUnreachable() {
Stack stack = createStack();
when(stackService.getByIdWithListsInTransaction(stack.getId())).thenReturn(stack);
Status unreachableState = Status.FREEIPA_UNREACHABLE_STATUSES.stream().findAny().get();
StackStatus stackStatus = new StackStatus(stack, unreachableState, "The FreeIPA instance is unreachable.", DetailedStackStatus.UNREACHABLE);
stack.setStackStatus(stackStatus);
Assertions.assertThrows(InvalidFreeIpaStateException.class, () -> underTest.getFreeIpaClientForStack(stack));
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class FreeIpaClientFactoryTest method getFreeIpaClientForStackForLegacyHealthCheckShouldReturnClientWhenStackStatusIsValid.
@Test
void getFreeIpaClientForStackForLegacyHealthCheckShouldReturnClientWhenStackStatusIsValid() {
Stack stack = createStack();
stack.setGatewayport(80);
FreeIpa freeIpa = new FreeIpa();
freeIpa.setAdminPassword(new Secret("", ""));
when(freeIpaService.findByStack(stack)).thenReturn(freeIpa);
when(stackService.getByIdWithListsInTransaction(stack.getId())).thenReturn(stack);
when(tlsSecurityService.buildTLSClientConfig(any(), any(), any())).thenReturn(new HttpClientConfig(FREEIPP_FQDN));
Status unreachableState = Status.AVAILABLE;
StackStatus stackStatus = new StackStatus(stack, unreachableState, "The FreeIPA instance is reachable.", DetailedStackStatus.AVAILABLE);
stack.setStackStatus(stackStatus);
FreeIpaClientException exception = Assertions.assertThrows(FreeIpaClientException.class, () -> underTest.getFreeIpaClientForStackForLegacyHealthCheck(stack, FREEIPP_FQDN));
verify(clusterProxyService, times(1)).isCreateConfigForClusterProxy(stack);
verify(tlsSecurityService, times(1)).buildTLSClientConfig(any(), any(), any());
Assertions.assertEquals(FreeIpaClientException.class, exception.getCause().getClass());
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class StackToAvailabiltyStatusConverterTest method testConvertUnavailable.
@Test
void testConvertUnavailable() {
Stack stack = new Stack();
StackStatus status = new StackStatus();
status.setDetailedStackStatus(DetailedStackStatus.UNREACHABLE);
stack.setStackStatus(status);
assertEquals(AvailabilityStatus.UNAVAILABLE, underTest.convert(stack));
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class StackToAvailabiltyStatusConverterTest method testConvertAvailable.
@Test
void testConvertAvailable() {
Stack stack = new Stack();
StackStatus status = new StackStatus();
status.setDetailedStackStatus(DetailedStackStatus.AVAILABLE);
stack.setStackStatus(status);
assertEquals(AvailabilityStatus.AVAILABLE, underTest.convert(stack));
}
Aggregations