@Test
  public void testConvert() {
    ThriftFlumeEvent thriftEvent = ThriftEventAdaptor.convert(testEvent);

    Assert.assertNotNull(thriftEvent);
    Assert.assertNotNull(thriftEvent.host);
    Assert.assertNotNull(thriftEvent.timestamp);
    Assert.assertNotNull(thriftEvent.fields);
    Assert.assertNotNull(thriftEvent.priority);

    for (Entry<String, byte[]> entry : testEvent.getAttrs().entrySet()) {
      Assert.assertTrue(thriftEvent.fields.containsKey(entry.getKey()));
      Assert.assertTrue(
          Arrays.equals(thriftEvent.fields.get(entry.getKey()).array(), entry.getValue()));
    }
  }
  @Override
  public void append(Event e) throws IOException, InterruptedException {
    String helloWorldBody = "Hello World! -- " + new String(e.getBody());

    // make a copy of the event, but with the new body string.
    EventImpl e2 =
        new EventImpl(
            helloWorldBody.getBytes(),
            e.getTimestamp(),
            e.getPriority(),
            e.getNanos(),
            e.getHost(),
            e.getAttrs());

    super.append(e2);
  }
  private void assertCorrectResponse(int count, Event event, SearchResponse response) {
    SearchHits hits = response.getHits();

    assertEquals(count, hits.getTotalHits());

    SearchHit hit = hits.getAt(0);

    Map<String, Object> source = hit.getSource();

    assertEquals(event.getHost(), source.get("host"));
    assertEquals("1970-01-01T00:00:00.000Z", source.get("timestamp"));
    assertEquals(event.getPriority().name(), source.get("priority"));

    @SuppressWarnings("unchecked")
    Map<String, Object> message = (Map<String, Object>) source.get("message");
    assertEquals(new String(event.getBody()), message.get("text"));

    @SuppressWarnings("unchecked")
    Map<String, Object> fields = (Map<String, Object>) source.get("fields");

    assertEquals(new String(event.getAttrs().get("attr1")), fields.get("attr1"));
    assertEquals(new String(event.getAttrs().get("attr2")), fields.get("attr2"));
  }