From c89ec276e75953bfb056a30e07296832fbe4d1e2 Mon Sep 17 00:00:00 2001 From: Christian Berger Date: Tue, 17 Oct 2023 10:49:06 +0200 Subject: [PATCH] fix: perform LF normalization --- .gitattributes | 3 - README.md | 114 +++++------ .../src/test/resources/mappings/mock.json | 18 +- .../ROOT/pages/includes/attributes.adoc | 4 +- .../ROOT/pages/includes/quarkus-wiremock.adoc | 178 +++++++++--------- docs/modules/ROOT/pages/index.adoc | 170 ++++++++--------- 6 files changed, 242 insertions(+), 245 deletions(-) diff --git a/.gitattributes b/.gitattributes index 2d4b1b0..d8ed717 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,9 +7,6 @@ # The above will handle all files NOT found below # -# ApprovalTests.Java ( https://github.com/approvals/ApprovalTests.Java ) -*.approved.* binary - # Documents *.bibtex text diff=bibtex *.doc diff=astextplain diff --git a/README.md b/README.md index 34f96ce..f5caedf 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,57 @@ -## Quarkus - WireMock -[![Build](https://github.com/quarkiverse/quarkus-wiremock/actions/workflows/build.yml/badge.svg)](https://github.com/quarkiverse/quarkus-wiremock/actions/workflows/build.yml) -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0) - -[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) - - -## Description - -Quarkus [WireMock](https://wiremock.org) extension for tests and local development. - -## Compatibility - -This Quarkus ``WireMock`` extension provides different version streams. - -| WireMock extension | Quarkus Platform | WireMock | Documentation | -|---------------------|------------------|----------|---------------------------------------------------------------------------------------------------------------------| -| 0.x.x | 2.16.x.Final | 2.35.x | [Quarkiverse Docs - Wiremock (0.x)](https://quarkiverse.github.io/quarkiverse-docs/quarkus-wiremock/0.x/index.html) | -| 1.x.x (coming soon) | 3.2.x (LTS) | 3.x | [Quarkiverse Docs - Wiremock (dev)](https://quarkiverse.github.io/quarkiverse-docs/quarkus-wiremock/dev/index.html) | - -## Development instructions - - -### Module description - -| Module | Description | -|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| deployment | The deployment module is used during the augmentation phase of the build and contains the major logic to configure and ramp-up ``WireMock`` as a ``DevService``. In addition, this module also contains test classes to test basic ``DevService`` functionality. | -| runtime | This is the module the application's developer will add as application dependency to enable ``WireMock`` as a ``DevService``. For this extension the runtime module is almost empty since everything will happen at build time (please refer to the deployment module). | -| test | This module can be used during test execution to retrieve a reference of the running ``WireMock`` instance managed by the ``DevService``. This is quite helpful when a developer wants to describe the ``WireMock`` behavior programmatically. For more details please refer to the documentation. | -| integration-test | Contains Quarkus tests to verify the proper functionality of the extension. This module uses the ``WireMock`` extension in a way how a business application would use it. | -| docs | Project documentation happens via [Asciidoctor](https://asciidoctor.org/) for content and [Antora](https://antora.org/) for navigation. The resulting documentation will be published to [Quarkiverse Docs](https://docs.quarkiverse.io/). | - -## Contributors ✨ - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - - - - - - -
Spanjer1
Spanjer1

💻 🚧
Christian Berger
Christian Berger

💻 🚧
Willem Jan Glerum
Willem Jan Glerum

