Return-Path: X-Original-To: apmail-usergrid-commits-archive@minotaur.apache.org Delivered-To: apmail-usergrid-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 769661036D for ; Tue, 11 Mar 2014 14:22:16 +0000 (UTC) Received: (qmail 49029 invoked by uid 500); 11 Mar 2014 14:22:16 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 48825 invoked by uid 500); 11 Mar 2014 14:22:13 -0000 Mailing-List: contact commits-help@usergrid.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@usergrid.incubator.apache.org Delivered-To: mailing list commits@usergrid.incubator.apache.org Received: (qmail 48503 invoked by uid 99); 11 Mar 2014 14:22:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Mar 2014 14:22:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AB80993ECF8; Tue, 11 Mar 2014 14:22:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: snoopdave@apache.org To: commits@usergrid.apache.org Date: Tue, 11 Mar 2014 14:22:07 -0000 Message-Id: In-Reply-To: <45c7b6907e214644934524125c024a39@git.apache.org> References: <45c7b6907e214644934524125c024a39@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/50] [abbrv] git commit: 99 of 100 tests passing in query-index module, one skipped because no connection support yet. 99 of 100 tests passing in query-index module, one skipped because no connection support yet. Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/cc0b774f Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/cc0b774f Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/cc0b774f Branch: refs/heads/optimistic-tx-semantics Commit: cc0b774ffeb11edc5fe61f0db03132e314fc1d73 Parents: c801a47 Author: Dave Johnson Authored: Mon Mar 10 12:30:04 2014 -0400 Committer: Dave Johnson Committed: Mon Mar 10 12:30:04 2014 -0400 ---------------------------------------------------------------------- .../index/impl/EsEntityCollectionIndex.java | 14 +++++++------- .../usergrid/persistence/index/impl/IndexIT.java | 6 ++++-- .../persistence/query/AbstractIteratingQueryIT.java | 8 ++++---- .../persistence/query/IntersectionUnionPagingIT.java | 2 ++ 4 files changed, 17 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc0b774f/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java index 443c1cc..1cb474d 100644 --- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java +++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java @@ -247,7 +247,7 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex { QueryBuilder qb = query.createQueryBuilder(); - SearchResponse sr; + SearchResponse searchResponse; if (query.getCursor() == null) { @@ -277,17 +277,17 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex { srb.addSort(sp.getPropertyName(), order); } - sr = srb.execute().actionGet(); + searchResponse = srb.execute().actionGet(); } else { log.debug("Executing query on type {} cursor: {} ", scope.getName(), query.getCursor()); SearchScrollRequestBuilder ssrb = client.prepareSearchScroll(query.getCursor()) .setScroll( cursorTimeout + "m" ); - sr = ssrb.execute().actionGet(); + searchResponse = ssrb.execute().actionGet(); } - SearchHits hits = sr.getHits(); + SearchHits hits = searchResponse.getHits(); log.debug(" Hit count: {} Total hits: {}", hits.getHits().length, hits.getTotalHits() ); Results results = new Results(); @@ -327,9 +327,9 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex { results.setEntities(entities); } - if ( !entities.isEmpty() ) { - results.setCursor(sr.getScrollId()); - log.debug(" Cursor = " + sr.getScrollId() ); + if ( entities.size() == query.getLimit() ) { + results.setCursor(searchResponse.getScrollId()); + log.debug(" Cursor = " + searchResponse.getScrollId() ); } return results; http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc0b774f/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java index fc0af93..d49392f 100644 --- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java +++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java @@ -119,8 +119,10 @@ public class IndexIT { query = Query.fromQL( "order by name" ).withCursor( r.getCursor() ); r = em.searchCollection( em.getApplicationRef(), "items", query ); for ( Entity entity : r.getEntities() ) { - assertEquals( alphabet[i], entity.getField( "name" ).getValue() ); - i++; + if ( i < 26 ) { + assertEquals( alphabet[i], entity.getField( "name" ).getValue() ); + i++; + } } assertEquals( alphabet.length, i ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc0b774f/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java index 8aefd2e..4113394 100644 --- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java +++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory; import org.apache.usergrid.persistence.collection.cassandra.CassandraRule; import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule; @@ -79,11 +80,10 @@ public abstract class AbstractIteratingQueryIT { @Before public void setup() { - Id appId = new SimpleId("application"); - Id orgId = new SimpleId("organization"); + Id appId = new SimpleId( getClass().getName() ); + Id orgId = new SimpleId( RandomStringUtils.randomAlphabetic(6)); em = new EntityManagerFacade( orgId, appId, cmf, cif ); - app.setEntityManager( em ); } @@ -1238,7 +1238,7 @@ public abstract class AbstractIteratingQueryIT { for ( int i = 0; i < size; i++ ) { Map entity = new HashMap(); entity.put( "name", String.valueOf( i ) ); - entity.put( "boolean", !(i % 100 == 0)); + entity.put( "boolean", !(i % 2 == 0)); entity.put( "index", i); io.writeEntity( entity ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc0b774f/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java index 870946b..8199c79 100644 --- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java +++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java @@ -119,6 +119,8 @@ public class IntersectionUnionPagingIT extends AbstractIteratingQueryIT { LOG.info("Writing entity with id '{}'", saved.getId()); } + app.getEm().refreshIndex(); + long stop = System.currentTimeMillis(); LOG.info( "Writes took {} ms", stop - start );