Search in sources :

Example 16 with StackStatus

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;
}
Also used : StackStatus(com.sequenceiq.freeipa.entity.StackStatus) Stack(com.sequenceiq.freeipa.entity.Stack)

Example 17 with StackStatus

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));
}
Also used : StackStatus(com.sequenceiq.freeipa.entity.StackStatus) InstanceStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus) Status(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status) DetailedStackStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus) StackStatus(com.sequenceiq.freeipa.entity.StackStatus) DetailedStackStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 18 with StackStatus

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());
}
Also used : Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) StackStatus(com.sequenceiq.freeipa.entity.StackStatus) InstanceStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus) Status(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status) DetailedStackStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus) HttpClientConfig(com.sequenceiq.cloudbreak.client.HttpClientConfig) FreeIpa(com.sequenceiq.freeipa.entity.FreeIpa) StackStatus(com.sequenceiq.freeipa.entity.StackStatus) DetailedStackStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 19 with StackStatus

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));
}
Also used : StackStatus(com.sequenceiq.freeipa.entity.StackStatus) DetailedStackStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 20 with StackStatus

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));
}
Also used : StackStatus(com.sequenceiq.freeipa.entity.StackStatus) DetailedStackStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Aggregations

StackStatus (com.sequenceiq.freeipa.entity.StackStatus)24 Stack (com.sequenceiq.freeipa.entity.Stack)17 DetailedStackStatus (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus)14 Test (org.junit.jupiter.api.Test)9 Status (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status)5 InstanceStatus (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus)5 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)4 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)4 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)3 Secret (com.sequenceiq.cloudbreak.service.secret.domain.Secret)3 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)3 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)3 StackDetails (com.sequenceiq.cloudbreak.structuredevent.event.StackDetails)2 CDPOperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails)2 HashSet (java.util.HashSet)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 CDPStructuredFlowEvent (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredFlowEvent)1