@@ -0,0 +1,2681 @@
+/**%0A * Copyright 2015 Impetus Infotech.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.impetus.client.query;%0A%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0Aimport javax.persistence.EntityManager;%0Aimport javax.persistence.EntityManagerFactory;%0Aimport javax.persistence.Persistence;%0A%0Aimport org.junit.After;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport com.impetus.client.hbase.crud.BaseTest;%0Aimport com.impetus.client.hbase.crud.PersonHBase;%0Aimport com.impetus.client.hbase.junits.HBaseCli;%0Aimport com.impetus.kundera.query.IResultIterator;%0Aimport com.impetus.kundera.query.Query;%0A%0A/**%0A * @author Pragalbh Garg junit for %7B@link IResultIterator%7D.%0A */%0Apublic class PaginationTests extends BaseTest%0A%7B%0A    private static final int NO_OF_RECORDS = 1000;%0A%0A    /** The emf. */%0A    private EntityManagerFactory emf;%0A%0A    /** The em. */%0A    private EntityManager em;%0A%0A    private HBaseCli cli = new HBaseCli();%0A%0A    /**%0A     * Sets the up.%0A     * %0A     * @throws Exception%0A     *             the exception%0A     */%0A    @Before%0A    public void setUp() throws Exception%0A    %7B%0A        cli.startCluster();%0A        emf = Persistence.createEntityManagerFactory(%22hbaseTest%22);%0A        em = emf.createEntityManager();%0A        persistData(NO_OF_RECORDS);%0A    %7D%0A%0A    @After%0A    public void tearDown()%0A    %7B%0A        cli.stopCluster(%22PERSON_HBASE%22);%0A    %7D%0A%0A    @Test%0A    public void chunkScrollTest() throws Exception%0A    %7B%0A        int chunkSize = 50;%0A        Query query = (Query) em.createQuery(%22Select p from PersonHBase p%22, PersonHBase.class);%0A        Iterator%3CPersonHBase%3E iter = query.iterate();%0A        IResultIterator%3CPersonHBase%3E iIter = (IResultIterator%3CPersonHBase%3E) iter;%0A        while (iIter.hasNext())%0A        %7B%0A            List%3CPersonHBase%3E result = iIter.next(chunkSize);%0A            Assert.assertNotNull(result);%0A            Assert.assertEquals(50, result.size());%0A        %7D%0A    %7D%0A%0A    private void persistData(int noOfRecords)%0A    %7B%0A        while (noOfRecords-- == 0)%0A        %7B%0A            Object p = prepareHbaseInstance(%22%22 + noOfRecords, 20);%0A            em.persist(p);%0A            em.clear();%0A        %7D%0A    %0A    %7D%0A%7D

test for chunk scrolling, #384