diff --git a/pom.xml b/pom.xml index bede18edff..cbf7c9a9be 100644 --- a/pom.xml +++ b/pom.xml @@ -50,14 +50,15 @@ + catalog + connectors core - utils - runtime - validation endpoints - connectors + runtime + test-api-generator tools - catalog + utils + validation @@ -247,7 +248,7 @@ 3.2.0 4.1.105.Final 4.12.0 - 7.5.0 + 7.5.0 4.7.6 3.0.4 4.21.0 @@ -255,6 +256,7 @@ 1.1.10.5 2.2 6.1.8 + 3.3.1 4.0.11 6.3.0 3.0.1 @@ -516,7 +518,7 @@ org.openapitools openapi-generator - ${openapi-generator-maven-plugin} + ${org.openapitools.version} provided diff --git a/src/manual/connector-openapi.adoc b/src/manual/connector-openapi.adoc index c0e24a1c8a..951920f6a0 100644 --- a/src/manual/connector-openapi.adoc +++ b/src/manual/connector-openapi.adoc @@ -334,11 +334,11 @@ The generator provides the following features: * generation of a Test API ** from OpenAPI Specification ** [TODO #1163] from WSDL via an intermediate step that generates a "light" OpenApi specification from a WSDL -* integration into Citrus XML test cases +* integration into <> ** integration into XML editors via generated XSD *** schema validation *** auto completion -* integration into Citrus Java test cases via Java DSL [TODO #1161] +* integration into <> via Java DSL [TODO #1161] The following directory structure/table specifies the files, which are generated by the generator. Note that the `Prefix` is a configuration parameter which should uniquely identify a generated API. @@ -387,9 +387,9 @@ target/ ==== Configuration of Test API generation Code generation is typically performed during the build process. -For the Citrus Test API Generator, it is carried out by a Maven plugin. +For the Citrus Test API Generator, it is carried out by a Maven or Gradle plugin. While the standard generator plugin, `org.openapitools:openapi-generator-maven-plugin`, can be employed for this purpose, configuring it can be cumbersome, especially when dealing with multiple APIs. -To address this challenge, Citrus offers its adaptation of this standard generator Maven plugin. +To address this challenge, Citrus offers its adaptation of this standard generator plugin. This `Citrus OpenAPI Generator Plugin` simplifies the configuration of test API generation by providing predefined defaults and supporting the generation of multiple APIs. Additionally, it enhances support for generating Spring integration files (`spring.handlers` and `spring.schemas`), thereby facilitating the integration of generated APIs into Spring-based applications. Consequently, utilizing the Citrus Generator Plugin is recommended in most scenarios. @@ -535,27 +535,26 @@ The following shows the configuration of test api generation for different scena These are the primary elements you can configure in the `` section: |=== -| Configuration element | Maven Property | Description | Default Value +| Configuration element | Maven Property | Description | Default Value | `schemaFolder` | `citrus.test.api.generator.schema.folder` | Location for the generated XSD schemas | `schema/xsd/%VERSION%` | `resourceFolder` | `citrus.test.api.generator.resource.folder` | Location to which resources are generated | `generated-resources` | `sourceFolder` | `citrus.test.api.generator.source.folder` | Location to which sources are generated | `generated-sources` | `metaInfFolder` | `citrus.test.api.generator.meta.inf.folder` | Location to which spring meta files are generated/updated | `target/generated-test-resources/META-INF` | `generateSpringIntegrationFiles` | `citrus.test.api.generator.generate.spring.integration.files` | Specifies whether spring integration files should be generated | `true` -| Nested api element | | | +| Nested `` element | | | | `prefix` | `citrus.test.api.generator.prefix` | Specifies the prefix used for the test API, typically an acronym | (no default, required) | `source` | `citrus.test.api.generator.source` | Specifies the source of the test API | (no default, required) | `version` | `citrus.test.api.generator.version` | Specifies the version of the API, may be null | (none) | `endpoint` | `citrus.test.api.generator.endpoint` | Specifies the endpoint of the test API | `applicationServiceClient` | `type` | `citrus.test.api.generator.type` | Specifies the type of the test API | `REST`, other option is `SOAP` | `useTags` | `citrus.test.api.generator.use.tags` | Specifies whether tags should be used by the generator | `true` -| `invokerPackage` | `citrus.test.api.generator.invoker.package` | Package for the test API classes | `org.citrusframework.automation.%PREFIX%.%VERSION%` +| `invokerPackage` | `citrus.test.api.generator.invoker.package` | Package for the test API classes | `org.citrusframework.automation.%PREFIX%.%VERSION%` | `apiPackage` | `citrus.test.api.generator.api.package` | Package for the test API interface classes | `org.citrusframework.automation.%PREFIX%.%VERSION%.api` | `modelPackage` | `citrus.test.api.generator.model.package` | Package for the test API model classes | `org.citrusframework.automation.%PREFIX%.%VERSION%.model` -| `targetXmlnsNamespace` | `citrus.test.api.generator.namespace` | XML namespace used by the API | `http://www.citrusframework.org/schema/%VERSION%/%PREFIX%-api` +| `targetXmlnsNamespace` | `citrus.test.api.generator.namespace` | XML namespace used by the API | `http://www.citrusframework.org/schema/%VERSION%/%PREFIX%-api` |=== - Note: `%PREFIX%` and `%VERSION%` are placeholders that will be replaced by their specific values as configured. The plugin performs a conversion to lowercase for `PREFIX` used in package names and in `targetXmlnsNamespace`. @@ -568,7 +567,6 @@ To run the generator, execute the following command in your project directory: mvn citrus-test-api-generator-maven-plugin:create-test-api ---- - This command will generate the classes and XSD files as configured for your APIs in the specified locations. ==== Spring meta file generation @@ -683,7 +681,7 @@ Further examples can be found here `org.citrusframework.openapi.generator.Genera ---- To utilize the test API in Java, it's necessary to import the API configuration, that provides the respective request actions. -The request to test can then be autowired, configured and autowired, as illustrated in the sample below. +The request to test can then be configured and autowired, as illustrated in the sample below. Further examples can be found here `org.citrusframework.openapi.generator.GetPetByIdTest`. .Java DSL diff --git a/test-api-generator/citrus-test-api-generator-core/pom.xml b/test-api-generator/citrus-test-api-generator-core/pom.xml index c74f91249a..4681188d7e 100644 --- a/test-api-generator/citrus-test-api-generator-core/pom.xml +++ b/test-api-generator/citrus-test-api-generator-core/pom.xml @@ -18,7 +18,6 @@ Generates a Citrus Test-API for OpenAPI and WSDL specifications. - org.citrusframework citrus-api @@ -54,6 +53,7 @@ org.openapitools openapi-generator + ${org.openapitools.version} wsdl4j @@ -67,18 +67,18 @@ ${project.version} test - - org.springframework.boot - spring-boot-test - ${spring.boot.test.version} - test - org.citrusframework citrus-validation-json ${project.version} test + + org.springframework.boot + spring-boot-test + ${spring.boot.version} + test + @@ -121,6 +121,7 @@ org.openapitools openapi-generator-maven-plugin + ${org.openapitools.version} org.citrusframework diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml index b77b55c4d2..cfac634788 100644 --- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml +++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml @@ -7,9 +7,9 @@ info: x-citrus-app: MPT x-citrus-api-name: multiparttest-rest-resource contact: - name: IT-Services-CI TAuBE - email: IT-Serv-CI-ETAdl@post.ch - url: https://confluence.pnet.ch/pages/viewpage.action?pageId=314828825 + name: Citrusframework Authors + email: citrus-dev@googlegroups.com + url: https://citrusframework.org tags: - name: multiparttest-controller paths: diff --git a/test-api-generator/citrus-test-api-generator-maven-plugin/pom.xml b/test-api-generator/citrus-test-api-generator-maven-plugin/pom.xml index e92fd84d94..134d44aee9 100644 --- a/test-api-generator/citrus-test-api-generator-maven-plugin/pom.xml +++ b/test-api-generator/citrus-test-api-generator-maven-plugin/pom.xml @@ -36,13 +36,18 @@ - org.citrusframework citrus-test-api-generator-core ${project.version} + + org.openapitools + openapi-generator-maven-plugin + ${org.openapitools.version} + + commons-io commons-io diff --git a/test-api-generator/pom.xml b/test-api-generator/pom.xml index f6298e3e11..44acb94765 100644 --- a/test-api-generator/pom.xml +++ b/test-api-generator/pom.xml @@ -19,19 +19,25 @@ true + + citrus-test-api-generator-core + citrus-test-api-generator-maven-plugin + + org.junit.jupiter junit-jupiter-engine - ${junit.jupiter.version} + ${junit.jupiter.version} test - - - - citrus-test-api-generator-core - citrus-test-api-generator-maven-plugin - + + org.junit.jupiter + junit-jupiter-params + ${junit.jupiter.version} + test + +