use of org.pentaho.di.trans.steps.databaselookup.DatabaseLookupData in project pentaho-kettle by pentaho.
the class ReadAllCacheTest method setUp.
@Before
public void setUp() {
stepData = new DatabaseLookupData();
stepData.conditions = new int[4];
keysMeta = new RowMeta();
keysMeta.addValueMeta(new ValueMetaInteger());
keysMeta.addValueMeta(new ValueMetaString());
keysMeta.addValueMeta(new ValueMetaDate());
keysMeta.addValueMeta(new ValueMetaInteger());
keys = new Object[][] { new Object[] { 0L, "0", new Date(0), null }, new Object[] { 0L, "0", new Date(50), null }, new Object[] { 2L, "2", new Date(200), null }, new Object[] { 1L, "1", new Date(100), null }, new Object[] { 1L, "1", new Date(150), null } };
data = new Object[][] { new Object[] { 0 }, new Object[] { 1 }, new Object[] { 2 }, new Object[] { 3 }, new Object[] { 4 } };
}
use of org.pentaho.di.trans.steps.databaselookup.DatabaseLookupData in project pentaho-kettle by pentaho.
the class ReadAllCacheTest method lookup_HandlesAbsenceOfLookupValue.
@Test
public void lookup_HandlesAbsenceOfLookupValue() throws Exception {
stepData = new DatabaseLookupData();
stepData.conditions = new int[] { DatabaseLookupMeta.CONDITION_IS_NOT_NULL };
ReadAllCache.Builder builder = new ReadAllCache.Builder(stepData, 2);
RowMeta keysMeta = new RowMeta();
keysMeta.addValueMeta(new ValueMetaInteger());
builder.setKeysMeta(keysMeta);
builder.add(new Object[] { null }, new Object[] { "null" });
builder.add(new Object[] { 1L }, new Object[] { "one" });
ReadAllCache cache = builder.build();
Object[] found = cache.getRowFromCache(new RowMeta(), new Object[0]);
assertArrayEquals("(keys[1] == 1L) --> row 2", new Object[] { "one" }, found);
}
Aggregations