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

[01/10] git commit: moving user creation to setup

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o 795874e37 -> 2a0ed717a


moving user creation to setup


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

Branch: refs/heads/two-dot-o
Commit: 60055e47ee1d02dfdc8667fb7ccdb39424229909
Parents: e351179
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Nov 5 14:30:45 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Nov 5 14:30:45 2014 -0700

----------------------------------------------------------------------
 .../datagenerators/EntityDataGenerator.scala    |   5 +-
 .../org/apache/usergrid/helpers/Setup.scala     | 132 +++++++++++++++++++
 .../scenarios/NotificationScenarios.scala       |   8 +-
 .../usergrid/scenarios/UserScenarios.scala      |  18 ++-
 .../simulations/GeoProfileSimulation.scala      |  33 +++++
 .../PushNotificationTargetUserSimulation.scala  |  22 ++--
 6 files changed, 200 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60055e47/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 b0a4771..6917930 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
@@ -43,7 +43,7 @@ object EntityDataGenerator {
 
   def generateUser(userId: Int): Map[String,String] = {
 
-    return Map("username" -> "user".concat(userId.toString).concat(UUID.randomUUID().toString),
+    return Map("username" -> "user".concat(userId.toString),
       "profileId" -> Utils.generateRandomInt(10000, 1000000).toString,
       "displayName" -> Utils.generateRandomInt(10000, 1000000).toString,
       "showAge" -> Utils.generateRandomInt(0, 1).toString,
@@ -54,7 +54,8 @@ object EntityDataGenerator {
       "age" -> Utils.generateRandomInt(18, 65).toString,
       "height" -> Utils.generateRandomInt(48, 84).toString,
       "weight" -> Utils.generateRandomInt(120, 350).toString,
-      "seen" -> Utils.generateRandomInt(50, 100000).toString
+      "seen" -> Utils.generateRandomInt(50, 100000).toString,
+      "password" -> "password"
     )
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60055e47/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
new file mode 100644
index 0000000..8072be8
--- /dev/null
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/helpers/Setup.scala
@@ -0,0 +1,132 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.helpers
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.ning.http.client.AsyncHttpClient
+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.settings.{Settings, Headers}
+
+/**
+ * Classy class class.
+ */
+object Setup {
+  var token:String = null
+  def setupOrg(): Integer = {
+    val client = new AsyncHttpClient()
+
+    val createOrgPost = client
+      .preparePost(Settings.baseUrl + "/management/organizations")
+      .setBody("{\"organization\":\"" + Settings.org + "\",\"username\":\"" + Settings.admin + "\",\"name\":\"" + Settings.admin + "\",\"email\":\"" + Settings.admin + "@apigee.com\",\"password\":\"" + Settings.password + "\"}")
+      .setHeader("Cache-Control", "no-cache")
+      .setHeader("Content-Type", "application/json; charset=UTF-8")
+
+    val orgResponse = createOrgPost.execute().get();
+
+    return orgResponse.getStatusCode
+  }
+  def setupApplication():Integer = {
+    val client = new AsyncHttpClient()
+
+    val authToken = getManagementToken()
+    val createAppPost = client
+      .preparePost(Settings.baseUrl + "/management/organizations/"+Settings.org+"/applications")
+      .setBody("{\"name\":\"" + Settings.app + "\"}")
+      .setHeader("Cache-Control", "no-cache")
+      .setHeader("Content-Type", "application/json; charset=UTF-8")
+      .setHeader("Authorization","Bearer "+authToken)
+
+
+    val appResponse = createAppPost.execute().get();
+
+
+    return appResponse.getStatusCode
+  }
+
+  def setupNotifier():Integer = {
+    val client = new AsyncHttpClient()
+
+    val authToken = getManagementToken()
+    val createNotifier = client
+      .preparePost(Settings.baseAppUrl + "/notifiers")
+      .setBody("{\"name\":\"" + Settings.pushNotifier + "\",\"provider\":\"" + Settings.pushProvider + "\"}")
+      .setHeader("Cache-Control", "no-cache")
+      .setHeader("Content-Type", "application/json; charset=UTF-8")
+      .setHeader("Authorization","Bearer "+authToken)
+
+    val notifierResponse = createNotifier.execute().get();
+
+    return notifierResponse.getStatusCode
+  }
+
+  def getManagementToken():String = {
+//    if(token==null) {
+
+      val client = new AsyncHttpClient()
+      val getToken = client
+        .preparePost(Settings.baseUrl + "/management/token")
+        .setBody("{\"username\":\"" + Settings.admin + "\",\"password\":\"" + Settings.password + "\",\"grant_type\":\"password\"}")
+        .setHeader("Cache-Control", "no-cache")
+        .setHeader("Content-Type", "application/json; charset=UTF-8")
+      val body = getToken.execute().get().getResponseBody()
+      val omapper = new ObjectMapper();
+      val tree = omapper.readTree(body)
+      val node = tree.get("access_token");
+      token = node.toString
+//    }
+    return token
+  }
+
+  def setupUsers() = {
+    val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *  Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+    userFeeder.foreach(user => {
+      setupUser(user);
+    });
+
+  }
+
+  def setupUser(user:Map[String,String]):Integer = {
+
+    val client = new AsyncHttpClient()
+
+    val authToken = getManagementToken()
+    val createUser = client
+      .preparePost(Settings.baseAppUrl + "/users")
+      .setBody("{\"location\":{\"latitude\":\"" + user.get("latitude") + "\",\"longitude\":\"" + user.get("longitude") + "\"},\"username\":\"" + user.get("username") + "\"," +
+      "\"displayName\":\""+user.get("displayName")+"\",\"age\":\""+user.get("age")+"\",\"seen\":\""+user.get("seen")+"\",\"weight\":\""+user.get("weight")+"\"," +
+      "\"height\":\""+user.get("height")+"\",\"aboutMe\":\""+user.get("aboutMe")+"\",\"profileId\":\""+user.get("profileId")+"\",\"headline\":\""+user.get("headline")+"\"," +
+      "\"showAge\":\""+user.get("showAge")+"\",\"relationshipStatus\":\""+user.get("relationshipStatus")+"\",\"ethnicity\":\""+user.get("ethnicity")+"\",\"password\":\""+user.get("password")+"\"}"
+      )
+      .setHeader("Cache-Control", "no-cache")
+      .setHeader("Content-Type", "application/json; charset=UTF-8")
+      .setHeader("Authorization","Bearer "+authToken)
+
+    val createUserResponse = createUser.execute().get();
+
+    return createUserResponse.getStatusCode
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60055e47/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 8556845..40f5085 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
@@ -72,14 +72,8 @@ object NotificationScenarios {
   val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *  Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
 
   val createScenario = scenario("Create Push Notification")
-    .asLongAs(session=>session.get("applicationStatus")!="200" && session.get("notifierStatus")!="200"){
-      exec(TokenScenarios.getManagementToken)
-        .exec(ApplicationScenarios.checkApplication)
-        .exec(NotifierScenarios.checkNotifier)
-        .exec(session=>{session.remove("authToken")})
-    }
     .feed(userFeeder)
-    .exec( UserScenarios.postUser)
+    .exec( UserScenarios.getUserByUsername)
     .exec(TokenScenarios.getUserToken)
     .repeat(2){
     feed(FeederGenerator.generateEntityNameFeeder("device", numEntities))

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60055e47/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
index ae756dc..7a557e5 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
@@ -19,6 +19,7 @@
 import io.gatling.core.Predef._
  import io.gatling.http.Predef._
  import io.gatling.http.request.StringBody
+ import org.apache.usergrid.datagenerators.FeederGenerator
  import org.apache.usergrid.settings.{Headers, Settings, Utils}
 
  object UserScenarios {
@@ -49,5 +50,20 @@ import io.gatling.core.Predef._
       exec(getUserByUsername)
     }
 
+   val putUser = exec(
+     http("POST geolocated Users")
+       .put("/users")
+       .body(new StringBody( """{"location":{"latitude":"${latitude}","longitude":"${longitude}"},"username":"${username}",
+      "displayName":"${displayName}","age":"${age}","seen":"${seen}","weight":"${weight}",
+      "height":"${height}","aboutMe":"${aboutMe}","profileId":"${profileId}","headline":"${headline}",
+      "showAge":"${showAge}","relationshipStatus":"${relationshipStatus}","ethnicity":"${ethnicity}","password":"password"}"""))
+       .check(status.is(200), status.saveAs("userStatus"), jsonPath("$..entities[0].uuid").saveAs("userId"))
+   )
+     .doIf("${userStatus}", "400") {
+     exec(getUserByUsername)
+   }
+   val numEntities:Int = Settings.numEntities
+
+   val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *  Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
 
-}
+ }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60055e47/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
new file mode 100644
index 0000000..b8b8839
--- /dev/null
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/GeoProfileSimulation.scala
@@ -0,0 +1,33 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.simulations
+
+import io.gatling.core.Predef._
+import io.gatling.http.Predef._
+import org.apache.usergrid.scenarios.{OrganizationScenarios, UserScenarios}
+import org.apache.usergrid.settings.Settings
+
+/**
+ * Classy class class.
+ */
+class GeoProfileSimulation extends Simulation {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60055e47/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
index 67447e0..4c1de29 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
@@ -16,22 +16,28 @@
  */
 package org.apache.usergrid.simulations
 
+import com.ning.http.client.AsyncHttpClient
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import org.apache.usergrid.scenarios._
 import org.apache.usergrid.settings.Settings
 import scala.concurrent.duration._
+import org.apache.usergrid.helpers.Setup
 
 class PushNotificationTargetUserSimulation extends Simulation {
-  val scnToRun = NotificationScenarios.createScenario
-    .inject(constantUsersPerSec(Settings.numUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
-    .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
-    .protocols( Settings.httpConf.acceptHeader("application/json"))
 
-  val createOrg = OrganizationScenarios.createOrgScenario
-    .inject(atOnceUsers(1))
-    .protocols(http.baseURL(Settings.baseUrl))
 
-  setUp(createOrg,scnToRun)
+  before{
+    Setup.setupOrg()
+    Setup.setupApplication()
+    Setup.setupNotifier()
+    Setup.setupUsers()
+  }
+  setUp(
+    NotificationScenarios.createScenario
+      .inject(constantUsersPerSec(Settings.numUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
+      .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
+      .protocols( Settings.httpConf.acceptHeader("application/json"))
+  )
 
 }


[05/10] git commit: Merge branch 'key-row-sharding' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into key-row-sharding

Posted by sf...@apache.org.
Merge branch 'key-row-sharding' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into key-row-sharding


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

Branch: refs/heads/two-dot-o
Commit: 7d0cd3beb69f6f5027c2c62481ad8c33ac941805
Parents: 1b408c1 795874e
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 6 08:13:25 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 6 08:13:25 2014 -0700

----------------------------------------------------------------------
 .../dist/init_instance/init_graphite_server.sh  |   2 +
 .../main/dist/init_instance/init_rest_server.sh |   2 +-
 .../main/groovy/configure_elasticsearch.groovy  |   2 +
 .../src/main/groovy/configure_usergrid.groovy   |   8 +-
 stack/awscluster/ugcluster-cf.json              |   3 +
 .../corepersistence/CpEntityManager.java        |  12 +-
 .../corepersistence/CpEntityManagerFactory.java |  30 ++--
 .../HybridEntityManagerFactory.java             |  10 +-
 .../usergrid/persistence/EntityManager.java     |   6 +
 .../persistence/EntityManagerFactory.java       |  25 ++--
 .../cassandra/EntityManagerFactoryImpl.java     |  10 +-
 .../cassandra/EntityManagerImpl.java            |   6 +
 .../collection/EntityCollectionManager.java     |   6 +-
 .../impl/EntityCollectionManagerImpl.java       |   7 +-
 .../collection/EntityCollectionManagerIT.java   |   3 +-
 .../usergrid/persistence/core/util/Health.java  |  23 ++++
 .../usergrid/persistence/index/EntityIndex.java |  13 +-
 .../index/impl/EsEntityIndexImpl.java           |  58 +++++---
 .../index/impl/ElasticSearchResource.java       |   2 +-
 .../impl/EntityConnectionIndexImplTest.java     |  14 --
 .../persistence/index/impl/EntityIndexTest.java |  34 ++++-
 .../rest/JacksonCustomMapperProvider.java       |   7 +-
 .../org/apache/usergrid/rest/RootResource.java  |  42 +++++-
 .../rest/filters/HealthCheckFilter.java         |  67 ---------
 .../applications/ApplicationResource.java       | 136 +++++++++++++------
 stack/rest/src/main/webapp/WEB-INF/web.xml      |  10 --
 26 files changed, 308 insertions(+), 230 deletions(-)
----------------------------------------------------------------------



[10/10] git commit: logging

Posted by sf...@apache.org.
logging


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

Branch: refs/heads/two-dot-o
Commit: 2a0ed717af2f1159f1b88775bea6d22abbedf08c
Parents: 2da184c
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 6 08:50:12 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 6 08:50:12 2014 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/usergrid/settings/Settings.scala      | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a0ed717/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 401507f..76ca213 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
@@ -60,5 +60,6 @@ object Settings {
   val pushProvider = System.getProperty("pushProvider")
 
   val constantUsers:Int = Settings.numUsers/Settings.duration
+  println(s"Will inject $constantUsers users per sec")
 
 }


[04/10] git commit: adding new simulation

Posted by sf...@apache.org.
adding new simulation


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

Branch: refs/heads/two-dot-o
Commit: 1b408c19209e24741a0a5daeb3849a6e8723e0a2
Parents: cb43d81
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Nov 5 17:24:02 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Nov 5 17:24:02 2014 -0700

----------------------------------------------------------------------
 stack/loadtests/pom.xml                         |  2 +-
 .../usergrid/simulations/AppSimulation.scala    | 48 ++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1b408c19/stack/loadtests/pom.xml
----------------------------------------------------------------------
diff --git a/stack/loadtests/pom.xml b/stack/loadtests/pom.xml
index 1e5972b..363cfbc 100644
--- a/stack/loadtests/pom.xml
+++ b/stack/loadtests/pom.xml
@@ -148,7 +148,7 @@
 				<artifactId>gatling-maven-plugin</artifactId>
         <configuration>
           <simulationsFolder>src/main/scala</simulationsFolder>
-          <simulationClass>org.apache.usergrid.simulations.PushNotificationTargetUserSimulation</simulationClass>
+          <simulationClass>org.apache.usergrid.simulations.AppSimulation</simulationClass>
           <propagateSystemProperties>true</propagateSystemProperties>
         </configuration>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1b408c19/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
new file mode 100644
index 0000000..6567c91
--- /dev/null
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/AppSimulation.scala
@@ -0,0 +1,48 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.simulations
+
+import io.gatling.core.Predef._
+import io.gatling.core.scenario.Simulation
+import org.apache.usergrid.helpers.Setup
+import org.apache.usergrid.scenarios.NotificationScenarios
+import org.apache.usergrid.settings.Settings
+import scala.concurrent.duration._
+
+/**
+ * Classy class class.
+ */
+class AppSimulation extends Simulation{
+  before{
+    Setup.setupOrg()
+    Setup.setupApplication()
+    Setup.setupNotifier()
+    Setup.setupUsers()
+  }
+  setUp(
+    NotificationScenarios.createScenario
+      .inject(constantUsersPerSec(Settings.constantUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
+      .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
+      .protocols( Settings.httpConf.acceptHeader("application/json"))
+  )
+
+
+}


[09/10] git commit: make sure numUsers is divisible by duration

Posted by sf...@apache.org.
make sure numUsers is divisible by duration


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

Branch: refs/heads/two-dot-o
Commit: 2da184ce0fbee79a2d7836c1be4329a374d70319
Parents: b6a7fc0
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 6 08:49:06 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 6 08:49:06 2014 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/usergrid/settings/Settings.scala    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2da184ce/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 30cd4ab..401507f 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
@@ -46,6 +46,9 @@ object Settings {
     println(s"Changing numUsers $numUsers to duration length $duration")
     numUsers = duration
   }
+  if(numUsers % duration != 0){
+    throw new Exception(s"please use numUsers ($numUsers) that is evenly divisible by duration($duration)")
+  }
   // Geolocation settings
   val centerLatitude:Double = 37.442348 // latitude of center point
   val centerLongitude:Double = -122.138268 // longitude of center point


[03/10] git commit: new setup methodology

Posted by sf...@apache.org.
new setup methodology


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

Branch: refs/heads/two-dot-o
Commit: cb43d8173fcbf36b436c6f2c0c0570f0835188ac
Parents: 1c0f931
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Nov 5 17:21:06 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Nov 5 17:21:06 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/helpers/Setup.scala     | 96 +++++++++++++-------
 .../scenarios/NotificationScenarios.scala       |  5 +-
 .../usergrid/scenarios/UserScenarios.scala      |  3 -
 .../org/apache/usergrid/settings/Settings.scala |  3 +
 .../PushNotificationTargetUserSimulation.scala  |  2 +-
 5 files changed, 68 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb43d817/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 8072be8..bb1ae51 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,8 +20,10 @@
 
 package org.apache.usergrid.helpers
 
+import java.util
+
 import com.fasterxml.jackson.databind.ObjectMapper
-import com.ning.http.client.AsyncHttpClient
+import com.ning.http.client.{ListenableFuture, AsyncHttpClient,Response}
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import io.gatling.http.request.StringBody
@@ -29,26 +31,28 @@ import io.gatling.jsonpath.JsonPath
 import org.apache.usergrid.datagenerators.FeederGenerator
 import org.apache.usergrid.settings.{Settings, Headers}
 
+import scala.collection.mutable.ArrayBuffer
+
 /**
  * Classy class class.
  */
 object Setup {
   var token:String = null
+  val client = new AsyncHttpClient()
+
   def setupOrg(): Integer = {
-    val client = new AsyncHttpClient()
 
     val createOrgPost = client
       .preparePost(Settings.baseUrl + "/management/organizations")
-      .setBody("{\"organization\":\"" + Settings.org + "\",\"username\":\"" + Settings.admin + "\",\"name\":\"" + Settings.admin + "\",\"email\":\"" + Settings.admin + "@apigee.com\",\"password\":\"" + Settings.password + "\"}")
-      .setHeader("Cache-Control", "no-cache")
+       .setHeader("Cache-Control", "no-cache")
       .setHeader("Content-Type", "application/json; charset=UTF-8")
-
-    val orgResponse = createOrgPost.execute().get();
-
+      .setBody("{\"organization\":\"" + Settings.org + "\",\"username\":\"" + Settings.admin + "\",\"name\":\"" + Settings.admin + "\",\"email\":\"" + Settings.admin + "@apigee.com\",\"password\":\"" + Settings.password + "\"}")
+    .build()
+    val orgResponse = client.executeRequest(createOrgPost).get()
+    printResponse("POST ORG",orgResponse.getStatusCode,orgResponse.getResponseBody())
     return orgResponse.getStatusCode
   }
   def setupApplication():Integer = {
-    val client = new AsyncHttpClient()
 
     val authToken = getManagementToken()
     val createAppPost = client
@@ -57,16 +61,15 @@ object Setup {
       .setHeader("Cache-Control", "no-cache")
       .setHeader("Content-Type", "application/json; charset=UTF-8")
       .setHeader("Authorization","Bearer "+authToken)
+      .build()
 
-
-    val appResponse = createAppPost.execute().get();
-
+    val appResponse = client.executeRequest(createAppPost).get();
+    printResponse("POST Application",appResponse.getStatusCode, appResponse.getResponseBody())
 
     return appResponse.getStatusCode
   }
 
   def setupNotifier():Integer = {
-    val client = new AsyncHttpClient()
 
     val authToken = getManagementToken()
     val createNotifier = client
@@ -75,57 +78,82 @@ object Setup {
       .setHeader("Cache-Control", "no-cache")
       .setHeader("Content-Type", "application/json; charset=UTF-8")
       .setHeader("Authorization","Bearer "+authToken)
+      .build()
 
-    val notifierResponse = createNotifier.execute().get();
+    val notifierResponse = client.executeRequest(createNotifier).get();
+    printResponse("POST Notifier", notifierResponse.getStatusCode ,notifierResponse.getResponseBody())
 
     return notifierResponse.getStatusCode
   }
 
   def getManagementToken():String = {
-//    if(token==null) {
-
-      val client = new AsyncHttpClient()
+    if(token == null) {
       val getToken = client
         .preparePost(Settings.baseUrl + "/management/token")
         .setBody("{\"username\":\"" + Settings.admin + "\",\"password\":\"" + Settings.password + "\",\"grant_type\":\"password\"}")
         .setHeader("Cache-Control", "no-cache")
         .setHeader("Content-Type", "application/json; charset=UTF-8")
-      val body = getToken.execute().get().getResponseBody()
+        .build()
+      val response = client.executeRequest(getToken).get()
       val omapper = new ObjectMapper();
-      val tree = omapper.readTree(body)
+      val tree = omapper.readTree(response.getResponseBody())
       val node = tree.get("access_token");
-      token = node.toString
-//    }
+      token = node.asText()
+      println("Token is "+token)
+    }
     return token
   }
 
   def setupUsers() = {
-    val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *  Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+    val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers * Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+    val list:ArrayBuffer[ListenableFuture[Response]] = new ArrayBuffer[ListenableFuture[Response]]
     userFeeder.foreach(user => {
-      setupUser(user);
+      list += setupUser(user);
     });
+    list.foreach(f => {
+      val response = f.get()
+      printResponse("Post user",response.getStatusCode,response.getResponseBody())
+    })
 
   }
 
-  def setupUser(user:Map[String,String]):Integer = {
-
-    val client = new AsyncHttpClient()
+  def setupUser(user:Map[String,String]):ListenableFuture[Response] = {
+
+    val latitude = user.get("latitude").get
+    val longitude = user.get("longitude").get
+    val username = user.get("username").get
+    val displayName = user.get("displayName").get
+    val age = user.get("age").get
+    val seen = user.get("seen").get
+    val weight = user.get("weight").get
+    val height = user.get("height").get
+    val aboutMe = user.get("aboutMe").get
+    val profileId = user.get("profileId").get
+    val headline = user.get("headline").get
+    val showAge = user.get("showAge").get
+    val relationshipStatus = user.get("relationshipStatus").get
+    val ethnicity = user.get("ethnicity").get
+    val password= user.get("password").get
+    val body = s"""{"location":{"latitude":"$latitude","longitude":"$longitude"},"username":"$username",
+      "displayName":"$displayName","age":"$age","seen":"$seen","weight":"$weight",
+      "height":"$height","aboutMe":"$aboutMe","profileId":"$profileId","headline":"$headline",
+      "showAge":"$showAge","relationshipStatus":"$relationshipStatus","ethnicity":"$ethnicity","password":"$password"}"""
 
     val authToken = getManagementToken()
     val createUser = client
       .preparePost(Settings.baseAppUrl + "/users")
-      .setBody("{\"location\":{\"latitude\":\"" + user.get("latitude") + "\",\"longitude\":\"" + user.get("longitude") + "\"},\"username\":\"" + user.get("username") + "\"," +
-      "\"displayName\":\""+user.get("displayName")+"\",\"age\":\""+user.get("age")+"\",\"seen\":\""+user.get("seen")+"\",\"weight\":\""+user.get("weight")+"\"," +
-      "\"height\":\""+user.get("height")+"\",\"aboutMe\":\""+user.get("aboutMe")+"\",\"profileId\":\""+user.get("profileId")+"\",\"headline\":\""+user.get("headline")+"\"," +
-      "\"showAge\":\""+user.get("showAge")+"\",\"relationshipStatus\":\""+user.get("relationshipStatus")+"\",\"ethnicity\":\""+user.get("ethnicity")+"\",\"password\":\""+user.get("password")+"\"}"
-      )
-      .setHeader("Cache-Control", "no-cache")
-      .setHeader("Content-Type", "application/json; charset=UTF-8")
+      .setBody(body)
+      .setBodyEncoding("UTF-8")
       .setHeader("Authorization","Bearer "+authToken)
+      .build()
+
+    return client.executeRequest(createUser)
 
-    val createUserResponse = createUser.execute().get();
 
-    return createUserResponse.getStatusCode
+  }
+
+  def printResponse(caller:String, status:Int, body:String) = {
+    println(caller + ": status: "+status.toString+" body:"+body)
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb43d817/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 40f5085..b248260 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
@@ -68,13 +68,12 @@ object NotificationScenarios {
   )
 
   val numEntities:Int = Settings.numUsers * 3 * Settings.duration
-
-  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *  Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+  val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
 
   val createScenario = scenario("Create Push Notification")
     .feed(userFeeder)
-    .exec( UserScenarios.getUserByUsername)
     .exec(TokenScenarios.getUserToken)
+    .exec( UserScenarios.getUserByUsername)
     .repeat(2){
     feed(FeederGenerator.generateEntityNameFeeder("device", numEntities))
       .exec( DeviceScenarios.postDeviceWithNotifier)

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb43d817/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
index 7a557e5..86d1f78 100755
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/UserScenarios.scala
@@ -62,8 +62,5 @@ import io.gatling.core.Predef._
      .doIf("${userStatus}", "400") {
      exec(getUserByUsername)
    }
-   val numEntities:Int = Settings.numEntities
-
-   val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers *  Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
 
  }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb43d817/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 5c7852b..90dd41d 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
@@ -18,6 +18,7 @@ package org.apache.usergrid.settings
 
 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
+import org.apache.usergrid.datagenerators.FeederGenerator
 import scala.concurrent.duration._
 
 object Settings {
@@ -50,4 +51,6 @@ object Settings {
   val pushNotifier = System.getProperty("pushNotifier")
   val pushProvider = System.getProperty("pushProvider")
 
+  val constantUsers:Int = Settings.numUsers/Settings.duration
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cb43d817/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
index 4c1de29..510cee1 100644
--- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
+++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/PushNotificationTargetUserSimulation.scala
@@ -35,7 +35,7 @@ class PushNotificationTargetUserSimulation extends Simulation {
   }
   setUp(
     NotificationScenarios.createScenario
-      .inject(constantUsersPerSec(Settings.numUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
+      .inject(constantUsersPerSec(Settings.constantUsers) during (Settings.duration)) // wait for 15 seconds so create org can finish, need to figure out coordination
       .throttle(reachRps(Settings.throttle) in ( Settings.rampTime.seconds))
       .protocols( Settings.httpConf.acceptHeader("application/json"))
   )


[02/10] git commit: Merge branch 'key-row-sharding' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into key-row-sharding

Posted by sf...@apache.org.
Merge branch 'key-row-sharding' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into key-row-sharding


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

Branch: refs/heads/two-dot-o
Commit: 1c0f9313d27e96833bf1ade13b3cf0bf90a2dc25
Parents: 60055e4 c3f01dc
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Nov 5 14:31:08 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Nov 5 14:31:08 2014 -0700

----------------------------------------------------------------------
 stack/awscluster/assembly.xml                   |   8 +-
 stack/awscluster/pom.xml                        | 379 +++++++++++--------
 .../main/dist/init_instance/init_rest_server.sh |  12 +
 stack/awscluster/src/main/dist/update.sh        |  16 +-
 .../main/groovy/configure_elasticsearch.groovy  |  47 ++-
 .../src/main/groovy/configure_usergrid.groovy   |   5 +-
 stack/awscluster/ugcluster-cf.json              |  10 +-
 stack/pom.xml                                   |  10 +-
 8 files changed, 304 insertions(+), 183 deletions(-)
----------------------------------------------------------------------



[07/10] git commit: remove sets of users

Posted by sf...@apache.org.
remove sets of users


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

Branch: refs/heads/two-dot-o
Commit: 7f7c93687e6f705eae9288b444711f9140a2955d
Parents: 00d8347
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 6 08:37:42 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 6 08:37:42 2014 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/usergrid/helpers/Setup.scala     | 6 ++++--
 .../scala/org/apache/usergrid/simulations/AppSimulation.scala  | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7f7c9368/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 bb1ae51..3782726 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,7 +105,10 @@ object Setup {
   }
 
   def setupUsers() = {
-    val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers * Settings.duration, Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+    val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers , Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
+    val numUsers = userFeeder.length
+    println(s"Sending requests for $numUsers users")
+
     val list:ArrayBuffer[ListenableFuture[Response]] = new ArrayBuffer[ListenableFuture[Response]]
     userFeeder.foreach(user => {
       list += setupUser(user);
@@ -138,7 +141,6 @@ object Setup {
       "displayName":"$displayName","age":"$age","seen":"$seen","weight":"$weight",
       "height":"$height","aboutMe":"$aboutMe","profileId":"$profileId","headline":"$headline",
       "showAge":"$showAge","relationshipStatus":"$relationshipStatus","ethnicity":"$ethnicity","password":"$password"}"""
-
     val authToken = getManagementToken()
     val createUser = client
       .preparePost(Settings.baseAppUrl + "/users")

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7f7c9368/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 6567c91..aa246a4 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,10 +32,12 @@ import scala.concurrent.duration._
  */
 class AppSimulation extends Simulation{
   before{
+    println("Begin setup")
     Setup.setupOrg()
     Setup.setupApplication()
     Setup.setupNotifier()
     Setup.setupUsers()
+    println("End Setup")
   }
   setUp(
     NotificationScenarios.createScenario


[06/10] git commit: change default simulation

Posted by sf...@apache.org.
change default simulation


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

Branch: refs/heads/two-dot-o
Commit: 00d8347b9cacd97d78e664b5bde520e7d757dc67
Parents: 7d0cd3b
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 6 08:27:21 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 6 08:27:21 2014 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/usergrid/settings/Settings.scala    | 7 ++++++-
 stack/loadtests/src/test/scala/Engine.scala                   | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/00d8347b/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 90dd41d..30cd4ab 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
@@ -33,7 +33,8 @@ object Settings {
   val httpConf = http.baseURL(baseAppUrl)
 
   // Simulation settings
-  val numUsers:Int = Integer.getInteger("numUsers", 10).toInt
+  var numUsers:Int = Integer.getInteger("numUsers", 10).toInt
+
   val numEntities:Int = Integer.getInteger("numEntities", 5000).toInt
   val numDevices:Int = Integer.getInteger("numDevices", 2000).toInt
 
@@ -41,6 +42,10 @@ object Settings {
   val duration:Int = Integer.getInteger("duration", 300).toInt // in seconds
   val throttle:Int = Integer.getInteger("throttle", 50).toInt // in seconds
 
+  if(numUsers<duration){
+    println(s"Changing numUsers $numUsers to duration length $duration")
+    numUsers = duration
+  }
   // Geolocation settings
   val centerLatitude:Double = 37.442348 // latitude of center point
   val centerLongitude:Double = -122.138268 // longitude of center point

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/00d8347b/stack/loadtests/src/test/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/stack/loadtests/src/test/scala/Engine.scala b/stack/loadtests/src/test/scala/Engine.scala
index 00f1004..543674a 100644
--- a/stack/loadtests/src/test/scala/Engine.scala
+++ b/stack/loadtests/src/test/scala/Engine.scala
@@ -26,7 +26,7 @@ object Engine extends App {
 	props.requestBodiesDirectory(IDEPathHelper.requestBodiesDirectory.toString)
 	props.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
 
-  props.simulationClass("org.apache.usergrid.simulations.PushNotificationTargetUserSimulation")
+  props.simulationClass("org.apache.usergrid.simulations.AppSimulation")
 
 	Gatling.fromMap(props.build)
 }


[08/10] git commit: better logging

Posted by sf...@apache.org.
better logging


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

Branch: refs/heads/two-dot-o
Commit: b6a7fc0b403b995c0f3e428c61de241fe076d89c
Parents: 7f7c936
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 6 08:43:13 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 6 08:43:13 2014 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/usergrid/helpers/Setup.scala    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b6a7fc0b/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 3782726..96ce1c9 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
@@ -107,16 +107,22 @@ object Setup {
   def setupUsers() = {
     val userFeeder = FeederGenerator.generateUserWithGeolocationFeeder(Settings.numUsers , Settings.userLocationRadius, Settings.centerLatitude, Settings.centerLongitude)
     val numUsers = userFeeder.length
-    println(s"Sending requests for $numUsers users")
+    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()
-      printResponse("Post user",response.getStatusCode,response.getResponseBody())
+      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.")
 
   }