use of com.hazelcast.query.SampleObjects.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, new PortableFactory() {
public Portable create(int classId) {
return 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(new SqlPredicate("notExist = name_0 OR a > 1"));
assertEquals(3, values.size());
}
use of com.hazelcast.query.SampleObjects.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, new PortableFactory() {
public Portable create(int classId) {
return new PortableEmployee();
}
});
config.getMapConfig(mapName).addMapIndexConfig(new MapIndexConfig("notExist", false)).addMapIndexConfig(new MapIndexConfig("n", false));
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(new SqlPredicate("n = name_2 OR notExist = name_0"));
assertEquals(1, values.size());
}
Aggregations