usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject git commit: adding switch for simulation selector
Date Thu, 06 Nov 2014 16:47:57 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o 66b14681e -> 1589d0417


adding switch for simulation selector


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

Branch: refs/heads/two-dot-o
Commit: 1589d0417f3c74ba0116eec29c7736857ef717d7
Parents: 66b1468
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Nov 6 09:47:42 2014 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Nov 6 09:47:42 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/settings/Settings.scala |  2 +
 .../usergrid/simulations/AppSimulation.scala    | 41 +++++++++++++-------
 2 files changed, 29 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1589d041/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
index 03a4200..3a0d23d 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
@@ -64,4 +64,6 @@ object Settings {
   val constantUsers:Int = Settings.numUsers/Settings.duration
   println(s"Will inject $constantUsers users per sec")
 
+  var simulation:String =  if(System.getProperty("simulation") != null) System.getProperty("simulation")
else "all"
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1589d041/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
index aa246a4..9805eea 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
@@ -25,26 +25,39 @@ import io.gatling.core.scenario.Simulation
 import org.apache.usergrid.helpers.Setup
 import org.apache.usergrid.scenarios.NotificationScenarios
 import org.apache.usergrid.settings.Settings
+import scala.annotation.switch
 import scala.concurrent.duration._
 
 /**
  * Classy class class.
  */
 class AppSimulation extends Simulation{
-  before{
-    println("Begin setup")
-    Setup.setupOrg()
-    Setup.setupApplication()
-    Setup.setupNotifier()
-    Setup.setupUsers()
-    println("End Setup")
-  }
-  setUp(
-    NotificationScenarios.createScenario
-      .inject(constantUsersPerSec(Settings.constantUsers) 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( Settings.httpConf.acceptHeader("application/json"))
-  )
 
+  val simulation = Settings.simulation
+  println(s"Running simulation $simulation")
+
+  println("Begin setup")
+  Setup.setupOrg()
+  Setup.setupApplication()
+  Setup.setupNotifier()
+  Setup.setupUsers()
+  println("End Setup")
 
+  def sim(choice:String) = (choice: @switch) match {
+    case "connections" =>
+      setUp(
+        NotificationScenarios.createScenario
+          .inject(constantUsersPerSec(Settings.constantUsers) 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( Settings.httpConf.acceptHeader("application/json"))
+      )
+    case "all" =>
+      setUp(
+        NotificationScenarios.createScenario
+          .inject(constantUsersPerSec(Settings.constantUsers) 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(Settings.httpConf.acceptHeader("application/json"))
+      )
+  }
+  sim(simulation)
 }


Mime
View raw message