forked from loafle/openapi-generator-original
[java] openapi-generator-maven-plugin: add jaxrs-jersey2 test (#11658)
This commit is contained in:
parent
840f36a50d
commit
4a7f46cba5
@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.3.0</version>
|
<version>5.4.0</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -126,13 +126,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-invoker-plugin</artifactId>
|
<artifactId>maven-invoker-plugin</artifactId>
|
||||||
<version>3.2.1</version>
|
<version>3.2.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<debug>false</debug>
|
||||||
|
<failIfNoProjects>true</failIfNoProjects>
|
||||||
<postBuildHookScript>verify</postBuildHookScript>
|
<postBuildHookScript>verify</postBuildHookScript>
|
||||||
<showVersion>true</showVersion>
|
<streamLogsOnFailures>true</streamLogsOnFailures>
|
||||||
<streamLogs>true</streamLogs>
|
|
||||||
<noLog>false</noLog>
|
|
||||||
<showErrors>true</showErrors>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -146,6 +145,7 @@
|
|||||||
<execution>
|
<execution>
|
||||||
<id>integration-test</id>
|
<id>integration-test</id>
|
||||||
<goals>
|
<goals>
|
||||||
|
<goal>install</goal>
|
||||||
<goal>run</goal>
|
<goal>run</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
invoker.goals = -nsu clean generate-sources
|
||||||
|
# The expected result of the build, possible values are "success" (default) and "failure"
|
||||||
|
invoker.buildResult = success
|
@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright 2022 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
|
~
|
||||||
|
~ Licensed 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.openapitools.maven.its</groupId>
|
||||||
|
<artifactId>jaxrs-jersey2</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.javadoc.skip>true</maven.javadoc.skip>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.10.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>@project.groupId@</groupId>
|
||||||
|
<artifactId>@project.artifactId@</artifactId>
|
||||||
|
<version>@project.version@</version>
|
||||||
|
<configuration>
|
||||||
|
<inputSpec>https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml</inputSpec>
|
||||||
|
<generatorName>jaxrs-jersey</generatorName>
|
||||||
|
<library>jersey2</library>
|
||||||
|
<dateLibrary>java8</dateLibrary>
|
||||||
|
<output>${basedir}/out</output>
|
||||||
|
<templateDirectory>${project.basedir}/templates</templateDirectory>
|
||||||
|
<configOptions>
|
||||||
|
</configOptions>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>remote</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
21
modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey2/templates/README.mustache
vendored
Normal file
21
modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey2/templates/README.mustache
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# TEST TEST TEST
|
||||||
|
|
||||||
|
# {{artifactId}}
|
||||||
|
|
||||||
|
{{appName}}
|
||||||
|
|
||||||
|
- API version: {{appVersion}}
|
||||||
|
{{^hideGenerationTimestamp}}
|
||||||
|
|
||||||
|
- Build date: {{generatedDate}}
|
||||||
|
{{/hideGenerationTimestamp}}
|
||||||
|
|
||||||
|
{{#appDescriptionWithNewLines}}{{{appDescriptionWithNewLines}}}{{/appDescriptionWithNewLines}}
|
||||||
|
|
||||||
|
{{#infoUrl}}
|
||||||
|
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||||
|
{{/infoUrl}}
|
||||||
|
|
||||||
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||||
|
|
||||||
|
… etc.
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
|
*
|
||||||
|
* Licensed 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
File readme = new File(basedir, "out/README.md")
|
||||||
|
|
||||||
|
assert readme.isFile()
|
||||||
|
assert readme.text.contains("# TEST TEST TEST")
|
||||||
|
assert readme.text.contains("# openapi-jaxrs-server")
|
||||||
|
assert readme.text.contains("OpenAPI Petstore")
|
||||||
|
|
||||||
|
File mavenPomXml = new File(basedir, "out/pom.xml")
|
||||||
|
assert mavenPomXml.isFile()
|
||||||
|
|
||||||
|
File petApi = new File(basedir, "out/src/gen/java/org/openapitools/api/PetApi.java")
|
||||||
|
assert petApi.isFile()
|
||||||
|
assert petApi.text.contains("import org.openapitools.api.PetApiService;")
|
||||||
|
|
||||||
|
File petApiService = new File(basedir, "out/src/gen/java/org/openapitools/api/PetApiService.java")
|
||||||
|
assert petApiService.isFile()
|
||||||
|
assert petApiService.text.contains("import javax.ws.rs.core.Response;")
|
||||||
|
|
||||||
|
File petModel = new File(basedir, "out/src/gen/java/org/openapitools/model/Pet.java")
|
||||||
|
assert petModel.isFile()
|
||||||
|
assert petModel.text.contains("public class Pet")
|
Loading…
x
Reference in New Issue
Block a user