-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba887e6
commit ca40252
Showing
7 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
== Camel Quarkus GitHub Integration Tests | ||
|
||
By default the GitHub integration tests use WireMock to stub the API interactions. | ||
|
||
To run the `camel-quarkus-github` integration tests against the real API, you must first create a https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token[GitHub token]. | ||
|
||
Set the following environment variable: | ||
|
||
[source,shell] | ||
---- | ||
export GITHUB_TOKEN=your-token | ||
---- | ||
|
||
If the WireMock stub recordings need updating, then remove the existing files from `src/test/resources/mappings` and run tests with either: | ||
|
||
System property `-Dwiremock.record=true` | ||
|
||
Or | ||
|
||
Set environment variable `WIREMOCK_RECORD=true` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...github/src/test/java/org/apache/camel/quarkus/component/github/it/GithubTestResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.camel.quarkus.component.github.it; | ||
|
||
import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager; | ||
|
||
public class GithubTestResource extends WireMockTestResourceLifecycleManager { | ||
|
||
private static final String GITHUB_ENV_TOKEN = "GITHUB_TOKEN"; | ||
|
||
@Override | ||
protected String getRecordTargetBaseUrl() { | ||
return "https://api.github.com"; | ||
} | ||
|
||
@Override | ||
protected boolean isMockingEnabled() { | ||
return !envVarsPresent(GITHUB_ENV_TOKEN); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
integration-tests/github/src/test/resources/mappings/githubGetRepository.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"id" : "85e3cc39-9d71-45a1-863c-7989052af075", | ||
"name" : "repos_apache_camel-quarkus", | ||
"request" : { | ||
"url" : "/repos/apache/camel-quarkus", | ||
"method" : "GET" | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"id\":193065376,\"node_id\":\"MDEwOlJlcG9zaXRvcnkxOTMwNjUzNzY=\",\"name\":\"camel-quarkus\",\"full_name\":\"apache/camel-quarkus\",\"private\":false,\"owner\":{\"login\":\"apache\",\"id\":47359,\"node_id\":\"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/47359?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/apache\",\"html_url\":\"https://github.com/apache\",\"followers_url\":\"https://api.github.com/users/apache/followers\",\"following_url\":\"https://api.github.com/users/apache/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/apache/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/apache/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/apache/subscriptions\",\"organizations_url\":\"https://api.github.com/users/apache/orgs\",\"repos_url\":\"https://api.github.com/users/apache/repos\",\"events_url\":\"https://api.github.com/users/apache/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/apache/received_events\",\"type\":\"Organization\",\"site_admin\":false},\"html_url\":\"https://github.com/apache/camel-quarkus\",\"description\":\"Apache Camel Quarkus support\",\"fork\":false,\"url\":\"https://api.github.com/repos/apache/camel-quarkus\",\"forks_url\":\"https://api.github.com/repos/apache/camel-quarkus/forks\",\"keys_url\":\"https://api.github.com/repos/apache/camel-quarkus/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/apache/camel-quarkus/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/apache/camel-quarkus/teams\",\"hooks_url\":\"https://api.github.com/repos/apache/camel-quarkus/hooks\",\"issue_events_url\":\"https://api.github.com/repos/apache/camel-quarkus/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/apache/camel-quarkus/events\",\"assignees_url\":\"https://api.github.com/repos/apache/camel-quarkus/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/apache/camel-quarkus/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/apache/camel-quarkus/tags\",\"blobs_url\":\"https://api.github.com/repos/apache/camel-quarkus/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/apache/camel-quarkus/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/apache/camel-quarkus/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/apache/camel-quarkus/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/apache/camel-quarkus/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/apache/camel-quarkus/languages\",\"stargazers_url\":\"https://api.github.com/repos/apache/camel-quarkus/stargazers\",\"contributors_url\":\"https://api.github.com/repos/apache/camel-quarkus/contributors\",\"subscribers_url\":\"https://api.github.com/repos/apache/camel-quarkus/subscribers\",\"subscription_url\":\"https://api.github.com/repos/apache/camel-quarkus/subscription\",\"commits_url\":\"https://api.github.com/repos/apache/camel-quarkus/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/apache/camel-quarkus/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/apache/camel-quarkus/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/apache/camel-quarkus/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/apache/camel-quarkus/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/apache/camel-quarkus/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/apache/camel-quarkus/merges\",\"archive_url\":\"https://api.github.com/repos/apache/camel-quarkus/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/apache/camel-quarkus/downloads\",\"issues_url\":\"https://api.github.com/repos/apache/camel-quarkus/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/apache/camel-quarkus/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/apache/camel-quarkus/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/apache/camel-quarkus/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/apache/camel-quarkus/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/apache/camel-quarkus/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/apache/camel-quarkus/deployments\",\"created_at\":\"2019-06-21T08:55:25Z\",\"updated_at\":\"2021-05-20T03:40:17Z\",\"pushed_at\":\"2021-05-20T07:17:36Z\",\"git_url\":\"git://github.com/apache/camel-quarkus.git\",\"ssh_url\":\"git@github.com:apache/camel-quarkus.git\",\"clone_url\":\"https://github.com/apache/camel-quarkus.git\",\"svn_url\":\"https://github.com/apache/camel-quarkus\",\"homepage\":\"https://camel.apache.org\",\"size\":20828,\"stargazers_count\":116,\"watchers_count\":116,\"language\":\"Java\",\"has_issues\":true,\"has_projects\":true,\"has_downloads\":true,\"has_wiki\":false,\"has_pages\":false,\"forks_count\":99,\"mirror_url\":null,\"archived\":false,\"disabled\":false,\"open_issues_count\":262,\"license\":{\"key\":\"apache-2.0\",\"name\":\"Apache License 2.0\",\"spdx_id\":\"Apache-2.0\",\"url\":\"https://api.github.com/licenses/apache-2.0\",\"node_id\":\"MDc6TGljZW5zZTI=\"},\"forks\":99,\"open_issues\":262,\"watchers\":116,\"default_branch\":\"main\",\"master_branch\":\"main\",\"temp_clone_token\":null,\"organization\":{\"login\":\"apache\",\"id\":47359,\"node_id\":\"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/47359?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/apache\",\"html_url\":\"https://github.com/apache\",\"followers_url\":\"https://api.github.com/users/apache/followers\",\"following_url\":\"https://api.github.com/users/apache/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/apache/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/apache/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/apache/subscriptions\",\"organizations_url\":\"https://api.github.com/users/apache/orgs\",\"repos_url\":\"https://api.github.com/users/apache/repos\",\"events_url\":\"https://api.github.com/users/apache/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/apache/received_events\",\"type\":\"Organization\",\"site_admin\":false},\"network_count\":99,\"subscribers_count\":27}", | ||
"headers" : { | ||
"Server" : "GitHub.com", | ||
"Date" : "Thu, 20 May 2021 10:38:18 GMT", | ||
"Content-Type" : "application/json; charset=utf-8", | ||
"Cache-Control" : "public, max-age=60, s-maxage=60", | ||
"Vary" : "Accept, Accept-Encoding, Accept, X-Requested-With", | ||
"ETag" : "W/\"7a87e6c15f634559e9085861786f1e47ae9949c046cd43a5f12af7b3cf813183\"", | ||
"Last-Modified" : "Thu, 20 May 2021 03:40:17 GMT", | ||
"X-GitHub-Media-Type" : "github.beta; format=json", | ||
"Strict-Transport-Security" : "max-age=31536000; includeSubdomains; preload", | ||
"X-Frame-Options" : "deny", | ||
"X-Content-Type-Options" : "nosniff", | ||
"X-XSS-Protection" : "0", | ||
"Referrer-Policy" : "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
"Content-Security-Policy" : "default-src 'none'", | ||
"X-RateLimit-Limit" : "60", | ||
"X-RateLimit-Remaining" : "58", | ||
"X-RateLimit-Reset" : "1621510517", | ||
"X-RateLimit-Resource" : "core", | ||
"X-RateLimit-Used" : "2", | ||
"Accept-Ranges" : "bytes", | ||
"X-GitHub-Request-Id" : "A086:97B8:1BF790:1E9A3C:60A63C19" | ||
} | ||
}, | ||
"uuid" : "85e3cc39-9d71-45a1-863c-7989052af075", | ||
"persistent" : true, | ||
"insertionIndex" : 1 | ||
} |
37 changes: 37 additions & 0 deletions
37
integration-tests/github/src/test/resources/mappings/githubGetRepositoryFile.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"id" : "b61eef33-a160-48e7-95e1-40349b7f5e1e", | ||
"name" : "repos_apache_camel-quarkus_git_blobs_6195efafd0a8100795247e35942b5c61fea79267", | ||
"request" : { | ||
"url" : "/repos/apache/camel-quarkus/git/blobs/6195efafd0a8100795247e35942b5c61fea79267", | ||
"method" : "GET" | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"sha\":\"6195efafd0a8100795247e35942b5c61fea79267\",\"node_id\":\"MDQ6QmxvYjE5MzA2NTM3Njo2MTk1ZWZhZm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ZWwtcXVhcmt1cy9s\\nYXRlc3QvY29udHJpYnV0b3ItZ3VpZGUuaHRtbFtBcGFjaGUgQ2FtZWwgd2Vi\\nc2l0ZV0uCgoKPT0gTGljZW5zaW5nCgpUaGlzIHNvZnR3YXJlIGlzIGxpY2Vu\\nc2VkIHVuZGVyIHRoZSB0ZXJtcyB5b3UgbWF5IGZpbmQgaW4gdGhlIGZpbGUg\\nbmFtZWQgYExJQ0VOU0UudHh0YCBpbiB0aGlzIGRpcmVjdG9yeS4K\\n\",\"encoding\":\"base64\"}", | ||
"headers" : { | ||
"Server" : "GitHub.com", | ||
"Date" : "Thu, 20 May 2021 10:38:31 GMT", | ||
"Content-Type" : "application/json; charset=utf-8", | ||
"Cache-Control" : "public, max-age=60, s-maxage=60", | ||
"Vary" : "Accept, Accept-Encoding, Accept, X-Requested-With", | ||
"ETag" : "W/\"f7af62dc21539a2acbc6159b8869ab60dccd4da5e92eeead36caddd9281d0ae3\"", | ||
"X-GitHub-Media-Type" : "github.beta; format=json", | ||
"Strict-Transport-Security" : "max-age=31536000; includeSubdomains; preload", | ||
"X-Frame-Options" : "deny", | ||
"X-Content-Type-Options" : "nosniff", | ||
"X-XSS-Protection" : "0", | ||
"Referrer-Policy" : "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
"Content-Security-Policy" : "default-src 'none'", | ||
"X-RateLimit-Limit" : "60", | ||
"X-RateLimit-Remaining" : "57", | ||
"X-RateLimit-Reset" : "1621510517", | ||
"X-RateLimit-Resource" : "core", | ||
"X-RateLimit-Used" : "3", | ||
"Accept-Ranges" : "bytes", | ||
"X-GitHub-Request-Id" : "A086:97B8:1BFAA5:1E9D8A:60A63C27" | ||
} | ||
}, | ||
"uuid" : "b61eef33-a160-48e7-95e1-40349b7f5e1e", | ||
"persistent" : true, | ||
"insertionIndex" : 2 | ||
} |