Package org.eclipse.jgit.junit.http
Class HttpTestCase
- java.lang.Object
-
- org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
-
- org.eclipse.jgit.junit.http.HttpTestCase
-
public abstract class HttpTestCase extends LocalDiskRepositoryTestCase
Base class for HTTP related transport testing.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
master
Constantmaster="Constants.R_HEADS + Constants.MASTER"
protected AppServer
server
In-memory application server; subclass must start.-
Fields inherited from class org.eclipse.jgit.junit.LocalDiskRepositoryTestCase
ASSUME_UNCHANGED, author, committer, CONTENT, CONTENT_ID, LENGTH, mockSystemReader, MOD_TIME, SMUDGE
-
-
Constructor Summary
Constructors Constructor Description HttpTestCase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AppServer
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.protected TestRepository<Repository>
createTestRepository()
Create TestRepositoryprotected static URIish
extendPath(URIish uri, java.lang.String pathComponents)
Extend a pathprotected static void
fsck(Repository db, RevObject... tips)
Run fsckprotected java.util.List<AccessEvent>
getRequests()
Get requests.protected java.util.List<AccessEvent>
getRequests(java.lang.String path)
Get requests.protected java.util.List<AccessEvent>
getRequests(URIish base, java.lang.String path)
Get requests.static java.lang.String
join(URIish base, java.lang.String path)
Join a base URIish and a pathstatic java.lang.String
loose(URIish base, AnyObjectId id)
Create loose object pathprotected static java.util.Set<RefSpec>
mirror(java.lang.String... refs)
Mirror refsprotected static java.util.Collection<RemoteRefUpdate>
push(TestRepository from, RevCommit q)
Push a commitprotected static java.lang.String
rewriteUrl(java.lang.String url, java.lang.String newProtocol, int newPort)
Rewrite a urlvoid
setUp()
Setup testvoid
tearDown()
Tear down the testprotected URIish
toURIish(java.lang.String path)
Convert path to URIishprotected URIish
toURIish(org.eclipse.jetty.servlet.ServletContextHandler app, java.lang.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
-
-
-
-
Field Detail
-
master
protected static final java.lang.String master
Constantmaster="Constants.R_HEADS + Constants.MASTER"
- See Also:
- Constant Field Values
-
server
protected AppServer server
In-memory application server; subclass must start.
-
-
Method Detail
-
setUp
public void setUp() throws java.lang.Exception
Setup test- Overrides:
setUp
in classLocalDiskRepositoryTestCase
- Throws:
java.lang.Exception
-
tearDown
public void tearDown() throws java.lang.Exception
Tear down the test- Overrides:
tearDown
in classLocalDiskRepositoryTestCase
- Throws:
java.lang.Exception
-
createServer
protected AppServer 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 TestRepository<Repository> createTestRepository() throws java.io.IOException
Create TestRepository- Returns:
- the TestRepository
- Throws:
java.io.IOException
-
toURIish
protected URIish toURIish(java.lang.String path) throws java.net.URISyntaxException
Convert path to URIish- Parameters:
path
-- Returns:
- the URIish
- Throws:
java.net.URISyntaxException
-
toURIish
protected URIish toURIish(org.eclipse.jetty.servlet.ServletContextHandler app, java.lang.String name) throws java.net.URISyntaxException
Convert a path relative to the app's context path to a URIish- Parameters:
app
-name
-- Returns:
- the warnings (if any) from the last execution
- Throws:
java.net.URISyntaxException
-
getRequests
protected java.util.List<AccessEvent> getRequests()
Get requests.- Returns:
- list of events
-
getRequests
protected java.util.List<AccessEvent> getRequests(URIish base, java.lang.String path)
Get requests.- Parameters:
base
-path
-- Returns:
- list of events
-
getRequests
protected java.util.List<AccessEvent> getRequests(java.lang.String path)
Get requests.- Parameters:
path
-- Returns:
- list of events
-
fsck
protected static void fsck(Repository db, RevObject... tips) throws java.lang.Exception
Run fsck- Parameters:
db
-tips
-- Throws:
java.lang.Exception
-
mirror
protected static java.util.Set<RefSpec> mirror(java.lang.String... refs)
Mirror refs- Parameters:
refs
-- Returns:
- set of RefSpecs
-
push
protected static java.util.Collection<RemoteRefUpdate> push(TestRepository from, RevCommit q) throws java.io.IOException
Push a commit- Parameters:
from
-q
-- Returns:
- collection of RefUpdates
- Throws:
java.io.IOException
-
loose
public static java.lang.String loose(URIish base, AnyObjectId id)
Create loose object path- Parameters:
base
-id
-- Returns:
- path of the loose object
-
join
public static java.lang.String join(URIish base, java.lang.String path)
Join a base URIish and a path- Parameters:
base
-path
- a relative path- Returns:
- the joined path
-
rewriteUrl
protected static java.lang.String rewriteUrl(java.lang.String url, java.lang.String newProtocol, int newPort)
Rewrite a url- Parameters:
url
-newProtocol
-newPort
-- Returns:
- the rewritten url
-
-