usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [07/21] incubator-usergrid git commit: USERGRID-871: refactor Gatling load testing code
Date Mon, 03 Aug 2015 20:30:51 GMT
USERGRID-871: refactor Gatling load testing code


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

Branch: refs/heads/two-dot-o-dev
Commit: c499e421554d88485b712e65a14c33007de0acd3
Parents: f62f053
Author: Mike Dunker <mdunker@apigee.com>
Authored: Tue Jul 21 16:13:50 2015 -0700
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Tue Jul 21 16:13:50 2015 -0700

----------------------------------------------------------------------
 stack/loadtests/README.md                       |    50 +-
 stack/loadtests/pom.xml                         |    26 +-
 stack/loadtests/runCollectionQueryTest.sh       |    95 +
 stack/loadtests/runRandomEntityByNameTest.sh    |    95 +
 stack/loadtests/runtests.sh                     |    12 +-
 .../datagenerators/EntityDataGenerator.scala    |    74 +-
 .../datagenerators/FeederGenerator.scala        |   122 +-
 .../datagenerators/datafiles/dist.all.last.txt  | 88799 +++++++++++++++++
 .../datafiles/dist.female.first.txt             |  4275 +
 .../datafiles/dist.male.first.txt               |  1219 +
 .../usergrid/datagenerators/firstNames.txt      |  5494 +
 .../usergrid/datagenerators/lastNames.txt       | 88799 +++++++++++++++++
 .../org/apache/usergrid/enums/AuthType.scala    |    10 +
 .../usergrid/enums/ConfigProperties.scala       |    47 +
 .../usergrid/enums/EndConditionType.scala       |     9 +
 .../org/apache/usergrid/enums/EntityType.scala  |     9 +
 .../apache/usergrid/enums/ScenarioType.scala    |     9 +
 .../org/apache/usergrid/enums/TokenType.scala   |    10 +
 .../apache/usergrid/helpers/Extractors.scala    |    67 +-
 .../org/apache/usergrid/helpers/Setup.scala     |   193 +-
 .../org/apache/usergrid/helpers/Utils.scala     |   100 +
 .../scenarios/ApplicationScenarios.scala        |     4 +-
 .../scenarios/ConnectionScenarios.scala         |     6 +-
 .../usergrid/scenarios/DeviceScenarios.scala    |     6 +-
 .../scenarios/EntityCollectionScenarios.scala   |   131 +
 .../usergrid/scenarios/EntityScenarios.scala    |    36 +-
 .../usergrid/scenarios/GeoScenarios.scala       |    17 +-
 .../scenarios/NotificationScenarios.scala       |     5 +-
 .../usergrid/scenarios/NotifierScenarios.scala  |     6 +-
 .../scenarios/OrganizationScenarios.scala       |     4 +-
 .../usergrid/scenarios/TokenScenarios.scala     |     4 +-
 .../usergrid/scenarios/UserScenarios.scala      |    29 +-
 .../org/apache/usergrid/settings/Headers.scala  |    22 +-
 .../org/apache/usergrid/settings/Settings.scala |    96 +-
 .../org/apache/usergrid/settings/Utils.scala    |    91 -
 .../usergrid/simulations/AppSimulation.scala    |    44 -
 .../simulations/ConfigurableSimulation.scala    |    73 +
 .../simulations/ConnectionsSimulation.scala     |    53 -
 .../simulations/DeleteUsersSimulation.scala     |    56 -
 .../simulations/GetEntitySimulation.scala       |    44 -
 .../simulations/GetUserPagesSimulation.scala    |    51 -
 .../simulations/GetUsersSimulation.scala        |    51 -
 .../PostCustomEntitySimulation.scala            |    80 -
 .../simulations/PostUsersSimulation.scala       |    51 -
 .../PushNotificationTargetUserSimulation.scala  |    44 -
 .../simulations/PutCustomEntitySimulation.scala |    75 -
 .../simulations/PutUsersSimulation.scala        |    56 -
 .../usergrid/simulations/SetupSimulation.scala  |    45 -
 .../simulations/deprecated/AppSimulation.scala  |    44 +
 .../deprecated/ConnectionsSimulation.scala      |    54 +
 .../deprecated/DeleteUsersSimulation.scala      |    56 +
 .../deprecated/GetEntitySimulation.scala        |    44 +
 .../deprecated/GetUserPagesSimulation.scala     |    51 +
 .../deprecated/GetUsersSimulation.scala         |    51 +
 .../deprecated/PostCustomEntitySimulation.scala |    76 +
 .../deprecated/PostUsersSimulation.scala        |    51 +
 .../PushNotificationTargetUserSimulation.scala  |    45 +
 .../deprecated/PutCustomEntitySimulation.scala  |    75 +
 .../deprecated/PutUsersSimulation.scala         |    56 +
 .../deprecated/SetupSimulation.scala            |    46 +
 stack/loadtests/src/test/scala/Engine.scala     |     2 +-
 61 files changed, 190329 insertions(+), 1016 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c499e421/stack/loadtests/README.md
