usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [23/35] git commit: Fix for BasicIT failure.
Date Wed, 01 Oct 2014 14:51:59 GMT
Fix for BasicIT failure.


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

Branch: refs/heads/two-dot-o-rebuildable-index
Commit: 4f68f7207bc3827e817f90fc2184dc649200d7a8
Parents: 009a184
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Mon Sep 29 14:10:11 2014 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Mon Sep 29 14:10:11 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/CpRelationManager.java      |  6 ++--
 .../persistence/index/impl/EsQueryVistor.java   |  3 +-
 .../java/org/apache/usergrid/rest/BasicIT.java  | 34 ++++++++++++++------
 3 files changed, 31 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4f68f720/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index 0345e23..3486fbc 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -1627,6 +1627,8 @@ public class CpRelationManager implements RelationManager {
 
     private Results buildResults(Query query, CandidateResults crs, String collName ) {
 
+        logger.debug("buildResults() for {} from {} candidates", collName, crs.size());
+
         Results results = null;
 
         if ( query.getLevel().equals( Level.IDS )) {
@@ -1700,7 +1702,7 @@ public class CpRelationManager implements RelationManager {
                     logger.debug("Stale version of Entity uuid:{} type:{}, stale v:{}, latest
v:{}", 
                         new Object[] { cr.getId().getUuid(), cr.getId().getType(), 
                             cr.getVersion(), e.getVersion()});
-                continue;
+                    continue;
                 }
 
                 org.apache.usergrid.persistence.model.entity.Entity alreadySeen = 
@@ -1741,7 +1743,7 @@ public class CpRelationManager implements RelationManager {
         results.setCursor( crs.getCursor() );
         results.setQueryProcessor( new CpQueryProcessor(em, query, headEntity, collName)
);
 
-        logger.debug("Returning results size {}", results.getIds().size() );
+        logger.debug("Returning results size {}", results.size() );
 
         return results;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4f68f720/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
index 4f9cd60..5634183 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
@@ -214,6 +214,7 @@ public class EsQueryVistor implements QueryVisitor {
             String svalue = (String)value;
 
             BoolQueryBuilder qb = QueryBuilders.boolQuery();  // let's do a boolean OR
+            qb.minimumNumberShouldMatch(1); 
 
             // field is an entity/array that does not need a prefix on its name
             qb = qb.should( QueryBuilders.wildcardQuery( name, svalue ) );
@@ -264,7 +265,6 @@ public class EsQueryVistor implements QueryVisitor {
 
         // logic to deal with nested property names
         // only add prefix to last name in property
-
         String[] parts = origname.split("\\.");
         if ( parts.length > 1 ) {
             name = parts[ parts.length - 1 ];
@@ -286,6 +286,7 @@ public class EsQueryVistor implements QueryVisitor {
             name = addStringPrefix( name );
         }
 
+        // re-create nested property name 
         if ( parts.length > 1 ) {
             parts[parts.length - 1] = name;
             Joiner joiner = Joiner.on(".").skipNulls();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4f68f720/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
index ec30753..473052d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
@@ -230,7 +230,8 @@ public class BasicIT extends AbstractRestIT {
 
         err_thrown = false;
         try {
-            node = mapper.readTree( resource().path( "/test-organization/test-app/users"
).accept( MediaType.APPLICATION_JSON )
+            node = mapper.readTree( resource().path( "/test-organization/test-app/users"
)
+                    .accept( MediaType.APPLICATION_JSON )
                     .get( String.class ));
         }
         catch ( UniformInterfaceException e ) {
@@ -241,8 +242,10 @@ public class BasicIT extends AbstractRestIT {
 
         // test login app user with pin
 
-        node = mapper.readTree( resource().path( "/test-organization/test-app/token" ).queryParam(
"grant_type", "pin" )
-                .queryParam( "username", "ed@anuff.com" ).queryParam( "pin", "1234" )
+        node = mapper.readTree( resource().path( "/test-organization/test-app/token" )
+                .queryParam( "grant_type", "pin" )
+                .queryParam( "username", "ed@anuff.com" )
+                .queryParam( "pin", "1234" )
                 .accept( MediaType.APPLICATION_JSON ).get( String.class ));
 
         logNode( node );
@@ -254,22 +257,35 @@ public class BasicIT extends AbstractRestIT {
 
         MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
         formData.add( "pin", "5678" );
-        node = mapper.readTree( resource().path( "/test-organization/test-app/users/ed@anuff.com/setpin"
)
-                .queryParam( "access_token", user_access_token ).type( "application/x-www-form-urlencoded"
)
+        node = mapper.readTree( resource()
+                .path( "/test-organization/test-app/users/ed@anuff.com/setpin" )
+                .queryParam( "access_token", user_access_token )
+                .type( "application/x-www-form-urlencoded" )
                 .post( String.class, formData ));
 
-        node = mapper.readTree( resource().path( "/test-organization/test-app/token" ).queryParam(
"grant_type", "pin" )
-                .queryParam( "username", "ed@anuff.com" ).queryParam( "pin", "5678" )
-                .accept( MediaType.APPLICATION_JSON ).get( String.class ));
+        refreshIndex("test-organization", "test-app");
+        
+        node = mapper.readTree( resource()
+                .path( "/test-organization/test-app/token" )
+                .queryParam( "grant_type", "pin" )
+                .queryParam( "username", "ed@anuff.com" )
+                .queryParam( "pin", "5678" )
+                .accept( MediaType.APPLICATION_JSON )
+                .get( String.class ));
 
         logNode( node );
 
         user_access_token = node.get( "access_token" ).textValue();
         assertTrue( isNotBlank( user_access_token ) );
 
+        refreshIndex("test-organization", "test-app");
+
         // test user test extension resource
 
-        node = mapper.readTree( resource().path( "/test-organization/test-app/users/ed@anuff.com/test"
).get( String.class ));
+        node = mapper.readTree( resource()
+                .path( "/test-organization/test-app/users/ed@anuff.com/test" )
+                .queryParam( "access_token", user_access_token )
+                .get( String.class ));
         logNode( node );
 
         // test create user with guest permissions (no token)


Mime
View raw message