use of org.whole.lang.models.codebase.XmlModel in project whole by wholeplatform.
the class SelectQueriesTest method testSelectTemplateWithNestedRelativeQuery.
@Test
public void testSelectTemplateWithNestedRelativeQuery() {
ITemplateManager tm = SelectQueriesTemplateManager.instance();
Model m = new XmlModel().create();
PathExpression pe1 = (PathExpression) tm.create("selectTemplateWithNestedRelativeQuery");
PathExpression pe2 = (PathExpression) tm.create("selectTemplateWithNestedQuery");
IEntityIterator<ClassDeclaration> i2 = BehaviorUtils.<ClassDeclaration>compileAndLazyEvaluate(pe2, m);
for (ClassDeclaration t : BehaviorUtils.<ClassDeclaration>compileAndLazyEvaluate(pe1, m)) {
assertTrue(i2.hasNext());
assertTrue(Matcher.match(i2.next(), t));
}
}
use of org.whole.lang.models.codebase.XmlModel in project whole by wholeplatform.
the class SelectQueriesTest method testBindingScopes2.
@Test
public void testBindingScopes2() {
Model model = new XmlModel().create();
ITemplateManager tm = SelectQueriesTemplateManager.instance();
PathExpression query = (PathExpression) tm.create("selectBindingScopes2");
IBindingManager bm = BindingManagerFactory.instance.createArguments();
for (IEntity tuple : BehaviorUtils.compileAndLazyEvaluate(query, model, bm)) {
Document d = (Document) tuple.wGet(0);
SimpleEntity e = (SimpleEntity) tuple.wGet(1);
String eName = e.getName().getValue();
assertEquals(eName, d.wGet(0).wGet(1).wStringValue());
assertEquals(eName, d.wGet(0).wGet(2).wStringValue());
assertEquals(eName + eName, d.wGet(1).wGet(1).wStringValue());
}
}
use of org.whole.lang.models.codebase.XmlModel in project whole by wholeplatform.
the class HistoryInvariantsTest method testHistoryDefaultHistoryEnablement.
@Test
public void testHistoryDefaultHistoryEnablement() {
IEntity model = new XmlModel().create();
IHistoryManager history = ReflectionFactory.getHistoryManager(model);
Assert.assertFalse(history.isHistoryEnabled());
Assert.assertEquals(0, history.getUndoSize());
Assert.assertTrue(history.getUndoCommands().isEmpty());
}
use of org.whole.lang.models.codebase.XmlModel in project whole by wholeplatform.
the class PathExpressionsQueriesTest method testPathOfChildSteps.
@Test
public void testPathOfChildSteps() {
Model model = new XmlModel().create();
IEntity decl3 = model.getDeclarations().wGet(3);
QueriesEntityFactory ef = QueriesEntityFactory.instance;
PathExpression pe = ef.createPath(ef.createFeatureStep("declarations"), ef.createFilter(ef.createChildStep(), ef.createIndexTest(ef.createIntLiteral(3))));
IEntity result = BehaviorUtils.evaluateFirstResult(pe, model);
Assert.assertSame(decl3, result);
}
use of org.whole.lang.models.codebase.XmlModel in project whole by wholeplatform.
the class PathExpressionsQueriesTest method testChildStepByName.
@Test
public void testChildStepByName() {
Model model = new XmlModel().create();
SimpleName name = model.getName();
QueriesEntityFactory ef = QueriesEntityFactory.instance;
IEntity result = BehaviorUtils.evaluateFirstResult(ef.createFeatureStep("name"), model);
Assert.assertSame(name, result);
}
Aggregations