Skip to content

Commit

Permalink
Merge pull request #9919 from drdk/scala-gatling-fixes
Browse files Browse the repository at this point in the history
Fixes to scala-gatling generated scripts
  • Loading branch information
frantuma committed Dec 13, 2019
2 parents b930bb4 + 269e191 commit 3a75314
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ class {{classname}}Simulation extends Simulation {
def getCurrentDirectory = new File("").getAbsolutePath
def userDataDirectory = getCurrentDirectory + "/src/gatling/resources/data"
def userConfDirectory = getCurrentDirectory + "/src/gatling/resources/conf"
// basic test setup
val configName = System.getProperty("testConfig", "baseline")
val config = ConfigFactory.load(configName).withFallback(ConfigFactory.load("default"))
val config = ConfigFactory.parseFile(new File(userConfDirectory + File.separator + configName + ".conf"))
.withFallback(ConfigFactory.parseFile(new File(userConfDirectory + File.separator + "default.conf")))
val durationSeconds = config.getInt("performance.durationSeconds")
val rampUpSeconds = config.getInt("performance.rampUpSeconds")
val rampDownSeconds = config.getInt("performance.rampDownSeconds")
Expand All @@ -42,7 +44,7 @@ class {{classname}}Simulation extends Simulation {
// Setup http protocol configuration
val httpConf = http
.baseURL("{{basePath}}")
.baseUrl("{{basePath}}")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
Expand All @@ -51,7 +53,7 @@ class {{classname}}Simulation extends Simulation {
.contentTypeHeader(contentTypeHeader)
// set authorization header if it has been modified from config
if(!authentication.equals("~MANUAL_ENTRY")){
if(!authentication.equals("~MANUAL_ENTRY~")){
httpConf.authorizationHeader(authentication)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.3-SNAPSHOT
2.4.11-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
photoUrls,name,id,category,tags,status
tags,id,category,status,name,photoUrls
Original file line number Diff line number Diff line change
@@ -1 +1 @@
firstName,lastName,password,userStatus,phone,id,email,username
id,lastName,phone,username,email,userStatus,firstName,password
Original file line number Diff line number Diff line change
@@ -1 +1 @@
petId,quantity,id,shipDate,complete,status
id,petId,complete,status,quantity,shipDate
Original file line number Diff line number Diff line change
@@ -1 +1 @@
photoUrls,name,id,category,tags,status
tags,id,category,status,name,photoUrls
Original file line number Diff line number Diff line change
@@ -1 +1 @@
firstName,lastName,password,userStatus,phone,id,email,username
id,lastName,phone,username,email,userStatus,firstName,password
Original file line number Diff line number Diff line change
@@ -1 +1 @@
file,additionalMetadata
additionalMetadata,file
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ class PetApiSimulation extends Simulation {

def getCurrentDirectory = new File("").getAbsolutePath
def userDataDirectory = getCurrentDirectory + "/src/gatling/resources/data"
def userConfDirectory = getCurrentDirectory + "/src/gatling/resources/conf"

// basic test setup
val configName = System.getProperty("testConfig", "baseline")
val config = ConfigFactory.load(configName).withFallback(ConfigFactory.load("default"))
val config = ConfigFactory.parseFile(new File(userConfDirectory + File.separator + configName + ".conf"))
.withFallback(ConfigFactory.parseFile(new File(userConfDirectory + File.separator + "default.conf")))
val durationSeconds = config.getInt("performance.durationSeconds")
val rampUpSeconds = config.getInt("performance.rampUpSeconds")
val rampDownSeconds = config.getInt("performance.rampDownSeconds")
Expand All @@ -42,7 +44,7 @@ class PetApiSimulation extends Simulation {

// Setup http protocol configuration
val httpConf = http
.baseURL("http://petstore.swagger.io/v2")
.baseUrl("http://petstore.swagger.io/v2")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
Expand All @@ -51,7 +53,7 @@ class PetApiSimulation extends Simulation {
.contentTypeHeader(contentTypeHeader)

// set authorization header if it has been modified from config
if(!authentication.equals("~MANUAL_ENTRY")){
if(!authentication.equals("~MANUAL_ENTRY~")){
httpConf.authorizationHeader(authentication)
}

Expand Down Expand Up @@ -87,7 +89,7 @@ class PetApiSimulation extends Simulation {
.feed(addPetBodyFeeder)
.exec(http("addPet")
.httpRequest("POST","/pet")
.body(StringBody(Pet.toStringBody("${id}","${category}","${name}","${tags}","${status}","${photoUrls}")))
.body(StringBody(Pet.toStringBody("${status}","${id}","${tags}","${category}","${name}","${photoUrls}")))
)

// Run scnaddPet with warm up and reach a constant rate for entire duration
Expand Down Expand Up @@ -162,7 +164,7 @@ class PetApiSimulation extends Simulation {
.feed(updatePetBodyFeeder)
.exec(http("updatePet")
.httpRequest("PUT","/pet")
.body(StringBody(Pet.toStringBody("${id}","${category}","${name}","${tags}","${status}","${photoUrls}")))
.body(StringBody(Pet.toStringBody("${status}","${id}","${tags}","${category}","${name}","${photoUrls}")))
)

// Run scnupdatePet with warm up and reach a constant rate for entire duration
Expand Down Expand Up @@ -195,8 +197,8 @@ class PetApiSimulation extends Simulation {
.feed(uploadFilePATHFeeder)
.exec(http("uploadFile")
.httpRequest("POST","/pet/${petId}/uploadImage")
.formParam("file","${file}")
.formParam("additionalMetadata","${additionalMetadata}")
.formParam("file","${file}")
)

// Run scnuploadFile with warm up and reach a constant rate for entire duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ class StoreApiSimulation extends Simulation {

def getCurrentDirectory = new File("").getAbsolutePath
def userDataDirectory = getCurrentDirectory + "/src/gatling/resources/data"
def userConfDirectory = getCurrentDirectory + "/src/gatling/resources/conf"

// basic test setup
val configName = System.getProperty("testConfig", "baseline")
val config = ConfigFactory.load(configName).withFallback(ConfigFactory.load("default"))
val config = ConfigFactory.parseFile(new File(userConfDirectory + File.separator + configName + ".conf"))
.withFallback(ConfigFactory.parseFile(new File(userConfDirectory + File.separator + "default.conf")))
val durationSeconds = config.getInt("performance.durationSeconds")
val rampUpSeconds = config.getInt("performance.rampUpSeconds")
val rampDownSeconds = config.getInt("performance.rampDownSeconds")
Expand All @@ -42,7 +44,7 @@ class StoreApiSimulation extends Simulation {

// Setup http protocol configuration
val httpConf = http
.baseURL("http://petstore.swagger.io/v2")
.baseUrl("http://petstore.swagger.io/v2")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
Expand All @@ -51,7 +53,7 @@ class StoreApiSimulation extends Simulation {
.contentTypeHeader(contentTypeHeader)

// set authorization header if it has been modified from config
if(!authentication.equals("~MANUAL_ENTRY")){
if(!authentication.equals("~MANUAL_ENTRY~")){
httpConf.authorizationHeader(authentication)
}

Expand Down Expand Up @@ -116,7 +118,7 @@ class StoreApiSimulation extends Simulation {
.feed(placeOrderBodyFeeder)
.exec(http("placeOrder")
.httpRequest("POST","/store/order")
.body(StringBody(Order.toStringBody("${id}","${shipDate}","${complete}","${quantity}","${status}","${petId}")))
.body(StringBody(Order.toStringBody("${status}","${id}","${petId}","${quantity}","${complete}","${shipDate}")))
)

// Run scnplaceOrder with warm up and reach a constant rate for entire duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ class UserApiSimulation extends Simulation {

def getCurrentDirectory = new File("").getAbsolutePath
def userDataDirectory = getCurrentDirectory + "/src/gatling/resources/data"
def userConfDirectory = getCurrentDirectory + "/src/gatling/resources/conf"

// basic test setup
val configName = System.getProperty("testConfig", "baseline")
val config = ConfigFactory.load(configName).withFallback(ConfigFactory.load("default"))
val config = ConfigFactory.parseFile(new File(userConfDirectory + File.separator + configName + ".conf"))
.withFallback(ConfigFactory.parseFile(new File(userConfDirectory + File.separator + "default.conf")))
val durationSeconds = config.getInt("performance.durationSeconds")
val rampUpSeconds = config.getInt("performance.rampUpSeconds")
val rampDownSeconds = config.getInt("performance.rampDownSeconds")
Expand All @@ -42,7 +44,7 @@ class UserApiSimulation extends Simulation {

// Setup http protocol configuration
val httpConf = http
.baseURL("http://petstore.swagger.io/v2")
.baseUrl("http://petstore.swagger.io/v2")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
Expand All @@ -51,7 +53,7 @@ class UserApiSimulation extends Simulation {
.contentTypeHeader(contentTypeHeader)

// set authorization header if it has been modified from config
if(!authentication.equals("~MANUAL_ENTRY")){
if(!authentication.equals("~MANUAL_ENTRY~")){
httpConf.authorizationHeader(authentication)
}

Expand Down Expand Up @@ -82,7 +84,7 @@ class UserApiSimulation extends Simulation {
.feed(createUserBodyFeeder)
.exec(http("createUser")
.httpRequest("POST","/user")
.body(StringBody(User.toStringBody("${password}","${id}","${lastName}","${firstName}","${email}","${userStatus}","${phone}","${username}")))
.body(StringBody(User.toStringBody("${email}","${firstName}","${lastName}","${id}","${userStatus}","${phone}","${password}","${username}")))
)

// Run scncreateUser with warm up and reach a constant rate for entire duration
Expand Down Expand Up @@ -183,7 +185,7 @@ class UserApiSimulation extends Simulation {
.feed(updateUserPATHFeeder)
.exec(http("updateUser")
.httpRequest("PUT","/user/${username}")
.body(StringBody(User.toStringBody("${password}","${id}","${lastName}","${firstName}","${email}","${userStatus}","${phone}","${username}")))
.body(StringBody(User.toStringBody("${email}","${firstName}","${lastName}","${id}","${userStatus}","${phone}","${password}","${username}")))
)

// Run scnupdateUser with warm up and reach a constant rate for entire duration
Expand Down

0 comments on commit 3a75314

Please sign in to comment.