usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [1/3] incubator-usergrid git commit: USERGRID-871: add Apache comments + changes for modification date auditing
Date Mon, 03 Aug 2015 23:53:03 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 6ad32c363 -> 29f22332a


USERGRID-871: add Apache comments + changes for modification date auditing


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

Branch: refs/heads/two-dot-o-dev
Commit: a6939ccc9af485848a6cb2579792bde5a5762217
Parents: b038b46
Author: Mike Dunker <mdunker@apigee.com>
Authored: Mon Aug 3 16:10:39 2015 -0700
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Mon Aug 3 16:10:39 2015 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/enums/AuthType.scala    | 16 ++++++++++
 .../usergrid/enums/ConfigProperties.scala       | 16 ++++++++++
 .../usergrid/enums/EndConditionType.scala       | 16 ++++++++++
 .../org/apache/usergrid/enums/EntityType.scala  | 16 ++++++++++
 .../apache/usergrid/enums/ScenarioType.scala    | 16 ++++++++++
 .../org/apache/usergrid/enums/TokenType.scala   | 16 ++++++++++
 .../usergrid/scenarios/AuditScenarios.scala     | 32 ++++++++++++--------
 .../org/apache/usergrid/settings/Settings.scala | 24 ++++++++++-----
 .../src/test/resources/dummyAuditUuid.csv       |  2 +-
 9 files changed, 132 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 abbb204..13891fe 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
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * 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.
+ */
 package org.apache.usergrid.enums
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 75228a7..293cc9d 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
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * 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.
+ */
 package org.apache.usergrid.enums
 
 import java.util.Date

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 2d4bf63..6d77dd1 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,3 +1,19 @@
+/*
+ * 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
+ *
+ * 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.
+ */
 package org.apache.usergrid.enums
 
 object EndConditionType {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 214d48c..505dd4f 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,3 +1,19 @@
+/*
+ * 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
+ *
+ * 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.
+ */
 package org.apache.usergrid.enums
 
 object EntityType {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 76fae7b..6f9a20e 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,3 +1,19 @@
+/*
+ * 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
+ *
+ * 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.
+ */
 package org.apache.usergrid.enums
 
 object ScenarioType {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 456a9cb..99ed52a 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,3 +1,19 @@
+/*
+ * 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
+ *
+ * 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.
+ */
 package org.apache.usergrid.enums
 
 object TokenType {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 93440ac..eaf14a9 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
@@ -52,12 +52,14 @@ object AuditScenarios {
       .get(collectionGetUrl(false))
       .headers(Headers.authToken)
       .check(status.is(200), extractCollectionUuids(SessionVarCollectionUuids), maybeExtractCursor(SessionVarCursor)))
-      .foreach("${" + SessionVarCollectionUuids + "}", "singleUuid") {
+      .foreach("${" + SessionVarCollectionUuids + "}", "singleResult") {
         exec(session => {
-          val uuidObj = session("singleUuid").as[Map[String,Any]]
-          val uuid = uuidObj("uuid").asInstanceOf[String]
+          val resultObj = session("singleResult").as[Map[String,Any]]
+          val uuid = resultObj("uuid").asInstanceOf[String]
+          val entityName = resultObj("name").asInstanceOf[String]
+          val modified = resultObj("modified").asInstanceOf[Long]
           val collectionName = session(SessionVarCollectionName).as[String]
-          Settings.addAuditUuid(uuid, collectionName)
+          Settings.addAuditUuid(uuid, collectionName, entityName, modified)
           session
         })
       }
@@ -67,12 +69,14 @@ object AuditScenarios {
       .get(collectionGetUrl(true))
       .headers(Headers.authToken)
       .check(status.is(200), extractCollectionUuids(SessionVarCollectionUuids), maybeExtractCursor(SessionVarCursor)))
-      .foreach("${" + SessionVarCollectionUuids + "}", "singleUuid") {
+      .foreach("${" + SessionVarCollectionUuids + "}", "singleResult") {
         exec(session => {
-          val uuidObj = session("singleUuid").as[Map[String,Any]]
-          val uuid = uuidObj("uuid").asInstanceOf[String]
+          val resultObj = session("singleResult").as[Map[String,Any]]
+          val uuid = resultObj("uuid").asInstanceOf[String]
+          val entityName = resultObj("name").asInstanceOf[String]
+          val modified = resultObj("modified").asInstanceOf[Long]
           val collectionName = session(SessionVarCollectionName).as[String]
-          Settings.addAuditUuid(uuid, collectionName)
+          Settings.addAuditUuid(uuid, collectionName, entityName, modified)
           session
         })
       }
@@ -102,19 +106,21 @@ object AuditScenarios {
         .exec(session => {
           val count = session("count").as[String].toInt
           val uuid = session("uuid").as[String]
+          val entityName = session("name").as[String]
+          val modified = session("modified").as[Long]
           val collectionName = session(SessionVarCollectionName).as[String]
 
           // save items not found
           if (count < 1) {
-            Settings.addAuditUuid(uuid, collectionName)
+            Settings.addAuditUuid(uuid, collectionName, entityName, modified)
             Settings.incAuditNotFound()
-            println(s"NOT FOUND: $collectionName.$uuid")
+            println(s"NOT FOUND: $collectionName.$entityName $uuid")
           } else if (count > 1) {
-            Settings.addAuditUuid(uuid, collectionName)
+            Settings.addAuditUuid(uuid, collectionName, entityName, modified)
             Settings.incAuditBadResponse()
-            println(s"INVALID RESPONSE (count=$count): $collectionName.$uuid")
+            println(s"INVALID RESPONSE (count=$count): $collectionName.$entityName $uuid")
           } else {
-            // println(s"FOUND: $collectionName.$uuid")
+            // println(s"FOUND: $collectionName.$entityName $uuid")
             Settings.incAuditSuccess()
           }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/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 0714698..61231d5 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
@@ -25,6 +25,8 @@ import org.apache.usergrid.datagenerators.FeederGenerator
 import org.apache.usergrid.enums._
 import org.apache.usergrid.helpers.Utils
 
+import scala.collection.mutable
+
 object Settings {
 
   def initStrSetting(cfg: String): String = {
@@ -255,25 +257,31 @@ object Settings {
   }
 
 
-  val auditUuidsHeader = "collection,uuid"
+  val auditUuidsHeader = "collection,name,uuid,modified"
+
+  case class AuditList(var collection: String, var entityName: String, var uuid: String,
var modified: Long)
 
   // key: uuid, value: collection
-  private var auditUuidMap: Map[String,String] = Map()
-  def addAuditUuid(uuid: String, collection: String): Unit = {
-    if (captureAuditUuids) auditUuidMap += (uuid -> collection)
+  private var auditUuidList: mutable.MutableList[AuditList] = mutable.MutableList[AuditList]()
+  def addAuditUuid(uuid: String, collection: String, entityName: String, modified: Long):
Unit = {
+    if (captureAuditUuids) {
+      auditUuidList.synchronized {
+        auditUuidList += AuditList(collection, entityName, uuid, modified)
+      }
+    }
   }
 
   def writeAuditUuidsToFile(uuidDesc: String): Unit = {
     if (captureAuditUuids) {
-      println(s"Sorting and writing ${auditUuidMap.size} ${uuidDesc} UUIDs in CSV file ${captureAuditUuidFilename}")
+      println(s"Sorting and writing ${auditUuidList.size} $uuidDesc UUIDs in CSV file $captureAuditUuidFilename")
       val writer = {
         val fos = new FileOutputStream(captureAuditUuidFilename)
         new PrintWriter(fos, false)
       }
       writer.println(auditUuidsHeader)
-      val uuidList: List[(String, String)] = auditUuidMap.toList.sortBy(l => (l._2, l._1))
-      uuidList.foreach { l =>
-        writer.println(s"${l._2},${l._1}")
+      val uuidList: List[AuditList] = auditUuidList.toList.sortBy(e => (e.collection,
e.entityName, e.modified))
+      uuidList.foreach { e =>
+        writer.println(s"${e.collection},${e.entityName},${e.uuid},${e.modified}")
       }
       writer.flush()
       writer.close()

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6939ccc/stack/loadtests/src/test/resources/dummyAuditUuid.csv
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/test/resources/dummyAuditUuid.csv b/stack/loadtests/src/test/resources/dummyAuditUuid.csv
index fc9f2fb..6d81339 100644
--- a/stack/loadtests/src/test/resources/dummyAuditUuid.csv
+++ b/stack/loadtests/src/test/resources/dummyAuditUuid.csv
@@ -1 +1 @@
-collection,uuid
+collection,name,uuid,modified


Mime
View raw message