Skip to content

Commit 09be19c

Browse files
upgrade okhttp-gson and google-api-client to junit5 (#18668)
* upgrade okhttp-gson and google-api-client to junit5 * add changes in StringUtilTest * use https instead of http to fix 301 (moved) error * revert petstore test server url to http://petstore.swagger.io and regenerate samples * synced gradle/sbt/pom, re-generated samples * revert removal of port 80 from test url * udpate google api client tests * update sha * update comment --------- Co-authored-by: Thorsten Hirsch <t.hirsch@web.de>
1 parent ed33b86 commit 09be19c

99 files changed

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

bin/utils/test_file_list.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sha256: 0a67c32728197e942b13bdda064b73793f12f5c795f1e5cf35a3adf69c973230
99
# java okhttp gson test files
1010
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java"
11-
sha256: db505f7801fef62c13a08a8e9ca1fc4c5c947ab46b46f12943139d353feacf17
11+
sha256: 325fdd5d7e2c97790c0fb44f712ab7b2ba022d7e1a5b0056f47b07f342682b6d
1212
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java"
1313
sha256: e673d9928c8eb848262d0116fe0d28db832e128671a810a7c966d06d90cb9b63
1414
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java"

modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api_test.mustache

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ package {{package}};
44

55
{{#imports}}import {{import}};
66
{{/imports}}
7-
import org.junit.Test;
8-
import org.junit.Ignore;
7+
import org.junit.jupiter.api.Disabled;
8+
import org.junit.jupiter.api.Test;
99

1010
import java.io.IOException;
1111
import java.time.LocalDate;
@@ -18,12 +18,12 @@ import java.util.Map;
1818
/**
1919
* API tests for {{classname}}
2020
*/
21-
@Ignore
2221
public class {{classname}}Test {
2322
2423
private final {{classname}} api = new {{classname}}();
2524

26-
{{#operations}}{{#operation}}
25+
{{#operations}}
26+
{{#operation}}
2727
/**
2828
* {{summary}}
2929
*
@@ -37,9 +37,12 @@ public class {{classname}}Test {
3737
{{#allParams}}
3838
{{{dataType}}} {{paramName}} = null;
3939
{{/allParams}}
40-
{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
40+
// uncomment below to test the API function
41+
//{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
4142

4243
// TODO: test validations
4344
}
44-
{{/operation}}{{/operations}}
45+
46+
{{/operation}}
47+
{{/operations}}
4548
}

modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<plugin>
6464
<groupId>org.apache.maven.plugins</groupId>
6565
<artifactId>maven-surefire-plugin</artifactId>
66-
<version>2.12</version>
66+
<version>2.22.2</version>
6767
<configuration>
6868
<systemPropertyVariables>
6969
<property>
@@ -73,7 +73,6 @@
7373
</systemPropertyVariables>
7474
<argLine>-Xms512m -Xmx1500m</argLine>
7575
<parallel>methods</parallel>
76-
<forkMode>pertest</forkMode>
7776
</configuration>
7877
</plugin>
7978
<plugin>
@@ -295,8 +294,8 @@
295294

296295
<!-- test dependencies -->
297296
<dependency>
298-
<groupId>junit</groupId>
299-
<artifactId>junit</artifactId>
297+
<groupId>org.junit.jupiter</groupId>
298+
<artifactId>junit-jupiter-api</artifactId>
300299
<version>${junit-version}</version>
301300
<scope>test</scope>
302301
</dependency>
@@ -326,6 +325,6 @@
326325
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
327326
{{/useJakartaEe}}
328327
<maven-plugin-version>1.0.0</maven-plugin-version>
329-
<junit-version>4.13.2</junit-version>
328+
<junit-version>5.10.2</junit-version>
330329
</properties>
331330
</project>

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ dependencies {
135135
implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.30'
136136
{{/dynamicOperations}}
137137
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
138-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
138+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
139139
testImplementation 'org.mockito:mockito-core:3.12.4'
140-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
140+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
141141
}
142142

143143
javadoc {

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ lazy val root = (project in file(".")).
3535
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
3636
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
3737
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
38-
"org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
38+
"org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
3939
"com.novocode" % "junit-interface" % "0.10" % "test",
4040
"org.mockito" % "mockito-core" % "3.12.4" % "test"
4141
)

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@
438438
{{#useBeanValidation}}
439439
<beanvalidation-version>3.0.2</beanvalidation-version>
440440
{{/useBeanValidation}}
441-
<junit-version>5.10.0</junit-version>
441+
<junit-version>5.10.2</junit-version>
442442
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
443443
<javax.ws.rs-api-version>2.1.1</javax.ws.rs-api-version>
444444
<jsr311-api-version>1.1.1</jsr311-api-version>

samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ dependencies {
118118
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2'
119119
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
120120
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
121-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
121+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
122122
testImplementation 'org.mockito:mockito-core:3.12.4'
123-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
123+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
124124
}
125125

126126
javadoc {

samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lazy val root = (project in file(".")).
2222
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
2323
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
2424
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
25-
"org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
25+
"org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
2626
"com.novocode" % "junit-interface" % "0.10" % "test",
2727
"org.mockito" % "mockito-core" % "3.12.4" % "test"
2828
)

samples/client/echo_api/java/okhttp-gson-user-defined-templates/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
<commons-lang3-version>3.14.0</commons-lang3-version>
340340
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
341341
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
342-
<junit-version>5.10.0</junit-version>
342+
<junit-version>5.10.2</junit-version>
343343
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
344344
<javax.ws.rs-api-version>2.1.1</javax.ws.rs-api-version>
345345
<jsr311-api-version>1.1.1</jsr311-api-version>

samples/client/echo_api/java/okhttp-gson/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ dependencies {
117117
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
118118
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
119119
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
120-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
120+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
121121
testImplementation 'org.mockito:mockito-core:3.12.4'
122-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
122+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
123123
}
124124

125125
javadoc {

0 commit comments

Comments
 (0)