use of org.apache.ignite.springdata.misc.Person in project ignite by apache.
the class IgniteSpringDataCrudSelfTest method testDelete.
/**
*
*/
public void testDelete() {
assertEquals(CACHE_SIZE, repo.count());
repo.delete(0);
assertEquals(CACHE_SIZE - 1, repo.count());
assertNull(repo.findOne(0));
try {
repo.delete(new Person("", ""));
fail("Managed to delete a Person without id");
} catch (UnsupportedOperationException e) {
//expected
}
}
use of org.apache.ignite.springdata.misc.Person in project ignite by apache.
the class IgniteSpringDataQueriesSelfTest method testQueryWithPaging.
/** */
public void testQueryWithPaging() {
List<Person> persons = repo.queryWithPageable("^[a-z]+$", new PageRequest(1, 7, Sort.Direction.DESC, "secondName"));
assertEquals(7, persons.size());
Person previous = persons.get(0);
for (Person person : persons) {
assertTrue(person.getSecondName().compareTo(previous.getSecondName()) <= 0);
assertTrue(person.getFirstName().matches("^[a-z]+$"));
previous = person;
}
}
use of org.apache.ignite.springdata.misc.Person in project ignite by apache.
the class IgniteSpringDataQueriesSelfTest method testEqualsPart.
/** */
public void testEqualsPart() {
List<Person> persons = repo.findByFirstName("person4e");
assertFalse(persons.isEmpty());
for (Person person : persons) assertEquals("person4e", person.getFirstName());
}
use of org.apache.ignite.springdata.misc.Person in project ignite by apache.
the class IgniteSpringDataQueriesSelfTest method testPageable.
/** */
public void testPageable() {
PageRequest pageable = new PageRequest(1, 5, Sort.Direction.DESC, "firstName");
HashSet<String> firstNames = new HashSet<>();
List<Person> pageable1 = repo.findByFirstNameRegex("^[a-z]+$", pageable);
assertEquals(5, pageable1.size());
for (Person person : pageable1) {
firstNames.add(person.getFirstName());
assertTrue(person.getFirstName().matches("^[a-z]+$"));
}
List<Person> pageable2 = repo.findByFirstNameRegex("^[a-z]+$", pageable.next());
assertEquals(5, pageable2.size());
for (Person person : pageable2) {
firstNames.add(person.getFirstName());
assertTrue(person.getFirstName().matches("^[a-z]+$"));
}
assertEquals(10, firstNames.size());
}
use of org.apache.ignite.springdata.misc.Person in project ignite by apache.
the class IgniteSpringDataCrudSelfTest method testPutGet.
/**
*
*/
public void testPutGet() {
Person person = new Person("some_name", "some_surname");
int id = CACHE_SIZE + 1;
assertEquals(person, repo.save(id, person));
assertTrue(repo.exists(id));
assertEquals(person, repo.findOne(id));
try {
repo.save(person);
fail("Managed to save a Person without ID");
} catch (UnsupportedOperationException e) {
//excepted
}
}
Aggregations