@Test public void testNmapUtil_1() { NmapUtil fixture = new NmapUtil(null); Map<String, Boolean> result = null; try { result = fixture.getNodeListWithStatus(); } catch (Exception e) { e.printStackTrace(); } assertNotNull(fixture); assertNotNull(result); assertEquals(0, result.size()); }
public Map<String, Boolean> getNodeListWithStatus() { Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; }
NmapUtil { public Map<String, Boolean> getNodeListWithStatus() { Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; } }
NmapUtil { public Map<String, Boolean> getNodeListWithStatus() { Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; } NmapUtil(String nodePattern); }
NmapUtil { public Map<String, Boolean> getNodeListWithStatus() { Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; } NmapUtil(String nodePattern); Map<String, Boolean> getNodeListWithStatus(); Map<String, String> getHostIPMap(List<String> hostNameList); }
NmapUtil { public Map<String, Boolean> getNodeListWithStatus() { Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; } NmapUtil(String nodePattern); Map<String, Boolean> getNodeListWithStatus(); Map<String, String> getHostIPMap(List<String> hostNameList);  }