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 2015/08/03 22:30:53 UTC
[09/21] incubator-usergrid git commit: USERGRID-871: added load and
delete tests, fixes to feeders
USERGRID-871: added load and delete tests, fixes to feeders
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b3f72da9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b3f72da9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b3f72da9
Branch: refs/heads/two-dot-o-dev
Commit: b3f72da92661930d1996aca3b19412bfd72414b3
Parents: f1326fd
Author: Mike Dunker <md...@apigee.com>
Authored: Wed Jul 22 11:44:57 2015 -0700
Committer: Mike Dunker <md...@apigee.com>
Committed: Wed Jul 22 11:44:57 2015 -0700
----------------------------------------------------------------------
stack/loadtests/runCollectionQueryTest.sh | 6 +-
stack/loadtests/runDeleteEntities.sh | 99 ++++++++++++++++++++
stack/loadtests/runLoadEntities.sh | 99 ++++++++++++++++++++
stack/loadtests/runRandomEntityByNameTest.sh | 8 +-
.../datagenerators/FeederGenerator.scala | 33 ++++++-
.../usergrid/enums/ConfigProperties.scala | 7 +-
.../apache/usergrid/enums/ScenarioType.scala | 2 +
.../org/apache/usergrid/helpers/Setup.scala | 10 +-
.../scenarios/EntityCollectionScenarios.scala | 69 ++++++++++++++
.../org/apache/usergrid/settings/Settings.scala | 11 ++-
.../simulations/ConfigurableSimulation.scala | 30 ++++--
11 files changed, 353 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/runCollectionQueryTest.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runCollectionQueryTest.sh b/stack/loadtests/runCollectionQueryTest.sh
index 8137d2e..7d1779c 100755
--- a/stack/loadtests/runCollectionQueryTest.sh
+++ b/stack/loadtests/runCollectionQueryTest.sh
@@ -34,6 +34,8 @@ shift 6
mvn compile
#Set the app id to be a date epoch for uniqueness
+ADMIN_USER=superuser
+ADMIN_PASSWORD=test
CREATE_ORG=false
ORG=gatling
CREATE_APP=false
@@ -63,8 +65,8 @@ mvn gatling:execute -Dorg=usergrid \
-DcreateApp=${CREATE_APP} \
-Dapp=${APP} \
-Dbaseurl=${URL} \
--DadminUser=usergrid \
--DadminPassword=test \
+-DadminUser=${ADMIN_USER} \
+-DadminPassword=${ADMIN_PASSWORD} \
-DloadEntities=${LOAD_ENTITIES} \
-DnumEntities=${NUM_ENTITIES} \
-DentityType=${ENTITY_TYPE} \
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/runDeleteEntities.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runDeleteEntities.sh b/stack/loadtests/runDeleteEntities.sh
new file mode 100755
index 0000000..1ca557e
--- /dev/null
+++ b/stack/loadtests/runDeleteEntities.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# Licensed 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.
+#
+
+die() { echo "$@" 1>&2 ; exit 1; }
+
+####
+#This is a script to simplify running gatling tests. It will default several parameters, invoke the maven plugins
+#Then aggregate the results
+####
+[ "$#" -ge 6 ] || die "At least 6 arguments required, $# provided. Example is $0 URL RAMP_USERS RAMP_TIME(seconds) CONSTANT_USERS_PER_SEC, CONSTANT_USERS_DURATION(seconds) NUM_ENTITIES"
+
+URL="$1"
+RAMP_USERS="$2"
+RAMP_TIME="$3"
+CONSTANT_USERS_PER_SEC="$4"
+CONSTANT_USERS_DURATION="$5"
+NUM_ENTITIES="$6"
+
+shift 6
+
+#Compile everything
+mvn compile
+
+#Set the app id to be a date epoch for uniqueness
+#APP=$(date +%s)
+ADMIN_USER=superuser
+ADMIN_PASSWORD=test
+CREATE_ORG=false
+ORG=gatling
+CREATE_APP=false
+APP=millionentities
+COLLECTION_TYPE=trivialentities
+SCENARIO_TYPE=deleteEntities
+# don't load entities as part of setup
+LOAD_ENTITIES=false
+
+SKIP_SETUP=TRUE
+#SEARCH_QUERY=order%20by%20specials%20desc
+#SEARCH_LIMIT=1000
+ENTITY_TYPE=trivial
+ENTITY_PREFIX=trivial
+ENTITY_SEED=1
+AUTH_TYPE=token
+TOKEN_TYPE=management
+END_CONDITION_TYPE=minutesElapsed
+#END_CONDITION_TYPE=requestCount
+END_MINUTES=2
+END_REQUEST_COUNT=100
+
+#Execute the test
+mvn gatling:execute \
+-DskipSetup=${SKIP_SETUP} \
+-DcreateOrg=${CREATE_ORG} \
+-Dorg=${ORG} \
+-DcreateApp=${CREATE_APP} \
+-Dapp=${APP} \
+-Dbaseurl=${URL} \
+-DadminUser=${ADMIN_USER} \
+-DadminPassword=${ADMIN_PASSWORD} \
+-DloadEntities=${LOAD_ENTITIES} \
+-DnumEntities=${NUM_ENTITIES} \
+-DentityType=${ENTITY_TYPE} \
+-DentityPrefix=${ENTITY_PREFIX} \
+-DentitySeed=${ENTITY_SEED} \
+-DrampUsers=${RAMP_USERS} \
+-DrampTime=${RAMP_TIME} \
+-DconstantUsersPerSec=${CONSTANT_USERS_PER_SEC} \
+-DconstantUsersDuration=${CONSTANT_USERS_DURATION} \
+-DcollectionType=${COLLECTION_TYPE} \
+-DscenarioType=${SCENARIO_TYPE} \
+-DauthType=${AUTH_TYPE} \
+-DtokenType=${TOKEN_TYPE} \
+-DendConditionType=${END_CONDITION_TYPE} \
+-DendMinutes=${END_MINUTES} \
+-DendRequestCount=${END_REQUEST_COUNT} \
+-Dgatling.simulationClass=org.apache.usergrid.simulations.ConfigurableSimulation
+
+
+
+#Now move all the reports
+#AGGREGATE_DIR="target/aggregate-$(date +%s)"
+
+#mkdir -p ${AGGREGATE_DIR}
+
+#copy to the format of target/aggregate(date)/(simnulationame)-simulation.log
+#find target -name "simulation.log" -exec cp {} ${AGGREGATE_DIR}/$(basename $(dirname {} ))-simulation.log \;
+
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/runLoadEntities.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runLoadEntities.sh b/stack/loadtests/runLoadEntities.sh
new file mode 100755
index 0000000..bee8d1a
--- /dev/null
+++ b/stack/loadtests/runLoadEntities.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# Licensed 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.
+#
+
+die() { echo "$@" 1>&2 ; exit 1; }
+
+####
+#This is a script to simplify running gatling tests. It will default several parameters, invoke the maven plugins
+#Then aggregate the results
+####
+[ "$#" -ge 6 ] || die "At least 6 arguments required, $# provided. Example is $0 URL RAMP_USERS RAMP_TIME(seconds) CONSTANT_USERS_PER_SEC, CONSTANT_USERS_DURATION(seconds) NUM_ENTITIES"
+
+URL="$1"
+RAMP_USERS="$2"
+RAMP_TIME="$3"
+CONSTANT_USERS_PER_SEC="$4"
+CONSTANT_USERS_DURATION="$5"
+NUM_ENTITIES="$6"
+
+shift 6
+
+#Compile everything
+mvn compile
+
+#Set the app id to be a date epoch for uniqueness
+#APP=$(date +%s)
+ADMIN_USER=superuser
+ADMIN_PASSWORD=test
+CREATE_ORG=false
+ORG=gatling
+CREATE_APP=false
+APP=millionentities
+COLLECTION_TYPE=trivialentities
+SCENARIO_TYPE=loadEntities
+# don't load entities as part of setup
+LOAD_ENTITIES=false
+
+SKIP_SETUP=FALSE
+#SEARCH_QUERY=order%20by%20specials%20desc
+#SEARCH_LIMIT=1000
+ENTITY_TYPE=trivial
+ENTITY_PREFIX=trivial
+ENTITY_SEED=1
+AUTH_TYPE=token
+TOKEN_TYPE=management
+END_CONDITION_TYPE=minutesElapsed
+#END_CONDITION_TYPE=requestCount
+END_MINUTES=2
+END_REQUEST_COUNT=100
+
+#Execute the test
+mvn gatling:execute \
+-DskipSetup=${SKIP_SETUP} \
+-DcreateOrg=${CREATE_ORG} \
+-Dorg=${ORG} \
+-DcreateApp=${CREATE_APP} \
+-Dapp=${APP} \
+-Dbaseurl=${URL} \
+-DadminUser=${ADMIN_USER} \
+-DadminPassword=${ADMIN_PASSWORD} \
+-DloadEntities=${LOAD_ENTITIES} \
+-DnumEntities=${NUM_ENTITIES} \
+-DentityType=${ENTITY_TYPE} \
+-DentityPrefix=${ENTITY_PREFIX} \
+-DentitySeed=${ENTITY_SEED} \
+-DrampUsers=${RAMP_USERS} \
+-DrampTime=${RAMP_TIME} \
+-DconstantUsersPerSec=${CONSTANT_USERS_PER_SEC} \
+-DconstantUsersDuration=${CONSTANT_USERS_DURATION} \
+-DcollectionType=${COLLECTION_TYPE} \
+-DscenarioType=${SCENARIO_TYPE} \
+-DauthType=${AUTH_TYPE} \
+-DtokenType=${TOKEN_TYPE} \
+-DendConditionType=${END_CONDITION_TYPE} \
+-DendMinutes=${END_MINUTES} \
+-DendRequestCount=${END_REQUEST_COUNT} \
+-Dgatling.simulationClass=org.apache.usergrid.simulations.ConfigurableSimulation
+
+
+
+#Now move all the reports
+#AGGREGATE_DIR="target/aggregate-$(date +%s)"
+
+#mkdir -p ${AGGREGATE_DIR}
+
+#copy to the format of target/aggregate(date)/(simnulationame)-simulation.log
+#find target -name "simulation.log" -exec cp {} ${AGGREGATE_DIR}/$(basename $(dirname {} ))-simulation.log \;
+
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/runRandomEntityByNameTest.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runRandomEntityByNameTest.sh b/stack/loadtests/runRandomEntityByNameTest.sh
index 474acfe..dd98aa6 100755
--- a/stack/loadtests/runRandomEntityByNameTest.sh
+++ b/stack/loadtests/runRandomEntityByNameTest.sh
@@ -34,6 +34,8 @@ mvn compile
#Set the app id to be a date epoch for uniqueness
#APP=$(date +%s)
+ADMIN_USER=superuser
+ADMIN_PASSWORD=test
CREATE_ORG=false
ORG=gatling
CREATE_APP=false
@@ -56,15 +58,15 @@ END_MINUTES=2
END_REQUEST_COUNT=100
#Execute the test
-mvn gatling:execute -Dorg=usergrid \
+mvn gatling:execute \
-DskipSetup=${SKIP_SETUP} \
-DcreateOrg=${CREATE_ORG} \
-Dorg=${ORG} \
-DcreateApp=${CREATE_APP} \
-Dapp=${APP} \
-Dbaseurl=${URL} \
--DadminUser=usergrid \
--DadminPassword=test \
+-DadminUser=${ADMIN_USER} \
+-DadminPassword=${ADMIN_PASSWORD} \
-DloadEntities=${LOAD_ENTITIES} \
-DnumEntities=${NUM_ENTITIES} \
-DentityType=${ENTITY_TYPE} \
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala
index 63091a7..92444b2 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala
@@ -195,7 +195,7 @@
* @param prefix Prefix for entities
* @return
*/
- def generateCustomEntityFeeder(numEntities: Int, entityType: String, prefix: String, seed: Int = 1): Array[String] = {
+ def generateCustomEntityArray(numEntities: Int, entityType: String, prefix: String, seed: Int = 1): Array[String] = {
//val entityFeeder = Iterator.from(1).take(numEntities).map(i=>Map("entity" -> EntityDataGenerator.generateNamedCustomEntityJSONString(prefix.concat(i.toString()))))
var entityArray: ArrayBuffer[String] = new ArrayBuffer[String]
for (i <- seed to numEntities+seed-1) {
@@ -206,6 +206,37 @@
entityArray.toArray
}
+ def generateCustomEntityFeeder(numEntities: Int, entityType: String, prefix: String, seed: Int = 1): Array[Map[String, Any]] = {
+ var entityMapArray: ArrayBuffer[Map[String, Any]] = new ArrayBuffer[Map[String, Any]]
+
+ for (i <- seed to numEntities+seed-1) {
+ val entityName = prefix.concat(i.toString)
+ val entity = EntityDataGenerator.generateEntity(entityType, entityName)
+ val entityUrl = Settings.baseCollectionUrl + "/" + entityName
+ entityMapArray += Map("entityName" -> entityName, "entity" -> entity, "entityUrl" -> entityUrl)
+ }
+
+ entityMapArray.toArray
+ }
+
+ def generateCustomEntityFeeder2 (numEntities: Int, entityType: String, prefix: String, seed: Int = 1): Feeder[String] =
+ new Feeder[String] {
+ var counter = new AtomicInteger(seed)
+
+ // runs forever -- users detect when data is done using validEntity field
+ override def hasNext: Boolean = true
+
+ override def next(): Map[String, String] = {
+ val i = counter.getAndIncrement()
+ val entityName = prefix.concat(i.toString)
+ val entity = EntityDataGenerator.generateEntity(entityType, entityName)
+ val entityUrl = Settings.baseCollectionUrl + "/" + entityName
+ val validEntity = if (i >= seed + numEntities) "no" else "yes"
+
+ Map("entityName" -> entityName, "entity" -> entity, "entityUrl" -> entityUrl, "validEntity" -> validEntity)
+ }
+ }
+
def generateCustomEntityInfiniteFeeder(seed: Int = Settings.entitySeed, entityType: String = Settings.entityType, prefix: String = Settings.entityPrefix): Iterator[String] = {
Iterator.from(seed).map(i=>EntityDataGenerator.generateEntity(entityType, prefix.concat(i.toString)))
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala
index 9a4989a..56350ee 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala
@@ -40,8 +40,13 @@ object ConfigProperties {
val EndConditionType = "endConditionType"
val EndMinutes = "endMinutes"
val EndRequestCount = "endRequestCount"
+ val OrgCreationUsername = "orgCreationUsername"
+ val OrgCreationName = "orgCreationName"
+ val OrgCreationEmail = "orgCreationEmail"
+ val OrgCreationPassword = "orgCreationPassword"
val Values = Seq(Org,App,AdminUser,AdminPassword,BaseUrl,AuthType,TokenType,SkipSetup,CreateOrg,CreateApp,LoadEntities,
ScenarioType,RampUsers,ConstantUsersPerSec,ConstantUsersDuration,UserSeed,AppUser,AppUserPassword,NumEntities,
NumDevices,CollectionType,RampTime,Throttle,RpsTarget,RpsRampTime,HoldDuration,PushNotifier,EntityPrefix,EntityType,
- EntitySeed,SearchLimit,SearchQuery,EndConditionType,EndMinutes,EndRequestCount)
+ EntitySeed,SearchLimit,SearchQuery,EndConditionType,EndMinutes,EndRequestCount,OrgCreationUsername,OrgCreationName,
+ OrgCreationEmail,OrgCreationPassword)
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ScenarioType.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ScenarioType.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ScenarioType.scala
index 52fcbc5..e21a1ee 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ScenarioType.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ScenarioType.scala
@@ -6,4 +6,6 @@ package org.apache.usergrid.enums
object ScenarioType {
val GetAllByCursor = "getAllByCursor"
val NameRandomInfinite = "nameRandomInfinite"
+ val LoadEntities = "loadEntities"
+ val DeleteEntities = "deleteEntities"
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
index 776e0b9..af3aabb 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
@@ -83,10 +83,10 @@ object Setup {
.setHeader("Content-Type", "application/json; charset=UTF-8")
.setBody(Utils.toJSONStr(Map(
"organization" -> Settings.org,
- "username" -> Settings.adminUser,
- "name" -> Settings.adminUser,
- "email" -> (Settings.adminUser + "@apigee.com"),
- "password" -> Settings.adminPassword
+ "username" -> Settings.orgCreationUsername,
+ "name" -> Settings.orgCreationName,
+ "email" -> Settings.orgCreationEmail,
+ "password" -> Settings.orgCreationPassword
)))
.build()
@@ -192,7 +192,7 @@ object Setup {
}
def setupEntitiesCollection(numEntities: Int, entityType: String, prefix: String, seed: Int = 1) = {
- val entitiesFeeder = FeederGenerator.generateCustomEntityFeeder(numEntities, entityType, prefix, seed)
+ val entitiesFeeder = FeederGenerator.generateCustomEntityArray(numEntities, entityType, prefix, seed)
val purgeUsers = Integer.getInteger("purgeUsers", 100)
val list: ArrayBuffer[ListenableFuture[Response]] = new ArrayBuffer[ListenableFuture[Response]]
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala
index 844eb82..a6d6e0d 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala
@@ -18,6 +18,7 @@ package org.apache.usergrid.scenarios
import io.gatling.core.Predef._
import io.gatling.http.Predef._
+import org.apache.usergrid.datagenerators.FeederGenerator
import org.apache.usergrid.enums.{EndConditionType, AuthType}
import org.apache.usergrid.helpers.Extractors._
import org.apache.usergrid.helpers.Utils
@@ -53,6 +54,9 @@ object EntityCollectionScenarios {
Utils.randomEntityNameUrl(prefix, numEntities, seed, Settings.baseCollectionUrl)
}
+ /*
+ * Loop through entities using cursor
+ */
val getEntitiesWithoutCursor = exec(
http("GET entities")
.get(entityGetUrl(false))
@@ -87,6 +91,9 @@ object EntityCollectionScenarios {
}
//.exec(sessionFunction => { sessionFunction })
+ /*
+ * Get random entities
+ */
val getRandomEntityAnonymous = exec(
http("GET entity by name (anonymous)")
.get(_ => randomEntityNameUrl())
@@ -123,6 +130,68 @@ object EntityCollectionScenarios {
}
/*
+ * Create entities
+ */
+ val loadEntity = exec(
+ doIf("${validEntity}", "yes") {
+ exec(http("POST load entity")
+ .post(Settings.baseCollectionUrl)
+ .headers(Headers.authToken)
+ .body(StringBody("""${entity}"""))
+ .check(status.in(Seq(200,400))))
+ }
+ )
+
+ val loadEntities = scenario("Load entities")
+ .exec(injectTokenIntoSession())
+ .exec(injectAuthType())
+ .asLongAs(session => session("validEntity").asOption[String].map(validEntity => validEntity != "no").getOrElse[Boolean](true)) {
+ feed(FeederGenerator.generateCustomEntityFeeder2(Settings.numEntities, Settings.entityType, Settings.entityPrefix, Settings.entitySeed))
+ .doIf(session => session("validEntity").as[String] == "yes") {
+ exec(loadEntity)
+ }
+ }
+ //.rendezVous(Settings.totalUsers)
+
+ /*
+ val loadEntity = exec(
+ http("POST load entity")
+ .post(Settings.baseCollectionUrl)
+ .headers(Headers.authToken)
+ .body(StringBody("""${entity}"""))
+ .check(status.in(Seq(200,400)))
+ )
+
+ val loadEntities = scenario("Load entities")
+ .exec(injectTokenIntoSession())
+ .exec(injectAuthType())
+ .forever(
+ feed(FeederGenerator.generateCustomEntityFeeder(Settings.numEntities, Settings.entityType, Settings.entityPrefix, Settings.entitySeed))
+ .exec(loadEntity)
+ )
+ */
+
+
+ /*
+ * Delete entities
+ */
+ val deleteEntity = exec(
+ http("DELETE entity")
+ .delete("""${entityUrl}""")
+ .headers(Headers.authToken)
+ .check(status.in(Seq(200,404)))
+ )
+
+ val deleteEntities = scenario("Delete entities")
+ .exec(injectTokenIntoSession())
+ .exec(injectAuthType())
+ .asLongAs(session => session("validEntity").asOption[String].map(validEntity => validEntity != "no").getOrElse[Boolean](true)) {
+ feed(FeederGenerator.generateCustomEntityFeeder2(Settings.numEntities, Settings.entityType, Settings.entityPrefix, Settings.entitySeed))
+ .doIf(session => session("validEntity").as[String] == "yes") {
+ exec(deleteEntity)
+ }
+ }
+ /*
val createEntityBatchScenario = scenario("Create custom entities")
.exec(injectStaticTokenToSession())
.feed(FeederGenerator.generateCustomEntityCreateFeeder(Settings.entityPrefix, Settings.numEntities))
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
index 72b591f..3992c68 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala
@@ -17,7 +17,7 @@
package org.apache.usergrid.settings
import java.nio.charset.StandardCharsets
-//import java.util.Base64
+import java.util.Base64
import io.gatling.core.Predef._
@@ -52,8 +52,7 @@ object Settings {
val userSeed:Int = Integer.getInteger(ConfigProperties.UserSeed,1).toInt
val appUser = System.getProperty(ConfigProperties.AppUser)
val appUserPassword = System.getProperty(ConfigProperties.AppUserPassword)
- //val appUserBase64 = Base64.getEncoder.encodeToString((appUser + ":" + appUserPassword).getBytes(StandardCharsets.UTF_8))
- val appUserBase64 = "BROKEN FOR NOW"
+ val appUserBase64 = Base64.getEncoder.encodeToString((appUser + ":" + appUserPassword).getBytes(StandardCharsets.UTF_8))
val numEntities:Int = Integer.getInteger(ConfigProperties.NumEntities, 5000).toInt
val numDevices:Int = Integer.getInteger(ConfigProperties.NumDevices, 4000).toInt
@@ -87,6 +86,12 @@ object Settings {
val endMinutes = Integer.getInteger(ConfigProperties.EndMinutes, 10).toInt
val endRequestCount = Integer.getInteger(ConfigProperties.EndRequestCount, 10).toInt
+ // Org creation fields
+ val orgCreationUsername = System.getProperty(ConfigProperties.OrgCreationUsername, org.concat("_admin"))
+ val orgCreationEmail = System.getProperty(ConfigProperties.OrgCreationEmail, orgCreationUsername.concat("@usergrid.com"))
+ val orgCreationName = System.getProperty(ConfigProperties.OrgCreationName, orgCreationUsername)
+ val orgCreationPassword = System.getProperty(ConfigProperties.OrgCreationPassword, "test")
+
def getUserFeeder():Array[Map[String, String]]= {
FeederGenerator.generateUserWithGeolocationFeeder(totalUsers, userLocationRadius, centerLatitude, centerLongitude)
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b3f72da9/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala
index 7a55577..4b0f96a 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala
@@ -47,14 +47,32 @@ class ConfigurableSimulation extends Simulation {
Settings.setTestStartTime()
- if (Settings.scenarioType == ScenarioType.GetAllByCursor) {
+ if (Settings.scenarioType == ScenarioType.LoadEntities) {
setUp(
- EntityCollectionScenarios.getEntityPagesToEnd
- .inject(
- rampUsers(Settings.rampUsers) over Settings.rampTime,
- constantUsersPerSec(Settings.constantUsersPerSec) during Settings.constantUsersDuration
+ EntityCollectionScenarios.loadEntities
+ .inject(
+ rampUsers(Settings.rampUsers) over Settings.rampTime,
+ constantUsersPerSec(Settings.constantUsersPerSec) during Settings.constantUsersDuration
+
+ ).protocols(Settings.httpConf.acceptHeader("application/json"))
+ )
+ } else if (Settings.scenarioType == ScenarioType.DeleteEntities) {
+ setUp(
+ EntityCollectionScenarios.deleteEntities
+ .inject(
+ rampUsers(Settings.rampUsers) over Settings.rampTime,
+ constantUsersPerSec(Settings.constantUsersPerSec) during Settings.constantUsersDuration
- ).protocols(Settings.httpConf.acceptHeader("application/json"))
+ ).protocols(Settings.httpConf.acceptHeader("application/json"))
+ )
+ } else if (Settings.scenarioType == ScenarioType.GetAllByCursor) {
+ setUp(
+ EntityCollectionScenarios.getEntityPagesToEnd
+ .inject(
+ rampUsers(Settings.rampUsers) over Settings.rampTime,
+ constantUsersPerSec(Settings.constantUsersPerSec) during Settings.constantUsersDuration
+
+ ).protocols(Settings.httpConf.acceptHeader("application/json"))
)
} else if (Settings.scenarioType == ScenarioType.NameRandomInfinite) {
setUp(