USERGRID-1044: fixes

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

Branch: refs/heads/master
Commit: 83d7a6f83e005ee8a4794ed86f4f0de95653360c
Parents: be0033e
Author: Mike Dunker <mdun...@apigee.com>
Authored: Tue Oct 27 13:44:33 2015 -0700
Committer: Mike Dunker <mdun...@apigee.com>
Committed: Tue Oct 27 13:44:33 2015 -0700

----------------------------------------------------------------------
 .../usergrid/datagenerators/FeederGenerator.scala |  3 ++-
 .../usergrid/scenarios/AuditScenarios.scala       | 18 ++++++++----------
 .../org/apache/usergrid/settings/Settings.scala   | 10 +++++-----
 3 files changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/83d7a6f8/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 73b3d3c..38db19a 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
@@ -279,11 +279,12 @@ object FeederGenerator {
       val name = if (line != null) array(1) else ""
       val uuid = if (line != null) array(2) else ""
       val modified = if (line != null) array(3) else ""
+      val lastStatus = if (line != null) array(4) else ""
       //println(s"$collectionName|$name|$uuid|$modified")
       val accessField = if (uuid != "") uuid else name
       val queryField = if (uuid != "") s"uuid='$uuid'" else s"name='$name'"
 
-      Map("collectionName" -> collectionName, "name" -> name,  "uuid" -> uuid, 
"modified" -> modified,
+      Map("collectionName" -> collectionName, "name" -> name,  "uuid" -> uuid, 
"modified" -> modified, "lastStatus" -> lastStatus,
         "validEntity" -> validEntity, "accessField" -> accessField, 
"queryField" -> queryField)
     }
   }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/83d7a6f8/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 86c0b73..1ce2bc2 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
@@ -157,8 +157,7 @@ object AuditScenarios {
         val modified = session("modified").as[String].toLong
         val uuid = session("uuid").as[String]
         val reqName = session("name").as[String]
-        val prevStatus = session("status").as[Int]
-        val prevError = session("error").as[String]
+        val lastStatus = session("lastStatus").as[String]
         if (status == 200 || status == 404) {
           val collectionEntities = 
session(SessionVarCollectionEntities).as[Seq[Any]]
           val entityUuid = session(SessionVarEntityUuid).as[String]
@@ -166,12 +165,12 @@ object AuditScenarios {
 
           val count = collectionEntities.length
           if (count < 1) {
-            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, s"NotFoundAtAll", prevStatus, prevError)
+            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, s"NotFoundAtAll", lastStatus)
             Settings.incAuditNotFoundAtAll()
             println(s"NOT FOUND AT ALL: $collectionName.$reqName ($uuid)")
           } else if (count > 1) {
             // invalid
-            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, s"QueryInvalidCount$count", prevStatus, prevError)
+            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, s"QueryInvalidCount$count", lastStatus)
             Settings.incAuditBadResponse()
             println(s"INVALID RESPONSE (count=$count): 
$collectionName.$reqName ($uuid)")
           } else {
@@ -199,13 +198,13 @@ object AuditScenarios {
               println(s"PAYLOAD NAME MISMATCH (DIRECT): requestedName=$reqName 
returnedName=$entityName")
             }
 
-            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, errorString, prevStatus, prevError)
+            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, errorString, lastStatus)
             Settings.incAuditNotFoundViaQuery()
             println(s"NOT FOUND VIA QUERY: $collectionName.$reqName ($uuid)")
           }
           session
         } else if (saveFailures) {
-          Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, "Failure", prevStatus, prevError)
+          Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, "Failure", lastStatus)
           session
         } else {
           session.markAsFailed
@@ -227,8 +226,7 @@ object AuditScenarios {
         val uuid = session("uuid").as[String]
         val reqName = session("name").as[String]
         val modified = session("modified").as[String].toLong
-        val prevStatus = session("status").as[Int]
-        val prevError = session("error").as[String]
+        val lastStatus = session("lastStatus").as[String]
         val collectionName = session(SessionVarCollectionName).as[String]
         val entityUuid = session(SessionVarEntityUuid).as[String]
         val entityName = session(SessionVarEntityName).as[String]
@@ -236,7 +234,7 @@ object AuditScenarios {
         if (count < 1) {
           // will check to see whether accessible directly
         } else if (count > 1) {
-          Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, s"QueryInvalidCount$count", prevStatus, prevError)
+          Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, s"QueryInvalidCount$count", lastStatus)
           Settings.incAuditBadResponse()
           println(s"INVALID RESPONSE (count=$count): $collectionName.$reqName 
($uuid)")
         } else {
@@ -268,7 +266,7 @@ object AuditScenarios {
 
           // log even if technically successful -- we need to capture 
incorrect response
           if (errorString != errorPrefix) {
-            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, errorString, prevStatus, prevError)
+            Settings.addAuditUuid(uuid, collectionName, reqName, modified, 
status, errorString, lastStatus)
           }
           Settings.incAuditSuccess()
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/83d7a6f8/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 e0a0ec9..e27903a 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
@@ -291,10 +291,10 @@ object Settings {
   val purgeUsers:Int = initIntSetting(ConfigProperties.PurgeUsers)
 
   val uuidsHeader = "collection,name,uuid,modified,status"
-  val uuidsFailHeader = 
"collection,name,uuid,modified,status,error,prevStatus,prevError"
+  val uuidsFailHeader = "collection,name,uuid,modified,status,error,lastStatus"
   case class AuditList(var collection: String, var entityName: String, var 
uuid: String, var modified: Long, var status: Int)
   case class AuditFailList(var collection: String, var entityName: String, var 
uuid: String, var modified: Long,
-                           var status: Int, var error: String, var prevStatus: 
Int, var prevError: String)
+                           var status: Int, var error: String, var lastStatus: 
String)
 
   //private var uuidMap: Map[Int, String] = Map()
   private var uuidList: mutable.MutableList[AuditList] = 
mutable.MutableList[AuditList]()
@@ -383,10 +383,10 @@ object Settings {
   private var lastAuditEntityCountPrinted: Long = 0L
   private var auditUuidList: mutable.MutableList[AuditFailList] = 
mutable.MutableList[AuditFailList]()
   def addAuditUuid(uuid: String, collection: String, entityName: String, 
modified: Long, status: Int, error: String,
-                    prevStatus: Int, prevError: String): Unit = {
+                    lastStatus: String): Unit = {
     if (captureAuditUuids) {
       auditUuidList.synchronized {
-        auditUuidList += AuditFailList(collection, entityName, uuid, modified, 
status, error, prevStatus, prevError)
+        auditUuidList += AuditFailList(collection, entityName, uuid, modified, 
status, error, lastStatus)
         auditEntityCounter += 1L
         if (logEntityProgress && (auditEntityCounter >= 
lastAuditEntityCountPrinted + entityProgressCount)) {
           println(s"Entity: $auditEntityCounter")
@@ -406,7 +406,7 @@ object Settings {
       writer.println(uuidsFailHeader)
       val uuidList: List[AuditFailList] = auditUuidList.toList.sortBy(e => 
(e.collection, e.entityName, e.modified, e.status))
       uuidList.foreach { e =>
-        
writer.println(s"${e.collection},${e.entityName},${e.uuid},${e.modified},${e.status},${e.error},${e.prevStatus},${e.prevError}")
+        
writer.println(s"${e.collection},${e.entityName},${e.uuid},${e.modified},${e.status},${e.error},${e.lastStatus}")
       }
       writer.flush()
       writer.close()

Reply via email to