usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [2/5] incubator-usergrid git commit: Removed legacy 1.0 code Cleaned up Query object to only be query state/builder Refactor of tests to use query language
Date Fri, 10 Apr 2015 16:28:03 GMT
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index a60a6b5..97f0045 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -29,10 +29,6 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.AbstractCoreIT;
 import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.persistence.cassandra.CassandraService;
-import org.apache.usergrid.persistence.cassandra.IndexUpdate;
-import org.apache.usergrid.persistence.cassandra.IndexUpdate.IndexEntry;
-import org.apache.usergrid.persistence.cassandra.RelationManagerImpl;
-import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.utils.JsonUtils;
 import org.apache.usergrid.utils.UUIDUtils;
 
@@ -437,43 +433,5 @@ public class IndexIT extends AbstractCoreIT {
 
 
 
-        //now read the index and see what properties are there
-
-        RelationManager rm = em.getRelationManager( entity2Ref );
-
-        if ( rm instanceof RelationManagerImpl ) { // only relevant for old-school EntityManagers
-
-            RelationManagerImpl impl = (RelationManagerImpl)rm;
-
-            CassandraService cass = SpringResource.getInstance().getBean( CassandraService.class );
-
-            ByteBufferSerializer buf = ByteBufferSerializer.get();
-
-            Keyspace ko = cass.getApplicationKeyspace( applicationId );
-            Mutator<ByteBuffer> m = createMutator( ko, buf );
-
-            IndexUpdate update = impl.batchStartIndexUpdate( m, entity1Ref,
-                    "status", "ignore", UUIDUtils.newTimeUUID(), false, false, true, false );
-
-            int count = 0;
-
-            IndexEntry lastMatch = null;
-
-            for ( IndexEntry entry : update.getPrevEntries() ) {
-                if ( "status".equals( entry.getPath() ) ) {
-                    count++;
-                    lastMatch = entry;
-                }
-            }
-
-            assertEquals( 1, count );
-
-            if ( lastMatch != null ) {
-                assertEquals( "herring", lastMatch.getValue() );
-            }
-            else {
-                fail( "The last match was null but should have been herring!" );
-            }
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
index 6bddf76..c5873ea 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
@@ -28,8 +28,8 @@ import java.util.UUID;
 import org.junit.Test;
 
 import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.persistence.index.query.Query.Level;
+import org.apache.usergrid.persistence.Query;
+import org.apache.usergrid.persistence.Query.Level;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
 import static org.junit.Assert.assertEquals;
@@ -71,11 +71,9 @@ public class PathQueryIT extends AbstractCoreIT {
 
         int pageSize = 10; // shouldn't affect these tests
 
-        Query userQuery = new Query();
+        Query userQuery = Query.fromQL( "select * where index >= 2 AND index <= 13" );
         userQuery.setCollection( "users" );
         userQuery.setLimit( pageSize );
-        userQuery.addFilter( "index >= 2" );
-        userQuery.addFilter( "index <= 13" );
         int expectedUserQuerySize = 12;
 
         // query the users, ignoring page boundaries
@@ -89,10 +87,9 @@ public class PathQueryIT extends AbstractCoreIT {
         assertEquals( count, expectedUserQuerySize + 2 );
 
         // query devices as a sub-query of the users, ignoring page boundaries
-        Query deviceQuery = new Query();
+        Query deviceQuery = Query.fromQL( "select * where index >= 2 " );
         deviceQuery.setCollection( "devices" );
         deviceQuery.setLimit( pageSize );
-        deviceQuery.addFilter( "index >= 2" );
         int expectedDeviceQuerySize = 3;
 
         PathQuery<EntityRef> usersPQ = new PathQuery<EntityRef>(
@@ -160,23 +157,19 @@ public class PathQueryIT extends AbstractCoreIT {
 
         int pageSize = 3; // ensure we're crossing page boundaries
 
-        Query groupQuery = new Query();
+        Query groupQuery = Query.fromQL( "select * where index <= 7 " );
         groupQuery.setCollection( "groups" );
         groupQuery.setLimit( pageSize );
-        groupQuery.addFilter( "index <= 7" );
         int expectedGroupQuerySize = 4;
 
-        Query userQuery = new Query();
+        Query userQuery = Query.fromQL( "select * where index >= 2 AND index <= 6" );
         userQuery.setCollection( "users" );
         userQuery.setLimit( pageSize );
-        userQuery.addFilter( "index >= 2" );
-        userQuery.addFilter( "index <= 6" );
         int expectedUserQuerySize = 5;
 
-        Query deviceQuery = new Query();
+        Query deviceQuery = Query.fromQL( "select * where index >= 4 " );
         deviceQuery.setCollection( "devices" );
         deviceQuery.setLimit( pageSize );
-        deviceQuery.addFilter( "index >= 4" );
         int expectedDeviceQuerySize = 3;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
index 9336df8..b0fc245 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
@@ -40,7 +40,7 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.index.EntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndexFactory;
 import org.apache.usergrid.persistence.index.impl.EsEntityIndexImpl;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
index 6f76a79..bfdc3cf 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang3.RandomStringUtils;
 
 import org.apache.usergrid.AbstractCoreIT;
 import org.apache.usergrid.persistence.entities.Role;
-import org.apache.usergrid.persistence.index.query.Query.Level;
+import org.apache.usergrid.persistence.Query.Level;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/QueryTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/QueryTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/QueryTest.java
deleted file mode 100644
index 1b4bb6f..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/QueryTest.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence;
-
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.persistence.index.exceptions.QueryParseException;
-import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.persistence.index.query.Query.SortDirection;
-import org.apache.usergrid.persistence.index.query.Query.SortPredicate;
-import org.apache.usergrid.persistence.index.query.tree.AndOperand;
-import org.apache.usergrid.persistence.index.query.tree.ContainsOperand;
-import org.apache.usergrid.persistence.index.query.tree.Equal;
-import org.apache.usergrid.persistence.index.query.tree.FloatLiteral;
-import org.apache.usergrid.persistence.index.query.tree.GreaterThan;
-import org.apache.usergrid.persistence.index.query.tree.GreaterThanEqual;
-import org.apache.usergrid.persistence.index.query.tree.LessThan;
-import org.apache.usergrid.persistence.index.query.tree.LessThanEqual;
-import org.apache.usergrid.persistence.index.query.tree.LongLiteral;
-import org.apache.usergrid.persistence.index.query.tree.NotOperand;
-import org.apache.usergrid.persistence.index.query.tree.StringLiteral;
-import org.apache.usergrid.persistence.index.query.tree.WithinOperand;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-
-
-public class QueryTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger( QueryTest.class );
-
-
-    @Test
-    public void testQueryTree() throws Exception {
-        LOG.info( "testQuery" );
-
-        Query q = new Query();
-
-        try {
-            q.addFilter( "blah" );
-            fail( "'blah' shouldn't be a valid operation." );
-        }
-        catch ( RuntimeException e ) {
-            // this is correct
-        }
-
-        q.addFilter( "a=5" );
-        q.addFilter( "b='hello'" );
-        q.addFilter( "c < 7" );
-        q.addFilter( "d gt 5" );
-        // q.addFilter("e in 5,6");
-        q.addFilter( "f = 6.0" );
-        q.addFilter( "g = .05" );
-        q.addFilter( "loc within .05 of 5.0,6.0" );
-        q.addFilter( "not h eq 4" );
-
-        AndOperand and = ( AndOperand ) q.getRootOperand();
-
-        NotOperand not = ( NotOperand ) and.getRight();
-        Equal equal = ( Equal ) not.getOperation();
-        assertEquals( "h", equal.getProperty().getValue() );
-        assertEquals( 4.0f, ( ( LongLiteral ) equal.getLiteral() ).getValue(), 0 );
-
-        and = ( AndOperand ) and.getLeft();
-        WithinOperand op = ( WithinOperand ) and.getRight();
-
-        assertEquals( "loc", op.getProperty().getValue() );
-        assertEquals( .05f, op.getDistance().getFloatValue(), 0 );
-        assertEquals( 5f, op.getLatitude().getFloatValue(), 0 );
-        assertEquals( 6f, op.getLongitude().getFloatValue(), 0 );
-
-        and = ( AndOperand ) and.getLeft();
-        equal = ( Equal ) and.getRight();
-
-        assertEquals( "g", equal.getProperty().getValue() );
-        assertEquals( .05f, ( ( FloatLiteral ) equal.getLiteral() ).getValue(), 0 );
-
-        and = ( AndOperand ) and.getLeft();
-        equal = ( Equal ) and.getRight();
-
-        assertEquals( "f", equal.getProperty().getValue() );
-        assertEquals( 6.0f, ( ( FloatLiteral ) equal.getLiteral() ).getValue(), 0 );
-
-        and = ( AndOperand ) and.getLeft();
-        GreaterThan gt = ( GreaterThan ) and.getRight();
-
-        assertEquals( "d", gt.getProperty().getValue() );
-        assertEquals( 5, ( ( LongLiteral ) gt.getLiteral() ).getValue(), 0 );
-
-        and = ( AndOperand ) and.getLeft();
-        LessThan lt = ( LessThan ) and.getRight();
-
-        assertEquals( "c", lt.getProperty().getValue() );
-        assertEquals( 7, ( ( LongLiteral ) lt.getLiteral() ).getValue(), 0 );
-
-        and = ( AndOperand ) and.getLeft();
-        equal = ( Equal ) and.getRight();
-
-        assertEquals( "b", equal.getProperty().getValue() );
-        assertEquals( "hello", ( ( StringLiteral ) equal.getLiteral() ).getValue() );
-
-        equal = ( Equal ) and.getLeft();
-
-        assertEquals( "a", equal.getProperty().getValue() );
-        assertEquals( 5, ( ( LongLiteral ) equal.getLiteral() ).getValue().intValue() );
-    }
-
-    @Test
-    public void withinDistanceCorrect(){
-        final Query query = Query.fromQL( "location within 2000 of 37.776753, -122.407846" );
-
-        WithinOperand withinOperand = ( WithinOperand ) query.getRootOperand();
-
-        final float distance = withinOperand.getDistance().getFloatValue();
-        final float lat = withinOperand.getLatitude().getFloatValue();
-        final float lon = withinOperand.getLongitude().getFloatValue();
-
-        assertEquals( 2000f, distance, 0f );
-        assertEquals( 37.776753f, lat, 0f );
-        assertEquals( -122.407846f, lon, 0f );
-    }
-
-
-    @Test
-    public void testCodeEquals() {
-        Query query = new Query();
-        query.addEqualityFilter( "foo", "bar" );
-
-        Equal equal = ( Equal ) query.getRootOperand();
-
-        assertEquals( "foo", equal.getProperty().getValue() );
-        assertEquals( "bar", equal.getLiteral().getValue() );
-    }
-
-
-    @Test
-    public void testCodeLessThan() {
-        Query query = new Query();
-        query.addLessThanFilter( "foo", 5 );
-
-        LessThan equal = ( LessThan ) query.getRootOperand();
-
-        assertEquals( "foo", equal.getProperty().getValue() );
-        assertEquals( 5l, equal.getLiteral().getValue() );
-    }
-
-
-    @Test
-    public void testCodeLessThanEqual() {
-        Query query = new Query();
-        query.addLessThanEqualFilter( "foo", 5 );
-
-        LessThanEqual equal = ( LessThanEqual ) query.getRootOperand();
-
-        assertEquals( "foo", equal.getProperty().getValue() );
-        assertEquals( 5l, equal.getLiteral().getValue() );
-    }
-
-
-    @Test
-    public void testCodeGreaterThan() {
-        Query query = new Query();
-        query.addGreaterThanFilter( "foo", 5 );
-
-        GreaterThan equal = ( GreaterThan ) query.getRootOperand();
-
-        assertEquals( "foo", equal.getProperty().getValue() );
-        assertEquals( 5l, equal.getLiteral().getValue() );
-    }
-
-
-    @Test
-    public void testCodeGreaterThanEqual() {
-        Query query = new Query();
-        query.addGreaterThanEqualFilter( "foo", 5 );
-
-        GreaterThanEqual equal = ( GreaterThanEqual ) query.getRootOperand();
-
-        assertEquals( "foo", equal.getProperty().getValue() );
-        assertEquals( 5l, equal.getLiteral().getValue() );
-    }
-
-
-    @Test
-    public void testFromJson() throws QueryParseException {
-        String s = "{\"filter\":\"a contains 'ed'\"}";
-        Query q = Query.fromJsonString( s );
-        assertNotNull( q );
-
-        ContainsOperand contains = ( ContainsOperand ) q.getRootOperand();
-
-        assertEquals( "a", contains.getProperty().getValue() );
-        assertEquals( "ed", contains.getString().getValue() );
-    }
-
-
-    @Test
-    public void testCompoundQueryWithNot() throws QueryParseException {
-        String s = "name contains 'm' and not name contains 'grover'";
-        Query q = Query.fromQL( s );
-        assertNotNull( q );
-
-        AndOperand and = ( AndOperand ) q.getRootOperand();
-
-        ContainsOperand contains = ( ContainsOperand ) and.getLeft();
-        assertEquals( "name", contains.getProperty().getValue() );
-        assertEquals( "m", contains.getString().getValue() );
-
-        NotOperand not = ( NotOperand ) and.getRight();
-        contains = ( ContainsOperand ) not.getOperation();
-        assertEquals( "name", contains.getProperty().getValue() );
-        assertEquals( "grover", contains.getString().getValue() );
-    }
-
-
-    @Test
-    public void badGrammar() throws QueryParseException {
-        // from isn't allowed
-        String s = "select * from where name = 'bob'";
-
-        String error = null;
-
-        try {
-            Query.fromQL( s );
-        }
-        catch ( QueryParseException qpe ) {
-            error = qpe.getMessage();
-        }
-
-        assertEquals( "The query cannot be parsed. The token 'from' at column 4 on line 1 cannot be parsed", error );
-    }
-
-
-    @Test
-    public void testTruncation() {
-
-        Query query = new Query();
-        query.setLimit( Query.MAX_LIMIT * 2 );
-
-        assertEquals( Query.MAX_LIMIT, query.getLimit() );
-    }
-
-
-    @Test
-    public void testTruncationFromParams() throws QueryParseException {
-
-        HashMap<String, List<String>> params = new HashMap<String, List<String>>();
-
-        params.put( "limit", Collections.singletonList( "2000" ) );
-
-        Query query = Query.fromQueryParams( params );
-
-        assertEquals( Query.MAX_LIMIT, query.getLimit() );
-    }
-
-
-    @Test
-    public void badOrderByBadGrammar() throws QueryParseException {
-        // from isn't allowed
-        String s = "select * where name = 'bob' order by";
-
-        String error = null;
-
-        try {
-            Query.fromQL( s );
-        }
-        catch ( QueryParseException qpe ) {
-            error = qpe.getMessage();
-        }
-
-        assertEquals( "The query cannot be parsed. The token '<EOF>' at column 13 on line 1 cannot be parsed", error );
-    }
-
-
-    @Test
-    public void badOrderByGrammarAsc() throws QueryParseException {
-        // from isn't allowed
-        String s = "select * where name = 'bob' order by name asc";
-
-        Query q = Query.fromQL( s );
-
-        List<SortPredicate> sorts = q.getSortPredicates();
-
-        assertEquals( 1, sorts.size() );
-
-        assertEquals( "name", sorts.get( 0 ).getPropertyName() );
-        assertEquals( SortDirection.ASCENDING, sorts.get( 0 ).getDirection() );
-    }
-
-
-    @Test
-    public void badOrderByGrammarDesc() throws QueryParseException {
-        // from isn't allowed
-        String s = "select * where name = 'bob' order by name desc";
-
-        Query q = Query.fromQL( s );
-
-        List<SortPredicate> sorts = q.getSortPredicates();
-
-        assertEquals( 1, sorts.size() );
-
-        assertEquals( "name", sorts.get( 0 ).getPropertyName() );
-        assertEquals( SortDirection.DESCENDING, sorts.get( 0 ).getDirection() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/QueryProcessorTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/QueryProcessorTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/QueryProcessorTest.java
deleted file mode 100644
index 6d1ab8a..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/QueryProcessorTest.java
+++ /dev/null
@@ -1,822 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.cassandra;
-
-
-import java.math.BigInteger;
-import java.util.Iterator;
-import java.util.UUID;
-
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.TokenRewriteStream;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.usergrid.mq.QueryFilterLexer;
-import org.apache.usergrid.mq.QueryFilterParser;
-import org.apache.usergrid.persistence.exceptions.PersistenceException;
-import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.persistence.index.query.tree.CpQueryFilterLexer;
-import org.apache.usergrid.persistence.index.query.tree.CpQueryFilterParser;
-import org.apache.usergrid.persistence.query.ir.AndNode;
-import org.apache.usergrid.persistence.query.ir.NotNode;
-import org.apache.usergrid.persistence.query.ir.OrNode;
-import org.apache.usergrid.persistence.query.ir.QuerySlice;
-import org.apache.usergrid.persistence.query.ir.SliceNode;
-import org.apache.usergrid.persistence.query.ir.WithinNode;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-
-/**
- * @author tnine
- */
-
-public class QueryProcessorTest {
-
-    @Test
-    public void equality() throws Exception {
-        String queryString = "select * where a = 5";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( BigInteger.valueOf( 5 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 5 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void lessThan() throws Exception {
-        String queryString = "select * where a < 5";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertNull( slice.getStart() );
-
-        assertEquals( BigInteger.valueOf( 5 ), slice.getFinish().getValue() );
-        assertFalse( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void lessThanEquals() throws Exception {
-        String queryString = "select * where a <= 5";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertNull( slice.getStart() );
-
-        assertEquals( BigInteger.valueOf( 5 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void greaterThan() throws Exception {
-        String queryString = "select * where a > 5";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( BigInteger.valueOf( 5 ), slice.getStart().getValue() );
-        assertFalse( slice.getStart().isInclusive() );
-
-        assertNull( slice.getFinish() );
-    }
-
-
-    @Test
-    public void greaterThanEquals() throws Exception {
-        String queryString = "select * where a >= 5";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( BigInteger.valueOf( 5 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-
-        assertNull( slice.getFinish() );
-    }
-
-
-    @Test
-    public void contains() throws Exception {
-        String queryString = "select * where a contains 'foo'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a.keywords", slice.getPropertyName() );
-
-        assertEquals( "foo", slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-
-        assertEquals( "foo", slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void containsLower() throws Exception {
-        String queryString = "select * where a contains 'FOO'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a.keywords", slice.getPropertyName() );
-
-        assertEquals( "foo", slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-
-        assertEquals( "foo", slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void containsRange() throws Exception, PersistenceException {
-
-        String queryString = "select * where a contains 'foo*'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        if ( !(processor.getEntityManager() instanceof EntityManagerImpl) ) {
-            return; // only relevant for old entity manager
-        }
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a.keywords", slice.getPropertyName() );
-
-        assertEquals( "foo", slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-
-        assertEquals( "foo\uffff", slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void within() throws Exception {
-        String queryString = "select * where a within .5 of 157.00, 0.00";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        WithinNode node = ( WithinNode ) processor.getFirstNode();
-
-        assertEquals( "a.coordinates", node.getPropertyName() );
-        assertEquals( .5f, node.getDistance(), 0 );
-        assertEquals( 157f, node.getLattitude(), 0 );
-        assertEquals( 0f, node.getLongitude(), 0 );
-    }
-
-
-    @Test
-    public void andEquality() throws Exception {
-        assertAndQuery( "select * where a = 1 and b = 2 and c = 3" );
-        assertAndQuery( "select * where a = 1 AND b = 2 and c = 3" );
-        assertAndQuery( "select * where a = 1 AnD b = 2 and c = 3" );
-        assertAndQuery( "select * where a = 1 ANd b = 2 and c = 3" );
-        assertAndQuery( "select * where a = 1 anD b = 2 and c = 3" );
-        assertAndQuery( "select * where a = 1 ANd b = 2 and c = 3" );
-        assertAndQuery( "select * where a = 1 && b = 2 && c = 3" );
-    }
-
-
-    private void assertAndQuery( String queryString ) throws Exception {
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-
-        assertEquals( "a", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-
-        slice = slices.next();
-
-        assertEquals( "b", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-
-        slice = slices.next();
-
-        assertEquals( "c", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 3 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 3 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void orEquality() throws Exception {
-        assertOrQuery( "select * where a = 1 or b = 2" );
-        assertOrQuery( "select * where a = 1 OR b = 2" );
-        assertOrQuery( "select * where a = 1 oR b = 2" );
-        assertOrQuery( "select * where a = 1 Or b = 2" );
-        assertOrQuery( "select * where a = 1 || b = 2" );
-    }
-
-
-    private void assertOrQuery( String queryString ) throws Exception {
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        OrNode node = ( OrNode ) processor.getFirstNode();
-
-        SliceNode sliceNode = ( SliceNode ) node.getLeft();
-
-        Iterator<QuerySlice> slices = sliceNode.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-
-        sliceNode = ( SliceNode ) node.getRight();
-
-        slices = sliceNode.getAllSlices().iterator();
-
-        slice = slices.next();
-
-        assertEquals( "b", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    /** Tests that when properties are not siblings, they are properly assigned to a SliceNode */
-    @Test
-    public void nestedCompression() throws Exception {
-        String queryString =
-                "select * where (a > 1 and b > 10 and a < 10 and b < 20 ) or ( c >= 20 and d >= 30 and c <= 30 and d "
-                        + "<= 40)";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        OrNode node = ( OrNode ) processor.getFirstNode();
-
-        SliceNode sliceNode = ( SliceNode ) node.getLeft();
-
-        Iterator<QuerySlice> slices = sliceNode.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-
-        assertEquals( "a", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getStart().getValue() );
-        assertFalse( slice.getStart().isInclusive() );
-
-        assertEquals( BigInteger.valueOf( 10 ), slice.getFinish().getValue() );
-        assertFalse( slice.getFinish().isInclusive() );
-
-
-        slice = slices.next();
-
-
-        assertEquals( "b", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 10 ), slice.getStart().getValue() );
-        assertFalse( slice.getStart().isInclusive() );
-
-        assertEquals( BigInteger.valueOf( 20 ), slice.getFinish().getValue() );
-        assertFalse( slice.getFinish().isInclusive() );
-
-
-        sliceNode = ( SliceNode ) node.getRight();
-
-        slices = sliceNode.getAllSlices().iterator();
-
-        slice = slices.next();
-
-
-        assertEquals( "c", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 20 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 30 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-
-        slice = slices.next();
-
-        assertEquals( "d", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 30 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 40 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    /** Tests that when there are multiple or with and clauses, the tree is constructed correctly */
-    @Test
-    public void nestedOrCompression() throws Exception {
-        String queryString =
-                "select * where ((a > 1 and  a < 10) or (b > 10 and b < 20 )) or (( c >= 20 and c <= 30 ) or (d >= 30"
-                        + "  and d <= 40))";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        OrNode rootNode = ( OrNode ) processor.getFirstNode();
-
-        OrNode node = ( OrNode ) rootNode.getLeft();
-
-        // get the left node of the or
-
-        SliceNode sliceNode = ( SliceNode ) node.getLeft();
-
-        Iterator<QuerySlice> slices = sliceNode.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getStart().getValue() );
-        assertFalse( slice.getStart().isInclusive() );
-
-        assertEquals( BigInteger.valueOf( 10 ), slice.getFinish().getValue() );
-        assertFalse( slice.getFinish().isInclusive() );
-
-        // get our right node
-        sliceNode = ( SliceNode ) node.getRight();
-
-        slices = sliceNode.getAllSlices().iterator();
-
-        slice = slices.next();
-
-        assertEquals( "b", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 10 ), slice.getStart().getValue() );
-        assertFalse( slice.getStart().isInclusive() );
-
-        assertEquals( BigInteger.valueOf( 20 ), slice.getFinish().getValue() );
-        assertFalse( slice.getFinish().isInclusive() );
-
-        node = ( OrNode ) rootNode.getRight();
-
-        sliceNode = ( SliceNode ) node.getLeft();
-
-        slices = sliceNode.getAllSlices().iterator();
-
-        slice = slices.next();
-
-        assertEquals( "c", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 20 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 30 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-
-        sliceNode = ( SliceNode ) node.getRight();
-
-        slices = sliceNode.getAllSlices().iterator();
-
-        slice = slices.next();
-
-        assertEquals( "d", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 30 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 40 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    /** Tests that when NOT is not the root operand the tree has a different root */
-    @Test
-    public void andNot() throws Exception {
-        String queryString = "select * where a > 1 and not b = 2";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        AndNode rootNode = ( AndNode ) processor.getFirstNode();
-
-        SliceNode sliceNode = ( SliceNode ) rootNode.getLeft();
-
-        Iterator<QuerySlice> slices = sliceNode.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 1 ), slice.getStart().getValue() );
-        assertFalse( slice.getStart().isInclusive() );
-
-        assertNull( slice.getFinish() );
-
-        NotNode notNode = ( NotNode ) rootNode.getRight();
-
-        // now get the child of the not node
-        sliceNode = ( SliceNode ) notNode.getSubtractNode();
-
-        slices = sliceNode.getAllSlices().iterator();
-
-        slice = slices.next();
-
-        assertEquals( "b", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    /** Tests that when NOT is the root operand, a full scan range is performed. */
-    @Test
-    public void notRootOperand() throws Exception {
-        String queryString = "select * where not b = 2";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        NotNode rootNode = ( NotNode ) processor.getFirstNode();
-
-        SliceNode sliceNode = ( SliceNode ) rootNode.getSubtractNode();
-
-        Iterator<QuerySlice> slices = sliceNode.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "b", slice.getPropertyName() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 2 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void stringWithSpaces() throws Exception {
-        String queryString = "select * where a = 'foo with bar'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a", slice.getPropertyName() );
-
-        assertEquals( "foo with bar", slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-
-        assertEquals( "foo with bar", slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void fieldWithDash() throws Exception {
-        String queryString = "select * where a-foo = 5";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a-foo", slice.getPropertyName() );
-
-        assertEquals( BigInteger.valueOf( 5 ), slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( BigInteger.valueOf( 5 ), slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void stringWithDash() throws Exception {
-        String queryString = "select * where a = 'foo-bar'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "a", slice.getPropertyName() );
-
-        assertEquals( "foo-bar", slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-
-        assertEquals( "foo-bar", slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    public void uuidParse() throws Exception {
-
-        //    UUID value = UUID.fromString("4b91a9c2-86a1-11e2-b7fa-68a86d52fa56");
-        //
-        //
-        //    String queryString = "select * where uuid = 4b91a9c2-86a1-11e2-b7fa-68a86d52fa56";
-
-        UUID value = UUID.fromString( "c6ee8a1c-3ef4-11e2-8861-02e81adcf3d0" );
-        String queryString = "select * where uuid = c6ee8a1c-3ef4-11e2-8861-02e81adcf3d0";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        Query query = parser.ql().query;
-
-        QueryProcessor processor = new QueryProcessorImpl( query, null, null, null );
-
-        SliceNode node = ( SliceNode ) processor.getFirstNode();
-
-        Iterator<QuerySlice> slices = node.getAllSlices().iterator();
-
-        QuerySlice slice = slices.next();
-
-        assertEquals( "uuid", slice.getPropertyName() );
-
-        assertEquals( value, slice.getStart().getValue() );
-        assertTrue( slice.getStart().isInclusive() );
-        assertEquals( value, slice.getFinish().getValue() );
-        assertTrue( slice.getFinish().isInclusive() );
-    }
-
-
-    @Test
-    @Ignore("no longer relevant for two-dot-o")
-    public void validateHintSizeForOrder() throws Exception {
-        String queryString = "order by name desc";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        QueryFilterLexer lexer = new QueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        QueryFilterParser parser = new QueryFilterParser( tokens );
-
-        /**
-         * Test set limit
-         */
-
-        final int limit = 105;
-
-//        Query query = parser.ql().query;
-//        query.setLimit( limit );
-//
-//        QueryProcessor processor = new QueryProcessor( query, null, null, null );
-//
-//        OrderByNode node = ( OrderByNode ) processor.getFirstNode();
-//
-//        assertEquals( limit, processor.getPageSizeHint( node ) );
-    }
-
-
-    @Test
-    @Ignore("no longer relevant for two-dot-o")
-    public void validateHintSizeForEquality() throws Exception {
-        String queryString = "select * where X = 'Foo'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        /**
-         * Test set limit
-         */
-
-        final int limit = 105;
-
-        Query query = parser.ql().query;
-        query.setLimit( limit );
-
-//        QueryProcessor processor = new QueryProcessor( query, null, null, null );
-//
-//        SliceNode node = ( SliceNode ) processor.getFirstNode();
-//
-//        assertEquals( limit, processor.getPageSizeHint( node ) );
-    }
-
-
-    @Test
-    @Ignore("no longer relevant for two-dot-o")
-    public void validateHintSizeForComplexQueries() throws Exception {
-        //        String queryString = "select * where y = 'Foo' AND z = 'Bar'";
-
-        String queryString = "select * where y = 'Foo' AND z = 'Bar'";
-
-        ANTLRStringStream in = new ANTLRStringStream( queryString );
-        CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
-        TokenRewriteStream tokens = new TokenRewriteStream( lexer );
-        CpQueryFilterParser parser = new CpQueryFilterParser( tokens );
-
-        /**
-         * Test set limit
-         */
-
-        final int limit = 105;
-
-        Query query = parser.ql().query;
-        query.setLimit( limit );
-
-//        QueryProcessor processor = new QueryProcessor( query, null, null, null );
-//
-//        QueryNode slice =  processor.getFirstNode();
-//
-//        assertEquals( 1000, processor.getPageSizeHint( slice ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/SimpleIndexShardLocatorImplTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/SimpleIndexShardLocatorImplTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/SimpleIndexShardLocatorImplTest.java
deleted file mode 100644
index 2618e49..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/SimpleIndexShardLocatorImplTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.cassandra;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-
-import org.apache.usergrid.persistence.IndexBucketLocator.IndexType;
-import org.apache.usergrid.utils.UUIDUtils;
-
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Timer;
-import com.yammer.metrics.core.TimerContext;
-
-import static org.junit.Assert.assertEquals;
-
-
-/** @author tnine */
-
-public class SimpleIndexShardLocatorImplTest {
-    @Test
-    public void oneBucket() {
-
-        UUID appId = UUIDUtils.newTimeUUID();
-        String entityType = "user";
-        String propName = "firstName";
-
-        SimpleIndexBucketLocatorImpl locator = new SimpleIndexBucketLocatorImpl( 1 );
-
-        List<String> buckets = locator.getBuckets( appId, IndexType.COLLECTION, entityType, propName );
-
-        assertEquals( 1, buckets.size() );
-
-        UUID testId1 = UUIDUtils.minTimeUUID( 0l );
-
-        UUID testId2 = UUIDUtils.minTimeUUID( Long.MAX_VALUE / 2 );
-
-        UUID testId3 = UUIDUtils.minTimeUUID( Long.MAX_VALUE );
-
-        String bucket1 = locator.getBucket( appId, IndexType.COLLECTION, testId1, entityType, propName );
-
-        String bucket2 = locator.getBucket( appId, IndexType.COLLECTION, testId2, entityType, propName );
-
-        String bucket3 = locator.getBucket( appId, IndexType.COLLECTION, testId3, entityType, propName );
-
-        assertEquals( bucket1, "000000000000000000000000000000000000000" );
-        assertEquals( bucket2, "000000000000000000000000000000000000000" );
-        assertEquals( bucket3, "000000000000000000000000000000000000000" );
-    }
-
-
-    @Test
-    public void twoBuckets() {
-
-        UUID appId = UUIDUtils.newTimeUUID();
-        String entityType = "user";
-        String propName = "firstName";
-
-        SimpleIndexBucketLocatorImpl locator = new SimpleIndexBucketLocatorImpl( 2 );
-
-        List<String> buckets = locator.getBuckets( appId, IndexType.COLLECTION, entityType, propName );
-
-        assertEquals( 2, buckets.size() );
-
-        UUID testId1 = UUIDUtils.minTimeUUID( 0l );
-
-        UUID testId2 = UUIDUtils.maxTimeUUID( Long.MAX_VALUE / 2 );
-
-        UUID testId3 = UUIDUtils.minTimeUUID( Long.MAX_VALUE );
-
-        String bucket1 = locator.getBucket( appId, IndexType.COLLECTION, testId1, entityType, propName );
-
-        String bucket2 = locator.getBucket( appId, IndexType.COLLECTION, testId2, entityType, propName );
-
-        String bucket3 = locator.getBucket( appId, IndexType.COLLECTION, testId3, entityType, propName );
-
-        assertEquals( bucket1, "000000000000000000000000000000000000000" );
-        assertEquals( bucket2, "085070591730234615865843651857942052863" );
-        assertEquals( bucket3, "000000000000000000000000000000000000000" );
-    }
-
-
-    @Test
-    public void evenDistribution() {
-
-        UUID appId = UUIDUtils.newTimeUUID();
-        String entityType = "user";
-        String propName = "firstName";
-
-        int bucketSize = 20;
-        float distributionPercentage = .05f;
-
-        // test 100 elements
-        SimpleIndexBucketLocatorImpl locator = new SimpleIndexBucketLocatorImpl( bucketSize );
-
-        List<String> buckets = locator.getBuckets( appId, IndexType.COLLECTION, entityType, propName );
-
-        assertEquals( bucketSize, buckets.size() );
-
-        int testSize = 2000000;
-
-        Map<String, Float> counts = new HashMap<String, Float>();
-
-        final Timer hashes =
-                Metrics.newTimer( SimpleIndexShardLocatorImplTest.class, "responses", TimeUnit.MILLISECONDS,
-                        TimeUnit.SECONDS );
-
-        // ConsoleReporter.enable(1, TimeUnit.SECONDS);
-
-        /**
-         * Loop through each new UUID and add it's hash to our map
-         */
-        for ( int i = 0; i < testSize; i++ ) {
-            UUID id = UUIDUtils.newTimeUUID();
-
-            final TimerContext context = hashes.time();
-
-            String bucket = locator.getBucket( appId, IndexType.COLLECTION, id, entityType, propName );
-
-            context.stop();
-
-            Float count = counts.get( bucket );
-
-            if ( count == null ) {
-                count = 0f;
-            }
-
-            counts.put( bucket, ++count );
-        }
-
-        /**
-         * Check each entry is within +- 5% of every subsequent entry
-         */
-        List<String> keys = new ArrayList<String>( counts.keySet() );
-        int keySize = keys.size();
-
-        assertEquals( bucketSize, keySize );
-
-        for ( int i = 0; i < keySize; i++ ) {
-
-            float sourceCount = counts.get( keys.get( i ) );
-
-            for ( int j = i + 1; j < keySize; j++ ) {
-                float destCount = counts.get( keys.get( j ) );
-
-                // find the maximum allowed value for the assert based on the
-                // largest value in the pair
-                float maxDelta = Math.max( sourceCount, destCount ) * distributionPercentage;
-
-                assertEquals(
-                        String.format( "Not within %f as percentage for keys '%s' and '%s'", distributionPercentage,
-                                keys.get( i ), keys.get( j ) ), sourceCount, destCount, maxDelta );
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/geo/EntityLocationRefDistanceComparatorTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/geo/EntityLocationRefDistanceComparatorTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/geo/EntityLocationRefDistanceComparatorTest.java
deleted file mode 100644
index d2cf8ad..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/geo/EntityLocationRefDistanceComparatorTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.geo;
-
-
-import java.util.UUID;
-
-import org.junit.Test;
-
-import org.apache.usergrid.persistence.geo.model.Point;
-import org.apache.usergrid.utils.UUIDUtils;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-
-/** @author tnine */
-public class EntityLocationRefDistanceComparatorTest {
-
-
-    @Test
-    public void locationDistanceComparator() {
-        EntityLocationRefDistanceComparator comp = new EntityLocationRefDistanceComparator();
-
-        UUID firstId = UUIDUtils.newTimeUUID();
-        UUID matchId = UUID.fromString( firstId.toString() );
-
-
-        Point zero = new Point( 0, 0 );
-
-        EntityLocationRef first = new EntityLocationRef( ( String ) null, firstId, 0, 0 );
-        first.calcDistance( zero );
-
-        EntityLocationRef second = new EntityLocationRef( ( String ) null, matchId, 0, 0 );
-        second.calcDistance( zero );
-
-        assertEquals( 0, comp.compare( first, second ) );
-
-        //now increase the distance on the second one
-
-        second = new EntityLocationRef( ( String ) null, matchId, 1, 1 );
-        second.calcDistance( zero );
-
-        assertTrue( comp.compare( first, second ) < 0 );
-
-        //set the first one to be farther
-        first = new EntityLocationRef( ( String ) null, firstId, 1, 1 );
-        first.calcDistance( zero );
-
-        second = new EntityLocationRef( ( String ) null, matchId, 0, 0 );
-        second.calcDistance( zero );
-
-        assertTrue( comp.compare( first, second ) > 0 );
-
-        //now compare by UUID.
-
-        UUID secondId = UUIDUtils.newTimeUUID();
-
-        first = new EntityLocationRef( ( String ) null, firstId, 0, 0 );
-        first.calcDistance( zero );
-
-        second = new EntityLocationRef( ( String ) null, secondId, 0, 0 );
-        second.calcDistance( zero );
-
-        assertTrue( comp.compare( first, second ) < 0 );
-
-        first = new EntityLocationRef( ( String ) null, secondId, 0, 0 );
-        first.calcDistance( zero );
-
-        second = new EntityLocationRef( ( String ) null, firstId, 0, 0 );
-        second.calcDistance( zero );
-
-        assertTrue( comp.compare( first, second ) > 0 );
-
-        //compare nulls
-
-        assertTrue( comp.compare( null, first ) > 0 );
-        assertTrue( comp.compare( first, null ) < 0 );
-
-        assertEquals( 0, comp.compare( null, null ) );
-
-
-        double less = 0;
-        double more = 1000;
-
-        int compare = Double.compare( less, more );
-
-        assertTrue( compare < 1 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/CollectionIoHelper.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/CollectionIoHelper.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/CollectionIoHelper.java
index 8965013..8cc3b73 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/CollectionIoHelper.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/CollectionIoHelper.java
@@ -25,7 +25,7 @@ import java.util.Map;
 import org.apache.usergrid.CoreApplication;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/ConnectionHelper.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ConnectionHelper.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ConnectionHelper.java
index 5f9874b..e99ae9c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ConnectionHelper.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ConnectionHelper.java
@@ -26,7 +26,7 @@ import java.util.Map;
 import org.apache.usergrid.CoreApplication;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionTransitivePagingIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionTransitivePagingIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionTransitivePagingIT.java
index 195ccdb..3b12353 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionTransitivePagingIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionTransitivePagingIT.java
@@ -33,7 +33,7 @@ import org.apache.usergrid.CoreApplication;
 import org.apache.usergrid.CoreITSetup;
 import org.apache.usergrid.CoreITSetupImpl;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java
index b78bc46..e8ee0b6 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IntersectionUnionPagingIT.java
@@ -34,7 +34,7 @@ import org.apache.usergrid.CoreITSetup;
 import org.apache.usergrid.CoreITSetupImpl;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/IoHelper.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IoHelper.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IoHelper.java
index 1032bd0..cb1f020 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IoHelper.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IoHelper.java
@@ -24,7 +24,7 @@ import java.util.Map;
 
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
index c2b8b87..02d3a52 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
@@ -37,7 +37,7 @@ import org.apache.usergrid.CoreITSetup;
 import org.apache.usergrid.CoreITSetupImpl;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -303,8 +303,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "created" );
+        Query query = Query.fromQL("sort by  created" );
         query.setLimit( queryLimit );
 
         int count = 0;
@@ -374,9 +373,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "created" );
-        query.addEqualityFilter( "intersect", true );
+        Query query = Query.fromQL( "select * where intersect = true sort by  created" );
         query.setLimit( queryLimit );
 
         int count = 0;
@@ -446,10 +443,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "created" );
-        query.addEqualityFilter( "intersect", true );
-        query.addEqualityFilter( "intersect2", true );
+        Query query = Query.fromQL( "select * where intersect = true AND intersect2 = true sort by  created" );
         query.setLimit( queryLimit );
 
         int count = 0;
@@ -506,11 +500,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "created" );
-        // nothing will ever match this, the search should short circuit
-        query.addEqualityFilter( "intersect", true );
-        query.addEqualityFilter( "intersect2", true );
+        Query query = Query.fromQL( "select * where intersect = true AND intersect2 = true sort by  created" );
         query.setLimit( queryLimit );
 
         start = System.currentTimeMillis();
@@ -701,10 +691,8 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "created" );
+        Query query = Query.fromQL( "select * where searched = true sort by  created" );
         query.setLimit( queryLimit );
-        query.addEqualityFilter( "searched", true );
 
         int count = 0;
 
@@ -756,9 +744,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "index desc" );
-        query.addLessThanEqualFilter( "index", startValue );
+        Query query = Query.fromQL( "select * where index = "+ startValue + " sort by index desc" );
         query.setLimit( queryLimit );
 
         int count = 0;
@@ -818,9 +804,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "index desc" );
-        query.addLessThanFilter( "index", startValue );
+        Query query = Query.fromQL( "select * where index = "+ startValue + " sort by index desc" );
         query.setLimit( queryLimit );
 
         int count = 0;
@@ -880,9 +864,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "index desc" );
-        query.addGreaterThanEqualFilter( "index", startValue );
+        Query query = Query.fromQL( "select * where index = "+ startValue + " sort by index desc" );
         query.setLimit( queryLimit );
 
         int count = 0;
@@ -941,9 +923,7 @@ public class IteratingQueryIT {
 
         LOG.info( "Writes took {} ms", stop - start );
 
-        Query query = new Query();
-        query.addSort( "index desc" );
-        query.addGreaterThanFilter( "index", startValue );
+        Query query = Query.fromQL( "select * where index = "+ startValue + " sort by index desc" );
         query.setLimit( queryLimit );
 
         int count = 0;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotSubPropertyIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotSubPropertyIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotSubPropertyIT.java
index d0b292d..ff66f8e 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotSubPropertyIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotSubPropertyIT.java
@@ -33,7 +33,7 @@ import org.apache.usergrid.CoreApplication;
 import org.apache.usergrid.CoreITSetup;
 import org.apache.usergrid.CoreITSetupImpl;
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
deleted file mode 100644
index a936e7f..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query.ir.result;
-
-
-import java.nio.ByteBuffer;
-import java.util.UUID;
-
-import org.junit.Test;
-
-import org.apache.usergrid.utils.UUIDUtils;
-
-import static junit.framework.Assert.assertNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-
-/**
- * Simple test to test null value
- */
-public class AbstractScanColumnTest {
-
-    @Test
-    public void testValues() {
-        final UUID uuid = UUIDUtils.newTimeUUID();
-        final ByteBuffer buffer = ByteBuffer.allocate( 4 );
-        buffer.putInt( 1 );
-        buffer.rewind();
-
-        TestScanColumn col = new TestScanColumn( uuid, buffer );
-
-        assertSame( uuid, col.getUUID() );
-
-        assertEquals( 1, col.getCursorValue().getInt() );
-    }
-
-
-    @Test
-    public void nullUUID() {
-        final UUID uuid = null;
-        final ByteBuffer buffer = ByteBuffer.allocate( 4 );
-        buffer.putInt( 1 );
-        buffer.rewind();
-
-        TestScanColumn col = new TestScanColumn( uuid, buffer );
-
-        assertNull( col.getUUID() );
-
-        assertEquals( 1, col.getCursorValue().getInt() );
-    }
-
-
-    @Test
-    public void nullBuffer() {
-        final UUID uuid = UUIDUtils.newTimeUUID();
-        final ByteBuffer buffer = null;
-
-        TestScanColumn col = new TestScanColumn( uuid, buffer );
-
-        assertSame( uuid, col.getUUID() );
-
-        assertNull( col.getCursorValue() );
-    }
-
-
-    @Test
-    public void nullBoth() {
-        final UUID uuid = null;
-        final ByteBuffer buffer = null;
-
-        TestScanColumn col = new TestScanColumn( uuid, buffer );
-
-        assertNull( col.getUUID() );
-
-        assertNull( col.getCursorValue() );
-    }
-
-
-
-
-    private class TestScanColumn extends AbstractScanColumn {
-
-        protected TestScanColumn( final UUID uuid, final ByteBuffer buffer ) {
-            super( uuid, buffer );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e534d9c7/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
deleted file mode 100644
index b79b38a..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query.ir.result;
-
-
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.junit.Ignore;
-
-import org.apache.usergrid.persistence.cassandra.CursorCache;
-
-import com.google.common.collect.Iterables;
-
-
-/**
- * Simple iterator for testing that iterates UUIDs in the order returned
- *
- * @author tnine
- */
-@Ignore("not a test")
-public class InOrderIterator implements ResultIterator {
-
-    private LinkedHashSet<ScanColumn> uuids = new LinkedHashSet<ScanColumn>();
-    private Iterator<List<ScanColumn>> iterator;
-    private int pageSize = 1000;
-
-
-    public InOrderIterator( int pageSize ) {
-        this.pageSize = pageSize;
-    }
-
-
-    /** Add a uuid to the list */
-    public void add( UUID... ids ) {
-        for ( UUID current : ids ) {
-            uuids.add( new UUIDIndexSliceParser.UUIDColumn( current, ByteBuffer.allocate( 0 ) ) );
-        }
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Iterable#iterator()
-     */
-    @Override
-    public Iterator<Set<ScanColumn>> iterator() {
-        if ( iterator == null ) {
-            reset();
-        }
-
-        return this;
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.util.Iterator#hasNext()
-     */
-    @Override
-    public boolean hasNext() {
-        if ( iterator == null ) {
-            reset();
-        }
-
-        return iterator.hasNext();
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.util.Iterator#next()
-     */
-    @Override
-    public Set<ScanColumn> next() {
-        if ( iterator == null ) {
-            reset();
-        }
-
-        return new LinkedHashSet<ScanColumn>( iterator.next() );
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.persistence.query.ir.result.ResultIterator#reset()
-     */
-    @Override
-    public void reset() {
-        this.iterator = Iterables.partition( uuids, pageSize ).iterator();
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.util.Iterator#remove()
-     */
-    @Override
-    public void remove() {
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.persistence.query.ir.result.ResultIterator#finalizeCursor(org.apache.usergrid.persistence.cassandra
-     * .CursorCache)
-     */
-    @Override
-    public void finalizeCursor( CursorCache cache, UUID lastLoaded ) {
-
-    }
-}


Mime
View raw message