use of org.whole.lang.models.model.SimpleEntity 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.model.SimpleEntity in project whole by wholeplatform.
the class MatcherTest method testCompareSimpleEntityWithResolver.
@Test
public void testCompareSimpleEntityWithResolver() {
SimpleEntity concrete = ModelsEntityFactory.instance.createSimpleEntity();
SimpleEntity resolver = CommonsEntityAdapterFactory.createResolver(ModelsEntityDescriptorEnum.SimpleEntity);
assertFalse(Matcher.match(concrete, resolver));
}
use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.
the class MatcherTest method testDataSubstitute.
@Test
public void testDataSubstitute() {
SimpleEntity entityPattern = new SimpleEntityPattern().create();
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
bindings.wDefValue("entityName", "SE");
Matcher.substitute(entityPattern, bindings, false);
assertEquals("SE", entityPattern.getName().wStringValue());
assertEquals(ModelsEntityDescriptorEnum.SimpleName, entityPattern.getName().wGetEntityDescriptor());
}
use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.
the class HistoryInvariantsTest method createSimpleEntity.
private SimpleEntity createSimpleEntity() {
SimpleEntity se = ModelsEntityFactory.instance.createSimpleEntity();
ReflectionFactory.getHistoryManager(se).setHistoryEnabled(true);
se.getName().setValue("my new simple name");
se.getTypes().wAdd(ModelsEntityFactory.instance.createSimpleName("T1"));
se.getFeatures().wAdd(ModelsEntityFactory.instance.createFeature());
return se;
}
use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.
the class HistoryInvariantsTest method testMergeHistory.
@Test
public void testMergeHistory() {
performChanges(model);
int size1 = history.getUndoSize();
SimpleEntity se = createSimpleEntity();
Assert.assertEquals(size1, history.getUndoSize());
model.getDeclarations().wAdd(se);
Assert.assertEquals(size1 + 1, history.getUndoSize());
size1 = history.getUndoSize();
se = createSimpleEntity();
se.wGetModel().getCompoundModel().setHistoryManager(history, false);
Assert.assertEquals(size1, history.getUndoSize());
model.getDeclarations().wAdd(se);
Assert.assertEquals(size1 + 1, history.getUndoSize());
size1 = history.getUndoSize();
se = createSimpleEntity();
se.wGetModel().getCompoundModel().setHistoryManager(history, true);
Assert.assertEquals(size1 + 1, history.getUndoSize());
model.getDeclarations().wAdd(se);
Assert.assertEquals(size1 + 2, history.getUndoSize());
size1 = history.getUndoSize();
se = createSimpleEntity();
history.mergeHistory(ReflectionFactory.getHistoryManager(se));
Assert.assertEquals(size1 + 1, history.getUndoSize());
model.getDeclarations().wAdd(se);
Assert.assertEquals(size1 + 2, history.getUndoSize());
}
Aggregations