Search in sources :

Example 11 with ReadRange

use of co.cask.cdap.logging.read.ReadRange in project cdap by caskdata.

the class TestDistributedLogReader method testDistributedLogNextFile.

@Test
public void testDistributedLogNextFile() throws Exception {
    ReadRange readRange = new ReadRange(0, Long.MAX_VALUE, LogOffset.INVALID_KAFKA_OFFSET);
    testDistributedLogNext(readRange, LOGGING_CONTEXT_FILE, 14, 3, "TestDistributedLogReader Log message2 ", 40, 0);
    readRange = new ReadRange(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1), System.currentTimeMillis(), LogOffset.INVALID_KAFKA_OFFSET);
    testDistributedLogNext(readRange, LOGGING_CONTEXT_FILE, 14, 3, "TestDistributedLogReader Log message2 ", 40, 0);
    testDistributedLogNext(ReadRange.LATEST, LOGGING_CONTEXT_FILE, 1, 5, "TestDistributedLogReader Log message2 ", 5, 35);
}
Also used : ReadRange(co.cask.cdap.logging.read.ReadRange) Test(org.junit.Test)

Example 12 with ReadRange

use of co.cask.cdap.logging.read.ReadRange in project cdap by caskdata.

the class TestDistributedLogReader method testDistributedLogPrevFile.

@Test
public void testDistributedLogPrevFile() throws Exception {
    ReadRange readRange = new ReadRange(0, Long.MAX_VALUE, LogOffset.INVALID_KAFKA_OFFSET);
    testDistributedLogPrev(readRange, LOGGING_CONTEXT_FILE, 7, 6, "TestDistributedLogReader Log message2 ", 40);
    readRange = new ReadRange(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1), System.currentTimeMillis(), LogOffset.INVALID_KAFKA_OFFSET);
    testDistributedLogPrev(readRange, LOGGING_CONTEXT_FILE, 7, 6, "TestDistributedLogReader Log message2 ", 40);
    testDistributedLogPrev(ReadRange.LATEST, LOGGING_CONTEXT_FILE, 7, 6, "TestDistributedLogReader Log message2 ", 40);
}
Also used : ReadRange(co.cask.cdap.logging.read.ReadRange) Test(org.junit.Test)

Aggregations

ReadRange (co.cask.cdap.logging.read.ReadRange)12 Test (org.junit.Test)6 Filter (co.cask.cdap.logging.filter.Filter)4 LogEvent (co.cask.cdap.logging.read.LogEvent)3 Callback (co.cask.cdap.logging.read.Callback)2 LogOffset (co.cask.cdap.logging.read.LogOffset)2 CloseableIterator (co.cask.cdap.api.dataset.lib.CloseableIterator)1