use of com.hazelcast.client.standalone.model.MyPortableElement in project hazelcast by hazelcast.
the class ClientMapStandaloneTest method testRemoveAllWithPredicate_DoesNotDeserializeValues.
@Test
public void testRemoveAllWithPredicate_DoesNotDeserializeValues() {
IMap<Integer, MyPortableElement> map = createMap();
for (int i = 0; i < 100; i++) {
map.put(i, new MyPortableElement(i));
}
Predicate<Integer, MyPortableElement> predicate = in("id", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
map.removeAll(predicate);
for (int i = 0; i < 10; i++) {
MyPortableElement entry = map.get(i);
assertNull(entry);
}
for (int i = 10; i < 100; i++) {
MyPortableElement entry = map.get(i);
assertNotNull(entry);
}
}
use of com.hazelcast.client.standalone.model.MyPortableElement in project hazelcast by hazelcast.
the class ClientMapStandaloneTest method testPortable_query_with_index.
@Test
public void testPortable_query_with_index() {
IMap<Integer, MyPortableElement> map = createMap();
for (int i = 0; i < 100; i++) {
MyPortableElement element = new MyPortableElement(i);
map.put(i, element);
}
map.addIndex(IndexType.HASH, "id");
Predicate predicate = or(equal("id", 0), equal("id", 1));
Collection values = map.values(predicate);
assertEquals(2, values.size());
}
use of com.hazelcast.client.standalone.model.MyPortableElement in project hazelcast by hazelcast.
the class ClientMapStandaloneTest method testPortable_withEntryListenerWithPredicate.
@Test
public void testPortable_withEntryListenerWithPredicate() {
int key = 1;
int id = 1;
IMap<Integer, MyPortableElement> map = createMap();
Predicate<Integer, MyPortableElement> predicate = equal("id", id);
MyPortableElement element = new MyPortableElement(id);
final CountDownLatch eventLatch = new CountDownLatch(1);
map.addEntryListener(new EntryAdapter<Integer, MyPortableElement>() {
@Override
public void onEntryEvent(EntryEvent<Integer, MyPortableElement> event) {
eventLatch.countDown();
}
}, predicate, true);
map.put(key, element);
assertOpenEventually(eventLatch);
Collection values = map.values(Predicates.lessThan("date", new Date().getTime()));
assertEquals(values.iterator().next(), element);
}
Aggregations