use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class ExtendedEntityViewRepositoryTest method testFindAnyByName.
@Test
public void testFindAnyByName() {
String name = "John Smith";
PersonView result1 = personViewRepository.findAnyByName(name);
PersonView result2 = simplePersonViewRepository.findAnyByName(name);
assertEquals(persons[4].getId(), result1.getId());
assertEquals(result1, result2);
}
use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class ExtendedEntityViewRepositoryTest method testFindFirstByNameLikeOrderByIdAsc.
@Test
public void testFindFirstByNameLikeOrderByIdAsc() {
PersonView result1 = personViewRepository.findFirst1ByNameLikeOrderByIdAsc("John%");
PersonView result2 = personViewRepository.findTop1ByNameLikeOrderByIdAsc("John%");
assertEquals(persons[1].getId(), result1.getId());
assertEquals(persons[1].getId(), result2.getId());
}
use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindByLikePaginated.
@Test
public void testFindByLikePaginated() {
Person example = new Person();
example.setName("John %");
// we do not test DeltaSpike's findByLike(E, int, int, SingularAttribute<E,?>...) method here because its results are non-deterministic
List<PersonView> page2 = personViewRepository.findByLike(example, 1, 1, Person_.name);
assertEquals(1, page2.size());
assertEquals(persons[4].getId(), page2.get(0).getId());
List<PersonView> page1 = personViewRepository.findByLike(example, 0, 1, Person_.name);
assertEquals(1, page1.size());
assertEquals(persons[1].getId(), page1.get(0).getId());
}
use of com.blazebit.persistence.deltaspike.data.testsuite.view.PersonView in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindSliceKeyset.
@Test
@Category(NoH2.class)
public void testFindSliceKeyset() {
Slice<PersonView> actual = personViewRepository.findByIdIsNotNull(new KeysetPageRequest(null, new PageRequest(0, 1, Sort.Direction.ASC, "id")));
assertEquals(1, actual.getSize());
assertEquals("Mother", actual.getContent().get(0).getName());
actual = personViewRepository.findByIdIsNotNull(actual.nextPageable());
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 testFindByLike.
@Test
public void testFindByLike() {
List<PersonView> expected = Arrays.asList(fetch(PersonView.class, persons[1].getId()), fetch(PersonView.class, persons[4].getId()));
Person example = new Person();
example.setName("John %");
// we do not test DeltaSpike's findByLike(E, SingularAttribute<E,?>...) method here because its results are non-deterministic
assertEquals(expected, personViewRepository.findByLike(example, Person_.name));
}
Aggregations