http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 new file mode 100644 index 0000000..a6930a0 --- /dev/null +++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java @@ -0,0 +1,1432 @@ +/* + * 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; + + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.usergrid.CoreApplication; +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 static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +/** @author tnine */ +public class IteratingQueryIT { + private static final Logger LOG = LoggerFactory.getLogger( IteratingQueryIT.class ); + + @ClassRule + public static CoreITSetup setup = new CoreITSetupImpl( ); + + @Rule + public CoreApplication app = new CoreApplication( setup ); + + + @Test + public void allInCollection() throws Exception { + allIn( new CollectionIoHelper( app ) ); + } + + + @Test + public void allInConnection() throws Exception { + allIn( new ConnectionHelper( app ) ); + } + + + @Test + public void allInConnectionNoType() throws Exception { + allIn( new ConnectionNoTypeHelper( app ) ); + } + + + @Test + public void multiOrderByCollection() throws Exception { + multiOrderBy( new CollectionIoHelper( app ) ); + } + + + @Test + public void multiOrderByComplexUnionCollection() throws Exception { + multiOrderByComplexUnion( new CollectionIoHelper( app ) ); + } + + + @Test + public void multiOrderByComplexUnionConnection() throws Exception { + multiOrderByComplexUnion( new CollectionIoHelper( app ) ); + } + + + @Test + public void multOrderByConnection() throws Exception { + multiOrderBy( new ConnectionHelper( app ) ); + } + + + @Test + public void orderByWithNotCollection() throws Exception { + notOrderBy( new CollectionIoHelper( app ) ); + } + + + @Test + public void orderByWithNotConnection() throws Exception { + notOrderBy( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByBoundRangeScanAscCollection() throws Exception { + singleOrderByBoundRangeScanAsc( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByBoundRangeScanAscConnection() throws Exception { + singleOrderByBoundRangeScanAsc( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByBoundRangeScanDescCollection() throws Exception { + singleOrderByBoundRangeScanDesc( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByBoundRangeScanDescConnection() throws Exception { + singleOrderByBoundRangeScanDesc( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByComplexIntersectionCollection() throws Exception { + singleOrderByComplexIntersection( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByComplexIntersectionConnection() throws Exception { + singleOrderByComplexIntersection( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByComplexUnionCollection() throws Exception { + singleOrderByComplexUnion( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByComplexUnionConnection() throws Exception { + singleOrderByComplexUnion( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByIntersectionCollection() throws Exception { + singleOrderByIntersection( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByIntersectionConnection() throws Exception { + singleOrderByIntersection( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByLessThanLimitCollection() throws Exception { + singleOrderByLessThanLimit( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByLessThanLimitConnection() throws Exception { + singleOrderByLessThanLimit( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByMaxLimitCollection() throws Exception { + singleOrderByMaxLimit( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByMaxLimitConnection() throws Exception { + singleOrderByMaxLimit( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderByNoIntersectionCollection() throws Exception { + singleOrderByNoIntersection( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByNoIntersectionConnection() throws Exception { + singleOrderByNoIntersection( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByNotCollection() throws Exception { + singleOrderByNot( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderByNotConnection() throws Exception { + singleOrderByNot( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanGreaterCollection() throws Exception { + singleOrderBySameRangeScanGreater( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanGreaterConnection() throws Exception { + singleOrderBySameRangeScanGreater( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanGreaterThanEqualCollection() throws Exception { + singleOrderBySameRangeScanGreaterThanEqual( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanLessCollection() throws Exception { + singleOrderBySameRangeScanLessEqual( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanLessConnection() throws Exception { + singleOrderBySameRangeScanLessEqual( new ConnectionHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanLessThanEqualCollection() throws Exception { + singleOrderBySameRangeScanLessThanEqual( new CollectionIoHelper( app ) ); + } + + + @Test + public void singleOrderBySameRangeScanLessThanEqualConnection() throws Exception { + singleOrderBySameRangeScanLessThanEqual( new ConnectionHelper( app ) ); + } + + class ConnectionNoTypeHelper extends ConnectionHelper { + + public ConnectionNoTypeHelper( final CoreApplication app ) { + super( app ); + } + + + /** + * (non-Javadoc) @see org.apache.usergrid.persistence.query.SingleOrderByMaxLimitCollection + * .ConnectionHelper#getResults + * (org.apache.usergrid.persistence.Query) + */ + @Override + public Results getResults( Query query ) throws Exception { + query.setConnectionType( CONNECTION ); + // don't set it on purpose + query.setEntityType( null ); + return app.getEntityManager().searchConnectedEntities( rootEntity, query ); + } + } + + public void singleOrderByMaxLimit( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + entity.put( "name", String.valueOf( i ) ); + + io.writeEntity( entity ); + //we have to sleep, or we kill embedded cassandra + Thread.sleep( 10 ); + + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "created" ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( String.valueOf( count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( size, count ); + } + + + protected void singleOrderByIntersection( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 700; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + int intersectIncrement = 5; + + long start = System.currentTimeMillis(); + + List<String> expected = new ArrayList<String>( size / intersectIncrement ); + + LOG.info( "Writing {} entities.", size ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + + String name = String.valueOf( i ); + + boolean intersect = i % intersectIncrement == 0; + + entity.put( "name", String.valueOf( i ) ); + // if we hit the increment, set this to true + entity.put( "intersect", intersect ); + + io.writeEntity( entity ); + + if ( intersect ) { + expected.add( name ); + } + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "created" ); + query.addEqualityFilter( "intersect", true ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( expected.size(), count ); + } + + + protected void singleOrderByComplexIntersection( IoHelper io ) throws Exception { + + int size = 2000; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + int intersectIncrement = 5; + int secondIncrement = 9; + + long start = System.currentTimeMillis(); + + io.doSetup(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expectedResults = new ArrayList<String>( size / secondIncrement ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + + String name = String.valueOf( i ); + boolean intersect1 = i % intersectIncrement == 0; + boolean intersect2 = i % secondIncrement == 0; + entity.put( "name", name ); + // if we hit the increment, set this to true + + entity.put( "intersect", intersect1 ); + entity.put( "intersect2", intersect2 ); + io.writeEntity( entity ); + + if ( intersect1 && intersect2 ) { + expectedResults.add( name ); + } + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "created" ); + query.addEqualityFilter( "intersect", true ); + query.addEqualityFilter( "intersect2", true ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expectedResults.get( count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( expectedResults.size(), count ); + } + + + protected void singleOrderByNoIntersection( IoHelper io ) throws Exception { + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + int secondIncrement = 9; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + entity.put( "name", String.valueOf( i ) ); + // if we hit the increment, set this to true + entity.put( "intersect", false ); + entity.put( "intersect2", i % secondIncrement == 0 ); + io.writeEntity( entity ); + } + + long stop = System.currentTimeMillis(); + + 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.setLimit( queryLimit ); + + start = System.currentTimeMillis(); + + Results results = io.getResults( query ); + + // now do simple ordering, should be returned in order + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, 0 ); + + assertEquals( 0, results.size() ); + } + + + protected void singleOrderByComplexUnion( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + int intersectIncrement = 5; + int secondIncrement = 9; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expectedResults = new ArrayList<String>( size / secondIncrement ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + + String name = String.valueOf( i ); + boolean intersect1 = i % intersectIncrement == 0; + boolean intersect2 = i % secondIncrement == 0; + entity.put( "name", name ); + // if we hit the increment, set this to true + + entity.put( "intersect", intersect1 ); + entity.put( "intersect2", intersect2 ); + io.writeEntity( entity ); + + if ( intersect1 || intersect2 ) { + expectedResults.add( name ); + } + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = Query.fromQL( "select * where intersect = true OR intersect2 = true order by created" ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expectedResults.get( count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( expectedResults.size(), count ); + } + + + protected void singleOrderByNot( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + int intersectIncrement = 5; + int secondIncrement = 9; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expectedResults = new ArrayList<String>( size / secondIncrement ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + + String name = String.valueOf( i ); + boolean intersect1 = i % intersectIncrement == 0; + boolean intersect2 = i % secondIncrement == 0; + entity.put( "name", name ); + // if we hit the increment, set this to true + + entity.put( "intersect", intersect1 ); + entity.put( "intersect2", intersect2 ); + io.writeEntity( entity ); + + if ( !( intersect1 && intersect2 ) ) { + expectedResults.add( name ); + } + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = Query.fromQL( "select * where NOT (intersect = true AND intersect2 = true) order by created" ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expectedResults.get( count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( expectedResults.size(), count ); + } + + + protected void singleOrderByLessThanLimit( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + int matchMax = queryLimit - 1; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( matchMax ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + boolean searched = i < matchMax; + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "searched", searched ); + io.writeEntity( entity ); + + if ( searched ) { + expected.add( name ); + } + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "created" ); + query.setLimit( queryLimit ); + query.addEqualityFilter( "searched", true ); + + int count = 0; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( count ), results.getEntities().get( i ).getName() ); + count++; + } + + assertTrue( results.getCursor() == null ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( expected.size(), count ); + } + + + protected void singleOrderBySameRangeScanLessThanEqual( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = 100; + int startValue = 400; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( size ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "index", i ); + io.writeEntity( entity ); + expected.add( name ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "index desc" ); + query.addLessThanEqualFilter( "index", startValue ); + query.setLimit( queryLimit ); + + int count = 0; + int delta = size - startValue; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results; + + do { + + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( size - delta - count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.hasCursor() ); + + assertEquals( expected.size() - delta + 1, count ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + } + + + protected void singleOrderBySameRangeScanLessEqual( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = 100; + int startValue = 400; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( size ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "index", i ); + io.writeEntity( entity ); + expected.add( name ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "index desc" ); + query.addLessThanFilter( "index", startValue ); + query.setLimit( queryLimit ); + + int count = 0; + int delta = size - startValue; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results; + + do { + + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( size - delta - count - 1 ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.hasCursor() ); + + assertEquals( expected.size() - delta, count ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + } + + + protected void singleOrderBySameRangeScanGreaterThanEqual( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = 100; + int startValue = 100; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( size ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "index", i ); + io.writeEntity( entity ); + expected.add( name ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "index desc" ); + query.addGreaterThanEqualFilter( "index", startValue ); + query.setLimit( queryLimit ); + + int count = 0; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results; + + do { + + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( size - count - 1 ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.hasCursor() ); + + assertEquals( expected.size() - startValue, count ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + } + + + protected void singleOrderBySameRangeScanGreater( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = 100; + int startValue = 99; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( size ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "index", i ); + io.writeEntity( entity ); + expected.add( name ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = new Query(); + query.addSort( "index desc" ); + query.addGreaterThanFilter( "index", startValue ); + query.setLimit( queryLimit ); + + int count = 0; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results; + + do { + + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( size - count - 1 ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.hasCursor() ); + + assertEquals( expected.size() - startValue - 1, count ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + } + + + protected void singleOrderByBoundRangeScanDesc( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = 100; + int startValue = 100; + int endValue = 400; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( size ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "index", i ); + io.writeEntity( entity ); + expected.add( name ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = Query.fromQL( + String.format( "select * where index >= %d AND index <= %d order by index desc", startValue, + endValue ) ); + query.setLimit( queryLimit ); + + int count = 0; + int delta = size - endValue; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results; + + do { + + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( size - count - delta ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.hasCursor() ); + + assertEquals( expected.size() - startValue - delta + 1, count ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + } + + + protected void singleOrderByBoundRangeScanAsc( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = 100; + int startValue = 100; + int endValue = 400; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + List<String> expected = new ArrayList<String>( size ); + + for ( int i = 0; i < size; i++ ) { + String name = String.valueOf( i ); + + Map<String, Object> entity = new HashMap<String, Object>(); + + entity.put( "name", name ); + entity.put( "index", i ); + io.writeEntity( entity ); + expected.add( name ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = Query.fromQL( + String.format( "select * where index >= %d AND index <= %d order by index asc", startValue, + endValue ) ); + query.setLimit( queryLimit ); + + int count = 0; + int delta = size - endValue; + + start = System.currentTimeMillis(); + + // now do simple ordering, should be returned in order + Results results; + + do { + + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( expected.get( delta + count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.hasCursor() ); + + assertEquals( expected.size() - startValue - delta + 1, count ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + } + + + /** + * Tests that when an empty query is issued, we page through all entities correctly + * + * @param io the io helper + */ + protected void allIn( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 300; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + entity.put( "name", String.valueOf( i ) ); + + io.writeEntity( entity ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + app.getEntityManager().refreshIndex(); + + Query query = new Query(); + query.setLimit( 100 ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + assertEquals( String.valueOf( count ), results.getEntities().get( i ).getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( size, count ); + } + + + protected void multiOrderBy( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + + Set<Entity> sortedResults = new TreeSet<Entity>( new Comparator<Entity>() { + + @Override + public int compare( Entity o1, Entity o2 ) { + boolean o1Boolean = ( Boolean ) o1.getProperty( "boolean" ); + boolean o2Boolean = ( Boolean ) o2.getProperty( "boolean" ); + + if ( o1Boolean != o2Boolean ) { + if ( o1Boolean ) { + return -1; + } + + return 1; + } + + int o1Index = ( Integer ) o1.getProperty( "index" ); + int o2Index = ( Integer ) o2.getProperty( "index" ); + + if ( o1Index > o2Index ) { + return 1; + } + else if ( o2Index > o1Index ) { + return -1; + } + + return 0; + } + } ); + + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + + String name = String.valueOf( i ); + boolean bool = i % 2 == 0; + entity.put( "name", name ); + entity.put( "boolean", bool ); + + /** + * we want them to be ordered from the "newest" time uuid to the oldec since we + * have a low cardinality value as the first second clause. This way the test + *won't accidentally pass b/c the UUID ordering matches the index ordering. If we were + *to reverse the value of index (size-i) the test would pass incorrectly + */ + + entity.put( "index", i ); + + Entity saved = io.writeEntity( entity ); + + sortedResults.add( saved ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + app.getEntityManager().refreshIndex(); + + Query query = Query.fromQL( "select * order by boolean desc, index asc" ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + Iterator<Entity> itr = sortedResults.iterator(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { + Entity expected = itr.next(); + Entity returned = results.getEntities().get( i ); + + assertEquals( "Order incorrect", expected.getName(), returned.getName() ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( sortedResults.size(), count ); + } + + + protected void multiOrderByComplexUnion( IoHelper io ) throws Exception { + + io.doSetup(); + + int size = 200; + int queryLimit = Query.MAX_LIMIT; + + // the number of entities that should be written including an intersection + int intersectIncrement = 5; + int secondIncrement = 9; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + Set<Entity> sortedResults = new TreeSet<Entity>( new Comparator<Entity>() { + + @Override + public int compare( Entity o1, Entity o2 ) { + long o1Index = ( Long ) o1.getProperty( "created" ); + long o2Index = ( Long ) o2.getProperty( "created" ); + + if ( o1Index > o2Index ) { + return 1; + } + else if ( o2Index > o1Index ) { + return -1; + } + + + boolean o1Boolean = ( Boolean ) o1.getProperty( "intersect" ); + boolean o2Boolean = ( Boolean ) o2.getProperty( "intersect" ); + + if ( o1Boolean != o2Boolean ) { + if ( o1Boolean ) { + return -1; + } + + return 1; + } + + + return 0; + } + } ); + + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); + + String name = String.valueOf( i ); + boolean intersect1 = i % intersectIncrement == 0; + boolean intersect2 = i % secondIncrement == 0; + entity.put( "name", name ); + // if we hit the increment, set this to true + + entity.put( "intersect", intersect1 ); + entity.put( "intersect2", intersect2 ); + Entity e = io.writeEntity( entity ); + + if ( intersect1 || intersect2 ) { + sortedResults.add( e ); + } + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + app.getEntityManager().refreshIndex(); + + Query query = + Query.fromQL( "select * where intersect = true OR intersect2 = true order by created, intersect desc" ); + query.setLimit( queryLimit ); + + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + Iterator<Entity> expected = sortedResults.iterator(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( Entity result : results.getEntities() ) { + assertEquals( expected.next(), result ); + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( sortedResults.size(), count ); + } + + + /** + * Tests that when an empty query is issued, we page through all entities correctly + * + * @param io the io helper + */ + protected void notOrderBy( IoHelper io ) throws Exception { + + io.doSetup(); + + /** + * Leave this as a large size. We have to write over 1k to reproduce this issue + */ + int size = 200; + + long start = System.currentTimeMillis(); + + LOG.info( "Writing {} entities.", size ); + + 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 % 2 == 0)); + entity.put( "index", i); + + io.writeEntity( entity ); + } + + long stop = System.currentTimeMillis(); + + LOG.info( "Writes took {} ms", stop - start ); + + Query query = Query.fromQL("select * where NOT boolean = false order by index asc"); + query.setLimit( 20 ); + + int index = 0; + int count = 0; + + Results results; + + start = System.currentTimeMillis(); + + do { + + // now do simple ordering, should be returned in order + results = io.getResults( query ); + + for ( int i = 0; i < results.size(); i++ ) { +// assertEquals( String.valueOf( index ), results.getEntities().get( i ).getName() ); +// index +=2; + count++; + } + + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + stop = System.currentTimeMillis(); + LOG.info( "Query took {} ms to return {} entities", stop - start, count ); + + assertEquals( size/2, count ); + } + + +}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByCollectionIT.java deleted file mode 100644 index 3651129..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class MultiOrderByCollectionIT extends AbstractIteratingQueryIT { - @Test - public void multiOrderByCollection() throws Exception { - multiOrderBy( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionCollectionIT.java deleted file mode 100644 index 6d7d799..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class MultiOrderByComplexUnionCollectionIT extends AbstractIteratingQueryIT { - @Test - public void multiOrderByComplexUnionCollection() throws Exception { - multiOrderByComplexUnion( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionConnectionIT.java deleted file mode 100644 index 9543d1e..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByComplexUnionConnectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class MultiOrderByComplexUnionConnectionIT extends AbstractIteratingQueryIT { - @Test - public void multiOrderByComplexUnionConnection() throws Exception { - multiOrderByComplexUnion( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByConnectionIT.java deleted file mode 100644 index 3a0c5fd..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/MultiOrderByConnectionIT.java +++ /dev/null @@ -1,32 +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; - - -import org.junit.Test; -import org.apache.usergrid.cassandra.Concurrent; - - -/** @author tnine */ -@Concurrent() -public class MultiOrderByConnectionIT extends AbstractIteratingQueryIT { - - @Test - public void multOrderByConnection() throws Exception { - multiOrderBy( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByCollectionIT.java deleted file mode 100644 index 193bbce..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class NotOrderByCollectionIT extends AbstractIteratingQueryIT { - @Test - public void orderByWithNot() throws Exception { - notOrderBy( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByConnectionIT.java deleted file mode 100644 index 03ede21..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/NotOrderByConnectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class NotOrderByConnectionIT extends AbstractIteratingQueryIT { - @Test - public void orderByWithNot() throws Exception { - notOrderBy( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 13f7b22..d0b292d 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 @@ -23,13 +23,17 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.apache.usergrid.persistence.index.query.Query; +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.cassandra.QueryProcessor; +import org.apache.usergrid.persistence.index.query.Query; import static org.junit.Assert.assertEquals; @@ -37,141 +41,136 @@ import static org.junit.Assert.assertEquals; /** * Tests sub entites in full results */ -public class NotSubPropertyIT extends AbstractIteratingQueryIT { +public class NotSubPropertyIT { private static final Logger LOG = LoggerFactory.getLogger( IntersectionUnionPagingIT.class ); - private static final String notQuery = - "select * where NOT subArray.usageType = 'true1'"; - - private static final int PAGE_SIZE = 300; + private static final String notQuery = "select * where NOT subArray.usageType = 'true1'"; + private static final int PAGE_SIZE = 300; - @Test - public void testNotPagingCollection() throws Exception { + @ClassRule + public static CoreITSetup setup = new CoreITSetupImpl( ); - final CollectionIoHelper collectionIoHelper = new CollectionIoHelper( app ); + @Rule + public CoreApplication app = new CoreApplication( setup ); - List<UUID> expected = performSetup( collectionIoHelper ); - - testSubPropertySearching( collectionIoHelper, notQuery, expected ); - } + @Test + public void testNotPagingCollection() throws Exception { - @Test - public void testNotPagingConnection() throws Exception { + final CollectionIoHelper collectionIoHelper = new CollectionIoHelper( app ); - final ConnectionHelper connectionHelper = new ConnectionHelper( app ); + List<UUID> expected = performSetup( collectionIoHelper ); - List<UUID> expected = performSetup( connectionHelper ); + testSubPropertySearching( collectionIoHelper, notQuery, expected ); + } - testSubPropertySearching( connectionHelper, notQuery, expected ); - } + @Test + public void testNotPagingConnection() throws Exception { - /** - * Perform the writes - * @param io - * @return - * @throws Exception - */ - private List<UUID> performSetup( final IoHelper io ) throws Exception { - io.doSetup(); + final ConnectionHelper connectionHelper = new ConnectionHelper( app ); - int size = ( int ) ( QueryProcessor.PAGE_SIZE*2.5); + List<UUID> expected = performSetup( connectionHelper ); - long start = System.currentTimeMillis(); - LOG.info( "Writing {} entities.", size ); + testSubPropertySearching( connectionHelper, notQuery, expected ); + } + /** + * Perform the writes + */ + private List<UUID> performSetup( final IoHelper io ) throws Exception { + io.doSetup(); - List<UUID> expected = new ArrayList<UUID>(size); + int size = 200; - for ( int i = 0; i < size; i++ ) { - Map<String, Object> entity = new HashMap<String, Object>(); + long start = System.currentTimeMillis(); + LOG.info( "Writing {} entities.", size ); - final boolean usageTypeBool = i%2 == 0; - final String usageType = String.valueOf( usageTypeBool ); + List<UUID> expected = new ArrayList<UUID>( size ); - List<Map<String, Object>> subArray = new ArrayList<Map<String, Object>>(); + for ( int i = 0; i < size; i++ ) { + Map<String, Object> entity = new HashMap<String, Object>(); - for(int j = 0; j < 2; j ++){ - Map<String, Object> subFields = new HashMap<String, Object>(); - subFields.put( "startDate", 10000 ); - subFields.put( "endDate", 20000); - subFields.put( "usageType", usageType+j ); + final boolean usageTypeBool = i % 2 == 0; + final String usageType = String.valueOf( usageTypeBool ); - subArray.add( subFields ); - } + List<Map<String, Object>> subArray = new ArrayList<Map<String, Object>>(); - entity.put( "subArray", subArray ); + for ( int j = 0; j < 2; j++ ) { - UUID entityId = io.writeEntity( entity ).getUuid(); + Map<String, Object> subFields = new HashMap<String, Object>(); + subFields.put( "startDate", 10000 ); + subFields.put( "endDate", 20000 ); + subFields.put( "usageType", usageType + j ); - if(!usageTypeBool){ - expected.add(entityId); - } + subArray.add( subFields ); + } + entity.put( "subArray", subArray ); + UUID entityId = io.writeEntity( entity ).getUuid(); + if ( !usageTypeBool ) { + expected.add( entityId ); } - - long stop = System.currentTimeMillis(); - - LOG.info( "Writes took {} ms", stop - start ); - - return expected; } + long stop = System.currentTimeMillis(); - private void testSubPropertySearching( final IoHelper io, final String queryString, - final List<UUID> expectedResults ) - throws Exception { + LOG.info( "Writes took {} ms", stop - start ); + return expected; + } - //our field1Or has a result size < our page size, so it shouldn't blow up when the cursor is getting created - //the leaf iterator should insert it's own "no value left" into the cursor - Query query = Query.fromQL( queryString ); - query.setLimit( PAGE_SIZE ); + private void testSubPropertySearching( final IoHelper io, final String queryString, + final List<UUID> expectedResults ) throws Exception { - Results results; - long start = System.currentTimeMillis(); - int expectedIndex = 0; + //our field1Or has a result size < our page size, so it shouldn't blow up when the cursor is getting created + //the leaf iterator should insert it's own "no value left" into the cursor + Query query = Query.fromQL( queryString ); + query.setLimit( PAGE_SIZE ); - do { + Results results; - // now do simple ordering, should be returned in order - results = io.getResults( query ); + long start = System.currentTimeMillis(); + int expectedIndex = 0; + do { + // now do simple ordering, should be returned in order + results = io.getResults( query ); - for ( int i = 0; i < results.size(); i++, expectedIndex++ ) { - final UUID returned = results.getEntities().get( i ).getUuid(); - final UUID expected = expectedResults.get( expectedIndex ); - assertEquals( "Not returned as excpected", expected, returned ); - } + for ( int i = 0; i < results.size(); i++, expectedIndex++ ) { + final UUID returned = results.getEntities().get( i ).getUuid(); + final UUID expected = expectedResults.get( expectedIndex ); - query.setCursor( results.getCursor() ); + assertEquals( "Not returned as excpected", expected, returned ); } - while ( results.getCursor() != null ); - long stop = System.currentTimeMillis(); + query.setCursor( results.getCursor() ); + } + while ( results.getCursor() != null ); + + long stop = System.currentTimeMillis(); - LOG.info( "Query took {} ms to return {} entities", stop - start, expectedResults.size() ); + LOG.info( "Query took {} ms to return {} entities", stop - start, expectedResults.size() ); - assertEquals( "All names returned", expectedResults.size(), expectedIndex ); - } + assertEquals( "All names returned", expectedResults.size(), expectedIndex ); + } } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscCollectionIT.java deleted file mode 100644 index 1af7501..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByBoundRangeScanAscCollectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByBoundRangeScanAscCollection() throws Exception { - singleOrderByBoundRangeScanAsc( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscConnectionIT.java deleted file mode 100644 index 8b5bd68..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanAscConnectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByBoundRangeScanAscConnectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByBoundRangeScanAscConnection() throws Exception { - singleOrderByBoundRangeScanAsc( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescCollectionIT.java deleted file mode 100644 index 2982ffa..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByBoundRangeScanDescCollectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByBoundRangeScanDescCollection() throws Exception { - singleOrderByBoundRangeScanDesc( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescConnectionIT.java deleted file mode 100644 index 65d5d57..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByBoundRangeScanDescConnectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByBoundRangeScanDescConnectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByBoundRangeScanDescConnection() throws Exception { - singleOrderByBoundRangeScanDesc( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionCollectionIT.java deleted file mode 100644 index c7be821..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByComplexIntersectionCollectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByComplexIntersectionCollection() throws Exception { - singleOrderByComplexIntersection( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionConnectionIT.java deleted file mode 100644 index 1fe1320..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexIntersectionConnectionIT.java +++ /dev/null @@ -1,30 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByComplexIntersectionConnectionIT extends AbstractIteratingQueryIT { - - @Test - public void singleOrderByComplexIntersectionConnection() throws Exception { - singleOrderByComplexIntersection( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionCollectionIT.java deleted file mode 100644 index 00d8d10..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByComplexUnionCollectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByComplexUnionCollection() throws Exception { - singleOrderByComplexUnion( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionConnectionIT.java deleted file mode 100644 index e69e730..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByComplexUnionConnectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByComplexUnionConnectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByComplexUnionConnection() throws Exception { - singleOrderByComplexUnion( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionCollectionIT.java deleted file mode 100644 index 29ff610..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionCollectionIT.java +++ /dev/null @@ -1,31 +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; - - -import org.junit.Test; -import org.apache.usergrid.cassandra.Concurrent; - - -/** @author tnine */ -@Concurrent() -public class SingleOrderByIntersectionCollectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByIntersectionCollection() throws Exception { - singleOrderByIntersection( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionConnectionIT.java deleted file mode 100644 index ff1b29b..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByIntersectionConnectionIT.java +++ /dev/null @@ -1,31 +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; - - -import org.junit.Test; -import org.apache.usergrid.cassandra.Concurrent; - - -/** @author tnine */ -@Concurrent() -public class SingleOrderByIntersectionConnectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByIntersectionConnection() throws Exception { - singleOrderByIntersection( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitCollectionIT.java deleted file mode 100644 index f597a82..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitCollectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByLessThanLimitCollectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByLessThanLimitCollection() throws Exception { - singleOrderByLessThanLimit( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitConnectionIT.java deleted file mode 100644 index edb02c7..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByLessThanLimitConnectionIT.java +++ /dev/null @@ -1,29 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByLessThanLimitConnectionIT extends AbstractIteratingQueryIT { - @Test - public void singleOrderByLessThanLimitConnection() throws Exception { - singleOrderByLessThanLimit( new ConnectionHelper(app) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitCollectionIT.java deleted file mode 100644 index 876e223..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitCollectionIT.java +++ /dev/null @@ -1,30 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByMaxLimitCollectionIT extends AbstractIteratingQueryIT { - - @Test - public void singleOrderByMaxLimitCollection() throws Exception { - singleOrderByMaxLimit( new CollectionIoHelper( app ) ); - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitConnectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitConnectionIT.java deleted file mode 100644 index 0b58023..0000000 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByMaxLimitConnectionIT.java +++ /dev/null @@ -1,30 +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; - - -import org.junit.Test; - - -/** @author tnine */ -public class SingleOrderByMaxLimitConnectionIT extends AbstractIteratingQueryIT { - - @Test - public void singleOrderByMaxLimitConnection() throws Exception { - singleOrderByMaxLimit( new ConnectionHelper(app) ); - } -}