use of com.hazelcast.nio.serialization.PortableTest.ChildPortableObject in project hazelcast by hazelcast.
the class QueryBasicTest method testQueryPortableField.
@Test(expected = QueryException.class)
public void testQueryPortableField() {
Config config = getConfig();
HazelcastInstance instance = createHazelcastInstance(config);
IMap<Object, Object> map = instance.getMap(randomMapName());
map.put(1, new GrandParentPortableObject(1, new ParentPortableObject(1L, new ChildPortableObject(1L))));
Collection<Object> values = map.values(new SqlPredicate("child > 0"));
values.size();
}
use of com.hazelcast.nio.serialization.PortableTest.ChildPortableObject in project hazelcast by hazelcast.
the class QueryBasicTest method testQueryUsingNestedPortableObject.
private void testQueryUsingNestedPortableObject(Config config, String name) {
addPortableFactories(config);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
IMap<String, GrandParentPortableObject> map = instance2.getMap(name);
String key = generateKeyOwnedBy(instance1);
map.put(key, new GrandParentPortableObject(1, new ParentPortableObject(1L, new ChildPortableObject(1L))));
waitAllForSafeState(instance1, instance2);
Collection<GrandParentPortableObject> values = map.values(new SqlPredicate("child.timestamp > 0"));
assertEquals(1, values.size());
values = map.values(new SqlPredicate("child.child.timestamp > 0"));
assertEquals(1, values.size());
}
use of com.hazelcast.nio.serialization.PortableTest.ChildPortableObject in project hazelcast by hazelcast.
the class QueryBasicTest method testSqlQueryUsingPortable__KeyField.
@Test
public void testSqlQueryUsingPortable__KeyField() {
Config config = getConfig();
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
factory.newHazelcastInstance(config);
HazelcastInstance instance = factory.newHazelcastInstance(config);
IMap<Object, Object> map = instance.getMap(randomMapName());
Object key = new ChildPortableObject(123L);
Object value = "value";
map.put(key, value);
Collection<Object> values = map.values(new SqlPredicate("__key.timestamp = 123"));
assertEquals(1, values.size());
assertEquals(value, values.iterator().next());
}
Aggregations