Dynamic injection profile

I’m trying to create a simulation where the scenarios executed and the injection profiles for them are passed in as a system property in the form of a JSON string. Here’s a gist of what I have so far.

I’m getting the following compile errors:

type mismatch;
found : io.gatling.core.controller.inject.RampInjection
required: Nothing
case “rampUsers” => rampUsers(stepArgs.getInt(0)) over(stepArgs.getInt(1))

^

type mismatch;
found : io.gatling.core.structure.PopulatedScenarioBuilder
required: Nothing
scnList(i) = scenarioNames(testCase.getString(“case”)).inject(injectStepList:_*)
^

Anyone have any ideas as to what’s wrong/how to fix it? (Other comments/suggestions not related to the errors are also welcome.)

PS The format of the JSON looks like this:

[{‘case’:‘ScenarioMapKey’, ‘inject’:[{‘type’:‘injectionStepType’, ‘args’:[arg1(,arg2(,arg3)))]}]}]

Example:

[
{
‘case’: ‘Login’,
‘inject’: [
{
‘type’: ‘nothingFor’,
‘args’: [
5
]
},
{
‘type’: ‘constantUsersPerSec’,
‘args’: [
1,
10
]
}
]
},
{
‘case’: ‘Register’,
‘inject’: [
{
‘type’: ‘atOnceUsers’,
‘args’: [
3
]
}
]
}
]

Which should translate to:

setUp(LoginScenario.scn.inject(nothingFor(5), constantUsersPerSec(1) during(10)),
RegisterScenario.scn.inject(atOnceUsers(3))).protocols(httpConf)

Please provide a full gist that should compile, except for your problem.
What is JSONArray? Certainly not scala.util.parsing.json.JSONArray.

Updated.

The JSON library is json.org, jar available here.

o_O I wasn’t aware of a Java reference implementation. How does it perform, compared to something like Jackson? Is it just a toy, or is it production ready? You know that Gatling already ships Jackson and Boon, right?

I was already using the reference implementation in the Java app that’s writing the JSON, so I picked it test-side over the built-in Scala package or Jackson just for consistency. It’s the least of my concerns w.r.t. performance, so no clue on that front.

Well, I fixed it and added the working version to the gist. That said, I have no clue why it works now. All I did was pull the match statement that turns the injection step name into an InjectionStep into its own function.

What was your problem with the first version in the first place? It seems to be compiling just fine.
Could it be that you’re using IntelliJ? Beware, its compiler is quite buggy…

The type mismatch errors in the first post. I’m just using gatling.sh from the command line. I guess I’ll just call it gremlins in my computer and move on?

I tried with eclipse w/ latest Gatling and it compiles just fine…
Whatever…

Please ping if you still hit something.