ParseLog { public static LogEntryObject pullOutLogValues(final String line, final String type) { LogEntryObject logEntry = getDebugOutLogValue(line, type); if (logEntry == null) { logEntry = getRestApiOutLogValue(line, type); } if (logEntry == null) { logEntry = getInfoOutLogValue(line, type); } if (logEntry == null) { logEntry = getSevereOutLogValue(line, type); } if (logEntry == null) { logEntry = getWarnOutLogValue(line, type); } return logEntry; }  static void main(final String[] args); static int countLines(final String filename); static String pullLastLineRead(final File file, final String dataFileName); static LogEntryObject pullOutLogValues(final String line, final String type); static void process(final String line, final String type, final LogType logFile); static Date parseDate(final String dateline, final String pattern, final boolean singleSplit); static String parseRemoteSystem(final String line); static String[] getPaths(final String logPath); static Properties getPropertiesValue(final String fileName); static Connection getDbConnection();  }
@Test public void testPullOutLogValues() { logger.debug("testPullOutLogValues: enter"); FileInputStream fstream; try { fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); final String strLine = br.readLine(); final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "ERROR"); assertEquals("ERROR_VALUE", retrunObject.getDescription()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValues: exit"); }
@Test public void testPullOutLogValuesSecond() { logger.debug("testPullOutLogValuesSecond: enter"); FileInputStream fstream; try { fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); strLine = br.readLine(); final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "INFO"); assertEquals(LogType.INFO, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesSecond: exit"); }
@Test public void testPullOutLogValuesThird() { logger.debug("testPullOutLogValuesThird: enter"); FileInputStream fstream; try { final int number = 3; fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); for (int i = 0; i < number; i++) { strLine = br.readLine(); } final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PAP"); assertEquals(LogType.INFO, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesThird: exit"); }
@Test public void testPullOutLogValuesFourth() { logger.debug("testPullOutLogValuesFourth: enter"); FileInputStream fstream; try { final int number = 4; fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); for (int i = 0; i < number; i++) { strLine = br.readLine(); } final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PAP"); assertEquals(LogType.INFO, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesFourth: exit"); }
@Test public void testPullOutLogValuesFith() { logger.debug("testPullOutLogValuesFith: enter"); FileInputStream fstream; try { final int number = 5; fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); for (int i = 0; i < number; i++) { strLine = br.readLine(); } final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PyPDP"); assertEquals(LogType.WARN, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesFith: exit"); }
@Test public void testPullOutLogValuesSixth() { logger.debug("testPullOutLogValuesSixth: enter"); FileInputStream fstream; try { final int number = 6; fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); for (int i = 0; i < number; i++) { strLine = br.readLine(); } final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PyPDP"); assertEquals(LogType.SEVERE, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesSixth: exit"); }
@Test public void testPullOutLogValuesSeven() { logger.debug("testPullOutLogValuesSeven: enter"); FileInputStream fstream; try { final int number = 7; fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); for (int i = 0; i < number; i++) { strLine = br.readLine(); } final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "Console"); assertEquals(LogType.ERROR, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesSeven: exit"); }
@Test public void testPullOutLogValuesEight() { logger.debug("testPullOutLogValuesEight: enter"); FileInputStream fstream; try { final int number = 8; fstream = new FileInputStream(testFile1); final BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); String strLine = br.readLine(); for (int i = 0; i < number; i++) { strLine = br.readLine(); } final LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "pap"); assertEquals(LogType.WARN, retrunObject.getLogType()); br.close(); } catch (final IOException e) { fail(); } logger.debug("testPullOutLogValuesEight: exit"); }
@Test public void testPullOutLogValuesNull() { logger.debug("testPullOutLogValuesNull: enter"); final LogEntryObject retrunObject = ParseLog.pullOutLogValues("", "Console"); assertEquals(null, retrunObject); logger.debug("testPullOutLogValuesNull: exit"); }