Merge branch 'assertThatIssues' of https://github.com/alexanderrtaylor/github-api into assertThatIssues

This commit is contained in:
Alex Taylor
2020-01-30 11:22:39 -05:00
79 changed files with 127 additions and 49 deletions

View File

@@ -7,4 +7,4 @@ We love getting PRs, but we hate asking people for the same basic changes every
- [ ] Push your changes to a branch other than `master`. Create your PR from that branch.
- [ ] Add JavaDocs and other comments
- [ ] Write tests that run and pass in CI. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to capture snapshot data.
- [ ] Run `mvn -P ci install site` locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.
- [ ] Run `mvn -D enable-ci install site` locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.

View File

@@ -1,23 +1,68 @@
name: Java CI Build and Test
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
name: build-only (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
java: [ '1.8.0', '11.0.x', '13.0.x' ]
java: [ 11 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Cached .m2
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Install (skipTests)
run: mvn -B install -DskipTests -D enable-ci --file pom.xml
site:
name: site (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Site
run: mvn -B site -D enable-ci --file pom.xml
test:
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ ubuntu, windows ]
java: [ 8, 11, 13 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Maven Download all dependencies
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline -P ci
- name: Maven Build
run: mvn -B install site -P ci --file pom.xml
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Install
run: mvn -B install --file pom.xml

24
pom.xml
View File

@@ -203,6 +203,11 @@
<exclude>org.kohsuke.github.GHPerson.1</exclude>
<exclude>org.kohsuke.github.GHPerson.1.1</exclude>
<!-- These fail coverage on windows because tests are disabled -->
<exclude>org.kohsuke.github.GHAsset</exclude>
<exclude>org.kohsuke.github.GHReleaseBuilder</exclude>
<exclude>org.kohsuke.github.GHRelease</exclude>
<!-- TODO: These still need test coverage -->
<exclude>org.kohsuke.github.GitHub.GHApiInfo</exclude>
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
@@ -580,15 +585,28 @@
</pluginRepositories>
<profiles>
<profile>
<id>ci</id>
<id>ci-non-windows</id>
<activation>
<property>
<name>enable-ci</name>
</property>
<os>
<family>!windows</family>
</os>
</activation>
<properties>
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
</properties>
</profile>
<profile>
<id>ci-all</id>
<activation>
<property>
<name>enable-ci</name>
</property>
</activation>
<properties>
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
</properties>
<build>

View File

@@ -549,9 +549,9 @@ class Requester {
|| e instanceof SSLHandshakeException;
if (connectionError && retries > 0) {
LOGGER.log(INFO,
"Error while connecting to " + uc.getURL() + ". Sleeping " + Requester.retryTimeoutMillis
+ " milliseconds before retrying... ; will try " + retries + " more time(s)",
e);
e.getMessage() + " while connecting to " + uc.getURL() + ". Sleeping "
+ Requester.retryTimeoutMillis + " milliseconds before retrying... ; will try " + retries
+ " more time(s)");
try {
Thread.sleep(Requester.retryTimeoutMillis);
} catch (InterruptedException ie) {

View File

@@ -3,6 +3,8 @@ package org.kohsuke.github;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.kohsuke.github.GHCommit.File;
@@ -895,6 +897,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
@Test
public void blob() throws Exception {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
GHRepository r = gitHub.getRepository("github-api/github-api");
String sha1 = "a12243f2fc5b8c2ba47dd677d0b0c7583539584d";

View File

@@ -1,5 +1,7 @@
package org.kohsuke.github;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Test;
import java.io.File;
@@ -14,6 +16,8 @@ import static org.hamcrest.core.Is.is;
public class LifecycleTest extends AbstractGitHubWireMockTest {
@Test
public void testCreateRepository() throws IOException {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
GHMyself myself = gitHub.getMyself();
// GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);

View File

@@ -20,8 +20,8 @@ import java.net.URL;
import java.security.Permission;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.logging.StreamHandler;
import javax.net.ssl.SSLHandshakeException;
@@ -55,8 +55,7 @@ public class RequesterRetryTest extends AbstractGitHubWireMockTest {
@Before
public void attachLogCapturer() {
logCapturingStream = new ByteArrayOutputStream();
Handler[] handlers = log.getParent().getHandlers();
customLogHandler = new StreamHandler(logCapturingStream, handlers[0].getFormatter());
customLogHandler = new StreamHandler(logCapturingStream, new SimpleFormatter());
log.addHandler(customLogHandler);
}

View File

@@ -6,6 +6,8 @@ import com.squareup.okhttp.Cache;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.github.AbstractGitHubWireMockTest;
@@ -55,7 +57,9 @@ public class GitHubCachingTest extends AbstractGitHubWireMockTest {
}
@Test
public void OkHttpConnector_Cache_MaxAgeDefault_Zero_GitHubRef_Error() throws Exception {
public void testCached404() throws Exception {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
// ISSUE #669
snapshotNotAllowed();

View File

@@ -5,6 +5,8 @@ import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemp
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.github.AbstractGitHubWireMockTest;
@@ -56,7 +58,9 @@ public class GitHubCachingTest extends AbstractGitHubWireMockTest {
}
@Test
public void OkHttpConnector_Cache_MaxAgeDefault_Zero_GitHubRef_Error() throws Exception {
public void testCached404() throws Exception {
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
// ISSUE #669
snapshotNotAllowed();

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b1b91949-0448-415c-998e-a38135c37661.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b1b91949.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:01 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-39714670-728d-4f72-bf18-7b2e6f0ac276.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-39714670.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:02 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b0c1117a-926e-4ccd-baf3-c7813a465a7a.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-b0c1117a.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:02 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename-6cc04a40-acd6-409b-b004-671cbc0c03c8.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename-6cc04a40.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:02 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_bitwiseman_github-api-test-rename2-c1bd7f2a-cab0-4208-b4c8-f2a24bca9169.json",
"bodyFileName": "repos_bitwiseman_github-api-test-rename2-c1bd7f2a.json",
"headers": {
"Date": "Wed, 02 Oct 2019 21:40:03 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -5322,7 +5322,7 @@
"url": "https://api.github.com/repos/github-api/github-api/git/trees/23d4565bd270308657a4e5b65cb6e6bec6736b54"
},
{
"path": "src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetDirectoryContentTrailingSlash/__files",
"path": "src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetDirectoryContentTrailingSlashtestGetDirectoryContentTrailingSlash/__files",
"mode": "040000",
"type": "tree",
"sha": "98db44a404132445a934e7e1b28d0d94a8243a6e",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api_github-api-1c232f75-a19d-455f-b0c5-4278cc80a1e9.json",
"bodyFileName": "repos_github-api_github-api-1c232f75.json",
"headers": {
"Date": "Sat, 26 Oct 2019 01:27:03 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api_github-api_git_trees_master-ffd3e351-e215-4bef-9756-a608a46e6c42.json",
"bodyFileName": "repos_github-api_github-api_git_trees_master-ffd3e351.json",
"headers": {
"Date": "Sat, 26 Oct 2019 01:27:04 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablebranchprotections-02ee4913-4f10-4403-9f86-c911719d8b88.json",
"bodyFileName": "repos_github-api-test-org_temp-02ee4913.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:32 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablebranchprotections_branches_master-040c1d69-d6af-4a94-b583-7d18957bad10.json",
"bodyFileName": "repos_github-api-test-org_temp-040c1d69.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:32 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablebranchprotections_branches_master_protection-aa97cf7b-7c9d-4c01-b7c5-bccc62b30873.json",
"bodyFileName": "repos_github-api-test-org_temp-aa97cf7b.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:32 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_temp-testenablerequirereviewsonly_branches_master_protection-b57fab91-f2a6-4d52-b6d4-05e4a8be5df4.json",
"bodyFileName": "repos_github-api-test-org_temp-testenablerequirereviewsonly_branches_master_protection-b57fab91.json",
"headers": {
"Date": "Tue, 19 Nov 2019 03:01:41 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-e5080341-7377-4f3f-9427-388a105a91a7.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-e5080341.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:44 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50-3cdae02b-77ed-4fb7-96fa-fee8aab5e88d.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50-3cdae02b.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-a5a649cc-8b2b-4c58-ba06-8445261108f8.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-a5a649cc.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:48 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 201,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-a971220e-d7f0-4919-9963-dbcedf5577e7.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-a971220e.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:45 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-5b2d0899-ece6-4a5f-a8dc-4b0f296b21a1.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-5b2d0899.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-4be43bcb-37e3-4c54-8b0a-c190690dc820.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-4be43bcb.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-64a83a7d-a195-4f3b-989e-293e3f23611a.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-64a83a7d.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:46 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-04f85e50-583c-48ad-8d45-55368c542148.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-04f85e50.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:47 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_testdirectory-50_test-file-tocreate-1txt-1d4297f8-515f-48b0-8f13-99894911d416.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest-50_test-file-tocreate-1txt-1d4297f8.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:47 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-dir-with-3-entries-2d908c73-0706-4af1-86d4-005b3b91adba.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-dir-with-3-entries-2d908c73.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:39 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-dir-with-3-entries-462ae734-fe48-4be5-b432-ddd9912ca0e5.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-dir-with-3-entries-462ae734.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:41 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-file-with-content-3e4aa25e-6949-43de-b9e8-bafb84e4b2a5.json",
"bodyFileName": "repos_github-api-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-file-with-content-3e4aa25e.json",
"headers": {
"Date": "Tue, 26 Nov 2019 01:09:51 GMT",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -19,7 +19,7 @@
},
"response": {
"status": 201,
"bodyFileName": "repos_github-api-test-org_github-api_git_refs-d5310eac-a58b-496e-9829-5bfb59231e49.json",
"bodyFileName": "repos_github-api-test-org_github-api_git_refs-d5310eac.json",
"headers": {
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -18,7 +18,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_github-api_git_refs_heads_test_content_ref_cache-709410bf-7c2e-48fa-92a7-f493ffbe7262.json",
"bodyFileName": "repos_github-api-test-org_github-api_git_refs_heads_test_content_ref_cache-709410bf.json",
"headers": {
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -18,7 +18,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_github-api_git_refs_heads_test_content_ref_cache-3964781d-6074-412b-bb7a-f3de1bd9ca9c.json",
"bodyFileName": "repos_github-api-test-org_github-api_git_refs_heads_test_content_ref_cache-3964781d.json",
"headers": {
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
"Content-Type": "application/json; charset=utf-8",

View File

@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_github-api-test-org_github-api_git_refs_heads_test_unmergeable-d47b333a-351b-499c-866b-11122bd52803.json",
"bodyFileName": "repos_github-api-test-org_github-api_git_refs_heads_test_unmergeable-d47b333a.json",
"headers": {
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
"Content-Type": "application/json; charset=utf-8",