Skip to content

Commit a5e9b43

Browse files
committed
add test for jaxrs cxf swagger2 client
1 parent f02acaf commit a5e9b43

File tree

19 files changed

+2249
-1
lines changed

19 files changed

+2249
-1
lines changed

.github/workflows/samples-java-client-jdk11.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- 'samples/client/petstore/java/**'
77
- samples/client/petstore/jaxrs-cxf-client/**
8+
- samples/client/petstore/jaxrs-cxf-client-swagger2/**
89
- samples/client/petstore/java-micronaut-client/**
910
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
1011
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
@@ -27,6 +28,7 @@ on:
2728
paths:
2829
- 'samples/client/petstore/java/**'
2930
- samples/client/petstore/jaxrs-cxf-client/**
31+
- samples/client/petstore/jaxrs-cxf-client-swagger2/**
3032
- samples/client/petstore/java-micronaut-client/**
3133
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
3234
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
@@ -54,9 +56,10 @@ jobs:
5456
matrix:
5557
sample:
5658
# clients
59+
- samples/client/petstore/jaxrs-cxf-client-swagger2
5760
- samples/client/petstore/jaxrs-cxf-client
5861
- samples/client/petstore/java/native
59-
- samples/client/petstore/java/native-async
62+
- samples/client/petstore/java/native-asyn
6063
- samples/client/petstore/java/native-jakarta
6164
- samples/client/petstore/java/retrofit2
6265
- samples/client/petstore/java/retrofit2rx2
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
generatorName: jaxrs-cxf-client
2+
outputDir: samples/client/petstore/jaxrs-cxf-client-swagger2
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/cxf
5+
additionalProperties:
6+
artifactId: jaxrs-cxf-petstore-swagger2
7+
documentationProvider: swagger2
8+
annotationLibrary: swagger2

modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/api_test.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import org.junit.Test;
88
import org.junit.Before;
99
import static org.junit.Assert.*;
1010

11+
{{#useBeanValidation}}
1112
import {{javaxPackage}}.validation.Valid;
13+
{{/useBeanValidation}}
1214
import {{javaxPackage}}.ws.rs.core.Response;
1315
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
1416
import org.apache.cxf.jaxrs.client.ClientConfiguration;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pom.xml
2+
src/gen/java/org/openapitools/api/PetApi.java
3+
src/gen/java/org/openapitools/api/StoreApi.java
4+
src/gen/java/org/openapitools/api/UserApi.java
5+
src/gen/java/org/openapitools/model/Category.java
6+
src/gen/java/org/openapitools/model/ModelApiResponse.java
7+
src/gen/java/org/openapitools/model/Order.java
8+
src/gen/java/org/openapitools/model/Pet.java
9+
src/gen/java/org/openapitools/model/Tag.java
10+
src/gen/java/org/openapitools/model/User.java
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.16.0-SNAPSHOT
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<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/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>org.openapitools</groupId>
4+
<artifactId>jaxrs-cxf-petstore-swagger2</artifactId>
5+
<packaging>jar</packaging>
6+
<name>jaxrs-cxf-petstore-swagger2</name>
7+
<description>This is a sample server Petstore server. For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.</description>
8+
<version>1.0.0</version>
9+
10+
11+
<build>
12+
<sourceDirectory>src/main/java</sourceDirectory>
13+
<plugins>
14+
<plugin>
15+
<artifactId>maven-failsafe-plugin</artifactId>
16+
<version>2.6</version>
17+
<executions>
18+
<execution>
19+
<goals>
20+
<goal>integration-test</goal>
21+
<goal>verify</goal>
22+
</goals>
23+
</execution>
24+
</executions>
25+
</plugin>
26+
<!--plugin>
27+
<groupId>org.eclipse.jetty</groupId>
28+
<artifactId>jetty-maven-plugin</artifactId>
29+
<version>${jetty-version}</version>
30+
<configuration>
31+
<webApp>
32+
<contextPath>/</contextPath>
33+
</webApp>
34+
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
35+
<stopPort>8079</stopPort>
36+
<stopKey>stopit</stopKey>
37+
<httpConnector>
38+
<port></port>
39+
<idleTimeout>60000</idleTimeout>
40+
</httpConnector>
41+
</configuration>
42+
<executions>
43+
<execution>
44+
<id>start-jetty</id>
45+
<phase>pre-integration-test</phase>
46+
<goals>
47+
<goal>start</goal>
48+
</goals>
49+
<configuration>
50+
<scanIntervalSeconds>0</scanIntervalSeconds>
51+
<daemon>true</daemon>
52+
</configuration>
53+
</execution>
54+
<execution>
55+
<id>stop-jetty</id>
56+
<phase>post-integration-test</phase>
57+
<goals>
58+
<goal>stop</goal>
59+
</goals>
60+
</execution>
61+
</executions>
62+
</plugin-->
63+
<plugin>
64+
<groupId>org.codehaus.mojo</groupId>
65+
<artifactId>build-helper-maven-plugin</artifactId>
66+
<version>1.9.1</version>
67+
<executions>
68+
<execution>
69+
<id>add-source</id>
70+
<phase>generate-sources</phase>
71+
<goals>
72+
<goal>add-source</goal>
73+
</goals>
74+
<configuration>
75+
<sources>
76+
<source>src/gen/java</source>
77+
</sources>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
</plugin>
82+
</plugins>
83+
</build>
84+
<dependencyManagement>
85+
<dependencies>
86+
<dependency>
87+
<groupId>com.fasterxml.jackson</groupId>
88+
<artifactId>jackson-bom</artifactId>
89+
<version>${jackson-jaxrs-version}</version>
90+
<type>pom</type>
91+
<scope>import</scope>
92+
</dependency>
93+
</dependencies>
94+
</dependencyManagement>
95+
<dependencies>
96+
<dependency>
97+
<groupId>io.swagger.core.v3</groupId>
98+
<artifactId>swagger-annotations</artifactId>
99+
<version>${swagger-annotations-version}</version>
100+
</dependency>
101+
<dependency>
102+
<groupId>ch.qos.logback</groupId>
103+
<artifactId>logback-classic</artifactId>
104+
<version>${logback-version}</version>
105+
<scope>compile</scope>
106+
</dependency>
107+
<dependency>
108+
<groupId>ch.qos.logback</groupId>
109+
<artifactId>logback-core</artifactId>
110+
<version>${logback-version}</version>
111+
<scope>compile</scope>
112+
</dependency>
113+
<dependency>
114+
<groupId>junit</groupId>
115+
<artifactId>junit</artifactId>
116+
<version>${junit-version}</version>
117+
<scope>test</scope>
118+
</dependency>
119+
<!-- CXF Client -->
120+
<dependency>
121+
<groupId>org.apache.cxf</groupId>
122+
<artifactId>cxf-rt-rs-client</artifactId>
123+
<version>${cxf-version}</version>
124+
<scope>test</scope>
125+
</dependency>
126+
127+
<!-- CXF server -->
128+
<dependency>
129+
<groupId>org.apache.cxf</groupId>
130+
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
131+
<version>${cxf-version}</version>
132+
<scope>compile</scope>
133+
</dependency>
134+
<dependency>
135+
<groupId>org.apache.cxf</groupId>
136+
<artifactId>cxf-rt-rs-service-description</artifactId>
137+
<version>${cxf-version}</version>
138+
<scope>compile</scope>
139+
</dependency>
140+
<dependency>
141+
<groupId>org.apache.cxf</groupId>
142+
<artifactId>cxf-rt-ws-policy</artifactId>
143+
<version>${cxf-version}</version>
144+
<scope>compile</scope>
145+
</dependency>
146+
<dependency>
147+
<groupId>org.apache.cxf</groupId>
148+
<artifactId>cxf-rt-wsdl</artifactId>
149+
<version>${cxf-version}</version>
150+
<scope>compile</scope>
151+
</dependency>
152+
<dependency>
153+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
154+
<artifactId>jackson-jaxrs-json-provider</artifactId>
155+
<version>${jackson-jaxrs-version}</version>
156+
<scope>compile</scope>
157+
</dependency>
158+
<dependency>
159+
<groupId>com.fasterxml.jackson.datatype</groupId>
160+
<artifactId>jackson-datatype-jsr310</artifactId>
161+
<version>${jackson-jaxrs-version}</version>
162+
</dependency>
163+
<dependency>
164+
<groupId>jakarta.annotation</groupId>
165+
<artifactId>jakarta.annotation-api</artifactId>
166+
<version>${jakarta-annotation-version}</version>
167+
<scope>provided</scope>
168+
</dependency>
169+
<dependency>
170+
<groupId>joda-time</groupId>
171+
<artifactId>joda-time</artifactId>
172+
<version>2.10.13</version>
173+
</dependency>
174+
</dependencies>
175+
<repositories>
176+
<repository>
177+
<id>sonatype-snapshots</id>
178+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
179+
<snapshots>
180+
<enabled>true</enabled>
181+
</snapshots>
182+
</repository>
183+
</repositories>
184+
<properties>
185+
<java.version>1.8</java.version>
186+
<maven.compiler.source>${java.version}</maven.compiler.source>
187+
<maven.compiler.target>${java.version}</maven.compiler.target>
188+
<swagger-annotations-version>2.2.7</swagger-annotations-version>
189+
<jetty-version>9.2.9.v20150224</jetty-version>
190+
<junit-version>4.13.2</junit-version>
191+
<logback-version>1.5.13</logback-version>
192+
<cxf-version>3.5.9</cxf-version>
193+
<jackson-jaxrs-version>2.17.1</jackson-jaxrs-version>
194+
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
195+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
196+
</properties>
197+
</project>

0 commit comments

Comments
 (0)