SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeDiskInfos() { List<Map<Object, Object>> nodeInfoList = new ArrayList<Map<Object, Object>>(); Map<Object, Object> nodeDiskInfo; FileSystem[] fileSystemList = null; FileSystemUsage fileSystemUsage = null; try { fileSystemList = sigar.getFileSystemList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (FileSystem fileSystem : fileSystemList) { nodeDiskInfo = new HashMap<Object, Object>(); nodeDiskInfo.put("deviceName", fileSystem.getDevName()); nodeDiskInfo.put("dirName", fileSystem.getDirName()); nodeDiskInfo.put("fileSystemEnvironmentType", fileSystem.getTypeName()); nodeDiskInfo.put("fileSystemType", fileSystem.getSysTypeName()); nodeDiskInfo.put("partitionFlags", fileSystem.getFlags()); nodeDiskInfo.put("options", fileSystem.getOptions()); fileSystemUsage = new FileSystemUsage(); try { fileSystemUsage.gather(sigar, fileSystem.getDirName()); } catch (SigarException e) { LOGGER.error(e.getMessage(), e); } nodeDiskInfo.put("availableMemory", fileSystemUsage.getAvail()); nodeDiskInfo.put("freeMemory", fileSystemUsage.getFree()); nodeDiskInfo.put("totalMemory", fileSystemUsage.getTotal()); nodeDiskInfo.put("usedMemory", fileSystemUsage.getUsed()); nodeDiskInfo.put("readBytes", fileSystemUsage.getDiskReadBytes()); nodeDiskInfo.put("reads", fileSystemUsage.getDiskReads()); nodeDiskInfo.put("writeBytes", fileSystemUsage.getDiskWriteBytes()); nodeDiskInfo.put("writes", fileSystemUsage.getDiskWrites()); nodeInfoList.add(nodeDiskInfo); } return nodeInfoList; } SigarNodeInfoProvider(); Map<Object, Object> getNodeMemoryInfo(); List<Map<Object, Object>> getNodeCpuInfos(); Map<Object, Object> getNodeSwapInfo(); List<Map<Object, Object>> getNodeNetworkInfos(); Map<Object, Object> getNodeOSInfo(); Map<Object, Object> getNodeUpTimeInfo(); List<Map<Object, Object>> getNodeDiskInfos(); List<Map<Object, Object>> getSortedListByItem(final String item); Map<String, Object> getNodeInfo(int topProcessCount); static final char SLEEP; static final char RUN; static final char STOP; static final char ZOMBIE; static final char IDLE; static final int HUNDRED; static final int NUMBER_1024; }
@Test public void testGetNodeDiskInfoFunction() { assertEquals(ArrayList.class, provider.getNodeDiskInfos().getClass()); assert(provider.getNodeDiskInfos() != null); }