Package com.hazelcast.query

Examples of com.hazelcast.query.SqlPredicate


            Object value = key+"value";
            map.put(key, value);
        }
        expected.add(4);

        final Set keySet = map.keySet(new SqlPredicate("this == 4value"));

        assertEquals(expected, keySet);
    }
View Full Code Here


            Object value = key+"value";
            map.put(key, value);
        }
        expected.add(4);

        final Set keySet = map.keySet(new SqlPredicate("this == 4value"));

        assertEquals(expected, keySet);
    }
View Full Code Here

            Object value = key+"value";
            expected.put(key, value);
            map.put(key, value);
        }

        final Set<Map.Entry> entrySet = map.entrySet(new SqlPredicate("this == 1value"));

        Map.Entry entry = entrySet.iterator().next();
        assertEquals(1, entry.getKey());
        assertEquals("1value", entry.getValue());
        assertEquals(1, entrySet.size());
View Full Code Here

        testSet.add("met");
        final IMap map = getMap();
        map.put(1, new Employee("enes", 29, true, 100d));
        map.put(2, new Employee("serra", 3, true, 100d));
        map.put(3, new Employee("met", 7, true, 100d));
        MapQueryRequest request = new MapQueryRequest(mapName, new SqlPredicate("age < 10"), IterationType.VALUE);
        final SimpleClient client = getClient();
        client.send(request);
        Object receive = client.receive();
        QueryResultSet result = (QueryResultSet) receive;
        for (Object aResult : result) {
View Full Code Here

            public void entryAdded(EntryEvent<Object, Object> event) {
                addCount.incrementAndGet();
            }
        };

        Predicate predicate = new SqlPredicate("age >= 50");
        map.addEntryListener(listener, predicate, null, false);
        int size = 100;
        for (int i = 0; i < size; i++) {
            Person person = new Person("name", i);
            map.put(i, person);
View Full Code Here

    @ManagedAnnotation(value = "values", operation = true)
    public String values(String query) {
        Collection coll;
        if (query != null && !query.isEmpty()) {
            Predicate predicate = new SqlPredicate(query);
            coll = managedObject.values(predicate);
        } else {
            coll = managedObject.values();
        }
        StringBuilder buf = new StringBuilder();
View Full Code Here

    @ManagedAnnotation(value = "entrySet", operation = true)
    public String entrySet(String query) {
        Set<Map.Entry> entrySet;
        if (query != null && !query.isEmpty()) {
            Predicate predicate = new SqlPredicate(query);
            entrySet = managedObject.entrySet(predicate);
        } else {
            entrySet = managedObject.entrySet();
        }
View Full Code Here

        try {
            boolean b = h1.executeTransaction(options, new TransactionalTask<Boolean>() {
                public Boolean execute(TransactionalTaskContext context) throws TransactionException {
                    final TransactionalMap<Object, Object> txMap = context.getMap("default");

                    assertEquals(0, txMap.keySet(new SqlPredicate("age <= 10")).size());
                    //put
                    txMap.put(2, employee2);
                    Set keys = txMap.keySet(new SqlPredicate("age <= 10"));
                    Iterator iterator = keys.iterator();

                    assertEquals(1, keys.size());

                    while (iterator.hasNext()) {
                        assertEquals(2, ((Integer) iterator.next()).intValue());
                    }

                    txMap.put(3, employee3);
                    txMap.put(4, employee4);

                    keys = txMap.keySet(new SqlPredicate("age <= 10"));
                    assertEquals(3, keys.size());

                    // force rollback.
                    throw new DummyUncheckedHazelcastTestException();
                }
            });
        } catch (Exception e) {
            if (!(e instanceof DummyUncheckedHazelcastTestException)) {
                throw new RuntimeException(e);
            }
        }
        assertEquals(1, map.size());
        assertEquals(1, map.keySet().size());
        assertEquals(0, map.keySet(new SqlPredicate("age <= 10")).size());

        h1.shutdown();
        h2.shutdown();
    }
View Full Code Here

        assertNull(txMap.put(employee2, employee2));

        assertEquals(2, txMap.size());
        assertEquals(2, txMap.keySet().size());
        assertEquals(1, txMap.keySet(new SqlPredicate("age = 34")).size());

        context.commitTransaction();


        assertEquals(2, map.size());
View Full Code Here

        final TransactionalMap txMap = context.getMap(mapName);

        assertNull(txMap.put(emp2, emp2));
        assertEquals(2, txMap.size());
        assertEquals(2, txMap.keySet().size());
        assertEquals(0, txMap.keySet(new SqlPredicate("a = 10")).size());
        assertEquals(0, txMap.values(new SqlPredicate("a = 10")).size());
        assertEquals(2, txMap.keySet(new SqlPredicate("a >= 10")).size());
        assertEquals(2, txMap.values(new SqlPredicate("a >= 10")).size());

        context.commitTransaction();

        assertEquals(2, map.size());
        assertEquals(2, map.values().size());
View Full Code Here

TOP

Related Classes of com.hazelcast.query.SqlPredicate

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.