@Override
        protected void starting(Description descriptor) {
          super.starting(descriptor);
          deleteDirectory();

          operator = new JsonFormatter();

          validDataSink = new CollectorTestSink<Object>();
          invalidDataSink = new CollectorTestSink<String>();
          TestUtils.setSink(operator.out, validDataSink);
          TestUtils.setSink(operator.err, invalidDataSink);
          operator.setup(null);

          operator.beginWindow(0);
        }
  @Test
  public void testHttpInputModule() throws Exception {

    final List<String> receivedMessages = new ArrayList<String>();
    Handler handler =
        new AbstractHandler() {
          @Override
          public void handle(
              String string, Request rq, HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            IOUtils.copy(request.getInputStream(), bos);
            receivedMessages.add(new String(bos.toByteArray()));
            response.setContentType("text/plain");
            response.setStatus(HttpServletResponse.SC_OK);
            response.getOutputStream().println("Hello");
            response.getOutputStream().println("World,");
            response.getOutputStream().println("Big");
            response.getOutputStream().println("Data!");
            response.getOutputStream().flush();

            ((Request) request).setHandled(true);
          }
        };

    Server server = new Server(0);
    server.setHandler(handler);
    server.start();

    String url = "http://localhost:" + server.getConnectors()[0].getLocalPort() + "/somecontext";

    final HttpLinesInputOperator operator = new HttpLinesInputOperator();
    CollectorTestSink<String> sink =
        TestUtils.setSink(operator.outputPort, new CollectorTestSink<String>());
    operator.setUrl(new URI(url));

    operator.setup(null);
    operator.activate(null);

    int timeoutMillis = 3000;
    while (sink.collectedTuples.isEmpty() && timeoutMillis > 0) {
      operator.emitTuples();
      timeoutMillis -= 20;
      Thread.sleep(20);
    }

    Assert.assertTrue("tuple emitted", sink.collectedTuples.size() > 0);

    Assert.assertEquals("", sink.collectedTuples.get(0), "Hello");
    Assert.assertEquals("", sink.collectedTuples.get(1), "World,");
    Assert.assertEquals("", sink.collectedTuples.get(2), "Big");
    Assert.assertEquals("", sink.collectedTuples.get(3), "Data!");

    operator.deactivate();
    operator.teardown();
    server.stop();
  }
    @Override
    protected void starting(Description description) {
      TestUtils.deleteTargetTestClassFolder(description);
      store = new ManagedStateSpillableStateStore();
      timeStore = new ManagedTimeUnifiedStateSpillableStateStore();
      applicationPath = "target/" + description.getClassName() + "/" + description.getMethodName();
      ((FileAccessFSImpl) store.getFileAccess()).setBasePath(applicationPath + "/" + "bucket_data");
      ((FileAccessFSImpl) timeStore.getFileAccess())
          .setBasePath(applicationPath + "/" + "time_bucket_data");

      operatorContext = ManagedStateTestUtils.getOperatorContext(1, applicationPath);
    }
    @Override
    protected void starting(Description description) {
      TestUtils.deleteTargetTestClassFolder(description);
      applicationPath = "target/" + description.getClassName() + "/" + description.getMethodName();

      Context.OperatorContext operatorContext =
          ManagedStateTestUtils.getOperatorContext(operatorId, applicationPath);
      managedStateContext = new MockManagedStateContext(operatorContext);

      ((FileAccessFSImpl) managedStateContext.getFileAccess())
          .setBasePath(applicationPath + "/" + "bucket_data");
      managedStateContext.getFileAccess().init();

      checkpointManager = new IncrementalCheckpointManager();

      managedStateContext.getTimeBucketAssigner().setup(managedStateContext);
      managedStateContext.getBucketsFileSystem().setup(managedStateContext);
    }
 @Override
 protected void finished(Description description) {
   managedStateContext.getTimeBucketAssigner().teardown();
   managedStateContext.getBucketsFileSystem().teardown();
   TestUtils.deleteTargetTestClassFolder(description);
 }
 @Override
 protected void finished(Description description) {
   TestUtils.deleteTargetTestClassFolder(description);
 }