示例#1
0
  @BeforeClass
  public static void setUpFakeMavenRepo() throws Exception {
    repo = TestDataHelper.getTestDataDirectory(new ResolverIntegrationTest());
    // If we're running this test in IJ, then this path doesn't exist. Fall back to one that does
    if (!Files.exists(repo)) {
      repo = Paths.get("test/com/facebook/buck/maven/testdata");
    }

    httpd = new HttpdForTests();

    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed(true);
    resourceHandler.setResourceBase(repo.toAbsolutePath().toString());

    ContextHandler contextHandler = new ContextHandler("/");
    contextHandler.setHandler(resourceHandler);
    contextHandler.setLogger(new StdErrLog());

    httpd.addHandler(contextHandler);
    httpd.start();
  }