Add missing javadoc in org.eclipse.jgit.junit

Change-Id: Ib709ef050bec31c87f542fb2cc977863dda93ef9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-07-18 13:25:39 +02:00
parent ba5d13ed42
commit 376c20f454
2 changed files with 157 additions and 0 deletions

View File

@ -81,13 +81,31 @@ public class RepeatRule implements TestRule {
private static Logger LOG = Logger
.getLogger(RepeatRule.class.getName());
/**
* Exception thrown if repeated execution of a test annotated with
* {@code @Repeat} failed.
*/
public static class RepeatedTestException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* Constructor
*
* @param message
* the error message
*/
public RepeatedTestException(String message) {
super(message);
}
/**
* Constructor
*
* @param message
* the error message
* @param cause
* exception causing this exception
*/
public RepeatedTestException(String message, Throwable cause) {
super(message, cause);
}

View File

@ -1059,6 +1059,14 @@ public class CommitBuilder {
parents.add(prior.create());
}
/**
* set parent commit
*
* @param p
* parent commit
* @return this commit builder
* @throws Exception
*/
public CommitBuilder parent(RevCommit p) throws Exception {
if (parents.isEmpty()) {
DirCacheBuilder b = tree.builder();
@ -1071,29 +1079,71 @@ public CommitBuilder parent(RevCommit p) throws Exception {
return this;
}
/**
* Get parent commits
*
* @return parent commits
*/
public List<RevCommit> parents() {
return Collections.unmodifiableList(parents);
}
/**
* Remove parent commits
*
* @return this commit builder
*/
public CommitBuilder noParents() {
parents.clear();
return this;
}
/**
* Remove files
*
* @return this commit builder
*/
public CommitBuilder noFiles() {
tree.clear();
return this;
}
/**
* Set top level tree
*
* @param treeId
* the top level tree
* @return this commit builder
*/
public CommitBuilder setTopLevelTree(ObjectId treeId) {
topLevelTree = treeId;
return this;
}
/**
* Add file with given content
*
* @param path
* path of the file
* @param content
* the file content
* @return this commit builder
* @throws Exception
*/
public CommitBuilder add(String path, String content) throws Exception {
return add(path, blob(content));
}
/**
* Add file with given path and blob
*
* @param path
* path of the file
* @param id
* blob for this file
* @return this commit builder
* @throws Exception
*/
public CommitBuilder add(String path, RevBlob id)
throws Exception {
return edit(new PathEdit(path) {
@ -1105,6 +1155,13 @@ public void apply(DirCacheEntry ent) {
});
}
/**
* Edit the index
*
* @param edit
* the index record update
* @return this commit builder
*/
public CommitBuilder edit(PathEdit edit) {
DirCacheEditor e = tree.editor();
e.add(edit);
@ -1112,6 +1169,13 @@ public CommitBuilder edit(PathEdit edit) {
return this;
}
/**
* Remove a file
*
* @param path
* path of the file
* @return this commit builder
*/
public CommitBuilder rm(String path) {
DirCacheEditor e = tree.editor();
e.add(new DeletePath(path));
@ -1120,49 +1184,111 @@ public CommitBuilder rm(String path) {
return this;
}
/**
* Set commit message
*
* @param m
* the message
* @return this commit builder
*/
public CommitBuilder message(String m) {
message = m;
return this;
}
/**
* Get the commit message
*
* @return the commit message
*/
public String message() {
return message;
}
/**
* Tick the clock
*
* @param secs
* number of seconds
* @return this commit builder
*/
public CommitBuilder tick(int secs) {
tick = secs;
return this;
}
/**
* Set author and committer identity
*
* @param ident
* identity to set
* @return this commit builder
*/
public CommitBuilder ident(PersonIdent ident) {
author = ident;
committer = ident;
return this;
}
/**
* Set the author identity
*
* @param a
* the author's identity
* @return this commit builder
*/
public CommitBuilder author(PersonIdent a) {
author = a;
return this;
}
/**
* Get the author identity
*
* @return the author identity
*/
public PersonIdent author() {
return author;
}
/**
* Set the committer identity
*
* @param c
* the committer identity
* @return this commit builder
*/
public CommitBuilder committer(PersonIdent c) {
committer = c;
return this;
}
/**
* Get the committer identity
*
* @return the committer identity
*/
public PersonIdent committer() {
return committer;
}
/**
* Insert changeId
*
* @return this commit builder
*/
public CommitBuilder insertChangeId() {
changeId = "";
return this;
}
/**
* Insert given changeId
*
* @param c
* changeId
* @return this commit builder
*/
public CommitBuilder insertChangeId(String c) {
// Validate, but store as a string so we can use "" as a sentinel.
ObjectId.fromString(c);
@ -1170,6 +1296,13 @@ public CommitBuilder insertChangeId(String c) {
return this;
}
/**
* Create the commit
*
* @return the new commit
* @throws Exception
* if creation failed
*/
public RevCommit create() throws Exception {
if (self == null) {
TestRepository.this.tick(tick);
@ -1230,6 +1363,12 @@ private void insertChangeId(org.eclipse.jgit.lib.CommitBuilder c) {
+ cid.getName() + "\n"); //$NON-NLS-1$
}
/**
* Create child commit builder
*
* @return child commit builder
* @throws Exception
*/
public CommitBuilder child() throws Exception {
return new CommitBuilder(this);
}