Package org.candlepin.paging

Examples of org.candlepin.paging.PageRequest


    @Test
    public void testGetPrevPage() {
        Page p = new Page();
        p.setMaxRecords(55);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(3);

        assertEquals(Integer.valueOf(2), interceptor.getPrevPage(p));
    }
View Full Code Here


    @Test
    public void testGetPrevPageWhenOnFirstPage() {
        Page p = new Page();
        p.setMaxRecords(55);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(1);

        assertNull(interceptor.getPrevPage(p));
    }
View Full Code Here

    @Test
    public void testGetNextPage() {
        Page p = new Page();
        p.setMaxRecords(55);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(3);

        assertEquals(Integer.valueOf(4), interceptor.getNextPage(p));
    }
View Full Code Here

    @Test
    public void testGetNextPageWhenNoNextAvailable() {
        Page p = new Page();
        p.setMaxRecords(55);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(6);

        assertNull(interceptor.getNextPage(p));
    }
View Full Code Here

    @Test
    public void testGetLastPage() {
        Page p = new Page();
        p.setMaxRecords(55);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(1);

        assertEquals(Integer.valueOf(6), interceptor.getLastPage(p));
    }
View Full Code Here

    @Test
    public void testGetLastPageWhenMaxRecordsLessThanLimit() {
        Page p = new Page();
        p.setMaxRecords(8);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(1);

        assertEquals(Integer.valueOf(1), interceptor.getLastPage(p));
    }
View Full Code Here

    @Test
    public void testGetLastPageWhenEvenlyDivisible() {
        Page p = new Page();
        p.setMaxRecords(10);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(1);

        assertEquals(Integer.valueOf(1), interceptor.getLastPage(p));
    }
View Full Code Here

    @Test
    public void testPagesWithOutOfBoundsInitialPage() {
        Page p = new Page();
        p.setMaxRecords(8);

        PageRequest pr = new PageRequest();
        p.setPageRequest(pr);

        pr.setPerPage(10);
        pr.setPage(2);

        assertNull(interceptor.getPrevPage(p));
        assertNull(interceptor.getNextPage(p));
        assertEquals(Integer.valueOf(1), interceptor.getLastPage(p));
    }
View Full Code Here

        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status");

        interceptor.preProcess(req, rmethod);

        PageRequest p = ResteasyProviderFactory.getContextData(PageRequest.class);
        assertNull(p);
    }
View Full Code Here

        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status?per_page=10&page=4");

        interceptor.preProcess(req, rmethod);

        PageRequest p = ResteasyProviderFactory.getContextData(PageRequest.class);
        assertEquals(Integer.valueOf(10), p.getPerPage());
        assertEquals(Integer.valueOf(4), p.getPage());
        assertEquals(PageRequest.DEFAULT_ORDER, p.getOrder());
        assertNull(p.getSortBy());
    }
View Full Code Here

TOP

Related Classes of org.candlepin.paging.PageRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.