use of org.craftercms.core.xml.mergers.impl.cues.impl.MergeParentAndChildMergeCue in project core by craftercms.
the class DescriptorMergerImplTest method setUpTestMerger.
private void setUpTestMerger() {
MergeCueResolverImpl mergeCueResolver = new MergeCueResolverImpl();
ElementMergeMatcherImpl elementMergeMatcher = new ElementMergeMatcherImpl();
elementMergeMatcher.setIdAttributeName(new QName(MergeParentAndChildMergeCueTest.ID_ATTR_NAME));
UseChildMergeCue overrideParentMergeCue = new UseChildMergeCue();
overrideParentMergeCue.setPriority(OVERRIDE_PARENT_MERGE_CUE_PRIORITY);
UseParentMergeCue disallowOverrideMergeCue = new UseParentMergeCue();
disallowOverrideMergeCue.setPriority(DISALLOW_OVERRIDE_MERGE_CUE_PRIORITY);
UseParentMergeCue useParentIfAvailableMergeCue = new UseParentMergeCue();
useParentIfAvailableMergeCue.setPriority(USE_PARENT_MERGE_CUE_PRIORITY);
MergeParentAndChildMergeCue mergeWithParentMergeCue = new MergeParentAndChildMergeCue();
mergeWithParentMergeCue.setPriority(MERGE_WITH_PARENT_MERGE_CUE_PRIORITY);
mergeWithParentMergeCue.setElementMergeMatcher(elementMergeMatcher);
mergeWithParentMergeCue.setMergeCueResolver(mergeCueResolver);
mergeWithParentMergeCue.setMergeOrderParamName(MergeParentAndChildMergeCueTest.MERGE_ORDER_PARAM_NAME);
mergeWithParentMergeCue.setDefaultMergeOrder(MergeParentAndChildMergeCueTest.DEFAULT_MERGE_ORDER);
MergeParentAndChildMergeCue mergeWithChildMergeCue = new MergeParentAndChildMergeCue();
mergeWithChildMergeCue.setPriority(MERGE_WITH_CHILD_MERGE_CUE_PRIORITY);
mergeWithChildMergeCue.setElementMergeMatcher(elementMergeMatcher);
mergeWithChildMergeCue.setMergeCueResolver(mergeCueResolver);
mergeWithChildMergeCue.setMergeOrderParamName(MergeParentAndChildMergeCueTest.MERGE_ORDER_PARAM_NAME);
mergeWithChildMergeCue.setDefaultMergeOrder(MergeParentAndChildMergeCueTest.DEFAULT_MERGE_ORDER);
UseParentIfNotEmptyMergeCue defaultParentMergeCue = new UseParentIfNotEmptyMergeCue();
defaultParentMergeCue.setPriority(DEFAULT_PARENT_MERGE_CUE_PRIORITY);
UseChildIfNotEmptyMergeCue defaultChildMergeCue = new UseChildIfNotEmptyMergeCue();
defaultParentMergeCue.setPriority(DEFAULT_CHILD_MERGE_CUE_PRIORITY);
Map<QName, MergeCue> parentMergeCues = new HashMap<QName, MergeCue>(2);
parentMergeCues.put(new QName(DISALLOW_OVERRIDE_MERGE_CUE_ATTR_NAME), disallowOverrideMergeCue);
parentMergeCues.put(new QName(MERGE_WITH_CHILD_MERGE_CUE_ATTR_NAME), mergeWithChildMergeCue);
Map<QName, MergeCue> childMergeCues = new HashMap<QName, MergeCue>(3);
childMergeCues.put(new QName(OVERRIDE_PARENT_MERGE_CUE_ATTR_NAME), overrideParentMergeCue);
childMergeCues.put(new QName(USE_PARENT_MERGE_CUE_ATTR_NAME), useParentIfAvailableMergeCue);
childMergeCues.put(new QName(MERGE_WITH_PARENT_MERGE_CUE_ATTR_NAME), mergeWithParentMergeCue);
mergeCueResolver.setParentMergeCues(parentMergeCues);
mergeCueResolver.setChildMergeCues(childMergeCues);
mergeCueResolver.setDefaultParentMergeCue(defaultParentMergeCue);
mergeCueResolver.setDefaultChildMergeCue(defaultChildMergeCue);
merger = new DescriptorMergerImpl();
merger.setInitialMergeCue(mergeWithChildMergeCue);
}
Aggregations