Search in sources :

Example 26 with SimpleEntity

use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.

the class ModelInvariantsTest method testParentedFailures.

@Test
public void testParentedFailures() {
    SimpleName name = model.getName();
    SimpleEntity simpleEntity = ModelsEntityFactory.instance.createSimpleEntity();
    try {
        simpleEntity.setName(name);
        Assert.fail();
    } catch (IllegalArgumentException e) {
        simpleEntity.wUnset(name);
    }
    try {
        simpleEntity.getTypes().wAdd(name);
        Assert.fail();
    } catch (IllegalArgumentException e) {
        simpleEntity.getTypes().wRemove(name);
    }
    try {
        simpleEntity.getTypes().wSet(0, name);
        Assert.fail();
    } catch (IllegalArgumentException e) {
        simpleEntity.getTypes().wRemove(0);
    }
    try {
        simpleEntity.getTypes().wAdd(0, name);
        Assert.fail();
    } catch (IllegalArgumentException e) {
        simpleEntity.getTypes().wRemove(0);
    }
}
Also used : SimpleName(org.whole.lang.models.model.SimpleName) SimpleEntity(org.whole.lang.models.model.SimpleEntity) Test(org.junit.Test)

Example 27 with SimpleEntity

use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.

the class MatcherTest method testSubstitute.

@Test
public void testSubstitute() {
    SimpleEntity entityPattern = new SimpleEntityPattern().create();
    IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
    bindings.wDef("entityName", ModelsEntityFactory.instance.createSimpleName("SE"));
    Matcher.substitute(entityPattern, bindings, false);
    assertEquals("SE", entityPattern.getName().wStringValue());
}
Also used : SimpleEntity(org.whole.lang.models.model.SimpleEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Example 28 with SimpleEntity

use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.

the class MatcherTest method testSubstituteValue.

@Test
public void testSubstituteValue() {
    SimpleEntity entityPattern = new SimpleEntityPattern().create();
    IBindingScope args = BindingManagerFactory.instance.createSimpleScope();
    args.wDefValue("entityName", "SE");
    Matcher.substitute(entityPattern, args, false);
    assertEquals("SE", entityPattern.getName().wStringValue());
    assertEquals(ModelsEntityDescriptorEnum.SimpleName, entityPattern.getName().wGetEntityDescriptor());
}
Also used : IBindingScope(org.whole.lang.bindings.IBindingScope) SimpleEntity(org.whole.lang.models.model.SimpleEntity) Test(org.junit.Test)

Example 29 with SimpleEntity

use of org.whole.lang.models.model.SimpleEntity in project whole by wholeplatform.

the class SimpleEntityTablePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    SimpleEntity entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(4);
    list.add(entity.getModifiers());
    list.add(entity.getName());
    list.add(entity.getTypes());
    list.add(entity.getFeatures());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) SimpleEntity(org.whole.lang.models.model.SimpleEntity) ArrayList(java.util.ArrayList)

Aggregations

SimpleEntity (org.whole.lang.models.model.SimpleEntity)29 Test (org.junit.Test)22 IEntity (org.whole.lang.model.IEntity)14 Model (org.whole.lang.models.model.Model)13 PathExpression (org.whole.lang.queries.model.PathExpression)13 ITemplateManager (org.whole.lang.templates.ITemplateManager)13 XmlModel (org.whole.lang.models.codebase.XmlModel)12 IBindingManager (org.whole.lang.bindings.IBindingManager)9 ModelsModel (org.whole.lang.models.codebase.ModelsModel)7 ModelDeclarations (org.whole.lang.models.model.ModelDeclarations)7 CompositeEntity (org.whole.lang.models.model.CompositeEntity)6 DataEntity (org.whole.lang.models.model.DataEntity)5 EnumEntity (org.whole.lang.models.model.EnumEntity)5 Feature (org.whole.lang.models.model.Feature)5 Features (org.whole.lang.models.model.Features)5 EnumValues (org.whole.lang.models.model.EnumValues)3 Document (org.whole.lang.text.model.Document)3 ClassDeclaration (org.whole.lang.java.model.ClassDeclaration)2 ModelsEntityFactory (org.whole.lang.models.factories.ModelsEntityFactory)2 ArrayList (java.util.ArrayList)1