Skip to content

Commit

Permalink
Merge pull request #768 from bitwiseman/task/jacoco-report
Browse files Browse the repository at this point in the history
Add Jacoco report to site
  • Loading branch information
bitwiseman committed Apr 1, 2020
2 parents c5ee07a + ea7a1a7 commit 3cddffa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,10 @@
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down Expand Up @@ -621,6 +625,18 @@
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<!-- select non-aggregate reports -->
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
28 changes: 14 additions & 14 deletions src/test/java/org/kohsuke/github/GHRateLimitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public void testGitHubRateLimit() throws Exception {
GHRateLimit headerRateLimit = rateLimit;

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// ratelimit() uses headerRateLimit if available and headerRateLimit is not expired
assertThat(gitHub.rateLimit(), equalTo(headerRateLimit));

assertThat(mockGitHub.getRequestCount(), equalTo(1));

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// Always requests new info
rateLimit = gitHub.getRateLimit();
Expand All @@ -96,7 +96,7 @@ public void testGitHubRateLimit() throws Exception {
previousLimit = rateLimit;

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// Always requests new info
rateLimit = gitHub.getRateLimit();
Expand Down Expand Up @@ -200,7 +200,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception {
Date lastReset = new Date(System.currentTimeMillis() / 1000L);

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// -------------------------------------------------------------
// Before any queries, rate limit starts as null but may be requested
Expand All @@ -224,7 +224,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception {
assertThat(mockGitHub.getRequestCount(), equalTo(1));

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// -------------------------------------------------------------
// First call to /user gets response without rate limit information
Expand All @@ -244,7 +244,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception {
assertThat(mockGitHub.getRequestCount(), equalTo(3));

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// Always requests new info
rateLimit = gitHub.getRateLimit();
Expand All @@ -256,13 +256,13 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception {
assertThat(rateLimit.getResetDate().compareTo(lastReset), equalTo(1));

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// last is still null, because it actually means lastHeaderRateLimit
assertThat(gitHub.lastRateLimit(), CoreMatchers.nullValue());

// ratelimit() tries not to make additional requests, uses queried rate limit since header not available
Thread.sleep(1000);
Thread.sleep(1500);
assertThat(gitHub.rateLimit(), sameInstance(rateLimit));

// -------------------------------------------------------------
Expand All @@ -283,15 +283,15 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception {
GHRateLimit headerRateLimit = rateLimit;

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// ratelimit() uses headerRateLimit if available and headerRateLimit is not expired
assertThat(gitHub.rateLimit(), sameInstance(headerRateLimit));

assertThat(mockGitHub.getRequestCount(), equalTo(5));

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// Always requests new info
rateLimit = gitHub.getRateLimit();
Expand All @@ -308,7 +308,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception {
assertThat(mockGitHub.getRequestCount(), equalTo(6));

// Wait for the header
Thread.sleep(1000);
Thread.sleep(1500);
}

@Test
Expand Down Expand Up @@ -361,7 +361,7 @@ private void executeExpirationTest() throws Exception {
GHRateLimit headerRateLimit = null;

// Give this a moment
Thread.sleep(1000);
Thread.sleep(1500);

// -------------------------------------------------------------
// /user gets response with rate limit information
Expand All @@ -380,7 +380,7 @@ private void executeExpirationTest() throws Exception {
sameInstance(headerRateLimit));

// Nothing changes still valid
Thread.sleep(1000);
Thread.sleep(1500);

assertThat("rateLimit() selects header instance when not expired, does not ask server",
gitHub.rateLimit(),
Expand All @@ -392,7 +392,7 @@ private void executeExpirationTest() throws Exception {
assertThat(mockGitHub.getRequestCount(), equalTo(1));

// This time, rateLimit() should find an expired record and get a new one.
Thread.sleep(3000);
Thread.sleep(2500);

assertThat("Header instance has expired", gitHub.lastRateLimit().isExpired(), is(true));

Expand Down

0 comments on commit 3cddffa

Please sign in to comment.