gzout.close();
// Test for the log retrieval of the job that began 10 seconds before and ended 5 seconds before current time
// respectively
StringWriter sw = new StringWriter();
XLogStreamer str = new XLogStreamer(xf, sw, getTestCaseDir(), "oozie.log", 1);
str.streamLog(new Date(currTime - 10000), new Date(currTime - 5000));
String[] out = sw.toString().split("\n");
// Check if the retrieved log content is of length seven lines after filtering based on time window, file name
// pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
assertEquals(7, out.length);
// Check if the lines of the log contain the expected strings
assertEquals(true, out[0].contains("_L10_"));
assertEquals(true, out[1].contains("_L11_"));
assertEquals(true, out[2].contains("_L8_"));
assertEquals(true, out[3].contains("_L9_"));
assertEquals(true, out[4].contains("_L1_"));
assertEquals(true, out[5].contains("_L2_"));
assertEquals(true, out[6].contains("_L4_"));
// Test to check if the null values for startTime and endTime are translated to 0 and current time respectively
// and corresponding log content is retrieved properly
StringWriter sw1 = new StringWriter();
XLogStreamer str1 = new XLogStreamer(xf, sw1, getTestCaseDir(), "oozie.log", 1);
str1.streamLog(null, null);
out = sw1.toString().split("\n");
// Check if the retrieved log content is of length eight lines after filtering based on time window, file name
// pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
assertEquals(8, out.length);
// Check if the lines of the log contain the expected strings