@Test public void testExtractEvent() throws Exception { final DateTime eventDateTime = new DateTime(); final String coreHostname = "hostname"; final TLoggingEvent event = new TLoggingEvent(); event.setCoreHostname(coreHostname); final String ip = "10.1.2.3"; event.setCoreIp(ip); final String type = "coic"; event.setCoreType(type); event.setEventDate(eventDateTime.getMillis()); final ThriftEnvelopeEvent envelopeEvent = ThriftToThriftEnvelopeEvent.extractEvent("TLoggingEvent", event); final TLoggingEvent finalEvent = ThriftEnvelopeEventToThrift.extractThrift(TLoggingEvent.class, envelopeEvent); Assert.assertEquals(finalEvent.getCoreHostname(), event.getCoreHostname()); Assert.assertEquals(finalEvent.getCoreHostname(), coreHostname); Assert.assertEquals(finalEvent.getCoreIp(), event.getCoreIp()); Assert.assertEquals(finalEvent.getCoreIp(), ip); Assert.assertEquals(finalEvent.getCoreType(), event.getCoreType()); Assert.assertEquals(finalEvent.getCoreType(), type); Assert.assertEquals(finalEvent.getEventDate(), event.getEventDate()); Assert.assertEquals(finalEvent.getEventDate(), eventDateTime.getMillis()); for (final ThriftField field : ((ThriftEnvelope) envelopeEvent.getData()).getPayload()) { Assert.assertTrue(field.getId() > 0); } }
public static <T extends Serializable> ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject) { return extractEvent(eventName, new DateTime(), thriftObject); }
ThriftToThriftEnvelopeEvent { public static <T extends Serializable> ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject) { return extractEvent(eventName, new DateTime(), thriftObject); } }
ThriftToThriftEnvelopeEvent { public static <T extends Serializable> ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject) { return extractEvent(eventName, new DateTime(), thriftObject); }  }
ThriftToThriftEnvelopeEvent { public static <T extends Serializable> ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject) { return extractEvent(eventName, new DateTime(), thriftObject); }  static ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject); static ThriftEnvelopeEvent extractEvent(final String eventName, final DateTime eventDateTime, final T thriftObject); static ThriftEnvelopeEvent extractEvent(final String type, final byte[] payload); static ThriftEnvelopeEvent extractEvent(final String type, final DateTime eventDateTime, final byte[] payload); }
ThriftToThriftEnvelopeEvent { public static <T extends Serializable> ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject) { return extractEvent(eventName, new DateTime(), thriftObject); }  static ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject); static ThriftEnvelopeEvent extractEvent(final String eventName, final DateTime eventDateTime, final T thriftObject); static ThriftEnvelopeEvent extractEvent(final String type, final byte[] payload); static ThriftEnvelopeEvent extractEvent(final String type, final DateTime eventDateTime, final byte[] payload);  }