Search in sources :

Example 86 with Predicate

use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.

the class MapPreconditionsTest method testAddLocalEntryListenerWithMapListenerAndPredicate_NullListener.

@Test(expected = UnsupportedOperationException.class)
public void testAddLocalEntryListenerWithMapListenerAndPredicate_NullListener() throws Exception {
    MapListener mapListener = null;
    Predicate predicate = new TruePredicate();
    map.addLocalEntryListener(mapListener, predicate, false);
}
Also used : MapListener(com.hazelcast.map.listener.MapListener) TruePredicate(com.hazelcast.query.TruePredicate) Predicate(com.hazelcast.query.Predicate) TruePredicate(com.hazelcast.query.TruePredicate) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 87 with Predicate

use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.

the class MapPreconditionsTest method testAddEntryListenerWithEntryListenerAndPredicateAndKey_NullPredicate.

@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithEntryListenerAndPredicateAndKey_NullPredicate() throws Exception {
    EntryListener entryListener = new TestEntryListener();
    Predicate predicate = null;
    map.addEntryListener(entryListener, predicate, null, true);
}
Also used : EntryListener(com.hazelcast.core.EntryListener) Predicate(com.hazelcast.query.Predicate) TruePredicate(com.hazelcast.query.TruePredicate) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 88 with Predicate

use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.

the class MapPreconditionsTest method testAddEntryListenerWithMapListenerAndPredicateAndKey_NullListener.

@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithMapListenerAndPredicateAndKey_NullListener() throws Exception {
    MapListener mapListener = null;
    Predicate predicate = new TruePredicate();
    map.addEntryListener(mapListener, predicate, null, true);
}
Also used : MapListener(com.hazelcast.map.listener.MapListener) TruePredicate(com.hazelcast.query.TruePredicate) Predicate(com.hazelcast.query.Predicate) TruePredicate(com.hazelcast.query.TruePredicate) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 89 with Predicate

use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.

the class MapPreconditionsTest method testAddLocalEntryListenerWithMapListenerAndPredicateAndKey_NullListener.

@Test(expected = UnsupportedOperationException.class)
public void testAddLocalEntryListenerWithMapListenerAndPredicateAndKey_NullListener() throws Exception {
    MapListener mapListener = null;
    Predicate predicate = new TruePredicate();
    map.addLocalEntryListener(mapListener, predicate, null, false);
}
Also used : MapListener(com.hazelcast.map.listener.MapListener) TruePredicate(com.hazelcast.query.TruePredicate) Predicate(com.hazelcast.query.Predicate) TruePredicate(com.hazelcast.query.TruePredicate) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 90 with Predicate

use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.

the class TransactionalMapValuesWithPredicateMessageTask method innerCall.

@Override
protected Object innerCall() throws Exception {
    final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
    final TransactionalMap map = context.getMap(parameters.name);
    Predicate predicate = serializationService.toObject(parameters.predicate);
    Collection values = map.values(predicate);
    List<Data> list = new ArrayList<Data>(values.size());
    for (Object o : values) {
        list.add(serializationService.toData(o));
    }
    return list;
}
Also used : TransactionalMap(com.hazelcast.core.TransactionalMap) TransactionContext(com.hazelcast.transaction.TransactionContext) ArrayList(java.util.ArrayList) Collection(java.util.Collection) Data(com.hazelcast.nio.serialization.Data) Predicate(com.hazelcast.query.Predicate)

Aggregations

Predicate (com.hazelcast.query.Predicate)160 Test (org.junit.Test)125 QuickTest (com.hazelcast.test.annotation.QuickTest)124 ParallelTest (com.hazelcast.test.annotation.ParallelTest)107 TruePredicate (com.hazelcast.query.TruePredicate)41 SqlPredicate (com.hazelcast.query.SqlPredicate)33 HazelcastInstance (com.hazelcast.core.HazelcastInstance)26 FalsePredicate (com.hazelcast.query.impl.FalsePredicate)23 PredicateBuilder (com.hazelcast.query.PredicateBuilder)19 EntryListener (com.hazelcast.core.EntryListener)16 MapListener (com.hazelcast.map.listener.MapListener)16 EntryObject (com.hazelcast.query.EntryObject)14 IndexAwarePredicate (com.hazelcast.query.IndexAwarePredicate)12 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)10 Value (com.hazelcast.query.SampleObjects.Value)9 PredicateTestUtils.createMockVisitablePredicate (com.hazelcast.query.impl.predicates.PredicateTestUtils.createMockVisitablePredicate)9 ArrayList (java.util.ArrayList)9 EntryEvent (com.hazelcast.core.EntryEvent)8 MapListenerAdapter (com.hazelcast.map.impl.MapListenerAdapter)8 ValueType (com.hazelcast.query.SampleObjects.ValueType)7