Skip to content

Commit b979ecc

Browse files
authored
Add Github action file to test Java clients (#11633)
* add github action file to test java clients * update tests
1 parent 0a68d83 commit b979ecc

62 files changed

Lines changed: 938 additions & 7 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.

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ public void processOpts() {
350350
supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java"));
351351
supportingFiles.add(new SupportingFile("ServerConfiguration.mustache", invokerFolder, "ServerConfiguration.java"));
352352
supportingFiles.add(new SupportingFile("ServerVariable.mustache", invokerFolder, "ServerVariable.java"));
353+
supportingFiles.add(new SupportingFile("maven.yml.mustache", ".github/workflows", "maven.yml"));
353354
if (dynamicOperations) {
354355
supportingFiles.add(new SupportingFile("openapi.mustache", projectFolder + "/resources/openapi", "openapi.yaml"));
355356
supportingFiles.add(new SupportingFile("apiOperation.mustache", invokerFolder, "ApiOperation.java"));
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 {{{appName}}}
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+
{{=< >=}}
27+
java-version: ${{ matrix.java }}
28+
distribution: 'temurin'
29+
cache: maven
30+
- name: Build with Maven
31+
run: mvn -B package --no-transfer-progress --file pom.xml

modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void testIgnoreFileProcessing() throws IOException {
6464

6565
List<File> files = generator.opts(clientOptInput).generate();
6666

67-
Assert.assertEquals(files.size(), 43);
67+
Assert.assertEquals(files.size(), 44);
6868

6969
// Check expected generated files
7070
// api sanity check

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public void testGeneratePing() throws Exception {
290290
DefaultGenerator generator = new DefaultGenerator();
291291
List<File> files = generator.opts(clientOptInput).generate();
292292

293-
Assert.assertEquals(files.size(), 39);
293+
Assert.assertEquals(files.size(), 40);
294294
TestUtils.ensureContainsFile(files, output, ".gitignore");
295295
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
296296
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
@@ -358,7 +358,7 @@ public void testGeneratePingSomeObj() throws Exception {
358358
DefaultGenerator generator = new DefaultGenerator();
359359
List<File> files = generator.opts(clientOptInput).generate();
360360

361-
Assert.assertEquals(files.size(), 42);
361+
Assert.assertEquals(files.size(), 43);
362362
TestUtils.ensureContainsFile(files, output, ".gitignore");
363363
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
364364
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
@@ -429,7 +429,7 @@ public void testJdkHttpClient() throws Exception {
429429
DefaultGenerator generator = new DefaultGenerator();
430430
List<File> files = generator.opts(clientOptInput).generate();
431431

432-
Assert.assertEquals(files.size(), 31);
432+
Assert.assertEquals(files.size(), 32);
433433
validateJavaSourceFiles(files);
434434

435435
TestUtils.assertFileContains(Paths.get(output + "/src/main/java/xyz/abcdef/api/DefaultApi.java"),
@@ -496,7 +496,7 @@ public void testJdkHttpAsyncClient() throws Exception {
496496
DefaultGenerator generator = new DefaultGenerator();
497497
List<File> files = generator.opts(clientOptInput).generate();
498498

499-
Assert.assertEquals(files.size(), 34);
499+
Assert.assertEquals(files.size(), 35);
500500
validateJavaSourceFiles(files);
501501

502502
Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/PingApi.java");
@@ -998,7 +998,7 @@ public void testAllowModelWithNoProperties() throws Exception {
998998
DefaultGenerator generator = new DefaultGenerator();
999999
List<File> files = generator.opts(clientOptInput).generate();
10001000

1001-
Assert.assertEquals(files.size(), 48);
1001+
Assert.assertEquals(files.size(), 49);
10021002
TestUtils.ensureContainsFile(files, output, "src/main/java/org/openapitools/client/model/RealCommand.java");
10031003
TestUtils.ensureContainsFile(files, output, "src/main/java/org/openapitools/client/model/Command.java");
10041004

@@ -1270,7 +1270,7 @@ public void testNativeClientWhiteSpacePathParamEncoding() throws IOException {
12701270
DefaultGenerator generator = new DefaultGenerator();
12711271
List<File> files = generator.opts(clientOptInput).generate();
12721272

1273-
Assert.assertEquals(files.size(), 34);
1273+
Assert.assertEquals(files.size(), 35);
12741274
validateJavaSourceFiles(files);
12751275

12761276
TestUtils.assertFileContains(Paths.get(output + "/src/main/java/xyz/abcdef/ApiClient.java"),
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 ping some object
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

samples/client/others/java/okhttp-gson-streaming/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.github/workflows/maven.yml
12
.gitignore
23
.travis.yml
34
README.md
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 OpenAPI Petstore
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

samples/client/petstore/java/apache-httpclient/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.github/workflows/maven.yml
12
.gitignore
23
.travis.yml
34
README.md
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 OpenAPI Petstore
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

samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.github/workflows/maven.yml
12
.gitignore
23
.travis.yml
34
README.md

0 commit comments

Comments
 (0)