Search in sources :

Example 86 with IBindingManager

use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.

the class WorkflowsInterpreterVisitorTest method testInvokeQuery.

@Test
public void testInvokeQuery() {
    IEntity invokeQueryTest = WorkflowsTestTemplateManager.instance().create("invokeQueryTest");
    IBindingManager args = BindingManagerFactory.instance.createArguments();
    args.wEnterScope();
    InterpreterOperation.interpret(invokeQueryTest, args);
    args.wExitScope();
    Assert.assertFalse(args.wIsSet("queryName"));
    Assert.assertFalse(args.wIsSet("methodName"));
    Assert.assertFalse(args.wIsSet("self"));
    Assert.assertFalse(args.wIsSet("methodCall"));
}
Also used : IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Example 87 with IBindingManager

use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.

the class WorkflowsInterpreterVisitorTest method testLoadJavaModel.

@Test
public void testLoadJavaModel() {
    IEntity loadJavaModelTest = WorkflowsTestTemplateManager.instance().create("loadJavaModelTest");
    IBindingManager args = BindingManagerFactory.instance.createArguments();
    InterpreterOperation.interpret(loadJavaModelTest, args);
    Assert.assertTrue(Matcher.match(args.wGet("model"), new JavaClassTemplateFactory(SampleModel.class).create()));
}
Also used : IEntity(org.whole.lang.model.IEntity) JavaClassTemplateFactory(org.whole.lang.java.codebase.JavaClassTemplateFactory) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Example 88 with IBindingManager

use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.

the class WorkflowsInterpreterVisitorTest method testLoadModel.

@Test
public void testLoadModel() {
    IEntity loadModelTest = WorkflowsTestTemplateManager.instance().create("loadModelTest");
    IBindingManager args = BindingManagerFactory.instance.createArguments();
    InterpreterOperation.interpret(loadModelTest, args);
    Assert.assertFalse(args.wIsSet("varName"));
    Assert.assertTrue(Matcher.match(args.wGet("model"), new SampleModel().create()));
}
Also used : IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Example 89 with IBindingManager

use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.

the class WorkflowsInterpreterVisitorTest method testInvokeJavaInstanceMethod.

@Test
public void testInvokeJavaInstanceMethod() {
    IEntity invokeJavaInstanceMethodTest = WorkflowsTestTemplateManager.instance().create("invokeJavaInstanceMethodTest");
    IBindingManager args = BindingManagerFactory.instance.createArguments();
    InterpreterOperation.interpret(invokeJavaInstanceMethodTest, args);
    Assert.assertTrue(args.wIsSet("value"));
    Assert.assertFalse(args.wBooleanValue("value"));
}
Also used : IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Example 90 with IBindingManager

use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.

the class WorkflowsInterpreterVisitorTest method testLoadAndSaveModelToString.

@Test
public void testLoadAndSaveModelToString() {
    IEntity loadAndSaveModelToStringTest = WorkflowsTestTemplateManager.instance().create("loadAndSaveModelToStringTest");
    IBindingManager args = BindingManagerFactory.instance.createArguments();
    String ls = System.getProperty("line.separator");
    String sourceString = "Hello, world!" + ls + "This is a three" + ls + "lines text message";
    args.wDefValue("sourceString", sourceString);
    InterpreterOperation.interpret(loadAndSaveModelToStringTest, args);
    Assert.assertTrue(args.wIsSet("targetString"));
    Assert.assertEquals(args.wStringValue("sourceString"), args.wStringValue("targetString"));
}
Also used : IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Aggregations

IBindingManager (org.whole.lang.bindings.IBindingManager)223 IEntity (org.whole.lang.model.IEntity)141 Test (org.junit.Test)91 PathExpression (org.whole.lang.queries.model.PathExpression)49 ITemplateManager (org.whole.lang.templates.ITemplateManager)40 Grammar (org.whole.lang.grammars.model.Grammar)28 TestXmlGrammar (org.whole.lang.grammars.util.TestXmlGrammar)27 ESelectionService (org.eclipse.e4.ui.workbench.modeling.ESelectionService)17 Model (org.whole.lang.models.model.Model)15 Production (org.whole.lang.grammars.model.Production)14 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)14 File (java.io.File)12 QueriesGrammar (org.whole.lang.grammars.codebase.QueriesGrammar)12 XmlModel (org.whole.lang.models.codebase.XmlModel)11 SimpleEntity (org.whole.lang.models.model.SimpleEntity)10 VisitException (org.whole.lang.visitors.VisitException)9 IBindingScope (org.whole.lang.bindings.IBindingScope)6 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)6 HashMap (java.util.HashMap)5 IFile (org.eclipse.core.resources.IFile)5