@Before
  public void prepareTest() throws Exception {

    syncConfiguration =
        MAPPER.readValue(
            MongoElasticsearchSyncIT.class.getResourceAsStream("/testSync.json"),
            MongoElasticsearchSyncConfiguration.class);

    syncConfiguration.getDestination().setClusterName(cluster().getClusterName());

    MongoPersistWriter setupWriter = new MongoPersistWriter(syncConfiguration.getSource());

    setupWriter.prepare(null);

    InputStream testActivityFolderStream =
        MongoElasticsearchSyncIT.class.getClassLoader().getResourceAsStream("activities");
    List<String> files = IOUtils.readLines(testActivityFolderStream, Charsets.UTF_8);

    for (String file : files) {
      LOGGER.info("File: " + file);
      InputStream testActivityFileStream =
          MongoElasticsearchSyncIT.class.getClassLoader().getResourceAsStream("activities/" + file);
      Activity activity = MAPPER.readValue(testActivityFileStream, Activity.class);
      activity.getAdditionalProperties().remove("$license");
      StreamsDatum datum = new StreamsDatum(activity, activity.getVerb());
      setupWriter.write(datum);
      LOGGER.info("Wrote: " + activity.getVerb());
      srcCount++;
    }

    setupWriter.cleanUp();
  }
  @Override
  public void run() {

    while (true) {
      if (persistQueue.peek() != null) {
        try {
          StreamsDatum entry = persistQueue.remove();
          write(entry);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      try {
        Thread.sleep(new Random().nextInt(1));
      } catch (InterruptedException e) {
      }
    }
  }