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/06 01:15:08 UTC
[22/50] git commit: removing device sim and moving token funcs
removing device sim and moving token funcs
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/ba1396cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/ba1396cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/ba1396cd
Branch: refs/heads/two-dot-o
Commit: ba1396cd91c60218594e9a90341b3c767ba1448a
Parents: a5dc3a4
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Nov 3 09:28:09 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Nov 3 09:28:09 2014 -0700
----------------------------------------------------------------------
.../scenarios/OrganizationScenarios.scala | 8 +--
.../usergrid/scenarios/TokenScenarios.scala | 18 ++++++-
.../usergrid/scenarios/UserScenarios.scala | 8 +--
...PushNotificationTargetDeviceSimulation.scala | 57 --------------------
.../PushNotificationTargetUserSimulation.scala | 4 +-
5 files changed, 21 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba1396cd/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 8761e18..c790d81 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
@@ -41,12 +41,6 @@ object OrganizationScenarios {
.check(status.in(200 to 400))
)
- val getManagementToken = exec(http("POST Org Token")
- .post(Settings.baseUrl+"/management/token")
- .headers(Headers.jsonAnonymous)
- //pass in the the username and password, store the "access_token" json response element as the var "authToken" in the session
- .body(StringBody("{\"username\":\"" + Settings.admin + "\",\"password\":\"test\",\"grant_type\":\"password\"}"))
- .check(jsonPath("$.access_token").find(0).saveAs("authToken"))
- )
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba1396cd/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 a08701b..40366a5 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,9 @@
package org.apache.usergrid.scenarios
import io.gatling.core.Predef._
-import io.gatling.http.Predef._
+ import io.gatling.http.Predef.StringBody
+ import io.gatling.http.Predef._
+ import io.gatling.http.request.StringBody
import org.apache.usergrid.settings.Headers
import org.apache.usergrid.settings.Settings
@@ -38,5 +40,19 @@ import io.gatling.http.Predef._
*/
object TokenScenarios {
+ val getManagementToken = exec(http("POST Org Token")
+ .post(Settings.baseUrl+"/management/token")
+ .headers(Headers.jsonAnonymous)
+ //pass in the the username and password, store the "access_token" json response element as the var "authToken" in the session
+ .body(StringBody("{\"username\":\"" + Settings.admin + "\",\"password\":\"test\",\"grant_type\":\"password\"}"))
+ .check(jsonPath("$.access_token").find(0).saveAs("authToken"))
+ )
+ val getUserToken =
+ exec(
+ http("POST user token")
+ .post("/token")
+ .body(StringBody("{\"grant_type\":\"password\",\"username\":\"${username}\",\"password\":\"password\"}"))
+ .check(status.is(200),jsonPath("$..access_token").exists,jsonPath("$..access_token").saveAs("authToken"))
+ )
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba1396cd/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 c46f99d..ae756dc 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
@@ -49,11 +49,5 @@ import io.gatling.core.Predef._
exec(getUserByUsername)
}
- val getUserToken =
- exec(
- http("POST user token")
- .post("/token")
- .body(StringBody("{\"grant_type\":\"password\",\"username\":\"${username}\",\"password\":\"password\"}"))
- .check(status.is(200),jsonPath("$..access_token").exists,jsonPath("$..access_token").saveAs("authToken"))
- )
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba1396cd/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetDeviceSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetDeviceSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetDeviceSimulation.scala
deleted file mode 100755
index 731423c..0000000
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetDeviceSimulation.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.
- */
- package org.apache.usergrid.simulations
-
-import io.gatling.core.Predef._
-import io.gatling.http.Predef._
- import org.apache.usergrid._
- import org.apache.usergrid.datagenerators.FeederGenerator
- import org.apache.usergrid.scenarios.{NotificationScenarios, DeviceScenarios, NotifierScenarios}
- import org.apache.usergrid.settings.Settings
- import scala.concurrent.duration._
-
-/**
- *
- * Simple test for setting up multiple orgs and creating push notifications
- *
- */
-class PushNotificationTargetDeviceSimulation extends Simulation {
-
- val numUsers:Int = Settings.numUsers
- val numEntities:Int = Settings.numEntities
- val rampTime:Int = Settings.rampTime
- val throttle:Int = Settings.throttle
- val duration:Int = Settings.duration
- val httpConf = Settings.httpConf
- .acceptHeader("application/json")
-
- val createNotifier = NotifierScenarios.createNotifier
- val createDevice = DeviceScenarios.postDeviceWithNotifier
- val sendNotification = NotificationScenarios.sendNotification
-
- val deviceNameFeeder = FeederGenerator.generateEntityNameFeeder("device", numEntities).circular
-
- val scnToRun = scenario("Create Push Notification")
- .during(duration.seconds) {
- feed(deviceNameFeeder)
- .exec(sendNotification)
- }
-
-
- setUp(scnToRun.inject(atOnceUsers(numUsers)).throttle(reachRps(throttle) in (rampTime.seconds)).protocols(httpConf))
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba1396cd/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 16c5bc3..31e78dc 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
@@ -43,9 +43,9 @@ class PushNotificationTargetUserSimulation extends Simulation {
val connectUserToDevice = ConnectionScenarios.postUserToDeviceConnection
val createApp = ApplicationScenarios.createApplication
- val getManagementToken = OrganizationScenarios.getManagementToken
+ val getManagementToken = TokenScenarios.getManagementToken
- val getUserToken = UserScenarios.getUserToken
+ val getUserToken = TokenScenarios.getUserToken
val deviceNameFeeder = FeederGenerator.generateEntityNameFeeder("device", numEntities)
val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(numUsersPerSecond * duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)