Search in sources :

Example 1 with GrandParentPortableObject

use of com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject 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();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ChildPortableObject(com.hazelcast.nio.serialization.PortableTest.ChildPortableObject) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) ParentPortableObject(com.hazelcast.nio.serialization.PortableTest.ParentPortableObject) GrandParentPortableObject(com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject) SqlPredicate(com.hazelcast.query.SqlPredicate) EntryObject(com.hazelcast.query.EntryObject) ParentPortableObject(com.hazelcast.nio.serialization.PortableTest.ParentPortableObject) GrandParentPortableObject(com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject) ChildPortableObject(com.hazelcast.nio.serialization.PortableTest.ChildPortableObject) GrandParentPortableObject(com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with GrandParentPortableObject

use of com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject 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());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ChildPortableObject(com.hazelcast.nio.serialization.PortableTest.ChildPortableObject) ParentPortableObject(com.hazelcast.nio.serialization.PortableTest.ParentPortableObject) GrandParentPortableObject(com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject) SqlPredicate(com.hazelcast.query.SqlPredicate) GrandParentPortableObject(com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory)

Aggregations

HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 ChildPortableObject (com.hazelcast.nio.serialization.PortableTest.ChildPortableObject)2 GrandParentPortableObject (com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject)2 ParentPortableObject (com.hazelcast.nio.serialization.PortableTest.ParentPortableObject)2 SqlPredicate (com.hazelcast.query.SqlPredicate)2 Config (com.hazelcast.config.Config)1 MapConfig (com.hazelcast.config.MapConfig)1 MapIndexConfig (com.hazelcast.config.MapIndexConfig)1 EntryObject (com.hazelcast.query.EntryObject)1 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1