use of org.whole.lang.xml.codebase.XmlNormalizerBuilderOperation in project whole by wholeplatform.
the class XsiModelTemplateTest method testXsdModelTemplate.
@Test
public void testXsdModelTemplate() throws Exception {
String pacs002FileName = "pacs.002.001.02S2.xsd";
IEntity xsdPacs002 = loadXMLSchema(pacs002FileName);
CommonsEntityFactory.instance.createRootFragment(xsdPacs002.wGetAdapter(CommonsEntityDescriptorEnum.Any));
IEntity xmlPacs002 = XmlSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getInputStream(pacs002FileName)));
CommonsEntityFactory.instance.createRootFragment(xmlPacs002.wGetAdapter(CommonsEntityDescriptorEnum.Any));
ModelBuilderOperation mop = new ModelBuilderOperation();
XmlNormalizerBuilderOperation xnbo = new XmlNormalizerBuilderOperation(mop);
XsdModelTemplate xsdModelTemplate = new XsdModelTemplate(xsdPacs002);
xsdModelTemplate.apply(xnbo);
IEntity xmlModelFromXsdPacs002 = mop.wGetResult();
Assert.assertTrue(OrderedMatcher.match(xmlModelFromXsdPacs002, xmlPacs002, comparatorsMap));
String credTrfFileName = "SCTCcfBlkCredTrf.xsd";
IEntity xsdCredTrf = loadXMLSchema(credTrfFileName);
CommonsEntityFactory.instance.createRootFragment(xsdCredTrf.wGetAdapter(CommonsEntityDescriptorEnum.Any));
IEntity xmlCredTrf = XmlSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getInputStream(credTrfFileName)));
CommonsEntityFactory.instance.createRootFragment(xmlCredTrf.wGetAdapter(CommonsEntityDescriptorEnum.Any));
mop = new ModelBuilderOperation();
xnbo = new XmlNormalizerBuilderOperation(mop);
xsdModelTemplate = new XsdModelTemplate(xsdCredTrf);
xsdModelTemplate.apply(xnbo);
IEntity xmlModelFromXsdCredTrf = mop.wGetResult();
Assert.assertTrue(OrderedMatcher.match(xmlModelFromXsdCredTrf, xmlCredTrf, comparatorsMap));
}
Aggregations