----------------------------------------------------------------------
diff --git a/stack/loadtests/README.md b/stack/loadtests/README.md
index 14514c6..d497a10 100644
--- a/stack/loadtests/README.md
+++ b/stack/loadtests/README.md
@@ -5,41 +5,41 @@ Gatling will run through mvn
 
 1. execute mvn gatling:execute with these options
 
-	*Required
-	> -Dthrottle={maxReqsSec} -Dduration={durationInSecs} -Dorg={org}  -Dapp={appName} -Dbaseurl={uriNoProceedingSlash}
-DnumEntities={numberOfEntitiesYouWantToCreateInteger} -DmaxPossibleUsers={totalUsersInteger}
-DrampTime={rampTimeIntegerSeconds} -DadminUser={username} -DadminPassword={pwd} -Dgatling.simulationClass={simulationFQDN}
-
-	*Addional optional settings 
-		
-	>-DpushNotifier={notifierName} -DpushProvider={noop_apns_or_gcm} -DskipSetup={boolean}
-
-	skipSetup will skip the setup steps
-
-	So running will look something like this
-	>mvn gatling:execute -Dthrottle=100 -Dduration=300 -Dorg=usergrid  -Dapp=load -Dbaseurl=http://load.usergrid.com
-DnumEntities=300 -DmaxPossibleUsers=600 -DrampTime=30 -DadminUser=usergrid -DadminPassword=test
-Dgatling.simulationClass=org.apache.usergrid.simulations.AppSimulation
-	
-	Setting the users and duration => Injects a given number of users with a linear ramp
over a given duration. users must be greater than duration
-	
-	Setting the throttle and ramptime => will attempt to hit a set reqs/sec over a given
time period.  If users and duration are not great enough then you will never hit your throttle
-	
-	Values for simulation are 'all','connections'
-	
-	Also see http://gatling.io/docs/2.0.2/general/simulation_setup.html
-	
-	Additional docs can be found here http://gatling.io/docs/2.0.2/
+    *Required
+    > -Dthrottle={maxReqsSec} -Dduration={durationInSecs} -Dorg={org}  -Dapp={appName}
-Dbaseurl={uriNoProceedingSlash} -DnumEntities={numberOfEntitiesYouWantToCreateInteger} -DmaxPossibleUsers={totalUsersInteger}
-DrampTime={rampTimeIntegerSeconds} -DadminUser={username} -DadminPassword={pwd} -Dgatling.simulationClass={simulationFQDN}
+
+    *Addional optional settings 
+        
+    >-DpushNotifier={notifierName} -DpushProvider={noop_apns_or_gcm} -DskipSetup={boolean}
+
+    skipSetup will skip the setup steps
+
+    So running will look something like this
+    >mvn gatling:execute -Dthrottle=100 -Dduration=300 -Dorg=usergrid  -Dapp=load -Dbaseurl=http://load.usergrid.com
-DnumEntities=300 -DmaxPossibleUsers=600 -DrampTime=30 -DadminUser=usergrid -DadminPassword=test
-Dgatling.simulationClass=org.apache.usergrid.simulations.deprecated.AppSimulation
+    
+    Setting the users and duration => Injects a given number of users with a linear ramp
over a given duration. users must be greater than duration
+    
+    Setting the throttle and ramptime => will attempt to hit a set reqs/sec over a given
time period.  If users and duration are not great enough then you will never hit your throttle
+    
+    Values for simulation are 'all','connections'
+    
+    Also see http://gatling.io/docs/2.0.2/general/simulation_setup.html
+    
+    Additional docs can be found here http://gatling.io/docs/2.0.2/
 
 ##Running a Push Notification Simulation
 
 1. Set up all users in the system with 2 devices each.
 
