use of com.devonfw.cobigen.xmlplugin.merger.delegates.XmlMergerDelegate in project cobigen by devonfw.
the class XmlPluginMergerIntegrationTest method setUp.
/**
* Sets up a patchPreferingMerger and a basePreferingMerger without validation
*/
@Before
public void setUp() {
final String mergeSchemaLocation = "src/main/resources/mergeSchemas/";
this.patchPreferingMerger = new XmlMergerDelegate(mergeSchemaLocation, MergeType.PATCHATTACHOROVERWRITE, false);
// ((XmlLawMergerDelegate) patchPreferingMerger).setValidation(false);
this.basePreferingMerger = new XmlMergerDelegate(mergeSchemaLocation, MergeType.BASEATTACHOROVERWRITE, false);
((XmlMergerDelegate) this.basePreferingMerger).setValidation(false);
}
use of com.devonfw.cobigen.xmlplugin.merger.delegates.XmlMergerDelegate in project cobigen by devonfw.
the class XmlPluginActivator method bindMerger.
@Override
public List<Merger> bindMerger() {
List<Merger> merger = Lists.newLinkedList();
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.BASEOVERWRITE, false));
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.BASEATTACHOROVERWRITE, false));
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.PATCHOVERWRITE, false));
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.PATCHATTACHOROVERWRITE, false));
// mergers with validation enabled
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.BASEOVERWRITEVALIDATE, true));
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.BASEATTACHOROVERWRITEVALIDATE, true));
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.PATCHOVERWRITEVALIDATE, true));
merger.add(new XmlMergerDelegate(defaultMergeSchemaLocation, MergeType.PATCHATTACHOROVERWRITEVALIDATE, true));
mergerList = merger;
return merger;
}
use of com.devonfw.cobigen.xmlplugin.merger.delegates.XmlMergerDelegate in project cobigen by devonfw.
the class XmlPluginMergerIntegrationTest method testValidationEnabledThrowsMergeException.
/**
* Tests that a MergeException is thrown if the validation is enabled and the validation by LeXeMe failed and canceled
* the merge
*
* @throws Exception should not happen
*/
@Test(expected = MergeException.class)
public void testValidationEnabledThrowsMergeException() throws Exception {
String mergeSchemaLocation = "src/main/resources/mergeSchemas/";
this.patchPreferingMerger = new XmlMergerDelegate(mergeSchemaLocation, MergeType.PATCHATTACHOROVERWRITEVALIDATE, true);
this.basePreferingMerger = new XmlMergerDelegate(mergeSchemaLocation, MergeType.BASEATTACHOROVERWRITEVALIDATE, true);
String basePath = this.resourcesRoot + "BaseFile_validation.xml";
String patchPath = this.resourcesRoot + "PatchFile_validation.xml";
File baseFile = new File(basePath);
String patchString = readFile(patchPath, this.charset);
this.basePreferingMerger.merge(baseFile, patchString, this.charset);
}
Aggregations