Class HttpTestCase

java.lang.Object
org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
org.eclipse.jgit.junit.http.HttpTestCase

public abstract class HttpTestCase extends org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
Base class for HTTP related transport testing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
    Constant master="Constants.R_HEADS + Constants.MASTER"
    protected AppServer
    In-memory application server; subclass must start.

    Fields inherited from class org.eclipse.jgit.junit.LocalDiskRepositoryTestCase

    ASSUME_UNCHANGED, author, committer, CONTENT, CONTENT_ID, currentTest, LENGTH, mockSystemReader, MOD_TIME, SMUDGE, testRoot
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected AppServer
    Create the AppServer.This default implementation creates a server without SSLsupport listening for HTTP connections on a dynamically chosen port, which can be gotten once the server has been started via its AppServer.getPort() method.
    protected org.eclipse.jgit.junit.TestRepository<org.eclipse.jgit.lib.Repository>
    Create TestRepository
    protected static org.eclipse.jgit.transport.URIish
    extendPath(org.eclipse.jgit.transport.URIish uri, String pathComponents)
    Extend a path
    protected static void
    fsck(org.eclipse.jgit.lib.Repository db, org.eclipse.jgit.revwalk.RevObject... tips)
    Run fsck
    protected List<AccessEvent>
    Get requests.
    protected List<AccessEvent>
    Get requests.
    protected List<AccessEvent>
    getRequests(org.eclipse.jgit.transport.URIish base, String path)
    Get requests.
    static String
    join(org.eclipse.jgit.transport.URIish base, String path)
    Join a base URIish and a path
    static String
    loose(org.eclipse.jgit.transport.URIish base, org.eclipse.jgit.lib.AnyObjectId id)
    Create loose object path
    protected static Set<org.eclipse.jgit.transport.RefSpec>
    mirror(String... refs)
    Mirror refs
    protected static Collection<org.eclipse.jgit.transport.RemoteRefUpdate>
    push(org.eclipse.jgit.junit.TestRepository from, org.eclipse.jgit.revwalk.RevCommit q)
    Push a commit
    protected static String
    rewriteUrl(String url, String newProtocol, int newPort)
    Rewrite a url
    void
     
    void
     
    protected org.eclipse.jgit.transport.URIish
    Convert path to URIish
    protected org.eclipse.jgit.transport.URIish
    toURIish(org.eclipse.jetty.ee10.servlet.ServletContextHandler app, String name)
    Convert a path relative to the app's context path to a URIish

    Methods inherited from class org.eclipse.jgit.junit.LocalDiskRepositoryTestCase

    addRepoToClose, createBareRepository, createRepository, createRepository, createTempDirectory, createTempFile, createUniqueTestGitDir, createWorkRepository, getCeilings, getTemporaryDirectory, indexState, read, recursiveDelete, runHook, tick, write, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • master

      protected static final String master
      Constant master="Constants.R_HEADS + Constants.MASTER"
      See Also:
    • server

      protected AppServer server
      In-memory application server; subclass must start.
  • Constructor Details

    • HttpTestCase

      public HttpTestCase()
  • Method Details

    • setUp

      public void setUp() throws Exception
      Overrides:
      setUp in class org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
      Throws:
      Exception
    • tearDown

      public void tearDown() throws Exception
      Overrides:
      tearDown in class org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
      Throws:
      Exception
    • createServer

      protected AppServer createServer()
      Create the AppServer.This default implementation creates a server without SSLsupport listening for HTTP connections on a dynamically chosen port, which can be gotten once the server has been started via its AppServer.getPort() method. Subclasses may override if they need a more specialized server.
      Returns:
      the AppServer.
      Since:
      4.9
    • createTestRepository

      protected org.eclipse.jgit.junit.TestRepository<org.eclipse.jgit.lib.Repository> createTestRepository() throws IOException
      Create TestRepository
      Returns:
      the TestRepository
      Throws:
      IOException - if an IO error occurred
    • toURIish

      protected org.eclipse.jgit.transport.URIish toURIish(String path) throws URISyntaxException
      Convert path to URIish
      Parameters:
      path - the path
      Returns:
      the URIish
      Throws:
      URISyntaxException - if URI is invalid
    • toURIish

      protected org.eclipse.jgit.transport.URIish toURIish(org.eclipse.jetty.ee10.servlet.ServletContextHandler app, String name) throws URISyntaxException
      Convert a path relative to the app's context path to a URIish
      Parameters:
      app - app name
      name - context path name
      Returns:
      the warnings (if any) from the last execution
      Throws:
      URISyntaxException - if URI is invalid
      Since:
      7.0
    • getRequests

      protected List<AccessEvent> getRequests()
      Get requests.
      Returns:
      list of events
    • getRequests

      protected List<AccessEvent> getRequests(org.eclipse.jgit.transport.URIish base, String path)
      Get requests.
      Parameters:
      base - base URI
      path - the request path relative to base
      Returns:
      list of events
    • getRequests

      protected List<AccessEvent> getRequests(String path)
      Get requests.
      Parameters:
      path - request path
      Returns:
      list of events
    • fsck

      protected static void fsck(org.eclipse.jgit.lib.Repository db, org.eclipse.jgit.revwalk.RevObject... tips) throws Exception
      Run fsck
      Parameters:
      db - the repository
      tips - tips to start checking from
      Throws:
      Exception - if an error occurred
    • mirror

      protected static Set<org.eclipse.jgit.transport.RefSpec> mirror(String... refs)
      Mirror refs
      Parameters:
      refs - the refs
      Returns:
      set of RefSpecs
    • push

      protected static Collection<org.eclipse.jgit.transport.RemoteRefUpdate> push(org.eclipse.jgit.junit.TestRepository from, org.eclipse.jgit.revwalk.RevCommit q) throws IOException
      Push a commit
      Parameters:
      from - repository from which to push
      q - commit to push
      Returns:
      collection of RefUpdates
      Throws:
      IOException - if an IO error occurred
    • loose

      public static String loose(org.eclipse.jgit.transport.URIish base, org.eclipse.jgit.lib.AnyObjectId id)
      Create loose object path
      Parameters:
      base - base URI
      id - objectId
      Returns:
      path of the loose object
    • join

      public static String join(org.eclipse.jgit.transport.URIish base, String path)
      Join a base URIish and a path
      Parameters:
      base - base URI
      path - a relative path
      Returns:
      the joined path
    • rewriteUrl

      protected static String rewriteUrl(String url, String newProtocol, int newPort)
      Rewrite a url
      Parameters:
      url - the URL
      newProtocol - new protocol
      newPort - new port
      Returns:
      the rewritten url
    • extendPath

      protected static org.eclipse.jgit.transport.URIish extendPath(org.eclipse.jgit.transport.URIish uri, String pathComponents) throws URISyntaxException
      Extend a path
      Parameters:
      uri - the URI
      pathComponents - path components
      Returns:
      the extended URIish
      Throws:
      URISyntaxException - if URI is invalid