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 2015/07/08 19:36:56 UTC

incubator-usergrid git commit: Updates tests to be cleaner.

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-752 b14a9ae14 -> b2e1fe686


Updates tests to be cleaner.

Fixes stack trace on exception


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

Branch: refs/heads/USERGRID-752
Commit: b2e1fe686a11f87e0de4abbe043e7bb28f9f6083
Parents: b14a9ae
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Jul 8 11:36:53 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Jul 8 11:36:53 2015 -0600

----------------------------------------------------------------------
 .../main/resources/usergrid-default.properties  |  2 +-
 .../query/ir/result/GatherIterator.java         |  2 +-
 .../collection/activities/OrderByTest.java      | 24 ++++++++++++++------
 3 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b2e1fe68/stack/config/src/main/resources/usergrid-default.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/main/resources/usergrid-default.properties b/stack/config/src/main/resources/usergrid-default.properties
index 0a4f218..1aeb67f 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -32,7 +32,7 @@
 cassandra.url=localhost:9160
 
 # The number of thrift connections to open per cassandra node.
-cassandra.connections=50
+cassandra.connections=100
 
 # Name of Cassandra cluster
 cassandra.cluster=Test Cluster

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b2e1fe68/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GatherIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GatherIterator.java b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GatherIterator.java
index f4ffcd2..4187ae0 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GatherIterator.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GatherIterator.java
@@ -93,7 +93,7 @@ public class GatherIterator implements ResultIterator {
                 future.get();
             }
             catch ( Exception e ) {
-                throw new RuntimeException( "Unable to aggregate results" );
+                throw new RuntimeException( "Unable to aggregate results", e );
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b2e1fe68/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/OrderByTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/OrderByTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/OrderByTest.java
index c9e0143..23c3e23 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/OrderByTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/OrderByTest.java
@@ -89,20 +89,30 @@ public class OrderByTest extends AbstractRestIT {
         props.put( "verb", "go" );
         props.put( "content", "bragh" );
 
+        final List<JsonNode> saved = new ArrayList<JsonNode>( 20  );
+
         for ( int i = 0; i < 20; i++ ) {
             props.put( "ordinal", i );
             JsonNode activity = activities.create( props );
+
+            saved.add( getEntity( activity, 0 ) );
         }
 
         String query = "select * where created > " + 1 + " order by created desc";
 
-        JsonNode incorrectNode = activities.withQuery( query ).withLimit( 5 ).get();
+        JsonNode results = activities.withQuery( query ).withLimit( 5 ).get();
+
+        assertEquals( 5, results.get( "entities" ).size() );
+
 
-        assertEquals( 5, incorrectNode.get( "entities" ).size() );
 
         while ( checkResultsNum < 5 ) {
-            assertEquals( activities.entityIndex( query, checkResultsNum ),
-                    activities.entityIndexLimit( query, 5, checkResultsNum ) );
+
+
+            final JsonNode expected = saved.get( saved.size() - checkResultsNum -1 );
+            final JsonNode returned = getEntity( results, checkResultsNum  );
+
+            assertEquals(expected , returned);
             checkResultsNum++;
         }
     }
@@ -119,7 +129,7 @@ public class OrderByTest extends AbstractRestIT {
 
         CustomCollection activities = context.collection( "activities" );
 
-        int size = 200;
+        int size = 50;
 
         Map<String, String> actor = hashMap( "displayName", "Erin" );
         Map<String, Object> props = new HashMap<String, Object>();
@@ -138,12 +148,12 @@ public class OrderByTest extends AbstractRestIT {
 
         long lastCreated = activites.get( activites.size() - 1 ).get( "created" ).asLong();
 
-        String errorQuery = String.format( "select * where created <= %d order by created desc", lastCreated );
+        String query = String.format( "select * where created <= %d order by created desc", lastCreated );
         String cursor = null;
         int index = size - 1;
 
         do {
-            JsonNode response = activities.withQuery( errorQuery ).get();
+            JsonNode response = activities.withQuery( query ).get();
             JsonNode cursorNode = response.get( "cursor" );
 
             cursor = cursorNode != null ? cursorNode.asText() : null;