💻
- - - - - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. -Contributions of any kind welcome! +## Quarkus - WireMock +[![Build](https://github.com/quarkiverse/quarkus-wiremock/actions/workflows/build.yml/badge.svg)](https://github.com/quarkiverse/quarkus-wiremock/actions/workflows/build.yml) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0) + +[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) + + +## Description + +Quarkus [WireMock](https://wiremock.org) extension for tests and local development. + +## Compatibility + +This Quarkus ``WireMock`` extension provides different version streams. + +| WireMock extension | Quarkus Platform | WireMock | Documentation | +|---------------------|------------------|----------|---------------------------------------------------------------------------------------------------------------------| +| 0.x.x | 2.16.x.Final | 2.35.x | [Quarkiverse Docs - Wiremock (0.x)](https://quarkiverse.github.io/quarkiverse-docs/quarkus-wiremock/0.x/index.html) | +| 1.x.x (coming soon) | 3.2.x (LTS) | 3.x | [Quarkiverse Docs - Wiremock (dev)](https://quarkiverse.github.io/quarkiverse-docs/quarkus-wiremock/dev/index.html) | + +## Development instructions + + +### Module description + +| Module | Description | +|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| deployment | The deployment module is used during the augmentation phase of the build and contains the major logic to configure and ramp-up ``WireMock`` as a ``DevService``. In addition, this module also contains test classes to test basic ``DevService`` functionality. | +| runtime | This is the module the application's developer will add as application dependency to enable ``WireMock`` as a ``DevService``. For this extension the runtime module is almost empty since everything will happen at build time (please refer to the deployment module). | +| test | This module can be used during test execution to retrieve a reference of the running ``WireMock`` instance managed by the ``DevService``. This is quite helpful when a developer wants to describe the ``WireMock`` behavior programmatically. For more details please refer to the documentation. | +| integration-test | Contains Quarkus tests to verify the proper functionality of the extension. This module uses the ``WireMock`` extension in a way how a business application would use it. | +| docs | Project documentation happens via [Asciidoctor](https://asciidoctor.org/) for content and [Antora](https://antora.org/) for navigation. The resulting documentation will be published to [Quarkiverse Docs](https://docs.quarkiverse.io/). | + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + + + +
Spanjer1
Spanjer1

💻 🚧
Christian Berger
Christian Berger

💻 🚧
Willem Jan Glerum
Willem Jan Glerum

