use of org.opennms.netmgt.syslogd.api.SyslogMessageLogDTO in project opennms by OpenNMS.
the class SyslogdEventdLoadIT method testNGSyslog.
@Test(timeout = 120000)
@Transactional
public void testNGSyslog() throws Exception {
loadSyslogConfiguration("/etc/syslogd-syslogng-configuration.xml");
startSyslogdGracefully();
m_eventCounter.anticipate();
InetAddress address = InetAddress.getLocalHost();
// handle an invalid packet
byte[] bytes = "<34>main: 2010-08-19 localhost foo0: load test 0 on tty1\0".getBytes();
DatagramPacket pkt = new DatagramPacket(bytes, bytes.length, address, SyslogClient.PORT);
SyslogMessageLogDTO messageLog = m_syslogSinkModule.toMessageLog(new SyslogConnection(pkt, false));
m_syslogSinkConsumer.handleMessage(messageLog);
// handle a valid packet
bytes = "<34>monkeysatemybrain!\0".getBytes();
pkt = new DatagramPacket(bytes, bytes.length, address, SyslogClient.PORT);
messageLog = m_syslogSinkModule.toMessageLog(new SyslogConnection(pkt, false));
m_syslogSinkConsumer.handleMessage(messageLog);
m_eventCounter.waitForFinish(120000);
assertEquals(1, m_eventCounter.getCount());
}
Aggregations