Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2018-05-08 19:30:37 +0000
committerThomas Wolf2018-05-08 19:30:37 +0000
commita039ba440106f7fcc4e6fa718771ce3a8d822377 (patch)
treec0dd453cd7f348e9ae31a397c1409dee9bf66b7c /org.eclipse.egit.github.core.tests/resources
parent5fad06251c0b68aa4743fbfde25ad474d73f1a46 (diff)
downloadegit-github-a039ba440106f7fcc4e6fa718771ce3a8d822377.tar.gz
egit-github-a039ba440106f7fcc4e6fa718771ce3a8d822377.tar.xz
egit-github-a039ba440106f7fcc4e6fa718771ce3a8d822377.zip
Fix Repository.getWatchers(); add Repository.getStars()
Per [1] it appears that the JSON returned by Github changed, apparently already in 2012. What Github shows today as the number of "watchers" is stored in field "subscribers_count". Field "watchers" actually is a copy of "stargazers_count" (as is "watchers_count"). So add fields "stargazersCount" and "subscribersCount", but keep the legacy "watchers" field to be able to deal with old serialized (via Gson or via Java serialization) objects. Add tests, including a new test for Gson de-serialization. The test data in test_repo.json is anonymized actual output for an existing repository obtained from the Github API as of 2018-05-08. [1] https://developer.github.com/changes/2012-09-05-watcher-api/ Bug: 534440 Change-Id: I1faba649986ab6ed9e367bfefdb0bbe2fbaf7071 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.github.core.tests/resources')
-rw-r--r--org.eclipse.egit.github.core.tests/resources/org/eclipse/egit/github/core/tests/test_repo.json98
1 files changed, 98 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core.tests/resources/org/eclipse/egit/github/core/tests/test_repo.json b/org.eclipse.egit.github.core.tests/resources/org/eclipse/egit/github/core/tests/test_repo.json
new file mode 100644
index 00000000..545ddfea
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/resources/org/eclipse/egit/github/core/tests/test_repo.json
@@ -0,0 +1,98 @@
+{
+ "id": 1234567,
+ "name": "some-repo",
+ "full_name": "some-user/some-repo",
+ "owner": {
+ "login": "some-user",
+ "id": 123456,
+ "avatar_url": "",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/some-user",
+ "html_url": "https://github.com/some-user",
+ "followers_url": "https://api.github.com/users/some-user/followers",
+ "following_url": "https://api.github.com/users/some-user/following{/other_user}",
+ "gists_url": "https://api.github.com/users/some-user/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/some-user/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/some-user/subscriptions",
+ "organizations_url": "https://api.github.com/users/some-user/orgs",
+ "repos_url": "https://api.github.com/users/some-user/repos",
+ "events_url": "https://api.github.com/users/some-user/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/some-user/received_events",
+ "type": "User",
+ "site_admin": false
+ },
+ "private": false,
+ "html_url": "https://github.com/some-user/some-repo",
+ "description": "Some fictitious test repo",
+ "fork": false,
+ "url": "https://api.github.com/repos/some-user/some-repo",
+ "forks_url": "https://api.github.com/repos/some-user/some-repo/forks",
+ "keys_url": "https://api.github.com/repos/some-user/some-repo/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/some-user/some-repo/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/some-user/some-repo/teams",
+ "hooks_url": "https://api.github.com/repos/some-user/some-repo/hooks",
+ "issue_events_url": "https://api.github.com/repos/some-user/some-repo/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/some-user/some-repo/events",
+ "assignees_url": "https://api.github.com/repos/some-user/some-repo/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/some-user/some-repo/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/some-user/some-repo/tags",
+ "blobs_url": "https://api.github.com/repos/some-user/some-repo/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/some-user/some-repo/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/some-user/some-repo/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/some-user/some-repo/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/some-user/some-repo/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/some-user/some-repo/languages",
+ "stargazers_url": "https://api.github.com/repos/some-user/some-repo/stargazers",
+ "contributors_url": "https://api.github.com/repos/some-user/some-repo/contributors",
+ "subscribers_url": "https://api.github.com/repos/some-user/some-repo/subscribers",
+ "subscription_url": "https://api.github.com/repos/some-user/some-repo/subscription",
+ "commits_url": "https://api.github.com/repos/some-user/some-repo/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/some-user/some-repo/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/some-user/some-repo/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/some-user/some-repo/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/some-user/some-repo/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/some-user/some-repo/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/some-user/some-repo/merges",
+ "archive_url": "https://api.github.com/repos/some-user/some-repo/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/some-user/some-repo/downloads",
+ "issues_url": "https://api.github.com/repos/some-user/some-repo/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/some-user/some-repo/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/some-user/some-repo/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/some-user/some-repo/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/some-user/some-repo/labels{/name}",
+ "releases_url": "https://api.github.com/repos/some-user/some-repo/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/some-user/some-repo/deployments",
+ "created_at": "2018-05-08T08:00:00Z",
+ "updated_at": "2018-05-08T10:01:01Z",
+ "pushed_at": "2018-05-08T10:00:58Z",
+ "git_url": "git://github.com/some-user/some-repo.git",
+ "ssh_url": "git@github.com:some-user/some-repo.git",
+ "clone_url": "https://github.com/some-user/some-repo.git",
+ "svn_url": "https://github.com/some-user/some-repo",
+ "homepage": "",
+ "size": 677,
+ "stargazers_count": 21,
+ "watchers_count": 21,
+ "language": "Java",
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "forks_count": 2,
+ "mirror_url": null,
+ "archived": false,
+ "open_issues_count": 3,
+ "license": {
+ "key": "apache-2.0",
+ "name": "Apache License 2.0",
+ "spdx_id": "Apache-2.0",
+ "url": "https://api.github.com/licenses/apache-2.0"
+ },
+ "forks": 2,
+ "open_issues": 3,
+ "watchers": 21,
+ "default_branch": "master",
+ "network_count": 2,
+ "subscribers_count": 9
+}

Back to the top