Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Commit dcd26ec

Browse files
authored
Update Scala gatling's default value (OpenAPITools#390)
* update powershell script * update powershell bin script (oas3) * update html2 generator's default value * update scala gatling default value
1 parent 4ae1113 commit dcd26ec

File tree

18 files changed

+186
-211
lines changed

18 files changed

+186
-211
lines changed

bin/openapi3/powershell-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/powershell -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l powershell -o samples/client/petstore/powershell --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=\$ScriptDir\..\..\petstore\csharp\SwaggerClient $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/powershell -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l powershell -o samples/client/petstore/powershell --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=\$ScriptDir\..\..\petstore\csharp\OpenAPIClient $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

bin/powershell-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/powershell -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=\$ScriptDir\..\..\petstore\csharp\SwaggerClient $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/powershell -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=\$ScriptDir\..\..\petstore\csharp\OpenAPIClient $@"
3131

3232
java ${JAVA_OPTS} -jar ${executable} ${ags}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ public ScalaGatlingCodegen() {
9696
/**
9797
* Api Package. Optional, if needed, this can be used in templates
9898
*/
99-
apiPackage = "io.swagger.client.api";
99+
apiPackage = "org.openapitools.client.api";
100100

101101
/**
102102
* Model Package. Optional, if needed, this can be used in templates
103103
*/
104-
modelPackage = "io.swagger.client.model";
104+
modelPackage = "org.openapitools.client.model";
105105

106106
/**
107107
* Additional Properties. These values can be passed to the templates and
@@ -305,9 +305,9 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
305305
/**
306306
* Creates all the necessary openapi vendor extensions and feeder files for gatling
307307
*
308-
* @param operation Swagger Operation
309-
* @param parameters Swagger Parameters
310-
* @param parameterType Swagger Parameter Type
308+
* @param operation OpoenAPI Operation
309+
* @param parameters OpenAPI Parameters
310+
* @param parameterType OpenAPI Parameter Type
311311
*/
312312
private void prepareGatlingData(Operation operation, Set<Parameter> parameters, String parameterType) {
313313
if (parameters.size() > 0) {

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
5050
protected String artifactVersion = "1.0.0";
5151
protected String jsProjectName;
5252
protected String jsModuleName;
53-
protected String perlModuleName = "WWW::SwaggerClient";
54-
protected String pythonPackageName = "swagger_client";
53+
protected String perlModuleName = "WWW::OPenAPIClient";
54+
protected String pythonPackageName = "openapi_client";
5555

5656
public StaticHtml2Generator() {
5757
super();
@@ -77,8 +77,8 @@ public StaticHtml2Generator() {
7777

7878
additionalProperties.put("appName", "OpenAPI Sample");
7979
additionalProperties.put("appDescription", "A sample openapi server");
80-
additionalProperties.put("infoUrl", "https://helloreverb.com");
81-
additionalProperties.put("infoEmail", "hello@helloreverb.com");
80+
additionalProperties.put("infoUrl", "https://openapi-generator.tech");
81+
additionalProperties.put("infoEmail", "contributors@openapitools.org");
8282
additionalProperties.put("licenseInfo", "All rights reserved");
8383
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
8484
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
@@ -161,7 +161,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
161161

162162
// default values
163163
if (StringUtils.isBlank(jsProjectName)) {
164-
jsProjectName = "swagger-js-client";
164+
jsProjectName = "openapi-js-client";
165165
}
166166
if (StringUtils.isBlank(jsModuleName)) {
167167
jsModuleName = camelize(underscore(jsProjectName));

samples/client/petstore/powershell/Build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function Get-FunctionsToExport {
3838
}
3939

4040
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
41-
$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath
41+
$ClientPath = ("$ScriptDir\..\..\petstore\csharp\OpenAPIClient" | Resolve-Path).ProviderPath
4242
$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\Org.OpenAPITools\" $_}
4343
$BinPath = "$ScriptDir\src\Org.OpenAPITools\Bin"
4444

samples/client/petstore/powershell/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This PowerShell module is automatically generated by the [OpenAPI Generator](htt
1414

1515
<a name="dependencies"></a>
1616
## Dependencies
17-
- C# API client generated by OpenAPI Generator AND should be located in $ScriptDir\..\..\petstore\csharp\SwaggerClient as stated in Build.ps1
17+
- C# API client generated by OpenAPI Generator AND should be located in $ScriptDir\..\..\petstore\csharp\OpenAPIClient as stated in Build.ps1
1818

1919
<a name="installation"></a>
2020
## Installation
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.0-SNAPSHOT
1+
3.0.0-SNAPSHOT

samples/client/petstore/scala-gatling/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.github.lkishalmi.gatling' version '0.4.1'
2+
id 'com.github.lkishalmi.gatling' version '0.7.1'
33
}
44

55
repositories {

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/api/PetApiSimulation.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/api/PetApiSimulation.scala

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package io.swagger.client.api
1+
package org.openapitools.client.api
22

3-
import io.swagger.client.model._
3+
import org.openapitools.client.model._
44
import com.typesafe.config.ConfigFactory
55

66
import io.gatling.core.Predef._
@@ -68,27 +68,21 @@ class PetApiSimulation extends Simulation {
6868
val scenarioBuilders: mutable.MutableList[PopulationBuilder] = new mutable.MutableList[PopulationBuilder]()
6969

7070
// Set up CSV feeders
71-
val addPetBodyFeeder = csv(userDataDirectory + File.separator + "addPet-bodyParams.csv", escapeChar = '\\').random
7271
val deletePetHEADERFeeder = csv(userDataDirectory + File.separator + "deletePet-headerParams.csv").random
7372
val deletePetPATHFeeder = csv(userDataDirectory + File.separator + "deletePet-pathParams.csv").random
7473
val findPetsByStatusQUERYFeeder = csv(userDataDirectory + File.separator + "findPetsByStatus-queryParams.csv").random
7574
val findPetsByTagsQUERYFeeder = csv(userDataDirectory + File.separator + "findPetsByTags-queryParams.csv").random
7675
val getPetByIdPATHFeeder = csv(userDataDirectory + File.separator + "getPetById-pathParams.csv").random
77-
val updatePetBodyFeeder = csv(userDataDirectory + File.separator + "updatePet-bodyParams.csv", escapeChar = '\\').random
78-
val updatePetWithFormFORMFeeder = csv(userDataDirectory + File.separator + "updatePetWithForm-formParams.csv").random
7976
val updatePetWithFormPATHFeeder = csv(userDataDirectory + File.separator + "updatePetWithForm-pathParams.csv").random
80-
val uploadFileFORMFeeder = csv(userDataDirectory + File.separator + "uploadFile-formParams.csv").random
8177
val uploadFilePATHFeeder = csv(userDataDirectory + File.separator + "uploadFile-pathParams.csv").random
8278

8379
// Setup all scenarios
8480

8581

8682
val scnaddPet = scenario("addPetSimulation")
87-
.feed(addPetBodyFeeder)
8883
.exec(http("addPet")
8984
.httpRequest("POST","/pet")
90-
.body(StringBody(Pet.toStringBody("${id}","${category}","${name}","${tags}","${status}","${photoUrls}")))
91-
)
85+
)
9286

9387
// Run scnaddPet with warm up and reach a constant rate for entire duration
9488
scenarioBuilders += scnaddPet.inject(
@@ -159,11 +153,9 @@ class PetApiSimulation extends Simulation {
159153

160154

161155
val scnupdatePet = scenario("updatePetSimulation")
162-
.feed(updatePetBodyFeeder)
163156
.exec(http("updatePet")
164157
.httpRequest("PUT","/pet")
165-
.body(StringBody(Pet.toStringBody("${id}","${category}","${name}","${tags}","${status}","${photoUrls}")))
166-
)
158+
)
167159

168160
// Run scnupdatePet with warm up and reach a constant rate for entire duration
169161
scenarioBuilders += scnupdatePet.inject(
@@ -174,12 +166,9 @@ class PetApiSimulation extends Simulation {
174166

175167

176168
val scnupdatePetWithForm = scenario("updatePetWithFormSimulation")
177-
.feed(updatePetWithFormFORMFeeder)
178169
.feed(updatePetWithFormPATHFeeder)
179170
.exec(http("updatePetWithForm")
180171
.httpRequest("POST","/pet/${petId}")
181-
.formParam("name","${name}")
182-
.formParam("status","${status}")
183172
)
184173

185174
// Run scnupdatePetWithForm with warm up and reach a constant rate for entire duration
@@ -191,12 +180,9 @@ class PetApiSimulation extends Simulation {
191180

192181

193182
val scnuploadFile = scenario("uploadFileSimulation")
194-
.feed(uploadFileFORMFeeder)
195183
.feed(uploadFilePATHFeeder)
196184
.exec(http("uploadFile")
197185
.httpRequest("POST","/pet/${petId}/uploadImage")
198-
.formParam("file","${file}")
199-
.formParam("additionalMetadata","${additionalMetadata}")
200186
)
201187

202188
// Run scnuploadFile with warm up and reach a constant rate for entire duration

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/api/StoreApiSimulation.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/api/StoreApiSimulation.scala

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package io.swagger.client.api
1+
package org.openapitools.client.api
22

3-
import io.swagger.client.model._
3+
import org.openapitools.client.model._
44
import com.typesafe.config.ConfigFactory
55

66
import io.gatling.core.Predef._
@@ -66,7 +66,6 @@ class StoreApiSimulation extends Simulation {
6666
// Set up CSV feeders
6767
val deleteOrderPATHFeeder = csv(userDataDirectory + File.separator + "deleteOrder-pathParams.csv").random
6868
val getOrderByIdPATHFeeder = csv(userDataDirectory + File.separator + "getOrderById-pathParams.csv").random
69-
val placeOrderBodyFeeder = csv(userDataDirectory + File.separator + "placeOrder-bodyParams.csv", escapeChar = '\\').random
7069

7170
// Setup all scenarios
7271

@@ -113,11 +112,9 @@ class StoreApiSimulation extends Simulation {
113112

114113

115114
val scnplaceOrder = scenario("placeOrderSimulation")
116-
.feed(placeOrderBodyFeeder)
117115
.exec(http("placeOrder")
118116
.httpRequest("POST","/store/order")
119-
.body(StringBody(Order.toStringBody("${id}","${shipDate}","${complete}","${quantity}","${status}","${petId}")))
120-
)
117+
)
121118

122119
// Run scnplaceOrder with warm up and reach a constant rate for entire duration
123120
scenarioBuilders += scnplaceOrder.inject(

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/api/UserApiSimulation.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/api/UserApiSimulation.scala

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package io.swagger.client.api
1+
package org.openapitools.client.api
22

3-
import io.swagger.client.model._
3+
import org.openapitools.client.model._
44
import com.typesafe.config.ConfigFactory
55

66
import io.gatling.core.Predef._
@@ -68,22 +68,18 @@ class UserApiSimulation extends Simulation {
6868
val scenarioBuilders: mutable.MutableList[PopulationBuilder] = new mutable.MutableList[PopulationBuilder]()
6969

7070
// Set up CSV feeders
71-
val createUserBodyFeeder = csv(userDataDirectory + File.separator + "createUser-bodyParams.csv", escapeChar = '\\').random
7271
val deleteUserPATHFeeder = csv(userDataDirectory + File.separator + "deleteUser-pathParams.csv").random
7372
val getUserByNamePATHFeeder = csv(userDataDirectory + File.separator + "getUserByName-pathParams.csv").random
7473
val loginUserQUERYFeeder = csv(userDataDirectory + File.separator + "loginUser-queryParams.csv").random
7574
val updateUserPATHFeeder = csv(userDataDirectory + File.separator + "updateUser-pathParams.csv").random
76-
val updateUserBodyFeeder = csv(userDataDirectory + File.separator + "updateUser-bodyParams.csv", escapeChar = '\\').random
7775

7876
// Setup all scenarios
7977

8078

8179
val scncreateUser = scenario("createUserSimulation")
82-
.feed(createUserBodyFeeder)
8380
.exec(http("createUser")
8481
.httpRequest("POST","/user")
85-
.body(StringBody(User.toStringBody("${password}","${id}","${lastName}","${firstName}","${email}","${userStatus}","${phone}","${username}")))
86-
)
82+
)
8783

8884
// Run scncreateUser with warm up and reach a constant rate for entire duration
8985
scenarioBuilders += scncreateUser.inject(
@@ -96,8 +92,7 @@ class UserApiSimulation extends Simulation {
9692
val scncreateUsersWithArrayInput = scenario("createUsersWithArrayInputSimulation")
9793
.exec(http("createUsersWithArrayInput")
9894
.httpRequest("POST","/user/createWithArray")
99-
.body(StringBody(StringBody("[]")))
100-
)
95+
)
10196

10297
// Run scncreateUsersWithArrayInput with warm up and reach a constant rate for entire duration
10398
scenarioBuilders += scncreateUsersWithArrayInput.inject(
@@ -110,8 +105,7 @@ class UserApiSimulation extends Simulation {
110105
val scncreateUsersWithListInput = scenario("createUsersWithListInputSimulation")
111106
.exec(http("createUsersWithListInput")
112107
.httpRequest("POST","/user/createWithList")
113-
.body(StringBody(StringBody("[]")))
114-
)
108+
)
115109

116110
// Run scncreateUsersWithListInput with warm up and reach a constant rate for entire duration
117111
scenarioBuilders += scncreateUsersWithListInput.inject(
@@ -179,12 +173,10 @@ class UserApiSimulation extends Simulation {
179173

180174

181175
val scnupdateUser = scenario("updateUserSimulation")
182-
.feed(updateUserBodyFeeder)
183176
.feed(updateUserPATHFeeder)
184177
.exec(http("updateUser")
185178
.httpRequest("PUT","/user/${username}")
186-
.body(StringBody(User.toStringBody("${password}","${id}","${lastName}","${firstName}","${email}","${userStatus}","${phone}","${username}")))
187-
)
179+
)
188180

189181
// Run scnupdateUser with warm up and reach a constant rate for entire duration
190182
scenarioBuilders += scnupdateUser.inject(

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/model/ApiResponse.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/model/ApiResponse.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package io.swagger.client.model
2+
package org.openapitools.client.model
33

44

55
case class ApiResponse (

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/model/Category.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/model/Category.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package io.swagger.client.model
2+
package org.openapitools.client.model
33

44

55
case class Category (

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/model/Order.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/model/Order.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package io.swagger.client.model
2+
package org.openapitools.client.model
33

44
import java.util.Date
55

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/model/Pet.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/model/Pet.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package io.swagger.client.model
2+
package org.openapitools.client.model
33

44

55
case class Pet (

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/model/Tag.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/model/Tag.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package io.swagger.client.model
2+
package org.openapitools.client.model
33

44

55
case class Tag (

samples/client/petstore/scala-gatling/src/gatling/scala/io/swagger/client/model/User.scala samples/client/petstore/scala-gatling/src/gatling/scala/org/openapitools/client/model/User.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package io.swagger.client.model
2+
package org.openapitools.client.model
33

44

55
case class User (

0 commit comments

Comments
 (0)