Search in sources :

Example 1 with FormattedBufferCache

use of com.yahoo.logserver.handlers.replicator.FormattedBufferCache in project vespa by vespa-engine.

the class FormattedBufferCacheTestCase method testCache.

@Test
public void testCache() {
    LogMessage[] msgs = MockLogEntries.getMessages();
    FormattedBufferCache cache = new FormattedBufferCache();
    String[] n = LogFormatterManager.getFormatterNames();
    for (int i = 0; i < n.length; i++) {
        LogFormatter f = LogFormatterManager.getLogFormatter(n[i]);
        for (int j = 0; j < msgs.length; j++) {
            ByteBuffer bb = cache.getFormatted(msgs[j], f);
            assertNotNull(bb);
        }
    }
    assertTrue(cache.getUnderlyingMapOnlyForTesting().size() > 0);
    cache.reset();
    assertTrue(cache.getUnderlyingMapOnlyForTesting().size() == 0);
}
Also used : LogMessage(com.yahoo.log.LogMessage) FormattedBufferCache(com.yahoo.logserver.handlers.replicator.FormattedBufferCache) LogFormatter(com.yahoo.logserver.formatter.LogFormatter) ByteBuffer(java.nio.ByteBuffer)

Aggregations

LogMessage (com.yahoo.log.LogMessage)1 LogFormatter (com.yahoo.logserver.formatter.LogFormatter)1 FormattedBufferCache (com.yahoo.logserver.handlers.replicator.FormattedBufferCache)1 ByteBuffer (java.nio.ByteBuffer)1