-	>mvn compile gatling:execute -Dgatling.simulationClass=org.apache.usergrid.simulations.SetupSimulation
-DadminUser=usergrid -DadminPassword=test -Dorg=usergrid  -Dapp=load -Dthrottle=100 -Dbaseurl=http://loadtest.usergrid.com
-DmaxPossibleUsers=1000
+    >mvn compile gatling:execute -Dgatling.simulationClass=org.apache.usergrid.simulations.deprecated.SetupSimulation
-DadminUser=usergrid -DadminPassword=test -Dorg=usergrid  -Dapp=load -Dthrottle=100 -Dbaseurl=http://loadtest.usergrid.com
-DmaxPossibleUsers=1000
 
 
-	Note the following.
+    Note the following.
 
 
-	**throttle:**  The max number of users + devices per second to create
+    **throttle:**  The max number of users + devices per second to create
 
-	**maxPossibleUsers:**  The maximum number of users the simulation will create before exiting
+    **maxPossibleUsers:**  The maximum number of users the simulation will create before
exiting
 
 
 1. No

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c499e421/stack/loadtests/pom.xml
----------------------------------------------------------------------
diff --git a/stack/loadtests/pom.xml b/stack/loadtests/pom.xml
index 0389eda..6605602 100644
--- a/stack/loadtests/pom.xml
+++ b/stack/loadtests/pom.xml
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-    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
+	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
+		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.
+	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.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -53,7 +53,7 @@
 		<encoding>UTF-8</encoding>
 
 		<gatling.version>2.0.3</gatling.version>
-    <gatling.plugin.version>2.0.0</gatling.plugin.version>
+	<gatling.plugin.version>2.0.0</gatling.plugin.version>
 		<gatling-highcharts.version>2.0.3</gatling-highcharts.version>
 
 		<scala-maven-plugin.version>3.1.6</scala-maven-plugin.version>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c499e421/stack/loadtests/runCollectionQueryTest.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runCollectionQueryTest.sh b/stack/loadtests/runCollectionQueryTest.sh
new file mode 100755
index 0000000..8137d2e
--- /dev/null
+++ b/stack/loadtests/runCollectionQueryTest.sh
@@ -0,0 +1,95 @@
+#!/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) SEARCH_LIMIT"
+
+URL="$1"
+RAMP_USERS="$2"
+RAMP_TIME="$3"
+CONSTANT_USERS_PER_SEC="$4"
+CONSTANT_USERS_DURATION="$5"
+SEARCH_LIMIT="$6"
+
+shift 6
+
+#Compile everything
+mvn compile
+
+#Set the app id to be a date epoch for uniqueness
+CREATE_ORG=false
+ORG=gatling
+CREATE_APP=false
+#APP=$(date +%s)
+APP=millionentities
+COLLECTION_TYPE=basicentities
+SCENARIO_TYPE=getAllByCursor
+LOAD_ENTITIES=false
+NUM_ENTITIES=10000
+SKIP_SETUP=false
+SEARCH_QUERY=order%20by%20specials%20desc
+ENTITY_TYPE=basic
+ENTITY_PREFIX=basic
+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 -Dorg=usergrid \
+-DskipSetup=${SKIP_SETUP} \
+-DcreateOrg=${CREATE_ORG} \
+-Dorg=${ORG} \
+-DcreateApp=${CREATE_APP} \
+-Dapp=${APP} \
+-Dbaseurl=${URL} \
+-DadminUser=usergrid  \
+-DadminPassword=test  \
+-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/c499e421/stack/loadtests/runRandomEntityByNameTest.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runRandomEntityByNameTest.sh b/stack/loadtests/runRandomEntityByNameTest.sh
new file mode 100755
index 0000000..474acfe
--- /dev/null
+++ b/stack/loadtests/runRandomEntityByNameTest.sh
@@ -0,0 +1,95 @@
+#!/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 5 ] || die "At least 5 arguments required, $# provided.  Example is $0 URL RAMP_USERS
RAMP_TIME(seconds) CONSTANT_USERS_PER_SEC, CONSTANT_USERS_DURATION(seconds)"
+
+URL="$1"
+RAMP_USERS="$2"
+RAMP_TIME="$3"
+CONSTANT_USERS_PER_SEC="$4"
+CONSTANT_USERS_DURATION="$5"
+
+shift 5
+
+#Compile everything
+mvn compile
+
+#Set the app id to be a date epoch for uniqueness
+#APP=$(date +%s)
+CREATE_ORG=false
+ORG=gatling
+CREATE_APP=false
+APP=millionentities
+COLLECTION_TYPE=trivialentities
+SCENARIO_TYPE=nameRandomInfinite
+LOAD_ENTITIES=false
+NUM_ENTITIES=10000
+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 -Dorg=usergrid \
+-DskipSetup=${SKIP_SETUP} \
+-DcreateOrg=${CREATE_ORG} \
+-Dorg=${ORG} \
+-DcreateApp=${CREATE_APP} \
+-Dapp=${APP} \
+-Dbaseurl=${URL} \
+-DadminUser=usergrid  \
+-DadminPassword=test  \
+-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/c499e421/stack/loadtests/runtests.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runtests.sh b/stack/loadtests/runtests.sh
index 0897d25..ea9658c 100755
--- a/stack/loadtests/runtests.sh
+++ b/stack/loadtests/runtests.sh
@@ -40,7 +40,7 @@ APP1=$(date +%s)
 mvn gatling:execute -Dorg=usergrid \
 -Dbaseurl=${URL} \
 -DmaxPossibleUsers=${MAX_CONCURRENT_USERS}  \
--DmaxPossibleUsers=${RAMP_TIME}  \
+-DrampTime=${RAMP_TIME}  \
 -DadminUser=usergrid  \
 -DadminPassword=test  \
 -Dduration=${DURATION_TIME}    \
@@ -52,7 +52,7 @@ mvn gatling:execute -Dorg=usergrid \
 mvn gatling:execute -Dorg=usergrid \
 -Dbaseurl=${URL} \
 -DmaxPossibleUsers=${MAX_CONCURRENT_USERS}  \
--DmaxPossibleUsers=${RAMP_TIME}  \
+-DrampTime=${RAMP_TIME}  \
 -DadminUser=usergrid  \
 -DadminPassword=test  \
 -Dduration=${DURATION_TIME}    \
@@ -64,7 +64,7 @@ mvn gatling:execute -Dorg=usergrid \
 mvn gatling:execute -Dorg=usergrid \
 -Dbaseurl=${URL} \
 -DmaxPossibleUsers=${MAX_CONCURRENT_USERS}  \
--DmaxPossibleUsers=${RAMP_TIME}  \
+-DrampTime=${RAMP_TIME}  \
 -DadminUser=usergrid  \
 -DadminPassword=test  \
 -Dduration=${DURATION_TIME}    \
@@ -78,7 +78,7 @@ APP2=$(date +%s)
 mvn gatling:execute -Dorg=usergrid \
 -Dbaseurl=${URL} \
 -DmaxPossibleUsers=${MAX_CONCURRENT_USERS}  \
--DmaxPossibleUsers=${RAMP_TIME}  \
+-DrampTime=${RAMP_TIME}  \
 -DadminUser=usergrid  \
 -DadminPassword=test  \
 -Dduration=${DURATION_TIME}    \
@@ -89,7 +89,7 @@ mvn gatling:execute -Dorg=usergrid \
 mvn gatling:execute -Dorg=usergrid \
 -Dbaseurl=${URL} \
 -DmaxPossibleUsers=${MAX_CONCURRENT_USERS}  \
--DmaxPossibleUsers=${RAMP_TIME}  \
+-rampTime=${RAMP_TIME}  \
 -DadminUser=usergrid  \
 -DadminPassword=test  \
 -Dduration=${DURATION_TIME}    \
@@ -101,7 +101,7 @@ mvn gatling:execute -Dorg=usergrid \
 mvn gatling:execute -Dorg=usergrid \
 -Dbaseurl=${URL} \
 -DmaxPossibleUsers=${MAX_CONCURRENT_USERS}  \
--DmaxPossibleUsers=${RAMP_TIME}  \
+-DrampTime=${RAMP_TIME}  \
 -DadminUser=usergrid  \
 -DadminPassword=test  \
 -Dduration=${DURATION_TIME}    \

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c499e421/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/EntityDataGenerator.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/EntityDataGenerator.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/EntityDataGenerator.scala
index cb024d3..88b81c8 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/EntityDataGenerator.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/EntityDataGenerator.scala
@@ -16,9 +16,8 @@
  */
  package org.apache.usergrid.datagenerators
 
- import java.util.UUID
-
- import org.apache.usergrid.settings.Utils
+ import org.apache.usergrid.enums.EntityType
+ import org.apache.usergrid.helpers.Utils
 
  import scala.collection.mutable.ArrayBuffer
  import scala.util.parsing.json.JSONObject
@@ -44,7 +43,7 @@
 
   def generateUser(userId: String): Map[String,String] = {
 
-    return Map(
+    Map(
 
       "username" -> "user".concat(userId.toString),
       "profileId" -> Utils.generateRandomInt(10000, 1000000).toString,
@@ -64,7 +63,7 @@
 
   def generateCustomEntity(): Map[String,String] = {
 
-    var entity: Map[String, String] = Map(
+    val entity: Map[String, String] = Map(
       // "name" -> "fdsa",
       "address" -> Utils.generateRandomInt(10000, 1000000).toString,
       "city" -> Utils.generateRandomInt(10000, 1000000).toString,
@@ -82,14 +81,31 @@
       "tables" -> Utils.generateRandomInt(50, 100000).toString,
       "outdoor" -> Utils.generateRandomInt(50, 100000).toString
       )
-    return Map("entity" -> new JSONObject(entity).toString())
 
+    Map("entity" -> new JSONObject(entity).toString())
   }
 
-   def generateCustomEntityJSONString(): String = {
+   /* --------------------------- */
+
+   def generateTrivialEntity(name: String = null): String = {
+
+     val nameKey = if (name != null) "name" else "noname"
+     val nameVal = if (name != null) name else Utils.generateRandomInt(1,10000000).toString
+
+     val entity: Map[String, String] = Map(
+       nameKey -> nameVal
+     )
+
+     new JSONObject(entity).toString()
+   }
 
-      var entity: Map[String, String] = Map(
-        // "name" -> "fdsa",
+   def generateBasicEntity(name: String = null): String = {
+
+     val nameKey = if (name != null) "name" else "noname"
+     val nameVal = if (name != null) name else Utils.generateRandomInt(1,10000000).toString
+
+     val entity: Map[String, String] = Map(
+        nameKey -> nameVal,
         "address" -> Utils.generateRandomInt(10000, 1000000).toString,
         "city" -> Utils.generateRandomInt(10000, 1000000).toString,
         "state" -> Utils.generateRandomInt(10000, 1000000).toString,
@@ -105,9 +121,39 @@
         "bar" -> Utils.generateRandomInt(120, 350).toString,
         "tables" -> Utils.generateRandomInt(50, 100000).toString,
         "outdoor" -> Utils.generateRandomInt(50, 100000).toString
-        )
-
-     return new JSONObject(entity).toString();
-
-    }
+     )
+
+     new JSONObject(entity).toString()
+   }
+
+   def generateEntity(entityType: String = EntityType.Basic, entityName: String = null):
String = {
+     val entity: String =
+       if (entityType == EntityType.Trivial)
+         generateTrivialEntity(entityName)
+       else // default is basic
+         generateBasicEntity(entityName)
+
+     entity
+   }
+
+   def generateUserEntity(userId: String = "user" + System.currentTimeMillis().toString):
String = {
+
+     val entity: Map[String, Any] = Map(
+       "username" -> userId,
+       "profileId" -> Utils.generateRandomInt(10000, 1000000),
+       "displayName" -> Utils.generateRandomInt(10000, 1000000).toString,
+       "showAge" -> Utils.generateRandomInt(0, 1),
+       "ethnicity" -> Utils.generateRandomInt(1, 15),
+       "relationshipStatus" -> Utils.generateRandomInt(1, 4),
+       "headline" -> "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.",
+       "aboutMe" -> "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.",
+       "age" -> Utils.generateRandomInt(18, 65),
+       "height" -> Utils.generateRandomInt(48, 84),
+       "weight" -> Utils.generateRandomInt(120, 350),
+       "seen" -> Utils.generateRandomInt(50, 100000).toString,
+       "password" -> "password"
+     )
+
+     new JSONObject(entity).toString()
+   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c499e421/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 97be06a..63091a7 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
@@ -20,7 +20,8 @@
  import java.util.UUID
  import java.util.concurrent.atomic.{AtomicInteger, AtomicLong}
  import io.gatling.core.Predef._
- import org.apache.usergrid.settings.Utils
+ import org.apache.usergrid.helpers.Utils
+ import org.apache.usergrid.settings.Settings
  import scala.collection.mutable.ArrayBuffer
  import scala.util.Random
 
@@ -30,29 +31,27 @@
     var userArray: ArrayBuffer[Map[String, String]] = new ArrayBuffer[Map[String, String]]
     for (userCount <- 1 to numUsers) {
       var user: Map[String, String] = EntityDataGenerator.generateUser(userCount.toString)
-      var geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
-      var blockLists: Map[String, String] = EntityDataGenerator.generateBlockUserLists(numUsers)
+      val geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
+      val blockLists: Map[String, String] = EntityDataGenerator.generateBlockUserLists(numUsers)
 
       user = user ++ geolocation ++ blockLists
 
       userArray += user
     }
-    return userArray.toArray
-  }
-
 
+    userArray.toArray
+  }
 
   /**
    * Generate users forever
+   * @param seed
    * @param radius
    * @param centerLatitude
    * @param centerLongitude
    * @return
    */
-  def generateUserWithGeolocationFeederInfinite(seed:Int,radius: Double, centerLatitude:
Double, centerLongitude: Double, maxPossible: Int): Iterator[Map[String, String]] = {
-    val userFeeder = Iterator.from(seed).map(i=>generateUserData(i.toString, radius, centerLatitude,
centerLongitude))
-    return userFeeder
-
+  def generateUserWithGeolocationFeederInfinite(seed:Int,radius: Double, centerLatitude:
Double, centerLongitude: Double): Iterator[Map[String, String]] = {
+    Iterator.from(seed).map(i=>generateUserData(i.toString, radius, centerLatitude, centerLongitude))
   }
 
   /**
@@ -64,14 +63,11 @@
    */
   def generateUserData(id: String, radius: Double, centerLatitude: Double, centerLongitude:
Double): Map[String, String] = {
 
+    val user: Map[String, String] = EntityDataGenerator.generateUser(id)
+    val geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
+    val blockLists: Map[String, String] = EntityDataGenerator.generateBlockUserLists(1)
 
-    var user: Map[String, String] = EntityDataGenerator.generateUser(id)
-    var geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
-    var blockLists: Map[String, String] = EntityDataGenerator.generateBlockUserLists(1)
-
-    user = user ++ geolocation ++ blockLists
-
-    return user
+    user ++ geolocation ++ blockLists
   }
 
 
@@ -82,14 +78,13 @@
       // always return true as this feeder can be polled infinitively
       override def hasNext = true
 
-      override def next: Map[String, String] = {
-        var geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
+      override def next(): Map[String, String] = {
+        val geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
         Map("latitude" -> geolocation("latitude"), "longitude" -> geolocation("longitude"))
       }
     }
 
-    return geolocationFeeder
-
+    geolocationFeeder
   }
 
   def generateGeolocationWithQueryFeeder(radius: Double, centerLatitude: Double, centerLongitude:
Double): Feeder[String] = {
@@ -99,36 +94,33 @@
       // always return true as this feeder can be polled infinitively
       override def hasNext = true
 
-      override def next: Map[String, String] = {
-        var geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
-        var queryParams = Utils.generateRandomQueryString
+      override def next(): Map[String, String] = {
+        val geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
+        val queryParams = Utils.generateRandomQueryString
         Map("latitude" -> geolocation("latitude"), "longitude" -> geolocation("longitude"),
"queryParams" -> queryParams)
       }
     }
 
-    return geolocationFeeder
-
+    geolocationFeeder
   }
 
   def generateUserConnectionFeeder(numUsers: Int): Feeder[String] = {
 
     val userIdFeeder = new Feeder[String] {
 
-      // always return true as this feeder can be polled infinitively
+      // always return true as this feeder can be polled infinitely
       override def hasNext = true
 
-      override def next: Map[String, String] = {
+      override def next(): Map[String, String] = {
         Map("user1" -> "user".concat(Utils.generateRandomInt(1, numUsers).toString), "user2"
-> "user".concat(Utils.generateRandomInt(1, numUsers).toString))
       }
     }
 
-    return userIdFeeder
-
+    userIdFeeder
   }
 
   def generateEntityNameFeeder(prefix: String, numEntities: Int): Iterator[Map[String, String]]
 = {
-    val itr = Iterator.from(1).map(i=> Map("entityName" -> prefix.concat(i.toString).concat(UUID.randomUUID().toString)))
-    return itr
+    Iterator.from(1).map(i=> Map("entityName" -> prefix.concat(i.toString).concat(UUID.randomUUID().toString)))
   }
 
   def generateRandomEntityNameFeeder(prefix: String, numEntities: Int): Array[Map[String,
String]] = {
@@ -139,8 +131,7 @@
       nameArray += Map("entityName" -> prefix.concat(Utils.generateRandomInt(0, 100000000).toString))
     }
 
-    return nameArray.toArray
-
+    nameArray.toArray
   }
 
 
@@ -166,32 +157,57 @@
     */
    def generateCustomEntityPutInfinite(seed:Int): Iterator[Map[String, Any]] = {
      //val rod = "rod"
-     val userFeeder = Iterator.from(seed).map(i=>Map("entityName" -> i.toString.concat(UUID.randomUUID().toString),
"entity" -> EntityDataGenerator.generateCustomEntityJSONString()));
+     val userFeeder = Iterator.from(seed).map(i=>Map("entityName" -> i.toString.concat(UUID.randomUUID().toString),
"entity" -> EntityDataGenerator.generateCustomEntity()));
      return userFeeder
    }
 
 
-   def testFeeder(seed:Int): Iterator[Map[String, String]] = {
-     var entity: Map[String, String] = EntityDataGenerator.generateCustomEntity();
-     Map("entity" -> entity)
-     val userFeeder = Iterator.from(seed).map(i=>EntityDataGenerator.generateCustomEntity())
-     return userFeeder
-   }
+   /*
+      def testFeeder(seed:Int): Iterator[Map[String, String]] = {
+        var entity: Map[String, String] = EntityDataGenerator.generateCustomEntity();
+        Map("entity" -> entity)
+        val userFeeder = Iterator.from(seed).map(i=>EntityDataGenerator.generateCustomEntity())
+        return userFeeder
+      }
 
-/*
 
-   def testFeeder(): Array[Map[String, String]] = {
-     var userArray: ArrayBuffer[Map[String, String]] = new ArrayBuffer[Map[String, String]]
-     for (userCount <- 1 to numUsers) {
-       var user: Map[String, String] = EntityDataGenerator.generateUser(userCount.toString)
-       var geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius, centerLatitude,
centerLongitude)
-       var blockLists: Map[String, String] = EntityDataGenerator.generateBlockUserLists(numUsers)
+      def testFeeder(): Array[Map[String, String]] = {
+        var userArray: ArrayBuffer[Map[String, String]] = new ArrayBuffer[Map[String, String]]
+        for (userCount <- 1 to numUsers) {
+          var user: Map[String, String] = EntityDataGenerator.generateUser(userCount.toString)
+          var geolocation: Map[String, String] = Utils.generateRandomGeolocation(radius,
centerLatitude, centerLongitude)
+          var blockLists: Map[String, String] = EntityDataGenerator.generateBlockUserLists(numUsers)
 
-       user = user ++ geolocation ++ blockLists
+          user = user ++ geolocation ++ blockLists
 
-       userArray += user
-     }
-     return userArray.toArray
-   }
+          userArray += user
+        }
+        return userArray.toArray
+      }
+     */
+
+ /* --------------------------- */
+
+ /**
+  * Generate specified number of custom entities
+  * @param numEntities Number of entities to create
+  * @param entityType Type of entity to create
+  * @param prefix Prefix for entities
+  * @return
   */
+ def generateCustomEntityFeeder(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) {
+     var entity = EntityDataGenerator.generateEntity(entityType, prefix.concat(i.toString))
+     entityArray += entity
+   }
+
+   entityArray.toArray
+ }
+
+ 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)))
+ }
+
 }


Mime
View raw message