use of com.hazelcast.query.SampleObjects.Value in project hazelcast by hazelcast.
the class QueryIndexTest method issue685RemoveIndexesOnClear.
@Test(timeout = 1000 * 60)
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);
assertEquals(0, values.size());
}
use of com.hazelcast.query.SampleObjects.Value in project hazelcast by hazelcast.
the class QueryIndexTest method testQueryDoesNotMatchOldResults_whenEntriesAreUpdated.
@Test(timeout = 1000 * 60)
public void testQueryDoesNotMatchOldResults_whenEntriesAreUpdated() {
HazelcastInstance instance = createHazelcastInstance();
IMap<String, SampleObjects.Value> map = instance.getMap("default");
map.addIndex("name", true);
map.put("0", new Value("name"));
map.put("0", new Value("newName"));
Collection<SampleObjects.Value> values = map.values(new SqlPredicate("name='name'"));
assertEquals(0, values.size());
}
use of com.hazelcast.query.SampleObjects.Value in project hazelcast by hazelcast.
the class QueryIndexTest method testPredicateNotEqualWithIndex.
private void testPredicateNotEqualWithIndex(IMap<Integer, Value> map, boolean ordered) {
map.addIndex("name", ordered);
map.put(1, new Value("abc", 1));
map.put(2, new Value("xyz", 2));
map.put(3, new Value("aaa", 3));
assertEquals(3, map.values(new SqlPredicate("name != 'aac'")).size());
assertEquals(2, map.values(new SqlPredicate("index != 2")).size());
assertEquals(3, map.values(new SqlPredicate("name <> 'aac'")).size());
assertEquals(2, map.values(new SqlPredicate("index <> 2")).size());
assertEquals(3, map.values(new PredicateBuilder().getEntryObject().get("name").notEqual("aac")).size());
assertEquals(2, map.values(new PredicateBuilder().getEntryObject().get("index").notEqual(2)).size());
}
use of com.hazelcast.query.SampleObjects.Value in project hazelcast by hazelcast.
the class QueryBasicTest method testPredicateStringAttribute.
/**
* Github issues 98 and 131
*/
@Test(timeout = 1000 * 60)
public void testPredicateStringAttribute() {
HazelcastInstance instance = createHazelcastInstance(getConfig());
IMap<Integer, Value> map = instance.getMap("testPredicateStringWithString");
testPredicateStringAttribute(map);
}
use of com.hazelcast.query.SampleObjects.Value in project hazelcast by hazelcast.
the class QueryBasicTest method testPredicateStringAttributesWithIndex.
/**
* Github issues 98 and 131
*/
@Test(timeout = 1000 * 60)
public void testPredicateStringAttributesWithIndex() {
HazelcastInstance instance = createHazelcastInstance(getConfig());
IMap<Integer, Value> map = instance.getMap("testPredicateStringWithStringIndex");
map.addIndex("name", false);
testPredicateStringAttribute(map);
}
Aggregations