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 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, currentTest, 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, String pathComponents)
Extend a pathprotected static void
fsck(Repository db, RevObject... tips)
Run fsckprotected List<AccessEvent>
getRequests()
Get requests.protected List<AccessEvent>
getRequests(String path)
Get requests.protected List<AccessEvent>
getRequests(URIish base, String path)
Get requests.static String
join(URIish base, String path)
Join a base URIish and a pathstatic String
loose(URIish base, AnyObjectId id)
Create loose object pathprotected static Set<RefSpec>
mirror(String... refs)
Mirror refsprotected static Collection<RemoteRefUpdate>
push(TestRepository from, RevCommit q)
Push a commitprotected static String
rewriteUrl(String url, String newProtocol, int newPort)
Rewrite a urlvoid
setUp()
Setup testvoid
tearDown()
Tear down the testprotected URIish
toURIish(String path)
Convert path to URIishprotected URIish
toURIish(org.eclipse.jetty.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
-
-
-
-
Field Detail
-
master
protected static final 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 Exception
Setup test- Overrides:
setUp
in classLocalDiskRepositoryTestCase
- Throws:
Exception
-
tearDown
public void tearDown() throws Exception
Tear down the test- Overrides:
tearDown
in classLocalDiskRepositoryTestCase
- Throws:
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 IOException
Create TestRepository- Returns:
- the TestRepository
- Throws:
IOException
-
toURIish
protected URIish toURIish(String path) throws URISyntaxException
Convert path to URIish- Parameters:
path
-- Returns:
- the URIish
- Throws:
URISyntaxException
-
toURIish
protected URIish toURIish(org.eclipse.jetty.servlet.ServletContextHandler app, String name) throws 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:
URISyntaxException
-
getRequests
protected List<AccessEvent> getRequests()
Get requests.- Returns:
- list of events
-
getRequests
protected List<AccessEvent> getRequests(URIish base, String path)
Get requests.- Parameters:
base
-path
-- Returns:
- list of events
-
getRequests
protected List<AccessEvent> getRequests(String path)
Get requests.- Parameters:
path
-- Returns:
- list of events
-
fsck
protected static void fsck(Repository db, RevObject... tips) throws Exception
Run fsck- Parameters:
db
-tips
-- Throws:
Exception
-
mirror
protected static Set<RefSpec> mirror(String... refs)
Mirror refs- Parameters:
refs
-- Returns:
- set of RefSpecs
-
push
protected static Collection<RemoteRefUpdate> push(TestRepository from, RevCommit q) throws IOException
Push a commit- Parameters:
from
-q
-- Returns:
- collection of RefUpdates
- Throws:
IOException
-
loose
public static String loose(URIish base, AnyObjectId id)
Create loose object path- Parameters:
base
-id
-- Returns:
- path of the loose object
-
join
public static String join(URIish base, String path)
Join a base URIish and a path- Parameters:
base
-path
- a relative path- Returns:
- the joined path
-
rewriteUrl
protected static String rewriteUrl(String url, String newProtocol, int newPort)
Rewrite a url- Parameters:
url
-newProtocol
-newPort
-- Returns:
- the rewritten url
-
extendPath
protected static URIish extendPath(URIish uri, String pathComponents) throws URISyntaxException
Extend a path- Parameters:
uri
-pathComponents
-- Returns:
- the extended URIish
- Throws:
URISyntaxException
-
-