Skip to content

Commit

Permalink
Describe releases.json in the http-client guide (#1431)
Browse files Browse the repository at this point in the history
When following the guide, there is only a passing reference to releases.json which is used by the tests.

If the file is missing, then the tests will not pass.

This PR adds a brief example to the guide for people to copy as they work through the guide.
  • Loading branch information
timyates authored Feb 5, 2024
1 parent f32757f commit 60a0faa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions guides/micronaut-http-client/micronaut-http-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ callout:get[number=5,arg0=fetchReleases,arg1=/releases]

=== Tests

We will mock the GitHub api with some releases

NOTE: Here we only show a single release.
If you download the complete solution, you will find a file with multiple releases.

[source, json]
.src/test/resources/releases.json
----
include::{sourceDir}/micronaut-http-client/@sourceDir@/src/test/resources/single-release.json[]
----

Create a test to verify that both clients work as expected, and the controller echoes the output of the GitHub API in a Reactive way.

test:GithubControllerTest[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"url":"https://api.github.com/repos/micronaut-projects/micronaut-core/releases/91622014","assets_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/releases/91622014/assets","upload_url":"https://uploads.github.com/repos/micronaut-projects/micronaut-core/releases/91622014/assets{?name,label}","html_url":"https://github.com/micronaut-projects/micronaut-core/releases/tag/v3.8.4","id":91622014,"author":{"login":"sdelamo","id":864788,"node_id":"MDQ6VXNlcjg2NDc4OA==","avatar_url":"https://avatars.githubusercontent.com/u/864788?v=4","gravatar_id":"","url":"https://api.github.com/users/sdelamo","html_url":"https://github.com/sdelamo","followers_url":"https://api.github.com/users/sdelamo/followers","following_url":"https://api.github.com/users/sdelamo/following{/other_user}","gists_url":"https://api.github.com/users/sdelamo/gists{/gist_id}","starred_url":"https://api.github.com/users/sdelamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdelamo/subscriptions","organizations_url":"https://api.github.com/users/sdelamo/orgs","repos_url":"https://api.github.com/users/sdelamo/repos","events_url":"https://api.github.com/users/sdelamo/events{/privacy}","received_events_url":"https://api.github.com/users/sdelamo/received_events","type":"User","site_admin":false},"node_id":"RE_kwDOB2eaPM4Fdgp-","tag_name":"v3.8.4","target_commitish":"3.8.x","name":"Micronaut Framework 3.8.4","draft":false,"prerelease":false,"created_at":"2023-02-07T15:53:03Z","published_at":"2023-02-07T15:53:05Z","assets":[{"url":"https://api.github.com/repos/micronaut-projects/micronaut-core/releases/assets/94667997","id":94667997,"node_id":"RA_kwDOB2eaPM4FpITd","name":"artifacts.zip","label":"","uploader":{"login":"github-actions[bot]","id":41898282,"node_id":"MDM6Qm90NDE4OTgyODI=","avatar_url":"https://avatars.githubusercontent.com/in/15368?v=4","gravatar_id":"","url":"https://api.github.com/users/github-actions%5Bbot%5D","html_url":"https://github.com/apps/github-actions","followers_url":"https://api.github.com/users/github-actions%5Bbot%5D/followers","following_url":"https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github-actions%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/github-actions%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/github-actions%5Bbot%5D/repos","events_url":"https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/github-actions%5Bbot%5D/received_events","type":"Bot","site_admin":false},"content_type":"application/zip","state":"uploaded","size":28063979,"download_count":33,"created_at":"2023-02-07T16:18:05Z","updated_at":"2023-02-07T16:18:06Z","browser_download_url":"https://github.com/micronaut-projects/micronaut-core/releases/download/v3.8.4/artifacts.zip"},{"url":"https://api.github.com/repos/micronaut-projects/micronaut-core/releases/assets/94669478","id":94669478,"node_id":"RA_kwDOB2eaPM4FpIqm","name":"multiple.intoto.jsonl","label":"","uploader":{"login":"github-actions[bot]","id":41898282,"node_id":"MDM6Qm90NDE4OTgyODI=","avatar_url":"https://avatars.githubusercontent.com/in/15368?v=4","gravatar_id":"","url":"https://api.github.com/users/github-actions%5Bbot%5D","html_url":"https://github.com/apps/github-actions","followers_url":"https://api.github.com/users/github-actions%5Bbot%5D/followers","following_url":"https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github-actions%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/github-actions%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/github-actions%5Bbot%5D/repos","events_url":"https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/github-actions%5Bbot%5D/received_events","type":"Bot","site_admin":false},"content_type":"application/octet-stream","state":"uploaded","size":65612,"download_count":34,"created_at":"2023-02-07T16:32:49Z","updated_at":"2023-02-07T16:32:49Z","browser_download_url":"https://github.com/micronaut-projects/micronaut-core/releases/download/v3.8.4/multiple.intoto.jsonl"}],"tarball_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/tarball/v3.8.4","zipball_url":"https://api.github.com/repos/micronaut-projects/micronaut-core/zipball/v3.8.4","body":"<!-- Release notes generated using configuration in .github/release.yml at 3.8.x -->\r\n\r\n\r\n## What's Changed\r\n\r\n### Bugs 🐛\r\n* Allow programmatic logback config if xml config is absent (#8674)\r\n* Tweak uri to account for WebLogic/Windows URIs by @mattmoss in https://github.com/micronaut-projects/micronaut-core/pull/8704\r\n\r\n### Docs 📖\r\n* Docs on self-signed cert setup (#8684)\r\n\r\n### Dependency Upgrades 🚀\r\n\r\n* Micronaut Test to 3.8.2 (#8728)\r\n* Micronaut OpenAPI to 4.8.3 (#8724)\r\n* Micronaut Data to 3.9.6 (#8711)\r\n* Micronaut Rabbit to 3.4.1 (#8709)\r\n* Micronaut Azure to 3.7.1 (#8682)\r\n* Micronaut Micrometer to 4.7.2 (#8681)\r\n\r\n### Tests ✅\r\n\r\n* Require docker for test (#8698)\r\n* Add octet stream serialization to the TCK (#8712)\r\n\r\n**Full Changelog**: https://github.com/micronaut-projects/micronaut-core/compare/v3.8.3...v3.8.4","mentions_count":1}]

0 comments on commit 60a0faa

Please sign in to comment.