You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/11/03 19:29:28 UTC

[1/2] git commit: spacing changes

Repository: incubator-usergrid
Updated Branches:
  refs/heads/key-row-sharding d68967c2f -> 45416984b


spacing changes


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

Branch: refs/heads/key-row-sharding
Commit: 4e107f339d9d05108cd905007f8fde94b7376f6e
Parents: d68967c
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Nov 3 10:48:30 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Nov 3 10:48:30 2014 -0700

----------------------------------------------------------------------
 .../usergrid/scenarios/ApplicationScenarios.scala    |  6 ++++++
 .../usergrid/scenarios/OrganizationScenarios.scala   | 15 +++++++--------
 .../apache/usergrid/scenarios/TokenScenarios.scala   |  1 -
 3 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e107f33/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
index d125f9d..2db49ff 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
@@ -43,4 +43,10 @@ object ApplicationScenarios {
 
     )
 
+   val checkApplication = exec(http("Create Application")
+     .get(Settings.baseUrl +  "/management/organizations/"+Settings.org+"/applications/"+Settings.app)
+     .headers(Headers.jsonAnonymous)
+     .check(status.not(400).saveAs("applicationStatus"))
+   )
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e107f33/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 c790d81..c7ba274 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
@@ -34,13 +34,12 @@ import io.gatling.http.Predef._
 object OrganizationScenarios {
 
   //register the org with the randomly generated org
-  val createOrgAndAdmin = exec(http("Create Organization")
-    .post(Settings.baseUrl+"/management/organizations")
-    .headers(Headers.jsonAnonymous)
-    .body(StringBody("{\"organization\":\"" + Settings.org + "\",\"username\":\"" + Settings.admin + "\",\"name\":\"${entityName}\",\"email\":\"${entityName}@apigee.com\",\"password\":\""+Settings.password+"\"}"))
-    .check(status.in(200 to 400))
-  )
-
-
+  val createOrgAndAdmin =
+    exec(http("Create Organization")
+      .post(Settings.baseUrl + "/management/organizations")
+      .headers(Headers.jsonAnonymous)
+      .body(StringBody("{\"organization\":\"" + Settings.org + "\",\"username\":\"" + Settings.admin + "\",\"name\":\"${entityName}\",\"email\":\"${entityName}@apigee.com\",\"password\":\"" + Settings.password + "\"}"))
+      .check(status.in(200 to 400))
+    )
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e107f33/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/TokenScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/TokenScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/TokenScenarios.scala
index 40366a5..aa30296 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/TokenScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/TokenScenarios.scala
@@ -17,7 +17,6 @@
  package org.apache.usergrid.scenarios
 
 import io.gatling.core.Predef._
- import io.gatling.http.Predef.StringBody
  import io.gatling.http.Predef._
  import io.gatling.http.request.StringBody
  import org.apache.usergrid.settings.Headers


[2/2] git commit: modularize tests

Posted by sf...@apache.org.
modularize tests


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

Branch: refs/heads/key-row-sharding
Commit: 45416984b3fa71772d754b2df20942ca7b8ec5c1
Parents: 4e107f3
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Nov 3 11:29:11 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Nov 3 11:29:11 2014 -0700

----------------------------------------------------------------------
 .../scenarios/ApplicationScenarios.scala        |  6 +--
 .../scenarios/OrganizationScenarios.scala       | 17 +++++++
 .../PushNotificationTargetUserSimulation.scala  | 52 ++++----------------
 3 files changed, 29 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/45416984/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
index 2db49ff..7d11a49 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ApplicationScenarios.scala
@@ -43,10 +43,10 @@ object ApplicationScenarios {
 
     )
 
-   val checkApplication = exec(http("Create Application")
-     .get(Settings.baseUrl +  "/management/organizations/"+Settings.org+"/applications/"+Settings.app)
+   val checkApplication = exec(http("Get Application")
+     .get(Settings.baseAppUrl)
      .headers(Headers.jsonAnonymous)
-     .check(status.not(400).saveAs("applicationStatus"))
+     .check(status.saveAs("applicationStatus"))
    )
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/45416984/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 c7ba274..27d23c7 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
@@ -18,6 +18,7 @@
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
+ import org.apache.usergrid.datagenerators.FeederGenerator
  import org.apache.usergrid.settings.{Settings, Headers}
  import scala.concurrent.duration._
 
@@ -41,5 +42,21 @@ object OrganizationScenarios {
       .body(StringBody("{\"organization\":\"" + Settings.org + "\",\"username\":\"" + Settings.admin + "\",\"name\":\"${entityName}\",\"email\":\"${entityName}@apigee.com\",\"password\":\"" + Settings.password + "\"}"))
       .check(status.in(200 to 400))
     )
+  val createOrgBatch =
+    feed(FeederGenerator.generateRandomEntityNameFeeder("org", 1))
+      .exec(OrganizationScenarios.createOrgAndAdmin)
+      .exec(TokenScenarios.getManagementToken)
+      .exec(session => {
+      // print the Session for debugging, don't do that on real Simulations
+      println(session)
+      session
+    })
+      .exec(ApplicationScenarios.createApplication)
+      .exec(NotifierScenarios.createNotifier)
+
+  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/45416984/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 31e78dc..c1143b7 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
@@ -14,11 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.simulations
+package org.apache.usergrid.simulations
 
 import io.gatling.core.Predef._
-import io.gatling.http.Predef._
-import org.apache.usergrid.settings.Utils
 import org.apache.usergrid.datagenerators.FeederGenerator
 import org.apache.usergrid.scenarios._
 import org.apache.usergrid.settings.Settings
@@ -29,60 +27,28 @@ class PushNotificationTargetUserSimulation extends Simulation {
   val duration:Int = Settings.duration
   val numUsersPerSecond:Int = Settings.numUsers
   val numEntities:Int = numUsersPerSecond * 3 * duration
-  val rampTime:Int = Settings.rampTime
-  val throttle:Int = Settings.throttle
-
   val httpConf = Settings.httpConf.acceptHeader("application/json")
-  val notifier = Settings.pushNotifier
-
-  val createNotifier = NotifierScenarios.createNotifier
-  val createDevice = DeviceScenarios.postDeviceWithNotifier
-  val sendNotification = NotificationScenarios.sendNotificationToUser
-  val createUser = UserScenarios.postUser
-  val createOrg = OrganizationScenarios.createOrgAndAdmin
-  val connectUserToDevice = ConnectionScenarios.postUserToDeviceConnection
-  val createApp = ApplicationScenarios.createApplication
-
-  val getManagementToken = TokenScenarios.getManagementToken
-
-  val getUserToken = TokenScenarios.getUserToken
-
-  val deviceNameFeeder = FeederGenerator.generateEntityNameFeeder("device", numEntities)
   val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numUsersPerSecond * duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
-  val orgFeeder = FeederGenerator.generateRandomEntityNameFeeder("org", 1)
-
-  val scnCreateOrg = scenario("Create org")
-    .feed(orgFeeder)
-    .exec(createOrg)
-    .exec(getManagementToken)
-    .exec(session => {
-      // print the Session for debugging, don't do that on real Simulations
-      println(session)
-      session
-    })
-    .exec(createApp)
-    .exec(createNotifier).inject(atOnceUsers(1))
-    .protocols(http.baseURL(Settings.baseUrl))
 
   val scnToRun = scenario("Create Push Notification")
     .feed(userFeeder)
-    .exec(createUser)
-    .exec(getUserToken)
+    .exec( UserScenarios.postUser)
+    .exec(TokenScenarios.getUserToken)
     .repeat(2){
-      feed(deviceNameFeeder)
-        .exec(createDevice)
-        .exec(connectUserToDevice)
+      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(sendNotification)
+    .exec( NotificationScenarios.sendNotificationToUser)
     .inject(nothingFor(15),constantUsersPerSec(numUsersPerSecond) during (duration))
-    .throttle(reachRps(throttle) in (rampTime.seconds))
+    .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
     .protocols(httpConf)
 
-  setUp(scnCreateOrg,scnToRun)
+  setUp(OrganizationScenarios.createOrgScenario,scnToRun)
 
 }