Search in sources :

Example 16 with Indexes

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

the class NotPredicateTest method accept_whenNullPredicate_thenReturnItself.

@Test
public void accept_whenNullPredicate_thenReturnItself() {
    Visitor mockVisitor = createPassthroughVisitor();
    Indexes mockIndexes = mock(Indexes.class);
    NotPredicate notPredicate = new NotPredicate(null);
    NotPredicate result = (NotPredicate) notPredicate.accept(mockVisitor, mockIndexes);
    assertThat(result, sameInstance(notPredicate));
}
Also used : PredicateTestUtils.createPassthroughVisitor(com.hazelcast.query.impl.predicates.PredicateTestUtils.createPassthroughVisitor) Indexes(com.hazelcast.query.impl.Indexes) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 17 with Indexes

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

the class NotPredicateTest method accept_whenPredicateChangedOnAccept_thenReturnAndNewNotPredicate.

@Test
public void accept_whenPredicateChangedOnAccept_thenReturnAndNewNotPredicate() {
    Visitor mockVisitor = createPassthroughVisitor();
    Indexes mockIndexes = mock(Indexes.class);
    Predicate transformed = mock(Predicate.class);
    Predicate predicate = createMockVisitablePredicate(transformed);
    NotPredicate notPredicate = new NotPredicate(predicate);
    NotPredicate result = (NotPredicate) notPredicate.accept(mockVisitor, mockIndexes);
    assertThat(result, not(sameInstance(notPredicate)));
    assertThat(result.predicate, equalTo(transformed));
}
Also used : PredicateTestUtils.createPassthroughVisitor(com.hazelcast.query.impl.predicates.PredicateTestUtils.createPassthroughVisitor) Indexes(com.hazelcast.query.impl.Indexes) TruePredicate(com.hazelcast.query.TruePredicate) FalsePredicate(com.hazelcast.query.impl.FalsePredicate) PredicateTestUtils.createMockVisitablePredicate(com.hazelcast.query.impl.predicates.PredicateTestUtils.createMockVisitablePredicate) Predicate(com.hazelcast.query.Predicate) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Indexes (com.hazelcast.query.impl.Indexes)17 ParallelTest (com.hazelcast.test.annotation.ParallelTest)8 QuickTest (com.hazelcast.test.annotation.QuickTest)8 Test (org.junit.Test)8 Data (com.hazelcast.nio.serialization.Data)6 Predicate (com.hazelcast.query.Predicate)5 PredicateTestUtils.createPassthroughVisitor (com.hazelcast.query.impl.predicates.PredicateTestUtils.createPassthroughVisitor)5 Record (com.hazelcast.map.impl.record.Record)4 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)4 PredicateTestUtils.createDelegatingVisitor (com.hazelcast.query.impl.predicates.PredicateTestUtils.createDelegatingVisitor)3 PredicateTestUtils.createMockVisitablePredicate (com.hazelcast.query.impl.predicates.PredicateTestUtils.createMockVisitablePredicate)3 MapService (com.hazelcast.map.impl.MapService)2 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)2 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)2 Index (com.hazelcast.query.impl.Index)2 PredicateTestUtils.createMockNegatablePredicate (com.hazelcast.query.impl.predicates.PredicateTestUtils.createMockNegatablePredicate)2 HashMap (java.util.HashMap)2 LockService (com.hazelcast.concurrent.lock.LockService)1 NativeMemoryConfig (com.hazelcast.config.NativeMemoryConfig)1 MapInterceptor (com.hazelcast.map.MapInterceptor)1