Skip to content

Commit 0f2a27d

Browse files
authored
add tests for useAbstractionForFiles option (webclient, resttemplate) (#16644)
1 parent 1a4b574 commit 0f2a27d

66 files changed

Lines changed: 4747 additions & 0 deletions

File tree

Some content is hidden

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

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
1111
- samples/openapi3/client/petstore/java/jersey2-java8-swagger2/**
1212
- samples/openapi3/client/petstore/java/native**
13+
- samples/client/others/java/resttemplate-useAbstractionForFiles/**
14+
- samples/client/others/java/webclient-useAbstractionForFiles/**
1315
pull_request:
1416
paths:
1517
- 'samples/client/petstore/java/**'
@@ -19,6 +21,8 @@ on:
1921
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
2022
- samples/openapi3/client/petstore/java/jersey2-java8-swagger2/**
2123
- samples/openapi3/client/petstore/java/native**
24+
- samples/client/others/java/resttemplate-useAbstractionForFiles/**
25+
- samples/client/others/java/webclient-useAbstractionForFiles/**
2226
jobs:
2327
build:
2428
name: Build Java Client JDK11
@@ -61,6 +65,8 @@ jobs:
6165
- samples/client/petstore/java/okhttp-gson-swagger2/
6266
- samples/client/petstore/java/resttemplate-swagger2/
6367
- samples/openapi3/client/petstore/java/jersey2-java8-swagger2/
68+
- samples/client/others/java/resttemplate-useAbstractionForFiles/
69+
- samples/client/others/java/webclient-useAbstractionForFiles/
6470
steps:
6571
- uses: actions/checkout@v4
6672
- uses: actions/setup-java@v3
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
generatorName: java
2+
outputDir: samples/client/others/java/resttemplate-useAbstractionForFiles
3+
library: resttemplate
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue13146_file_abstraction_response.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
additionalProperties:
7+
artifactId: file-resttemplate
8+
hideGenerationTimestamp: "true"
9+
useAbstractionForFiles: true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
generatorName: java
2+
outputDir: samples/client/others/java/webclient-useAbstractionForFiles
3+
library: webclient
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue13146_file_abstraction_response.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
additionalProperties:
7+
artifactId: file-webclient
8+
hideGenerationTimestamp: "true"
9+
useAbstractionForFiles: true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
#
4+
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
5+
6+
name: Java CI with Maven
7+
8+
on:
9+
push:
10+
branches: [ main, master ]
11+
pull_request:
12+
branches: [ main, master ]
13+
14+
jobs:
15+
build:
16+
name: Build Response file abstraction test
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
java: [ '8' ]
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up JDK
24+
uses: actions/setup-java@v2
25+
with:
26+
java-version: ${{ matrix.java }}
27+
distribution: 'temurin'
28+
cache: maven
29+
- name: Build with Maven
30+
run: mvn -B package --no-transfer-progress --file pom.xml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
13+
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build
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: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.github/workflows/maven.yml
2+
.gitignore
3+
.travis.yml
4+
README.md
5+
api/openapi.yaml
6+
build.gradle
7+
build.sbt
8+
docs/ResourceApi.md
9+
git_push.sh
10+
gradle.properties
11+
gradle/wrapper/gradle-wrapper.jar
12+
gradle/wrapper/gradle-wrapper.properties
13+
gradlew
14+
gradlew.bat
15+
pom.xml
16+
settings.gradle
17+
src/main/AndroidManifest.xml
18+
src/main/java/org/openapitools/client/ApiClient.java
19+
src/main/java/org/openapitools/client/JavaTimeFormatter.java
20+
src/main/java/org/openapitools/client/RFC3339DateFormat.java
21+
src/main/java/org/openapitools/client/ServerConfiguration.java
22+
src/main/java/org/openapitools/client/ServerVariable.java
23+
src/main/java/org/openapitools/client/api/ResourceApi.java
24+
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
25+
src/main/java/org/openapitools/client/auth/Authentication.java
26+
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
27+
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.1.0-SNAPSHOT
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Generated by OpenAPI Generator: https://openapi-generator.tech
3+
#
4+
# Ref: https://docs.travis-ci.com/user/languages/java/
5+
#
6+
language: java
7+
jdk:
8+
- openjdk12
9+
- openjdk11
10+
- openjdk10
11+
- openjdk9
12+
- openjdk8
13+
before_install:
14+
# ensure gradlew has proper permission
15+
- chmod a+x ./gradlew
16+
script:
17+
# test using maven
18+
#- mvn test
19+
# test using gradle
20+
- gradle test
21+
# test using sbt
22+
# - sbt test
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# file-resttemplate
2+
3+
Response file abstraction test
4+
5+
- API version: 1.0.0
6+
7+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8+
9+
10+
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
11+
12+
## Requirements
13+
14+
Building the API client library requires:
15+
16+
1. Java 1.8+
17+
2. Maven/Gradle
18+
19+
## Installation
20+
21+
To install the API client library to your local Maven repository, simply execute:
22+
23+
```shell
24+
mvn clean install
25+
```
26+
27+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
28+
29+
```shell
30+
mvn clean deploy
31+
```
32+
33+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
34+
35+
### Maven users
36+
37+
Add this dependency to your project's POM:
38+
39+
```xml
40+
<dependency>
41+
<groupId>org.openapitools</groupId>
42+
<artifactId>file-resttemplate</artifactId>
43+
<version>1.0.0</version>
44+
<scope>compile</scope>
45+
</dependency>
46+
```
47+
48+
### Gradle users
49+
50+
Add this dependency to your project's build file:
51+
52+
```groovy
53+
repositories {
54+
mavenCentral() // Needed if the 'file-resttemplate' jar has been published to maven central.
55+
mavenLocal() // Needed if the 'file-resttemplate' jar has been published to the local maven repo.
56+
}
57+
58+
dependencies {
59+
implementation "org.openapitools:file-resttemplate:1.0.0"
60+
}
61+
```
62+
63+
### Others
64+
65+
At first generate the JAR by executing:
66+
67+
```shell
68+
mvn clean package
69+
```
70+
71+
Then manually install the following JARs:
72+
73+
- `target/file-resttemplate-1.0.0.jar`
74+
- `target/lib/*.jar`
75+
76+
## Getting Started
77+
78+
Please follow the [installation](#installation) instruction and execute the following Java code:
79+
80+
```java
81+
82+
import org.openapitools.client.*;
83+
import org.openapitools.client.auth.*;
84+
import org.openapitools.client.model.*;
85+
import org.openapitools.client.api.ResourceApi;
86+
87+
public class ResourceApiExample {
88+
89+
public static void main(String[] args) {
90+
ApiClient defaultClient = Configuration.getDefaultApiClient();
91+
defaultClient.setBasePath("http://localhost");
92+
93+
ResourceApi apiInstance = new ResourceApi(defaultClient);
94+
try {
95+
File result = apiInstance.resourceInResponse();
96+
System.out.println(result);
97+
} catch (ApiException e) {
98+
System.err.println("Exception when calling ResourceApi#resourceInResponse");
99+
System.err.println("Status code: " + e.getCode());
100+
System.err.println("Reason: " + e.getResponseBody());
101+
System.err.println("Response headers: " + e.getResponseHeaders());
102+
e.printStackTrace();
103+
}
104+
}
105+
}
106+
107+
```
108+
109+
## Documentation for API Endpoints
110+
111+
All URIs are relative to *http://localhost*
112+
113+
Class | Method | HTTP request | Description
114+
------------ | ------------- | ------------- | -------------
115+
*ResourceApi* | [**resourceInResponse**](docs/ResourceApi.md#resourceInResponse) | **GET** /resource |
116+
117+
118+
## Documentation for Models
119+
120+
121+
122+
<a id="documentation-for-authorization"></a>
123+
## Documentation for Authorization
124+
125+
Endpoints do not require authorization.
126+
127+
128+
## Recommendation
129+
130+
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
131+
132+
## Author
133+
134+
135+

0 commit comments

Comments
 (0)