use of org.eclipse.jgit.http.server.glue.MetaFilter in project gitiles by GerritCodeReview.
the class TestViewFilter method service.
public static Result service(TestRepository<? extends DfsRepository> repo, String pathAndQuery) throws IOException, ServletException {
TestServlet servlet = new TestServlet();
ViewFilter vf = new ViewFilter(new TestGitilesAccess(repo.getRepository()), TestGitilesUrls.URLS, new VisibilityCache(false));
MetaFilter mf = new MetaFilter();
for (Pattern p : ImmutableList.of(ROOT_REGEX, REPO_REGEX, REPO_PATH_REGEX)) {
mf.serveRegex(p).through(vf).with(servlet);
}
FakeHttpServletRequest req = newRequest(repo, pathAndQuery);
FakeHttpServletResponse res = new FakeHttpServletResponse();
dummyServlet(mf).service(req, res);
if (servlet.view != null) {
ViewFilter.setView(req, servlet.view);
if (servlet.view.getRepositoryName() != null) {
assertThat(servlet.view.getRepositoryName()).isEqualTo(repo.getRepository().getDescription().getRepositoryName());
}
}
return new Result(servlet.view, req, res);
}
Aggregations