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

[03/15] incubator-usergrid git commit: add delete and put methods

add delete and put methods


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

Branch: refs/heads/two-dot-o
Commit: 3079231c92fc100caf5b02aa6e3e98b11b522a1f
Parents: 2372701
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Dec 3 20:54:55 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Dec 3 20:54:55 2014 -0700

----------------------------------------------------------------------
 .../usergrid/scenarios/UserScenarios.scala      | 38 ++++++++++++++------
 1 file changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3079231c/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 2bbe9a3..eeecffa 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
@@ -35,7 +35,9 @@ import io.gatling.core.Predef._
      http("GET user")
        .get("/users/${username}")
        .headers(Headers.jsonAuthorized)
-       .check(status.saveAs("userStatus"), jsonPath("$..entities[0]").exists, jsonPath("$..entities[0].uuid").exists, jsonPath("$..entities[0].uuid").saveAs("userId"))
+       .check(status.saveAs("userStatus"), jsonPath("$..entities[0]").exists,
+         jsonPath("$..entities[0].uuid").exists, jsonPath("$..entities[0].uuid").saveAs("userId"),
+         jsonPath("$..entities[0].username").exists, jsonPath("$..entities[0].uuid").saveAs("username"))
    )
 
 
@@ -66,22 +68,36 @@ import io.gatling.core.Predef._
       exec(postUser)
      }
 
-
-   val putUser =
-     exec(getUserByUsername)
-     .doIf("${userStatus}", "200") {
-       exec(
-         http("POST geolocated Users")
-           .put("/users")
-           .body(new StringBody( """{"location":{"latitude":"${latitude}","longitude":"${longitude}"},"username":"${username}",
+   val putUser = exec(
+     http("PUT geolocated Users")
+       .put("/users/${username}")
+       .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), jsonPath("$..entities[0].uuid").saveAs("userId"))
+       .check(status.is(200), jsonPath("$..entities[0].uuid").saveAs("userId"))
 
-       )
+   )
+
+   val putUserIfExists =
+     exec(getUserByUsername)
+     .doIf("${userStatus}", "200") {
+       putUser
       }
 
+   val deleteUser = exec(
+     http("PUT geolocated Users")
+       .delete("/users/${username}")
+       .check(status.is(200))
+
+   )
+
+   val deleteUserIfExists =
+     exec(getUserByUsername)
+       .doIf("${userStatus}", "200") {
+       deleteUser
+     }
+
    /**
     * Get a collection of users without a cursor.  Sets the cursor and entities array as "users"
     */