Search in sources :

Example 11 with GelfTransport

use of org.graylog2.gelfclient.transport.GelfTransport in project graylog2-server by Graylog2.

the class GelfOutputTest method testToGELFMessageTimestamp.

@Test
public void testToGELFMessageTimestamp() throws Exception {
    final GelfTransport transport = mock(GelfTransport.class);
    final GelfOutput gelfOutput = new GelfOutput(transport);
    final DateTime now = DateTime.now(DateTimeZone.UTC);
    final Message message = new Message("Test", "Source", now);
    final GelfMessage gelfMessage = gelfOutput.toGELFMessage(message);
    assertEquals(gelfMessage.getTimestamp(), now.getMillis() / 1000.0d, 0.0d);
}
Also used : GelfTransport(org.graylog2.gelfclient.transport.GelfTransport) GelfMessage(org.graylog2.gelfclient.GelfMessage) Message(org.graylog2.plugin.Message) DateTime(org.joda.time.DateTime) GelfMessage(org.graylog2.gelfclient.GelfMessage) Test(org.junit.Test)

Aggregations

GelfMessage (org.graylog2.gelfclient.GelfMessage)10 GelfTransport (org.graylog2.gelfclient.transport.GelfTransport)10 Message (org.graylog2.plugin.Message)10 Test (org.junit.Test)10 DateTime (org.joda.time.DateTime)9 File (java.io.File)1 GelfConfiguration (org.graylog2.gelfclient.GelfConfiguration)1 GelfTransports (org.graylog2.gelfclient.GelfTransports)1 MessageOutputConfigurationException (org.graylog2.plugin.outputs.MessageOutputConfigurationException)1