use of org.whole.lang.rdb.codebase.SampleDatabase in project whole by wholeplatform.
the class SQLInterpreterTest method testMapAuthorsQueryWithNestedVar.
@Test
public void testMapAuthorsQueryWithNestedVar() {
IBindingManager bm = BindingManagerFactory.instance.createArguments();
bm.wDefValue("connection", connection);
bm.wDefValue("generateDropStatements", false);
Database database = new SampleDatabase().create();
InterpreterOperation.interpret(database, bm);
IEntity e = DBMappingTemplateManager.instance().create("populateDB");
InterpreterOperation.interpret(e, bm);
IEntity map = DBMappingTemplateManager.instance().create("mapAuthorsQueryWithNestedVar");
IEntity results = DBMappingTemplateManager.instance().create("mapAuthorsResults");
int index = 0;
for (IEntity result : DynamicCompilerOperation.compile(map, bm).getResultIterator()) {
IEntity expectedResult = results.wGet(index++).wGet(0);
assertTrue(Matcher.match(expectedResult, result));
}
assertEquals(1, index);
}
use of org.whole.lang.rdb.codebase.SampleDatabase in project whole by wholeplatform.
the class SQLInterpreterTest method testMapAuthorsQuery.
@Test
public void testMapAuthorsQuery() {
IBindingManager bm = BindingManagerFactory.instance.createArguments();
bm.wDefValue("connection", connection);
bm.wDefValue("generateDropStatements", false);
Database database = new SampleDatabase().create();
InterpreterOperation.interpret(database, bm);
IEntity e = DBMappingTemplateManager.instance().create("populateDB");
InterpreterOperation.interpret(e, bm);
IEntity map = DBMappingTemplateManager.instance().create("mapAuthorsQuery");
IEntity results = DBMappingTemplateManager.instance().create("mapAuthorsResults");
int index = 0;
for (IEntity result : DynamicCompilerOperation.compile(map, bm).getResultIterator()) {
IEntity expectedResult = results.wGet(index++).wGet(0);
assertTrue(Matcher.match(expectedResult, result));
}
assertEquals(results.wSize(), index);
}
use of org.whole.lang.rdb.codebase.SampleDatabase in project whole by wholeplatform.
the class SQLInterpreterTest method testMapAuthorsQuery3.
@Test
public void testMapAuthorsQuery3() {
IBindingManager bm = BindingManagerFactory.instance.createArguments();
bm.wDefValue("connection", connection);
bm.wDefValue("generateDropStatements", false);
Database database = new SampleDatabase().create();
InterpreterOperation.interpret(database, bm);
IEntity e = DBMappingTemplateManager.instance().create("populateDB");
InterpreterOperation.interpret(e, bm);
IEntity map = DBMappingTemplateManager.instance().create("mapAuthorsQuery3");
IEntity results = DBMappingTemplateManager.instance().create("mapAuthorsResults");
int index = 0;
for (IEntity result : DynamicCompilerOperation.compile(map, bm).getResultIterator()) {
IEntity expectedResult = results.wGet(index++).wGet(0);
assertTrue(Matcher.match(expectedResult, result));
}
assertEquals(results.wSize(), index);
}
use of org.whole.lang.rdb.codebase.SampleDatabase in project whole by wholeplatform.
the class SQLInterpreterTest method testMapAuthorsQuery2.
@Test
public void testMapAuthorsQuery2() {
IBindingManager bm = BindingManagerFactory.instance.createArguments();
bm.wDefValue("connection", connection);
bm.wDefValue("generateDropStatements", false);
Database database = new SampleDatabase().create();
InterpreterOperation.interpret(database, bm);
IEntity e = DBMappingTemplateManager.instance().create("populateDB");
InterpreterOperation.interpret(e, bm);
IEntity map = DBMappingTemplateManager.instance().create("mapAuthorsQuery2");
IEntity results = DBMappingTemplateManager.instance().create("mapAuthorsResults");
int index = 0;
for (IEntity result : DynamicCompilerOperation.compile(map, bm).getResultIterator()) {
IEntity expectedResult = results.wGet(index++).wGet(0);
assertTrue(Matcher.match(expectedResult, result));
}
assertEquals(results.wSize(), index);
}
Aggregations