Search in sources :

Example 1 with IndexImpl

use of com.hazelcast.query.impl.IndexImpl in project hazelcast by hazelcast.

the class LikePredicateTest method createIndex.

@Nonnull
private Index createIndex(IndexType indexType) {
    InternalSerializationService mockSerializationService = mock(InternalSerializationService.class);
    Extractors mockExtractors = Extractors.newBuilder(mockSerializationService).build();
    IndexConfig config = IndexUtils.createTestIndexConfig(indexType, "this");
    return new IndexImpl(config, mockSerializationService, mockExtractors, IndexCopyBehavior.COPY_ON_READ, PerIndexStats.EMPTY, MemberPartitionStateImpl.DEFAULT_PARTITION_COUNT);
}
Also used : Extractors(com.hazelcast.query.impl.getters.Extractors) IndexConfig(com.hazelcast.config.IndexConfig) IndexImpl(com.hazelcast.query.impl.IndexImpl) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) Nonnull(javax.annotation.Nonnull)

Example 2 with IndexImpl

use of com.hazelcast.query.impl.IndexImpl in project hazelcast by hazelcast.

the class PredicatesTest method testNotEqualsPredicateDoesNotUseIndex.

@Test
public void testNotEqualsPredicateDoesNotUseIndex() {
    Index dummyIndex = new IndexImpl("foo", false, ss, Extractors.empty());
    QueryContext mockQueryContext = mock(QueryContext.class);
    when(mockQueryContext.getIndex(anyString())).thenReturn(dummyIndex);
    NotEqualPredicate p = new NotEqualPredicate("foo", "bar");
    boolean indexed = p.isIndexed(mockQueryContext);
    assertFalse(indexed);
}
Also used : IndexImpl(com.hazelcast.query.impl.IndexImpl) Index(com.hazelcast.query.impl.Index) QueryContext(com.hazelcast.query.impl.QueryContext) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

IndexImpl (com.hazelcast.query.impl.IndexImpl)2 IndexConfig (com.hazelcast.config.IndexConfig)1 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)1 Index (com.hazelcast.query.impl.Index)1 QueryContext (com.hazelcast.query.impl.QueryContext)1 Extractors (com.hazelcast.query.impl.getters.Extractors)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Nonnull (javax.annotation.Nonnull)1 Test (org.junit.Test)1