public LogEntries get(String logType) { return new LogEntries(Collections.emptyList()); }
public LogEntries getLogs(String logType) { if (logType == null || !logTypeToEntriesMap.containsKey(logType)) { return new LogEntries(Collections.emptyList()); } return logTypeToEntriesMap.get(logType); }
public static LogEntries combine(LogEntries... entries) { return new LogEntries( Stream.of(entries) .map(LogEntries::getAll) .flatMap(Collection::stream) .sorted(LOG_ENTRY_TIMESTAMP_COMPARATOR) .collect(Collectors.toList())); } }
public LogEntries get(String logType) { if (LogType.CLIENT.equals(logType) && logTypesToInclude.contains(logType)) { Collection<LogEntry> entries = loggingHandler.getRecords(); loggingHandler.flush(); return new LogEntries(entries); } return new LogEntries(Collections.emptyList()); }
LogEntries toLogEntries() { List<LogEntry> list = new ArrayList<LogEntry>(); for (Entry entry : entries) { list.add(entry.toLogEntry()); } return new LogEntries(list); } }
public LogEntries get(String logType) { Iterable<LogEntry> toReturn = getLocalLogs(logType); localLogs.remove(logType); return new LogEntries(toReturn); }
public LogEntries get(String logType) { return new LogEntries(getLocalLogs(logType)); }
public LogEntries get(String logType) { if (LogType.CLIENT.equals(logType)) { LoggingHandler loggingHandler = LoggingHandler.getInstance(); List<LogEntry> entries = loggingHandler.getRecords(); loggingHandler.flush(); return new LogEntries(entries); } return new LogEntries(Lists.<LogEntry>newArrayList()); }
public static SessionLogs fromJSON(Map<String, Object> rawSessionLogs) { SessionLogs sessionLogs = new SessionLogs(); for (Map.Entry<String, Object> entry : rawSessionLogs.entrySet()) { String logType = entry.getKey(); Collection<?> rawLogEntries = (Collection<?>) entry.getValue(); List<LogEntry> logEntries = new ArrayList<>(); for (Object o : rawLogEntries) { @SuppressWarnings("unchecked") Map<String, Object> rawEntry = (Map<String, Object>) o; logEntries.add(new LogEntry( LogLevelMapping.toLevel(String.valueOf(rawEntry.get("level"))), ((Number) rawEntry.get("timestamp")).longValue(), String.valueOf(rawEntry.get("message")))); } sessionLogs.addLog(logType, new LogEntries(logEntries)); } return sessionLogs; }
@Override public LogEntries createFromParcel(Parcel source) { return new LogEntries(source);
@Test(expected = WebDriverException.class) public void shouldCheckForErrors() { //given when(webDriver.manage().logs().get(LogType.BROWSER)).thenReturn(new LogEntries(of(new LogEntry(Level.SEVERE, Instant.now().toEpochMilli(), "Fehler!")))); //when new LogErrorChecker().checkForErrors(webDriver, JobConfig.exampleConfig()); //then expect exception fail(); }
@Test public void shouldNotCheckForErrorsIfDisabled() { //given when(webDriver.manage().logs().get(LogType.BROWSER)).thenReturn(new LogEntries(of(new LogEntry(Level.SEVERE, Instant.now().toEpochMilli(), "Fehler!")))); JobConfig jobConfig = JobConfig.exampleConfigBuilder().withCheckForErrorsInLog(false).build(); //when new LogErrorChecker().checkForErrors(webDriver, jobConfig); //then expect no exception } }