Search in sources :

Example 61 with IndexConfig

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

the class GetMapConfigOperationTest method mapWithPreconfiguredIndex_empty.

@Test
public void mapWithPreconfiguredIndex_empty() throws Exception {
    MCGetMapConfigCodec.ResponseParameters actual = runCommand(client, hz, "map-with-index").get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
    // index is read from config
    assertThat(actual.globalIndexes).usingElementComparatorIgnoringFields("name").containsExactly(new IndexConfig(IndexType.SORTED, "first"));
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) MCGetMapConfigCodec(com.hazelcast.client.impl.protocol.codec.MCGetMapConfigCodec) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 62 with IndexConfig

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

the class GetMapConfigOperationTest method testMapWithPreconfiguredIndex_addedIndex.

@Test
public void testMapWithPreconfiguredIndex_addedIndex() throws Exception {
    client.getMap("map-with-index").addIndex(new IndexConfig(IndexType.HASH, "second"));
    MCGetMapConfigCodec.ResponseParameters actual = runCommand(client, hz, "map-with-index").get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
    assertThat(actual.globalIndexes).usingElementComparatorIgnoringFields("name").containsExactly(new IndexConfig(IndexType.SORTED, "first"), new IndexConfig(IndexType.HASH, "second"));
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) MCGetMapConfigCodec(com.hazelcast.client.impl.protocol.codec.MCGetMapConfigCodec) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with IndexConfig

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

the class AbstractExtractionTest method setupIndexes.

/**
 * Configures the HZ indexing according to the test parameters
 */
private void setupIndexes(Config config, Query query) {
    if (index != Index.NO_INDEX) {
        IndexConfig indexConfig = new IndexConfig();
        for (String column : query.expression.split(",")) {
            indexConfig.addAttribute(column);
        }
        indexConfig.setType(index == Index.HASH ? IndexType.HASH : IndexType.BITMAP);
        config.getMapConfig("map").addIndexConfig(indexConfig);
    }
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig)

Example 64 with IndexConfig

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

the class PhoneHomeTest method testMapCountWithAtleastOneIndex.

@Test
public void testMapCountWithAtleastOneIndex() {
    Map<String, String> parameters;
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_ATLEAST_ONE_INDEX.getRequestParameterName()), "0");
    Map<String, String> map1 = node.hazelcastInstance.getMap("hazelcast");
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_ATLEAST_ONE_INDEX.getRequestParameterName()), "0");
    IndexConfig config = new IndexConfig(IndexType.SORTED, "hazelcast");
    node.getConfig().getMapConfig("hazelcast").getIndexConfigs().add(config);
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_ATLEAST_ONE_INDEX.getRequestParameterName()), "1");
    config = new IndexConfig(IndexType.HASH, "phonehome");
    node.getConfig().getMapConfig("hazelcast").getIndexConfigs().add(config);
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_ATLEAST_ONE_INDEX.getRequestParameterName()), "1");
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with IndexConfig

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

the class PhoneHomeIntegrationTest method testMapMetrics.

@Test
public void testMapMetrics() {
    node.hazelcastInstance.getMap("hazelcast");
    node.hazelcastInstance.getMap("phonehome");
    MapConfig config = node.getConfig().getMapConfig("hazelcast");
    config.setReadBackupData(true);
    config.getMapStoreConfig().setClassName(DelayMapStore.class.getName()).setEnabled(true);
    config.addQueryCacheConfig(new QueryCacheConfig("queryconfig"));
    config.getHotRestartConfig().setEnabled(true);
    config.getIndexConfigs().add(new IndexConfig().setName("index"));
    config.setWanReplicationRef(new WanReplicationRef().setName("wan"));
    config.getAttributeConfigs().add(new AttributeConfig("hz", AttributeExtractor.class.getName()));
    config.getEvictionConfig().setEvictionPolicy(EvictionPolicy.LRU);
    config.setInMemoryFormat(InMemoryFormat.NATIVE);
    phoneHome.phoneHome(false);
    verify(1, postRequestedFor(urlPathEqualTo("/ping")).withRequestBody(containingParam("mpct", "2")).withRequestBody(containingParam("mpbrct", "1")).withRequestBody(containingParam("mpmsct", "1")).withRequestBody(containingParam("mpaoqcct", "1")).withRequestBody(containingParam("mpaoict", "1")).withRequestBody(containingParam("mphect", "1")).withRequestBody(containingParam("mpwact", "1")).withRequestBody(containingParam("mpaocct", "1")).withRequestBody(containingParam("mpevct", "1")).withRequestBody(containingParam("mpnmct", "1")));
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) MapConfig(com.hazelcast.config.MapConfig) AttributeConfig(com.hazelcast.config.AttributeConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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