use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class JavaGeneratorTest method testGenerateJava.
@Test
public void testGenerateJava() throws Exception {
IEntity artifactsModel = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/artifacts/ArtifactsModel.xwl"));
assertNotNull(artifactsModel);
List<CompilationUnit> cuList = JavaCompilerOperation.compile(artifactsModel, BindingManagerFactory.instance.createArguments());
assertTrue(cuList.size() > 0);
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class PathExpressionsQueriesTest method testKindTest.
@Test
public void testKindTest() throws Exception {
IEntity model = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/templates/codebase/TemplateManagerArtifactsTemplates.xwl"));
QueriesEntityFactory ef = QueriesEntityFactory.instance;
for (IEntity e : BehaviorUtils.compileAndLazyEvaluate(ef.createFilter(ef.createDescendantOrSelfStep(), ef.createKindTest(KindTestEnum.RESOLVER)), model)) Assert.assertTrue(EntityUtils.isResolver(e));
for (IEntity e : BehaviorUtils.compileAndLazyEvaluate(ef.createFilter(ef.createDescendantOrSelfStep(), ef.createKindTest(KindTestEnum.DATA)), model)) Assert.assertTrue(EntityUtils.isData(e));
for (IEntity e : BehaviorUtils.compileAndLazyEvaluate(ef.createFilter(ef.createDescendantOrSelfStep(), ef.createKindTest(KindTestEnum.FRAGMENT)), model)) Assert.assertTrue(EntityUtils.isFragment(e));
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class JSONPersistencesTest method testJSONLDPersistence.
@Test
public void testJSONLDPersistence() throws Exception {
StringPersistenceProvider pp = new StringPersistenceProvider();
for (String modelPath : models) {
IEntity sourceModel = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider(modelPath));
pp.delete();
JSONLDPersistenceKit.instance().writeModel(sourceModel, pp);
IEntity targetModel = JSONLDPersistenceKit.instance().readModel(pp);
assertTrue(Matcher.forceMatch(sourceModel, targetModel));
}
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class IteratorFactoryTest method testTopDownIterator.
@Test
public void testTopDownIterator() throws Exception {
Grammar g = new TestXmlGrammar().create();
final Productions productions = g.getPhraseStructure();
final IEntityIterator<IEntity> ci = IteratorFactory.<IEntity>descendantOrSelfIterator();
ci.reset(productions);
IVisitor v = GenericTraversalFactory.instance.topDown(new GenericIdentityVisitor() {
public void visit(IEntity entity) {
if (ci.hasNext())
assertSame(entity, ci.next());
else
fail();
}
}, false);
v.visit(productions);
final IEntityIterator<IEntity> ci2 = IteratorFactory.<IEntity>descendantOrSelfScannerIterator();
ci2.reset(productions);
v = GenericTraversalFactory.instance.topDown(new GenericIdentityVisitor() {
public void visit(IEntity entity) {
if (EntityUtils.isResolver(entity))
return;
if (ci2.hasNext())
assertSame(entity, ci2.next());
else
fail();
}
}, false);
v.visit(productions);
final IEntityIterator<IEntity> ci3 = IteratorFactory.<IEntity>descendantOrSelfMatcherIterator().withPattern(GrammarsEntityDescriptorEnum.Production);
ci3.reset(productions);
v = GenericTraversalFactory.instance.topDown(new GenericIdentityVisitor() {
public void visit(IEntity entity) {
if (!Matcher.match(GrammarsEntityDescriptorEnum.Production, entity))
return;
if (ci3.hasNext())
assertSame(entity, ci3.next());
else
fail();
}
}, false);
v.visit(productions);
IEntity artifactsModel = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/artifacts/ArtifactsModel.xwl"));
Set<Type> typeSet = new HashSet<Type>();
IEntityIterator<Type> ci4 = IteratorFactory.<Type>descendantOrSelfMatcherIterator().withPattern(ModelsEntityFactory.instance.createSimpleName("Atifacts"));
ci4.reset(artifactsModel);
while (ci4.hasNext()) assertTrue(typeSet.add(ci4.next()));
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class DTAUSDeployer method deploy.
public void deploy(ReflectionFactory platform) {
try {
IBindingManager bm = BindingManagerFactory.instance.createArguments();
IEntity model = XsdPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/examples/dataintegration/xsd/pain.001.001.02.xsd", bm));
InterpreterOperation.interpret(model, bm);
InterpreterOperation.interpret(new DTAUSGrammar().create());
model = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/examples/dataintegration/xsd/DTAUSActions.xwl"));
InterpreterOperation.interpret(model);
} catch (Exception e) {
E4CompatibilityPlugin.log(e);
}
}
Aggregations