Search in sources :

Example 46 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class EntryProcessorBouncingNodesTest method getConfig.

@Override
protected Config getConfig() {
    Config config = super.getConfig();
    MapConfig mapConfig = config.getMapConfig(MAP_NAME);
    mapConfig.setBackupCount(2);
    if (withIndex) {
        mapConfig.addIndexConfig(new IndexConfig(IndexType.SORTED, "__key"));
    }
    return config;
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 47 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class CompositeEqualPredicateTest method testUnordered.

@Test
public void testUnordered() {
    IndexConfig indexConfig = IndexUtils.createTestIndexConfig(IndexType.HASH, "age", "height");
    map.addIndex(indexConfig);
    assertEquals(0, map.getLocalMapStats().getIndexedQueryCount());
    for (int i = 0; i < 100; ++i) {
        final Integer age = randomQueryAge();
        final Long height = randomQueryHeight();
        assertPredicate(new Predicate<Integer, Person>() {

            @Override
            public boolean apply(Map.Entry<Integer, Person> mapEntry) {
                return ObjectTestUtils.equals(mapEntry.getValue().age, age) && ObjectTestUtils.equals(mapEntry.getValue().height, height);
            }
        }, predicate(indexConfig.getName(), value(age, height), "age", "height"));
    }
    assertEquals(100, map.getLocalMapStats().getIndexedQueryCount());
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Map(java.util.Map) IMap(com.hazelcast.map.IMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 48 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class CompositeRangePredicateTest method before.

@Before
public void before() {
    long seed = System.currentTimeMillis();
    System.out.println("CompositeRangePredicateTest seed: " + seed);
    random = new Random(seed);
    Config config = getConfig();
    config.getMapConfig("persons").setInMemoryFormat(inMemoryFormat);
    map = createHazelcastInstance(config).getMap("persons");
    IndexConfig indexConfig = IndexUtils.createTestIndexConfig(IndexType.SORTED, "age", "height", "__key");
    indexName = indexConfig.getName();
    map.addIndex(indexConfig);
    for (int i = 0; i < 500; ++i) {
        map.put(i, new Person(randomAge(), randomHeight()));
    }
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Random(java.util.Random) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) Before(org.junit.Before)

Example 49 with IndexConfig

use of com.hazelcast.config.IndexConfig 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 50 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class UnsupportedBitmapIndexPredicatesTest method before.

@Before
public void before() {
    Config config = smallInstanceConfig();
    config.setProperty(QueryEngineImpl.DISABLE_MIGRATION_FALLBACK.getName(), "true");
    config.getMapConfig("map").addIndexConfig(new IndexConfig(IndexType.BITMAP, "this"));
    map = createHazelcastInstance(config).getMap("map");
    for (int i = 0; i < 10; ++i) {
        map.put(i, i);
    }
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) Before(org.junit.Before)

Aggregations

IndexConfig (com.hazelcast.config.IndexConfig)130 Test (org.junit.Test)49 QuickTest (com.hazelcast.test.annotation.QuickTest)45 Config (com.hazelcast.config.Config)42 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)38 MapConfig (com.hazelcast.config.MapConfig)34 HazelcastInstance (com.hazelcast.core.HazelcastInstance)29 ArrayList (java.util.ArrayList)16 Before (org.junit.Before)13 MapStoreConfig (com.hazelcast.config.MapStoreConfig)12 InternalIndex (com.hazelcast.query.impl.InternalIndex)12 AttributeConfig (com.hazelcast.config.AttributeConfig)9 MapContainer (com.hazelcast.map.impl.MapContainer)9 IndexRangeFilter (com.hazelcast.sql.impl.exec.scan.index.IndexRangeFilter)9 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)8 Node (org.w3c.dom.Node)8 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)7 IMap (com.hazelcast.map.IMap)7 Indexes (com.hazelcast.query.impl.Indexes)7 ExpressionEvalContext (com.hazelcast.sql.impl.expression.ExpressionEvalContext)7