OaiPmhServer extends HttpServlet implements OaiPmhServerInfo, ManagedService { public static Option<String> repositoryId(HttpServletRequest req, String mountPoint) { return mlist(StringUtils.removeStart(UrlSupport.removeDoubleSeparator(req.getRequestURI()), mountPoint).split("/")) .bind(trimToNil).headOpt(); }  void setRepository(final OaiPmhRepository r); void unsetRepository(OaiPmhRepository r); void setSecurityService(SecurityService securityService); synchronized void activate(ComponentContext cc); @Override synchronized void updated(Dictionary<String, ?> properties); @Override void destroy(); static Option<String> repositoryId(HttpServletRequest req, String mountPoint); @Override boolean hasRepo(String id); @Override String getMountPoint();  }
@Test public void testExtractRepositoryIdFromRequest() { assertEquals(none(""), repositoryId(req("http: assertEquals(none(""), repositoryId(req("http: assertEquals(some("default"), repositoryId(req("http: assertEquals(some("default"), repositoryId(req("http: assertEquals(some("oai"), repositoryId(req("http: assertEquals(some("default"), repositoryId(req("http: assertEquals(none(""), repositoryId(req("http: assertEquals(none(""), repositoryId(req("http: assertEquals(none(""), repositoryId(req("http: assertEquals(none(""), repositoryId(req("http: }