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
FieldsModifier and TypeFieldDescriptionprotected static final StringConstantmaster="Constants.R_HEADS + Constants.MASTER"protected AppServerIn-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 -
Method Summary
Modifier and TypeMethodDescriptionprotected AppServerCreate theAppServer.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 itsAppServer.getPort()method.protected org.eclipse.jgit.junit.TestRepository<org.eclipse.jgit.lib.Repository>Create TestRepositoryprotected static org.eclipse.jgit.transport.URIishextendPath(org.eclipse.jgit.transport.URIish uri, String pathComponents) Extend a pathprotected static voidfsck(org.eclipse.jgit.lib.Repository db, org.eclipse.jgit.revwalk.RevObject... tips) Run fsckprotected List<AccessEvent>Get requests.protected List<AccessEvent>getRequests(String path) Get requests.protected List<AccessEvent>getRequests(org.eclipse.jgit.transport.URIish base, String path) Get requests.static StringJoin a base URIish and a pathstatic Stringloose(org.eclipse.jgit.transport.URIish base, org.eclipse.jgit.lib.AnyObjectId id) Create loose object pathprotected static Set<org.eclipse.jgit.transport.RefSpec>Mirror refsprotected static Collection<org.eclipse.jgit.transport.RemoteRefUpdate>push(org.eclipse.jgit.junit.TestRepository from, org.eclipse.jgit.revwalk.RevCommit q) Push a commitprotected static StringrewriteUrl(String url, String newProtocol, int newPort) Rewrite a urlvoidsetUp()voidtearDown()protected org.eclipse.jgit.transport.URIishConvert path to URIishprotected org.eclipse.jgit.transport.URIishConvert a path relative to the app's context path to a URIishMethods 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
-
Field Details
-
master
Constantmaster="Constants.R_HEADS + Constants.MASTER"- See Also:
-
server
In-memory application server; subclass must start.
-
-
Constructor Details
-
HttpTestCase
public HttpTestCase()
-
-
Method Details
-
setUp
- Overrides:
setUpin classorg.eclipse.jgit.junit.LocalDiskRepositoryTestCase- Throws:
Exception
-
tearDown
- Overrides:
tearDownin classorg.eclipse.jgit.junit.LocalDiskRepositoryTestCase- Throws:
Exception
-
createServer
Create theAppServer.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 itsAppServer.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 IOExceptionCreate TestRepository- Returns:
- the TestRepository
- Throws:
IOException- if an IO error occurred
-
toURIish
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 namename- context path name- Returns:
- the warnings (if any) from the last execution
- Throws:
URISyntaxException- if URI is invalid- Since:
- 7.0
-
getRequests
Get requests.- Returns:
- list of events
-
getRequests
Get requests.- Parameters:
base- base URIpath- the request path relative tobase- Returns:
- list of events
-
getRequests
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 repositorytips- tips to start checking from- Throws:
Exception- if an error occurred
-
mirror
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 pushq- 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 URIid- objectId- Returns:
- path of the loose object
-
join
Join a base URIish and a path- Parameters:
base- base URIpath- a relative path- Returns:
- the joined path
-
rewriteUrl
Rewrite a url- Parameters:
url- the URLnewProtocol- new protocolnewPort- 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 URIpathComponents- path components- Returns:
- the extended URIish
- Throws:
URISyntaxException- if URI is invalid
-