use of com.hazelcast.query.impl.QueryContext in project hazelcast by hazelcast.
the class NotEqualPredicateTest method newMockContextWithIndex.
private QueryContext newMockContextWithIndex(String indexedFieldName) {
QueryContext queryContext = mock(QueryContext.class);
Index mockIndex = mock(Index.class);
when(queryContext.getIndex(indexedFieldName)).thenReturn(mockIndex);
return queryContext;
}
use of com.hazelcast.query.impl.QueryContext in project hazelcast by hazelcast.
the class NotEqualPredicateTest method isIndexed_givenAttributeNameIsFoo_whenTheFooFieldIsIndexed_returnFalse.
@Test
public void isIndexed_givenAttributeNameIsFoo_whenTheFooFieldIsIndexed_returnFalse() {
// see https://github.com/hazelcast/hazelcast/pull/5847
String fieldName = "name";
NotEqualPredicate name = new NotEqualPredicate(fieldName, "foo");
QueryContext queryContext = newMockContextWithIndex(fieldName);
boolean indexed = name.isIndexed(queryContext);
assertFalse(indexed);
}
use of com.hazelcast.query.impl.QueryContext in project hazelcast by hazelcast.
the class LikePredicateTest method likePredicateIsNotIndexed_whenPercentWildcardIsUsedMultipleTimes.
@Test
public void likePredicateIsNotIndexed_whenPercentWildcardIsUsedMultipleTimes() {
QueryContext queryContext = mock(QueryContext.class);
when(queryContext.matchIndex("this", QueryContext.IndexMatchHint.PREFER_ORDERED)).thenReturn(createIndex(IndexType.SORTED));
assertFalse(new LikePredicate("this", "sub%string%").isIndexed(queryContext));
}
use of com.hazelcast.query.impl.QueryContext in project hazelcast by hazelcast.
the class LikePredicateTest method likePredicateIsNotIndexed_whenBitmapIndexIsUsed.
@Test
public void likePredicateIsNotIndexed_whenBitmapIndexIsUsed() {
QueryContext queryContext = mock(QueryContext.class);
when(queryContext.matchIndex("this", QueryContext.IndexMatchHint.PREFER_ORDERED)).thenReturn(createIndex(IndexType.BITMAP));
assertFalse(new LikePredicate("this", "string%").isIndexed(queryContext));
}
use of com.hazelcast.query.impl.QueryContext in project hazelcast by hazelcast.
the class LikePredicateTest method likePredicateIsNotIndexed_whenHashIndexIsUsed.
@Test
public void likePredicateIsNotIndexed_whenHashIndexIsUsed() {
QueryContext queryContext = mock(QueryContext.class);
when(queryContext.matchIndex("this", QueryContext.IndexMatchHint.PREFER_ORDERED)).thenReturn(createIndex(IndexType.HASH));
assertFalse(new LikePredicate("this", "string%").isIndexed(queryContext));
}
Aggregations