@Test public void testLsBlkParse() { List<LsBlkEntry> lsBlkEntries = LsBlkUtils.parseLsblkOutput(TEST_DATA); Assert.assertEquals(14, lsBlkEntries.size()); Assert.assertEquals("sr0", lsBlkEntries.get(0).getName()); Assert.assertEquals("drbd1001", lsBlkEntries.get(lsBlkEntries.size() - 1).getName()); }
static List<LsBlkEntry> parseLsblkOutput(String lsblkOutput) { ArrayList<LsBlkEntry> lsBlkEntries = new ArrayList<>(); for (String line : lsblkOutput.split("\n")) { List<String> fields = splitFields(line.trim()); if (fields.size() > 0) { lsBlkEntries.add(new LsBlkEntry(fields)); } } return lsBlkEntries; }
LsBlkUtils { static List<LsBlkEntry> parseLsblkOutput(String lsblkOutput) { ArrayList<LsBlkEntry> lsBlkEntries = new ArrayList<>(); for (String line : lsblkOutput.split("\n")) { List<String> fields = splitFields(line.trim()); if (fields.size() > 0) { lsBlkEntries.add(new LsBlkEntry(fields)); } } return lsBlkEntries; } }
LsBlkUtils { static List<LsBlkEntry> parseLsblkOutput(String lsblkOutput) { ArrayList<LsBlkEntry> lsBlkEntries = new ArrayList<>(); for (String line : lsblkOutput.split("\n")) { List<String> fields = splitFields(line.trim()); if (fields.size() > 0) { lsBlkEntries.add(new LsBlkEntry(fields)); } } return lsBlkEntries; } private  LsBlkUtils(); }
LsBlkUtils { static List<LsBlkEntry> parseLsblkOutput(String lsblkOutput) { ArrayList<LsBlkEntry> lsBlkEntries = new ArrayList<>(); for (String line : lsblkOutput.split("\n")) { List<String> fields = splitFields(line.trim()); if (fields.size() > 0) { lsBlkEntries.add(new LsBlkEntry(fields)); } } return lsBlkEntries; } private  LsBlkUtils(); static List<LsBlkEntry> lsblk(ExtCmd extCmd); static boolean parentIsVDO(ExtCmd extCmd, @Nonnull List<String> devicePaths); static String[] blkid(ExtCmd extCmd); static List<LsBlkEntry> filterDeviceCandidates(List<LsBlkEntry> entries, final String[] blkIdEntries); }
LsBlkUtils { static List<LsBlkEntry> parseLsblkOutput(String lsblkOutput) { ArrayList<LsBlkEntry> lsBlkEntries = new ArrayList<>(); for (String line : lsblkOutput.split("\n")) { List<String> fields = splitFields(line.trim()); if (fields.size() > 0) { lsBlkEntries.add(new LsBlkEntry(fields)); } } return lsBlkEntries; } private  LsBlkUtils(); static List<LsBlkEntry> lsblk(ExtCmd extCmd); static boolean parentIsVDO(ExtCmd extCmd, @Nonnull List<String> devicePaths); static String[] blkid(ExtCmd extCmd); static List<LsBlkEntry> filterDeviceCandidates(List<LsBlkEntry> entries, final String[] blkIdEntries);  }