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/11/08 03:19:41 UTC

[2/2] incubator-usergrid git commit: Updated the create simulation

Updated the create 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/4fd87dec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4fd87dec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4fd87dec

Branch: refs/heads/toddtest
Commit: 4fd87decc8713749f91873715b0fa59e86195d56
Parents: 89c6857
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Nov 7 19:19:34 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Nov 7 19:19:34 2014 -0700

----------------------------------------------------------------------
 .../scenarios/NotificationScenarios.scala       | 25 ++++----
 .../simulations/UserCreateGetSimulation.scala   | 60 ++++++++++++++++++++
 2 files changed, 73 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4fd87dec/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 0e4ad9d..9be7a4e 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
@@ -80,22 +80,23 @@ object NotificationScenarios {
      */
 
     //not sure we want to do this, but the feeder runs out otherwise. It doe
+    .exec(TokenScenarios.getManagementToken)
     .feed(userFeeder)
     //create the user
     .exec(UserScenarios.postUser)
-    .exec(TokenScenarios.getUserToken)
+//    .exec(TokenScenarios.getUserToken)
     .exec( UserScenarios.getUserByUsername)
-    .repeat(2){
-    feed(FeederGenerator.generateEntityNameFeeder("device", Settings.numDevices))
-      .exec( DeviceScenarios.postDeviceWithNotifier)
-      .exec(ConnectionScenarios.postUserToDeviceConnection)
-  }
-    .exec(session => {
-    // print the Session for debugging, don't do that on real Simulations
-    println(session)
-    session
-  })
-    exec( sendNotificationToUser)
+//    .repeat(2){
+//    feed(FeederGenerator.generateEntityNameFeeder("device", Settings.numDevices))
+//      .exec( DeviceScenarios.postDeviceWithNotifier)
+//      .exec(ConnectionScenarios.postUserToDeviceConnection)
+//  }
+//    .exec(session => {
+//    // print the Session for debugging, don't do that on real Simulations
+//    println(session)
+//    session
+//  })
+//    exec( 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/4fd87dec/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/UserCreateGetSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/UserCreateGetSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/UserCreateGetSimulation.scala
new file mode 100644
index 0000000..feea6ec
--- /dev/null
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/UserCreateGetSimulation.scala
@@ -0,0 +1,60 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.simulations
+
+import io.gatling.core.Predef._
+import io.gatling.core.scenario.Simulation
+import org.apache.usergrid.helpers.Setup
+import org.apache.usergrid.scenarios.{UserScenarios, TokenScenarios, NotificationScenarios}
+import org.apache.usergrid.settings.Settings
+
+import scala.concurrent.duration._
+
+/**
+ * Classy class class.
+ */
+class UserCreateGetSimulation extends Simulation {
+  println("Begin setup")
+  Setup.setupOrg()
+  Setup.setupApplication()
+  println("End Setup")
+
+  val userFeeder = Settings.getUserFeeder
+  val createScenario = scenario("Create and Get users")
+
+    //get our management token, then feed forever
+      .exec(TokenScenarios.getManagementToken)
+      .feed(userFeeder)
+      //create the user
+      .exec(UserScenarios.postUser)
+      .exec( UserScenarios.getUserByUsername)
+
+  setUp(
+    createScenario
+      //inject all our users over the ramp time
+//      .inject(constantUsersPerSec(Settings.maxPossibleUsers) during (Settings.rampTime))
+      //ramp up to our max possible users over the ramp time.  We may not get there if we hit our max tps first
+      .inject(rampUsers(Settings.maxPossibleUsers) over  (Settings.rampTime))
+      //during the ramp time, try to hit our max TPS.  Then hold it for the duration of the test
+      .throttle(reachRps(Settings.throttle) in (Settings.rampTime.seconds), holdFor(Settings.duration))
+      .protocols(Settings.httpConf.acceptHeader("application/json"))
+  )
+}