@Test public void testStorageProcess() { long time = System.currentTimeMillis(); loggerObject.insertLog("org.opendaylight.test", time, "test", "this is a test"); loggerObject.insertLog("org.opendaylight.test2", time, "test2", "this is a second test"); runnableCaptor.getValue().run(); ArgumentCaptor<InsertTSDRLogRecordInput> argumentCaptor = ArgumentCaptor.forClass(InsertTSDRLogRecordInput.class); verify(tsdrCollectorSpiService).insertTSDRLogRecord(argumentCaptor.capture()); List<TSDRLogRecord> logRecords = argumentCaptor.getValue().getTSDRLogRecord(); assertEquals("org.opendaylight.test", logRecords.get(0).getNodeID()); assertEquals("LEVEL=test,MESSAGE=this is a test", logRecords.get(0).getRecordFullText()); assertEquals(0, (long)logRecords.get(0).getIndex()); assertEquals(time, (long)logRecords.get(0).getTimeStamp()); assertEquals("org.opendaylight.test2", logRecords.get(1).getNodeID()); assertEquals("LEVEL=test2,MESSAGE=this is a second test", logRecords.get(1).getRecordFullText()); assertEquals(1, (long)logRecords.get(1).getIndex()); assertEquals(time, (long)logRecords.get(1).getTimeStamp()); assertEquals(2, logRecords.size()); reset(tsdrCollectorSpiService); when(tsdrCollectorSpiService.insertTSDRLogRecord(any())) .thenReturn(RpcResultBuilder.success(new InsertTSDRLogRecordOutputBuilder().build()).buildFuture()); when(tsdrCollectorSpiService.insertTSDRMetricRecord(any())) .thenReturn(RpcResultBuilder.success(new InsertTSDRMetricRecordOutputBuilder().build()).buildFuture()); time = System.currentTimeMillis(); loggerObject.insertLog("org.opendaylight.test3", time, "test3", "this is a third test"); runnableCaptor.getValue().run(); verify(tsdrCollectorSpiService).insertTSDRLogRecord(argumentCaptor.capture()); logRecords = argumentCaptor.getValue().getTSDRLogRecord(); assertEquals("org.opendaylight.test3", logRecords.get(0).getNodeID()); assertEquals("LEVEL=test3,MESSAGE=this is a third test", logRecords.get(0).getRecordFullText()); assertEquals(0, (long)logRecords.get(0).getIndex()); assertEquals(time, (long)logRecords.get(0).getTimeStamp()); assertEquals(1, logRecords.size()); reset(tsdrCollectorSpiService); runnableCaptor.getValue().run(); verify(tsdrCollectorSpiService, never()).insertTSDRLogRecord(Mockito.any()); }
public void insertLog(String loggerName, long timeStamp, String level, String message) { super.insertLog(loggerName, timeStamp, "LEVEL=" + level + ",MESSAGE=" + message, DataCategory.ODLLOG); }
TsdrLogCollectorLogger extends BatchingLogCollector { public void insertLog(String loggerName, long timeStamp, String level, String message) { super.insertLog(loggerName, timeStamp, "LEVEL=" + level + ",MESSAGE=" + message, DataCategory.ODLLOG); } }
TsdrLogCollectorLogger extends BatchingLogCollector { public void insertLog(String loggerName, long timeStamp, String level, String message) { super.insertLog(loggerName, timeStamp, "LEVEL=" + level + ",MESSAGE=" + message, DataCategory.ODLLOG); } @Inject  TsdrLogCollectorLogger(TsdrCollectorSpiService tsdrCollectorSpiService, SchedulerService schedulerService); }
TsdrLogCollectorLogger extends BatchingLogCollector { public void insertLog(String loggerName, long timeStamp, String level, String message) { super.insertLog(loggerName, timeStamp, "LEVEL=" + level + ",MESSAGE=" + message, DataCategory.ODLLOG); } @Inject  TsdrLogCollectorLogger(TsdrCollectorSpiService tsdrCollectorSpiService, SchedulerService schedulerService); void insertLog(String loggerName, long timeStamp, String level, String message); }
TsdrLogCollectorLogger extends BatchingLogCollector { public void insertLog(String loggerName, long timeStamp, String level, String message) { super.insertLog(loggerName, timeStamp, "LEVEL=" + level + ",MESSAGE=" + message, DataCategory.ODLLOG); } @Inject  TsdrLogCollectorLogger(TsdrCollectorSpiService tsdrCollectorSpiService, SchedulerService schedulerService); void insertLog(String loggerName, long timeStamp, String level, String message);  }