@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()); }
public FreeIpaClient getFreeIpaClientForStack(Stack stack) throws FreeIpaClientException { LOGGER.debug("Creating FreeIpaClient for stack {}", stack.getResourceCrn()); return getFreeIpaClient(stack, false, false, Optional.empty()); }
FreeIpaClientFactory { public FreeIpaClient getFreeIpaClientForStack(Stack stack) throws FreeIpaClientException { LOGGER.debug("Creating FreeIpaClient for stack {}", stack.getResourceCrn()); return getFreeIpaClient(stack, false, false, Optional.empty()); } }
FreeIpaClientFactory { public FreeIpaClient getFreeIpaClientForStack(Stack stack) throws FreeIpaClientException { LOGGER.debug("Creating FreeIpaClient for stack {}", stack.getResourceCrn()); return getFreeIpaClient(stack, false, false, Optional.empty()); }  }
FreeIpaClientFactory { public FreeIpaClient getFreeIpaClientForStack(Stack stack) throws FreeIpaClientException { LOGGER.debug("Creating FreeIpaClient for stack {}", stack.getResourceCrn()); return getFreeIpaClient(stack, false, false, Optional.empty()); }  FreeIpaClient getFreeIpaClientForStackId(Long stackId); FreeIpaClient getFreeIpaClientByAccountAndEnvironment(String environmentCrn, String accountId); FreeIpaClient getFreeIpaClientForStack(Stack stack); FreeIpaClient getFreeIpaClientForStack(Stack stack, String freeIpaFqdn); FreeIpaClient getFreeIpaClientForStackWithPing(Stack stack, String freeIpaFqdn); String getAdminUser(); }
FreeIpaClientFactory { public FreeIpaClient getFreeIpaClientForStack(Stack stack) throws FreeIpaClientException { LOGGER.debug("Creating FreeIpaClient for stack {}", stack.getResourceCrn()); return getFreeIpaClient(stack, false, false, Optional.empty()); }  FreeIpaClient getFreeIpaClientForStackId(Long stackId); FreeIpaClient getFreeIpaClientByAccountAndEnvironment(String environmentCrn, String accountId); FreeIpaClient getFreeIpaClientForStack(Stack stack); FreeIpaClient getFreeIpaClientForStack(Stack stack, String freeIpaFqdn); FreeIpaClient getFreeIpaClientForStackWithPing(Stack stack, String freeIpaFqdn); String getAdminUser();  }