💻
+ + + + + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. +Contributions of any kind welcome! diff --git a/deployment/src/test/resources/mappings/mock.json b/deployment/src/test/resources/mappings/mock.json index 5ecb91a..ccdeca5 100644 --- a/deployment/src/test/resources/mappings/mock.json +++ b/deployment/src/test/resources/mappings/mock.json @@ -1,10 +1,10 @@ -{ - "request": { - "method": "GET", - "url": "/wiremock" - }, - "response": { - "status": 200, - "body": "Everything was just fine!" - } +{ + "request": { + "method": "GET", + "url": "/wiremock" + }, + "response": { + "status": 200, + "body": "Everything was just fine!" + } } \ No newline at end of file diff --git a/docs/modules/ROOT/pages/includes/attributes.adoc b/docs/modules/ROOT/pages/includes/attributes.adoc index 80ad71f..46b41ac 100644 --- a/docs/modules/ROOT/pages/includes/attributes.adoc +++ b/docs/modules/ROOT/pages/includes/attributes.adoc @@ -1,3 +1,3 @@ -:project-version: 0.0.2 - +:project-version: 0.0.2 + :examples-dir: ./../examples/ \ No newline at end of file diff --git a/docs/modules/ROOT/pages/includes/quarkus-wiremock.adoc b/docs/modules/ROOT/pages/includes/quarkus-wiremock.adoc index 0fd2bdc..735de0d 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-wiremock.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-wiremock.adoc @@ -1,90 +1,90 @@ -:summaryTableId: quarkus-wiremock -[.configuration-legend] -icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime -[.configuration-reference.searchable, cols="80,.^10,.^10"] -|=== - -h|[[quarkus-wiremock_configuration]]link:#quarkus-wiremock_configuration[Configuration property] - -h|Type -h|Default - -a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.enabled]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.enabled[quarkus.wiremock.devservices.enabled]` - -[.description] --- -If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. - -ifdef::add-copy-button-to-env-var[] -Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_ENABLED+++[] -endif::add-copy-button-to-env-var[] -ifndef::add-copy-button-to-env-var[] -Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_ENABLED+++` -endif::add-copy-button-to-env-var[] ---|boolean -|`true` - -a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.service-name]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.service-name[quarkus.wiremock.devservices.service-name]` - -[.description] --- -Name of the WireMock Dev Service. - -ifdef::add-copy-button-to-env-var[] -Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_SERVICE_NAME+++[] -endif::add-copy-button-to-env-var[] -ifndef::add-copy-button-to-env-var[] -Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_SERVICE_NAME+++` -endif::add-copy-button-to-env-var[] ---|string -|`wiremock-server` - - -a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.port]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.port[quarkus.wiremock.devservices.port]` - -[.description] --- -Optional fixed port the dev service will listen to. - -ifdef::add-copy-button-to-env-var[] -Environment variable: env_var_with_copy_button:+++QUARKUS_wiremock_DEVSERVICES_PORT+++[] -endif::add-copy-button-to-env-var[] -ifndef::add-copy-button-to-env-var[] -Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_PORT+++` -endif::add-copy-button-to-env-var[] ---|int -|8089 - -a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.reload]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.reload[quarkus.wiremock.devservices.reload]` - -[.description] --- -Restart WireMock whenever Quarkus is reloaded. Otherwise, whenever files are changed in the `files-mapping` location you would need to manually -reload Quarkus. - -ifdef::add-copy-button-to-env-var[] -Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_RELOAD+++[] -endif::add-copy-button-to-env-var[] -ifndef::add-copy-button-to-env-var[] -Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_RELOAD+++` -endif::add-copy-button-to-env-var[] ---|boolean -|`false` - -a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.files-mapping]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.files-mapping[quarkus.wiremock.devservices.files-mapping]` - -[.description] --- -Path to root dir with `mappings` and `__files` folders. - -ifdef::add-copy-button-to-env-var[] -Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_FILES_MAPPING+++[] -endif::add-copy-button-to-env-var[] -ifndef::add-copy-button-to-env-var[] -Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_FILES_MAPPING+++` -endif::add-copy-button-to-env-var[] ---|string -|`src/test/resources` - - +:summaryTableId: quarkus-wiremock +[.configuration-legend] +icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime +[.configuration-reference.searchable, cols="80,.^10,.^10"] +|=== + +h|[[quarkus-wiremock_configuration]]link:#quarkus-wiremock_configuration[Configuration property] + +h|Type +h|Default + +a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.enabled]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.enabled[quarkus.wiremock.devservices.enabled]` + +[.description] +-- +If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_ENABLED+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_ENABLED+++` +endif::add-copy-button-to-env-var[] +--|boolean +|`true` + +a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.service-name]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.service-name[quarkus.wiremock.devservices.service-name]` + +[.description] +-- +Name of the WireMock Dev Service. + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_SERVICE_NAME+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_SERVICE_NAME+++` +endif::add-copy-button-to-env-var[] +--|string +|`wiremock-server` + + +a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.port]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.port[quarkus.wiremock.devservices.port]` + +[.description] +-- +Optional fixed port the dev service will listen to. + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_wiremock_DEVSERVICES_PORT+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_PORT+++` +endif::add-copy-button-to-env-var[] +--|int +|8089 + +a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.reload]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.reload[quarkus.wiremock.devservices.reload]` + +[.description] +-- +Restart WireMock whenever Quarkus is reloaded. Otherwise, whenever files are changed in the `files-mapping` location you would need to manually +reload Quarkus. + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_RELOAD+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_RELOAD+++` +endif::add-copy-button-to-env-var[] +--|boolean +|`false` + +a|icon:lock[title=Fixed at build time] [[quarkus-wiremock_quarkus.wiremock.devservices.files-mapping]]`link:#quarkus-wiremock_quarkus.wiremock.devservices.files-mapping[quarkus.wiremock.devservices.files-mapping]` + +[.description] +-- +Path to root dir with `mappings` and `__files` folders. + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_WIREMOCK_DEVSERVICES_FILES_MAPPING+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_WIREMOCK_DEVSERVICES_FILES_MAPPING+++` +endif::add-copy-button-to-env-var[] +--|string +|`src/test/resources` + + |=== \ No newline at end of file diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 02d4a3d..9bfbca7 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -1,86 +1,86 @@ -= Quarkus WireMock - -include::./includes/attributes.adoc[] - -Quarkus https://wiremock.org[WireMock] extension for tests and local development. - -== Installation - -If you want to use this extension, you need to add the `io.quarkiverse.wiremock:quarkus-wiremock` extension first to your build file. - -For instance, with Maven, add the following dependency to your POM file: - -[source,xml,subs=attributes+] ----- - - io.quarkiverse.wiremock - quarkus-wiremock - {project-version} - test - ----- - -== Usage - -TIP: The extension is designed to run in `dev` and `test` mode only! Please don't specify any attributes applicable for the `prod` profile, otherwise `unknown` property warnings will show up when executing the production build. - -Example (default) configuration for testing and local development: -[source,properties] ----- -%dev,test.quarkus.wiremock.devservices.enabled=true -%dev,test.quarkus.wiremock.devservices.reload=false -%dev,test.quarkus.wiremock.devservices.files-mapping=src/test/resources -%dev,test.quarkus.wiremock.devservices.port=8089 -%dev,test.quarkus.wiremock.devservices.service-name=wiremock-server ----- - -== Testing - -In addition, you might want to configure `WireMock` programmatically. To do so, please add the following dependency to the target project: - -[source,xml,subs=attributes+] ----- - - io.quarkiverse.wiremock - quarkus-wiremock-test - {project-version} - test - ----- - -After that, you are able to inject a `WireMock` reference along with your test execution lifecycle has shown below: -[source,java] ----- -@QuarkusTest -@QuarkusTestResource(WireMockServerTestResource.class) -class WireMockDevServiceResourceTest { - - private static final String MOCK_MSG = "Hello from WireMock!"; - - @InjectWireMock - WireMock wiremock; - - @Test - void testHelloEndpoint() { - Assertions.assertNotNull(wiremock); - wiremock.register(get(urlEqualTo("/mock-me")) - .willReturn(aResponse().withStatus(200).withBody(MOCK_MSG))); - ... - } - -} ----- - -You can also reuse a `@QuarkusTest` as a `@QuarkusIntegrationTest`: -[source,java] ----- -@QuarkusIntegrationTest -public class WireMockDevServiceResourceIT extends WireMockDevServiceResourceTest { - // re-use Quarkus tests as integration tests -} ----- - -[[extension-configuration-reference]] -== Extension Configuration Reference - += Quarkus WireMock + +include::./includes/attributes.adoc[] + +Quarkus https://wiremock.org[WireMock] extension for tests and local development. + +== Installation + +If you want to use this extension, you need to add the `io.quarkiverse.wiremock:quarkus-wiremock` extension first to your build file. + +For instance, with Maven, add the following dependency to your POM file: + +[source,xml,subs=attributes+] +---- + + io.quarkiverse.wiremock + quarkus-wiremock + {project-version} + test + +---- + +== Usage + +TIP: The extension is designed to run in `dev` and `test` mode only! Please don't specify any attributes applicable for the `prod` profile, otherwise `unknown` property warnings will show up when executing the production build. + +Example (default) configuration for testing and local development: +[source,properties] +---- +%dev,test.quarkus.wiremock.devservices.enabled=true +%dev,test.quarkus.wiremock.devservices.reload=false +%dev,test.quarkus.wiremock.devservices.files-mapping=src/test/resources +%dev,test.quarkus.wiremock.devservices.port=8089 +%dev,test.quarkus.wiremock.devservices.service-name=wiremock-server +---- + +== Testing + +In addition, you might want to configure `WireMock` programmatically. To do so, please add the following dependency to the target project: + +[source,xml,subs=attributes+] +---- + + io.quarkiverse.wiremock + quarkus-wiremock-test + {project-version} + test + +---- + +After that, you are able to inject a `WireMock` reference along with your test execution lifecycle has shown below: +[source,java] +---- +@QuarkusTest +@QuarkusTestResource(WireMockServerTestResource.class) +class WireMockDevServiceResourceTest { + + private static final String MOCK_MSG = "Hello from WireMock!"; + + @InjectWireMock + WireMock wiremock; + + @Test + void testHelloEndpoint() { + Assertions.assertNotNull(wiremock); + wiremock.register(get(urlEqualTo("/mock-me")) + .willReturn(aResponse().withStatus(200).withBody(MOCK_MSG))); + ... + } + +} +---- + +You can also reuse a `@QuarkusTest` as a `@QuarkusIntegrationTest`: +[source,java] +---- +@QuarkusIntegrationTest +public class WireMockDevServiceResourceIT extends WireMockDevServiceResourceTest { + // re-use Quarkus tests as integration tests +} +---- + +[[extension-configuration-reference]] +== Extension Configuration Reference + include::includes/quarkus-wiremock.adoc[leveloffset=+1, opts=optional] \ No newline at end of file