@Test public void callTest() throws Exception { SaltConnector saltConnector = Mockito.mock(SaltConnector.class); SaltJobRunner saltJobRunner = Mockito.mock(SaltJobRunner.class); Set<String> targets = new HashSet<>(); when(saltJobRunner.getTargetHostnames()).thenReturn(targets); SaltCommandTracker saltCommandTracker = new SaltCommandTracker(saltConnector, saltJobRunner); saltCommandTracker.call(); }
@Override public Boolean call() throws Exception { saltJobRunner.submit(saltConnector); if (!saltJobRunner.getTargetHostnames().isEmpty()) { throw new CloudbreakOrchestratorFailedException("There are missing nodes from job result: " + saltJobRunner.getTargetHostnames()); } return true; }
SaltCommandTracker implements OrchestratorBootstrap { @Override public Boolean call() throws Exception { saltJobRunner.submit(saltConnector); if (!saltJobRunner.getTargetHostnames().isEmpty()) { throw new CloudbreakOrchestratorFailedException("There are missing nodes from job result: " + saltJobRunner.getTargetHostnames()); } return true; } }
SaltCommandTracker implements OrchestratorBootstrap { @Override public Boolean call() throws Exception { saltJobRunner.submit(saltConnector); if (!saltJobRunner.getTargetHostnames().isEmpty()) { throw new CloudbreakOrchestratorFailedException("There are missing nodes from job result: " + saltJobRunner.getTargetHostnames()); } return true; } SaltCommandTracker(SaltConnector saltConnector, SaltJobRunner saltJobRunner); }
SaltCommandTracker implements OrchestratorBootstrap { @Override public Boolean call() throws Exception { saltJobRunner.submit(saltConnector); if (!saltJobRunner.getTargetHostnames().isEmpty()) { throw new CloudbreakOrchestratorFailedException("There are missing nodes from job result: " + saltJobRunner.getTargetHostnames()); } return true; } SaltCommandTracker(SaltConnector saltConnector, SaltJobRunner saltJobRunner); @Override Boolean call(); @Override String toString(); }
SaltCommandTracker implements OrchestratorBootstrap { @Override public Boolean call() throws Exception { saltJobRunner.submit(saltConnector); if (!saltJobRunner.getTargetHostnames().isEmpty()) { throw new CloudbreakOrchestratorFailedException("There are missing nodes from job result: " + saltJobRunner.getTargetHostnames()); } return true; } SaltCommandTracker(SaltConnector saltConnector, SaltJobRunner saltJobRunner); @Override Boolean call(); @Override String toString();  }