USERGRID-1044: add usergrid region for auditing a specific region
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/b62ad30c Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/b62ad30c Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/b62ad30c Branch: refs/heads/usergrid-1007-shiro-cache Commit: b62ad30cb9f16de7cb1877877aee6126f541bc72 Parents: 9b2508f Author: Mike Dunker <mdun...@apigee.com> Authored: Fri Oct 9 16:44:19 2015 -0700 Committer: Mike Dunker <mdun...@apigee.com> Committed: Fri Oct 9 16:44:19 2015 -0700 ---------------------------------------------------------------------- stack/loadtests/runAuditVerifyCollectionEntities.sh | 5 ++++- .../scala/org/apache/usergrid/enums/ConfigProperties.scala | 4 +++- .../src/main/scala/org/apache/usergrid/helpers/Headers.scala | 7 +++++++ .../scala/org/apache/usergrid/scenarios/AuditScenarios.scala | 1 + .../main/scala/org/apache/usergrid/settings/Settings.scala | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/b62ad30c/stack/loadtests/runAuditVerifyCollectionEntities.sh ---------------------------------------------------------------------- diff --git a/stack/loadtests/runAuditVerifyCollectionEntities.sh b/stack/loadtests/runAuditVerifyCollectionEntities.sh index 2e2d76d..fa75505 100755 --- a/stack/loadtests/runAuditVerifyCollectionEntities.sh +++ b/stack/loadtests/runAuditVerifyCollectionEntities.sh @@ -28,16 +28,18 @@ if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi #RETRY_COUNT= DELETE_AFTER_SUCCESSFUL_AUDIT=false +AUDIT_REGION= die() { echo "$@" 1>&2 ; exit 1; } -[ "$#" -ge 3 ] || die "At least 3 arguments required, $# provided. Example is $0 RAMP_USERS RAMP_TIME(seconds) AUDIT_UUID_FILENAME [FAILED_UUID_FILENAME [DELETE_AFTER_SUCCESSFUL_AUDIT(true/false)]]" +[ "$#" -ge 3 ] || die "At least 3 arguments required, $# provided. Example is $0 RAMP_USERS RAMP_TIME(seconds) AUDIT_UUID_FILENAME [FAILED_UUID_FILENAME [DELETE_AFTER_SUCCESSFUL_AUDIT(true/false)[AUDIT_REGION]]]" RAMP_USERS="$1" RAMP_TIME="$2" AUDIT_UUID_FILENAME="$3" FAILED_UUID_FILENAME="$4" [ "$#" -ge 5 ] && DELETE_AFTER_SUCCESSFUL_AUDIT="$5" +[ "$#" -ge 6 ] && AUDIT_REGION="$6" shift $# @@ -63,5 +65,6 @@ mvn gatling:execute \ -DfailedUuidFilename=${FAILED_UUID_FILENAME} \ -DprintFailedRequests=${PRINT_FAILED_REQUESTS} \ -DdeleteAfterSuccessfulAudit=${DELETE_AFTER_SUCCESSFUL_AUDIT} \ +-DauditRegion=${AUDIT_REGION} \ -Dgatling.simulationClass=org.apache.usergrid.simulations.AuditSimulation http://git-wip-us.apache.org/repos/asf/usergrid/blob/b62ad30c/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 975944a..d825bb6 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 @@ -86,6 +86,7 @@ object ConfigProperties { val InterleavedWorkerFeed = "interleavedWorkerFeed" val NewCsvOnFlush = "newCsvOnFlush" val DeleteAfterSuccessfulAudit = "deleteAfterSuccessfulAudit" + val AuditRegion = "auditRegion"; val Values = Seq(Org,App,AdminUser,AdminPassword,BaseUrl,AuthType,TokenType,SkipSetup,CreateOrg,CreateApp,LoadEntities, ScenarioType,RampUsers,ConstantUsersPerSec,ConstantUsersDuration,UserSeed,AppUser,AppUserPassword,NumEntities, @@ -95,7 +96,7 @@ object ConfigProperties { UuidFilename,AuditUuidFilename,FailedUuidFilename,SandboxCollection,PurgeUsers,RetryCount,LaterThanTimestamp, EntityProgressCount,InjectionList,PrintFailedRequests,GetViaQuery,MultiPropertyPrefix,MultiPropertyCount, MultiPropertySizeInK,EntityNumberProperty,QueryParams,CsvFeedPattern,UnlimitedFeed,FlushCsv,InterleavedWorkerFeed, - NewCsvOnFlush,DeleteAfterSuccessfulAudit) + NewCsvOnFlush,DeleteAfterSuccessfulAudit,AuditRegion) def isValid(str: String): Boolean = { Values.contains(str) @@ -169,6 +170,7 @@ object ConfigProperties { case InterleavedWorkerFeed => false case NewCsvOnFlush => false case DeleteAfterSuccessfulAudit => false + case AuditRegion => "" } } else { null http://git-wip-us.apache.org/repos/asf/usergrid/blob/b62ad30c/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Headers.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Headers.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Headers.scala index 9feb197..ce9a168 100755 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Headers.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Headers.scala @@ -59,5 +59,12 @@ object Headers { else authAnonymous } + /** + * Optional region header + */ + def auditRegionHeaders: Map[String, String] = { + if (Settings.auditRegion != "") Map( "UsergridRegion" -> Settings.auditRegion ) + else Map() + } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/b62ad30c/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala index 836a1fb..aaabf99 100644 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala @@ -135,6 +135,7 @@ object AuditScenarios { http("GET collection entity") .get("/${collectionName}?ql=uuid=${uuid}") .headers(Headers.authToken) + .headers(Headers.auditRegionHeaders) .check(status.is(200),jsonPath("$.count").optional.saveAs("count"),extractAuditEntities(SessionVarCollectionEntities))) .exec(session => { val count = session("count").as[String].toInt http://git-wip-us.apache.org/repos/asf/usergrid/blob/b62ad30c/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 eeeac1f..979fb3f 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 @@ -187,6 +187,7 @@ object Settings { val interleavedWorkerFeed:Boolean = if (unlimitedFeed) true else initBoolSetting(ConfigProperties.InterleavedWorkerFeed) val newCsvOnFlush:Boolean = initBoolSetting(ConfigProperties.NewCsvOnFlush) val deleteAfterSuccessfulAudit:Boolean = initBoolSetting(ConfigProperties.DeleteAfterSuccessfulAudit) + val auditRegion = initStrSetting(ConfigProperties.AuditRegion) val multiPropertyPrefix = initStrSetting(ConfigProperties.MultiPropertyPrefix) val multiPropertyCount:Int = initIntSetting(ConfigProperties.MultiPropertyCount)