Skip to content

Instantly share code, notes, and snippets.

@nremond
Forked from krishnenc/gist:2888208
Created December 20, 2012 13:14
Show Gist options
  • Save nremond/4345254 to your computer and use it in GitHub Desktop.
Save nremond/4345254 to your computer and use it in GitHub Desktop.
package other
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
class ByteArrayBodySimulation extends Simulation {
val urlBase = "http://localhost:8080"
val httpConf = httpConfig.baseURL(urlBase)
val header = Map(
"Content-Type" -> "application/octet-stream")
val scn = scenario("Scenario name")
.repeat(10) {
exec(http("Protocol Buffer - hola").post("/hola")
.headers(header)
.byteArrayBody(session => getByteArrayBody(session)))
.pause(7, 8)
}
setUp(scn.configure.users(10).ramp(1).protocolConfig(httpConf))
val getByteArrayBody = (session: Session) => {
import Parse.Implicits.parseByteArray
redisPool.withClient(client =>
client.lpop("TEST")).getOrElse {
redisPool.close
val errMsg = "There are not enough records in the redis list"
throw new RuntimeException(errMsg)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment