Skip to content

Commit

Permalink
extracting karate feature to separate class
Browse files Browse the repository at this point in the history
  • Loading branch information
harikrishnan83 committed Aug 25, 2021
1 parent acfd625 commit e0feabc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
34 changes: 34 additions & 0 deletions src/main/scala/org/znsio/perfiz/KarateFeature.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.znsio.perfiz

import java.util.{ArrayList, List}

import org.znsio.perfiz.ClosedWorkloadModel.{ConstantConcurrentUsers, RampConcurrentUsers}
import org.znsio.perfiz.OpenWorkloadModel._

import scala.beans.BeanProperty
import scala.jdk.CollectionConverters._
import scala.language.postfixOps

class KarateFeature {
@BeanProperty
var karateFile: String = _

@BeanProperty
var gatlingSimulationName: String = _

@BeanProperty
var loadPattern: List[GatlingWorkLoadModelStep] = new ArrayList[GatlingWorkLoadModelStep]()

@BeanProperty
var uriPatterns: List[String] = new ArrayList[String]()

def openWorkloadModelSteps = loadPattern.asScala.toList.filter(loadPattern => {
val openModelLoadPatterns = scala.List(NothingFor, AtOnceUsers, RampUsers, ConstantUsersPerSecond, RampUsersPerSecond, HeavisideUsers)
openModelLoadPatterns.contains(loadPattern.patternType)
})

def closedWorkloadModelSteps = loadPattern.asScala.toList.filter(loadPattern => {
val closedModelLoadPatterns = scala.List(ConstantConcurrentUsers, RampConcurrentUsers)
closedModelLoadPatterns.contains(loadPattern.patternType)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import java.util.{ArrayList, List}

import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor
import org.znsio.perfiz.ClosedWorkloadModel._
import org.znsio.perfiz.OpenWorkloadModel._

import scala.beans.BeanProperty
import scala.concurrent.duration.{Duration, FiniteDuration}

import scala.jdk.CollectionConverters._
import scala.language.postfixOps

Expand All @@ -35,30 +32,6 @@ object PerfizConfiguration {
)
}

class KarateFeature {
@BeanProperty
var karateFile: String = _

@BeanProperty
var gatlingSimulationName: String = _

@BeanProperty
var loadPattern: List[GatlingWorkLoadModelStep] = new ArrayList[GatlingWorkLoadModelStep]()

@BeanProperty
var uriPatterns: List[String] = new ArrayList[String]()

def openWorkloadModelSteps = loadPattern.asScala.toList.filter(loadPattern => {
val openModelLoadPatterns = scala.List(NothingFor, AtOnceUsers, RampUsers, ConstantUsersPerSecond, RampUsersPerSecond, HeavisideUsers)
openModelLoadPatterns.contains(loadPattern.patternType)
})

def closedWorkloadModelSteps = loadPattern.asScala.toList.filter(loadPattern => {
val closedModelLoadPatterns = scala.List(ConstantConcurrentUsers, RampConcurrentUsers)
closedModelLoadPatterns.contains(loadPattern.patternType)
})
}

class GatlingWorkLoadModelStep {
@BeanProperty
var patternType: String = _
Expand Down

0 comments on commit e0feabc

Please sign in to comment.