Package com.hazelcast.query.SampleObjects

Examples of com.hazelcast.query.SampleObjects.Value


    public void testAndPredicate_whenFirstIndexAwarePredicateIsNotIndexed() throws Exception {
        final HazelcastInstance instance = createHazelcastInstance();
        final IMap<Object, Object> map = instance.getMap("map");
        map.addIndex("name", false);
        String name = randomString();
        map.put("key", new Value(name));

        final ShouldExecuteOncePredicate indexAwareNotIndexedPredicate = new ShouldExecuteOncePredicate();
        final EqualPredicate equalPredicate = new EqualPredicate("name", name);
        final AndPredicate andPredicate = new AndPredicate(indexAwareNotIndexedPredicate, equalPredicate);
        map.values(andPredicate);
View Full Code Here


    @Test
    public void testIndex2() throws Exception {
        IndexService indexService = new IndexService();
        indexService.addOrGetIndex("name", false);
        indexService.saveEntryIndex(new QueryEntry(null, toData(1), 1, new Value("abc")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(2), 2, new Value("xyz")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(3), 3, new Value("aaa")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(4), 4, new Value("zzz")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(5), 5, new Value("klm")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(6), 6, new Value("prs")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(7), 7, new Value("prs")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(8), 8, new Value("def")));
        indexService.saveEntryIndex(new QueryEntry(null, toData(9), 9, new Value("qwx")));
        assertEquals(8, new HashSet(indexService.query(new SqlPredicate("name > 'aac'"))).size());
    }
View Full Code Here

        TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(2);
        Config cfg = new Config();
        HazelcastInstance instance = nodeFactory.newHazelcastInstance(cfg);
        final IMap<String, Value> map = instance.getMap("default");
        for (int i = 0; i < 10; i++) {
            final Value v = new Value("name" + i, new ValueType("type" + i), i);
            map.put("" + i, v);
        }
        String[] emptyArray = new String[2];
        final Predicate predicate = new PredicateBuilder().getEntryObject().get("name").in(emptyArray);
        final Collection<Value> values = map.values(predicate);
View Full Code Here

        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("name", false);
        map.addIndex("type.typeName", false);
        for (int i = 0; i < 10; i++) {
            Value v = new Value("name" + i, i < 5 ? null : new ValueType("type" + i), i);
            map.put("" + i, v);
        }
        Predicate predicate = new PredicateBuilder().getEntryObject().get("type.typeName").in("type8", "type6");
        Collection<SampleObjects.Value> values = map.values(predicate);
        assertEquals(2, values.size());
View Full Code Here

        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("name", false);
        map.addIndex("type.typeName", false);
        for (int i = 0; i < 4; i++) {
            Value v = new Value("name" + i, new ValueType("type" + i), i);
            map.put("" + i, v);
        }
        Predicate predicate = new SqlPredicate("type.typeName='type1'");
        Collection<SampleObjects.Value> values = map.values(predicate);
        assertEquals(1, values.size());
View Full Code Here

    public void issue685RemoveIndexesOnClear() {
        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("name", true);
        for (int i = 0; i < 4; i++) {
            Value v = new Value("name" + i);
            map.put("" + i, v);
        }
        map.clear();
        Predicate predicate = new SqlPredicate("name='name0'");
        Collection<SampleObjects.Value> values = map.values(predicate);
View Full Code Here

    public void issue393SqlIn() {
        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("name", true);
        for (int i = 0; i < 4; i++) {
            Value v = new Value("name" + i);
            map.put("" + i, v);
        }
        Predicate predicate = new SqlPredicate("name IN ('name0', 'name2')");
        Collection<SampleObjects.Value> values = map.values(predicate);
        String[] expectedValues = new String[]{"name0", "name2"};
View Full Code Here

    public void issue393SqlInInteger() {
        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("index", false);
        for (int i = 0; i < 4; i++) {
            Value v = new Value("name" + i, new ValueType("type" + i), i);
            map.put("" + i, v);
        }
        Predicate predicate = new SqlPredicate("index IN (0, 2)");
        Collection<SampleObjects.Value> values = map.values(predicate);
        String[] expectedValues = new String[]{"name0", "name2"};
View Full Code Here

    @Test(timeout = 1000 * 60)
    public void issue393Fail() {
        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("qwe", true);
        Value v = new Value("name");
        try {
            map.put("0", v);
            fail();
        } catch (Throwable e) {
            assertTrue(e.getMessage().contains("There is no suitable accessor for 'qwe'"));
View Full Code Here

    public void issue393SqlEq() {
        HazelcastInstance instance = createHazelcastInstance();
        IMap<String, SampleObjects.Value> map = instance.getMap("default");
        map.addIndex("name", true);
        for (int i = 0; i < 4; i++) {
            Value v = new Value("name" + i);
            map.put("" + i, v);
        }
        Predicate predicate = new SqlPredicate("name='name0'");
        Collection<SampleObjects.Value> values = map.values(predicate);
        String[] expectedValues = new String[]{"name0"};
View Full Code Here

TOP

Related Classes of com.hazelcast.query.SampleObjects.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.