use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindSlice.
@Test
public void testFindSlice() {
Slice<PersonView> actual = personViewRepository.findByIdIsNotNull(new PageRequest(0, 1, Sort.Direction.ASC, "id"));
assertEquals(1, actual.getSize());
assertEquals("Mother", actual.getContent().get(0).getName());
actual = personViewRepository.findByIdIsNotNull(new PageRequest(1, 1, Sort.Direction.ASC, "id"));
assertEquals(1, actual.getSize());
assertEquals("John Doe", actual.getContent().get(0).getName());
}
use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindBy.
@Test
public void testFindBy() {
List<PersonView> expected = Arrays.asList(fetch(PersonView.class, persons[2].getId()), fetch(PersonView.class, persons[4].getId()));
Person example = new Person();
example.setPosition(4);
// we do not test DeltaSpike's findBy(E, SingularAttribute<E,?>...) method here because its results are non-deterministic
assertEquals(expected, personViewRepository.findBy(example, Person_.position));
}
use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindAllWithKeysetExtraction.
@Test
public void testFindAllWithKeysetExtraction() {
Pageable pageable = new KeysetPageRequest(null, new Sort("id"), 0, 5, true, true);
Page<PersonView> page = personViewRepository.findAll(pageable);
KeysetAwarePage<PersonView> keysetAwarePage = (KeysetAwarePage<PersonView>) page;
assertEquals(5, keysetAwarePage.getKeysetPage().getKeysets().size());
}
Aggregations