use of loghub.configuration.Properties in project LogHub by fbacchella.
the class TestMapper method test2.
@Test
public void test2() throws ProcessorException, InterruptedException, ConfigException, IOException {
Properties conf = Tools.loadConf("map.conf");
for (Pipeline pipe : conf.pipelines) {
Assert.assertTrue("configuration failed", pipe.configure(conf));
}
Event sent = Tools.getEvent();
sent.put("a", 1);
Tools.runProcessing(sent, conf.namedPipeLine.get("mapper2"), conf);
Assert.assertEquals("conversion not expected", "b", sent.get("a"));
}
use of loghub.configuration.Properties in project LogHub by fbacchella.
the class TestMapper method test3.
@Test
public void test3() throws ProcessorException, InterruptedException, ConfigException, IOException {
Properties conf = Tools.loadConf("map.conf");
for (Pipeline pipe : conf.pipelines) {
Assert.assertTrue("configuration failed", pipe.configure(conf));
}
Event sent = Tools.getEvent();
sent.put("a", 3);
Tools.runProcessing(sent, conf.namedPipeLine.get("mapper2"), conf);
Assert.assertEquals("conversion not expected", 3, sent.get("a"));
}
use of loghub.configuration.Properties in project LogHub by fbacchella.
the class TestNameResolver method test2.
@Test
public void test2() throws UnknownHostException, ProcessorException {
NameResolver nr = new NameResolver();
nr.setResolver("8.8.8.8");
nr.setField("host");
nr.setDestination("fqdn");
nr.configure(new Properties(Collections.emptyMap()));
Event e = Tools.getEvent();
// / resolving a.root-servers.net.
e.put("host", InetAddress.getByName("198.41.0.4"));
Assert.assertTrue(nr.process(e));
Assert.assertEquals("resolution failed", "a.root-servers.net", e.get("fqdn"));
}
use of loghub.configuration.Properties in project LogHub by fbacchella.
the class TestNameResolver method test3.
@Test
public void test3() throws UnknownHostException, ProcessorException {
NameResolver nr = new NameResolver();
nr.setResolver("8.8.8.8");
nr.setField("host");
nr.setDestination("fqdn_${field%s}");
nr.setTimeout(5);
nr.configure(new Properties(Collections.emptyMap()));
Event e = Tools.getEvent();
// / resolving a.root-servers.net.
e.put("host", InetAddress.getByName("2001:503:ba3e::2:30"));
nr.process(e);
Assert.assertEquals("resolution failed", "a.root-servers.net", e.get("fqdn_host"));
}
use of loghub.configuration.Properties in project LogHub by fbacchella.
the class TestOnigurumaRegex method testLoadPatterns1.
@Test
public void testLoadPatterns1() throws ProcessorException {
OnigurumaRegex grok = new OnigurumaRegex();
grok.setField("message");
grok.setPattern("<(?<syslog_pri>\\d+)>(?<message>.*)");
Properties props = new Properties(Collections.emptyMap());
Assert.assertTrue("Failed to configure grok", grok.configure(props));
Event e = Tools.getEvent();
e.put("message", "<15>a text");
Assert.assertTrue(e.process(grok));
Assert.assertEquals("Didn't find the good syslog priority", "15", e.get("syslog_pri"));
Assert.assertEquals("Didn't find the good syslog message", "a text", e.get("message"));
}
Aggregations