use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class XsiModelTemplateTest method testXsiModelTemplate.
@Category({ KnownFailingTests.class, SlowTests.class })
@Test
public void testXsiModelTemplate() throws Exception {
fail();
IBindingManager bm = BindingManagerFactory.instance.createBindingManager();
bm.wDefValue("folderLocation", new File("test/org/whole/lang/xsd/templates").getAbsolutePath());
bm.wDefValue("packageName", "");
XsdDeployStrategies.setDeployStrategy(bm, XsdDeployStrategies.ALL);
String fileName = "S202SCTDIRPFRAA0001.C.xml";
IEntity xsiModel = XsiPersistenceKit.instance().readModel(new StreamPersistenceProvider(getInputStream(fileName), null, bm));
CommonsEntityFactory.instance.createRootFragment(xsiModel.wGetAdapter(CommonsEntityDescriptorEnum.Any));
IEntity xmlModel = XmlSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getInputStream(fileName), null, bm));
CommonsEntityFactory.instance.createRootFragment(xmlModel.wGetAdapter(CommonsEntityDescriptorEnum.Any));
ModelBuilderOperation mop = new ModelBuilderOperation();
XmlNormalizerBuilderOperation xnbo = new XmlNormalizerBuilderOperation(mop);
XsiModelTemplate xsiModelTemplate = new XsiModelTemplate(xsiModel);
xsiModelTemplate.apply(xnbo);
IEntity xmlModelFromXsiModel = mop.wGetResult();
Assert.assertTrue(Matcher.match(xmlModelFromXsiModel, xmlModel));
}
use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class GrammarsUtils method parse.
@SuppressWarnings("unchecked")
public static <E extends IEntity> E parse(CharSequence source, String grammarUri, EntityDescriptor<?> ed) {
ModelBuilderOperation mop = new ModelBuilderOperation();
parse(source, grammarUri, mop, ed);
return (E) mop.wGetResult();
}
use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class RhinoTransformerVisitor method transform.
public static IEntity transform(IPersistenceProvider pp) throws Exception {
CompilerEnvirons compilerEnvirons = CompilerEnvirons.ideEnvirons();
compilerEnvirons.setLanguageVersion(Context.VERSION_1_8);
Parser parser = new Parser(compilerEnvirons);
AstRoot astRoot = parser.parse(new InputStreamReader(pp.getInputStream(), pp.getEncoding()), "http://whole.sourceforge.net/test.js", 0);
ModelBuilderOperation mop = new ModelBuilderOperation();
RhinoTransformerVisitor visitor = new RhinoTransformerVisitor(mop);
astRoot.visit(visitor);
return mop.wGetResult();
}
use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class ResourceArtifactsGeneratorTest method test2CompareArtifacts.
@Test
public void test2CompareArtifacts() {
ArtifactsEntityFactory aef = ArtifactsEntityFactory.instance;
File genFolder = new File("data/gen");
ResourceTemplate resourceTemplate = new ResourceTemplate(genFolder);
ModelBuilderOperation mop = new ModelBuilderOperation();
resourceTemplate.apply(mop);
IEntity artifactsRevEng = mop.wGetResult();
IEntity artifactsSubTree = Matcher.find(aef.createFolderArtifact(aef.createName("gen"), CommonsEntityAdapterFactory.createVariable(ArtifactsEntityDescriptorEnum.Metadata, "metadata"), CommonsEntityAdapterFactory.createVariable(ArtifactsEntityDescriptorEnum.Artifacts, "artifacts")), artifacts, false);
assertNotNull(artifactsSubTree);
assertTrue(OrderedMatcher.match(artifactsRevEng, artifactsSubTree, comparatorsMap));
}
use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class ResourceTemplateTest method testReadArtifacts.
@Test
public void testReadArtifacts() {
File testfolder = new File("data/testfolder");
ResourceTemplate template = new ResourceTemplate(testfolder);
ModelBuilderOperation op = new ModelBuilderOperation();
template.apply(op);
IEntity artifacts = getFilesystemPattern();
IEntity artifactsFromFilesystem = op.wGetResult();
assertTrue(OrderedMatcher.match(artifacts, artifactsFromFilesystem, comparatorsMap));
}
Aggregations