public void tearDown() throws Exception {
    servletContainer.stop();

    if (solrhome != null) {
      FileUtil.delete(solrhome);
    }

    if (archivehome != null) {
      FileUtil.delete(archivehome);
    }
  }
  public void setUp() throws Exception {
    solrhome = FileUtil.createTempDir("solrhome");
    SolrService.createSolrInstall(solrhome);
    solr = new SolrService(solrhome);

    archivehome = FileUtil.createTempDir("archive");
    archive = createTestArchiveStore(archivehome);
    index_service = new DcpIndexService(archive, solr);

    RandomEntityBuilder rb = new RandomEntityBuilder();
    DcsDeliverableUnit du = rb.createDeliverableUnit(null, null, false);

    du.setTitle("blah");

    List<DcsFile> files = new ArrayList<DcsFile>();
    DcsManifestation man = rb.createManifestation(du.getId(), files);

    dcp = new Dcp();

    dcp.addDeliverableUnit(du);
    dcp.addManifestation(man);
    dcp.addEvent(rb.createEvent(null));
    dcp.addCollection(rb.createCollection(null));
    for (DcsFile file : files) {
      dcp.addFile(file);
    }

    index(dcp);

    servletContainer = new ServletTester();
    servletContainer.setContextPath("/access");
    servletContainer.addServlet(QueryServlet.class, "/query/*");
    servletContainer
        .getContext()
        .getServletContext()
        .setAttribute(
            "dcpquery.impl", "org.dataconservancy.dcs.query.dcpsolr.DcsDataModelQueryService");
    String dsbaseurl = "/access/datastream";
    servletContainer.getContext().getServletContext().setAttribute("datastream.url", dsbaseurl);
    servletContainer.start();
  }