Search in sources :

Example 1 with ParentPortableObject

use of com.hazelcast.nio.serialization.PortableTest.ParentPortableObject 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 ParentPortableObject

use of com.hazelcast.nio.serialization.PortableTest.ParentPortableObject in project hazelcast by hazelcast.

the class QueryBasicTest method testQueryUsingPortableObject.

private void testQueryUsingPortableObject(Config config, String mapName) {
    addPortableFactories(config);
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    HazelcastInstance instance1 = factory.newHazelcastInstance(config);
    HazelcastInstance instance2 = factory.newHazelcastInstance(config);
    IMap<Object, Object> map = instance2.getMap(mapName);
    Object key = generateKeyOwnedBy(instance1);
    map.put(key, new ParentPortableObject(1L));
    waitAllForSafeState(instance1, instance2);
    Collection<Object> values = map.values(new SqlPredicate("timestamp > 0"));
    assertEquals(1, values.size());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) 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) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory)

Example 3 with ParentPortableObject

use of com.hazelcast.nio.serialization.PortableTest.ParentPortableObject 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)3 ChildPortableObject (com.hazelcast.nio.serialization.PortableTest.ChildPortableObject)3 GrandParentPortableObject (com.hazelcast.nio.serialization.PortableTest.GrandParentPortableObject)3 ParentPortableObject (com.hazelcast.nio.serialization.PortableTest.ParentPortableObject)3 SqlPredicate (com.hazelcast.query.SqlPredicate)3 EntryObject (com.hazelcast.query.EntryObject)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 Config (com.hazelcast.config.Config)1 MapConfig (com.hazelcast.config.MapConfig)1 MapIndexConfig (com.hazelcast.config.MapIndexConfig)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1