Search in sources :

Example 1 with Mapper

use of loghub.processors.Mapper in project LogHub by fbacchella.

the class TestFileMap method testone.

@Test
public void testone() throws ProcessorException {
    URL ifpixurl = getClass().getResource("/ipfix-information-elements.csv");
    FileMap s = new FileMap();
    s.setMappingFile(ifpixurl.getFile());
    s.setCsvFormat("RFC4180");
    s.setKeyName("ElementID");
    s.setValueName("Name");
    s.configure(null);
    Mapper p = new Mapper();
    p.setField(new String[] { "type" });
    p.setLvalue(new String[] { "type" });
    p.setMap(s);
    Event e = Tools.getEvent();
    e.put("type", "1");
    ProcessingStatus ps = Tools.runProcessing(e, "main", Collections.singletonList(p));
    Event ep = ps.mainQueue.remove();
    Assert.assertEquals("octetDeltaCount", ep.get("type"));
}
Also used : Mapper(loghub.processors.Mapper) Event(loghub.Event) ProcessingStatus(loghub.Tools.ProcessingStatus) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 Event (loghub.Event)1 ProcessingStatus (loghub.Tools.ProcessingStatus)1 Mapper (loghub.processors.Mapper)1 Test (org.junit.Test)1