usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [30/50] [abbrv] incubator-usergrid git commit: [USERGRID-686] Added fixes to make collections only use the graph search if they are doing direct searches using select *. Adding queries to order results back for PagingResourceIT.
Date Mon, 01 Jun 2015 21:48:39 GMT
[USERGRID-686] Added fixes to make collections only use the graph search if they are doing
direct searches using select *. Adding queries to order results back for PagingResourceIT.


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

Branch: refs/heads/USERGRID-628
Commit: 38472b6b507a2384877a67492e56b5c6e6a75991
Parents: 68833ad
Author: GERey <greyes@apigee.com>
Authored: Fri May 29 12:58:40 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Fri May 29 12:58:40 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/usergrid/persistence/Query.java   |  2 +-
 .../collection/paging/PagingResourceIT.java           | 14 +++++++++++---
 .../usergrid/rest/management/OrganizationsIT.java     |  5 +++++
 .../rest/test/resource2point0/ClientSetup.java        |  6 +++---
 .../rest/test/resource2point0/model/Organization.java |  4 +++-
 5 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/38472b6b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
index a4cccbc..b81d451 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
@@ -854,7 +854,7 @@ public class Query {
      * @return
      */
     public boolean isGraphSearch(){
-        return ql == null;
+        return ql == null || ql.trim().equals( "select *" );
     }
 
     public Query setQl( String ql ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/38472b6b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
index 3613357..d83ba7b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
@@ -146,7 +146,10 @@ public class PagingResourceIT extends AbstractRestIT {
         createEntities( collectionName, numOfEntities );
 
         //checks to make sure we have a cursor
-        pageAndVerifyEntities( collectionName,null,numOfPages, numOfEntities );
+        //pages through entities and verifies that they are correct.
+        QueryParameters queryParameters = new QueryParameters();
+        queryParameters.setQuery( "select * ORDER BY created" );
+        pageAndVerifyEntities( collectionName,queryParameters,numOfPages, numOfEntities );
 
         //Create new collection of only 5 entities
         String trinketCollectionName = "trinkets" ;
@@ -155,7 +158,10 @@ public class PagingResourceIT extends AbstractRestIT {
         createEntities( trinketCollectionName, numOfEntities );
 
         //checks to make sure we don't get a cursor for just 5 entities.
-        pageAndVerifyEntities( trinketCollectionName,null,numOfPages, numOfEntities );
+        //Created a new query parameter because when generated it store the cursor token
back into it. 
+        queryParameters = new QueryParameters();
+        queryParameters.setQuery( "select * ORDER BY created" );
+        pageAndVerifyEntities( trinketCollectionName,queryParameters,numOfPages, numOfEntities
);
 
     }
 
@@ -174,7 +180,9 @@ public class PagingResourceIT extends AbstractRestIT {
         createEntities( collectionName,numOfEntities );
 
         //pages through entities and verifies that they are correct.
-        pageAndVerifyEntities( collectionName,null,numOfPages,numOfEntities);
+        QueryParameters queryParameters = new QueryParameters();
+        queryParameters.setQuery( "select * ORDER BY created" );
+        pageAndVerifyEntities( collectionName, queryParameters, numOfPages, numOfEntities
);
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/38472b6b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
index f44886b..0fbf5ef 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
@@ -72,6 +72,9 @@ public class OrganizationsIT extends AbstractRestIT {
 
         assertNotNull( organizationResponse );
 
+//        Thread.sleep( 1000 );
+//        this.refreshIndex();
+
         //Creates token
         Token token =
                 clientSetup.getRestClient().management().token().post(Token.class, new Token(
"password",
@@ -79,6 +82,8 @@ public class OrganizationsIT extends AbstractRestIT {
 
         assertNotNull( token );
 
+        //this.refreshIndex();
+
         //Assert that the get returns the correct org and owner.
         Organization returnedOrg = clientSetup.getRestClient().management().orgs().organization(
organization.getOrganization()).get();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/38472b6b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
index c712605..c5c7a83 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
@@ -119,15 +119,15 @@ public class ClientSetup implements TestRule {
         organization = restClient.management().orgs()
                                  .post( new Organization( orgName, username, username + "@usergrid.com",
username,
                                      username, null ) );
-        refreshIndex();
+       // refreshIndex();
         clientCredentials = restClient.management().orgs().organization( orgName ).credentials().get();
-        refreshIndex();
+        //refreshIndex();
 
         //restClient.management().token().post(Token.class,new Token(username,password));
 
         ApiResponse appResponse = restClient.management().orgs().organization(organization.getName()).app().post(new
Application(appName));
         appUuid = ( String ) appResponse.getEntities().get( 0 ).get( "uuid" );
-        refreshIndex();
+        //refreshIndex();
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/38472b6b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
index 5487bda..f9e1b84 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
@@ -107,7 +107,9 @@ public class Organization extends Entity {
         LinkedHashMap orgHashMap = ( LinkedHashMap ) response.getProperties().get( "organization"
);
         LinkedHashMap userHashMap = (LinkedHashMap) orgHashMap.get( "users" );
         //this gets the first value in the users entities and returns it .
-        this.user = new User( ( Map<String, Object> ) userHashMap.get( userHashMap.keySet().iterator().next()
) ); //new User().mapOrgGetResponse(orgHashMap.get( "users" ));
+        if(userHashMap.keySet().iterator().hasNext())
+            this.user = new User( ( Map<String, Object> ) userHashMap.get( userHashMap.keySet().iterator().next()
) );
+        //new User().mapOrgGetResponse(orgHashMap.get( "users" ));
     }
 
     public Organization mapOrgResponse(Map<String,Object> map){


Mime
View raw message