Search in sources :

Example 41 with IndexConfig

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

the class IndexCreateTest method testTooManyAttributes.

@Test
public void testTooManyAttributes() {
    IndexConfig config = new IndexConfig();
    for (int i = 0; i < IndexUtils.MAX_ATTRIBUTES + 1; i++) {
        config.addAttribute("col" + i);
    }
    checkIndexFailed(IllegalArgumentException.class, "Index cannot have more than " + IndexUtils.MAX_ATTRIBUTES + " attributes", config);
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 42 with IndexConfig

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

the class IndexCreateTest method createConfig.

private static IndexConfig createConfig(String... attributes) {
    IndexConfig config = new IndexConfig();
    config.setType(type);
    if (attributes != null) {
        for (String attribute : attributes) {
            config.addAttribute(attribute);
        }
    }
    return config;
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig)

Example 43 with IndexConfig

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

the class MapValuesTest method setup.

@Before
public void setup() {
    Config config = regularInstanceConfig();
    config.setProperty(QueryEngineImpl.DISABLE_MIGRATION_FALLBACK.getName(), "true");
    config.getMapConfig("indexed").addIndexConfig(new IndexConfig(IndexType.SORTED, "this"));
    instance = createHazelcastInstance(config);
    map = instance.getMap(randomName());
    serializationService = getSerializationService(instance);
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) Before(org.junit.Before)

Example 44 with IndexConfig

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

the class MultiValueBitmapIndexTest method getConfig.

@Override
protected Config getConfig() {
    Config config = HazelcastTestSupport.smallInstanceConfig();
    config.setProperty(QueryEngineImpl.DISABLE_MIGRATION_FALLBACK.getName(), "true");
    MapConfig mapConfig = config.getMapConfig("persons");
    mapConfig.addIndexConfig(indexConfig);
    // disable periodic metrics collection (may interfere with the test)
    config.getMetricsConfig().setEnabled(false);
    return config;
}
Also used : MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 45 with IndexConfig

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

the class CompositeIndexQueriesTest method before.

@Before
public void before() {
    Config config = getConfig();
    config.getMapConfig("map").setInMemoryFormat(inMemoryFormat);
    config.setProperty(QueryEngineImpl.DISABLE_MIGRATION_FALLBACK.getName(), "true");
    map = createHazelcastInstance(config).getMap("map");
    IndexConfig indexConfig1 = IndexUtils.createTestIndexConfig(IndexType.HASH, "name", "age");
    IndexConfig indexConfig2 = IndexUtils.createTestIndexConfig(IndexType.SORTED, "__key", "age");
    IndexConfig indexConfig3 = IndexUtils.createTestIndexConfig(IndexType.SORTED, "height", "__key");
    map.addIndex(indexConfig1);
    map.addIndex(indexConfig2);
    map.addIndex(indexConfig3);
    indexes.add(indexConfig1.getName());
    indexes.add(indexConfig2.getName());
    indexes.add(indexConfig3.getName());
    map.put(-2, new Person(null));
    map.put(-1, new Person(null));
    for (int i = 0; i < 100; ++i) {
        map.put(i, new Person(i));
    }
    map.put(100, new Person(null));
    map.put(101, new Person(null));
}
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