Search in sources :

Example 1 with DatasetInfo

use of org.apache.asterix.common.context.DatasetInfo in project asterixdb by apache.

the class CorrelatedPrefixMergePolicyTest method mockMergePolicy.

private ILSMMergePolicy mockMergePolicy(IndexInfo... indexes) {
    Map<String, String> properties = new HashMap<>();
    properties.put(CorrelatedPrefixMergePolicyFactory.KEY_MAX_COMPONENT_COUNT, String.valueOf(MAX_COMPONENT_COUNT));
    properties.put(CorrelatedPrefixMergePolicyFactory.KEY_MAX_COMPONENT_SIZE, String.valueOf(MAX_COMPONENT_SIZE));
    Set<IndexInfo> indexInfos = new HashSet<>();
    for (IndexInfo info : indexes) {
        indexInfos.add(info);
    }
    DatasetInfo dsInfo = Mockito.mock(DatasetInfo.class);
    Mockito.when(dsInfo.getDatsetIndexInfos()).thenReturn(indexInfos);
    IDatasetLifecycleManager manager = Mockito.mock(IDatasetLifecycleManager.class);
    Mockito.when(manager.getDatasetInfo(DATASET_ID)).thenReturn(dsInfo);
    ILSMMergePolicy policy = new CorrelatedPrefixMergePolicy(manager, DATASET_ID);
    policy.configure(properties);
    return policy;
}
Also used : IDatasetLifecycleManager(org.apache.asterix.common.api.IDatasetLifecycleManager) HashMap(java.util.HashMap) DatasetInfo(org.apache.asterix.common.context.DatasetInfo) IndexInfo(org.apache.asterix.common.context.IndexInfo) ILSMMergePolicy(org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicy) HashSet(java.util.HashSet) CorrelatedPrefixMergePolicy(org.apache.asterix.common.context.CorrelatedPrefixMergePolicy)

Aggregations

HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 IDatasetLifecycleManager (org.apache.asterix.common.api.IDatasetLifecycleManager)1 CorrelatedPrefixMergePolicy (org.apache.asterix.common.context.CorrelatedPrefixMergePolicy)1 DatasetInfo (org.apache.asterix.common.context.DatasetInfo)1 IndexInfo (org.apache.asterix.common.context.IndexInfo)1 ILSMMergePolicy (org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicy)1