use of org.pentaho.di.trans.dataservice.optimization.ValueMetaResolver in project pdi-dataservice-server-plugin by pentaho.
the class SqlTransGeneratorTest method testDataFormatting.
@Test
public void testDataFormatting() throws Exception {
SQL sql = new SQL("SELECT * FROM table");
RowMetaInterface rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaString("str"));
rowMeta.addValueMeta(new ValueMetaDate("time"));
rowMeta.addValueMeta(new ValueMetaInteger("long"));
sql.parse(new ValueMetaResolver(rowMeta).getRowMeta());
SqlTransGenerator generator = new SqlTransGenerator(sql, -1);
TransMeta transMeta = generator.generateTransMeta();
RowMetaInterface outputFields = transMeta.getStepFields(generator.getResultStepName());
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(2016, Calendar.FEBRUARY, 12, 13, 20);
Object[] row = { "value", calendar.getTime(), 42L };
assertThat(outputFields.getFieldNames(), arrayContaining("str", "time", "long"));
assertThat(outputFields.getString(row, 0), is("value"));
assertThat(outputFields.getString(row, 1), is("2016-02-12"));
assertThat(outputFields.getString(row, 2), is("42"));
}
use of org.pentaho.di.trans.dataservice.optimization.ValueMetaResolver in project pdi-dataservice-server-plugin by pentaho.
the class MongodbPredicateTest method setup.
@Before
public void setup() {
for (int i = 0; i < 10; i++) {
rowMeta.addValueMeta(new ValueMeta("sField" + i, ValueMetaInterface.TYPE_STRING, 50));
rowMeta.addValueMeta(new ValueMeta("iField" + i, ValueMetaInterface.TYPE_INTEGER, 7));
}
resolver = new ValueMetaResolver(rowMeta);
fieldMappings = new HashMap<String, String>();
}
Aggregations