Skip to content

Commit 136c140

Browse files
authored
Move tests to Drone.io CI (#3754)
* move tests to drone.io * ls dir * debug * use bash * use jdk 11 image * move tests to drone.io * use maven wrapper * comment out scripts in circleci * update dart samples * remove commented tests * update dart samples
1 parent 5289262 commit 136c140

33 files changed

Lines changed: 289 additions & 295 deletions

File tree

CI/.drone.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ steps:
1111
- (cd samples/client/petstore/dart2/openapi && pub get && pub run test)
1212
# test Java 11 HTTP client
1313
- name: java11-test
14-
image: hirokimatsumoto/alpine-openjdk-11
14+
image: openjdk:11.0
1515
commands:
1616
- ./mvnw clean install
1717
- ./mvnw --quiet verify -Psamples.droneio
18+
# test all generators with fake petstore spec (2.0, 3.0)
19+
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
20+
# generate test scripts
21+
- /bin/bash bin/tests/run-all-test
22+
# generate all petstore samples (client, servers, doc)
23+
- /bin/bash bin/run-all-petstore
24+
# generate all petstore samples (openapi3)
25+
- /bin/bash bin/openapi3/run-all-petstore
1826
# test ocaml petstore client
1927
- name: ocaml-test
2028
image: ocaml/opam2:4.07

CI/circle_parallel.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,13 @@ if [ "$NODE_INDEX" = "1" ]; then
1414
mvn --quiet verify -Psamples.circleci
1515
mvn --quiet javadoc:javadoc -Psamples.circleci
1616

17-
# generate all petstore samples (client, servers, doc)
18-
./bin/run-all-petstore
19-
# generate all petstore samples (openapi3)
20-
./bin/openapi3/run-all-petstore
21-
# generate test scripts
22-
./bin/tests/run-all-test
23-
# test all generators with fake petstore spec (2.0, 3.0)
24-
./bin/utils/test-fake-petstore-for-all.sh
2517
elif [ "$NODE_INDEX" = "2" ]; then
2618
# run ensure-up-to-date sample script on SNAPSHOT version only
2719
project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout`
2820
if [[ $project_version == *"-SNAPSHOT" ]]; then
2921
echo "Running node $NODE_INDEX to test ensure-up-to-date"
3022
java -version
3123

32-
# install elm-format for formatting elm code
33-
npm install -g elm-format
34-
35-
# symlink elm-format
36-
sudo ln -s /opt/circleci/.nvm/versions/node/v12.1.0/bin/elm-format /usr/local/bin/elm-format
37-
3824
./bin/utils/ensure-up-to-date
3925
fi
4026
#elif [ "$NODE_INDEX" = "3" ]; then

bin/meta-codegen.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
2222

2323
if [ ! -f "$executable" ]
2424
then
25-
mvn -B clean package
25+
./mvnw -B clean package
2626
fi
2727

2828
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
2929
ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o samples/meta-codegen/lib $@"
3030

3131
java $JAVA_OPTS -jar $executable $ags
3232

33-
mvn clean package -f samples/meta-codegen/pom.xml
33+
./mvnw clean package -f samples/meta-codegen/pom.xml
3434

3535
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@"
3636

samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ part of openapi.api;
22

33
class ApiResponse {
44

5-
int code = null;
5+
int code = null;
66

7-
String type = null;
7+
String type = null;
88

9-
String message = null;
9+
String message = null;
1010
ApiResponse();
1111

1212
@override
@@ -16,9 +16,21 @@ class ApiResponse {
1616

1717
ApiResponse.fromJson(Map<String, dynamic> json) {
1818
if (json == null) return;
19-
code = json['code'];
20-
type = json['type'];
21-
message = json['message'];
19+
if (json['code'] == null) {
20+
code = null;
21+
} else {
22+
code = json['code'];
23+
}
24+
if (json['type'] == null) {
25+
type = null;
26+
} else {
27+
type = json['type'];
28+
}
29+
if (json['message'] == null) {
30+
message = null;
31+
} else {
32+
message = json['message'];
33+
}
2234
}
2335

2436
Map<String, dynamic> toJson() {

samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ part of openapi.api;
22

33
class Category {
44

5-
int id = null;
5+
int id = null;
66

7-
String name = null;
7+
String name = null;
88
Category();
99

1010
@override
@@ -14,8 +14,16 @@ class Category {
1414

1515
Category.fromJson(Map<String, dynamic> json) {
1616
if (json == null) return;
17-
id = json['id'];
18-
name = json['name'];
17+
if (json['id'] == null) {
18+
id = null;
19+
} else {
20+
id = json['id'];
21+
}
22+
if (json['name'] == null) {
23+
name = null;
24+
} else {
25+
name = json['name'];
26+
}
1927
}
2028

2129
Map<String, dynamic> toJson() {

samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ part of openapi.api;
22

33
class Order {
44

5-
int id = null;
5+
int id = null;
66

7-
int petId = null;
7+
int petId = null;
88

9-
int quantity = null;
9+
int quantity = null;
1010

11-
DateTime shipDate = null;
11+
DateTime shipDate = null;
1212
/* Order Status */
13-
String status = null;
13+
String status = null;
1414
//enum statusEnum { placed, approved, delivered, };{
1515

16-
bool complete = false;
16+
bool complete = false;
1717
Order();
1818

1919
@override
@@ -23,14 +23,36 @@ class Order {
2323

2424
Order.fromJson(Map<String, dynamic> json) {
2525
if (json == null) return;
26-
id = json['id'];
27-
petId = json['petId'];
28-
quantity = json['quantity'];
29-
shipDate = (json['shipDate'] == null) ?
30-
null :
31-
DateTime.parse(json['shipDate']);
32-
status = json['status'];
33-
complete = json['complete'];
26+
if (json['id'] == null) {
27+
id = null;
28+
} else {
29+
id = json['id'];
30+
}
31+
if (json['petId'] == null) {
32+
petId = null;
33+
} else {
34+
petId = json['petId'];
35+
}
36+
if (json['quantity'] == null) {
37+
quantity = null;
38+
} else {
39+
quantity = json['quantity'];
40+
}
41+
if (json['shipDate'] == null) {
42+
shipDate = null;
43+
} else {
44+
shipDate = DateTime.parse(json['shipDate']);
45+
}
46+
if (json['status'] == null) {
47+
status = null;
48+
} else {
49+
status = json['status'];
50+
}
51+
if (json['complete'] == null) {
52+
complete = null;
53+
} else {
54+
complete = json['complete'];
55+
}
3456
}
3557

3658
Map<String, dynamic> toJson() {

samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ part of openapi.api;
22

33
class Pet {
44

5-
int id = null;
5+
int id = null;
66

7-
Category category = null;
7+
Category category = null;
88

9-
String name = null;
9+
String name = null;
1010

11-
List<String> photoUrls = [];
11+
List<String> photoUrls = [];
1212

13-
List<Tag> tags = [];
13+
List<Tag> tags = [];
1414
/* pet status in the store */
15-
String status = null;
15+
String status = null;
1616
//enum statusEnum { available, pending, sold, };{
1717
Pet();
1818

@@ -23,18 +23,36 @@ class Pet {
2323

2424
Pet.fromJson(Map<String, dynamic> json) {
2525
if (json == null) return;
26-
id = json['id'];
27-
category = (json['category'] == null) ?
28-
null :
29-
Category.fromJson(json['category']);
30-
name = json['name'];
31-
photoUrls = (json['photoUrls'] == null) ?
32-
null :
33-
(json['photoUrls'] as List).cast<String>();
34-
tags = (json['tags'] == null) ?
35-
null :
36-
Tag.listFromJson(json['tags']);
37-
status = json['status'];
26+
if (json['id'] == null) {
27+
id = null;
28+
} else {
29+
id = json['id'];
30+
}
31+
if (json['category'] == null) {
32+
category = null;
33+
} else {
34+
category = new Category.fromJson(json['category']);
35+
}
36+
if (json['name'] == null) {
37+
name = null;
38+
} else {
39+
name = json['name'];
40+
}
41+
if (json['photoUrls'] == null) {
42+
photoUrls = null;
43+
} else {
44+
photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList();
45+
}
46+
if (json['tags'] == null) {
47+
tags = null;
48+
} else {
49+
tags = Tag.listFromJson(json['tags']);
50+
}
51+
if (json['status'] == null) {
52+
status = null;
53+
} else {
54+
status = json['status'];
55+
}
3856
}
3957

4058
Map<String, dynamic> toJson() {

samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ part of openapi.api;
22

33
class Tag {
44

5-
int id = null;
5+
int id = null;
66

7-
String name = null;
7+
String name = null;
88
Tag();
99

1010
@override
@@ -14,8 +14,16 @@ class Tag {
1414

1515
Tag.fromJson(Map<String, dynamic> json) {
1616
if (json == null) return;
17-
id = json['id'];
18-
name = json['name'];
17+
if (json['id'] == null) {
18+
id = null;
19+
} else {
20+
id = json['id'];
21+
}
22+
if (json['name'] == null) {
23+
name = null;
24+
} else {
25+
name = json['name'];
26+
}
1927
}
2028

2129
Map<String, dynamic> toJson() {

samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ part of openapi.api;
22

33
class User {
44

5-
int id = null;
5+
int id = null;
66

7-
String username = null;
7+
String username = null;
88

9-
String firstName = null;
9+
String firstName = null;
1010

11-
String lastName = null;
11+
String lastName = null;
1212

13-
String email = null;
13+
String email = null;
1414

15-
String password = null;
15+
String password = null;
1616

17-
String phone = null;
17+
String phone = null;
1818
/* User Status */
19-
int userStatus = null;
19+
int userStatus = null;
2020
User();
2121

2222
@override
@@ -26,14 +26,46 @@ class User {
2626

2727
User.fromJson(Map<String, dynamic> json) {
2828
if (json == null) return;
29-
id = json['id'];
30-
username = json['username'];
31-
firstName = json['firstName'];
32-
lastName = json['lastName'];
33-
email = json['email'];
34-
password = json['password'];
35-
phone = json['phone'];
36-
userStatus = json['userStatus'];
29+
if (json['id'] == null) {
30+
id = null;
31+
} else {
32+
id = json['id'];
33+
}
34+
if (json['username'] == null) {
35+
username = null;
36+
} else {
37+
username = json['username'];
38+
}
39+
if (json['firstName'] == null) {
40+
firstName = null;
41+
} else {
42+
firstName = json['firstName'];
43+
}
44+
if (json['lastName'] == null) {
45+
lastName = null;
46+
} else {
47+
lastName = json['lastName'];
48+
}
49+
if (json['email'] == null) {
50+
email = null;
51+
} else {
52+
email = json['email'];
53+
}
54+
if (json['password'] == null) {
55+
password = null;
56+
} else {
57+
password = json['password'];
58+
}
59+
if (json['phone'] == null) {
60+
phone = null;
61+
} else {
62+
phone = json['phone'];
63+
}
64+
if (json['userStatus'] == null) {
65+
userStatus = null;
66+
} else {
67+
userStatus = json['userStatus'];
68+
}
3769
}
3870

3971
Map<String, dynamic> toJson() {

0 commit comments

Comments
 (0)