You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/10/21 19:40:55 UTC

[55/58] [abbrv] git commit: updated loadtest simulations

updated loadtest simulations


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b9f6db0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b9f6db0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b9f6db0d

Branch: refs/heads/loadtest
Commit: b9f6db0d0b63bf8a37e8e28f2f7403b6ca7a5734
Parents: a8ab06c
Author: amuramoto <am...@apigee.com>
Authored: Tue Oct 14 15:57:11 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Tue Oct 14 15:57:11 2014 -0700

----------------------------------------------------------------------
 .../PushTargetDeviceSimulation.scala            | 37 ++++++++++++++
 .../simulations/PushTargetUserSimulation.scala  | 52 ++++++++++++++++++++
 2 files changed, 89 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b9f6db0d/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetDeviceSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetDeviceSimulation.scala b/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetDeviceSimulation.scala
new file mode 100755
index 0000000..ffe7afc
--- /dev/null
+++ b/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetDeviceSimulation.scala
@@ -0,0 +1,37 @@
+package org.apache.usergrid
+
+import io.gatling.core.Predef._
+import io.gatling.http.Predef._
+import scala.concurrent.duration._
+
+/**
+ *
+ * Simple test for setting up multiple orgs and creating push notifications
+ *
+ */
+class PushNotificationTargetDeviceSimulation extends Simulation {
+
+  val numUsers:Int = Settings.numUsers
+  val numEntities:Int = Settings.numEntities
+  val rampTime:Int = Settings.rampTime
+  val throttle:Int = Settings.throttle
+  val duration:Int = Settings.duration  
+  val httpConf = Settings.httpConf
+    .acceptHeader("application/json")
+
+  val createNotifier = NotifierScenarios.createNotifier
+  val createDevice = DeviceScenarios.postDeviceWithNotifier
+  val sendNotification = NotificationScenarios.sendNotification
+
+  val deviceNameFeeder = FeederGenerator.generateEntityNameFeeder("device", numEntities).circular
+
+  val scnToRun = scenario("Create Push Notification")    
+    .during(duration.seconds) {
+      feed(deviceNameFeeder)
+      .exec(sendNotification)
+    }
+
+
+  setUp(scnToRun.inject(atOnceUsers(numUsers)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b9f6db0d/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetUserSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetUserSimulation.scala b/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetUserSimulation.scala
new file mode 100644
index 0000000..922fe8d
--- /dev/null
+++ b/stack/loadtests/simulations/test/scala/org/apache/usergrid/simulations/PushTargetUserSimulation.scala
@@ -0,0 +1,52 @@
+package org.apache.usergrid
+
+import io.gatling.core.Predef._
+import io.gatling.http.Predef._
+import scala.concurrent.duration._
+
+class PushNotificationTargetUserSimulation extends Simulation {
+
+  val numUsers:Int = Settings.numUsers
+  val numEntities:Int = Settings.numEntities
+  val rampTime:Int = Settings.rampTime
+  val throttle:Int = Settings.throttle
+  val duration:Int = Settings.duration
+  val httpConf = Settings.httpConf
+    .acceptHeader("application/json")
+
+  val notifier = Settings.pushNotifier
+  val createDevice = DeviceScenarios.postDeviceWithNotifier400ok
+  val sendNotification = NotificationScenarios.sendNotification
+  val createUser = UserScenarios.postUser400ok
+  val deviceNameFeeder = FeederGenerator.generateEntityNameFeeder("device", numEntities).circular
+  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numEntities, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+
+  val scnToRun = scenario("Create Push Notification")
+    .feed(userFeeder)
+    .exec(createUser)
+    .pause(1000)
+    .exec(http("Check user and user devices")
+      .get("/users/${username}/devices")
+      .check(status.is(200))
+    )
+    .feed(deviceNameFeeder)
+    .exec(createDevice)
+    .pause(1000)
+    .exec(http("Check device connections")
+      .get("/devices/${entityName}/users")
+      .check(status.is(200))
+    )
+    .exec(http("Connect user with device")
+      .post("/users/${username}/devices/${entityName}")
+      .check(status.is(200))
+    )
+    .exec(http("Send Notification to All Devices")
+      .post("/users/${username}/notifications")
+      .body(StringBody("{\"payloads\":{\"" + notifier + "\":\"testmessage\"}}"))
+      .check(status.is(200))
+    )
+
+
+  setUp(scnToRun.inject(constantUsersPerSec(numUsers) during (duration)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
+
+}