use of org.whole.lang.bindings.IBindingManager 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.bindings.IBindingManager in project whole by wholeplatform.
the class MatcherTest method testMatchBindings.
@Test
public void testMatchBindings() {
IEntity pattern = buildArtifactsPattern(true);
IEntity model = buildArtifactsPattern(false);
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
if (Matcher.match(pattern, model, bindings)) {
assertEquals("LGPL", bindings.wStringValue("licenseText"));
return;
}
fail();
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class MatcherTest method testMultipleSubstitute.
@Test
public void testMultipleSubstitute() {
Model modelPattern = new ModelPattern().create();
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
bindings.wDefValue("dataEntity", "DE");
IBindingScope args = BindingManagerFactory.instance.createSimpleScope();
args.wDefValue("dataEntity", "DE");
Matcher.substitute(modelPattern, args, false);
SimpleName var1 = (SimpleName) modelPattern.getDeclarations().wGet(0).wGet(ModelsFeatureDescriptorEnum.features).wGet(0).wGet(ModelsFeatureDescriptorEnum.type);
SimpleName var2 = (SimpleName) modelPattern.getDeclarations().wGet(1).wGet(ModelsFeatureDescriptorEnum.name);
assertEquals("DE", var1.wStringValue());
assertEquals("DE", var2.wStringValue());
assertNotSame(var1, var2);
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class IteratorFactoryTest method testVariableIterator.
@Test
public void testVariableIterator() {
Grammar g = new TestXmlGrammar().create();
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
IEntityIterator<IEntity> i = IteratorFactory.variableIterator("testVar");
i.setBindings(bindings);
assertFalse(i.hasNext());
i.reset(g);
assertFalse(i.hasNext());
bindings.wDef("testVar", g);
assertTrue(i.hasNext());
IEntity g1 = i.next();
assertSame(g, g1);
assertFalse(i.hasNext());
i.reset(g);
assertTrue(i.hasNext());
g1 = i.next();
assertSame(g, g1);
assertFalse(i.hasNext());
bindings = BindingManagerFactory.instance.createBindingManager();
bindings.wDef("testVar", g);
i = IteratorFactory.variableIterator("testVar");
i.setBindings(bindings);
assertTrue(i.hasNext());
g1 = i.next();
assertSame(g, g1);
assertFalse(i.hasNext());
i.reset(g);
IEntityIterator<IEntity> i2 = i.clone();
assertTrue(i.hasNext());
g1 = i.next();
assertSame(g, g1);
assertFalse(i.hasNext());
assertTrue(i2.hasNext());
g1 = i2.next();
assertSame(g, g1);
assertFalse(i2.hasNext());
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ResourceArtifactsGeneratorTest method test1GenerateWorkspace.
@Test
public void test1GenerateWorkspace() {
assertTrue(workspaceFolder.exists());
IBindingManager bindings = BindingManagerFactory.instance.createArguments();
bindings.wDefValue("folderLocation", workspaceFolder.getAbsolutePath());
ArtifactsGeneratorOperation.generate(artifacts, bindings);
File genFolder = new File("data/gen");
assertTrue(genFolder.exists());
}
Aggregations