From ebb7fedf6ea0c5ba4051b39ce4e027b419d313ee Mon Sep 17 00:00:00 2001 From: dmitriya Date: Tue, 20 Jun 2023 08:49:50 +0300 Subject: [PATCH 1/7] issue #1484: Add support for deleting files from tree --- .../org/kohsuke/github/GHTreeBuilder.java | 26 +++- .../org/kohsuke/github/GHTreeBuilderTest.java | 34 +++++ ...os_hub4j-test-org_ghtreebuildertest-2.json | 121 ++++++++++++++++++ ...1cd95c3caf31a16ff21751a06a7feb039f-12.json | 72 +++++++++++ ...d9512f639acc6d48439621026cf8410f3a-19.json | 60 +++++++++ ...ebuildertest_contents_data_val1dat-11.json | 18 +++ ...buildertest_contents_doc_readmetxt-10.json | 18 +++ ...buildertest_contents_doc_readmetxt-18.json | 18 +++ ...-org_ghtreebuildertest_git_commits-16.json | 34 +++++ ...t-org_ghtreebuildertest_git_commits-8.json | 34 +++++ ...reebuildertest_git_refs_heads_main-13.json | 10 ++ ...reebuildertest_git_refs_heads_main-17.json | 10 ++ ...treebuildertest_git_refs_heads_main-3.json | 10 ++ ...treebuildertest_git_refs_heads_main-9.json | 10 ++ ...st-org_ghtreebuildertest_git_trees-15.json | 22 ++++ ...est-org_ghtreebuildertest_git_trees-7.json | 29 +++++ ...f79def8e437d825e0116def4be6be56026-14.json | 29 +++++ ...rg_ghtreebuildertest_git_trees_main-4.json | 15 +++ .../wiremock/testDelete/__files/user-1.json | 46 +++++++ ...os_hub4j-test-org_ghtreebuildertest-2.json | 51 ++++++++ ...1cd95c3caf31a16ff21751a06a7feb039f-12.json | 51 ++++++++ ...d9512f639acc6d48439621026cf8410f3a-19.json | 51 ++++++++ ...ebuildertest_contents_data_val1dat-11.json | 54 ++++++++ ...ebuildertest_contents_data_val1dat-20.json | 47 +++++++ ...buildertest_contents_doc_readmetxt-10.json | 54 ++++++++ ...buildertest_contents_doc_readmetxt-18.json | 53 ++++++++ ...est-org_ghtreebuildertest_git_blobs-5.json | 58 +++++++++ ...est-org_ghtreebuildertest_git_blobs-6.json | 58 +++++++++ ...-org_ghtreebuildertest_git_commits-16.json | 58 +++++++++ ...t-org_ghtreebuildertest_git_commits-8.json | 58 +++++++++ ...reebuildertest_git_refs_heads_main-13.json | 54 ++++++++ ...reebuildertest_git_refs_heads_main-17.json | 57 +++++++++ ...treebuildertest_git_refs_heads_main-3.json | 55 ++++++++ ...treebuildertest_git_refs_heads_main-9.json | 57 +++++++++ ...st-org_ghtreebuildertest_git_trees-15.json | 58 +++++++++ ...est-org_ghtreebuildertest_git_trees-7.json | 58 +++++++++ ...f79def8e437d825e0116def4be6be56026-14.json | 51 ++++++++ ...rg_ghtreebuildertest_git_trees_main-4.json | 51 ++++++++ .../wiremock/testDelete/mappings/user-1.json | 51 ++++++++ 39 files changed, 1700 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/user-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-20.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/user-1.json diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java index 8d4a3b91c9..aa9552f85f 100644 --- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java @@ -22,7 +22,7 @@ public class GHTreeBuilder { // Issue #636: Create Tree no longer accepts null value in sha field @JsonInclude(Include.NON_NULL) @SuppressFBWarnings("URF_UNREAD_FIELD") - private static final class TreeEntry { + private static class TreeEntry { private final String path; private final String mode; @@ -37,6 +37,15 @@ private TreeEntry(String path, String mode, String type) { } } + private static class DeleteTreeEntry extends TreeEntry { + @JsonInclude + private String sha; + + private DeleteTreeEntry(String path, String mode, String type) { + super(path, mode, type); + } + } + /** * Instantiates a new GH tree builder. * @@ -147,6 +156,21 @@ public GHTreeBuilder add(String path, byte[] content, boolean executable) { } } + /** + * Removes an entry with the given path from base tree. + * + * @param path + * the file path in the tree + * @param executable + * true, if the file should be executable + * @return this GHTreeBuilder + */ + public GHTreeBuilder delete(String path, boolean executable) { + TreeEntry entry = new DeleteTreeEntry(path, executable ? "100755" : "100644", "blob"); + treeEntries.add(entry); + return this; + } + /** * Adds a new entry with the given text content to the tree. * diff --git a/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java b/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java index a9260cb926..d0af8dc7c4 100644 --- a/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java @@ -134,6 +134,40 @@ public void testAdd() throws Exception { } + @Test + public void testDelete() throws Exception { + // add test tree + treeBuilder.add(PATH_README, CONTENT_README, false); + treeBuilder.add(PATH_DATA1, CONTENT_DATA1, false); + + GHCommit commit = updateTree(); + + assertThat(getFileSize(PATH_README), equalTo((long) CONTENT_README.length())); + assertThat(getFileSize(PATH_DATA1), equalTo((long) CONTENT_DATA1.length)); + + assertThat(commit.getCommitShortInfo().getAuthor().getEmail(), equalTo("author@author.com")); + assertThat(commit.getCommitShortInfo().getCommitter().getEmail(), equalTo("committer@committer.com")); + + // remove a file from tree + mainRef = repo.getRef("heads/main"); + treeBuilder = repo.createTree().baseTree(commit.getTree().getSha()); + treeBuilder.delete(PATH_DATA1, false); + + GHCommit deleteCommit = updateTree(); + + assertThat(getFileSize(PATH_README), equalTo((long) CONTENT_README.length())); + + assertThat(deleteCommit.getCommitShortInfo().getAuthor().getEmail(), equalTo("author@author.com")); + assertThat(deleteCommit.getCommitShortInfo().getCommitter().getEmail(), equalTo("committer@committer.com")); + + try { + getFileSize(PATH_DATA1); + fail("File " + PATH_DATA1 + " should not exist"); + } catch (IOException e) { + assertThat(e.getMessage(), stringContainsInOrder(PATH_DATA1, "Not Found")); + } + } + private GHCommit updateTree() throws IOException { String treeSha = treeBuilder.create().getSha(); GHCommit commit = new GHCommitBuilder(repo).message("Add files") diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest-2.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest-2.json new file mode 100644 index 0000000000..cb012a1256 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest-2.json @@ -0,0 +1,121 @@ +{ + "id": 654900107, + "node_id": "R_kgDOJwj7iw", + "name": "GHTreeBuilderTest", + "full_name": "hub4j-test-org/GHTreeBuilderTest", + "private": true, + "owner": { + "login": "hub4j-test-org", + "id": 1793410, + "node_id": "MDQ6VXNlcjE3OTM0MTA=", + "avatar_url": "https://avatars.githubusercontent.com/u/1793410?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/deployments", + "created_at": "2023-06-17T09:21:30Z", + "updated_at": "2023-06-17T09:21:30Z", + "pushed_at": "2023-06-20T05:28:20Z", + "git_url": "git://github.com/hub4j-test-org/GHTreeBuilderTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHTreeBuilderTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest", + "homepage": null, + "size": 4, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "AANV3AUXZXCI3AHCWHMMVFLESE5DS", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json new file mode 100644 index 0000000000..225ce2948e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json @@ -0,0 +1,72 @@ +{ + "sha": "7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "node_id": "MDY6Q29tbWl0NjU0OTAwMTA3OjdlODg4YTFjZDk1YzNjYWYzMWExNmZmMjE3NTFhMDZhN2ZlYjAzOWY=", + "commit": { + "author": { + "name": "author", + "email": "author@author.com", + "date": "2021-01-23T20:20:25Z" + }, + "committer": { + "name": "committer", + "email": "committer@committer.com", + "date": "2021-01-23T20:20:25Z" + }, + "message": "Add files", + "tree": { + "sha": "0efbfcf79def8e437d825e0116def4be6be56026", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/0efbfcf79def8e437d825e0116def4be6be56026" + }, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f/comments", + "author": null, + "committer": null, + "parents": [ + { + "sha": "172349212fb19ffa4f33dcced3263c6963dc750a", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits/172349212fb19ffa4f33dcced3263c6963dc750a", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/172349212fb19ffa4f33dcced3263c6963dc750a" + } + ], + "stats": { + "total": 2, + "additions": 2, + "deletions": 0 + }, + "files": [ + { + "sha": "aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74", + "filename": "data/val1.dat", + "status": "added", + "additions": 1, + "deletions": 0, + "changes": 1, + "blob_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/7e888a1cd95c3caf31a16ff21751a06a7feb039f/data%2Fval1.dat", + "raw_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/raw/7e888a1cd95c3caf31a16ff21751a06a7feb039f/data%2Fval1.dat", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/data%2Fval1.dat?ref=7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "patch": "@@ -0,0 +1 @@\n+\u0001\u0002\u0003\n\\ No newline at end of file" + }, + { + "sha": "fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "filename": "doc/readme.txt", + "status": "added", + "additions": 1, + "deletions": 0, + "changes": 1, + "blob_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/7e888a1cd95c3caf31a16ff21751a06a7feb039f/doc%2Freadme.txt", + "raw_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/raw/7e888a1cd95c3caf31a16ff21751a06a7feb039f/doc%2Freadme.txt", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc%2Freadme.txt?ref=7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "patch": "@@ -0,0 +1 @@\n+Thanks for using our application!" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json new file mode 100644 index 0000000000..2ba4afd323 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json @@ -0,0 +1,60 @@ +{ + "sha": "7f9b11d9512f639acc6d48439621026cf8410f3a", + "node_id": "MDY6Q29tbWl0NjU0OTAwMTA3OjdmOWIxMWQ5NTEyZjYzOWFjYzZkNDg0Mzk2MjEwMjZjZjg0MTBmM2E=", + "commit": { + "author": { + "name": "author", + "email": "author@author.com", + "date": "2021-01-23T20:20:25Z" + }, + "committer": { + "name": "committer", + "email": "committer@committer.com", + "date": "2021-01-23T20:20:25Z" + }, + "message": "Add files", + "tree": { + "sha": "f9a619cb835ac407e0a464618fc59386be70bd63", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/f9a619cb835ac407e0a464618fc59386be70bd63" + }, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7f9b11d9512f639acc6d48439621026cf8410f3a", + "comment_count": 0, + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } + }, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits/7f9b11d9512f639acc6d48439621026cf8410f3a", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/7f9b11d9512f639acc6d48439621026cf8410f3a", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits/7f9b11d9512f639acc6d48439621026cf8410f3a/comments", + "author": null, + "committer": null, + "parents": [ + { + "sha": "7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/7e888a1cd95c3caf31a16ff21751a06a7feb039f" + } + ], + "stats": { + "total": 1, + "additions": 0, + "deletions": 1 + }, + "files": [ + { + "sha": "aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74", + "filename": "data/val1.dat", + "status": "removed", + "additions": 0, + "deletions": 1, + "changes": 1, + "blob_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/7e888a1cd95c3caf31a16ff21751a06a7feb039f/data%2Fval1.dat", + "raw_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/raw/7e888a1cd95c3caf31a16ff21751a06a7feb039f/data%2Fval1.dat", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/data%2Fval1.dat?ref=7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "patch": "@@ -1 +0,0 @@\n-\u0001\u0002\u0003\n\\ No newline at end of file" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json new file mode 100644 index 0000000000..dc0d19abb7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json @@ -0,0 +1,18 @@ +{ + "name": "val1.dat", + "path": "data/val1.dat", + "sha": "aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74", + "size": 3, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/data/val1.dat?ref=main", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/main/data/val1.dat", + "git_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/GHTreeBuilderTest/main/data/val1.dat?token=AANV3AQG25IMIIRS2WYVBALESE4UY", + "type": "file", + "content": "AQID\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/data/val1.dat?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74", + "html": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/main/data/val1.dat" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json new file mode 100644 index 0000000000..a3a4409999 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json @@ -0,0 +1,18 @@ +{ + "name": "readme.txt", + "path": "doc/readme.txt", + "sha": "fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "size": 34, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc/readme.txt?ref=main", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/main/doc/readme.txt", + "git_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/GHTreeBuilderTest/main/doc/readme.txt?token=AANV3AUAKUQF4Q66G35XPVLESE4UY", + "type": "file", + "content": "VGhhbmtzIGZvciB1c2luZyBvdXIgYXBwbGljYXRpb24hCg==\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc/readme.txt?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "html": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/main/doc/readme.txt" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json new file mode 100644 index 0000000000..bdff55b213 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json @@ -0,0 +1,18 @@ +{ + "name": "readme.txt", + "path": "doc/readme.txt", + "sha": "fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "size": 34, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc/readme.txt?ref=main", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/main/doc/readme.txt", + "git_url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/GHTreeBuilderTest/main/doc/readme.txt?token=AANV3ATL6IK7FMQNM2ZOCG3ESE4U6", + "type": "file", + "content": "VGhhbmtzIGZvciB1c2luZyBvdXIgYXBwbGljYXRpb24hCg==\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc/readme.txt?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/fbbc875b17d1e17da06b4ee8fda46e2596c41f3c", + "html": "https://github.com/hub4j-test-org/GHTreeBuilderTest/blob/main/doc/readme.txt" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json new file mode 100644 index 0000000000..fb216cbe10 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json @@ -0,0 +1,34 @@ +{ + "sha": "7f9b11d9512f639acc6d48439621026cf8410f3a", + "node_id": "MDY6Q29tbWl0NjU0OTAwMTA3OjdmOWIxMWQ5NTEyZjYzOWFjYzZkNDg0Mzk2MjEwMjZjZjg0MTBmM2E=", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7f9b11d9512f639acc6d48439621026cf8410f3a", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/7f9b11d9512f639acc6d48439621026cf8410f3a", + "author": { + "name": "author", + "email": "author@author.com", + "date": "2021-01-23T20:20:25Z" + }, + "committer": { + "name": "committer", + "email": "committer@committer.com", + "date": "2021-01-23T20:20:25Z" + }, + "tree": { + "sha": "f9a619cb835ac407e0a464618fc59386be70bd63", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/f9a619cb835ac407e0a464618fc59386be70bd63" + }, + "message": "Add files", + "parents": [ + { + "sha": "7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/7e888a1cd95c3caf31a16ff21751a06a7feb039f" + } + ], + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json new file mode 100644 index 0000000000..4f4ff447cf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json @@ -0,0 +1,34 @@ +{ + "sha": "7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "node_id": "MDY6Q29tbWl0NjU0OTAwMTA3OjdlODg4YTFjZDk1YzNjYWYzMWExNmZmMjE3NTFhMDZhN2ZlYjAzOWY=", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "author": { + "name": "author", + "email": "author@author.com", + "date": "2021-01-23T20:20:25Z" + }, + "committer": { + "name": "committer", + "email": "committer@committer.com", + "date": "2021-01-23T20:20:25Z" + }, + "tree": { + "sha": "0efbfcf79def8e437d825e0116def4be6be56026", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/0efbfcf79def8e437d825e0116def4be6be56026" + }, + "message": "Add files", + "parents": [ + { + "sha": "172349212fb19ffa4f33dcced3263c6963dc750a", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/172349212fb19ffa4f33dcced3263c6963dc750a", + "html_url": "https://github.com/hub4j-test-org/GHTreeBuilderTest/commit/172349212fb19ffa4f33dcced3263c6963dc750a" + } + ], + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json new file mode 100644 index 0000000000..6d6251930d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json @@ -0,0 +1,10 @@ +{ + "ref": "refs/heads/main", + "node_id": "REF_kwDOJwj7i69yZWZzL2hlYWRzL21haW4", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "object": { + "sha": "7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json new file mode 100644 index 0000000000..ec2d79dbc9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json @@ -0,0 +1,10 @@ +{ + "ref": "refs/heads/main", + "node_id": "REF_kwDOJwj7i69yZWZzL2hlYWRzL21haW4", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "object": { + "sha": "7f9b11d9512f639acc6d48439621026cf8410f3a", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7f9b11d9512f639acc6d48439621026cf8410f3a" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json new file mode 100644 index 0000000000..7daaa422c0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json @@ -0,0 +1,10 @@ +{ + "ref": "refs/heads/main", + "node_id": "REF_kwDOJwj7i69yZWZzL2hlYWRzL21haW4", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "object": { + "sha": "172349212fb19ffa4f33dcced3263c6963dc750a", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/172349212fb19ffa4f33dcced3263c6963dc750a" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json new file mode 100644 index 0000000000..6d6251930d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json @@ -0,0 +1,10 @@ +{ + "ref": "refs/heads/main", + "node_id": "REF_kwDOJwj7i69yZWZzL2hlYWRzL21haW4", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "object": { + "sha": "7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "type": "commit", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json new file mode 100644 index 0000000000..ecec5ac01a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json @@ -0,0 +1,22 @@ +{ + "sha": "f9a619cb835ac407e0a464618fc59386be70bd63", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/f9a619cb835ac407e0a464618fc59386be70bd63", + "tree": [ + { + "path": "README.md", + "mode": "100644", + "type": "blob", + "sha": "958337fe1f522a58e5e7098cc61a2917db1c9643", + "size": 19, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/958337fe1f522a58e5e7098cc61a2917db1c9643" + }, + { + "path": "doc", + "mode": "040000", + "type": "tree", + "sha": "30bda54e864ecafd021698ddf75bb9378dd755e5", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/30bda54e864ecafd021698ddf75bb9378dd755e5" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json new file mode 100644 index 0000000000..a2661a636b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json @@ -0,0 +1,29 @@ +{ + "sha": "0efbfcf79def8e437d825e0116def4be6be56026", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/0efbfcf79def8e437d825e0116def4be6be56026", + "tree": [ + { + "path": "README.md", + "mode": "100644", + "type": "blob", + "sha": "958337fe1f522a58e5e7098cc61a2917db1c9643", + "size": 19, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/958337fe1f522a58e5e7098cc61a2917db1c9643" + }, + { + "path": "data", + "mode": "040000", + "type": "tree", + "sha": "3ad1a259f440f9995a93ecfd9de5b6ad23d88455", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/3ad1a259f440f9995a93ecfd9de5b6ad23d88455" + }, + { + "path": "doc", + "mode": "040000", + "type": "tree", + "sha": "30bda54e864ecafd021698ddf75bb9378dd755e5", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/30bda54e864ecafd021698ddf75bb9378dd755e5" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json new file mode 100644 index 0000000000..a2661a636b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json @@ -0,0 +1,29 @@ +{ + "sha": "0efbfcf79def8e437d825e0116def4be6be56026", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/0efbfcf79def8e437d825e0116def4be6be56026", + "tree": [ + { + "path": "README.md", + "mode": "100644", + "type": "blob", + "sha": "958337fe1f522a58e5e7098cc61a2917db1c9643", + "size": 19, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/958337fe1f522a58e5e7098cc61a2917db1c9643" + }, + { + "path": "data", + "mode": "040000", + "type": "tree", + "sha": "3ad1a259f440f9995a93ecfd9de5b6ad23d88455", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/3ad1a259f440f9995a93ecfd9de5b6ad23d88455" + }, + { + "path": "doc", + "mode": "040000", + "type": "tree", + "sha": "30bda54e864ecafd021698ddf75bb9378dd755e5", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/30bda54e864ecafd021698ddf75bb9378dd755e5" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json new file mode 100644 index 0000000000..3cd4ce1100 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json @@ -0,0 +1,15 @@ +{ + "sha": "172349212fb19ffa4f33dcced3263c6963dc750a", + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/172349212fb19ffa4f33dcced3263c6963dc750a", + "tree": [ + { + "path": "README.md", + "mode": "100644", + "type": "blob", + "sha": "958337fe1f522a58e5e7098cc61a2917db1c9643", + "size": 19, + "url": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/958337fe1f522a58e5e7098cc61a2917db1c9643" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/user-1.json new file mode 100644 index 0000000000..43b7923283 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/__files/user-1.json @@ -0,0 +1,46 @@ +{ + "login": "davseitsev", + "id": 1793410, + "node_id": "MDQ6VXNlcjE3OTM0MTA=", + "avatar_url": "https://avatars.githubusercontent.com/u/1793410?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/davseitsev", + "html_url": "https://github.com/davseitsev", + "followers_url": "https://api.github.com/users/davseitsev/followers", + "following_url": "https://api.github.com/users/davseitsev/following{/other_user}", + "gists_url": "https://api.github.com/users/davseitsev/gists{/gist_id}", + "starred_url": "https://api.github.com/users/davseitsev/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/davseitsev/subscriptions", + "organizations_url": "https://api.github.com/users/davseitsev/orgs", + "repos_url": "https://api.github.com/users/davseitsev/repos", + "events_url": "https://api.github.com/users/davseitsev/events{/privacy}", + "received_events_url": "https://api.github.com/users/davseitsev/received_events", + "type": "User", + "site_admin": false, + "name": "Dmitriy Avseitsev", + "company": "Wix", + "blog": "", + "location": "Ukraine", + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "public_repos": 4, + "public_gists": 0, + "followers": 3, + "following": 2, + "created_at": "2012-05-30T12:32:55Z", + "updated_at": "2023-06-17T08:08:30Z", + "private_gists": 0, + "total_private_repos": 4, + "owned_private_repos": 1, + "disk_usage": 29, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest-2.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest-2.json new file mode 100644 index 0000000000..389099f536 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest-2.json @@ -0,0 +1,51 @@ +{ + "id": "b245a8a9-81e7-4ca5-a095-277e85a86699", + "name": "repos_hub4j-test-org_ghtreebuildertest", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest-2.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"75d1ccbff669c56882f6a4f7fd8517c83624f0a2c501ba7c552652ce42d28d25\"", + "Last-Modified": "Sat, 17 Jun 2023 09:21:30 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4944", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "56", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F4:DD38:397C53B:3A04DDB:6491390C" + } + }, + "uuid": "b245a8a9-81e7-4ca5-a095-277e85a86699", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json new file mode 100644 index 0000000000..bc0e3dfe8b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json @@ -0,0 +1,51 @@ +{ + "id": "3ea508b9-5adb-40ec-afe3-d623090f54b6", + "name": "repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_commits_7e888a1cd95c3caf31a16ff21751a06a7feb039f-12.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"f423a98200a98ee8f47fc91c05aa2fa94bab34aafe25c055d8adfb48dcf62d97\"", + "Last-Modified": "Sat, 23 Jan 2021 20:20:25 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4934", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "66", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6FE:CAB0:38E8D78:3971640:64913910" + } + }, + "uuid": "3ea508b9-5adb-40ec-afe3-d623090f54b6", + "persistent": true, + "insertionIndex": 12 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json new file mode 100644 index 0000000000..eca17c0e11 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json @@ -0,0 +1,51 @@ +{ + "id": "37439e9b-a067-4b6a-8f12-334c323f9672", + "name": "repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/commits/7f9b11d9512f639acc6d48439621026cf8410f3a", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_commits_7f9b11d9512f639acc6d48439621026cf8410f3a-19.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"5e2a20a7a874d008dcc559b084c18a197e0531f4da8808b698ebb6758941787c\"", + "Last-Modified": "Sat, 23 Jan 2021 20:20:25 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4927", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "73", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E705:CAB0:38E9325:3971BFD:64913913" + } + }, + "uuid": "37439e9b-a067-4b6a-8f12-334c323f9672", + "persistent": true, + "insertionIndex": 19 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json new file mode 100644 index 0000000000..b343ea7ef0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json @@ -0,0 +1,54 @@ +{ + "id": "c85bcca2-d182-42a1-bc5b-b01c002b1692", + "name": "repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/contents/data/val1.dat", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-11.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:48 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74\"", + "Last-Modified": "Sat, 23 Jan 2021 20:20:25 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4935", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "65", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6FD:5618:3ACA2CA:3B52B8A:64913910" + } + }, + "uuid": "c85bcca2-d182-42a1-bc5b-b01c002b1692", + "persistent": true, + "scenarioName": "scenario-3-repos-hub4j-test-org-GHTreeBuilderTest-contents-data-val1.dat", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-3-repos-hub4j-test-org-GHTreeBuilderTest-contents-data-val1.dat-2", + "insertionIndex": 11 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-20.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-20.json new file mode 100644 index 0000000000..8981eddc73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat-20.json @@ -0,0 +1,47 @@ +{ + "id": "178b3392-4b27-4263-b453-63f7b92cd78f", + "name": "repos_hub4j-test-org_ghtreebuildertest_contents_data_val1dat", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/contents/data/val1.dat", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/repos#get-repository-content\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:52 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4926", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "74", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "E706:C35C:34F5A75:357E34F:64913913" + } + }, + "uuid": "178b3392-4b27-4263-b453-63f7b92cd78f", + "persistent": true, + "scenarioName": "scenario-3-repos-hub4j-test-org-GHTreeBuilderTest-contents-data-val1.dat", + "requiredScenarioState": "scenario-3-repos-hub4j-test-org-GHTreeBuilderTest-contents-data-val1.dat-2", + "insertionIndex": 20 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json new file mode 100644 index 0000000000..6217dffd7c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json @@ -0,0 +1,54 @@ +{ + "id": "91da6707-80ba-4686-9155-4c4c7368f28c", + "name": "repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc/readme.txt", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-10.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:48 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"fbbc875b17d1e17da06b4ee8fda46e2596c41f3c\"", + "Last-Modified": "Sat, 23 Jan 2021 20:20:25 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4936", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "64", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6FC:CAB0:38E8BF8:39714CD:64913910" + } + }, + "uuid": "91da6707-80ba-4686-9155-4c4c7368f28c", + "persistent": true, + "scenarioName": "scenario-2-repos-hub4j-test-org-GHTreeBuilderTest-contents-doc-readme.txt", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-2-repos-hub4j-test-org-GHTreeBuilderTest-contents-doc-readme.txt-2", + "insertionIndex": 10 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json new file mode 100644 index 0000000000..fca434b8b8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json @@ -0,0 +1,53 @@ +{ + "id": "b8c1379e-3668-459d-9a07-bb1f80773ebe", + "name": "repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/contents/doc/readme.txt", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_contents_doc_readmetxt-18.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"fbbc875b17d1e17da06b4ee8fda46e2596c41f3c\"", + "Last-Modified": "Sat, 23 Jan 2021 20:20:25 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4928", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "72", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E704:2866:377A46A:3802D1D:64913913" + } + }, + "uuid": "b8c1379e-3668-459d-9a07-bb1f80773ebe", + "persistent": true, + "scenarioName": "scenario-2-repos-hub4j-test-org-GHTreeBuilderTest-contents-doc-readme.txt", + "requiredScenarioState": "scenario-2-repos-hub4j-test-org-GHTreeBuilderTest-contents-doc-readme.txt-2", + "insertionIndex": 18 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-5.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-5.json new file mode 100644 index 0000000000..124b560cac --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-5.json @@ -0,0 +1,58 @@ +{ + "id": "6be43f18-f690-4dcf-97db-4a7f0dc3992f", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_blobs", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"encoding\":\"base64\",\"content\":\"VGhhbmtzIGZvciB1c2luZyBvdXIgYXBwbGljYXRpb24hCg==\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"sha\":\"fbbc875b17d1e17da06b4ee8fda46e2596c41f3c\",\"url\":\"https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/fbbc875b17d1e17da06b4ee8fda46e2596c41f3c\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:46 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"163f83bbd1173801e13129b664eefeca4bcffadac061620acf689bf7c9ca2cfc\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4941", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "59", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F7:2F49:B6BC1F:B99013:6491390D", + "Location": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/fbbc875b17d1e17da06b4ee8fda46e2596c41f3c" + } + }, + "uuid": "6be43f18-f690-4dcf-97db-4a7f0dc3992f", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-6.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-6.json new file mode 100644 index 0000000000..902afde443 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_blobs-6.json @@ -0,0 +1,58 @@ +{ + "id": "491e1e6a-996e-4ce8-9178-93198dcb077e", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_blobs", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"encoding\":\"base64\",\"content\":\"AQID\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"sha\":\"aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74\",\"url\":\"https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:46 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"ece9a63bb7a10d9be9df978bd3030b47be2b2a1e01cc5aa6fae0ad83e3cc3998\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4940", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "60", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F8:12658:3A94A56:3B1D323:6491390E", + "Location": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/blobs/aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74" + } + }, + "uuid": "491e1e6a-996e-4ce8-9178-93198dcb077e", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json new file mode 100644 index 0000000000..60c4951474 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json @@ -0,0 +1,58 @@ +{ + "id": "4157028e-c59c-4e4a-8e69-942880061268", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_commits", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/commits", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"committer\":{\"name\":\"committer\",\"email\":\"committer@committer.com\",\"date\":\"2021-01-23T20:20:25Z\"},\"author\":{\"name\":\"author\",\"email\":\"author@author.com\",\"date\":\"2021-01-23T20:20:25Z\"},\"tree\":\"f9a619cb835ac407e0a464618fc59386be70bd63\",\"message\":\"Add files\",\"parents\":[\"7e888a1cd95c3caf31a16ff21751a06a7feb039f\"]}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_commits-16.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"3238fa5eff984f4868d1c525a2a58bc3fbe0368600b2ab84600f1e0370a548d1\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4930", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "70", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E702:2D3A:1F58940:1FBC471:64913912", + "Location": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7f9b11d9512f639acc6d48439621026cf8410f3a" + } + }, + "uuid": "4157028e-c59c-4e4a-8e69-942880061268", + "persistent": true, + "insertionIndex": 16 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json new file mode 100644 index 0000000000..e52e217bc9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json @@ -0,0 +1,58 @@ +{ + "id": "ae17f42d-677c-4d51-97ee-a431fa113296", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_commits", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/commits", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"committer\":{\"name\":\"committer\",\"email\":\"committer@committer.com\",\"date\":\"2021-01-23T20:20:25Z\"},\"author\":{\"name\":\"author\",\"email\":\"author@author.com\",\"date\":\"2021-01-23T20:20:25Z\"},\"tree\":\"0efbfcf79def8e437d825e0116def4be6be56026\",\"message\":\"Add files\",\"parents\":[\"172349212fb19ffa4f33dcced3263c6963dc750a\"]}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_commits-8.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:47 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"9550476a519cba23cbf802381ee9325cacbcb788ce7932314fbad47e7c23e813\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4938", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "62", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6FA:DD38:397CB0C:3A053BA:6491390F", + "Location": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/commits/7e888a1cd95c3caf31a16ff21751a06a7feb039f" + } + }, + "uuid": "ae17f42d-677c-4d51-97ee-a431fa113296", + "persistent": true, + "insertionIndex": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json new file mode 100644 index 0000000000..e3e689b399 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json @@ -0,0 +1,54 @@ +{ + "id": "a007310d-5f4d-46c4-bee5-e85b006dd505", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-13.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"bba22ee793ee364dfd8404230d5d7b55b227def742a402a50d03bbe2dbed74f0\"", + "Last-Modified": "Sat, 17 Jun 2023 09:21:30 GMT", + "X-Poll-Interval": "300", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4933", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "67", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6FF:C35C:34F54F4:357DDA7:64913911" + } + }, + "uuid": "a007310d-5f4d-46c4-bee5-e85b006dd505", + "persistent": true, + "scenarioName": "scenario-1-repos-hub4j-test-org-GHTreeBuilderTest-git-refs-heads-main", + "requiredScenarioState": "scenario-1-repos-hub4j-test-org-GHTreeBuilderTest-git-refs-heads-main-2", + "insertionIndex": 13 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json new file mode 100644 index 0000000000..6499c6f655 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json @@ -0,0 +1,57 @@ +{ + "id": "8ac43b56-e027-48ee-8152-05ad21f3190a", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"force\":false,\"sha\":\"7f9b11d9512f639acc6d48439621026cf8410f3a\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-17.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"d2080b37f2f5091ab6fdb33a43b7545e716e14235ed485849cace3cae73c230f\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4929", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "71", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E703:E5A4:3923A92:39AC37A:64913912" + } + }, + "uuid": "8ac43b56-e027-48ee-8152-05ad21f3190a", + "persistent": true, + "insertionIndex": 17 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json new file mode 100644 index 0000000000..6896999f3d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json @@ -0,0 +1,55 @@ +{ + "id": "f6c2c882-fd90-4cac-bf53-a92a7cb4d0e4", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-3.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"afd11955e216e7cb970f6a80de3ed846d9e5374ec870029f916fd41e464bd367\"", + "Last-Modified": "Tue, 20 Jun 2023 05:28:20 GMT", + "X-Poll-Interval": "300", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4943", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "57", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F5:2F49:B6BA8B:B98E55:6491390D" + } + }, + "uuid": "f6c2c882-fd90-4cac-bf53-a92a7cb4d0e4", + "persistent": true, + "scenarioName": "scenario-1-repos-hub4j-test-org-GHTreeBuilderTest-git-refs-heads-main", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-hub4j-test-org-GHTreeBuilderTest-git-refs-heads-main-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json new file mode 100644 index 0000000000..e31afa11bf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json @@ -0,0 +1,57 @@ +{ + "id": "69a41ff0-b112-4fa3-930f-097886aba03d", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/refs/heads/main", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"force\":false,\"sha\":\"7e888a1cd95c3caf31a16ff21751a06a7feb039f\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_refs_heads_main-9.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:48 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"bba22ee793ee364dfd8404230d5d7b55b227def742a402a50d03bbe2dbed74f0\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4937", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "63", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6FB:C35C:34F51BF:357DA6E:6491390F" + } + }, + "uuid": "69a41ff0-b112-4fa3-930f-097886aba03d", + "persistent": true, + "insertionIndex": 9 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json new file mode 100644 index 0000000000..2f184b258c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json @@ -0,0 +1,58 @@ +{ + "id": "5d86fc86-f3cc-4939-bc99-8c5b59b5c2e3", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_trees", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/trees", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"base_tree\":\"0efbfcf79def8e437d825e0116def4be6be56026\",\"tree\":[{\"path\":\"data/val1.dat\",\"mode\":\"100644\",\"type\":\"blob\",\"sha\":null}]}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_trees-15.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"7994c86d53091fb0af7cab2c7eeab20a96a1c7d5c3003ab3999a492fa6252cc6\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4931", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "69", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E701:12658:3A952B2:3B1DBA7:64913911", + "Location": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/f9a619cb835ac407e0a464618fc59386be70bd63" + } + }, + "uuid": "5d86fc86-f3cc-4939-bc99-8c5b59b5c2e3", + "persistent": true, + "insertionIndex": 15 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json new file mode 100644 index 0000000000..82e757c5c8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json @@ -0,0 +1,58 @@ +{ + "id": "c7f39a2b-e126-4a9a-96a5-f3ae55c6c333", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_trees", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/trees", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"base_tree\":\"172349212fb19ffa4f33dcced3263c6963dc750a\",\"tree\":[{\"path\":\"doc/readme.txt\",\"mode\":\"100644\",\"type\":\"blob\",\"sha\":\"fbbc875b17d1e17da06b4ee8fda46e2596c41f3c\"},{\"path\":\"data/val1.dat\",\"mode\":\"100644\",\"type\":\"blob\",\"sha\":\"aed2973e4b8a7ff1b30ff5c4751e5a2b38989e74\"}]}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_trees-7.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:47 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"cc5396cc7dbc55b26008e889b238f9df01a65a0142ff0627a62834f9dfaa44f1\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4939", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "61", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F9:6FC5:3DA3361:3E2BC16:6491390E", + "Location": "https://api.github.com/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/0efbfcf79def8e437d825e0116def4be6be56026" + } + }, + "uuid": "c7f39a2b-e126-4a9a-96a5-f3ae55c6c333", + "persistent": true, + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json new file mode 100644 index 0000000000..fcd59b25b3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json @@ -0,0 +1,51 @@ +{ + "id": "31069baa-d4ff-44b5-b82f-ee9be05e8467", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/0efbfcf79def8e437d825e0116def4be6be56026", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_trees_0efbfcf79def8e437d825e0116def4be6be56026-14.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=86400, s-maxage=86400", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"cc5396cc7dbc55b26008e889b238f9df01a65a0142ff0627a62834f9dfaa44f1\"", + "Last-Modified": "Sat, 17 Jun 2023 09:21:30 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4932", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "68", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E700:B799:391DA3C:39A6308:64913911" + } + }, + "uuid": "31069baa-d4ff-44b5-b82f-ee9be05e8467", + "persistent": true, + "insertionIndex": 14 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json new file mode 100644 index 0000000000..b7bb86ffd5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json @@ -0,0 +1,51 @@ +{ + "id": "c6e73b5b-8987-4bf1-a132-284d5b8b4d6b", + "name": "repos_hub4j-test-org_ghtreebuildertest_git_trees_main", + "request": { + "url": "/repos/hub4j-test-org/GHTreeBuilderTest/git/trees/main?recursive=1", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j-test-org_ghtreebuildertest_git_trees_main-4.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"5f04be028cd2ad3a5e1019d3393811a6e086293c7b6d13ad93ff7e57881f8701\"", + "Last-Modified": "Sat, 17 Jun 2023 09:21:30 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4942", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "58", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F6:12914:39240C1:39AC978:6491390D" + } + }, + "uuid": "c6e73b5b-8987-4bf1-a132-284d5b8b4d6b", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/user-1.json new file mode 100644 index 0000000000..f33206a5c1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTreeBuilderTest/wiremock/testDelete/mappings/user-1.json @@ -0,0 +1,51 @@ +{ + "id": "baed7d1b-1826-40d0-9146-537f7369215d", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 20 Jun 2023 05:28:42 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"8e03f3c7f4bfa9a272abf7c471c1b788d8fcfa9f183f51d537df9097c70bc1e2\"", + "Last-Modified": "Sat, 17 Jun 2023 08:08:30 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2023-06-24 09:37:03 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4951", + "X-RateLimit-Reset": "1687242459", + "X-RateLimit-Used": "49", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E6F2:E5A4:39227DA:39AB07F:6491390A" + } + }, + "uuid": "baed7d1b-1826-40d0-9146-537f7369215d", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file From 1f585c2019787b1e40ebcb8489fd05fd863fba1c Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Wed, 28 Jun 2023 09:57:06 -0700 Subject: [PATCH 2/7] Reorder GHTreeBuilder.delete method definition --- .../org/kohsuke/github/GHTreeBuilder.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java index aa9552f85f..07e42a50ca 100644 --- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java @@ -157,33 +157,33 @@ public GHTreeBuilder add(String path, byte[] content, boolean executable) { } /** - * Removes an entry with the given path from base tree. + * Adds a new entry with the given text content to the tree. * * @param path * the file path in the tree + * @param content + * the file content as UTF-8 encoded string * @param executable * true, if the file should be executable * @return this GHTreeBuilder */ - public GHTreeBuilder delete(String path, boolean executable) { - TreeEntry entry = new DeleteTreeEntry(path, executable ? "100755" : "100644", "blob"); - treeEntries.add(entry); - return this; + public GHTreeBuilder add(String path, String content, boolean executable) { + return add(path, content.getBytes(StandardCharsets.UTF_8), executable); } /** - * Adds a new entry with the given text content to the tree. + * Removes an entry with the given path from base tree. * * @param path * the file path in the tree - * @param content - * the file content as UTF-8 encoded string * @param executable * true, if the file should be executable * @return this GHTreeBuilder */ - public GHTreeBuilder add(String path, String content, boolean executable) { - return add(path, content.getBytes(StandardCharsets.UTF_8), executable); + public GHTreeBuilder delete(String path, boolean executable) { + TreeEntry entry = new DeleteTreeEntry(path, executable ? "100755" : "100644", "blob"); + treeEntries.add(entry); + return this; } private String getApiTail() { From 9f0d82c7528a9249cc69aaddaa67a51441b84ad3 Mon Sep 17 00:00:00 2001 From: dmitriya Date: Thu, 29 Jun 2023 12:13:37 +0300 Subject: [PATCH 3/7] Hardcode mode value for deletion --- src/main/java/org/kohsuke/github/GHTreeBuilder.java | 12 +++++++----- .../java/org/kohsuke/github/GHTreeBuilderTest.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java index 07e42a50ca..52be628573 100644 --- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java @@ -38,8 +38,12 @@ private TreeEntry(String path, String mode, String type) { } private static class DeleteTreeEntry extends TreeEntry { + /** + According to reference doc https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#create-a-tree: + if sha value is null then the file will be deleted. That's why in this DTO sha is always {@literal null} and is included to json. + */ @JsonInclude - private String sha; + private final String sha = null; private DeleteTreeEntry(String path, String mode, String type) { super(path, mode, type); @@ -176,12 +180,10 @@ public GHTreeBuilder add(String path, String content, boolean executable) { * * @param path * the file path in the tree - * @param executable - * true, if the file should be executable * @return this GHTreeBuilder */ - public GHTreeBuilder delete(String path, boolean executable) { - TreeEntry entry = new DeleteTreeEntry(path, executable ? "100755" : "100644", "blob"); + public GHTreeBuilder delete(String path) { + TreeEntry entry = new DeleteTreeEntry(path, "100644", "blob"); treeEntries.add(entry); return this; } diff --git a/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java b/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java index d0af8dc7c4..02b50ab123 100644 --- a/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java @@ -151,7 +151,7 @@ public void testDelete() throws Exception { // remove a file from tree mainRef = repo.getRef("heads/main"); treeBuilder = repo.createTree().baseTree(commit.getTree().getSha()); - treeBuilder.delete(PATH_DATA1, false); + treeBuilder.delete(PATH_DATA1); GHCommit deleteCommit = updateTree(); From 36bcf4a64d90acbef701bc9c0b60089868b37e22 Mon Sep 17 00:00:00 2001 From: dmitriya Date: Thu, 29 Jun 2023 12:14:04 +0300 Subject: [PATCH 4/7] Add missing javadoc --- src/test/java/org/kohsuke/github/GHTreeBuilderTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java b/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java index 02b50ab123..9071477889 100644 --- a/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTreeBuilderTest.java @@ -134,6 +134,12 @@ public void testAdd() throws Exception { } + /** + * Test delete. + * + * @throws Exception + * the exception + */ @Test public void testDelete() throws Exception { // add test tree From f00ccb480d4a32e932d72548bbba16cf5d2a7cc1 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 29 Jun 2023 10:04:04 -0700 Subject: [PATCH 5/7] Update src/main/java/org/kohsuke/github/GHTreeBuilder.java --- src/main/java/org/kohsuke/github/GHTreeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java index 52be628573..18c3a60425 100644 --- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java @@ -183,7 +183,7 @@ public GHTreeBuilder add(String path, String content, boolean executable) { * @return this GHTreeBuilder */ public GHTreeBuilder delete(String path) { - TreeEntry entry = new DeleteTreeEntry(path, "100644", "blob"); + TreeEntry entry = new DeleteTreeEntry(path); treeEntries.add(entry); return this; } From 8ac3d241bf9366c529e7f3572bb1a8e960fa7e0d Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 29 Jun 2023 10:04:09 -0700 Subject: [PATCH 6/7] Update src/main/java/org/kohsuke/github/GHTreeBuilder.java --- src/main/java/org/kohsuke/github/GHTreeBuilder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java index 18c3a60425..f85aed7df1 100644 --- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java @@ -45,8 +45,10 @@ private static class DeleteTreeEntry extends TreeEntry { @JsonInclude private final String sha = null; - private DeleteTreeEntry(String path, String mode, String type) { - super(path, mode, type); + private DeleteTreeEntry(String path) { + // The `mode` and `type` parameters are required by the API, but their values are ignored during delete. + // Supply reasonable placeholders. + super(path, "100644", "blob"); } } From ac2f12386cf75257e804ad661a5186a947549d6c Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 29 Jun 2023 14:58:10 -0700 Subject: [PATCH 7/7] Update src/main/java/org/kohsuke/github/GHTreeBuilder.java --- src/main/java/org/kohsuke/github/GHTreeBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java index f85aed7df1..892afb7686 100644 --- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java @@ -39,8 +39,9 @@ private TreeEntry(String path, String mode, String type) { private static class DeleteTreeEntry extends TreeEntry { /** - According to reference doc https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#create-a-tree: - if sha value is null then the file will be deleted. That's why in this DTO sha is always {@literal null} and is included to json. + * According to reference doc https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#create-a-tree: if + * sha value is null then the file will be deleted. That's why in this DTO sha is always {@literal null} and is + * included to json. */ @JsonInclude private final String sha = null;