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"));
}
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"));
}
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);
}
}
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");
}
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")));
}
Aggregations