We have several Scala-based “helpers” that we’ve written over the years and were hoping to continue to leverage them in newer Java-based scripts without re-writing them.
For example, our “helpers” usually look something like…
ScalaHelper.scala file
object ScalaHelper {
def performSomeChain(String param): ChainBuilder =
exec(...)
.exec(...)
}
If I simply try call this chain inside our newer Java scripts, I get the something like the following…
LoadTest.java
...
.exec(ScalaHelper.peformSomeChain("value"))
...
no suitable method found for exec(io.gatling.core.structure.ChainBuilder)
method io.gatling.javaapi.core.exec.Execs.exec(java.util.function.Function<io.gatling.javaapi.core.Session,io.gatling.javaapi.core.Session>) is not applicable
(argument mismatch; io.gatling.core.structure.ChainBuilder cannot be converted to java.util.function.Function<io.gatling.javaapi.core.Session,io.gatling.javaapi.core.Session>)
method io.gatling.javaapi.core.exec.Execs.exec(io.gatling.javaapi.core.ActionBuilder) is not applicable
(argument mismatch; io.gatling.core.structure.ChainBuilder cannot be converted to io.gatling.javaapi.core.ActionBuilder)
method io.gatling.javaapi.core.exec.Execs.exec(io.gatling.javaapi.core.StructureBuilder<?,WB>…) is not applicable
(cannot infer type-variable(s) WB
(varargs mismatch; io.gatling.core.structure.ChainBuilder cannot be converted to io.gatling.javaapi.core.StructureBuilder<?,WB>))
method io.gatling.javaapi.core.exec.Execs.exec(java.util.List<io.gatling.javaapi.core.StructureBuilder<?,WB>>) is not applicable
(cannot infer type-variable(s) WB
(argument mismatch; io.gatling.core.structure.ChainBuilder cannot be converted to java.util.List<io.gatling.javaapi.core.StructureBuilder<?,WB>>))
feed(feeder)
Is there a general pattern for wrappering/converting these that we can use in this situation?
Thanks…
–Chris