use of com.hazelcast.query.SampleTestObjects.PortableEmployee in project hazelcast by hazelcast.
the class QueryAdvancedTest method testUnknownPortableField_notCausesQueryException_withoutIndex.
@Test
public // see: https://github.com/hazelcast/hazelcast/issues/3927
void testUnknownPortableField_notCausesQueryException_withoutIndex() {
String mapName = randomMapName();
Config config = getConfig();
config.getSerializationConfig().addPortableFactory(666, classId -> new PortableEmployee());
HazelcastInstance hazelcastInstance = createHazelcastInstance(config);
IMap<Integer, PortableEmployee> map = hazelcastInstance.getMap(mapName);
for (int i = 0; i < 5; i++) {
map.put(i, new PortableEmployee(i, "name_" + i));
}
Collection values = map.values(Predicates.sql("notExist = name_0 OR a > 1"));
assertEquals(3, values.size());
}
use of com.hazelcast.query.SampleTestObjects.PortableEmployee in project hazelcast by hazelcast.
the class CachedQueryEntryTest method testGetTargetObject_givenValueIsDataAndPortable_whenKeyFlagIsFalse_thenReturnValueData.
@Test
public void testGetTargetObject_givenValueIsDataAndPortable_whenKeyFlagIsFalse_thenReturnValueData() {
Data key = serializationService.toData("indexedKey");
Data value = serializationService.toData(new PortableEmployee(30, "peter"));
QueryableEntry entry = createEntry(key, value, newExtractor());
Object targetObject = entry.getTargetObject(false);
assertEquals(value, targetObject);
}
use of com.hazelcast.query.SampleTestObjects.PortableEmployee in project hazelcast by hazelcast.
the class CachedQueryEntryTest method testGetTargetObject_givenValueIsPortable_whenKeyFlagIsFalse_thenReturnValueData.
@Test
public void testGetTargetObject_givenValueIsPortable_whenKeyFlagIsFalse_thenReturnValueData() {
Data key = serializationService.toData("indexedKey");
Portable value = new PortableEmployee(30, "peter");
QueryableEntry entry = createEntry(key, value, newExtractor());
Object targetObject = entry.getTargetObject(false);
assertEquals(serializationService.toData(value), targetObject);
}
use of com.hazelcast.query.SampleTestObjects.PortableEmployee in project hazelcast by hazelcast.
the class QueryAdvancedTest method testUnknownPortableField_notCausesQueryException_withIndex.
@Test
public // see: https://github.com/hazelcast/hazelcast/issues/3927
void testUnknownPortableField_notCausesQueryException_withIndex() {
String mapName = "default";
Config config = getConfig();
config.getSerializationConfig().addPortableFactory(666, classId -> new PortableEmployee());
config.getMapConfig(mapName).addIndexConfig(new IndexConfig(IndexType.HASH, "notExist")).addIndexConfig(new IndexConfig(IndexType.HASH, "n"));
HazelcastInstance hazelcastInstance = createHazelcastInstance(config);
IMap<Integer, PortableEmployee> map = hazelcastInstance.getMap(mapName);
for (int i = 0; i < 5; i++) {
map.put(i, new PortableEmployee(i, "name_" + i));
}
Collection values = map.values(Predicates.sql("n = name_2 OR notExist = name_0"));
assertEquals(1, values.size());
}
Aggregations