use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class MapScanMigrationStressTest method stressTest_sortedIndex.
@Test(timeout = 600_000)
public void stressTest_sortedIndex() throws InterruptedException {
List<Row> expected = new ArrayList<>();
Map<Integer, Integer> temp = new HashMap<>();
for (int i = 0; i <= ITEM_COUNT; i++) {
temp.put(i, i);
expected.add(new Row(ITEM_COUNT - i, ITEM_COUNT - i));
}
map.putAll(temp);
IndexConfig indexConfig = new IndexConfig(IndexType.SORTED, "this").setName(randomName());
map.addIndex(indexConfig);
mutator = new MutatorThread(2000L);
assertRowsOrdered("SELECT * FROM " + MAP_NAME + " ORDER BY this DESC", expected, mutator);
mutator.terminate();
mutator.join();
assertThat(mutatorException.get()).isNull();
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class MapScanMigrationStressTest method stressTest_hashIndex.
@Test(timeout = 600_000)
public void stressTest_hashIndex() throws InterruptedException {
List<Row> expected = new ArrayList<>();
Map<Integer, Integer> temp = new HashMap<>();
for (int i = 0; i <= ITEM_COUNT / 5; i++) {
temp.put(i, 1);
expected.add(new Row(i, 1));
}
map.putAll(temp);
IndexConfig indexConfig = new IndexConfig(IndexType.HASH, "this").setName(randomName());
map.addIndex(indexConfig);
mutator = new MutatorThread(2000L);
// Awful performance of such a query, but still a good load for test.
assertRowsAnyOrder("SELECT * FROM " + MAP_NAME + " WHERE this = 1", expected, mutator);
mutator.terminate();
mutator.join();
assertThat(mutatorException.get()).isNull();
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class QueryCacheXmlConfigBuilderHelper method queryCacheIndexesHandle.
protected void queryCacheIndexesHandle(Node n, QueryCacheConfig queryCacheConfig) {
for (Node indexNode : childElements(n)) {
if (matches("index", cleanNodeName(indexNode))) {
IndexConfig indexConfig = IndexUtils.getIndexConfigFromXml(indexNode, domLevel3, strict);
queryCacheConfig.addIndexConfig(indexConfig);
}
}
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class SqlOrderByTest method addIndex.
private void addIndex(List<String> fieldNames, IndexType type, String mapName) {
IMap<Object, AbstractPojo> map = getTarget().getMap(mapName);
IndexConfig indexConfig = new IndexConfig().setName("Index_" + randomName()).setType(type);
for (String fieldName : fieldNames) {
indexConfig.addAttribute(fieldName);
}
map.addIndex(indexConfig);
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class SqlOrderByTest method checkSelectWithOrderBy.
private void checkSelectWithOrderBy(List<String> indexAttrs, String sql, List<String> checkOrderFields, List<Boolean> orderDirections) {
IMap<Object, AbstractPojo> map = getTarget().getMap(mapName());
IndexConfig indexConfig = new IndexConfig().setName("Index_" + randomName()).setType(SORTED);
for (String indexAttr : indexAttrs) {
indexConfig.addAttribute(indexAttr);
}
map.addIndex(indexConfig);
assertEquals(DATA_SET_SIZE, map.size());
assertSqlResultOrdered(sql, checkOrderFields, orderDirections, map.size());
}
Aggregations