Moves json samples to directory
This commit is contained in:
@@ -51,7 +51,7 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void bitbucketSample() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push
|
||||
Map<String, Object> value = readPayload("bitbucket.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucket.json");
|
||||
setHeaders("repo:push");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNotNull(extracted);
|
||||
@@ -61,7 +61,7 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void bitbucketPullRequestFulfillmentDetected() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Merged
|
||||
Map<String, Object> value = readPayload("bitbucket.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucket.json");
|
||||
setHeaders("pullrequest:fulfilled");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNotNull(extracted);
|
||||
@@ -75,23 +75,23 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
|
||||
@Test
|
||||
public void notAPushOrPullRequestNotDetected() throws Exception {
|
||||
assertNotExtracted("bitbucket.json", "issue:created");
|
||||
assertNotExtracted("pathsamples/bitbucket.json", "issue:created");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gitlabNotDetected() throws Exception {
|
||||
assertNotExtracted("gitlab.json", "repo:push");
|
||||
assertNotExtracted("pathsamples/gitlab.json", "repo:push");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void githubNotDetected() throws Exception {
|
||||
assertNotExtracted("github.json", "repo:push");
|
||||
assertNotExtracted("pathsamples/github.json", "repo:push");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingUuidHeader() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push
|
||||
Map<String, Object> value = readPayload("bitbucket.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucket.json");
|
||||
this.headers.set("X-Event-Key", "repo:push");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNull(extracted);
|
||||
@@ -100,7 +100,7 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void missingChanges() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push
|
||||
Map<String, Object> value = readPayload("bitbucket-invalid.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucket-invalid.json");
|
||||
setHeaders("repo:push");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNull(extracted);
|
||||
@@ -116,7 +116,7 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void bitbucketServerSample() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html
|
||||
Map<String, Object> value = readPayload("bitbucketserver.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucketserver.json");
|
||||
setServerHeaders("repo:refs_changed");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNotNull(extracted);
|
||||
@@ -126,7 +126,7 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void bitbucketServerSamplePullRequest() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html
|
||||
Map<String, Object> value = readPayload("bitbucketserver.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucketserver.json");
|
||||
setServerHeaders("pr:merged");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNotNull(extracted);
|
||||
@@ -140,13 +140,13 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
|
||||
@Test
|
||||
public void notAPushOrPullRequestServer() throws Exception {
|
||||
assertNotExtractedServer("bitbucketserver.json", "repo:comment:added");
|
||||
assertNotExtractedServer("pathsamples/bitbucketserver.json", "repo:comment:added");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingUuidHeaderServer() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html
|
||||
Map<String, Object> value = readPayload("bitbucketserver.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucketserver.json");
|
||||
this.headers.set("X-Event-Key", "repo:refs_changed");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNull(extracted);
|
||||
@@ -155,7 +155,7 @@ public class BitbucketPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void missingChangesServer() throws Exception {
|
||||
// https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html
|
||||
Map<String, Object> value = readPayload("bitbucketserver-invalid.json");
|
||||
Map<String, Object> value = readPayload("pathsamples/bitbucketserver-invalid.json");
|
||||
setServerHeaders("repo:refs_changed");
|
||||
PropertyPathNotification extracted = this.extractor.extract(this.headers, value);
|
||||
assertNull(extracted);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CompositePropertyPathNotificationExtractorTests {
|
||||
public void githubSample() throws Exception {
|
||||
// See https://developer.github.com/v3/activity/events/types/#pushevent
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("github.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/github.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Github-Event", "push");
|
||||
@@ -60,7 +60,7 @@ public class CompositePropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void gitlabDetected() throws Exception {
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gitlab.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gitlab.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gitlab-Event", "Push Hook");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class GiteaPropertyPathNotificationExtractorTests {
|
||||
public void giteaSample() throws Exception {
|
||||
// See https://docs.gitea.io/en-us/webhooks/
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gitea.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gitea.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gitea-Event", "push");
|
||||
@@ -55,7 +55,7 @@ public class GiteaPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void notAPushNotDetected() throws Exception {
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gitea.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gitea.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gitea-Event", "issues");
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GiteePropertyPathNotificationExtractorTests {
|
||||
public void giteeSample() throws Exception {
|
||||
// See http://git.mydoc.io/?t=154711
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gitee.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gitee.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("x-git-oschina-event", "Push Hook");
|
||||
@@ -53,7 +53,7 @@ public class GiteePropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void notAPushNotDetected() throws Exception {
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("github.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/github.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("x-git-oschina-event", "Issue Hook");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class GithubPropertyPathNotificationExtractorTests {
|
||||
public void githubSample() throws Exception {
|
||||
// See https://developer.github.com/v3/activity/events/types/#pushevent
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("github.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/github.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Github-Event", "push");
|
||||
@@ -55,7 +55,7 @@ public class GithubPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void notAPushNotDetected() throws Exception {
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("github.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/github.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Github-Event", "issues");
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GitlabPropertyPathNotificationExtractorTests {
|
||||
public void pushEvent() throws Exception {
|
||||
// See http://doc.gitlab.com/ee/web_hooks/web_hooks.html#push-events
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gitlab.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gitlab.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gitlab-Event", "Push Hook");
|
||||
@@ -58,7 +58,7 @@ public class GitlabPropertyPathNotificationExtractorTests {
|
||||
public void nonPushEventNotDetected() throws Exception {
|
||||
// See http://doc.gitlab.com/ee/web_hooks/web_hooks.html#push-events
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gitlab.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gitlab.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gitlab-Event", "Issue Hook");
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GogsPropertyPathNotificationExtractorTests {
|
||||
public void gogsSample() throws Exception {
|
||||
// See https://gogs.io/docs/features/webhook
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gogs.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gogs.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gogs-Event", "push");
|
||||
@@ -53,7 +53,7 @@ public class GogsPropertyPathNotificationExtractorTests {
|
||||
@Test
|
||||
public void notAPushNotDetected() throws Exception {
|
||||
Map<String, Object> value = new ObjectMapper().readValue(
|
||||
new ClassPathResource("gogs.json").getInputStream(),
|
||||
new ClassPathResource("pathsamples/gogs.json").getInputStream(),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
this.headers.set("X-Gogs-Event", "issues");
|
||||
|
||||
Reference in New Issue
Block a user