@Test public void testRedeployGatewayCertificateWhenRedeployOnHostRunnerThrowRuntimeException() { when(stackService.getByIdWithListsInTransaction(anyLong())).thenReturn(stack); when(clusterService.retrieveClusterByStackIdWithoutAuth(anyLong())).thenReturn(Optional.of(cluster)); doThrow(new RuntimeException("Stg. failed")).when(hostRunner).redeployGatewayCertificate(any(), any()); Assertions.assertThrows(RuntimeException.class, () -> underTest.redeployGatewayCertificate(0L)); }
public void redeployGatewayCertificate(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = clusterService.retrieveClusterByStackIdWithoutAuth(stack.getId()) .orElseThrow(NotFoundException.notFound("cluster", stack.getId())); hostRunner.redeployGatewayCertificate(stack, cluster); }
ClusterServiceRunner { public void redeployGatewayCertificate(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = clusterService.retrieveClusterByStackIdWithoutAuth(stack.getId()) .orElseThrow(NotFoundException.notFound("cluster", stack.getId())); hostRunner.redeployGatewayCertificate(stack, cluster); } }
ClusterServiceRunner { public void redeployGatewayCertificate(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = clusterService.retrieveClusterByStackIdWithoutAuth(stack.getId()) .orElseThrow(NotFoundException.notFound("cluster", stack.getId())); hostRunner.redeployGatewayCertificate(stack, cluster); }  }
ClusterServiceRunner { public void redeployGatewayCertificate(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = clusterService.retrieveClusterByStackIdWithoutAuth(stack.getId()) .orElseThrow(NotFoundException.notFound("cluster", stack.getId())); hostRunner.redeployGatewayCertificate(stack, cluster); }  void runAmbariServices(Long stackId); void updateAmbariClientConfig(Stack stack, Cluster cluster); void updateSaltState(Long stackId); void redeployGatewayCertificate(Long stackId); String changePrimaryGateway(Long stackId); }
ClusterServiceRunner { public void redeployGatewayCertificate(Long stackId) { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = clusterService.retrieveClusterByStackIdWithoutAuth(stack.getId()) .orElseThrow(NotFoundException.notFound("cluster", stack.getId())); hostRunner.redeployGatewayCertificate(stack, cluster); }  void runAmbariServices(Long stackId); void updateAmbariClientConfig(Stack stack, Cluster cluster); void updateSaltState(Long stackId); void redeployGatewayCertificate(Long stackId); String changePrimaryGateway(Long stackId);  }