usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject git commit: simplify simulation
Date Mon, 03 Nov 2014 18:48:56 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/key-row-sharding 45416984b -> 24ac268d7


simplify simulation


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

Branch: refs/heads/key-row-sharding
Commit: 24ac268d750f97ad39601bb756fb66617c018af6
Parents: 4541698
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Mon Nov 3 11:48:42 2014 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Mon Nov 3 11:48:42 2014 -0700

----------------------------------------------------------------------
 .../scenarios/NotificationScenarios.scala       | 23 ++++++++++++-
 .../scenarios/OrganizationScenarios.scala       |  3 +-
 .../PushNotificationTargetUserSimulation.scala  | 35 +++++---------------
 3 files changed, 32 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24ac268d/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
index f17e6d0..8bd1ad7 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
@@ -21,7 +21,8 @@ import java.nio.file.{Paths, Files}
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
-import scala.concurrent.duration._
+ import org.apache.usergrid.datagenerators.FeederGenerator
+ import scala.concurrent.duration._
 
 import scala.io.Source
 
@@ -66,6 +67,26 @@ object NotificationScenarios {
     .check(status.is(200))
   )
 
+  val numEntities:Int = Settings.numUsers * 3 * Settings.duration
+
+  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *
 Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+
+  val createScenario = scenario("Create Push Notification")
+    .feed(userFeeder)
+    .exec( UserScenarios.postUser)
+    .exec(TokenScenarios.getUserToken)
+    .repeat(2){
+    feed(FeederGenerator.generateEntityNameFeeder("device", numEntities))
+      .exec( DeviceScenarios.postDeviceWithNotifier)
+      .exec(ConnectionScenarios.postUserToDeviceConnection)
+  }
+    .exec(session => {
+    // print the Session for debugging, don't do that on real Simulations
+    println(session)
+    session
+  })
+    .exec( NotificationScenarios.sendNotificationToUser)
+
   /**
    * TODO: Add posting to users, which would expect a user in the session
    */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24ac268d/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/OrganizationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/OrganizationScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/OrganizationScenarios.scala
index 27d23c7..534ccbb 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/OrganizationScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/OrganizationScenarios.scala
@@ -56,7 +56,6 @@ object OrganizationScenarios {
 
   val createOrgScenario = scenario("Create org")
     .exec(OrganizationScenarios.createOrgBatch)
-    .inject(atOnceUsers(1))
-    .protocols(http.baseURL(Settings.baseUrl))
+
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24ac268d/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
index c1143b7..b8d57d1 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
@@ -17,38 +17,21 @@
 package org.apache.usergrid.simulations
 
 import io.gatling.core.Predef._
-import org.apache.usergrid.datagenerators.FeederGenerator
+import io.gatling.http.Predef._
 import org.apache.usergrid.scenarios._
 import org.apache.usergrid.settings.Settings
 import scala.concurrent.duration._
 
 class PushNotificationTargetUserSimulation extends Simulation {
-
-  val duration:Int = Settings.duration
-  val numUsersPerSecond:Int = Settings.numUsers
-  val numEntities:Int = numUsersPerSecond * 3 * duration
-  val httpConf = Settings.httpConf.acceptHeader("application/json")
-  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numUsersPerSecond *
duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
-
-  val scnToRun = scenario("Create Push Notification")
-    .feed(userFeeder)
-    .exec( UserScenarios.postUser)
-    .exec(TokenScenarios.getUserToken)
-    .repeat(2){
-      feed(FeederGenerator.generateEntityNameFeeder("device", numEntities))
-        .exec( DeviceScenarios.postDeviceWithNotifier)
-        .exec(ConnectionScenarios.postUserToDeviceConnection)
-      }
-    .exec(session => {
-      // print the Session for debugging, don't do that on real Simulations
-      println(session)
-      session
-    })
-    .exec( NotificationScenarios.sendNotificationToUser)
-    .inject(nothingFor(15),constantUsersPerSec(numUsersPerSecond) during (duration))
+  val scnToRun = NotificationScenarios.createScenario
+    .inject(nothingFor(15),constantUsersPerSec(Settings.numUsers) during (Settings.duration))
// wait for 15 seconds so create org can finish, need to figure out coordination
     .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
-    .protocols(httpConf)
+    .protocols( Settings.httpConf.acceptHeader("application/json"))
+
+  val createOrg = OrganizationScenarios.createOrgScenario
+    .inject(atOnceUsers(1))
+    .protocols(http.baseURL(Settings.baseUrl))
 
-  setUp(OrganizationScenarios.createOrgScenario,scnToRun)
+  setUp(createOrg,scnToRun)
 
 }


Mime
View raw message