use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class LocalCacheTest method prepareTestingData.
private void prepareTestingData() {
person1 = new Person();
person1.setName("Navin Surtani");
person1.setAge(20);
person1.setBlurb("Likes playing WoW");
person1.setNonIndexedField("test1");
person2 = new Person();
person2.setName("Big Goat");
person2.setAge(30);
person2.setBlurb("Eats grass");
person2.setNonIndexedField("test2");
person3 = new Person();
person3.setName("Mini Goat");
person3.setAge(25);
person3.setBlurb("Eats cheese");
person3.setNonIndexedField("test3");
anotherGrassEater = new AnotherGrassEater("Another grass-eater", "Eats grass");
StaticTestingErrorHandler.assertAllGood(cache);
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class MultipleCachesTest method notIndexedCacheNormalUse.
@Test
public void notIndexedCacheNormalUse() {
cacheManager.defineConfiguration("notIndexedB", cacheManager.getDefaultCacheConfiguration());
final Cache<Object, Object> notIndexedCache = cacheManager.getCache("notIndexedB");
notIndexedCache.put("1", new Person("A Person's Name", "A paragraph containing some text", 75));
assert notIndexedCache.get("1") != null;
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredCacheTest method testPutForExternalRead.
public void testPutForExternalRead() throws Exception {
prepareTestData();
assertEquals(3, createSelectAllQuery(cache2).execute().list().size());
person4 = new Person();
person4.setName("New Goat");
person4.setBlurb("Also eats grass");
cache2.putForExternalRead("newGoat", person4);
eventually(() -> cache2.get("newGoat") != null);
Query<Person> query = createSelectAllQuery(cache2);
eventually(() -> {
List<Person> found = query.execute().list();
return found.size() == 4 && found.contains(person4);
});
Person person5 = new Person();
person5.setName("Abnormal Goat");
person5.setBlurb("Plays with grass.");
cache2.putForExternalRead("newGoat", person5);
eventually(() -> {
QueryResult<Person> result = query.execute();
List<Person> found = result.list();
return found.size() == 4 && result.hitCount().orElse(-1) == 4 && found.contains(person4) && !found.contains(person5);
});
StaticTestingErrorHandler.assertAllGood(cache1, cache2);
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredCacheTest method testPutMapAsync.
public void testPutMapAsync() throws Exception {
prepareTestData();
assert createSelectAllQuery(cache2).execute().list().size() == 3;
person4 = new Person();
person4.setName("New Goat");
person4.setBlurb("Also eats grass");
Map<String, Person> allWrites = new HashMap<>();
allWrites.put(key1, person1);
allWrites.put(key2, person2);
allWrites.put(key3, person3);
allWrites.put("newGoat", person4);
Future<Void> futureTask = cache2.putAllAsync(allWrites);
futureTask.get();
assert futureTask.isDone();
List<Person> found = createSelectAllQuery(cache2).execute().list();
assertEquals(4, found.size());
assert found.contains(person4);
futureTask = cache1.putAllAsync(allWrites);
futureTask.get();
assert futureTask.isDone();
found = createSelectAllQuery(cache2).execute().list();
assertEquals(4, found.size());
assert found.contains(person4);
StaticTestingErrorHandler.assertAllGood(cache1, cache2);
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredQueryTest method testEagerOrdered.
public void testEagerOrdered() {
Query<Person> cacheQuery = createSortedQuery();
try (CloseableIterator<Person> iterator = cacheQuery.iterator()) {
assertEquals(10, cacheQuery.execute().hitCount().orElse(-1));
int previousAge = 0;
while (iterator.hasNext()) {
Person person = iterator.next();
assertTrue(person.getAge() > previousAge);
previousAge = person.getAge();
}
}
StaticTestingErrorHandler.assertAllGood(cacheAMachine1, cacheAMachine2);
}
Aggregations