Search in sources :

Example 61 with Model

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

the class MatcherTest method testForceMatch.

@Test
public void testForceMatch() throws Exception {
    IBindingManager bm = BindingManagerFactory.instance.createBindingManager();
    IEntity textModel = ModelsTemplateManager.instance().create("Text model");
    IEntity modifiedTextModel = new ModifiedTextModel().create();
    // test forced match
    assertFalse(Matcher.match(textModel, modifiedTextModel));
    assertTrue(Matcher.forceMatch(textModel, modifiedTextModel));
    new GenericMatcher().withAsIsMatching().withBindings(bm).withMismatchStrategy((pattern, model, bindings) -> {
        assertTrue(EntityUtils.isResolver(model));
    }).match(textModel, modifiedTextModel);
}
Also used : BeforeClass(org.junit.BeforeClass) ModelsEntityDescriptorEnum(org.whole.lang.models.reflect.ModelsEntityDescriptorEnum) Assert.assertNotSame(org.junit.Assert.assertNotSame) MethodInvocation(org.whole.lang.java.model.MethodInvocation) SimpleEntity(org.whole.lang.models.model.SimpleEntity) HashMap(java.util.HashMap) ListTestEntity(org.whole.lang.testentities.model.ListTestEntity) AbstractVariableVisitor(org.whole.lang.matchers.GenericMatcherFactory.AbstractVariableVisitor) GenericTraversalFactory(org.whole.lang.visitors.GenericTraversalFactory) ClassDeclaration(org.whole.lang.java.model.ClassDeclaration) Map(java.util.Map) Variable(org.whole.lang.commons.model.Variable) Assert.fail(org.junit.Assert.fail) ArtifactsEntityDescriptorEnum(org.whole.lang.artifacts.reflect.ArtifactsEntityDescriptorEnum) Before(org.junit.Before) IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) IEntity(org.whole.lang.model.IEntity) Feature(org.whole.lang.models.model.Feature) TestingModel(org.whole.lang.testentities.codebase.TestingModel) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) SimpleName(org.whole.lang.models.model.SimpleName) IBindingManager(org.whole.lang.bindings.IBindingManager) ModelsTemplateManager(org.whole.lang.models.reflect.ModelsTemplateManager) JavaFeatureDescriptorEnum(org.whole.lang.java.reflect.JavaFeatureDescriptorEnum) CommonsLanguageKit(org.whole.lang.commons.reflect.CommonsLanguageKit) ModelsEntityFactory(org.whole.lang.models.factories.ModelsEntityFactory) ArtifactsLanguageKit(org.whole.lang.artifacts.reflect.ArtifactsLanguageKit) TestLanguagesDeployer(org.whole.langs.test.TestLanguagesDeployer) Assert.assertFalse(org.junit.Assert.assertFalse) CommonsEntityAdapterFactory(org.whole.lang.commons.factories.CommonsEntityAdapterFactory) QuantifierEnum(org.whole.lang.commons.model.QuantifierEnum) IBindingScope(org.whole.lang.bindings.IBindingScope) ModelsFeatureDescriptorEnum(org.whole.lang.models.reflect.ModelsFeatureDescriptorEnum) EntityUtils(org.whole.lang.util.EntityUtils) Assert.assertEquals(org.junit.Assert.assertEquals) BindingManagerFactory(org.whole.lang.bindings.BindingManagerFactory) Model(org.whole.lang.models.model.Model) ReflectionFactory(org.whole.lang.reflect.ReflectionFactory) IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Example 62 with Model

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

the class ModelTablePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    Model entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(6);
    list.add(entity.getName());
    list.add(entity.getNamespace());
    list.add(entity.getVersion());
    list.add(entity.getUri());
    list.add(entity.getTypeRelations());
    list.add(entity.getDeclarations());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) Model(org.whole.lang.models.model.Model) ArrayList(java.util.ArrayList)

Aggregations

Model (org.whole.lang.models.model.Model)62 Test (org.junit.Test)55 PathExpression (org.whole.lang.queries.model.PathExpression)43 ITemplateManager (org.whole.lang.templates.ITemplateManager)41 IEntity (org.whole.lang.model.IEntity)40 XmlModel (org.whole.lang.models.codebase.XmlModel)30 ModelsModel (org.whole.lang.models.codebase.ModelsModel)25 ModelDeclarations (org.whole.lang.models.model.ModelDeclarations)19 IBindingManager (org.whole.lang.bindings.IBindingManager)15 SimpleEntity (org.whole.lang.models.model.SimpleEntity)14 ClassDeclaration (org.whole.lang.java.model.ClassDeclaration)12 DataEntity (org.whole.lang.models.model.DataEntity)10 Feature (org.whole.lang.models.model.Feature)9 ArrayList (java.util.ArrayList)6 FieldDeclaration (org.whole.lang.java.model.FieldDeclaration)6 CompositeEntity (org.whole.lang.models.model.CompositeEntity)4 Features (org.whole.lang.models.model.Features)4 EditorsModel (org.whole.lang.models.codebase.EditorsModel)3 EnumEntity (org.whole.lang.models.model.EnumEntity)3 SimpleName (org.whole.lang.models.model.SimpleName)3