Browse files

Updated simulation to interact with new JSON services.

  • Loading branch information...
1 parent 7523ab5 commit 47bb6870f03d78f40c7ae4f878f464d0aa2cef21 @skuenzli committed Nov 10, 2012
View
1 sample-webapp/src/main/java/com/qualimente/reliability/web/ExampleController.java
@@ -59,7 +59,6 @@
List<Example> result = exampleService.findAllExamples();
- LOGGER.info("Examples: " + result);
return new ResponseEntity<String>(Example.toJsonArray(result), headers, HttpStatus.OK);
}
View
54 ...le-webapp/src/main/resources/simulations/OutstandingRequestLimitingFilterSimulation.scala
@@ -1,40 +1,66 @@
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
+import akka.util.duration._
import com.ning.http.client.{Response, Request}
class OutstandingRequestLimitingFilterSimulation extends Simulation {
- def apply = {
+ def apply = {
- val urlBase = "http://localhost:8080"
+ val urlBase = "http://localhost:8080"
- val httpConf = httpConfig.baseURL(urlBase)
+ val httpConf = httpConfig.baseURL(urlBase)
.requestInfoExtractor((request: Request) => {
List[String](request.getUrl)
})
.responseInfoExtractor((response: Response) => {
List[String](response.getStatusCode.toString())
})
- val headers_standard = Map(
- "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
- "Accept-Charset" -> "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
- "Accept-Encoding" -> "gzip,deflate",
- "Host" -> "localhost:8080",
- "User-Agent" -> "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/9.10 (karmic) Firefox/3.6.17")
+ val headers_standard = Map(
+ "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+ "Accept-Charset" -> "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
+ "Accept-Encoding" -> "gzip,deflate",
+ "Host" -> "localhost:8080")
- val scn = scenario("Request overload")
+ val headers_json = Map(
+ "Accept" -> "application/json",
+ "Accept-Charset" -> "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
+ "Accept-Encoding" -> "gzip,deflate",
+ "Host" -> "localhost:8080")
+
+ val setupScenario = scenario("Setup")
+ .repeat(10) {
+ chain
+ .exec(
+ http("examples - create")
+ .post("/sample-webapp/examples/")
+ .headers(headers_json)
+ .body("{}")
+ )
+ }
+
+ val overloadScenario = scenario("Request overload")
.loop(
chain
.exec(
http("homepage")
.get("/sample-webapp/")
.headers(headers_standard)
.check(status.in(List(200, 503))))
- /* .pause(0, 50, MILLISECONDS) */
- .pauseExp(100, MILLISECONDS)
+ /* .pause(0, 50, MILLISECONDS) */
+ .pauseExp(100 milliseconds)
+
+ .exec(
+ http("examples - list")
+ .get("/sample-webapp/examples/")
+ .headers(headers_json)
+ .check(status.in(List(200, 503))))
).during(1, MINUTES)
- List(scn.configure.users(100).ramp(10).protocolConfig(httpConf))
- }
+ List(
+ setupScenario.configure.users(1).ramp(1).protocolConfig(httpConf)
+ , overloadScenario.configure.users(100).ramp(10).protocolConfig(httpConf)
+ )
+ }
}

0 comments on commit 47bb687

Please sign in to comment.