You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/10 18:20:39 UTC
git commit: 99 of 100 tests passing in query-index module,
one skipped because no connection support yet.
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o c801a47ef -> cc0b774ff
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/two-dot-o
Commit: cc0b774ffeb11edc5fe61f0db03132e314fc1d73
Parents: c801a47
Author: Dave Johnson <dm...@apigee.com>
Authored: Mon Mar 10 12:30:04 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
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<String, Object> entity = new HashMap<String, Object>();
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 );