mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-11 08:21:23 +00:00
Compare commits
104 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7a792251a | ||
|
|
aec2308144 | ||
|
|
0741b8aa6a | ||
|
|
3082622394 | ||
|
|
965c9cb0af | ||
|
|
495a46e2d8 | ||
|
|
05bda1192e | ||
|
|
6058af0ca1 | ||
|
|
1eb8bf9719 | ||
|
|
afc02faeda | ||
|
|
66f22de90f | ||
|
|
2949a2e0ff | ||
|
|
ba12efea9d | ||
|
|
e1180a12fb | ||
|
|
1393706f13 | ||
|
|
6f994f31f7 | ||
|
|
38aa99a063 | ||
|
|
85c44b3529 | ||
|
|
e1a2768de5 | ||
|
|
e1c9b27203 | ||
|
|
969f6ef826 | ||
|
|
7abc4d4e76 | ||
|
|
ac97147c1f | ||
|
|
dbd20fe396 | ||
|
|
44e57c9c4b | ||
|
|
488e5e531f | ||
|
|
42a6a8d770 | ||
|
|
f8e877ea05 | ||
|
|
65d6fc7272 | ||
|
|
63ce8e461b | ||
|
|
fbf4c48461 | ||
|
|
81a55db644 | ||
|
|
4d4edfa181 | ||
|
|
6f9182f1f6 | ||
|
|
fa600c03e2 | ||
|
|
4a53301e9f | ||
|
|
676984b3d5 | ||
|
|
e6d7f7248b | ||
|
|
50903b5c4a | ||
|
|
01e399fb91 | ||
|
|
911aeb7af0 | ||
|
|
7e5cd9abbc | ||
|
|
115527a21a | ||
|
|
eff4f4f601 | ||
|
|
16e0099a0d | ||
|
|
2c8c678275 | ||
|
|
3b51e87fbf | ||
|
|
6c6eef5e2b | ||
|
|
6e5910f44c | ||
|
|
a967189bc6 | ||
|
|
7069176cf6 | ||
|
|
44dcbe773d | ||
|
|
ca76975461 | ||
|
|
83122ac99e | ||
|
|
c3e9458555 | ||
|
|
057ba38873 | ||
|
|
81d7d6236b | ||
|
|
191dd49653 | ||
|
|
21e9dd6f51 | ||
|
|
cc2d14acc6 | ||
|
|
87f37e9f1c | ||
|
|
d536a9f874 | ||
|
|
b45f353fa9 | ||
|
|
a3073ec14e | ||
|
|
f77eb33029 | ||
|
|
c1c919097a | ||
|
|
e05348463c | ||
|
|
fdcf74eaf2 | ||
|
|
6d57a3e3b9 | ||
|
|
1f449c866e | ||
|
|
e12deccd24 | ||
|
|
3184ebb5ee | ||
|
|
4a35ed2b35 | ||
|
|
5c9474d1c8 | ||
|
|
2321dc50c5 | ||
|
|
4efd2e8184 | ||
|
|
e30e153bfa | ||
|
|
2724211535 | ||
|
|
81068de0f1 | ||
|
|
7d842175f7 | ||
|
|
e0aee9f361 | ||
|
|
df576e2738 | ||
|
|
bb1356b25d | ||
|
|
1b67960da4 | ||
|
|
d76718e8b2 | ||
|
|
76c51922f1 | ||
|
|
f95e89a136 | ||
|
|
2dff60a23c | ||
|
|
95f83d1a29 | ||
|
|
b875ccecc1 | ||
|
|
e4c3802f16 | ||
|
|
081e485f4f | ||
|
|
4adf88da19 | ||
|
|
31e2b1b8d3 | ||
|
|
bd28abd343 | ||
|
|
955690b124 | ||
|
|
fa6f06ae15 | ||
|
|
263de140c5 | ||
|
|
ed85d06d69 | ||
|
|
4ff0870df8 | ||
|
|
410bac2040 | ||
|
|
7fc68f2969 | ||
|
|
32ff315b6b | ||
|
|
f919346f8f |
4
.github/workflows/maven-build.yml
vendored
4
.github/workflows/maven-build.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ 11 ]
|
||||
java: [ 13 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu, windows ]
|
||||
java: [ 8, 11, 13 ]
|
||||
java: [ 8, 11, 13, 15-ea ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
|
||||
1324
CHANGELOG.md
1324
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
# Java API for GitHub
|
||||
|
||||
[](https://mvnrepository.com/artifact/org.kohsuke/github-api)
|
||||
[](https://gitter.im/github-api/github-api?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||

|
||||
[](https://gitter.im/hub4j/github-api?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
18
pom.xml
18
pom.xml
@@ -2,16 +2,16 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.109</version>
|
||||
<version>1.112</version>
|
||||
<name>GitHub API for Java</name>
|
||||
<url>https://github-api.kohsuke.org/</url>
|
||||
<description>GitHub API for Java</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
|
||||
<url>https://github.com/github-api/github-api/</url>
|
||||
<tag>github-api-1.109</tag>
|
||||
<connection>scm:git:git@github.com/hub4j/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/hub4j/${project.artifactId}.git</developerConnection>
|
||||
<url>https://github.com/hub4j/github-api/</url>
|
||||
<tag>github-api-1.112</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -27,14 +27,14 @@
|
||||
</repository>
|
||||
<site>
|
||||
<id>github-pages</id>
|
||||
<url>gitsite:git@github.com/github-api/${project.artifactId}.git</url>
|
||||
<url>gitsite:git@github.com/hub4j/${project.artifactId}.git</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spotbugs-maven-plugin.version>4.0.0</spotbugs-maven-plugin.version>
|
||||
<spotbugs.version>4.0.1</spotbugs.version>
|
||||
<spotbugs.version>4.0.3</spotbugs.version>
|
||||
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
|
||||
<hamcrest.version>2.2</hamcrest.version>
|
||||
<okhttp3.version>4.4.1</okhttp3.version>
|
||||
@@ -253,7 +253,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.1.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.bcel</groupId>
|
||||
@@ -337,7 +337,7 @@
|
||||
<plugin>
|
||||
<groupId>net.revelc.code</groupId>
|
||||
<artifactId>impsort-maven-plugin</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>1.4.1</version>
|
||||
<configuration>
|
||||
<groups>*,java.,javax.</groups>
|
||||
<removeUnused>true</removeUnused>
|
||||
|
||||
@@ -39,7 +39,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param owner
|
||||
* the owner
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setOwner(GHUser owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
@@ -58,7 +60,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -77,7 +81,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param description
|
||||
* the description
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
@@ -96,7 +102,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param externalUrl
|
||||
* the external url
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExternalUrl(String externalUrl) {
|
||||
this.externalUrl = externalUrl;
|
||||
}
|
||||
@@ -115,7 +123,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param events
|
||||
* the events
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEvents(List<GHEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
@@ -134,7 +144,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param installationsCount
|
||||
* the installations count
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setInstallationsCount(long installationsCount) {
|
||||
this.installationsCount = installationsCount;
|
||||
}
|
||||
@@ -157,7 +169,9 @@ public class GHApp extends GHObject {
|
||||
*
|
||||
* @param permissions
|
||||
* the permissions
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPermissions(Map<String, String> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param root
|
||||
* the root
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRoot(GitHub root) {
|
||||
this.root = root;
|
||||
}
|
||||
@@ -78,7 +80,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param account
|
||||
* the account
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAccount(GHUser account) {
|
||||
this.account = account;
|
||||
}
|
||||
@@ -97,7 +101,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param accessTokenUrl
|
||||
* the access token url
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAccessTokenUrl(String accessTokenUrl) {
|
||||
this.accessTokenUrl = accessTokenUrl;
|
||||
}
|
||||
@@ -116,7 +122,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param repositoriesUrl
|
||||
* the repositories url
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRepositoriesUrl(String repositoriesUrl) {
|
||||
this.repositoriesUrl = repositoriesUrl;
|
||||
}
|
||||
@@ -135,7 +143,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param appId
|
||||
* the app id
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAppId(long appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
@@ -154,7 +164,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param targetId
|
||||
* the target id
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTargetId(long targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
@@ -173,7 +185,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param targetType
|
||||
* the target type
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTargetType(GHTargetType targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
@@ -192,7 +206,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param permissions
|
||||
* the permissions
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPermissions(Map<String, GHPermissionType> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
@@ -211,7 +227,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param events
|
||||
* the events
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEvents(List<GHEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
@@ -230,7 +248,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param singleFileName
|
||||
* the single file name
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSingleFileName(String singleFileName) {
|
||||
this.singleFileName = singleFileName;
|
||||
}
|
||||
@@ -249,7 +269,9 @@ public class GHAppInstallation extends GHObject {
|
||||
*
|
||||
* @param repositorySelection
|
||||
* the repository selection
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRepositorySelection(GHRepositorySelection repositorySelection) {
|
||||
this.repositorySelection = repositorySelection;
|
||||
}
|
||||
@@ -274,7 +296,7 @@ public class GHAppInstallation extends GHObject {
|
||||
root.createRequest()
|
||||
.method("DELETE")
|
||||
.withPreview(GAMBIT)
|
||||
.withUrlPath(String.format("/app/installations/%d", id))
|
||||
.withUrlPath(String.format("/app/installations/%d", getId()))
|
||||
.send();
|
||||
}
|
||||
|
||||
@@ -293,7 +315,9 @@ public class GHAppInstallation extends GHObject {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHAppCreateTokenBuilder createToken(Map<String, GHPermissionType> permissions) {
|
||||
return new GHAppCreateTokenBuilder(root, String.format("/app/installations/%d/access_tokens", id), permissions);
|
||||
return new GHAppCreateTokenBuilder(root,
|
||||
String.format("/app/installations/%d/access_tokens", getId()),
|
||||
permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,6 +332,6 @@ public class GHAppInstallation extends GHObject {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHAppCreateTokenBuilder createToken() {
|
||||
return new GHAppCreateTokenBuilder(root, String.format("/app/installations/%d/access_tokens", id));
|
||||
return new GHAppCreateTokenBuilder(root, String.format("/app/installations/%d/access_tokens", getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ public class GHAppInstallationToken {
|
||||
*
|
||||
* @param root
|
||||
* the root
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRoot(GitHub root) {
|
||||
this.root = root;
|
||||
}
|
||||
@@ -56,7 +58,9 @@ public class GHAppInstallationToken {
|
||||
*
|
||||
* @param permissions
|
||||
* the permissions
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPermissions(Map<String, String> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
@@ -75,7 +79,9 @@ public class GHAppInstallationToken {
|
||||
*
|
||||
* @param token
|
||||
* the token
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
@@ -94,7 +100,9 @@ public class GHAppInstallationToken {
|
||||
*
|
||||
* @param repositories
|
||||
* the repositories
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRepositories(List<GHRepository> repositories) {
|
||||
this.repositories = repositories;
|
||||
}
|
||||
@@ -113,7 +121,9 @@ public class GHAppInstallationToken {
|
||||
*
|
||||
* @param repositorySelection
|
||||
* the repository selection
|
||||
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRepositorySelection(GHRepositorySelection repositorySelection) {
|
||||
this.repositorySelection = repositorySelection;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class GHAsset extends GHObject {
|
||||
}
|
||||
|
||||
private String getApiRoute() {
|
||||
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + id;
|
||||
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + getId();
|
||||
}
|
||||
|
||||
GHAsset wrap(GHRelease release) {
|
||||
|
||||
@@ -112,10 +112,12 @@ public class GHAuthorization extends GHObject {
|
||||
* Gets api url.
|
||||
*
|
||||
* @return the api url
|
||||
* @deprecated use {@link #getUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library API, cannot be changed")
|
||||
public URL getApiURL() {
|
||||
return GitHubClient.parseURL(url);
|
||||
return getUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,7 @@ public class GHBranch {
|
||||
* the io exception
|
||||
*/
|
||||
public GHBranchProtection getProtection() throws IOException {
|
||||
return root.createRequest().withUrlPath(protection_url).fetch(GHBranchProtection.class).wrap(this);
|
||||
return root.createRequest().setRawUrlPath(protection_url).fetch(GHBranchProtection.class).wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ public class GHBranch {
|
||||
* if disabling protection fails
|
||||
*/
|
||||
public void disableProtection() throws IOException {
|
||||
root.createRequest().method("DELETE").withUrlPath(protection_url).send();
|
||||
root.createRequest().method("DELETE").setRawUrlPath(protection_url).send();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,7 +144,7 @@ public final class GHCheckRunBuilder {
|
||||
.withPreview(Previews.ANTIOPE)
|
||||
.method("PATCH")
|
||||
.with("output", output2)
|
||||
.withUrlPath(repo.getApiTailUrl("check-runs/" + run.id))
|
||||
.withUrlPath(repo.getApiTailUrl("check-runs/" + run.getId()))
|
||||
.fetch(GHCheckRun.class)
|
||||
.wrap(repo);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class GHCommitComment extends GHObject implements Reactable {
|
||||
}
|
||||
|
||||
private String getApiTail() {
|
||||
return String.format("/repos/%s/%s/comments/%s", owner.getOwnerName(), owner.getName(), id);
|
||||
return String.format("/repos/%s/%s/comments/%s", owner.getOwnerName(), owner.getName(), getId());
|
||||
}
|
||||
|
||||
GHCommitComment wrap(GHRepository owner) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class GHDeployment extends GHObject {
|
||||
* @return the gh deployment status builder
|
||||
*/
|
||||
public GHDeploymentStatusBuilder createStatus(GHDeploymentState state) {
|
||||
return new GHDeploymentStatusBuilder(owner, id, state);
|
||||
return new GHDeploymentStatusBuilder(owner, getId(), state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
|
||||
@@ -207,6 +208,153 @@ public abstract class GHEventPayload {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An installation has been installed, uninstalled, or its permissions have been changed.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v3/activity/events/types/#installationevent">authoritative source</a>
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||
public static class Installation extends GHEventPayload {
|
||||
private String action;
|
||||
private GHAppInstallation installation;
|
||||
private List<GHRepository> repositories;
|
||||
|
||||
/**
|
||||
* Gets action
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets installation
|
||||
*
|
||||
* @return the installation
|
||||
*/
|
||||
public GHAppInstallation getInstallation() {
|
||||
return installation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets repositories
|
||||
*
|
||||
* @return the repositories
|
||||
*/
|
||||
public List<GHRepository> getRepositories() {
|
||||
return repositories;
|
||||
};
|
||||
|
||||
@Override
|
||||
void wrapUp(GitHub root) {
|
||||
super.wrapUp(root);
|
||||
if (installation == null)
|
||||
throw new IllegalStateException(
|
||||
"Expected check_suite payload, but got something else. Maybe we've got another type of event?");
|
||||
else
|
||||
installation.wrapUp(root);
|
||||
|
||||
if (repositories != null && !repositories.isEmpty()) {
|
||||
try {
|
||||
for (GHRepository singleRepo : repositories) { // warp each of the repository
|
||||
singleRepo.wrap(root);
|
||||
singleRepo.populate();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new GHException("Failed to refresh repositories", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A repository has been added or removed from an installation.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent">authoritative
|
||||
* source</a>
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||
public static class InstallationRepositories extends GHEventPayload {
|
||||
private String action;
|
||||
private GHAppInstallation installation;
|
||||
private String repositorySelection;
|
||||
private List<GHRepository> repositoriesAdded;
|
||||
private List<GHRepository> repositoriesRemoved;
|
||||
|
||||
/**
|
||||
* Gets action
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets installation
|
||||
*
|
||||
* @return the installation
|
||||
*/
|
||||
public GHAppInstallation getInstallation() {
|
||||
return installation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets installation selection
|
||||
*
|
||||
* @return the installation selection
|
||||
*/
|
||||
public String getRepositorySelection() {
|
||||
return repositorySelection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets repositories added
|
||||
*
|
||||
* @return the repositories
|
||||
*/
|
||||
public List<GHRepository> getRepositoriesAdded() {
|
||||
return repositoriesAdded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets repositories removed
|
||||
*
|
||||
* @return the repositories
|
||||
*/
|
||||
public List<GHRepository> getRepositoriesRemoved() {
|
||||
return repositoriesRemoved;
|
||||
}
|
||||
|
||||
@Override
|
||||
void wrapUp(GitHub root) {
|
||||
super.wrapUp(root);
|
||||
if (installation == null)
|
||||
throw new IllegalStateException(
|
||||
"Expected check_suite payload, but got something else. Maybe we've got another type of event?");
|
||||
else
|
||||
installation.wrapUp(root);
|
||||
|
||||
List<GHRepository> repositories;
|
||||
if ("added".equals(action))
|
||||
repositories = repositoriesAdded;
|
||||
else // action == "removed"
|
||||
repositories = repositoriesRemoved;
|
||||
|
||||
if (repositories != null && !repositories.isEmpty()) {
|
||||
try {
|
||||
for (GHRepository singleRepo : repositories) { // warp each of the repository
|
||||
singleRepo.wrap(root);
|
||||
singleRepo.populate();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new GHException("Failed to refresh repositories", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A pull request status has changed.
|
||||
*
|
||||
|
||||
@@ -50,6 +50,30 @@ public class GHGist extends GHObject {
|
||||
this.owner = root.getUser(owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlike most other GitHub objects, the id for Gists can be non-numeric, such as "aa5a315d61ae9438b18d". If the id
|
||||
* is numeric, this method will get it. If id is not numeric, this will throw a runtime
|
||||
* {@link NumberFormatException}.
|
||||
*
|
||||
* @return id of the Gist.
|
||||
* @deprecated Use {@link #getGistId()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public long getId() {
|
||||
return Long.parseLong(getGistId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id for this Gist. Unlike most other GitHub objects, the id for Gists can be non-numeric, such as
|
||||
* "aa5a315d61ae9438b18d". This should be used instead of {@link #getId()}.
|
||||
*
|
||||
* @return id of this Gist
|
||||
*/
|
||||
public String getGistId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets owner.
|
||||
*
|
||||
@@ -97,6 +121,11 @@ public class GHGist extends GHObject {
|
||||
return git_push_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the html url.
|
||||
*
|
||||
* @return the github html url
|
||||
*/
|
||||
public URL getHtmlUrl() {
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Builder pattern for creating a new Gist.
|
||||
*
|
||||
@@ -59,7 +61,7 @@ public class GHGistBuilder {
|
||||
* the content
|
||||
* @return Adds a new file.
|
||||
*/
|
||||
public GHGistBuilder file(String fileName, String content) {
|
||||
public GHGistBuilder file(@Nonnull String fileName, @Nonnull String content) {
|
||||
files.put(fileName, Collections.singletonMap("content", content));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Builder pattern for updating a Gist.
|
||||
@@ -12,7 +15,7 @@ import java.util.LinkedHashMap;
|
||||
public class GHGistUpdater {
|
||||
private final GHGist base;
|
||||
private final Requester builder;
|
||||
LinkedHashMap<String, Object> files;
|
||||
LinkedHashMap<String, Map<String, String>> files;
|
||||
|
||||
GHGistUpdater(GHGist base) {
|
||||
this.base = base;
|
||||
@@ -32,16 +35,15 @@ public class GHGistUpdater {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHGistUpdater addFile(String fileName, String content) throws IOException {
|
||||
public GHGistUpdater addFile(@Nonnull String fileName, @Nonnull String content) throws IOException {
|
||||
updateFile(fileName, content);
|
||||
return this;
|
||||
}
|
||||
|
||||
// // This method does not work.
|
||||
// public GHGistUpdater deleteFile(String fileName) throws IOException {
|
||||
// files.put(fileName, Collections.singletonMap("filename", null));
|
||||
// return this;
|
||||
// }
|
||||
public GHGistUpdater deleteFile(@Nonnull String fileName) throws IOException {
|
||||
files.put(fileName, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename file gh gist updater.
|
||||
@@ -54,8 +56,9 @@ public class GHGistUpdater {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHGistUpdater renameFile(String fileName, String newFileName) throws IOException {
|
||||
files.put(fileName, Collections.singletonMap("filename", newFileName));
|
||||
public GHGistUpdater renameFile(@Nonnull String fileName, @Nonnull String newFileName) throws IOException {
|
||||
Map<String, String> file = files.computeIfAbsent(fileName, d -> new HashMap<>());
|
||||
file.put("filename", newFileName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -70,8 +73,31 @@ public class GHGistUpdater {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHGistUpdater updateFile(String fileName, String content) throws IOException {
|
||||
files.put(fileName, Collections.singletonMap("content", content));
|
||||
public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String content) throws IOException {
|
||||
Map<String, String> file = files.computeIfAbsent(fileName, d -> new HashMap<>());
|
||||
file.put("content", content);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update file name and content
|
||||
*
|
||||
* @param fileName
|
||||
* the file name
|
||||
* @param newFileName
|
||||
* the new file name
|
||||
* @param content
|
||||
* the content
|
||||
* @return the gh gist updater
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String newFileName, @Nonnull String content)
|
||||
throws IOException {
|
||||
Map<String, String> file = files.computeIfAbsent(fileName, d -> new HashMap<>());
|
||||
file.put("content", content);
|
||||
file.put("filename", newFileName);
|
||||
files.put(fileName, file);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
|
||||
|
||||
@@ -179,10 +180,12 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
/**
|
||||
* Gets api url.
|
||||
*
|
||||
* @return the api url
|
||||
* @return API URL of this object.
|
||||
* @deprecated use {@link #getUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
public URL getApiURL() {
|
||||
return GitHubClient.parseURL(url);
|
||||
return getUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,6 +231,13 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Identical to edit(), but allows null for the value.
|
||||
*/
|
||||
private void editNullable(String key, Object value) throws IOException {
|
||||
root.createRequest().withNullable(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
|
||||
}
|
||||
|
||||
private void editIssue(String key, Object value) throws IOException {
|
||||
root.createRequest().with(key, value).method("PATCH").withUrlPath(getIssuesApiRoute()).send();
|
||||
}
|
||||
@@ -277,15 +287,19 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets milestone.
|
||||
* Sets the milestone for this issue.
|
||||
*
|
||||
* @param milestone
|
||||
* the milestone
|
||||
* The milestone to assign this issue to. Use null to remove the milestone for this issue.
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
* The io exception
|
||||
*/
|
||||
public void setMilestone(GHMilestone milestone) throws IOException {
|
||||
edit("milestone", milestone.getNumber());
|
||||
if (milestone == null) {
|
||||
editNullable("milestone", null);
|
||||
} else {
|
||||
edit("milestone", milestone.getNumber());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -559,7 +573,8 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
protected String getIssuesApiRoute() {
|
||||
if (owner == null) {
|
||||
// Issues returned from search to do not have an owner. Attempt to use url.
|
||||
return StringUtils.prependIfMissing(getUrl().toString().replace(root.getApiUrl(), ""), "/");
|
||||
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
|
||||
return StringUtils.prependIfMissing(url.toString().replace(root.getApiUrl(), ""), "/");
|
||||
}
|
||||
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/issues/" + number;
|
||||
}
|
||||
|
||||
@@ -149,6 +149,6 @@ public class GHIssueComment extends GHObject implements Reactable {
|
||||
|
||||
private String getApiRoute() {
|
||||
return "/repos/" + owner.getRepository().getOwnerName() + "/" + owner.getRepository().getName()
|
||||
+ "/issues/comments/" + id;
|
||||
+ "/issues/comments/" + getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.Date;
|
||||
/**
|
||||
* The type GHIssueEvent.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v3/issues/events/">Github documentation for issue events</a>
|
||||
*
|
||||
* @author Martin van Zijl
|
||||
*/
|
||||
public class GHIssueEvent {
|
||||
@@ -18,6 +20,9 @@ public class GHIssueEvent {
|
||||
private String commit_id;
|
||||
private String commit_url;
|
||||
private String created_at;
|
||||
private GHMilestone milestone;
|
||||
private GHLabel label;
|
||||
private GHUser assignee;
|
||||
|
||||
private GHIssue issue;
|
||||
|
||||
@@ -111,6 +116,36 @@ public class GHIssueEvent {
|
||||
return issue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link GHMilestone} that this issue was added to or removed from. Only present for events "milestoned"
|
||||
* and "demilestoned", <code>null</code> otherwise.
|
||||
*
|
||||
* @return the milestone
|
||||
*/
|
||||
public GHMilestone getMilestone() {
|
||||
return milestone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link GHLabel} that was added to or removed from the issue. Only present for events "labeled" and
|
||||
* "unlabeled", <code>null</code> otherwise.
|
||||
*
|
||||
* @return the label
|
||||
*/
|
||||
public GHLabel getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link GHUser} that was assigned or unassigned from the issue. Only present for events "assigned" and
|
||||
* "unassigned", <code>null</code> otherwise.
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
public GHUser getAssignee() {
|
||||
return assignee;
|
||||
}
|
||||
|
||||
GHIssueEvent wrapUp(GitHub root) {
|
||||
this.root = root;
|
||||
return this;
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The GitHub Preview API's license information
|
||||
@@ -78,14 +78,6 @@ public class GHLicense extends GHObject {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return API URL of this object.
|
||||
*/
|
||||
@WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
|
||||
public URL getUrl() {
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Featured licenses are bold in the new repository drop-down
|
||||
*
|
||||
@@ -199,7 +191,14 @@ public class GHLicense extends GHObject {
|
||||
if (description != null)
|
||||
return; // already populated
|
||||
|
||||
root.createRequest().withUrlPath(url).fetchInto(this);
|
||||
if (root == null || root.isOffline()) {
|
||||
return; // cannot populate, will have to live with what we have
|
||||
}
|
||||
|
||||
URL url = getUrl();
|
||||
if (url != null) {
|
||||
root.createRequest().setRawUrlPath(url.toString()).fetchInto(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,12 +209,12 @@ public class GHLicense extends GHObject {
|
||||
return false;
|
||||
|
||||
GHLicense that = (GHLicense) o;
|
||||
return this.url.equals(that.url);
|
||||
return Objects.equals(getUrl(), that.getUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return url.hashCode();
|
||||
return Objects.hashCode(getUrl());
|
||||
}
|
||||
|
||||
GHLicense wrap(GitHub root) {
|
||||
|
||||
@@ -24,12 +24,14 @@ public abstract class GHObject {
|
||||
/**
|
||||
* Capture response HTTP headers on the state object.
|
||||
*/
|
||||
protected Map<String, List<String>> responseHeaderFields;
|
||||
protected transient Map<String, List<String>> responseHeaderFields;
|
||||
|
||||
protected String url;
|
||||
protected long id;
|
||||
protected String created_at;
|
||||
protected String updated_at;
|
||||
private String url;
|
||||
|
||||
private long id;
|
||||
private String nodeId;
|
||||
private String createdAt;
|
||||
private String updatedAt;
|
||||
|
||||
GHObject() {
|
||||
}
|
||||
@@ -74,12 +76,12 @@ public abstract class GHObject {
|
||||
*/
|
||||
@WithBridgeMethods(value = String.class, adapterMethod = "createdAtStr")
|
||||
public Date getCreatedAt() throws IOException {
|
||||
return GitHubClient.parseDate(created_at);
|
||||
return GitHubClient.parseDate(createdAt);
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getCreatedAt")
|
||||
private Object createdAtStr(Date id, Class type) {
|
||||
return created_at;
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +112,18 @@ public abstract class GHObject {
|
||||
* on error
|
||||
*/
|
||||
public Date getUpdatedAt() throws IOException {
|
||||
return GitHubClient.parseDate(updated_at);
|
||||
return GitHubClient.parseDate(updatedAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Global node_id from Github object.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">Using Global Node IDs</a>
|
||||
*
|
||||
* @return Global Node ID.
|
||||
*/
|
||||
public String getNodeId() {
|
||||
return nodeId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,6 @@ class GHOrgHook extends GHHook {
|
||||
|
||||
@Override
|
||||
String getApiRoute() {
|
||||
return String.format("/orgs/%s/hooks/%d", organization.getLogin(), id);
|
||||
return String.format("/orgs/%s/hooks/%d", organization.getLogin(), getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,22 @@ public class GHOrganization extends GHPerson {
|
||||
.toIterable(GHTeam[].class, item -> item.wrapUp(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single team by ID.
|
||||
*
|
||||
* @param teamId
|
||||
* id of the team that we want to query for
|
||||
* @return the team
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*
|
||||
* @deprecated Use {@link GHOrganization#getTeam(long)}
|
||||
*/
|
||||
@Deprecated
|
||||
public GHTeam getTeam(int teamId) throws IOException {
|
||||
return getTeam((long) teamId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single team by ID.
|
||||
*
|
||||
@@ -139,9 +155,9 @@ public class GHOrganization extends GHPerson {
|
||||
*
|
||||
* @see <a href= "https://developer.github.com/v3/teams/#get-team-by-name">documentation</a>
|
||||
*/
|
||||
public GHTeam getTeam(int teamId) throws IOException {
|
||||
public GHTeam getTeam(long teamId) throws IOException {
|
||||
return root.createRequest()
|
||||
.withUrlPath(String.format("/organizations/%d/team/%d", id, teamId))
|
||||
.withUrlPath(String.format("/organizations/%d/team/%d", getId(), teamId))
|
||||
.fetch(GHTeam.class)
|
||||
.wrapUp(this);
|
||||
}
|
||||
|
||||
@@ -46,13 +46,16 @@ public abstract class GHPerson extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
protected synchronized void populate() throws IOException {
|
||||
if (created_at != null) {
|
||||
if (super.getCreatedAt() != null) {
|
||||
return; // already populated
|
||||
}
|
||||
if (root == null || root.isOffline()) {
|
||||
return; // cannot populate, will have to live with what we have
|
||||
}
|
||||
root.createRequest().withUrlPath(url).fetchInto(this);
|
||||
URL url = getUrl();
|
||||
if (url != null) {
|
||||
root.createRequest().setRawUrlPath(url.toString()).fetchInto(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,6 @@ public class GHProject extends GHObject {
|
||||
|
||||
private String owner_url;
|
||||
private String html_url;
|
||||
private String node_id;
|
||||
private String name;
|
||||
private String body;
|
||||
private int number;
|
||||
@@ -105,10 +104,12 @@ public class GHProject extends GHObject {
|
||||
/**
|
||||
* Gets node id.
|
||||
*
|
||||
* @deprecated Use {@link GHObject#getNodeId()}
|
||||
* @return the node id
|
||||
*/
|
||||
@Deprecated
|
||||
public String getNode_id() {
|
||||
return node_id;
|
||||
return getNodeId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +192,7 @@ public class GHProject extends GHObject {
|
||||
* @return the api route
|
||||
*/
|
||||
protected String getApiRoute() {
|
||||
return "/projects/" + id;
|
||||
return "/projects/" + getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,7 +291,7 @@ public class GHProject extends GHObject {
|
||||
final GHProject project = this;
|
||||
return root.createRequest()
|
||||
.withPreview(INERTIA)
|
||||
.withUrlPath(String.format("/projects/%d/columns", id))
|
||||
.withUrlPath(String.format("/projects/%d/columns", getId()))
|
||||
.toIterable(GHProjectColumn[].class, item -> item.wrap(project));
|
||||
}
|
||||
|
||||
@@ -308,7 +309,7 @@ public class GHProject extends GHObject {
|
||||
.method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("name", name)
|
||||
.withUrlPath(String.format("/projects/%d/columns", id))
|
||||
.withUrlPath(String.format("/projects/%d/columns", getId()))
|
||||
.fetch(GHProjectColumn.class)
|
||||
.wrap(this);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class GHProjectCard extends GHObject {
|
||||
* @return the api route
|
||||
*/
|
||||
protected String getApiRoute() {
|
||||
return String.format("/projects/columns/cards/%d", id);
|
||||
return String.format("/projects/columns/cards/%d", getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,7 +115,7 @@ public class GHProjectColumn extends GHObject {
|
||||
* @return the api route
|
||||
*/
|
||||
protected String getApiRoute() {
|
||||
return String.format("/projects/columns/%d", id);
|
||||
return String.format("/projects/columns/%d", getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,7 @@ public class GHProjectColumn extends GHObject {
|
||||
final GHProjectColumn column = this;
|
||||
return root.createRequest()
|
||||
.withPreview(INERTIA)
|
||||
.withUrlPath(String.format("/projects/columns/%d/cards", id))
|
||||
.withUrlPath(String.format("/projects/columns/%d/cards", getId()))
|
||||
.toIterable(GHProjectCard[].class, item -> item.wrap(column));
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class GHProjectColumn extends GHObject {
|
||||
.method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("note", note)
|
||||
.withUrlPath(String.format("/projects/columns/%d/cards", id))
|
||||
.withUrlPath(String.format("/projects/columns/%d/cards", getId()))
|
||||
.fetch(GHProjectCard.class)
|
||||
.wrap(this);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class GHProjectColumn extends GHObject {
|
||||
.withPreview(INERTIA)
|
||||
.with("content_type", issue instanceof GHPullRequest ? "PullRequest" : "Issue")
|
||||
.with("content_id", issue.getId())
|
||||
.withUrlPath(String.format("/projects/columns/%d/cards", id))
|
||||
.withUrlPath(String.format("/projects/columns/%d/cards", getId()))
|
||||
.fetch(GHProjectCard.class)
|
||||
.wrap(this);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
|
||||
@@ -103,7 +104,9 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
protected String getApiRoute() {
|
||||
if (owner == null) {
|
||||
// Issues returned from search to do not have an owner. Attempt to use url.
|
||||
return StringUtils.prependIfMissing(getUrl().toString().replace(root.getApiUrl(), ""), "/");
|
||||
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
|
||||
return StringUtils.prependIfMissing(url.toString().replace(root.getApiUrl(), ""), "/");
|
||||
|
||||
}
|
||||
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/pulls/" + number;
|
||||
}
|
||||
@@ -387,10 +390,14 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* Repopulates this object.
|
||||
*/
|
||||
public void refresh() throws IOException {
|
||||
if (root.isOffline()) {
|
||||
if (root == null || root.isOffline()) {
|
||||
return; // cannot populate, will have to live with what we have
|
||||
}
|
||||
root.createRequest().withPreview(SHADOW_CAT).withUrlPath(url).fetchInto(this).wrapUp(owner);
|
||||
|
||||
URL url = getUrl();
|
||||
if (url != null) {
|
||||
root.createRequest().withPreview(SHADOW_CAT).setRawUrlPath(url.toString()).fetchInto(this).wrapUp(owner);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,7 @@ public class GHPullRequestReview extends GHObject {
|
||||
* @return the api route
|
||||
*/
|
||||
protected String getApiRoute() {
|
||||
return owner.getApiRoute() + "/reviews/" + id;
|
||||
return owner.getApiRoute() + "/reviews/" + getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,7 +153,7 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
|
||||
* @return the api route
|
||||
*/
|
||||
protected String getApiRoute() {
|
||||
return "/repos/" + owner.getRepository().getFullName() + "/pulls/comments/" + id;
|
||||
return "/repos/" + owner.getRepository().getFullName() + "/pulls/comments/" + getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,6 +58,6 @@ public class GHReaction extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public void delete() throws IOException {
|
||||
root.createRequest().method("DELETE").withPreview(SQUIRREL_GIRL).withUrlPath("/reactions/" + id).send();
|
||||
root.createRequest().method("DELETE").withPreview(SQUIRREL_GIRL).withUrlPath("/reactions/" + getId()).send();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class GHRelease extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public void delete() throws IOException {
|
||||
root.createRequest().method("DELETE").withUrlPath(owner.getApiTailUrl("releases/" + id)).send();
|
||||
root.createRequest().method("DELETE").withUrlPath(owner.getApiTailUrl("releases/" + getId())).send();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,6 +283,6 @@ public class GHRelease extends GHObject {
|
||||
}
|
||||
|
||||
private String getApiTailUrl(String end) {
|
||||
return owner.getApiTailUrl(format("releases/%s/%s", id, end));
|
||||
return owner.getApiTailUrl(format("releases/%s/%s", getId(), end));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class GHReleaseUpdater {
|
||||
*/
|
||||
public GHRelease update() throws IOException {
|
||||
return builder.method("PATCH")
|
||||
.withUrlPath(base.owner.getApiTailUrl("releases/" + base.id))
|
||||
.withUrlPath(base.owner.getApiTailUrl("releases/" + base.getId()))
|
||||
.fetch(GHRelease.class)
|
||||
.wrap(base.owner);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ class GHRepoHook extends GHHook {
|
||||
|
||||
@Override
|
||||
String getApiRoute() {
|
||||
return String.format("/repos/%s/%s/hooks/%d", repository.getOwnerName(), repository.getName(), id);
|
||||
return String.format("/repos/%s/%s/hooks/%d", repository.getOwnerName(), repository.getName(), getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import edu.umd.cs.findbugs.annotations.CheckForNull;
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
@@ -47,6 +48,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.WeakHashMap;
|
||||
@@ -63,9 +65,9 @@ import static org.kohsuke.github.Previews.*;
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||
justification = "JSON API")
|
||||
public class GHRepository extends GHObject {
|
||||
/* package almost final */ GitHub root;
|
||||
/* package almost final */ transient GitHub root;
|
||||
|
||||
private String description, homepage, name, full_name;
|
||||
private String nodeId, description, homepage, name, full_name;
|
||||
private String html_url; // this is the UI
|
||||
/*
|
||||
* The license information makes use of the preview API.
|
||||
@@ -185,6 +187,15 @@ public class GHRepository extends GHObject {
|
||||
boolean pull, push, admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets node id
|
||||
*
|
||||
* @return the node id
|
||||
*/
|
||||
public String getNodeId() {
|
||||
return nodeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets description.
|
||||
*
|
||||
@@ -221,6 +232,17 @@ public class GHRepository extends GHObject {
|
||||
return clone_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Git http transport url string.
|
||||
*
|
||||
* @return the string
|
||||
* @deprecated Typo of {@link #getHttpTransportUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
public String gitHttpTransportUrl() {
|
||||
return clone_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Subversion URL to access this repository: https://github.com/rails/rails
|
||||
*
|
||||
@@ -1545,6 +1567,9 @@ public class GHRepository extends GHObject {
|
||||
* on failure communicating with GitHub, potentially due to an invalid ref type being requested
|
||||
*/
|
||||
public PagedIterable<GHRef> listRefs(String refType) throws IOException {
|
||||
if (refType.startsWith("refs/")) {
|
||||
refType = refType.replaceFirst("refs/", "");
|
||||
}
|
||||
final String url = String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType);
|
||||
return root.createRequest().withUrlPath(url).toIterable(GHRef[].class, item -> item.wrap(root));
|
||||
}
|
||||
@@ -1559,8 +1584,13 @@ public class GHRepository extends GHObject {
|
||||
* on failure communicating with GitHub, potentially due to an invalid ref type being requested
|
||||
*/
|
||||
public GHRef getRef(String refName) throws IOException {
|
||||
// Also accept e.g. "refs/heads/branch" for consistency with createRef().
|
||||
if (refName.startsWith("refs/")) {
|
||||
refName = refName.replaceFirst("refs/", "");
|
||||
}
|
||||
|
||||
return root.createRequest()
|
||||
.withUrlPath(getApiTailUrl(String.format("git/refs/%s", refName)))
|
||||
.withUrlPath(getApiTailUrl(String.format("git/ref/%s", refName)))
|
||||
.fetch(GHRef.class)
|
||||
.wrap(root);
|
||||
}
|
||||
@@ -2130,9 +2160,15 @@ public class GHRepository extends GHObject {
|
||||
|
||||
GHRepository wrap(GitHub root) {
|
||||
this.root = root;
|
||||
if (root.isOffline()) {
|
||||
if (root.isOffline() && owner != null) {
|
||||
owner.wrapUp(root);
|
||||
}
|
||||
if (source != null) {
|
||||
source.wrap(root);
|
||||
}
|
||||
if (parent != null) {
|
||||
parent.wrap(root);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2452,10 +2488,13 @@ public class GHRepository extends GHObject {
|
||||
* @see #getParent() #getParent()
|
||||
*/
|
||||
public GHRepository getSource() throws IOException {
|
||||
if (source == null)
|
||||
if (fork && source == null) {
|
||||
populate();
|
||||
}
|
||||
if (source == null) {
|
||||
return null;
|
||||
if (source.root == null)
|
||||
source = root.getRepository(source.getFullName());
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -2470,10 +2509,13 @@ public class GHRepository extends GHObject {
|
||||
* @see #getSource() #getSource()
|
||||
*/
|
||||
public GHRepository getParent() throws IOException {
|
||||
if (parent == null)
|
||||
if (fork && parent == null) {
|
||||
populate();
|
||||
}
|
||||
|
||||
if (parent == null) {
|
||||
return null;
|
||||
if (parent.root == null)
|
||||
parent = root.getRepository(parent.getFullName());
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
@@ -2792,4 +2834,31 @@ public class GHRepository extends GHObject {
|
||||
.fetch(GHTagObject.class)
|
||||
.wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate this object.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
* The IO exception
|
||||
*/
|
||||
void populate() throws IOException {
|
||||
if (root.isOffline())
|
||||
return; // can't populate if the root is offline
|
||||
|
||||
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
|
||||
|
||||
try {
|
||||
// IMPORTANT: the url for repository records is does not reliably point to the API url.
|
||||
// There is bug in Push event payloads that returns the wrong url.
|
||||
// All other occurrences of "url" take the form "https://api.github.com/...".
|
||||
// For Push event repository records, they take the form "https://github.com/{fullName}".
|
||||
root.createRequest().setRawUrlPath(url.toString()).fetchInto(this).wrap(root);
|
||||
} catch (HttpException e) {
|
||||
if (e.getCause() instanceof JsonParseException) {
|
||||
root.createRequest().withUrlPath("/repos/" + full_name).fetchInto(this).wrap(root);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@@ -315,21 +316,12 @@ public class GHRepositoryStatistics {
|
||||
* the io exception
|
||||
*/
|
||||
public List<CodeFrequency> getCodeFrequency() throws IOException {
|
||||
// Map to arrays first, since there are no field names in the
|
||||
// returned JSON.
|
||||
try {
|
||||
Integer[][] list = root.createRequest()
|
||||
CodeFrequency[] list = root.createRequest()
|
||||
.withUrlPath(getApiTailUrl("code_frequency"))
|
||||
.fetch(Integer[][].class);
|
||||
.fetch(CodeFrequency[].class);
|
||||
|
||||
// Convert to proper objects.
|
||||
List<CodeFrequency> returnList = new ArrayList<>();
|
||||
for (Integer[] item : list) {
|
||||
CodeFrequency cf = new CodeFrequency(Arrays.asList(item));
|
||||
returnList.add(cf);
|
||||
}
|
||||
|
||||
return returnList;
|
||||
return Arrays.asList(list);
|
||||
} catch (MismatchedInputException e) {
|
||||
// This sometimes happens when retrieving code frequency statistics
|
||||
// for a repository for the first time. It is probably still being
|
||||
@@ -342,10 +334,12 @@ public class GHRepositoryStatistics {
|
||||
* The type CodeFrequency.
|
||||
*/
|
||||
public static class CodeFrequency {
|
||||
private int week;
|
||||
private int additions;
|
||||
private int deletions;
|
||||
|
||||
private final int week;
|
||||
private final int additions;
|
||||
private final int deletions;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
private CodeFrequency(List<Integer> item) {
|
||||
week = item.get(0);
|
||||
additions = item.get(1);
|
||||
@@ -428,7 +422,7 @@ public class GHRepositoryStatistics {
|
||||
* @return The list of commit counts for everyone combined, for the last 52 weeks.
|
||||
*/
|
||||
public List<Integer> getAllCommits() {
|
||||
return all;
|
||||
return Collections.unmodifiableList(all);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,7 +431,7 @@ public class GHRepositoryStatistics {
|
||||
* @return The list of commit counts for the owner, for the last 52 weeks.
|
||||
*/
|
||||
public List<Integer> getOwnerCommits() {
|
||||
return owner;
|
||||
return Collections.unmodifiableList(owner);
|
||||
}
|
||||
|
||||
Participation wrapUp(GitHub root) {
|
||||
@@ -455,28 +449,22 @@ public class GHRepositoryStatistics {
|
||||
* the io exception
|
||||
*/
|
||||
public List<PunchCardItem> getPunchCard() throws IOException {
|
||||
// Map to ArrayLists first, since there are no field names in the
|
||||
// returned JSON.
|
||||
Integer[][] list = root.createRequest().withUrlPath(getApiTailUrl("punch_card")).fetch(Integer[][].class);
|
||||
|
||||
// Convert to proper objects.
|
||||
ArrayList<PunchCardItem> returnList = new ArrayList<>();
|
||||
for (Integer[] item : list) {
|
||||
PunchCardItem pci = new PunchCardItem(Arrays.asList(item));
|
||||
returnList.add(pci);
|
||||
}
|
||||
|
||||
return returnList;
|
||||
PunchCardItem[] list = root.createRequest()
|
||||
.withUrlPath(getApiTailUrl("punch_card"))
|
||||
.fetch(PunchCardItem[].class);
|
||||
return Arrays.asList(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type PunchCardItem.
|
||||
*/
|
||||
public static class PunchCardItem {
|
||||
private int dayOfWeek;
|
||||
private int hourOfDay;
|
||||
private int numberOfCommits;
|
||||
|
||||
private final int dayOfWeek;
|
||||
private final int hourOfDay;
|
||||
private final int numberOfCommits;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
private PunchCardItem(List<Integer> item) {
|
||||
dayOfWeek = item.get(0);
|
||||
hourOfDay = item.get(1);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
@@ -10,14 +11,14 @@ import java.util.TreeMap;
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHTeam implements Refreshable {
|
||||
public class GHTeam extends GHObject implements Refreshable {
|
||||
private String html_url;
|
||||
private String name;
|
||||
private String permission;
|
||||
private String slug;
|
||||
private String description;
|
||||
private Privacy privacy;
|
||||
|
||||
private int id;
|
||||
private GHOrganization organization; // populated by GET /user/teams where Teams+Orgs are returned together
|
||||
|
||||
protected /* final */ GitHub root;
|
||||
@@ -129,15 +130,6 @@ public class GHTeam implements Refreshable {
|
||||
root.createRequest().method("PATCH").with("privacy", privacy).withUrlPath(api("")).send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current members.
|
||||
*
|
||||
@@ -169,7 +161,7 @@ public class GHTeam implements Refreshable {
|
||||
*/
|
||||
public boolean hasMember(GHUser user) {
|
||||
try {
|
||||
root.createRequest().withUrlPath("/teams/" + id + "/members/" + user.getLogin()).send();
|
||||
root.createRequest().withUrlPath("/teams/" + getId() + "/members/" + user.getLogin()).send();
|
||||
return true;
|
||||
} catch (IOException ignore) {
|
||||
return false;
|
||||
@@ -302,7 +294,7 @@ public class GHTeam implements Refreshable {
|
||||
}
|
||||
|
||||
private String api(String tail) {
|
||||
return "/teams/" + id + tail;
|
||||
return "/teams/" + getId() + tail;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,4 +313,9 @@ public class GHTeam implements Refreshable {
|
||||
public void refresh() throws IOException {
|
||||
root.createRequest().withUrlPath(api("")).fetchInto(this).wrapUp(root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getHtmlUrl() {
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
*/
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectReader;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
|
||||
import java.io.*;
|
||||
@@ -411,7 +413,7 @@ public class GitHub {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
@WithBridgeMethods(GHUser.class)
|
||||
@WithBridgeMethods(value = GHUser.class)
|
||||
public GHMyself getMyself() throws IOException {
|
||||
client.requireCredential();
|
||||
synchronized (this) {
|
||||
@@ -725,7 +727,7 @@ public class GitHub {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*
|
||||
* @deprecated Use {@link GHOrganization#getTeam(int)}
|
||||
* @deprecated Use {@link GHOrganization#getTeam(long)}
|
||||
* @see <a href= "https://developer.github.com/v3/teams/#get-team-legacy">deprecation notice</a>
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1190,6 +1192,32 @@ public class GitHub {
|
||||
"UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use this method. This method will be removed and should never have been needed in the first place.
|
||||
*
|
||||
* @return an {@link ObjectWriter} instance that can be further configured.
|
||||
* @deprecated DO NOT USE THIS METHOD. Provided for backward compatibility with projects that did their own jackson
|
||||
* mapping of this project's data objects, such as Jenkins Blue Ocean.
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
public static ObjectWriter getMappingObjectWriter() {
|
||||
return GitHubClient.getMappingObjectWriter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use this method. This method will be removed and should never have been needed in the first place.
|
||||
*
|
||||
* @return an {@link ObjectReader} instance that can be further configured.
|
||||
* @deprecated DO NOT USE THIS METHOD. Provided for backward compatibility with projects that did their own jackson
|
||||
* mapping of this project's data objects, such as Jenkins Blue Ocean.
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
public static ObjectReader getMappingObjectReader() {
|
||||
return GitHubClient.getMappingObjectReader(GitHub.offline());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
GitHubClient getClient() {
|
||||
return client;
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -210,21 +210,31 @@ abstract class GitHubClient {
|
||||
/**
|
||||
* Gets the current rate limit from the server.
|
||||
*
|
||||
* For some versions of GitHub Enterprise, the {@code /rate_limit} endpoint returns a {@code 404 Not Found}. In
|
||||
* that, if {@link #lastRateLimit()} is not {@code null} and is not expired, it will be returned. Otherwise, a
|
||||
* placeholder {@link GHRateLimit} instance with {@link GHRateLimit.UnknownLimitRecord}s will be returned.
|
||||
*
|
||||
* @return the rate limit
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
@Nonnull
|
||||
public GHRateLimit getRateLimit() throws IOException {
|
||||
GHRateLimit rateLimit;
|
||||
GHRateLimit result;
|
||||
try {
|
||||
rateLimit = fetch(JsonRateLimit.class, "/rate_limit").resources;
|
||||
result = fetch(JsonRateLimit.class, "/rate_limit").resources;
|
||||
} catch (FileNotFoundException e) {
|
||||
// GitHub Enterprise doesn't have the rate limit
|
||||
// return a default rate limit that
|
||||
rateLimit = GHRateLimit.Unknown();
|
||||
// For some versions of GitHub Enterprise, the rate_limit endpoint returns a 404.
|
||||
// However some newer versions of GHE include rate limit header information
|
||||
// Use that if available
|
||||
result = lastRateLimit();
|
||||
if (result == null || result.isExpired()) {
|
||||
// return a default rate limit
|
||||
result = GHRateLimit.Unknown();
|
||||
}
|
||||
}
|
||||
|
||||
return this.rateLimit = rateLimit;
|
||||
return rateLimit = result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,9 +253,13 @@ abstract class GitHubClient {
|
||||
/**
|
||||
* Gets the current rate limit while trying not to actually make any remote requests unless absolutely necessary.
|
||||
*
|
||||
* If {@link #lastRateLimit()} is not {@code null} and is not expired, it will be returned. If the information
|
||||
* returned from the last call to {@link #getRateLimit()} is not {@code null} and is not expired, then it will be
|
||||
* returned. Otherwise, the result of a call to {@link #getRateLimit()} will be returned.
|
||||
*
|
||||
* @return the current rate limit data.
|
||||
* @throws IOException
|
||||
* if we couldn't get the current rate limit data.
|
||||
* if there was an error getting current rate limit data.
|
||||
*/
|
||||
@Nonnull
|
||||
public GHRateLimit rateLimit() throws IOException {
|
||||
@@ -254,11 +268,11 @@ abstract class GitHubClient {
|
||||
return headerRateLimit;
|
||||
}
|
||||
}
|
||||
GHRateLimit rateLimit = this.rateLimit;
|
||||
if (rateLimit == null || rateLimit.isExpired()) {
|
||||
rateLimit = getRateLimit();
|
||||
GHRateLimit result = this.rateLimit;
|
||||
if (result == null || result.isExpired()) {
|
||||
result = getRateLimit();
|
||||
}
|
||||
return rateLimit;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -583,13 +583,17 @@ class GitHubRequest {
|
||||
* when needing to set query parameters on requests methods that don't usually have them, such as
|
||||
* {@link GHRelease#uploadAsset(String, InputStream, String)}.
|
||||
*
|
||||
* @param urlOrPath
|
||||
* @param rawUrlPath
|
||||
* the content type
|
||||
* @return the request builder
|
||||
*/
|
||||
B setRawUrlPath(String urlOrPath) {
|
||||
Objects.requireNonNull(urlOrPath);
|
||||
this.urlPath = urlOrPath;
|
||||
B setRawUrlPath(@Nonnull String rawUrlPath) {
|
||||
Objects.requireNonNull(rawUrlPath);
|
||||
// This method should only work for full urls, which must start with "http"
|
||||
if (!rawUrlPath.startsWith("http")) {
|
||||
throw new GHException("Raw URL must start with 'http'");
|
||||
}
|
||||
this.urlPath = rawUrlPath;
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
@@ -603,10 +607,10 @@ class GitHubRequest {
|
||||
* the content type
|
||||
* @return the request builder
|
||||
*/
|
||||
public B withUrlPath(String... urlPathItems) {
|
||||
public B withUrlPath(@Nonnull String urlPath, @Nonnull String... urlPathItems) {
|
||||
// full url may be set and reset as needed
|
||||
if (urlPathItems.length == 1 && !urlPathItems[0].startsWith("/")) {
|
||||
return setRawUrlPath(urlPathItems[0]);
|
||||
if (urlPathItems.length == 0 && !urlPath.startsWith("/")) {
|
||||
return setRawUrlPath(urlPath);
|
||||
}
|
||||
|
||||
// Once full url is set, do not allow path setting
|
||||
@@ -614,7 +618,10 @@ class GitHubRequest {
|
||||
throw new GHException("Cannot append to url path after setting a full url");
|
||||
}
|
||||
|
||||
String tailUrlPath = String.join("/", urlPathItems);
|
||||
String tailUrlPath = urlPath;
|
||||
if (urlPathItems.length != 0) {
|
||||
tailUrlPath += "/" + String.join("/", urlPathItems);
|
||||
}
|
||||
|
||||
if (this.urlPath.endsWith("/")) {
|
||||
tailUrlPath = StringUtils.stripStart(tailUrlPath, "/");
|
||||
@@ -658,7 +665,7 @@ class GitHubRequest {
|
||||
*/
|
||||
private static String urlPathEncode(String value) {
|
||||
try {
|
||||
return new URI(null, null, value, null, null).toString();
|
||||
return new URI(null, null, value, null, null).toASCIIString();
|
||||
} catch (URISyntaxException ex) {
|
||||
throw new AssertionError(ex);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.InjectableValues;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -16,6 +17,8 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -31,6 +34,8 @@ import javax.annotation.Nonnull;
|
||||
*/
|
||||
class GitHubResponse<T> {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(GitHubResponse.class.getName());
|
||||
|
||||
private final int statusCode;
|
||||
|
||||
@Nonnull
|
||||
@@ -83,9 +88,10 @@ class GitHubResponse<T> {
|
||||
inject.addValue(ResponseInfo.class, responseInfo);
|
||||
|
||||
return GitHubClient.getMappingObjectReader(responseInfo).forType(type).readValue(data);
|
||||
} catch (JsonMappingException e) {
|
||||
String message = "Failed to deserialize " + data;
|
||||
throw new IOException(message, e);
|
||||
} catch (JsonMappingException | JsonParseException e) {
|
||||
String message = "Failed to deserialize: " + data;
|
||||
LOGGER.log(Level.FINE, message);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +114,10 @@ class GitHubResponse<T> {
|
||||
String data = responseInfo.getBodyAsString();
|
||||
try {
|
||||
return GitHubClient.getMappingObjectReader(responseInfo).withValueToUpdate(instance).readValue(data);
|
||||
} catch (JsonMappingException e) {
|
||||
String message = "Failed to deserialize " + data;
|
||||
throw new IOException(message, e);
|
||||
} catch (JsonMappingException | JsonParseException e) {
|
||||
String message = "Failed to deserialize: " + data;
|
||||
LOGGER.log(Level.FINE, message);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,6 +314,7 @@ class GitHubResponse<T> {
|
||||
* @throws IOException
|
||||
* if an I/O Exception occurs.
|
||||
*/
|
||||
@Nonnull
|
||||
String getBodyAsString() throws IOException {
|
||||
InputStreamReader r = null;
|
||||
try {
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* The interface Refreshable.
|
||||
|
||||
@@ -280,14 +280,15 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
if (c > '\u001f' && c < '\u007f')
|
||||
continue;
|
||||
|
||||
Buffer buffer = new Buffer();
|
||||
buffer.writeUtf8(s, 0, i);
|
||||
buffer.writeUtf8CodePoint('?');
|
||||
for (int j = i + Character.charCount(c); j < length; j += Character.charCount(c)) {
|
||||
c = s.codePointAt(j);
|
||||
buffer.writeUtf8CodePoint(c > '\u001f' && c < '\u007f' ? c : '?');
|
||||
try (Buffer buffer = new Buffer()) {
|
||||
buffer.writeUtf8(s, 0, i);
|
||||
buffer.writeUtf8CodePoint('?');
|
||||
for (int j = i + Character.charCount(c); j < length; j += Character.charCount(c)) {
|
||||
c = s.codePointAt(j);
|
||||
buffer.writeUtf8CodePoint(c > '\u001f' && c < '\u007f' ? c : '?');
|
||||
}
|
||||
return buffer.readUtf8();
|
||||
}
|
||||
return buffer.readUtf8();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<menu name="Git Hub API for Java">
|
||||
<item name="Introduction" href="/index.html"/>
|
||||
<item name="Download" href="https://mvnrepository.com/artifact/${project.groupId}/${project.artifactId}"/>
|
||||
<item name="Source code" href="https://github.com/github-api/${project.artifactId}"/>
|
||||
<item name="Source code" href="https://github.com/hub4j/${project.artifactId}"/>
|
||||
<item name="Mailing List" href="https://groups.google.com/forum/#!forum/github-api"/>
|
||||
</menu>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractGitHubWireMockTest extends Assert {
|
||||
|
||||
private final GitHubBuilder githubBuilder = createGitHubBuilder();
|
||||
|
||||
final static String GITHUB_API_TEST_ORG = "github-api-test-org";
|
||||
final static String GITHUB_API_TEST_ORG = "hub4j-test-org";
|
||||
|
||||
final static String STUBBED_USER_LOGIN = "placeholder-user";
|
||||
final static String STUBBED_USER_PASSWORD = "placeholder-password";
|
||||
|
||||
@@ -198,7 +198,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testGetIssues() throws Exception {
|
||||
List<GHIssue> closedIssues = gitHub.getOrganization("github-api")
|
||||
List<GHIssue> closedIssues = gitHub.getOrganization("hub4j")
|
||||
.getRepository("github-api")
|
||||
.getIssues(GHIssueState.CLOSED);
|
||||
// prior to using PagedIterable GHRepository.getIssues(GHIssueState) would only retrieve 30 issues
|
||||
@@ -211,7 +211,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testListIssues() throws IOException {
|
||||
Iterable<GHIssue> closedIssues = gitHub.getOrganization("github-api")
|
||||
Iterable<GHIssue> closedIssues = gitHub.getOrganization("hub4j")
|
||||
.getRepository("github-api")
|
||||
.listIssues(GHIssueState.CLOSED);
|
||||
|
||||
@@ -291,7 +291,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
GHOrganization organization = gitHub.getOrganization(GITHUB_API_TEST_ORG);
|
||||
GHTeam teamByName = organization.getTeams().get("Core Developers");
|
||||
|
||||
GHTeam teamById = gitHub.getTeam(teamByName.getId());
|
||||
GHTeam teamById = gitHub.getTeam((int) teamByName.getId());
|
||||
assertNotNull(teamById);
|
||||
|
||||
assertEquals(teamByName.getId(), teamById.getId());
|
||||
@@ -308,6 +308,13 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
assertEquals(teamByName.getId(), teamById.getId());
|
||||
assertEquals(teamByName.getDescription(), teamById.getDescription());
|
||||
|
||||
GHTeam teamById2 = organization.getTeam((int) teamByName.getId());
|
||||
assertNotNull(teamById2);
|
||||
|
||||
assertEquals(teamByName.getId(), teamById2.getId());
|
||||
assertEquals(teamByName.getDescription(), teamById2.getDescription());
|
||||
|
||||
}
|
||||
|
||||
@Ignore("Needs mocking check")
|
||||
@@ -322,7 +329,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
@Ignore("Needs mocking check")
|
||||
@Test
|
||||
public void testFetchPullRequestAsList() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
assertEquals("master", r.getMasterBranch());
|
||||
PagedIterable<GHPullRequest> i = r.listPullRequests(GHIssueState.CLOSED);
|
||||
List<GHPullRequest> prs = i.toList();
|
||||
@@ -628,7 +635,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testCommitStatus() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
|
||||
GHCommitStatus state;
|
||||
|
||||
@@ -644,7 +651,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testCommitShortInfo() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f23");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Kohsuke Kawaguchi");
|
||||
assertEquals(commit.getCommitShortInfo().getMessage(), "doc");
|
||||
@@ -807,7 +814,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test // issue #99
|
||||
public void testReadme() throws IOException {
|
||||
GHContent readme = gitHub.getRepository("github-api-test-org/test-readme").getReadme();
|
||||
GHContent readme = gitHub.getRepository("hub4j-test-org/test-readme").getReadme();
|
||||
assertEquals(readme.getName(), "README.md");
|
||||
assertEquals(readme.getContent(), "This is a markdown readme.\n");
|
||||
}
|
||||
@@ -815,7 +822,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
@Ignore("Needs mocking check")
|
||||
@Test
|
||||
public void testTrees() throws IOException {
|
||||
GHTree masterTree = gitHub.getRepository("github-api/github-api").getTree("master");
|
||||
GHTree masterTree = gitHub.getRepository("hub4j/github-api").getTree("master");
|
||||
boolean foundReadme = false;
|
||||
for (GHTreeEntry e : masterTree.getTree()) {
|
||||
if ("readme".equalsIgnoreCase(e.getPath().replaceAll("\\.md", ""))) {
|
||||
@@ -828,7 +835,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testTreesRecursive() throws IOException {
|
||||
GHTree masterTree = gitHub.getRepository("github-api/github-api").getTreeRecursive("master", 1);
|
||||
GHTree masterTree = gitHub.getRepository("hub4j/github-api").getTreeRecursive("master", 1);
|
||||
boolean foundThisFile = false;
|
||||
for (GHTreeEntry e : masterTree.getTree()) {
|
||||
if (e.getPath().endsWith(AppTest.class.getSimpleName() + ".java")) {
|
||||
@@ -844,7 +851,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
cleanupLabel("test");
|
||||
cleanupLabel("test2");
|
||||
|
||||
GHRepository r = gitHub.getRepository("github-api-test-org/test-labels");
|
||||
GHRepository r = gitHub.getRepository("hub4j-test-org/test-labels");
|
||||
List<GHLabel> lst = r.listLabels().toList();
|
||||
for (GHLabel l : lst) {
|
||||
assertThat(l.getUrl(), containsString(l.getName().replace(" ", "%20")));
|
||||
@@ -943,7 +950,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
void cleanupLabel(String name) {
|
||||
if (mockGitHub.isUseProxy()) {
|
||||
try {
|
||||
GHLabel t = getGitHubBeforeAfter().getRepository("github-api-test-org/test-labels").getLabel(name);
|
||||
GHLabel t = getGitHubBeforeAfter().getRepository("hub4j-test-org/test-labels").getLabel(name);
|
||||
t.delete();
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -1012,7 +1019,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void reactions() throws Exception {
|
||||
GHIssue i = gitHub.getRepository("github-api/github-api").getIssue(311);
|
||||
GHIssue i = gitHub.getRepository("hub4j/github-api").getIssue(311);
|
||||
|
||||
List<GHReaction> l;
|
||||
// retrieval
|
||||
@@ -1084,7 +1091,7 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
public void blob() throws Exception {
|
||||
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
|
||||
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
String sha1 = "a12243f2fc5b8c2ba47dd677d0b0c7583539584d";
|
||||
|
||||
assertBlobContent(r.readBlob(sha1));
|
||||
|
||||
@@ -5,12 +5,15 @@ import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
@@ -18,26 +21,50 @@ import static org.hamcrest.Matchers.equalTo;
|
||||
public class BridgeMethodTest extends Assert {
|
||||
|
||||
@Test
|
||||
public void lastStatus() throws IOException {
|
||||
GHObject obj = new GHIssue();
|
||||
public void testBridgeMethods() throws IOException {
|
||||
|
||||
List<Method> createdAtMethods = new ArrayList<>();
|
||||
for (Method method : obj.getClass().getMethods()) {
|
||||
if (method.getName().equalsIgnoreCase("getCreatedAt")) {
|
||||
if (method.getReturnType() == Date.class) {
|
||||
createdAtMethods.add(0, method);
|
||||
} else {
|
||||
createdAtMethods.add(method);
|
||||
}
|
||||
// Some would say this is redundant, given that bridge methods are so thin anyway
|
||||
// In the interest of maintaining binary compatibility, we'll do this anyway for a sampling of methods
|
||||
|
||||
// Something odd here
|
||||
// verifyBridgeMethods(new GHCommit(), "getAuthor", GHCommit.GHAuthor.class, GitUser.class);
|
||||
// verifyBridgeMethods(new GHCommit(), "getCommitter", GHCommit.GHAuthor.class, GitUser.class);
|
||||
|
||||
verifyBridgeMethods(GHIssue.class, "getCreatedAt", Date.class, String.class);
|
||||
verifyBridgeMethods(GHIssue.class, "getId", int.class, long.class, String.class);
|
||||
verifyBridgeMethods(GHIssue.class, "getUrl", String.class, URL.class);
|
||||
|
||||
verifyBridgeMethods(GHOrganization.class, "getHtmlUrl", String.class, URL.class);
|
||||
verifyBridgeMethods(GHOrganization.class, "getId", int.class, long.class, String.class);
|
||||
verifyBridgeMethods(GHOrganization.class, "getUrl", String.class, URL.class);
|
||||
|
||||
verifyBridgeMethods(GHRepository.class, "getCollaborators", GHPersonSet.class, Set.class);
|
||||
verifyBridgeMethods(GHRepository.class, "getHtmlUrl", String.class, URL.class);
|
||||
verifyBridgeMethods(GHRepository.class, "getId", int.class, long.class, String.class);
|
||||
verifyBridgeMethods(GHRepository.class, "getUrl", String.class, URL.class);
|
||||
|
||||
verifyBridgeMethods(GHUser.class, "getFollows", GHPersonSet.class, Set.class);
|
||||
verifyBridgeMethods(GHUser.class, "getFollowers", GHPersonSet.class, Set.class);
|
||||
verifyBridgeMethods(GHUser.class, "getOrganizations", GHPersonSet.class, Set.class);
|
||||
verifyBridgeMethods(GHUser.class, "getId", int.class, long.class, String.class);
|
||||
|
||||
verifyBridgeMethods(GHTeam.class, "getId", int.class, long.class, String.class);
|
||||
|
||||
// verifyBridgeMethods(GitHub.class, "getMyself", GHMyself.class, GHUser.class);
|
||||
|
||||
}
|
||||
|
||||
void verifyBridgeMethods(@Nonnull Class<?> targetClass, @Nonnull String methodName, Class<?>... returnTypes) {
|
||||
List<Class<?>> foundMethods = new ArrayList<>();
|
||||
Method[] methods = targetClass.getMethods();
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equalsIgnoreCase(methodName)) {
|
||||
// Bridge methods are only
|
||||
assertThat(method.getParameterCount(), equalTo(0));
|
||||
foundMethods.add(method.getReturnType());
|
||||
}
|
||||
}
|
||||
|
||||
assertThat(createdAtMethods.size(), equalTo(2));
|
||||
|
||||
assertThat(createdAtMethods.get(0).getParameterCount(), equalTo(0));
|
||||
assertThat(createdAtMethods.get(1).getParameterCount(), equalTo(0));
|
||||
|
||||
assertThat(createdAtMethods.get(0).getReturnType(), is(Date.class));
|
||||
assertThat(createdAtMethods.get(1).getReturnType(), is(String.class));
|
||||
assertThat(foundMethods, containsInAnyOrder(returnTypes));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ public class GHAppTest extends AbstractGitHubWireMockTest {
|
||||
@Test
|
||||
public void getGitHubApp() throws IOException {
|
||||
GHApp app = gitHub.getApp();
|
||||
assertThat(app.id, is((long) 11111));
|
||||
assertThat(app.getOwner().id, is((long) 111111111));
|
||||
assertThat(app.getId(), is((long) 11111));
|
||||
assertThat(app.getOwner().getId(), is((long) 111111111));
|
||||
assertThat(app.getOwner().login, is("bogus"));
|
||||
assertThat(app.getName(), is("Bogus-Development"));
|
||||
assertThat(app.getDescription(), is(""));
|
||||
@@ -132,8 +132,8 @@ public class GHAppTest extends AbstractGitHubWireMockTest {
|
||||
Map<String, GHPermissionType> appPermissions = appInstallation.getPermissions();
|
||||
GHUser appAccount = appInstallation.getAccount();
|
||||
|
||||
assertThat(appInstallation.id, is((long) 11111111));
|
||||
assertThat(appAccount.id, is((long) 111111111));
|
||||
assertThat(appInstallation.getId(), is((long) 11111111));
|
||||
assertThat(appAccount.getId(), is((long) 111111111));
|
||||
assertThat(appAccount.login, is("bogus"));
|
||||
assertThat(appInstallation.getRepositorySelection(), is(GHRepositorySelection.SELECTED));
|
||||
assertThat(appInstallation.getAccessTokenUrl(), endsWith("/app/installations/11111111/access_tokens"));
|
||||
|
||||
16
src/test/java/org/kohsuke/github/GHBranchProtectionTest.java
Normal file → Executable file
16
src/test/java/org/kohsuke/github/GHBranchProtectionTest.java
Normal file → Executable file
@@ -54,6 +54,14 @@ public class GHBranchProtectionTest extends AbstractGitHubWireMockTest {
|
||||
assertTrue(repo.getBranch(BRANCH).isProtected());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisableProtectionOnly() throws Exception {
|
||||
GHBranchProtection protection = branch.enableProtection().enable();
|
||||
assertTrue(repo.getBranch(BRANCH).isProtected());
|
||||
branch.disableProtection();
|
||||
assertFalse(repo.getBranch(BRANCH).isProtected());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnableRequireReviewsOnly() throws Exception {
|
||||
GHBranchProtection protection = branch.enableProtection().requireReviews().enable();
|
||||
@@ -73,4 +81,12 @@ public class GHBranchProtectionTest extends AbstractGitHubWireMockTest {
|
||||
protection.disableSignedCommits();
|
||||
assertFalse(protection.getRequiredSignatures());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProtection() throws Exception {
|
||||
GHBranchProtection protection = branch.enableProtection().enable();
|
||||
GHBranchProtection protectionTest = repo.getBranch(BRANCH).getProtection();
|
||||
assertTrue(protectionTest instanceof GHBranchProtection);
|
||||
assertTrue(repo.getBranch(BRANCH).isProtected());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GHCheckRunBuilderTest extends AbstractGitHubWireMockTest {
|
||||
.create();
|
||||
assertEquals("completed", checkRun.getStatus());
|
||||
assertEquals(1, checkRun.getOutput().getAnnotationsCount());
|
||||
assertEquals(546384586, checkRun.id);
|
||||
assertEquals(546384586, checkRun.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -74,7 +74,7 @@ public class GHCheckRunBuilderTest extends AbstractGitHubWireMockTest {
|
||||
assertEquals("Big Run", checkRun.getOutput().getTitle());
|
||||
assertEquals("Lots of stuff here »", checkRun.getOutput().getSummary());
|
||||
assertEquals(101, checkRun.getOutput().getAnnotationsCount());
|
||||
assertEquals(546384622, checkRun.id);
|
||||
assertEquals(546384622, checkRun.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -86,7 +86,7 @@ public class GHCheckRunBuilderTest extends AbstractGitHubWireMockTest {
|
||||
.create();
|
||||
assertEquals("completed", checkRun.getStatus());
|
||||
assertEquals(0, checkRun.getOutput().getAnnotationsCount());
|
||||
assertEquals(546384705, checkRun.id);
|
||||
assertEquals(546384705, checkRun.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -97,7 +97,7 @@ public class GHCheckRunBuilderTest extends AbstractGitHubWireMockTest {
|
||||
.create();
|
||||
assertEquals("in_progress", checkRun.getStatus());
|
||||
assertNull(checkRun.getConclusion());
|
||||
assertEquals(546469053, checkRun.id);
|
||||
assertEquals(546469053, checkRun.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -7,6 +8,7 @@ import org.junit.Test;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
@@ -26,7 +28,7 @@ public class GHContentIntegrationTest extends AbstractGitHubWireMockTest {
|
||||
@After
|
||||
public void cleanup() throws Exception {
|
||||
if (mockGitHub.isUseProxy()) {
|
||||
repo = getGitHubBeforeAfter().getRepository("github-api-test-org/GHContentIntegrationTest");
|
||||
repo = getGitHubBeforeAfter().getRepository("hub4j-test-org/GHContentIntegrationTest");
|
||||
try {
|
||||
GHContent content = repo.getFileContent(createdFilename);
|
||||
if (content != null) {
|
||||
@@ -39,12 +41,12 @@ public class GHContentIntegrationTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
repo = gitHub.getRepository("github-api-test-org/GHContentIntegrationTest");
|
||||
repo = gitHub.getRepository("hub4j-test-org/GHContentIntegrationTest");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFileContent() throws Exception {
|
||||
repo = gitHub.getRepository("github-api-test-org/GHContentIntegrationTest");
|
||||
repo = gitHub.getRepository("hub4j-test-org/GHContentIntegrationTest");
|
||||
GHContent content = repo.getFileContent("ghcontent-ro/a-file-with-content");
|
||||
|
||||
assertTrue(content.isFile());
|
||||
@@ -123,7 +125,7 @@ public class GHContentIntegrationTest extends AbstractGitHubWireMockTest {
|
||||
} catch (GHFileNotFoundException e) {
|
||||
assertThat(e.getMessage(),
|
||||
endsWith(
|
||||
"/repos/github-api-test-org/GHContentIntegrationTest/contents/test+directory%20%2350/test%20file-to+create-%231.txt {\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/contents/#get-contents\"}"));
|
||||
"/repos/hub4j-test-org/GHContentIntegrationTest/contents/test+directory%20%2350/test%20file-to+create-%231.txt {\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/contents/#get-contents\"}"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,4 +160,14 @@ public class GHContentIntegrationTest extends AbstractGitHubWireMockTest {
|
||||
+ "123456789012345678901234567890123456789012345678901234567890");
|
||||
ghContentBuilder.commit();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFileContentWithNonAsciiPath() throws Exception {
|
||||
final GHRepository repo = gitHub.getRepository("hub4j-test-org/GHContentIntegrationTest");
|
||||
final GHContent fileContent = repo.getFileContent("ghcontent-ro/a-file-with-\u00F6");
|
||||
assertThat(IOUtils.readLines(fileContent.read(), StandardCharsets.UTF_8), hasItems("test"));
|
||||
|
||||
final GHContent fileContent2 = repo.getFileContent(fileContent.getPath());
|
||||
assertThat(IOUtils.readLines(fileContent2.read(), StandardCharsets.UTF_8), hasItems("test"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class GHDeploymentTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,20 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class GHEventPayloadTest {
|
||||
public class GHEventPayloadTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Rule
|
||||
public final PayloadRule payload = new PayloadRule(".json");
|
||||
|
||||
public GHEventPayloadTest() {
|
||||
useDefaultGitHub = false;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commit_comment() throws Exception {
|
||||
GHEventPayload.CommitComment event = GitHub.offline()
|
||||
@@ -282,6 +285,70 @@ public class GHEventPayloadTest {
|
||||
assertThat(event.getSender().getLogin(), is("baxterthehacker"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Payload("push.fork")
|
||||
public void pushToFork() throws Exception {
|
||||
gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).build();
|
||||
|
||||
GHEventPayload.Push event = GitHub.offline().parseEventPayload(payload.asReader(), GHEventPayload.Push.class);
|
||||
assertThat(event.getRef(), is("refs/heads/changes"));
|
||||
assertThat(event.getBefore(), is("85c44b352958bf6d81b74ab8b21920f1d313a287"));
|
||||
assertThat(event.getHead(), is("1393706f1364742defbc28ba459082630ca979af"));
|
||||
assertThat(event.isCreated(), is(false));
|
||||
assertThat(event.isDeleted(), is(false));
|
||||
assertThat(event.isForced(), is(false));
|
||||
assertThat(event.getCommits().size(), is(1));
|
||||
assertThat(event.getCommits().get(0).getSha(), is("1393706f1364742defbc28ba459082630ca979af"));
|
||||
assertThat(event.getCommits().get(0).getAuthor().getEmail(), is("bitwiseman@gmail.com"));
|
||||
assertThat(event.getCommits().get(0).getCommitter().getEmail(), is("bitwiseman@gmail.com"));
|
||||
assertThat(event.getCommits().get(0).getAdded().size(), is(6));
|
||||
assertThat(event.getCommits().get(0).getRemoved().size(), is(0));
|
||||
assertThat(event.getCommits().get(0).getModified().size(), is(2));
|
||||
assertThat(event.getCommits().get(0).getModified().get(0),
|
||||
is("src/main/java/org/kohsuke/github/GHLicense.java"));
|
||||
assertThat(event.getRepository().getName(), is("github-api"));
|
||||
assertThat(event.getRepository().getOwnerName(), is("hub4j-test-org"));
|
||||
assertThat(event.getRepository().getUrl().toExternalForm(), is("https://github.com/hub4j-test-org/github-api"));
|
||||
assertThat(event.getPusher().getName(), is("bitwiseman"));
|
||||
assertThat(event.getPusher().getEmail(), is("bitwiseman@gmail.com"));
|
||||
assertThat(event.getSender().getLogin(), is("bitwiseman"));
|
||||
|
||||
assertThat(event.getRepository().isFork(), is(true));
|
||||
|
||||
// in offliine mode, we should not populate missing fields
|
||||
assertThat(event.getRepository().getSource(), is(nullValue()));
|
||||
assertThat(event.getRepository().getParent(), is(nullValue()));
|
||||
|
||||
assertThat(event.getRepository().getUrl().toString(), is("https://github.com/hub4j-test-org/github-api"));
|
||||
assertThat(event.getRepository().getHttpTransportUrl().toString(),
|
||||
is("https://github.com/hub4j-test-org/github-api.git"));
|
||||
|
||||
// Test repository populate
|
||||
event = gitHub.parseEventPayload(payload.asReader(mockGitHub::mapToMockGitHub), GHEventPayload.Push.class);
|
||||
assertThat(event.getRepository().getUrl().toString(), is("https://github.com/hub4j-test-org/github-api"));
|
||||
assertThat(event.getRepository().getHttpTransportUrl(), is("https://github.com/hub4j-test-org/github-api.git"));
|
||||
|
||||
event.getRepository().populate();
|
||||
|
||||
// After populate the url is fixed to point to the correct API endpoint
|
||||
assertThat(event.getRepository().getUrl().toString(),
|
||||
is(mockGitHub.apiServer().baseUrl() + "/repos/hub4j-test-org/github-api"));
|
||||
assertThat(event.getRepository().getHttpTransportUrl(), is("https://github.com/hub4j-test-org/github-api.git"));
|
||||
|
||||
// ensure that root has been bound after populate
|
||||
event.getRepository().getSource().getRef("heads/master");
|
||||
event.getRepository().getParent().getRef("heads/master");
|
||||
|
||||
// Source
|
||||
event = gitHub.parseEventPayload(payload.asReader(mockGitHub::mapToMockGitHub), GHEventPayload.Push.class);
|
||||
assertThat(event.getRepository().getSource().getFullName(), is("hub4j/github-api"));
|
||||
|
||||
// Parent
|
||||
event = gitHub.parseEventPayload(payload.asReader(mockGitHub::mapToMockGitHub), GHEventPayload.Push.class);
|
||||
assertThat(event.getRepository().getParent().getFullName(), is("hub4j/github-api"));
|
||||
|
||||
}
|
||||
|
||||
// TODO implement support classes and write test
|
||||
// @Test
|
||||
// public void release() throws Exception {}
|
||||
@@ -392,4 +459,43 @@ public class GHEventPayloadTest {
|
||||
assertThat(checkSuite.getApp().getId(), is(29310L));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Payload("installation_repositories")
|
||||
public void InstallationRepositoriesEvent() throws Exception {
|
||||
GHEventPayload.InstallationRepositories event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.InstallationRepositories.class);
|
||||
|
||||
assertThat(event.getAction(), is("added"));
|
||||
assertThat(event.getInstallation().getId(), is(957387L));
|
||||
assertThat(event.getInstallation().getAccount().getLogin(), is("Codertocat"));
|
||||
assertThat(event.getRepositorySelection(), is("selected"));
|
||||
|
||||
assertThat(event.getRepositoriesAdded().get(0).getId(), is(186853007L));
|
||||
assertThat(event.getRepositoriesAdded().get(0).getNodeId(), is("MDEwOlJlcG9zaXRvcnkxODY4NTMwMDc="));
|
||||
assertThat(event.getRepositoriesAdded().get(0).getName(), is("Space"));
|
||||
assertThat(event.getRepositoriesAdded().get(0).getFullName(), is("Codertocat/Space"));
|
||||
assertThat(event.getRepositoriesAdded().get(0).isPrivate(), is(false));
|
||||
|
||||
assertThat(event.getRepositoriesRemoved(), is(Collections.emptyList()));
|
||||
assertThat(event.getSender().getLogin(), is("Codertocat"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Payload("installation")
|
||||
public void InstallationEvent() throws Exception {
|
||||
GHEventPayload.Installation event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.Installation.class);
|
||||
|
||||
assertThat(event.getAction(), is("deleted"));
|
||||
assertThat(event.getInstallation().getId(), is(2L));
|
||||
assertThat(event.getInstallation().getAccount().getLogin(), is("octocat"));
|
||||
|
||||
assertThat(event.getRepositories().get(0).getId(), is(1296269L));
|
||||
assertThat(event.getRepositories().get(0).getNodeId(), is("MDEwOlJlcG9zaXRvcnkxODY4NTMwMDc="));
|
||||
assertThat(event.getRepositories().get(0).getName(), is("Hello-World"));
|
||||
assertThat(event.getRepositories().get(0).getFullName(), is("octocat/Hello-World"));
|
||||
assertThat(event.getRepositories().get(0).isPrivate(), is(false));
|
||||
|
||||
assertThat(event.getSender().getLogin(), is("octocat"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package org.kohsuke.github;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
|
||||
/**
|
||||
@@ -17,9 +19,12 @@ public class GHGistTest extends AbstractGitHubWireMockTest {
|
||||
.description("Test Gist")
|
||||
.file("abc.txt", "abc")
|
||||
.file("def.txt", "def")
|
||||
.file("ghi.txt", "ghi")
|
||||
.create();
|
||||
|
||||
assertThat(gist.getCreatedAt(), is(notNullValue()));
|
||||
assertThat(gist.getDescription(), equalTo("Test Gist"));
|
||||
assertThat(gist.getFiles().size(), equalTo(3));
|
||||
|
||||
assertNotNull(gist.getUpdatedAt());
|
||||
assertNotNull(gist.getCommentsUrl());
|
||||
@@ -28,7 +33,66 @@ public class GHGistTest extends AbstractGitHubWireMockTest {
|
||||
assertNotNull(gist.getGitPushUrl());
|
||||
assertNotNull(gist.getHtmlUrl());
|
||||
|
||||
String id = gist.getGistId();
|
||||
|
||||
GHGist gistUpdate = gitHub.getGist(id);
|
||||
assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId()));
|
||||
assertThat(gistUpdate.getDescription(), equalTo(gist.getDescription()));
|
||||
assertThat(gistUpdate.getFiles().size(), equalTo(3));
|
||||
|
||||
gistUpdate = gistUpdate.update().description("Gist Test").addFile("jkl.txt", "jkl").update();
|
||||
|
||||
assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId()));
|
||||
assertThat(gistUpdate.getDescription(), equalTo("Gist Test"));
|
||||
assertThat(gistUpdate.getFiles().size(), equalTo(4));
|
||||
|
||||
gistUpdate = gistUpdate.update()
|
||||
.renameFile("abc.txt", "ab.txt")
|
||||
.deleteFile("def.txt")
|
||||
.updateFile("ghi.txt", "gh")
|
||||
.updateFile("jkl.txt", "klm.txt", "nop")
|
||||
.update();
|
||||
|
||||
assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId()));
|
||||
assertThat(gistUpdate.getDescription(), equalTo("Gist Test"));
|
||||
assertThat(gistUpdate.getFiles().size(), equalTo(3));
|
||||
|
||||
// verify delete works
|
||||
assertThat(gistUpdate.getFile("def.txt"), nullValue());
|
||||
|
||||
// verify rename
|
||||
assertThat(gistUpdate.getFile("ab.txt").getContent(), equalTo("abc"));
|
||||
|
||||
// verify updates
|
||||
assertThat(gistUpdate.getFile("ghi.txt").getContent(), equalTo("gh"));
|
||||
assertThat(gistUpdate.getFile("klm.txt").getContent(), equalTo("nop"));
|
||||
|
||||
// rename and update on the same file in one update shoudl work.
|
||||
gistUpdate = gistUpdate.update().renameFile("ab.txt", "a.txt").updateFile("ab.txt", "abcd").update();
|
||||
|
||||
assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId()));
|
||||
assertThat(gistUpdate.getFiles().size(), equalTo(3));
|
||||
|
||||
// verify rename and update
|
||||
assertThat(gistUpdate.getFile("a.txt").getContent(), equalTo("abcd"));
|
||||
|
||||
try {
|
||||
gist.getId();
|
||||
fail("Newly created gists do not have numeric ids.");
|
||||
} catch (NumberFormatException e) {
|
||||
assertThat(e, notNullValue());
|
||||
}
|
||||
|
||||
assertThat(gist.getGistId(), notNullValue());
|
||||
|
||||
gist.delete();
|
||||
|
||||
try {
|
||||
gitHub.getGist(id);
|
||||
fail("Gist should be deleted.");
|
||||
} catch (FileNotFoundException e) {
|
||||
assertThat(e, notNullValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,6 +127,8 @@ public class GHGistTest extends AbstractGitHubWireMockTest {
|
||||
GHGist gist = gitHub.getGist("9903708");
|
||||
|
||||
assertTrue(gist.isPublic());
|
||||
assertThat(gist.getId(), equalTo(9903708L));
|
||||
assertThat(gist.getGistId(), equalTo("9903708"));
|
||||
|
||||
assertEquals(1, gist.getFiles().size());
|
||||
GHGistFile f = gist.getFile("keybase.md");
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
|
||||
public class GHIssueEventAttributeTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
private enum Type implements Predicate<GHIssueEvent>, Consumer<GHIssueEvent> {
|
||||
milestone(e -> assertNotNull(e.getMilestone()), "milestoned", "demilestoned"),
|
||||
label(e -> assertNotNull(e.getLabel()), "labeled", "unlabeled"),
|
||||
assignment(e -> assertNotNull(e.getAssignee()), "assigned", "unassigned");
|
||||
|
||||
private final Consumer<GHIssueEvent> assertion;
|
||||
private final Set<String> subtypes;
|
||||
|
||||
Type(final Consumer<GHIssueEvent> assertion, final String... subtypes) {
|
||||
this.assertion = assertion;
|
||||
this.subtypes = new HashSet<>(asList(subtypes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(final GHIssueEvent event) {
|
||||
return this.subtypes.contains(event.getEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final GHIssueEvent event) {
|
||||
this.assertion.accept(event);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<GHIssueEvent> listEvents(final Type type) throws IOException {
|
||||
return StreamSupport
|
||||
.stream(gitHub.getRepository("chids/project-milestone-test").getIssue(1).listEvents().spliterator(),
|
||||
false)
|
||||
.filter(type)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEventSpecificAttributes() throws IOException {
|
||||
for (Type type : Type.values()) {
|
||||
final List<GHIssueEvent> events = listEvents(type);
|
||||
assertThat(events, hasSize(2));
|
||||
events.forEach(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,6 @@ public class GHIssueEventTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.junit.Test;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
* @author Duncan Dickinson
|
||||
*/
|
||||
@@ -91,7 +93,7 @@ public class GHLicenseTest extends AbstractGitHubWireMockTest {
|
||||
*/
|
||||
@Test
|
||||
public void checkRepositoryLicense() throws IOException {
|
||||
GHRepository repo = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository repo = gitHub.getRepository("hub4j/github-api");
|
||||
GHLicense license = repo.getLicense();
|
||||
assertNotNull("The license is populated", license);
|
||||
assertTrue("The key is correct", license.getKey().equals("mit"));
|
||||
@@ -157,7 +159,7 @@ public class GHLicenseTest extends AbstractGitHubWireMockTest {
|
||||
*/
|
||||
@Test
|
||||
public void checkRepositoryFullLicense() throws IOException {
|
||||
GHRepository repo = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository repo = gitHub.getRepository("hub4j/github-api");
|
||||
GHLicense license = repo.getLicense();
|
||||
assertNotNull("The license is populated", license);
|
||||
assertTrue("The key is correct", license.getKey().equals("mit"));
|
||||
@@ -190,4 +192,21 @@ public class GHLicenseTest extends AbstractGitHubWireMockTest {
|
||||
fail("Expected the license to be Base64 encoded but instead it was " + content.getEncoding());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accesses the 'bndtools/bnd' repo using {@link GitHub#getRepository(String)} and then calls
|
||||
* {@link GHRepository#getLicense()}. The description is null due to multiple licences
|
||||
*
|
||||
* @throws IOException
|
||||
* if test fails
|
||||
*/
|
||||
@Test
|
||||
public void checkRepositoryLicenseForIndeterminate() throws IOException {
|
||||
GHRepository repo = gitHub.getRepository("bndtools/bnd");
|
||||
GHLicense license = repo.getLicense();
|
||||
assertNotNull("The license is populated", license);
|
||||
assertThat(license.getKey(), equalTo("other"));
|
||||
assertThat(license.getDescription(), is(nullValue()));
|
||||
assertThat(license.getUrl(), is(nullValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import org.junit.Test;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Martin van Zijl
|
||||
*/
|
||||
@@ -23,7 +21,8 @@ public class GHMilestoneTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
for (GHMilestone milestone : getRepository(getGitHubBeforeAfter()).listMilestones(GHIssueState.ALL)) {
|
||||
if ("Original Title".equals(milestone.getTitle()) || "Updated Title".equals(milestone.getTitle())) {
|
||||
if ("Original Title".equals(milestone.getTitle()) || "Updated Title".equals(milestone.getTitle())
|
||||
|| "Unset Test Milestone".equals(milestone.getTitle())) {
|
||||
milestone.delete();
|
||||
}
|
||||
}
|
||||
@@ -54,11 +53,28 @@ public class GHMilestoneTest extends AbstractGitHubWireMockTest {
|
||||
assertEquals(OUTPUT_DUE_DATE, milestone.getDueOn());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsetMilestone() throws IOException {
|
||||
GHRepository repo = getRepository();
|
||||
GHMilestone milestone = repo.createMilestone("Unset Test Milestone", "For testUnsetMilestone");
|
||||
GHIssue issue = repo.createIssue("Issue for testUnsetMilestone").create();
|
||||
|
||||
// set the milestone
|
||||
issue.setMilestone(milestone);
|
||||
issue = repo.getIssue(issue.getNumber()); // force reload
|
||||
assertEquals(milestone.getNumber(), issue.getMilestone().getNumber());
|
||||
|
||||
// remove the milestone
|
||||
issue.setMilestone(null);
|
||||
issue = repo.getIssue(issue.getNumber()); // force reload
|
||||
assertEquals(null, issue.getMilestone());
|
||||
}
|
||||
|
||||
protected GHRepository getRepository() throws IOException {
|
||||
return getRepository(gitHub);
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class GHObjectTest extends org.kohsuke.github.AbstractGitHubWireMockTest
|
||||
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
|
||||
assertThat(org.toString(),
|
||||
containsString(
|
||||
"login=github-api-test-org,location=<null>,blog=<null>,email=<null>,name=<null>,company=<null>,type=Organization,followers=0,following=0"));
|
||||
"login=hub4j-test-org,location=<null>,blog=<null>,email=<null>,name=<null>,company=<null>,type=Organization,followers=0,following=0"));
|
||||
|
||||
// getResponseHeaderFields is deprecated but we should not break it.
|
||||
assertThat(org.getResponseHeaderFields(), notNullValue());
|
||||
|
||||
@@ -28,6 +28,6 @@ public class GHPersonTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
// Assert htmlUrl is not null
|
||||
assertNotNull(comment.getHtmlUrl());
|
||||
assertEquals(new URL("https://github.com/github-api-test-org/github-api/pull/266#discussion_r321995146"),
|
||||
assertEquals(new URL("https://github.com/hub4j-test-org/github-api/pull/266#discussion_r321995146"),
|
||||
comment.getHtmlUrl());
|
||||
|
||||
comment.update("Updated review comment");
|
||||
@@ -156,7 +156,7 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
// System.out.println(p.getUrl());
|
||||
assertTrue(p.getRequestedReviewers().isEmpty());
|
||||
|
||||
GHOrganization testOrg = gitHub.getOrganization("github-api-test-org");
|
||||
GHOrganization testOrg = gitHub.getOrganization("hub4j-test-org");
|
||||
GHTeam testTeam = testOrg.getTeamBySlug("dummy-team");
|
||||
|
||||
p.requestTeamReviewers(Collections.singletonList(testTeam));
|
||||
@@ -258,7 +258,7 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
// Query by one of the heads and make sure we only get that branch's PR back.
|
||||
List<GHPullRequest> prs = repo.queryPullRequests()
|
||||
.state(GHIssueState.OPEN)
|
||||
.head("github-api-test-org:test/stable")
|
||||
.head("hub4j-test-org:test/stable")
|
||||
.base("master")
|
||||
.list()
|
||||
.toList();
|
||||
@@ -329,6 +329,6 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,8 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
Thread.sleep(1500);
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// First call to /user gets response without rate limit information
|
||||
// Some versions of GHE include header rate limit information, some do not
|
||||
// This response mocks the behavior without header rate limit information
|
||||
gitHub = GitHub.connectToEnterprise(mockGitHub.apiServer().baseUrl(), "bogus", "bogus");
|
||||
gitHub.getMyself();
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(2));
|
||||
@@ -246,6 +247,10 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
// Give this a moment
|
||||
Thread.sleep(1500);
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// GHE returns 404 from /rate_limit
|
||||
// Some versions of GHE include header rate limit information, some do not
|
||||
// This response mocks the behavior without header rate limit information
|
||||
// Always requests new info
|
||||
rateLimit = gitHub.getRateLimit();
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(4));
|
||||
@@ -266,12 +271,13 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
assertThat(gitHub.rateLimit(), sameInstance(rateLimit));
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Second call to /user gets response with rate limit information
|
||||
// Some versions of GHE include header rate limit information, some do not
|
||||
// This response mocks the behavior with header rate limit information
|
||||
gitHub = GitHub.connectToEnterprise(mockGitHub.apiServer().baseUrl(), "bogus", "bogus");
|
||||
gitHub.getMyself();
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(5));
|
||||
|
||||
// Since we already had rate limit info these don't request again
|
||||
// Since just got rate limit from header, these don't request again
|
||||
rateLimit = gitHub.lastRateLimit();
|
||||
assertThat(rateLimit, notNullValue());
|
||||
assertThat(rateLimit.getLimit(), equalTo(5000));
|
||||
@@ -293,17 +299,30 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
// Give this a moment
|
||||
Thread.sleep(1500);
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// GHE returns 404 from /rate_limit
|
||||
// Some versions of GHE include header rate limit information, some do not
|
||||
// This response mocks the behavior with header rate limit information
|
||||
// Mocks that other requests come in since previous call
|
||||
// Always requests new info
|
||||
rateLimit = gitHub.getRateLimit();
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(6));
|
||||
|
||||
assertThat(rateLimit.getCore(), instanceOf(GHRateLimit.UnknownLimitRecord.class));
|
||||
assertThat(rateLimit.getLimit(), equalTo(GHRateLimit.UnknownLimitRecord.unknownLimit));
|
||||
assertThat(rateLimit.getRemaining(), equalTo(GHRateLimit.UnknownLimitRecord.unknownRemaining));
|
||||
assertThat(rateLimit.getResetDate().compareTo(lastReset), equalTo(1));
|
||||
// getRateLimit() uses headerRateLimit if /rate_limit returns a 404
|
||||
// and headerRateLimit is available and not expired
|
||||
assertThat(rateLimit, notNullValue());
|
||||
assertThat(rateLimit.getLimit(), equalTo(5000));
|
||||
// 11 requests since previous api call
|
||||
// This verifies that header rate limit info is recorded even for /rate_limit endpoint and 404 response
|
||||
assertThat(rateLimit.getRemaining(), equalTo(4967));
|
||||
assertThat(rateLimit.getResetDate().compareTo(lastReset), equalTo(0));
|
||||
|
||||
// getRateLimit() uses headerRateLimit if /rate_limit returns a 404
|
||||
// and headerRateLimit is available and not expired
|
||||
assertThat(rateLimit, sameInstance(gitHub.lastRateLimit()));
|
||||
|
||||
// ratelimit() should prefer headerRateLimit when getRateLimit fails and headerRateLimit is not expired
|
||||
assertThat(gitHub.rateLimit(), equalTo(headerRateLimit));
|
||||
assertThat(gitHub.rateLimit(), sameInstance(rateLimit));
|
||||
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(6));
|
||||
|
||||
@@ -321,9 +340,8 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
fail("Invalid rate limit missing some records should throw");
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(HttpException.class));
|
||||
assertThat(e.getCause(), instanceOf(IOException.class));
|
||||
assertThat(e.getCause().getCause(), instanceOf(ValueInstantiationException.class));
|
||||
assertThat(e.getCause().getCause().getMessage(),
|
||||
assertThat(e.getCause(), instanceOf(ValueInstantiationException.class));
|
||||
assertThat(e.getCause().getMessage(),
|
||||
containsString(
|
||||
"Cannot construct instance of `org.kohsuke.github.GHRateLimit`, problem: `java.lang.NullPointerException`"));
|
||||
}
|
||||
@@ -333,9 +351,8 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
fail("Invalid rate limit record missing a value should throw");
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(HttpException.class));
|
||||
assertThat(e.getCause(), instanceOf(IOException.class));
|
||||
assertThat(e.getCause().getCause(), instanceOf(MismatchedInputException.class));
|
||||
assertThat(e.getCause().getCause().getMessage(),
|
||||
assertThat(e.getCause(), instanceOf(MismatchedInputException.class));
|
||||
assertThat(e.getCause().getMessage(),
|
||||
containsString("Missing required creator property 'reset' (index 2)"));
|
||||
}
|
||||
|
||||
@@ -452,7 +469,7 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -23,7 +24,32 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetters() throws IOException {
|
||||
GHRepository r = getTempRepository();
|
||||
|
||||
assertThat(r.hasAdminAccess(), is(true));
|
||||
assertThat(r.hasDownloads(), is(true));
|
||||
assertThat(r.hasIssues(), is(true));
|
||||
assertThat(r.hasPages(), is(false));
|
||||
assertThat(r.hasProjects(), is(true));
|
||||
assertThat(r.hasPullAccess(), is(true));
|
||||
assertThat(r.hasPushAccess(), is(true));
|
||||
assertThat(r.hasWiki(), is(true));
|
||||
|
||||
assertThat(r.isAllowMergeCommit(), is(true));
|
||||
assertThat(r.isAllowRebaseMerge(), is(true));
|
||||
assertThat(r.isAllowSquashMerge(), is(true));
|
||||
|
||||
String httpTransport = "https://github.com/hub4j-test-org/temp-testGetters.git";
|
||||
assertThat(r.getHttpTransportUrl(), equalTo(httpTransport));
|
||||
assertThat(r.gitHttpTransportUrl(), equalTo(httpTransport));
|
||||
|
||||
assertThat(r.getName(), equalTo("temp-testGetters"));
|
||||
assertThat(r.getFullName(), equalTo("hub4j-test-org/temp-testGetters"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,7 +92,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
assertThat(e.getMessage(),
|
||||
equalTo("Server returned HTTP response code: 200, message: '404 Not Found' for URL: "
|
||||
+ mockGitHub.apiServer().baseUrl()
|
||||
+ "/repos/github-api-test-org/github-api/branches/test/NonExistent"));
|
||||
+ "/repos/hub4j-test-org/github-api/branches/test/NonExistent"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +128,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void listContributors() throws IOException {
|
||||
GHRepository r = gitHub.getOrganization("github-api").getRepository("github-api");
|
||||
GHRepository r = gitHub.getOrganization("hub4j").getRepository("github-api");
|
||||
int i = 0;
|
||||
boolean kohsuke = false;
|
||||
|
||||
@@ -122,7 +148,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
@Test
|
||||
public void getPermission() throws Exception {
|
||||
kohsuke();
|
||||
GHRepository r = gitHub.getRepository("github-api-test-org/test-permission");
|
||||
GHRepository r = gitHub.getRepository("hub4j-test-org/test-permission");
|
||||
assertEquals(GHPermissionType.ADMIN, r.getPermission("kohsuke"));
|
||||
assertEquals(GHPermissionType.READ, r.getPermission("dude"));
|
||||
r = gitHub.getOrganization("apache").getRepository("groovy");
|
||||
@@ -219,7 +245,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void listLanguages() throws IOException {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
String mainLanguage = r.getLanguage();
|
||||
assertTrue(r.listLanguages().containsKey(mainLanguage));
|
||||
}
|
||||
@@ -248,7 +274,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test // issue #162
|
||||
public void testIssue162() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
List<GHContent> contents = r.getDirectoryContent("", "gh-pages");
|
||||
for (GHContent content : contents) {
|
||||
if (content.isFile()) {
|
||||
@@ -264,27 +290,19 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
public void markDown() throws Exception {
|
||||
assertEquals("<p><strong>Test日本語</strong></p>", IOUtils.toString(gitHub.renderMarkdown("**Test日本語**")).trim());
|
||||
|
||||
String actual = IOUtils.toString(gitHub.getRepository("github-api/github-api")
|
||||
.renderMarkdown("@kohsuke to fix issue #1", MarkdownMode.GFM));
|
||||
String actual = IOUtils.toString(
|
||||
gitHub.getRepository("hub4j/github-api").renderMarkdown("@kohsuke to fix issue #1", MarkdownMode.GFM));
|
||||
// System.out.println(actual);
|
||||
assertTrue(actual.contains("href=\"https://github.com/kohsuke\""));
|
||||
assertTrue(actual.contains("href=\"https://github.com/github-api/github-api/pull/1\""));
|
||||
assertTrue(actual.contains("href=\"https://github.com/hub4j/github-api/pull/1\""));
|
||||
assertTrue(actual.contains("class=\"user-mention\""));
|
||||
assertTrue(actual.contains("class=\"issue-link "));
|
||||
assertTrue(actual.contains("to fix issue"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMergeOptions() throws IOException {
|
||||
GHRepository r = getTempRepository();
|
||||
assertNotNull(r.isAllowMergeCommit());
|
||||
assertNotNull(r.isAllowRebaseMerge());
|
||||
assertNotNull(r.isAllowSquashMerge());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setMergeOptions() throws IOException {
|
||||
// String repoName = "github-api-test-org/test-mergeoptions";
|
||||
// String repoName = "hub4j-test-org/test-mergeoptions";
|
||||
GHRepository r = getTempRepository();
|
||||
|
||||
// at least one merge option must be selected
|
||||
@@ -417,11 +435,91 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void listRefs() throws Exception {
|
||||
GHRepository repo = getTempRepository();
|
||||
List<GHRef> refs = repo.listRefs().toList();
|
||||
assertThat(refs, notNullValue());
|
||||
assertThat(refs.size(), equalTo(1));
|
||||
assertThat(refs.get(0).getRef(), equalTo("refs/heads/master"));
|
||||
GHRepository repo = getRepository();
|
||||
|
||||
List<GHRef> ghRefs;
|
||||
|
||||
// handle refs/*
|
||||
ghRefs = repo.listRefs("heads").toList();
|
||||
List<GHRef> ghRefsWithPrefix = repo.listRefs("refs/heads").toList();
|
||||
|
||||
assertThat(ghRefs, notNullValue());
|
||||
assertThat(ghRefs.size(), greaterThan(3));
|
||||
assertThat(ghRefs.get(0).getRef(), equalTo("refs/heads/changes"));
|
||||
assertThat(ghRefsWithPrefix.size(), equalTo(ghRefs.size()));
|
||||
assertThat(ghRefsWithPrefix.get(0).getRef(), equalTo(ghRefs.get(0).getRef()));
|
||||
|
||||
// git/refs/heads/gh-pages
|
||||
// passing a specific ref to listRefs will fail to parse due to returning a single item not an array
|
||||
try {
|
||||
ghRefs = repo.listRefs("heads/gh-pages").toList();
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(HttpException.class));
|
||||
assertThat(e.getCause(), instanceOf(JsonMappingException.class));
|
||||
}
|
||||
|
||||
// git/refs/heads/gh
|
||||
ghRefs = repo.listRefs("heads/gh").toList();
|
||||
assertThat(ghRefs, notNullValue());
|
||||
assertThat(ghRefs.size(), equalTo(1));
|
||||
assertThat(ghRefs.get(0).getRef(), equalTo("refs/heads/gh-pages"));
|
||||
|
||||
// git/refs/headz
|
||||
try {
|
||||
ghRefs = repo.listRefs("headz").toList();
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(),
|
||||
containsString(
|
||||
"{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/git/refs/#get-a-reference\"}"));
|
||||
assertThat(e.getCause(), instanceOf(FileNotFoundException.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getRef() throws Exception {
|
||||
GHRepository repo = getRepository();
|
||||
|
||||
GHRef ghRef;
|
||||
|
||||
// handle refs/*
|
||||
ghRef = repo.getRef("heads/gh-pages");
|
||||
GHRef ghRefWithPrefix = repo.getRef("refs/heads/gh-pages");
|
||||
|
||||
assertThat(ghRef, notNullValue());
|
||||
assertThat(ghRef.getRef(), equalTo("refs/heads/gh-pages"));
|
||||
assertThat(ghRefWithPrefix.getRef(), equalTo(ghRef.getRef()));
|
||||
|
||||
// git/refs/heads/gh-pages
|
||||
ghRef = repo.getRef("heads/gh-pages");
|
||||
assertThat(ghRef, notNullValue());
|
||||
assertThat(ghRef.getRef(), equalTo("refs/heads/gh-pages"));
|
||||
|
||||
// git/refs/heads/gh
|
||||
try {
|
||||
ghRef = repo.getRef("heads/gh");
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(),
|
||||
containsString(
|
||||
"{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/git/refs/#get-a-single-reference\"}"));
|
||||
assertThat(e.getCause(), instanceOf(FileNotFoundException.class));
|
||||
}
|
||||
|
||||
// git/refs/headz
|
||||
try {
|
||||
ghRef = repo.getRef("headz");
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(),
|
||||
containsString(
|
||||
"{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/git/refs/#get-a-single-reference\"}"));
|
||||
assertThat(e.getCause(), instanceOf(FileNotFoundException.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -441,8 +539,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(),
|
||||
containsString("/repos/github-api-test-org/temp-listRefsEmptyTags/git/refs/tags"));
|
||||
assertThat(e.getMessage(), containsString("/repos/hub4j-test-org/temp-listRefsEmptyTags/git/refs/tags"));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -452,8 +549,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(GHException.class));
|
||||
assertThat(e.getMessage(), containsString("Failed to retrieve "));
|
||||
assertThat(e.getMessage(),
|
||||
containsString("/repos/github-api-test-org/temp-listRefsEmptyTags/git/refs/tags"));
|
||||
assertThat(e.getMessage(), containsString("/repos/hub4j-test-org/temp-listRefsEmptyTags/git/refs/tags"));
|
||||
assertThat(e.getCause(), instanceOf(GHFileNotFoundException.class));
|
||||
}
|
||||
}
|
||||
@@ -501,7 +597,7 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
public void getCheckRuns() throws Exception {
|
||||
final int expectedCount = 8;
|
||||
// Use github-api repository as it has checks set up
|
||||
PagedIterable<GHCheckRun> checkRuns = gitHub.getOrganization("github-api")
|
||||
PagedIterable<GHCheckRun> checkRuns = gitHub.getOrganization("hub4j")
|
||||
.getRepository("github-api")
|
||||
.getCheckRuns("78b9ff49d47daaa158eb373c4e2e040f739df8b9");
|
||||
// Check if the paging works correctly
|
||||
|
||||
@@ -60,6 +60,6 @@ public class GHTagTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Arrays;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class GHTreeBuilderTest extends AbstractGitHubWireMockTest {
|
||||
private static String REPO_NAME = "github-api-test-org/GHTreeBuilderTest";
|
||||
private static String REPO_NAME = "hub4j-test-org/GHTreeBuilderTest";
|
||||
|
||||
private static String PATH_SCRIPT = "app/run.sh";
|
||||
private static String CONTENT_SCRIPT = "#!/bin/bash\necho Hello\n";
|
||||
|
||||
@@ -9,7 +9,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
// Issue 737
|
||||
@Test
|
||||
public void testExpiredKey() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f01");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -18,7 +18,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testNotSigningKey() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f02");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -27,7 +27,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testGpgverifyError() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f03");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -36,7 +36,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testGpgverifyUnavailable() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f04");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -46,7 +46,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testUnsigned() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f05");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -55,7 +55,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testUnknownSignatureType() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f06");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -65,7 +65,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testNoUser() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f07");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -74,7 +74,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testUnverifiedEmail() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f08");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -83,7 +83,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testBadEmail() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f09");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -92,7 +92,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testUnknownKey() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f10");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -101,7 +101,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testMalformedSignature() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f11");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -111,7 +111,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testInvalid() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f12");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
@@ -120,7 +120,7 @@ public class GHVerificationReasonTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testValid() throws Exception {
|
||||
GHRepository r = gitHub.getRepository("github-api/github-api");
|
||||
GHRepository r = gitHub.getRepository("hub4j/github-api");
|
||||
GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f13");
|
||||
assertEquals(commit.getCommitShortInfo().getAuthor().getName(), "Sourabh Parkala");
|
||||
assertTrue(commit.getCommitShortInfo().getVerification().isVerified());
|
||||
|
||||
@@ -8,8 +8,7 @@ import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
|
||||
/**
|
||||
@@ -131,6 +130,32 @@ public class GitHubStaticTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMappingReaderWriter() throws Exception {
|
||||
|
||||
// This test ensures that data objects can be written and read in a raw form from string.
|
||||
// This behavior is completely unsupported and should not be used but given that some
|
||||
// clients, such as Jenkins Blue Ocean, have already implemented their own Jackson
|
||||
// Reader and Writer that bind this library's data objects from outside this library
|
||||
// this makes sure they don't break.
|
||||
|
||||
GHRepository repo = getTempRepository();
|
||||
assertThat(repo.root, not(nullValue()));
|
||||
|
||||
String repoString = GitHub.getMappingObjectWriter().writeValueAsString(repo);
|
||||
assertThat(repoString, not(nullValue()));
|
||||
assertThat(repoString, containsString("testMappingReaderWriter"));
|
||||
|
||||
GHRepository readRepo = GitHub.getMappingObjectReader().forType(GHRepository.class).readValue(repoString);
|
||||
|
||||
// This should never happen if these methods aren't used
|
||||
assertThat(readRepo.root, nullValue());
|
||||
|
||||
String readRepoString = GitHub.getMappingObjectWriter().writeValueAsString(readRepo);
|
||||
assertThat(readRepoString, equalTo(repoString));
|
||||
|
||||
}
|
||||
|
||||
static String formatDate(Date dt, String format) {
|
||||
SimpleDateFormat df = new SimpleDateFormat(format);
|
||||
df.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
|
||||
@@ -10,7 +10,11 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author Stephen Connolly
|
||||
@@ -79,6 +83,11 @@ public class PayloadRule implements TestRule {
|
||||
return new InputStreamReader(asInputStream(), Charset.defaultCharset());
|
||||
}
|
||||
|
||||
public Reader asReader(@Nonnull Function<String, String> transformer) throws IOException {
|
||||
String payloadString = asString();
|
||||
return new StringReader(transformer.apply(payloadString));
|
||||
}
|
||||
|
||||
public Reader asReader(String encoding) throws IOException {
|
||||
return new InputStreamReader(asInputStream(), encoding);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class RateLimitCheckerTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
// Should succeed without querying rate limit
|
||||
// Also due to earlier reset date, new value is ignored.
|
||||
GHOrganization org = gitHub.getOrganization("github-api-test-org");
|
||||
GHOrganization org = gitHub.getOrganization("hub4j-test-org");
|
||||
updateTestRateLimit();
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(3));
|
||||
assertThat(rateLimit.getCore().getRemaining(), equalTo(4501));
|
||||
@@ -89,7 +89,7 @@ public class RateLimitCheckerTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RepositoryTrafficTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j").getRepository("github-api");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -50,7 +50,7 @@ public class RequesterRetryTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -113,7 +113,7 @@ public class RequesterRetryTest extends AbstractGitHubWireMockTest {
|
||||
try {
|
||||
// status code is a different code path that should also be covered by this.
|
||||
gitHub.createRequest()
|
||||
.withUrlPath("/repos/github-api-test-org/github-api/branches/test/timeout")
|
||||
.withUrlPath("/repos/hub4j-test-org/github-api/branches/test/timeout")
|
||||
.fetchHttpStatusCode();
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
@@ -260,7 +260,7 @@ public class RequesterRetryTest extends AbstractGitHubWireMockTest {
|
||||
} catch (Exception e) {
|
||||
assertThat(e, instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getCause(), instanceOf(FileNotFoundException.class));
|
||||
assertThat(e.getCause().getMessage(), containsString("github-api-test-org-missing"));
|
||||
assertThat(e.getCause().getMessage(), containsString("hub4j-test-org-missing"));
|
||||
String capturedLog = getTestCapturedLog();
|
||||
assertFalse(capturedLog.contains("will try 2 more time"));
|
||||
assertFalse(capturedLog.contains("will try 1 more time"));
|
||||
|
||||
@@ -4,12 +4,16 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
/**
|
||||
* Tests in this class are meant to show the behavior of {@link AbstractGitHubWireMockTest} with proxying on or off.
|
||||
*
|
||||
* <p>
|
||||
* The wiremock data for these tests should only be modified by hand - thus most are skipped when snapshotting.
|
||||
*
|
||||
@@ -27,15 +31,16 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
assertThat(gitHub.getClient().login, not(equalTo(STUBBED_USER_LOGIN)));
|
||||
|
||||
// If this user query fails, either the proxying config has broken (unlikely)
|
||||
// or your auth settings are not being retrieved from the environemnt.
|
||||
// or your auth settings are not being retrieved from the environment.
|
||||
// Check your settings.
|
||||
GHUser user = gitHub.getMyself();
|
||||
assertThat(user.getLogin(), notNullValue());
|
||||
|
||||
// System.out.println();
|
||||
// System.out.println("WireMockStatusReporterTest: GitHub proxying and user auth correctly configured for user
|
||||
// login: " + user.getLogin());
|
||||
// System.out.println();
|
||||
System.out.println();
|
||||
System.out.println(
|
||||
"WireMockStatusReporterTest: GitHub proxying and user auth correctly configured for user login: "
|
||||
+ user.getLogin());
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,7 +71,7 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
GHRepository repo = null;
|
||||
|
||||
// Valid repository, stubbed
|
||||
repo = gitHub.getRepository("github-api/github-api");
|
||||
repo = gitHub.getRepository("hub4j/github-api");
|
||||
assertThat(repo.getDescription(), equalTo("this is a stubbed description"));
|
||||
|
||||
// Invalid repository, without stub - fails 404 when not proxying
|
||||
@@ -102,7 +107,7 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
GHRepository repo = null;
|
||||
|
||||
// Valid repository, stubbed
|
||||
repo = gitHub.getRepository("github-api/github-api");
|
||||
repo = gitHub.getRepository("hub4j/github-api");
|
||||
assertThat(repo.getDescription(), equalTo("this is a stubbed description"));
|
||||
|
||||
// Valid repository, without stub - succeeds when proxying
|
||||
|
||||
@@ -179,7 +179,7 @@ public class GitHubCachingTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class GitHubCachingTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
}
|
||||
|
||||
private static GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
return gitHub.getOrganization("hub4j-test-org").getRepository("github-api");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.kohsuke.github.junit;
|
||||
|
||||
import com.github.tomakehurst.wiremock.WireMockServer;
|
||||
import com.github.tomakehurst.wiremock.client.WireMock;
|
||||
import com.github.tomakehurst.wiremock.common.FileSource;
|
||||
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
|
||||
import com.github.tomakehurst.wiremock.extension.Parameters;
|
||||
import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
|
||||
import com.github.tomakehurst.wiremock.http.*;
|
||||
import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder;
|
||||
import com.github.tomakehurst.wiremock.verification.*;
|
||||
import com.google.gson.*;
|
||||
|
||||
import java.io.File;
|
||||
@@ -20,6 +18,8 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
||||
import static com.github.tomakehurst.wiremock.common.Gzip.unGzipToString;
|
||||
|
||||
@@ -264,6 +264,24 @@ public class GitHubWireMockRule extends WireMockMultiServerRule {
|
||||
return targetPath;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String mapToMockGitHub(String body) {
|
||||
body = body.replace("https://api.github.com", this.apiServer().baseUrl());
|
||||
|
||||
if (this.rawServer() != null) {
|
||||
body = body.replace("https://raw.githubusercontent.com", this.rawServer().baseUrl());
|
||||
} else {
|
||||
body = body.replace("https://raw.githubusercontent.com", this.apiServer().baseUrl() + "/raw");
|
||||
}
|
||||
|
||||
if (this.uploadsServer() != null) {
|
||||
body = body.replace("https://uploads.github.com", this.uploadsServer().baseUrl());
|
||||
} else {
|
||||
body = body.replace("https://uploads.github.com", this.apiServer().baseUrl() + "/uploads");
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* A number of modifications are needed as runtime to make responses target the WireMock server and not accidentally
|
||||
* switch to using the live github servers.
|
||||
@@ -286,19 +304,7 @@ public class GitHubWireMockRule extends WireMockMultiServerRule {
|
||||
|
||||
String body;
|
||||
body = getBodyAsString(response, headers);
|
||||
body = body.replace("https://api.github.com", rule.apiServer().baseUrl());
|
||||
|
||||
if (rule.rawServer() != null) {
|
||||
body = body.replace("https://raw.githubusercontent.com", rule.rawServer().baseUrl());
|
||||
} else {
|
||||
body = body.replace("https://raw.githubusercontent.com", rule.apiServer().baseUrl() + "/raw");
|
||||
}
|
||||
|
||||
if (rule.uploadsServer() != null) {
|
||||
body = body.replace("https://uploads.github.com", rule.uploadsServer().baseUrl());
|
||||
} else {
|
||||
body = body.replace("https://uploads.github.com", rule.apiServer().baseUrl() + "/uploads");
|
||||
}
|
||||
body = rule.mapToMockGitHub(body);
|
||||
|
||||
builder.body(body);
|
||||
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"id": 238757196,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
|
||||
"name": "temp-testHandler_Fail",
|
||||
"full_name": "github-api-test-org/temp-testHandler_Fail",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
|
||||
"description": "A test repository for testing the github-api project: temp-testHandler_Fail",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail",
|
||||
"forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/forks",
|
||||
"keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/teams",
|
||||
"hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/events",
|
||||
"assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/tags",
|
||||
"blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscription",
|
||||
"commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/merges",
|
||||
"archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/downloads",
|
||||
"issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/deployments",
|
||||
"created_at": "2020-02-06T18:33:39Z",
|
||||
"updated_at": "2020-02-06T18:33:43Z",
|
||||
"pushed_at": "2020-02-06T18:33:41Z",
|
||||
"git_url": "git://github.com/github-api-test-org/temp-testHandler_Fail.git",
|
||||
"ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Fail.git",
|
||||
"clone_url": "https://github.com/github-api-test-org/temp-testHandler_Fail.git",
|
||||
"svn_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": null,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"temp_clone_token": "",
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"allow_rebase_merge": true,
|
||||
"delete_branch_on_merge": false,
|
||||
"organization": {
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"network_count": 0,
|
||||
"subscribers_count": 6
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"id": 238757196,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
|
||||
"name": "temp-testHandler_Fail",
|
||||
"full_name": "hub4j-test-org/temp-testHandler_Fail",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?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": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/hub4j-test-org/temp-testHandler_Fail",
|
||||
"description": "A test repository for testing the github-api project: temp-testHandler_Fail",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail",
|
||||
"forks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/forks",
|
||||
"keys_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/teams",
|
||||
"hooks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/events",
|
||||
"assignees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/tags",
|
||||
"blobs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/subscription",
|
||||
"commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/merges",
|
||||
"archive_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/downloads",
|
||||
"issues_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/deployments",
|
||||
"created_at": "2020-02-06T18:33:39Z",
|
||||
"updated_at": "2020-02-06T18:33:43Z",
|
||||
"pushed_at": "2020-02-06T18:33:41Z",
|
||||
"git_url": "git://github.com/hub4j-test-org/temp-testHandler_Fail.git",
|
||||
"ssh_url": "git@github.com:hub4j-test-org/temp-testHandler_Fail.git",
|
||||
"clone_url": "https://github.com/hub4j-test-org/temp-testHandler_Fail.git",
|
||||
"svn_url": "https://github.com/hub4j-test-org/temp-testHandler_Fail",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": null,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"temp_clone_token": "",
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"allow_rebase_merge": true,
|
||||
"delete_branch_on_merge": false,
|
||||
"organization": {
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?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": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"network_count": 0,
|
||||
"subscribers_count": 6
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_github-api-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "30",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "Started",
|
||||
"newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"id": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"name": "repos_github-api-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-3.json",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4922",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
|
||||
}
|
||||
},
|
||||
"uuid": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_hub4j-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "30",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "Started",
|
||||
"newScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"id": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"name": "repos_hub4j-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_hub4j-test-org_temp-testratelimithandler_fail-3.json",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4922",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
|
||||
}
|
||||
},
|
||||
"uuid": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"id": 238757196,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
|
||||
"name": "temp-testHandler_Fail",
|
||||
"full_name": "github-api-test-org/temp-testHandler_Fail",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
|
||||
"description": "A test repository for testing the github-api project: temp-testHandler_Fail",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail",
|
||||
"forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/forks",
|
||||
"keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/teams",
|
||||
"hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/events",
|
||||
"assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/tags",
|
||||
"blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscription",
|
||||
"commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/merges",
|
||||
"archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/downloads",
|
||||
"issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/deployments",
|
||||
"created_at": "2020-02-06T18:33:39Z",
|
||||
"updated_at": "2020-02-06T18:33:43Z",
|
||||
"pushed_at": "2020-02-06T18:33:41Z",
|
||||
"git_url": "git://github.com/github-api-test-org/temp-testHandler_Fail.git",
|
||||
"ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Fail.git",
|
||||
"clone_url": "https://github.com/github-api-test-org/temp-testHandler_Fail.git",
|
||||
"svn_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": null,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"temp_clone_token": "",
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"allow_rebase_merge": true,
|
||||
"delete_branch_on_merge": false,
|
||||
"organization": {
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"network_count": 0,
|
||||
"subscribers_count": 6
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"id": 238757196,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
|
||||
"name": "temp-testHandler_Fail",
|
||||
"full_name": "hub4j-test-org/temp-testHandler_Fail",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?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": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/hub4j-test-org/temp-testHandler_Fail",
|
||||
"description": "A test repository for testing the github-api project: temp-testHandler_Fail",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail",
|
||||
"forks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/forks",
|
||||
"keys_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/teams",
|
||||
"hooks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/events",
|
||||
"assignees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/tags",
|
||||
"blobs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/subscription",
|
||||
"commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/merges",
|
||||
"archive_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/downloads",
|
||||
"issues_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Fail/deployments",
|
||||
"created_at": "2020-02-06T18:33:39Z",
|
||||
"updated_at": "2020-02-06T18:33:43Z",
|
||||
"pushed_at": "2020-02-06T18:33:41Z",
|
||||
"git_url": "git://github.com/hub4j-test-org/temp-testHandler_Fail.git",
|
||||
"ssh_url": "git@github.com:hub4j-test-org/temp-testHandler_Fail.git",
|
||||
"clone_url": "https://github.com/hub4j-test-org/temp-testHandler_Fail.git",
|
||||
"svn_url": "https://github.com/hub4j-test-org/temp-testHandler_Fail",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": null,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"temp_clone_token": "",
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"allow_rebase_merge": true,
|
||||
"delete_branch_on_merge": false,
|
||||
"organization": {
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?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": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"network_count": 0,
|
||||
"subscribers_count": 6
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_github-api-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "30",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "Started",
|
||||
"newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"id": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"name": "repos_github-api-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-3.json",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4922",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
|
||||
}
|
||||
},
|
||||
"uuid": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_hub4j-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "30",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "Started",
|
||||
"newScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"id": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"name": "repos_hub4j-test-org_temp-testratelimithandler_fail",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_Fail",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_hub4j-test-org_temp-testratelimithandler_fail-3.json",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4922",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
|
||||
}
|
||||
},
|
||||
"uuid": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail",
|
||||
"requiredScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Fail-2",
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"id": 238757196,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
|
||||
"name": "temp-testHandler_Wait",
|
||||
"full_name": "github-api-test-org/temp-testHandler_Wait",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/github-api-test-org/temp-testHandler_Wait",
|
||||
"description": "A test repository for testing the github-api project: temp-testHandler_Wait",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait",
|
||||
"forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/forks",
|
||||
"keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/teams",
|
||||
"hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/events",
|
||||
"assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/tags",
|
||||
"blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/subscription",
|
||||
"commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/merges",
|
||||
"archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/downloads",
|
||||
"issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/deployments",
|
||||
"created_at": "2020-02-06T18:33:39Z",
|
||||
"updated_at": "2020-02-06T18:33:43Z",
|
||||
"pushed_at": "2020-02-06T18:33:41Z",
|
||||
"git_url": "git://github.com/github-api-test-org/temp-testHandler_Wait.git",
|
||||
"ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Wait.git",
|
||||
"clone_url": "https://github.com/github-api-test-org/temp-testHandler_Wait.git",
|
||||
"svn_url": "https://github.com/github-api-test-org/temp-testHandler_Wait",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": null,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"temp_clone_token": "",
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"allow_rebase_merge": true,
|
||||
"delete_branch_on_merge": false,
|
||||
"organization": {
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"network_count": 0,
|
||||
"subscribers_count": 6
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"id": 238757196,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
|
||||
"name": "temp-testHandler_Wait",
|
||||
"full_name": "hub4j-test-org/temp-testHandler_Wait",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?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": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/hub4j-test-org/temp-testHandler_Wait",
|
||||
"description": "A test repository for testing the github-api project: temp-testHandler_Wait",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait",
|
||||
"forks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/forks",
|
||||
"keys_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/teams",
|
||||
"hooks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/events",
|
||||
"assignees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/tags",
|
||||
"blobs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/subscription",
|
||||
"commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/merges",
|
||||
"archive_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/downloads",
|
||||
"issues_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait/deployments",
|
||||
"created_at": "2020-02-06T18:33:39Z",
|
||||
"updated_at": "2020-02-06T18:33:43Z",
|
||||
"pushed_at": "2020-02-06T18:33:41Z",
|
||||
"git_url": "git://github.com/hub4j-test-org/temp-testHandler_Wait.git",
|
||||
"ssh_url": "git@github.com:hub4j-test-org/temp-testHandler_Wait.git",
|
||||
"clone_url": "https://github.com/hub4j-test-org/temp-testHandler_Wait.git",
|
||||
"svn_url": "https://github.com/hub4j-test-org/temp-testHandler_Wait",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": null,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"temp_clone_token": "",
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"allow_rebase_merge": true,
|
||||
"delete_branch_on_merge": false,
|
||||
"organization": {
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?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": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"network_count": 0,
|
||||
"subscribers_count": 6
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_github-api-test-org_temp-testHandler_Wait",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_Wait",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "2",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait",
|
||||
"requiredScenarioState": "Started",
|
||||
"newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait-2",
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"id": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"name": "repos_github-api-test-org_temp-testHandler_Wait",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_Wait",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-3.json",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4922",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
|
||||
}
|
||||
},
|
||||
"uuid": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait",
|
||||
"requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait-2",
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_hub4j-test-org_temp-testHandler_Wait",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_Wait",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "2",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait",
|
||||
"requiredScenarioState": "Started",
|
||||
"newScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait-2",
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"id": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"name": "repos_hub4j-test-org_temp-testHandler_Wait",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_Wait",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_hub4j-test-org_temp-testratelimithandler_fail-3.json",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4922",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
|
||||
}
|
||||
},
|
||||
"uuid": "574da117-6845-46d8-b2c1-4415546ca670",
|
||||
"persistent": true,
|
||||
"scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait",
|
||||
"requiredScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait-2",
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_github-api-test-org_temp-testHandler_WaitStuck",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/temp-testHandler_WaitStuck",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"name": "repos_hub4j-test-org_temp-testHandler_WaitStuck",
|
||||
"request": {
|
||||
"url": "/repos/hub4j-test-org/temp-testHandler_WaitStuck",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
|
||||
"headers": {
|
||||
"Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
"Status": "403 Forbidden",
|
||||
"Retry-After": "3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4000",
|
||||
"X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding"
|
||||
],
|
||||
"ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
|
||||
"Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
|
||||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
|
||||
}
|
||||
},
|
||||
"uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
|
||||
"persistent": true,
|
||||
"insertionIndex": 2
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user