You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/10/28 18:56:58 UTC

[05/12] git commit: changed push load test to use user uuid instead of username; improved error handling for when user already exists; updated loadtest pom to call pushNotificationTargetUserSimulation instead of PushNotificationTargetDeviceSimulation

changed push load test to use user uuid instead of username; improved error handling for when user already exists; updated loadtest pom to call pushNotificationTargetUserSimulation instead of PushNotificationTargetDeviceSimulation


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

Branch: refs/heads/two-dot-o-events
Commit: 0eda724ffd61c511f7de72317baaa1ad6911ca14
Parents: 6149bf1
Author: amuramoto <am...@apigee.com>
Authored: Mon Oct 27 15:49:31 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Mon Oct 27 15:49:31 2014 -0700

----------------------------------------------------------------------
 stack/loadtests/pom.xml                         |  2 +-
 .../scenarios/NotificationScenarios.scala       |  2 +-
 .../usergrid/scenarios/UserScenarios.scala      | 23 +++++++++-----------
 .../PushNotificationTargetUserSimulation.scala  |  2 +-
 4 files changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0eda724f/stack/loadtests/pom.xml
----------------------------------------------------------------------
diff --git a/stack/loadtests/pom.xml b/stack/loadtests/pom.xml
index 0fa6272..0a2f4de 100644
--- a/stack/loadtests/pom.xml
+++ b/stack/loadtests/pom.xml
@@ -131,7 +131,7 @@
 				<artifactId>gatling-maven-plugin</artifactId>
         <configuration>
           <simulationsFolder>src/main/scala</simulationsFolder>
-          <simulationClass>org.apache.usergrid.simulations.PushNotificationTargetDeviceSimulation</simulationClass>
+          <simulationClass>org.apache.usergrid.simulations.PushNotificationTargetUserSimulation</simulationClass>
         </configuration>
 
 			</plugin>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0eda724f/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 dad4cae..ab4d813 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
@@ -59,7 +59,7 @@ object NotificationScenarios {
     )
 
   val sendNotificationToUser= exec(http("Send Notification to All Devices")
-    .post("/users/${username}/notifications")
+    .post("/users/${userId}/notifications")
     .body(StringBody("{\"debug\":\"true\",\"payloads\":{\"" + notifier + "\":\"testmessage\"}}"))
     .check(status.is(200))
   )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0eda724f/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
index ff96714..a2fa227 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
@@ -30,24 +30,21 @@ import io.gatling.core.Predef._
       .check(status.is(200))
   )
 
-  val postUser = exec(
-    http("POST geolocated Users")
-      .post("/users")
-      .body(new StringBody("""{"location":{"latitude":"${latitude}","longitude":"${longitude}"},"username":"${username}",
-      "displayName":"${displayName}","age":"${age}","seen":"${seen}","weight":"${weight}",
-      "height":"${height}","aboutMe":"${aboutMe}","profileId":"${profileId}","headline":"${headline}","
-      "showAge":"${showAge}","relationshipStatus":"${relationshipStatus}","ethnicity":"${ethnicity}","password":"password"}"""))
-      .check(status.is(200))
-  )
+   val getUserByUsername = exec(
+     http("GET user")
+       .get("/users/${username}")
+       .check(status.is(200), jsonPath("$..entities[0].uuid").saveAs("userId"))
+   )
 
-  val postUser400ok = exec(
+  val postUser = exec(
     http("POST geolocated Users")
       .post("/users")
       .body(new StringBody("""{"location":{"latitude":"${latitude}","longitude":"${longitude}"},"username":"${username}",
       "displayName":"${displayName}","age":"${age}","seen":"${seen}","weight":"${weight}",
       "height":"${height}","aboutMe":"${aboutMe}","profileId":"${profileId}","headline":"${headline}",
       "showAge":"${showAge}","relationshipStatus":"${relationshipStatus}","ethnicity":"${ethnicity}","password":"password"}"""))
-      .check(status.in(200 to 400))
-  )
-
+      .check(status.is(200), status.saveAs("userStatus"), jsonPath("$..entities[0].uuid").saveAs("userId")))
+    .doIf ("${userStatus}", "400") {
+      exec(getUserByUsername)
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0eda724f/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 9391160..af95f8b 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
@@ -38,7 +38,7 @@ class PushNotificationTargetUserSimulation extends Simulation {
   val createNotifier = NotifierScenarios.createNotifier
   val createDevice = DeviceScenarios.postDeviceWithNotifier
   val sendNotification = NotificationScenarios.sendNotificationToUser
-  val createUser = UserScenarios.postUser400ok
+  val createUser = UserScenarios.postUser
   val createOrg = OrganizationScenarios.createOrgAndAdmin
   val connectUserToDevice = ConnectionScenarios.postUserToDeviceConnection