You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/11/11 00:21:56 UTC

[31/42] incubator-usergrid git commit: move skip setup to setup methods

move skip setup to setup methods


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

Branch: refs/heads/es-type-updates
Commit: ce011f18d707def785d4daa1a6296ad8cf0eeb91
Parents: b78ce8b
Author: Shawn Feldman <sf...@apache.org>
Authored: Fri Nov 7 09:40:42 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Fri Nov 7 09:40:42 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/helpers/Setup.scala     | 41 +++++++++++---------
 .../usergrid/simulations/AppSimulation.scala    | 16 +++-----
 2 files changed, 28 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ce011f18/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 3a3a9c5..0762feb 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
@@ -105,25 +105,28 @@ object Setup {
   }
 
   def setupUsers() = {
-    val userFeeder = Settings.userFeeder
-    val numUsers = userFeeder.length
-    println(s"setupUsers: Sending requests for $numUsers users")
-
-    val list:ArrayBuffer[ListenableFuture[Response]] = new ArrayBuffer[ListenableFuture[Response]]
-    userFeeder.foreach(user => {
-      list += setupUser(user);
-    });
-    var successCount:Int = 0;
-    list.foreach(f => {
-      val response = f.get()
-      if(response.getStatusCode != 200) {
-        printResponse("Post User", response.getStatusCode, response.getResponseBody())
-      }else{
-        successCount+=1
-      }
-    })
-    println(s"setupUsers: Received $successCount successful responses out of $numUsers requests.")
-
+    if (!Settings.skipSetup) {
+      val userFeeder = Settings.userFeeder
+      val numUsers = userFeeder.length
+      println(s"setupUsers: Sending requests for $numUsers users")
+
+      val list: ArrayBuffer[ListenableFuture[Response]] = new ArrayBuffer[ListenableFuture[Response]]
+      userFeeder.foreach(user => {
+        list += setupUser(user);
+      });
+      var successCount: Int = 0;
+      list.foreach(f => {
+        val response = f.get()
+        if (response.getStatusCode != 200) {
+          printResponse("Post User", response.getStatusCode, response.getResponseBody())
+        } else {
+          successCount += 1
+        }
+      })
+      println(s"setupUsers: Received $successCount successful responses out of $numUsers requests.")
+    } else {
+      println("Skipping Adding Users due to skipSetup=true")
+    }
   }
 
   def setupUser(user:Map[String,String]):ListenableFuture[Response] = {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ce011f18/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
index fb2f8cf..48fff1c 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
@@ -32,17 +32,13 @@ import scala.concurrent.duration._
  * Classy class class.
  */
 class AppSimulation extends Simulation {
+  println("Begin setup")
+  Setup.setupOrg()
+  Setup.setupApplication()
+  Setup.setupNotifier()
+  Setup.setupUsers()
+  println("End Setup")
 
-  if(!Settings.skipSetup) {
-    println("Begin setup")
-    Setup.setupOrg()
-    Setup.setupApplication()
-    Setup.setupNotifier()
-    Setup.setupUsers()
-    println("End Setup")
-  }else{
-    println("Skipping Setup")
-  }
   setUp(
     NotificationScenarios.createScenario
       .inject(constantUsersPerSec(Settings.constantUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination