Skip to content

Commit

Permalink
Avoid method names confused with Stapler methods
Browse files Browse the repository at this point in the history
The doXyz methods may be misinterpreted as Stapler methods.  This is
purely test code, but no reason to use poorly named methods in test
code either.
  • Loading branch information
MarkEWaite committed Oct 11, 2020
1 parent bfd7acb commit 520941b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/test/java/jmh/benchmark/GitClientFetchBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static class ClientState {
* "before" and "after" JUnit annotations.
*/
@Setup(Level.Iteration)
public void doSetup() throws Exception {
public void setup() throws Exception {
tmp.before();
gitDir = tmp.newFolder();

Expand All @@ -56,7 +56,7 @@ public void doSetup() throws Exception {
}

@TearDown(Level.Iteration)
public void doTearDown() {
public void tearDown() {
try {
// making sure that git init made a git an empty repository
File gitDir = gitClient.withRepository((repo, channel) -> repo.getDirectory());
Expand Down Expand Up @@ -112,7 +112,7 @@ public void cloneUpstreamRepo() throws Exception {
}

@TearDown(Level.Trial)
public void doTearDown() {
public void tearDown() {
tmp.after();
System.out.println("Removed local upstream directory for: " + repoUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
// }
//
// @After
// public void doTearDown() {
// public void tearDown() {
// try {
// File gitDir = gitClient.withRepository((repo, channel) -> repo.getDirectory());
// System.out.println(gitDir.isDirectory());
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/jmh/benchmark/GitClientInitBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class JenkinsState {
* "before" and "after" JUnit annotations.
*/
@Setup(Level.Iteration)
public void doSetup() throws Exception {
public void setup() throws Exception {
tmp.before();
gitDir = tmp.newFolder();

Expand All @@ -39,7 +39,7 @@ public void doSetup() throws Exception {
}

@TearDown(Level.Iteration)
public void doTearDown() {
public void tearDown() {
try {
// making sure that git init made a git an empty repository
File gitDir = gitClient.withRepository((repo, channel) -> repo.getDirectory());
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/jmh/benchmark/GitClientLSRemoteBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class ClientState {
* "before" and "after" JUnit annotations.
*/
@Setup(Level.Iteration)
public void doSetup() throws Exception {
public void setup() throws Exception {
tmp.before();
gitDir = tmp.newFolder();

Expand All @@ -48,7 +48,7 @@ public void doSetup() throws Exception {
}

@TearDown(Level.Iteration)
public void doTearDown() {
public void tearDown() {
try {
// making sure that git init made a git an empty repository
File gitDir = gitClient.withRepository((repo, channel) -> repo.getDirectory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void tearRemoteRepoDown() {
* "before" and "after" JUnit annotations.
*/
@Setup(Level.Iteration)
public void doSetup() throws Exception {
public void setup() throws Exception {
tmp.before();
gitDir = tmp.newFolder();
gitClient = Git.with(TaskListener.NULL, new EnvVars()).in(gitDir).using(gitExe).getClient();
Expand All @@ -98,7 +98,7 @@ public void doSetup() throws Exception {
}

@TearDown(Level.Iteration)
public void doTearDown() {
public void tearDown() {
try {
// making sure that git init made a git an empty repository
File gitDir = gitClient.withRepository((repo, channel) -> repo.getDirectory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ public static Collection gitRepoUrls() throws MalformedURLException, FileNotFoun
return TEST_ALL_CREDENTIALS ? repos : repos.subList(0, Math.min(repos.size(), 6));
}

private void doFetch(String source) throws Exception {
doFetch(source, "master", true);
private void gitFetch(String source) throws Exception {
gitFetch(source, "master", true);
}

private void doFetch(String source, String branch, Boolean allowShallowClone) throws Exception {
private void gitFetch(String source, String branch, Boolean allowShallowClone) throws Exception {
/* Save some bandwidth with shallow clone for CliGit, not yet available for JGit */
URIish sourceURI = new URIish(source);
List<RefSpec> refSpecs = new ArrayList<>();
Expand Down Expand Up @@ -397,10 +397,10 @@ public void testFetchWithCredentials() throws Exception {
assertFalse("file " + fileToCheck + " in " + repo + ", has " + listDir(repo), clonedFile.exists());
addCredential();
/* Fetch with remote URL */
doFetch(gitRepoURL);
gitFetch(gitRepoURL);
git.setRemoteUrl("origin", gitRepoURL);
/* Fetch with remote name "origin" instead of remote URL */
doFetch("origin");
gitFetch("origin");
ObjectId master = git.getHeadRev(gitRepoURL, "master");
git.checkout().branch("master").ref(master.getName()).deleteBranchIfExist(true).execute();
if (submodules) {
Expand Down Expand Up @@ -461,7 +461,7 @@ public void testLfsMergeWithCredentials() throws Exception {

/* Fetch with remote name "origin" instead of remote URL */
git.setRemoteUrl("origin", gitRepoURL);
doFetch("origin", "*", false);
gitFetch("origin", "*", false);
ObjectId master = git.getHeadRev(gitRepoURL, "master");
git.checkout().branch("master").ref(master.getName()).lfsRemote("origin").deleteBranchIfExist(true).execute();
assertTrue("master: " + master + " not in repo", git.isCommitInRepo(master));
Expand Down

0 comments on commit 520941b

Please sign in to comment.