use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class FreeIpaDeletionServiceTest method setUp.
@BeforeEach
void setUp() {
stack = new Stack();
stack.setId(STACK_ID);
stack.setName(STACK_NAME);
StackStatus stackStatus = new StackStatus();
stackStatus.setStatus(Status.AVAILABLE);
stack.setStackStatus(stackStatus);
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class FreeIpaDescribeServiceTest method setUp.
@BeforeEach
void setUp() {
stack = new Stack();
stack.setId(STACK_ID);
stack.setName(STACK_NAME);
StackStatus stackStatus = new StackStatus();
stackStatus.setStatus(Status.AVAILABLE);
stack.setStackStatus(stackStatus);
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class UpgradeValidationServiceTest method testStackNotAvailable.
@Test
public void testStackNotAvailable() {
Stack stack = mock(Stack.class);
when(stack.isAvailable()).thenReturn(Boolean.FALSE);
StackStatus stackStatus = new StackStatus();
stackStatus.setStatus(Status.DELETED_ON_PROVIDER_SIDE);
when(stack.getStackStatus()).thenReturn(stackStatus);
Set<InstanceMetaData> allInstances = Set.of(createAvailableInstance("im1"), createAvailableInstance("im2"));
assertThrows(BadRequestException.class, () -> underTest.validateStackForUpgrade(allInstances, stack));
}
use of com.sequenceiq.freeipa.entity.StackStatus in project cloudbreak by hortonworks.
the class FreeIpaClientFactoryTest method getFreeIpaClientForStackShouldReturnClientWhenStackStatusIsValid.
@Test
void getFreeIpaClientForStackShouldReturnClientWhenStackStatusIsValid() throws FreeIpaClientException {
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);
when(clusterProxyService.isCreateConfigForClusterProxy(stack)).thenReturn(false);
FreeIpaClientException exception = Assertions.assertThrows(FreeIpaClientException.class, () -> underTest.getFreeIpaClientForStack(stack));
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 FreeIpaClientFactoryTest method getFreeIpaClientForStackForLegacyHealthCheckShouldReturnClientWhenStackStatusIsUnreachable.
@Test
void getFreeIpaClientForStackForLegacyHealthCheckShouldReturnClientWhenStackStatusIsUnreachable() {
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.FREEIPA_UNREACHABLE_STATUSES.stream().findAny().get();
StackStatus stackStatus = new StackStatus(stack, unreachableState, "The FreeIPA instance is unreachable.", DetailedStackStatus.UNREACHABLE);
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());
}
Aggregations