Re: Testing for Pagination

From: Gary Jarrel (garyjarre..mail.com)
Date: Wed Jun 30 2010 - 03:27:03 UTC

  • Next message: Aristedes Maniatis: "Re: Testing for Pagination"

    On Wed, Jun 30, 2010 at 11:42 AM, Aristedes Maniatis <ar..sh.com.au> wrote:

    >
    > Records after the first 10 will have a status of "hollow".
    >

    I've been trying to test for this using:

            SelectQuery s = new SelectQuery(Role.class);
            s.setPageSize(2);
            List<Role> results = getDataContext().performQuery(s);

            assertEquals(5, results.size());

            assertEquals(PersistenceState.COMMITTED,
    results.get(0).getPersistenceState());
            assertEquals(PersistenceState.COMMITTED,
    results.get(1).getPersistenceState());

            assertEquals(PersistenceState.HOLLOW,
    results.get(4).getPersistenceState());
            assertEquals(PersistenceState.HOLLOW,
    results.get(3).getPersistenceState());
            assertEquals(PersistenceState.HOLLOW,
    results.get(2).getPersistenceState());

    But it seems that results.get(n) always inflates the object and put it
    into a committed persistence state, hence the test fails.

    Any way to stop the object from inflating when you access it's
    Persistence State.

    I can see in the logs that the query has also changed to just select
    the object ID as follows:

    SELECT t0.role_id FROM role t0

    Thank you

    Gary



    This archive was generated by hypermail 2.0.0 : Wed Jun 30 2010 - 03:28:36 UTC