use of org.activityinfo.store.query.shared.NullFormScanCache in project activityinfo by bedatadriven.
the class EnumerationQueryTest method enumRefTests.
@Test
public void enumRefTests() {
TestingStorageProvider catalog = new TestingStorageProvider();
ColumnSetBuilder builder = new ColumnSetBuilder(catalog, new NullFormScanCache(), new NullFormSupervisor());
IntakeForm intakeForm = catalog.getIntakeForm();
QueryModel queryModel = new QueryModel(intakeForm.getFormId());
queryModel.selectField(intakeForm.getNationalityFieldId()).as("nationality");
queryModel.selectExpr(intakeForm.getNationalityFieldId() + "==" + "\"" + intakeForm.getPalestinianId() + "\"").as("palestinian");
queryModel.selectExpr("\"" + intakeForm.getPalestinianId() + "\"" + "==" + intakeForm.getNationalityFieldId()).as("palestinianInverse");
ColumnSet columnSet = builder.build(queryModel);
ColumnView nationality = columnSet.getColumnView("nationality");
ColumnView palestinian = columnSet.getColumnView("palestinian");
ColumnView palestinianInverse = columnSet.getColumnView("palestinianInverse");
// Correct Tests
assertThat(nationality.get(1).toString(), equalTo(NAT_PAL));
assertThat(Boolean.valueOf(palestinian.get(1).toString()), equalTo(true));
assertThat(Boolean.valueOf(palestinianInverse.get(1).toString()), equalTo(true));
// Incorrect Tests
// Multiple selected values should return null
assertThat(nationality.get(5), equalTo(null));
}
use of org.activityinfo.store.query.shared.NullFormScanCache in project activityinfo by bedatadriven.
the class UnaryFunctionQueryTest method setup.
@Before
public void setup() {
catalog = new TestingStorageProvider();
builder = new ColumnSetBuilder(catalog, new NullFormScanCache(), new NullFormSupervisor());
intakeForm = catalog.getIntakeForm();
}
use of org.activityinfo.store.query.shared.NullFormScanCache in project activityinfo by bedatadriven.
the class AsyncClientStub method queryTableColumns.
@Override
public Promise<ColumnSet> queryTableColumns(QueryModel query) {
if (!connected) {
return offlineResult();
}
ColumnSetBuilder columnSetBuilder = new ColumnSetBuilder(storageProvider, new NullFormScanCache(), new NullFormSupervisor());
ColumnSet columnSet = columnSetBuilder.build(query);
return Promise.resolved(columnSet);
}
Aggregations