Search in sources :

Example 6 with Event

use of com.yahoo.log.event.Event in project vespa by vespa-engine.

the class NoMetricsFilterTestCase method testValueEvents.

@Test
public void testValueEvents() throws InvalidLogFormatException, IOException {
    NoMetricsFilter filter = new NoMetricsFilter();
    MetricsFilter metricsFilter = new MetricsFilter();
    String filename = "src/test/files/value-events.txt";
    BufferedReader br = new BufferedReader(new FileReader(filename));
    for (String line = br.readLine(); line != null; line = br.readLine()) {
        LogMessage m = LogMessage.parseNativeFormat(line);
        assertNotNull(m);
        try {
            Event event = m.getEvent();
            assertNotNull(event);
        } catch (MalformedEventException e) {
            fail();
        }
        if (filter.isLoggable(m)) {
            fail();
        } else {
            assertTrue(true);
        }
        if (metricsFilter.isLoggable(m)) {
            assertTrue(true);
        } else {
            fail();
        }
    }
}
Also used : NoMetricsFilter(com.yahoo.logserver.filter.NoMetricsFilter) LogMessage(com.yahoo.log.LogMessage) MalformedEventException(com.yahoo.log.event.MalformedEventException) BufferedReader(java.io.BufferedReader) Event(com.yahoo.log.event.Event) FileReader(java.io.FileReader) MetricsFilter(com.yahoo.logserver.filter.MetricsFilter) NoMetricsFilter(com.yahoo.logserver.filter.NoMetricsFilter)

Aggregations

Event (com.yahoo.log.event.Event)6 MalformedEventException (com.yahoo.log.event.MalformedEventException)4 LogMessage (com.yahoo.log.LogMessage)3 BufferedReader (java.io.BufferedReader)3 MetricsFilter (com.yahoo.logserver.filter.MetricsFilter)2 FileReader (java.io.FileReader)2 InvalidLogFormatException (com.yahoo.log.InvalidLogFormatException)1 Count (com.yahoo.log.event.Count)1 NoMetricsFilter (com.yahoo.logserver.filter.NoMetricsFilter)1 FileInputStream (java.io.FileInputStream)1 InputStreamReader (java.io.InputStreamReader)1 GZIPInputStream (java.util.zip.GZIPInputStream)1