stackTraces.put(jobId, new ArrayList<List<String>>()); stackTraces.get(jobId).addAll(tlp.getStackTraces());
stackTraces.put(jobId, new ArrayList<List<String>>()); stackTraces.get(jobId).addAll(tlp.getStackTraces());
@Test public void testGetStackTraces() throws Exception { JobConf jobConf = new JobConf(); HiveConf.setQueryString(jobConf, "select * from foo group by moo;"); final TaskLogProcessor taskLogProcessor = new TaskLogProcessor(jobConf); Throwable oome = new OutOfMemoryError("java heap space"); String oomeStr = writeThrowableAsFile("Some line in the beginning\n", oome, null, "1", taskLogProcessor); Throwable compositeException = new InvocationTargetException(new IOException(new NullPointerException())); String compositeStr = writeThrowableAsFile(null, compositeException, "Some line in the end.\n", "2", taskLogProcessor); Throwable eofe = new EOFException(); String eofeStr = writeThrowableAsFile("line a\nlineb\n", eofe, " line c\nlineD\n", "3", taskLogProcessor); List<List<String>> stackTraces = taskLogProcessor.getStackTraces(); assertEquals(3, stackTraces.size()); // Assert the actual stack traces are exactly equal to the written ones, // and are contained in "stackTraces" list in the submission order: checkException(oomeStr, stackTraces.get(0)); checkException(compositeStr, stackTraces.get(1)); checkException(eofeStr, stackTraces.get(2)); }
stackTraces.put(jobId, new ArrayList<List<String>>()); stackTraces.get(jobId).addAll(tlp.getStackTraces());