@Test public void testFilterNodesWithHostAndHostGroupFilter() { Set<String> hostGroups = new HashSet<>(); hostGroups.add("master"); Set<String> hosts = new HashSet<>(); hosts.add("host1"); boolean result = underTest.filterNodes(createNode(), hosts, hostGroups); assertTrue(result); }
@VisibleForTesting boolean filterNodes(Node node, Set<String> hosts, Set<String> hostGroups) { boolean result = true; if (CollectionUtils.isNotEmpty(hosts)) { result = hosts.contains(node.getHostname()) || hosts.contains(node.getPrivateIp()) || hosts.contains(node.getPublicIp()); } if (result && CollectionUtils.isNotEmpty(hostGroups)) { result = hostGroups.contains(node.getHostGroup()); } return result; }
DiagnosticsFlowService { @VisibleForTesting boolean filterNodes(Node node, Set<String> hosts, Set<String> hostGroups) { boolean result = true; if (CollectionUtils.isNotEmpty(hosts)) { result = hosts.contains(node.getHostname()) || hosts.contains(node.getPrivateIp()) || hosts.contains(node.getPublicIp()); } if (result && CollectionUtils.isNotEmpty(hostGroups)) { result = hostGroups.contains(node.getHostGroup()); } return result; } }
DiagnosticsFlowService { @VisibleForTesting boolean filterNodes(Node node, Set<String> hosts, Set<String> hostGroups) { boolean result = true; if (CollectionUtils.isNotEmpty(hosts)) { result = hosts.contains(node.getHostname()) || hosts.contains(node.getPrivateIp()) || hosts.contains(node.getPublicIp()); } if (result && CollectionUtils.isNotEmpty(hostGroups)) { result = hostGroups.contains(node.getHostGroup()); } return result; }  }
DiagnosticsFlowService { @VisibleForTesting boolean filterNodes(Node node, Set<String> hosts, Set<String> hostGroups) { boolean result = true; if (CollectionUtils.isNotEmpty(hosts)) { result = hosts.contains(node.getHostname()) || hosts.contains(node.getPrivateIp()) || hosts.contains(node.getPublicIp()); } if (result && CollectionUtils.isNotEmpty(hostGroups)) { result = hostGroups.contains(node.getHostGroup()); } return result; }  void init(Long stackId, Map<String, Object> parameters); void init(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); void collect(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); void upload(Long stackId, Map<String, Object> parameters); void upload(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); void cleanup(Long stackId, Map<String, Object> parameters); void cleanup(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); }
DiagnosticsFlowService { @VisibleForTesting boolean filterNodes(Node node, Set<String> hosts, Set<String> hostGroups) { boolean result = true; if (CollectionUtils.isNotEmpty(hosts)) { result = hosts.contains(node.getHostname()) || hosts.contains(node.getPrivateIp()) || hosts.contains(node.getPublicIp()); } if (result && CollectionUtils.isNotEmpty(hostGroups)) { result = hostGroups.contains(node.getHostGroup()); } return result; }  void init(Long stackId, Map<String, Object> parameters); void init(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); void collect(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); void upload(Long stackId, Map<String, Object> parameters); void upload(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups); void cleanup(Long stackId, Map<String, Object> parameters); void cleanup(Long stackId, Map<String, Object> parameters, Set<String> hosts, Set<String> hostGroups);  }