use of loghub.Event 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.Event 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.Event 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.Event in project LogHub by fbacchella.
the class TestNettyNameResolver method arootasipv6string.
@Test(timeout = 6000)
public void arootasipv6string() throws ProcessorException, InterruptedException, ConfigException, IOException {
Event e = Tools.getEvent();
// resolving a.root-servers.net. in IPv6 as a String
e.put("host", "2001:503:ba3e::2:30");
Tools.ProcessingStatus status = dorequest(i -> {
i.setField("host");
i.setDestination("fqdn");
}, e, "0.3.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.e.3.a.b.3.0.5.0.1.0.0.2.ip6.arpa");
e = status.mainQueue.take();
Assert.assertEquals("resolution failed", "a.root-servers.net", e.get("fqdn"));
Assert.assertEquals("Queue not empty: " + status.mainQueue, 0, status.mainQueue.size());
Assert.assertEquals("Still waiting events: " + status.repository, 0, status.repository.waiting());
}
use of loghub.Event in project LogHub by fbacchella.
the class TestNettyNameResolver method arootasipv4string.
@Test(timeout = 6000)
public void arootasipv4string() throws ProcessorException, InterruptedException {
Event e = Tools.getEvent();
// / resolving a.root-servers.net. in IPv4 as String
e.put("host", "198.41.0.4");
Tools.ProcessingStatus status = dorequest(i -> {
i.setField("host");
i.setDestination("fqdn");
}, e, "4.0.41.198.in-addr.arpa");
e = status.mainQueue.take();
Assert.assertEquals("resolution failed", "a.root-servers.net", e.get("fqdn"));
Assert.assertEquals("Queue not empty: " + status.mainQueue, 0, status.mainQueue.size());
Assert.assertEquals("Still waiting events: " + status.repository, 0, status.repository.waiting());
}
Aggregations