DefaultProcReader implements ProcReader { @Override public List<String> listProcesses(File cgroupFile) throws IOException { File cgroupProcsFile = new File(cgroupFile, CGROUP_PROCS); if (!cgroupProcsFile.exists()) { throw new FileNotFoundException(cgroupProcsFile.getAbsolutePath() + "is not exist!"); } return Files.readLines(cgroupProcsFile, Charset.defaultCharset()); }  @Override List<File> listContainerCgroupFiles(); @Override List<String> listProcesses(File cgroupFile); @Override Map<String, ProcStatus> listTaskStatus(String pid); static final String CGROUP_PROCS; static final String STATUS; }
@Test public void testListProcesses() throws Exception { File parent = new File(cgroupBasePath); File cgroupFile1 = new File(parent, "must_contains_2_running_tasks_to_paas_unit_test22222222222222222"); File cgroupFile2 = new File(parent, "must_contains_5_running_tasks_to_paas_unit_test55555555555555555"); Assert.assertEquals(procReader.listProcesses(cgroupFile1).size(), 2); Assert.assertEquals(procReader.listProcesses(cgroupFile2).size(), 3); }