ThriftEventConvertUtil { public static Event toFlumeEvent(ThriftFlumeEvent evt) { return toFlumeEvent(evt, false); } private  ThriftEventConvertUtil(); static Event toFlumeEvent(ThriftFlumeEvent evt); static Event toFlumeEvent(ThriftFlumeEvent evt, boolean truncates); static ThriftFlumeEvent toThriftEvent(Event e); static final Logger LOG; }
@Test public void testNullBody() { ThriftFlumeEvent tEvt = new ThriftFlumeEvent(); Assert.assertEquals(null, tEvt.body); Assert.assertEquals(0, ThriftEventConvertUtil.toFlumeEvent(tEvt).getBody().length); }
@Test(expected = RuntimeException.class) public void testEvilEvent() { long maxSize = FlumeConfiguration.get().getEventMaxSizeBytes(); ByteBuffer toobig = ByteBuffer.allocate((int) (maxSize * 2)); ThriftFlumeEvent tevt = new ThriftFlumeEvent(0L, Priority.INFO, toobig, 0L, "localhost", new HashMap<String, ByteBuffer>()); Event e = ThriftEventConvertUtil.toFlumeEvent(tevt); EventImpl.select(e); }
@Test public void testTruncEvilEvent() { long maxSize = FlumeConfiguration.get().getEventMaxSizeBytes(); ByteBuffer toobig = ByteBuffer.allocate((int) (maxSize * 2)); ThriftFlumeEvent tevt = new ThriftFlumeEvent(0L, Priority.INFO, toobig, 0L, "localhost", new HashMap<String, ByteBuffer>()); Event e = ThriftEventConvertUtil.toFlumeEvent(tevt, true); EventImpl.select(e); }