use of org.pentaho.di.core.row.value.ValueMetaInteger 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.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class ReadAllCacheTest method lookup_Finds_WithTwoBetweenOperators.
@Test
public void lookup_Finds_WithTwoBetweenOperators() throws Exception {
RowMeta meta = new RowMeta();
meta.addValueMeta(new ValueMetaInteger());
meta.addValueMeta(new ValueMetaString());
meta.addValueMeta(new ValueMetaString());
meta.addValueMeta(new ValueMetaDate());
meta.addValueMeta(new ValueMetaDate());
meta.addValueMeta(new ValueMetaInteger());
ReadAllCache cache = buildCache(">,BETWEEN,BETWEEN,IS NULL");
Object[] found = cache.getRowFromCache(meta, new Object[] { -1L, "1", "3", new Date(0), new Date(1000), null });
assertArrayEquals("('1' <= keys[1] <= '3') && (0 <= keys[2] <= 1000) --> row 2", data[2], found);
}
use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class ReadAllCacheTest method lookup_Finds_WithBetweenOperator.
@Test
public void lookup_Finds_WithBetweenOperator() throws Exception {
RowMeta meta = keysMeta.clone();
meta.setValueMeta(3, new ValueMetaDate());
meta.addValueMeta(new ValueMetaInteger());
ReadAllCache cache = buildCache("<>,IS NOT NULL,BETWEEN,IS NULL");
Object[] found = cache.getRowFromCache(meta, new Object[] { -1L, null, new Date(140), new Date(160), null });
assertArrayEquals("(140 <= keys[2] <= 160) --> row 4", data[4], found);
}
use of org.pentaho.di.core.row.value.ValueMetaInteger 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);
}
use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.
the class BaseMetadataInjectionTest method check.
/**
* Check long property.
*/
protected void check(String propertyName, LongGetter getter) throws KettleException {
ValueMetaInterface valueMetaString = new ValueMetaString("f");
injector.setProperty(meta, propertyName, setValue(valueMetaString, "1"), "f");
assertEquals(1, getter.get());
injector.setProperty(meta, propertyName, setValue(valueMetaString, "45"), "f");
assertEquals(45, getter.get());
ValueMetaInterface valueMetaInteger = new ValueMetaInteger("f");
injector.setProperty(meta, propertyName, setValue(valueMetaInteger, 1234L), "f");
assertEquals(1234, getter.get());
injector.setProperty(meta, propertyName, setValue(valueMetaInteger, Long.MAX_VALUE), "f");
assertEquals(Long.MAX_VALUE, getter.get());
skipPropertyTest(propertyName);
}
Aggregations