@Test public void testReadData()throws IOException { Mockito.when(fileReader.fileExist(Mockito.anyString())).thenReturn(true); Mockito.when(fileReader.readAllLine(Mockito.anyString())).thenReturn(new String[] { "DLT , 12288 , 1488927413524", "ULT , 12288 , 1488927433783", "DLT , 102400 , 1488927450230", }); List<SpeedThrottleEvent> throttleInfos = speedThrottleReader.readData(traceFolder); assertNotNull(throttleInfos); assertEquals(3, throttleInfos.size()); assertEquals(SpeedThrottleFlow.DLT, throttleInfos.get(0).getThrottleFlow()); assertEquals(12288, throttleInfos.get(0).getThrottleSpeed()); assertEquals(1488927413524L, throttleInfos.get(0).getTimeStamp()); }
@Override public List<SpeedThrottleEvent> readData(String directory) { List<SpeedThrottleEvent> throttleInfo = new ArrayList<SpeedThrottleEvent>(); String filepath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.SPEED_THROTTLE_EVENT; if (!filereader.fileExist(filepath)) { return throttleInfo; } String[] lines = null; try { lines = filereader.readAllLine(filepath); } catch (IOException e1) { LOGGER.error("Failed to open file for Speed Throttle Event: " + filepath, e1); } if(lines != null && lines.length > 0){ for (String strLineBuf : lines) { throttleInfo.add(processThrottleData(strLineBuf)); } } return throttleInfo; }
SpeedThrottleEventReaderImpl extends PeripheralBase implements ISpeedThrottleEventReader { @Override public List<SpeedThrottleEvent> readData(String directory) { List<SpeedThrottleEvent> throttleInfo = new ArrayList<SpeedThrottleEvent>(); String filepath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.SPEED_THROTTLE_EVENT; if (!filereader.fileExist(filepath)) { return throttleInfo; } String[] lines = null; try { lines = filereader.readAllLine(filepath); } catch (IOException e1) { LOGGER.error("Failed to open file for Speed Throttle Event: " + filepath, e1); } if(lines != null && lines.length > 0){ for (String strLineBuf : lines) { throttleInfo.add(processThrottleData(strLineBuf)); } } return throttleInfo; } }
SpeedThrottleEventReaderImpl extends PeripheralBase implements ISpeedThrottleEventReader { @Override public List<SpeedThrottleEvent> readData(String directory) { List<SpeedThrottleEvent> throttleInfo = new ArrayList<SpeedThrottleEvent>(); String filepath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.SPEED_THROTTLE_EVENT; if (!filereader.fileExist(filepath)) { return throttleInfo; } String[] lines = null; try { lines = filereader.readAllLine(filepath); } catch (IOException e1) { LOGGER.error("Failed to open file for Speed Throttle Event: " + filepath, e1); } if(lines != null && lines.length > 0){ for (String strLineBuf : lines) { throttleInfo.add(processThrottleData(strLineBuf)); } } return throttleInfo; }  }
SpeedThrottleEventReaderImpl extends PeripheralBase implements ISpeedThrottleEventReader { @Override public List<SpeedThrottleEvent> readData(String directory) { List<SpeedThrottleEvent> throttleInfo = new ArrayList<SpeedThrottleEvent>(); String filepath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.SPEED_THROTTLE_EVENT; if (!filereader.fileExist(filepath)) { return throttleInfo; } String[] lines = null; try { lines = filereader.readAllLine(filepath); } catch (IOException e1) { LOGGER.error("Failed to open file for Speed Throttle Event: " + filepath, e1); } if(lines != null && lines.length > 0){ for (String strLineBuf : lines) { throttleInfo.add(processThrottleData(strLineBuf)); } } return throttleInfo; }  @Override List<SpeedThrottleEvent> readData(String directory); }
SpeedThrottleEventReaderImpl extends PeripheralBase implements ISpeedThrottleEventReader { @Override public List<SpeedThrottleEvent> readData(String directory) { List<SpeedThrottleEvent> throttleInfo = new ArrayList<SpeedThrottleEvent>(); String filepath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.SPEED_THROTTLE_EVENT; if (!filereader.fileExist(filepath)) { return throttleInfo; } String[] lines = null; try { lines = filereader.readAllLine(filepath); } catch (IOException e1) { LOGGER.error("Failed to open file for Speed Throttle Event: " + filepath, e1); } if(lines != null && lines.length > 0){ for (String strLineBuf : lines) { throttleInfo.add(processThrottleData(strLineBuf)); } } return throttleInfo; }  @Override List<SpeedThrottleEvent> readData(String directory);  }