Class TestRepositoryResolver

  • All Implemented Interfaces:
    RepositoryResolver<javax.servlet.http.HttpServletRequest>

    public final class TestRepositoryResolver
    extends java.lang.Object
    implements RepositoryResolver<javax.servlet.http.HttpServletRequest>
    A simple repository resolver for tests.
    • Constructor Detail

      • TestRepositoryResolver

        public TestRepositoryResolver​(TestRepository<Repository> repo,
                                      java.lang.String repoName)
        Create a new TestRepositoryResolver that resolves the given name to the given repository.
        Parameters:
        repo - to resolve to
        repoName - to match
    • Method Detail

      • open

        public Repository open​(javax.servlet.http.HttpServletRequest req,
                               java.lang.String name)
                        throws RepositoryNotFoundException,
                               ServiceNotEnabledException
        Locate and open a reference to a Repository.

        The caller is responsible for closing the returned Repository.

        Specified by:
        open in interface RepositoryResolver<javax.servlet.http.HttpServletRequest>
        Parameters:
        req - the current request, may be used to inspect session state including cookies or user authentication.
        name - name of the repository, as parsed out of the URL.
        Returns:
        the opened repository instance, never null.
        Throws:
        RepositoryNotFoundException - the repository does not exist or the name is incorrectly formatted as a repository name.
        ServiceNotEnabledException - the repository may exist, but HTTP access is not allowed on the target repository, for the current user.