I am trying to parse a CSV, but am running into problems between the DSL and Scala
package scraper
import au.com.bytecode.opencsv.CSVWriter
import java.io.BufferedWriter
import java.io.FileWriter
import java.io.StringWriter
import io.gatling.core.session.Session
import scala.collection.JavaConversions._
object writeSwaggerValues extends App {
def createCSV () : Unit = {
val out = new BufferedWriter(new FileWriter("/home/aram/session.csv"))
val writer = new CSVWriter(out)
val swaggerSchema = Array("nickname", "path", "method")
val twitter = Array("${lastTweetsName}", "${lastTweetsPath}", "${lastTweetsMethod}")
val forecast = Array("${forecastName}", "${forecastPath}", "${forecastMethod}")
val listOfRecords = List(swaggerSchema, twitter, forecast)
writer.writeAll(listOfRecords)
out.close()
}
}
Stacktrace
error: overloaded method value exec with alternatives:
[ERROR] (scenario: io.gatling.core.structure.ScenarioBuilder)io.gatling.core.structure.ScenarioBuilder
[ERROR] (chains: Iterable[io.gatling.core.structure.ChainBuilder])io.gatling.core.structure.ScenarioBuilder
[ERROR] (chains: Iterator[io.gatling.core.structure.ChainBuilder])io.gatling.core.structure.ScenarioBuilder
[ERROR] (chains: io.gatling.core.structure.ChainBuilder*)io.gatling.core.structure.ScenarioBuilder
[ERROR] (actionBuilder: io.gatling.core.action.builder.ActionBuilder)io.gatling.core.structure.ScenarioBuilder
[ERROR] (sessionFunction: io.gatling.core.session.Expression[io.gatling.core.session.Session])io.gatling.core.structure.ScenarioBuilder
[ERROR] cannot be applied to (AnyVal)
[ERROR] .exec(writeSwaggerValues.createCSV)
[ERROR] ^
The problem is inthe return type if I am correct. I think the DSL chainbuilder want me to return Session (that is the reason for the import), but they I get:
error: type mismatch;
[ERROR] found : Unit
[ERROR] required: io.gatling.core.session.Session
[ERROR] out.close()
[ERROR] ^
Does anyone have a idea to solve this?
Thank you