I am almost done migrating my code base to 2.2. Most of the changes have been relatively simple to figure out. But there is one left that I need some help with.
I have a bunch of implicits that I created which allows me to extend the DSL with session management syntactic sugar. There is one method that does not compile under 2.2:
`
…
import io.gatling.core.json.Boon
import io.gatling.core.check.extractor.jsonpath._
…
object SessionManagement {
implicit class SessionManagementExtensions[T <: StructureBuilder[T]]( val c : T ) {
…
private def extractAll( path: String, json: String ) =
JsonPathExtractor.extractAll[String]( Boon.parse( json ), path ) match {
case Success(x) => x.toVector
case Failure(msg) => throw new Error( msg )
}
private def setVarExtract( dest: SessionVariable, path: String, src: SessionVariable) =
c.exec( session => session.set( dest, extractAll( path, session(src).as[String] ).head ) )
private def setVarExtractAll( dest: SessionVariable, path: String, src: SessionVariable ) =
c.exec( session => session.set( dest, extractAll( path, session(src).as[String] ) ) )
`
When compiled, it reports as follows:
`
18:27:00.666 [ERROR] i.g.c.ZincCompiler$ - /src/poc/rtde/src/scala/com/cigna/common/SessionManagement.scala:57: not found: value JsonPathExtractor
18:27:00.670 [ERROR] i.g.c.ZincCompiler$ - JsonPathExtractor.extractAll[String]( Boon.parse( json ), path ) match {
18:27:00.670 [ERROR] i.g.c.ZincCompiler$ - ^
18:27:00.673 [ERROR] i.g.c.ZincCompiler$ - /src/poc/rtde/src/scala/com/cigna/common/SessionManagement.scala:57: not found: value Boon
18:27:00.673 [ERROR] i.g.c.ZincCompiler$ - JsonPathExtractor.extractAll[String]( Boon.parse( json ), path ) match {
18:27:00.674 [ERROR] i.g.c.ZincCompiler$ - ^
18:27:00.684 [ERROR] i.g.c.ZincCompiler$ - /src/poc/rtde/src/scala/com/cigna/common/SessionManagement.scala:58: value toVector is not a member of Any
18:27:00.685 [ERROR] i.g.c.ZincCompiler$ - case Success(x) => x.toVector
18:27:00.685 [ERROR] i.g.c.ZincCompiler$ - ^
`
You had said here that I “should probably be creating a MultipleJsonPathExtractor instance” but when I search for that, I don’t find anything.
May I ask, what are the changes I need to make in order to get this code to work the way it did in 2.0?