Skip to content

Commit 87cdddc

Browse files
committed
add CI test for JAXRS datelibrary java8
1 parent 298ca8d commit 87cdddc

File tree

74 files changed

+6530
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+6530
-0
lines changed

bin/jaxrs-datelib-j8.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"serializableModel": true,
3+
"withXml": true,
4+
"dateLibrary": "java8",
5+
"java8": true,
6+
"useBeanValidation": true
7+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS/ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs -o samples/server/petstore/jaxrs-datelib-j8/ -c ./bin/jaxrs-datelib-j8.json -DhideGenerationTimestamp=true"
30+
31+
java $JAVA_OPTS -jar $executable $ags

pom.xml.circleci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@
865865
<module>samples/server/petstore/jaxrs/jersey2</module>
866866
<module>samples/server/petstore/jaxrs/jersey1-useTags</module>
867867
<module>samples/server/petstore/jaxrs/jersey2-useTags</module>
868+
<module>samples/server/petstore/jaxrs-datelib-j8</module>
868869
<module>samples/server/petstore/jaxrs-resteasy/default</module>
869870
<module>samples/server/petstore/jaxrs-resteasy/eap</module>
870871
<module>samples/server/petstore/jaxrs-resteasy/eap-joda</module>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
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 Swagger Codgen 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.4.0-SNAPSHOT
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Jersey generated server
2+
3+
## Overview
4+
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
5+
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
6+
is an example of building a swagger-enabled JAX-RS server.
7+
8+
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework.
9+
10+
To run the server, please execute the following:
11+
12+
```
13+
mvn clean package jetty:run
14+
```
15+
16+
You can then view the swagger listing here:
17+
18+
```
19+
http://localhost:80/v2/swagger.json
20+
```
21+
22+
Note that if you have configured the `host` to be something other than localhost, the calls through
23+
swagger-ui will be directed to that host and not localhost!
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
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>io.swagger</groupId>
4+
<artifactId>swagger-jaxrs-server</artifactId>
5+
<packaging>jar</packaging>
6+
<name>swagger-jaxrs-server</name>
7+
<version>1.0.0</version>
8+
9+
<licenses>
10+
<license>
11+
<name>Unlicense</name>
12+
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
13+
<distribution>repo</distribution>
14+
</license>
15+
</licenses>
16+
17+
<build>
18+
<sourceDirectory>src/main/java</sourceDirectory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.apache.maven.plugins</groupId>
22+
<artifactId>maven-war-plugin</artifactId>
23+
<version>3.1.0</version>
24+
</plugin>
25+
<plugin>
26+
<artifactId>maven-failsafe-plugin</artifactId>
27+
<version>2.6</version>
28+
<executions>
29+
<execution>
30+
<goals>
31+
<goal>integration-test</goal>
32+
<goal>verify</goal>
33+
</goals>
34+
</execution>
35+
</executions>
36+
</plugin>
37+
<plugin>
38+
<groupId>org.eclipse.jetty</groupId>
39+
<artifactId>jetty-maven-plugin</artifactId>
40+
<version>${jetty-version}</version>
41+
<configuration>
42+
<webApp>
43+
<contextPath>/</contextPath>
44+
</webApp>
45+
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
46+
<stopPort>8079</stopPort>
47+
<stopKey>stopit</stopKey>
48+
<stopWait>10</stopWait>
49+
<httpConnector>
50+
<port>80</port>
51+
<idleTimeout>60000</idleTimeout>
52+
</httpConnector>
53+
</configuration>
54+
<executions>
55+
<execution>
56+
<id>start-jetty</id>
57+
<phase>pre-integration-test</phase>
58+
<goals>
59+
<goal>start</goal>
60+
</goals>
61+
<configuration>
62+
<scanIntervalSeconds>0</scanIntervalSeconds>
63+
<daemon>true</daemon>
64+
</configuration>
65+
</execution>
66+
<execution>
67+
<id>stop-jetty</id>
68+
<phase>post-integration-test</phase>
69+
<goals>
70+
<goal>stop</goal>
71+
</goals>
72+
</execution>
73+
</executions>
74+
</plugin>
75+
<plugin>
76+
<groupId>org.codehaus.mojo</groupId>
77+
<artifactId>build-helper-maven-plugin</artifactId>
78+
<version>1.9.1</version>
79+
<executions>
80+
<execution>
81+
<id>add-source</id>
82+
<phase>generate-sources</phase>
83+
<goals>
84+
<goal>add-source</goal>
85+
</goals>
86+
<configuration>
87+
<sources>
88+
<source>src/gen/java</source>
89+
</sources>
90+
</configuration>
91+
</execution>
92+
</executions>
93+
</plugin>
94+
</plugins>
95+
</build>
96+
<dependencies>
97+
<dependency>
98+
<groupId>io.swagger</groupId>
99+
<artifactId>swagger-jersey2-jaxrs</artifactId>
100+
<scope>compile</scope>
101+
<version>${swagger-core-version}</version>
102+
</dependency>
103+
<dependency>
104+
<groupId>ch.qos.logback</groupId>
105+
<artifactId>logback-classic</artifactId>
106+
<version>${logback-version}</version>
107+
<scope>compile</scope>
108+
</dependency>
109+
<dependency>
110+
<groupId>ch.qos.logback</groupId>
111+
<artifactId>logback-core</artifactId>
112+
<version>${logback-version}</version>
113+
<scope>compile</scope>
114+
</dependency>
115+
<dependency>
116+
<groupId>junit</groupId>
117+
<artifactId>junit</artifactId>
118+
<version>${junit-version}</version>
119+
<scope>test</scope>
120+
</dependency>
121+
<dependency>
122+
<groupId>javax.servlet</groupId>
123+
<artifactId>servlet-api</artifactId>
124+
<version>${servlet-api-version}</version>
125+
</dependency>
126+
<dependency>
127+
<groupId>org.glassfish.jersey.containers</groupId>
128+
<artifactId>jersey-container-servlet-core</artifactId>
129+
<version>${jersey2-version}</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>org.glassfish.jersey.media</groupId>
133+
<artifactId>jersey-media-multipart</artifactId>
134+
<version>${jersey2-version}</version>
135+
</dependency>
136+
<dependency>
137+
<groupId>com.fasterxml.jackson.datatype</groupId>
138+
<artifactId>jackson-datatype-jsr310</artifactId>
139+
<version>${jackson-version}</version>
140+
</dependency>
141+
<dependency>
142+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
143+
<artifactId>jackson-jaxrs-json-provider</artifactId>
144+
<version>${jackson-version}</version>
145+
</dependency>
146+
<!-- Base64 encoding that works in both JVM and Android -->
147+
<dependency>
148+
<groupId>com.brsanthu</groupId>
149+
<artifactId>migbase64</artifactId>
150+
<version>2.2</version>
151+
</dependency>
152+
153+
154+
<!-- Bean Validation API support -->
155+
<dependency>
156+
<groupId>javax.validation</groupId>
157+
<artifactId>validation-api</artifactId>
158+
<version>1.1.0.Final</version>
159+
<scope>provided</scope>
160+
</dependency>
161+
162+
</dependencies>
163+
<repositories>
164+
<repository>
165+
<id>sonatype-snapshots</id>
166+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
167+
<snapshots>
168+
<enabled>true</enabled>
169+
</snapshots>
170+
</repository>
171+
</repositories>
172+
<properties>
173+
<java.version>1.8</java.version>
174+
<maven.compiler.source>${java.version}</maven.compiler.source>
175+
<maven.compiler.target>${java.version}</maven.compiler.target>
176+
<swagger-core-version>1.5.18</swagger-core-version>
177+
<jetty-version>9.2.9.v20150224</jetty-version>
178+
<jersey2-version>2.22.2</jersey2-version>
179+
<jackson-version>2.8.9</jackson-version>
180+
<junit-version>4.12</junit-version>
181+
<logback-version>1.1.7</logback-version>
182+
<servlet-api-version>2.5</servlet-api-version>
183+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
184+
</properties>
185+
</project>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package io.swagger.api;
2+
3+
import io.swagger.model.*;
4+
import io.swagger.api.AnotherFakeApiService;
5+
import io.swagger.api.factories.AnotherFakeApiServiceFactory;
6+
7+
import io.swagger.annotations.ApiParam;
8+
import io.swagger.jaxrs.*;
9+
10+
import io.swagger.model.Client;
11+
12+
import java.util.Map;
13+
import java.util.List;
14+
import io.swagger.api.NotFoundException;
15+
16+
import java.io.InputStream;
17+
18+
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
19+
import org.glassfish.jersey.media.multipart.FormDataParam;
20+
21+
import javax.servlet.ServletConfig;
22+
import javax.ws.rs.core.Context;
23+
import javax.ws.rs.core.Response;
24+
import javax.ws.rs.core.SecurityContext;
25+
import javax.ws.rs.*;
26+
import javax.validation.constraints.*;
27+
28+
@Path("/another-fake")
29+
30+
31+
@io.swagger.annotations.Api(description = "the another-fake API")
32+
33+
public class AnotherFakeApi {
34+
private final AnotherFakeApiService delegate;
35+
36+
public AnotherFakeApi(@Context ServletConfig servletContext) {
37+
AnotherFakeApiService delegate = null;
38+
39+
if (servletContext != null) {
40+
String implClass = servletContext.getInitParameter("AnotherFakeApi.implementation");
41+
if (implClass != null && !"".equals(implClass.trim())) {
42+
try {
43+
delegate = (AnotherFakeApiService) Class.forName(implClass).newInstance();
44+
} catch (Exception e) {
45+
throw new RuntimeException(e);
46+
}
47+
}
48+
}
49+
50+
if (delegate == null) {
51+
delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi();
52+
}
53+
54+
this.delegate = delegate;
55+
}
56+
57+
@PATCH
58+
@Path("/dummy")
59+
@Consumes({ "application/json" })
60+
@Produces({ "application/json" })
61+
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", })
62+
@io.swagger.annotations.ApiResponses(value = {
63+
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
64+
public Response testSpecialTags(@ApiParam(value = "client model" ,required=true) Client body
65+
,@Context SecurityContext securityContext)
66+
throws NotFoundException {
67+
return delegate.testSpecialTags(body,securityContext);
68+
}
69+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.swagger.api;
2+
3+
import io.swagger.api.*;
4+
import io.swagger.model.*;
5+
6+
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
7+
8+
import io.swagger.model.Client;
9+
10+
import java.util.List;
11+
import io.swagger.api.NotFoundException;
12+
13+
import java.io.InputStream;
14+
15+
import javax.ws.rs.core.Response;
16+
import javax.ws.rs.core.SecurityContext;
17+
import javax.validation.constraints.*;
18+
19+
public abstract class AnotherFakeApiService {
20+
public abstract Response testSpecialTags(Client body,SecurityContext securityContext) throws NotFoundException;
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.swagger.api;
2+
3+
4+
public class ApiException extends Exception{
5+
private int code;
6+
public ApiException (int code, String msg) {
7+
super(msg);
8+
this.code = code;
9+
}
10+
}

0 commit comments

Comments
 (0)