@Test
public void testHadoopCommandLine() throws Exception {
assertEquals(0, executeHadoopCmd("fs", "-ls", "/"));
assertEquals(0, executeHadoopCmd("fs", "-mkdir", "/input"));
assertEquals(0, executeHadoopCmd("fs", "-put", new File(testWorkDir, "test-data").getAbsolutePath(), "/input"));
assertTrue(igfs.exists(new IgfsPath("/input/test-data")));
assertEquals(0, executeHadoopCmd("jar", examplesJar.getAbsolutePath(), "wordcount", "/input", "/output"));
IgfsPath path = new IgfsPath("/user/" + System.getProperty("user.name") + "/");
assertTrue(igfs.exists(path));
IgfsPath jobStatPath = null;
for (IgfsPath jobPath : igfs.listPaths(path)) {
assertNull(jobStatPath);
jobStatPath = jobPath;
}
File locStatFile = new File(testWorkDir, "performance");
assertEquals(0, executeHadoopCmd("fs", "-get", jobStatPath.toString() + "/performance", locStatFile.toString()));
long evtCnt = HadoopTestUtils.simpleCheckJobStatFile(new BufferedReader(new FileReader(locStatFile)));
assertTrue(evtCnt >= 22);
assertTrue(igfs.exists(new IgfsPath("/output")));
BufferedReader in = new BufferedReader(new InputStreamReader(igfs.open(new IgfsPath("/output/part-r-00000"))));
List<String> res = new ArrayList<>();
String line;
while ((line = in.readLine()) != null)
res.add(line);
Collections.sort(res);
assertEquals("[blue\t150, green\t200, red\t100, yellow\t50]", res.toString());
}