-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extracting gatling work load model step to separate class
- Loading branch information
1 parent
e0feabc
commit d7efd6c
Showing
6 changed files
with
76 additions
and
36 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/scala/org/znsio/perfiz/GatlingWorkLoadModelStep.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.znsio.perfiz | ||
|
||
import scala.beans.BeanProperty | ||
import scala.concurrent.duration.{Duration, FiniteDuration} | ||
|
||
class GatlingWorkLoadModelStep { | ||
@BeanProperty | ||
var patternType: String = _ | ||
|
||
@BeanProperty | ||
var userCount: Int = _ | ||
|
||
@BeanProperty | ||
var duration: String = _ | ||
|
||
@BeanProperty | ||
var randomised: Boolean = _ | ||
|
||
@BeanProperty | ||
var targetUserCount: Int = _ | ||
|
||
def durationAsFiniteDuration = Duration(duration).asInstanceOf[FiniteDuration] | ||
} | ||
|
||
object OpenWorkloadModel { | ||
val NothingFor = "nothingFor" | ||
val AtOnceUsers = "atOnceUsers" | ||
val RampUsers = "rampUsers" | ||
val ConstantUsersPerSecond = "constantUsersPerSec" | ||
val RampUsersPerSecond = "rampUsersPerSec" | ||
val HeavisideUsers = "heavisideUsers" | ||
} | ||
|
||
object ClosedWorkloadModel { | ||
val ConstantConcurrentUsers = "constantConcurrentUsers" | ||
val RampConcurrentUsers = "rampConcurrentUsers" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/scala/org/znsio/perfiz/GatlingWorkLoadModelStepSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.znsio.perfiz | ||
|
||
import org.scalatest.freespec.AnyFreeSpec | ||
|
||
import scala.concurrent.duration.{Duration, FiniteDuration} | ||
|
||
class GatlingWorkLoadModelStepSpec extends AnyFreeSpec { | ||
"given a gatling workload model step" - { | ||
|
||
"when duration is set in minutes" - { | ||
val gatlingWorkLoadModelStep = new GatlingWorkLoadModelStep | ||
val twoMinutesString = "2 minutes" | ||
gatlingWorkLoadModelStep.duration = twoMinutesString | ||
|
||
"should convert to Finite Duration" in { | ||
val twoMinutes = Duration(twoMinutesString).asInstanceOf[FiniteDuration] | ||
assert(gatlingWorkLoadModelStep.durationAsFiniteDuration.equals(twoMinutes)) | ||
} | ||
} | ||
|
||
"when duration is set in seconds" - { | ||
val gatlingWorkLoadModelStep = new GatlingWorkLoadModelStep | ||
val oneSecondString = "1 second" | ||
gatlingWorkLoadModelStep.duration = oneSecondString | ||
|
||
"should convert to Finite Duration" in { | ||
val oneSecond = Duration(oneSecondString).asInstanceOf[FiniteDuration] | ||
assert(gatlingWorkLoadModelStep.durationAsFiniteDuration.equals(oneSecond)) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters