usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [11/21] incubator-usergrid git commit: USERGRID-871: add update test and some general cleanup
Date Mon, 03 Aug 2015 20:30:55 GMT
USERGRID-871: add update test and some general cleanup


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

Branch: refs/heads/two-dot-o-dev
Commit: 5d202d90c6ace67f7e0644d6fe5623f11fafb716
Parents: 195449f
Author: Mike Dunker <mdunker@apigee.com>
Authored: Thu Jul 23 08:07:12 2015 -0700
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Thu Jul 23 08:07:12 2015 -0700

----------------------------------------------------------------------
 stack/loadtests/runLoadEntities.sh              |  4 +-
 stack/loadtests/runUpdateEntities.sh            | 99 ++++++++++++++++++++
 .../datagenerators/EntityDataGenerator.scala    | 12 +--
 .../datagenerators/FeederGenerator.scala        | 48 ++++++----
 .../org/apache/usergrid/enums/AuthType.scala    |  6 ++
 .../usergrid/enums/ConfigProperties.scala       |  9 +-
 .../usergrid/enums/EndConditionType.scala       |  9 +-
 .../org/apache/usergrid/enums/EntityType.scala  |  9 +-
 .../apache/usergrid/enums/ScenarioType.scala    | 10 +-
 .../org/apache/usergrid/enums/TokenType.scala   |  9 +-
 .../apache/usergrid/helpers/Extractors.scala    | 27 ------
 .../org/apache/usergrid/helpers/Setup.scala     | 12 +--
 .../org/apache/usergrid/helpers/Utils.scala     |  2 +-
 .../scenarios/ApplicationScenarios.scala        |  2 +-
 .../scenarios/ConnectionScenarios.scala         |  8 +-
 .../scenarios/EntityCollectionScenarios.scala   | 60 +++++++-----
 .../usergrid/scenarios/EntityScenarios.scala    |  1 -
 .../scenarios/NotificationScenarios.scala       |  9 +-
 .../usergrid/scenarios/NotifierScenarios.scala  |  5 +-
 .../scenarios/OrganizationScenarios.scala       |  7 +-
 .../usergrid/scenarios/TokenScenarios.scala     | 11 +--
 .../org/apache/usergrid/settings/Headers.scala  |  1 -
 .../org/apache/usergrid/settings/Settings.scala | 10 +-
 .../simulations/ConfigurableSimulation.scala    | 47 +++-------
 .../simulations/deprecated/AppSimulation.scala  |  3 -
 .../deprecated/ConnectionsSimulation.scala      |  3 -
 .../deprecated/SetupSimulation.scala            |  3 -
 27 files changed, 250 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/runLoadEntities.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runLoadEntities.sh b/stack/loadtests/runLoadEntities.sh
index bee8d1a..d213fd4 100755
--- a/stack/loadtests/runLoadEntities.sh
+++ b/stack/loadtests/runLoadEntities.sh
@@ -37,9 +37,9 @@ mvn compile
 #APP=$(date +%s)
 ADMIN_USER=superuser
 ADMIN_PASSWORD=test
-CREATE_ORG=false
+CREATE_ORG=true
 ORG=gatling
-CREATE_APP=false
+CREATE_APP=true
 APP=millionentities
 COLLECTION_TYPE=trivialentities
 SCENARIO_TYPE=loadEntities

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/runUpdateEntities.sh
----------------------------------------------------------------------
diff --git a/stack/loadtests/runUpdateEntities.sh b/stack/loadtests/runUpdateEntities.sh
new file mode 100755
index 0000000..0963a2d
--- /dev/null
+++ b/stack/loadtests/runUpdateEntities.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=updateEntities
+# 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/5d202d90/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 88b81c8..f9fa4fc 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
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.datagenerators
+package org.apache.usergrid.datagenerators
 
- import org.apache.usergrid.enums.EntityType
- import org.apache.usergrid.helpers.Utils
+import org.apache.usergrid.enums.EntityType
+import org.apache.usergrid.helpers.Utils
 
- import scala.collection.mutable.ArrayBuffer
- import scala.util.parsing.json.JSONObject
+import scala.collection.mutable.ArrayBuffer
+import scala.util.parsing.json.JSONObject
 
- object EntityDataGenerator {
+object EntityDataGenerator {
 
   def generateBlockUserLists(numUsers: Int): Map[String, String] = {
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 92444b2..1c80822 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
@@ -14,18 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.datagenerators
+package org.apache.usergrid.datagenerators
 
- import java.util
- import java.util.UUID
- import java.util.concurrent.atomic.{AtomicInteger, AtomicLong}
- import io.gatling.core.Predef._
- import org.apache.usergrid.helpers.Utils
- import org.apache.usergrid.settings.Settings
- import scala.collection.mutable.ArrayBuffer
- import scala.util.Random
+import java.util.UUID
+import java.util.concurrent.atomic.AtomicInteger
+import io.gatling.core.Predef._
+import org.apache.usergrid.helpers.Utils
+import org.apache.usergrid.settings.Settings
+import scala.collection.mutable.ArrayBuffer
 
- object FeederGenerator {
+object FeederGenerator {
 
   def generateUserWithGeolocationFeeder(numUsers: Int, radius: Double, centerLatitude: Double,
centerLongitude: Double): Array[Map[String, String]] = {
     var userArray: ArrayBuffer[Map[String, String]] = new ArrayBuffer[Map[String, String]]
@@ -206,20 +204,32 @@
    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]]
+ /*
+  * Gatling doesn't handle feeders running out of data well -- ending test with failure and
not building a report.
+  * This feeder will serve data forever, but validEntity will be set to "no" when data has
run out. Each user can
+  * then exit in a controlled fashion.
+  */
+ def generateCustomEntityFeeder(numEntities: Int, entityType: String, prefix: String, seed:
Int = 1): Feeder[String] =
+ new Feeder[String] {
+   var counter = new AtomicInteger(0)
 
-   for (i <- seed to numEntities+seed-1) {
-     val entityName = prefix.concat(i.toString)
+   // 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 seededVal = i + seed
+     val entityName = prefix.concat(seededVal.toString)
      val entity = EntityDataGenerator.generateEntity(entityType, entityName)
      val entityUrl = Settings.baseCollectionUrl + "/" + entityName
-     entityMapArray += Map("entityName" -> entityName, "entity" -> entity, "entityUrl"
-> entityUrl)
-   }
+     val validEntity = if (i >= numEntities) "no" else "yes"
 
-   entityMapArray.toArray
+     Map("entityName" -> entityName, "entity" -> entity, "entityUrl" -> entityUrl,
"validEntity" -> validEntity, "entityNum" -> (i+1).toString)
+   }
  }
 
- def generateCustomEntityFeeder2 (numEntities: Int, entityType: String, prefix: String, seed:
Int = 1): Feeder[String] =
+   /*
+ def generateCustomEntityFeeder(numEntities: Int, entityType: String, prefix: String, seed:
Int = 1): Feeder[String] =
  new Feeder[String] {
    var counter = new AtomicInteger(seed)
 
@@ -237,6 +247,8 @@
    }
  }
 
+    */
+
  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/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/enums/AuthType.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/AuthType.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/AuthType.scala
index 2823d95..6086fdd 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/AuthType.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/AuthType.scala
@@ -7,4 +7,10 @@ object AuthType {
   val Anonymous = "anonymous"
   val Token = "token"
   val Basic = "basic"
+
+  val Values = Seq(Anonymous,Token,Basic)
+
+  def isValid(str: String): Boolean = {
+    Values.contains(str)
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 56350ee..2f13a12 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
@@ -44,9 +44,16 @@ object ConfigProperties {
   val OrgCreationName = "orgCreationName"
   val OrgCreationEmail = "orgCreationEmail"
   val OrgCreationPassword = "orgCreationPassword"
+  val UpdateProperty = "updateProperty"
+  val UpdateValue = "updateValue"
+
   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,OrgCreationUsername,OrgCreationName,
-    OrgCreationEmail,OrgCreationPassword)
+    OrgCreationEmail,OrgCreationPassword,UpdateProperty,UpdateValue)
+
+  def isValid(str: String): Boolean = {
+    Values.contains(str)
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala
index 4bbb9cc..2d4bf63 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala
@@ -1,9 +1,12 @@
 package org.apache.usergrid.enums
 
-/**
- * Created by mdunker on 7/21/15.
- */
 object EndConditionType {
   val MinutesElapsed = "minutesElapsed"
   val RequestCount = "requestCount"
+
+  val Values = Seq(MinutesElapsed,RequestCount)
+
+  def isValid(str: String): Boolean = {
+    Values.contains(str)
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EntityType.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EntityType.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EntityType.scala
index d17d280..dfb378c 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EntityType.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EntityType.scala
@@ -1,9 +1,12 @@
 package org.apache.usergrid.enums
 
-/**
- * Created by mdunker on 7/20/15.
- */
 object EntityType {
   val Trivial = "trivial"
   val Basic = "basic"
+
+  val Values = Seq(Trivial,Basic)
+
+  def isValid(str: String): Boolean = {
+    Values.contains(str)
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 e21a1ee..7dca619 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
@@ -1,11 +1,15 @@
 package org.apache.usergrid.enums
 
-/**
- * Created by mdunker on 7/20/15.
- */
 object ScenarioType {
   val GetAllByCursor = "getAllByCursor"
   val NameRandomInfinite = "nameRandomInfinite"
   val LoadEntities = "loadEntities"
   val DeleteEntities = "deleteEntities"
+  val UpdateEntities = "updateEntities"
+
+  val Values = Seq(GetAllByCursor,NameRandomInfinite,LoadEntities,DeleteEntities,UpdateEntities)
+
+  def isValid(str: String): Boolean = {
+    Values.contains(str)
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/enums/TokenType.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/TokenType.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/TokenType.scala
index 4d371e1..456a9cb 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/TokenType.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/TokenType.scala
@@ -1,10 +1,13 @@
 package org.apache.usergrid.enums
 
-/**
- * Created by mdunker on 7/20/15.
- */
 object TokenType {
   val None = "none"
   val User = "user"
   val Management = "management"
+
+  val Values = Seq(None, User, Management)
+
+  def isValid(str: String): Boolean = {
+    Values.contains(str)
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Extractors.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Extractors.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Extractors.scala
index 8de995e..35f75a7 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Extractors.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Extractors.scala
@@ -103,31 +103,4 @@ object Extractors {
     session => session.set("authType", Settings.authType)
   }
 
-  /*
-  def injectTokenToSession(authType: String, tokenType: String): Expression[Session] = {
-    session => {
-      if (authType == AuthType.Token && tokenType == TokenType.User) {
-        session.set("authToken", Setup.getUserToken)
-      } else if (authType == AuthType.Token && tokenType == TokenType.Management)
{
-        session.set("authToken", Setup.getManagementToken())
-      } else {
-        session.set("authToken", "")
-      }
-    }
-  }
-
-  def injectAuth(authType: String, tokenType: String): Expression[Session] = {
-    session => {
-      if (authType == AuthType.Token && tokenType == TokenType.User) {
-        session.set("authToken", Setup.getUserToken)
-      } else if (authType == AuthType.Token && tokenType == TokenType.Management)
{
-        session.set("authToken", Setup.getManagementToken())
-      } else {
-        session.set("authToken", "")
-      }
-      session.set("authType", authType)
-    }
-  }
-  */
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 af3aabb..d90353a 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
@@ -20,24 +20,14 @@
 
 package org.apache.usergrid.helpers
 
-import java.util
-
 import com.fasterxml.jackson.databind.ObjectMapper
 import com.ning.http.client.{ListenableFuture, AsyncHttpClient,Response}
-import io.gatling.core.Predef._
-import io.gatling.http.Predef._
-import io.gatling.http.request.StringBody
-import io.gatling.jsonpath.JsonPath
 import org.apache.usergrid.datagenerators.FeederGenerator
 import org.apache.usergrid.enums.TokenType
-import org.apache.usergrid.settings.{Settings, Headers}
+import org.apache.usergrid.settings.Settings
 
 import scala.collection.mutable.ArrayBuffer
-import scala.util.parsing.json.JSONObject
 
-/**
- * Classy class class.
- */
 object Setup {
   var managementToken:String = null
   val client = new AsyncHttpClient()

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Utils.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Utils.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Utils.scala
index 82061d6..16ade96 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Utils.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Utils.scala
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.helpers
+package org.apache.usergrid.helpers
 
 import scala.util.Random
 import scala.util.parsing.json.JSONObject

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 4150513..44fe118 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
@@ -18,7 +18,7 @@
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
- import org.apache.usergrid.settings.{Settings, Headers}
+import org.apache.usergrid.settings.{Settings, Headers}
 
  /**
  * Performs organization registration

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
index b2827bb..0ff20a0 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/ConnectionScenarios.scala
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.scenarios
+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.settings.{Settings, Headers}
+import org.apache.usergrid.datagenerators.FeederGenerator
+import org.apache.usergrid.settings.{Settings, Headers}
 
- object ConnectionScenarios {
+object ConnectionScenarios {
 
   val postUserConnection = exec(
     http("POST connection")

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 592a507..1dd534c 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
@@ -147,56 +147,64 @@ object EntityCollectionScenarios {
     .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))
+      feed(FeederGenerator.generateCustomEntityFeeder(Settings.numEntities, Settings.entityType,
Settings.entityPrefix, Settings.entitySeed))
+        .exec{
+          session => if (session("validEntity").as[String] == "yes") { println("Loading
entity #" + session("entityNum").as[String]) }
+          session
+        }
         .doIf(session => session("validEntity").as[String] == "yes") {
           exec(loadEntity)
         }
     }
-    //.rendezVous(Settings.totalUsers)
 
   /*
-  val loadEntity = exec(
-    http("POST load entity")
-      .post(Settings.baseCollectionUrl)
+   * Delete entities
+   */
+  val deleteEntity = exec(
+    http("DELETE entity")
+      .delete("""${entityUrl}""")
       .headers(Headers.authToken)
-      .body(StringBody("""${entity}"""))
-      .check(status.in(Seq(200,400)))
+      // 200 for success, 404 if doesn't exist
+      .check(status.in(Seq(200)))
   )
 
-  val loadEntities = scenario("Load entities")
+  val deleteEntities = scenario("Delete entities")
     .exec(injectTokenIntoSession())
     .exec(injectAuthType())
-    .forever(
-      feed(FeederGenerator.generateCustomEntityFeeder(Settings.numEntities, Settings.entityType,
Settings.entityPrefix, Settings.entitySeed))
-      .exec(loadEntity)
-    )
-    */
-
+    .asLongAs(session => session("validEntity").asOption[String].map(validEntity =>
validEntity != "no").getOrElse[Boolean](true)) {
+    feed(FeederGenerator.generateCustomEntityFeeder(Settings.numEntities, Settings.entityType,
Settings.entityPrefix, Settings.entitySeed))
+      .exec {
+      session => if (session("validEntity").as[String] == "yes") { println("Deleting entity
#" + session("entityNum").as[String]) }
+        session
+    }
+      .doIf(session => session("validEntity").as[String] == "yes") {
+      exec(deleteEntity)
+    }
+  }
 
   /*
    * Delete entities
    */
-  val deleteEntity = exec(
-    http("DELETE entity")
-      .delete("""${entityUrl}""")
+  val updateEntity = exec(
+    http("UPDATE entity")
+      .put("""${entityUrl}""")
       .headers(Headers.authToken)
+      .body(StringBody(Settings.updateBody))
       // 200 for success, 404 if doesn't exist
       .check(status.in(Seq(200)))
   )
 
-  val deleteEntities = scenario("Delete entities")
+  val updateEntities = scenario("Update 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))
+      feed(FeederGenerator.generateCustomEntityFeeder(Settings.numEntities, Settings.entityType,
Settings.entityPrefix, Settings.entitySeed))
+        .exec {
+          session => if (session("validEntity").as[String] == "yes") { println("Updating
entity #" + session("entityNum").as[String]) }
+          session
+        }
         .doIf(session => session("validEntity").as[String] == "yes") {
-          exec(deleteEntity)
+          exec(updateEntity)
         }
     }
-  /*
-  val createEntityBatchScenario = scenario("Create custom entities")
-      .exec(injectStaticTokenToSession())
-      .feed(FeederGenerator.generateCustomEntityCreateFeeder(Settings.entityPrefix, Settings.numEntities))
-      .exec(EntityScenarios.postEntity)
-  */
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityScenarios.scala
index dd21e3c..83a648e 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityScenarios.scala
@@ -22,7 +22,6 @@ import org.apache.usergrid.datagenerators.{EntityDataGenerator, FeederGenerator}
 import org.apache.usergrid.helpers.{Extractors,Utils}
 import org.apache.usergrid.settings.{Headers, Settings}
 
-import scala.util.parsing.json.JSONObject
 
 /**
  * Provides CRUD methods for custom entities

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
index 92998d0..5471426 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotificationScenarios.scala
@@ -14,17 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.scenarios
-
-import java.io.File
-import java.nio.file.{Paths, Files}
+package org.apache.usergrid.scenarios
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
- import org.apache.usergrid.datagenerators.FeederGenerator
- import scala.concurrent.duration._
-
-import scala.io.Source
 
 import org.apache.usergrid.settings.{Headers, Settings}
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotifierScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotifierScenarios.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotifierScenarios.scala
index b2e32e5..9718ad3 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotifierScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/NotifierScenarios.scala
@@ -14,12 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.scenarios
+package org.apache.usergrid.scenarios
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
- import org.apache.usergrid.settings.{Headers, Settings}
- import scala.concurrent.duration._
+import org.apache.usergrid.settings.{Headers, Settings}
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 1cdc25c..0c1beef 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
@@ -14,13 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.scenarios
+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.settings.{Settings, Headers}
- import scala.concurrent.duration._
+import org.apache.usergrid.datagenerators.FeederGenerator
+import org.apache.usergrid.settings.{Settings, Headers}
 
 /**
  * Performs organization registration

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 4385797..d0eca02 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
@@ -14,15 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.usergrid.scenarios
+package org.apache.usergrid.scenarios
 
 import io.gatling.core.Predef._
- import io.gatling.http.Predef._
- import io.gatling.http.request.StringBody
- import org.apache.usergrid.settings.Headers
- import org.apache.usergrid.settings.Settings
+import io.gatling.http.Predef._
+import io.gatling.http.request.StringBody
+import org.apache.usergrid.settings.Headers
+import org.apache.usergrid.settings.Settings
 
- import scala.concurrent.duration._
 
 /**
  * Class that will get the token and insert it into the test session.

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Headers.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Headers.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Headers.scala
index db6062f..04c4d3b 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Headers.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Headers.scala
@@ -17,7 +17,6 @@
  package org.apache.usergrid.settings
 
  import org.apache.usergrid.enums.AuthType
- import org.apache.usergrid.helpers.Setup
 
  /**
  *

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 3992c68..a7669a1 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,14 +17,13 @@
 package org.apache.usergrid.settings
 
 import java.nio.charset.StandardCharsets
-import java.util.Base64
+import java.util.{Date, Base64}
 
 
-import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import org.apache.usergrid.datagenerators.FeederGenerator
 import org.apache.usergrid.enums._
-import scala.concurrent.duration._
+import org.apache.usergrid.helpers.Utils
 
 object Settings {
 
@@ -92,6 +91,11 @@ object Settings {
   val orgCreationName = System.getProperty(ConfigProperties.OrgCreationName, orgCreationUsername)
   val orgCreationPassword = System.getProperty(ConfigProperties.OrgCreationPassword, "test")
 
+  // Entity update
+  val updateProperty = System.getProperty(ConfigProperties.UpdateProperty, "updateProp")
+  val updateValue = System.getProperty(ConfigProperties.UpdateValue, new Date().toString)
+  val updateBody = Utils.toJSONStr(Map(updateProperty -> updateValue))
+
   def getUserFeeder():Array[Map[String, String]]= {
     FeederGenerator.generateUserWithGeolocationFeeder(totalUsers, userLocationRadius, centerLatitude,
centerLongitude)
   }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/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 4b0f96a..2e13a6c 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
@@ -17,6 +17,7 @@
 package org.apache.usergrid.simulations
 
 import io.gatling.core.Predef._
+import io.gatling.core.structure.ScenarioBuilder
 import org.apache.usergrid.enums.ScenarioType
 import org.apache.usergrid.helpers.Setup
 import org.apache.usergrid.scenarios.EntityCollectionScenarios
@@ -33,6 +34,17 @@ import org.apache.usergrid.settings.Settings
  * getAllByCursor scenario: searchQuery, searchLimit
  */
 class ConfigurableSimulation extends Simulation {
+
+  def getScenario(scenarioType: String): ScenarioBuilder = {
+    scenarioType match {
+      case ScenarioType.LoadEntities => EntityCollectionScenarios.loadEntities
+      case ScenarioType.DeleteEntities => EntityCollectionScenarios.deleteEntities
+      case ScenarioType.UpdateEntities => EntityCollectionScenarios.updateEntities
+      case ScenarioType.GetAllByCursor => EntityCollectionScenarios.getEntityPagesToEnd
+      case ScenarioType.NameRandomInfinite => EntityCollectionScenarios.getRandomEntitiesByName
+    }
+  }
+
   before(
     if (!Settings.skipSetup) {
       println("Begin setup")
@@ -44,43 +56,14 @@ class ConfigurableSimulation extends Simulation {
     }
   )
 
-
-
   Settings.setTestStartTime()
-  if (Settings.scenarioType == ScenarioType.LoadEntities) {
-    setUp(
-      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"))
-    )
-  } 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) {
+  if (ScenarioType.isValid(Settings.scenarioType)) {
+    val scenario: ScenarioBuilder = getScenario(Settings.scenarioType)
     setUp(
-      EntityCollectionScenarios.getRandomEntitiesByName
+      scenario
         .inject(
           rampUsers(Settings.rampUsers) over Settings.rampTime,
           constantUsersPerSec(Settings.constantUsersPerSec) during Settings.constantUsersDuration
-
         ).protocols(Settings.httpConf.acceptHeader("application/json"))
     )
   } else {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/AppSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/AppSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/AppSimulation.scala
index 7f1af08..a66f6b7 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/AppSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/AppSimulation.scala
@@ -28,9 +28,6 @@ import org.apache.usergrid.settings.Settings
 
 import scala.concurrent.duration._
 
-/**
- * Classy class class.
- */
 class AppSimulation extends Simulation {
   println("Begin setup")
   Setup.setupNotifier()

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/ConnectionsSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/ConnectionsSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/ConnectionsSimulation.scala
index 8e3cd57..69ff0b1 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/ConnectionsSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/ConnectionsSimulation.scala
@@ -28,9 +28,6 @@ import org.apache.usergrid.settings.Settings
 
 import scala.concurrent.duration._
 
-/**
- * Classy class class.
- */
 class ConnectionsSimulation extends Simulation{
 
   if(!Settings.skipSetup) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d202d90/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/SetupSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/SetupSimulation.scala
b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/SetupSimulation.scala
index 484fb32..8032228 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/SetupSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/deprecated/SetupSimulation.scala
@@ -27,9 +27,6 @@ import org.apache.usergrid.settings.Settings
 
 import scala.concurrent.duration._
 
-/**
- * Classy class class.
- */
 class SetupSimulation extends Simulation{
 
   println("Begin setup")


Mime
View raw message