@Test public void submit() { String target1 = "10.0.0.1"; String target2 = "10.0.0.2"; targets = new HashSet<>(); targets.add(target1); targets.add(target2); allNode = new HashSet<>(); allNode.add(new Node("10.0.0.1", "5.5.5.1", "10-0-0-1.example.com", "hg")); allNode.add(new Node("10.0.0.2", "5.5.5.2", "10-0-0-2.example.com", "hg")); allNode.add(new Node("10.0.0.3", "5.5.5.3", "10-0-0-3.example.com", "hg")); HighStateRunner highStateRunner = new HighStateRunner(targets, allNode); SaltConnector saltConnector = Mockito.mock(SaltConnector.class); PowerMockito.mockStatic(SaltStates.class); String jobId = "1"; PowerMockito.when(SaltStates.highstate(any(), any())).thenReturn(jobId); String jid = highStateRunner.submit(saltConnector); assertEquals(jobId, jid); PowerMockito.verifyStatic(SaltStates.class); ArgumentCaptor<Target<String>> targetCaptor = ArgumentCaptor.forClass(Target.class); SaltStates.highstate(eq(saltConnector), targetCaptor.capture()); String order1 = target1 + "," + target2; String order2 = target2 + "," + target1; String actual = targetCaptor.getValue().getTarget(); assertTrue(order1.equals(actual) || order2.equals(actual)); }
@Override public String submit(SaltConnector saltConnector) { HostList targets = new HostList(getTargetHostnames()); return SaltStates.highstate(saltConnector, targets); }
HighStateRunner extends BaseSaltJobRunner { @Override public String submit(SaltConnector saltConnector) { HostList targets = new HostList(getTargetHostnames()); return SaltStates.highstate(saltConnector, targets); } }
HighStateRunner extends BaseSaltJobRunner { @Override public String submit(SaltConnector saltConnector) { HostList targets = new HostList(getTargetHostnames()); return SaltStates.highstate(saltConnector, targets); } HighStateRunner(Set<String> target, Set<Node> allNode); }
HighStateRunner extends BaseSaltJobRunner { @Override public String submit(SaltConnector saltConnector) { HostList targets = new HostList(getTargetHostnames()); return SaltStates.highstate(saltConnector, targets); } HighStateRunner(Set<String> target, Set<Node> allNode); @Override String submit(SaltConnector saltConnector); @Override StateType stateType(); @Override String toString(); }
HighStateRunner extends BaseSaltJobRunner { @Override public String submit(SaltConnector saltConnector) { HostList targets = new HostList(getTargetHostnames()); return SaltStates.highstate(saltConnector, targets); } HighStateRunner(Set<String> target, Set<Node> allNode); @Override String submit(SaltConnector saltConnector); @Override StateType stateType(); @Override String toString();  }