Search in sources :

Example 31 with ValueMetaDate

use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.

the class MemoryGroupByMetaTest method getInputRowMeta.

private RowMetaInterface getInputRowMeta() {
    RowMetaInterface rm = new RowMeta();
    rm.addValueMeta(new ValueMetaString("myGroupField2"));
    rm.addValueMeta(new ValueMetaString("myGroupField1"));
    rm.addValueMeta(new ValueMetaString("myString"));
    rm.addValueMeta(new ValueMetaInteger("myInteger"));
    rm.addValueMeta(new ValueMetaNumber("myNumber"));
    rm.addValueMeta(new ValueMetaBigNumber("myBigNumber"));
    rm.addValueMeta(new ValueMetaBinary("myBinary"));
    rm.addValueMeta(new ValueMetaBoolean("myBoolean"));
    rm.addValueMeta(new ValueMetaDate("myDate"));
    rm.addValueMeta(new ValueMetaTimestamp("myTimestamp"));
    rm.addValueMeta(new ValueMetaInternetAddress("myInternetAddress"));
    return rm;
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaTimestamp(org.pentaho.di.core.row.value.ValueMetaTimestamp) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaBigNumber(org.pentaho.di.core.row.value.ValueMetaBigNumber) ValueMetaInternetAddress(org.pentaho.di.core.row.value.ValueMetaInternetAddress) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate)

Example 32 with ValueMetaDate

use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.

the class NullIfTest method getInputRowMeta2.

private RowMeta getInputRowMeta2() {
    RowMeta inputRowMeta = new RowMeta();
    ValueMetaDate vmd1 = new ValueMetaDate("value1");
    vmd1.setConversionMask("yyyyMMdd");
    inputRowMeta.addValueMeta(vmd1);
    ValueMetaDate vmd2 = new ValueMetaDate("value2");
    vmd2.setConversionMask("yyyy/MM/dd HH:mm:ss.SSS");
    inputRowMeta.addValueMeta(vmd2);
    ValueMetaDate vmd3 = new ValueMetaDate("value3");
    vmd3.setConversionMask("yyyyMMdd");
    inputRowMeta.addValueMeta(vmd3);
    ValueMetaDate vmd4 = new ValueMetaDate("value4");
    vmd4.setConversionMask("yyyy/MM/dd HH:mm:ss.SSS");
    inputRowMeta.addValueMeta(vmd4);
    return inputRowMeta;
}
Also used : RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate)

Example 33 with ValueMetaDate

use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.

the class GroupByMetaGetFieldsTest method getFieldsWithSubject_NoFormat.

@Test
public void getFieldsWithSubject_NoFormat() {
    ValueMetaDate valueMeta = new ValueMetaDate();
    valueMeta.setName("date");
    doReturn(valueMeta).when(rowMeta).searchValueMeta("date");
    groupByMeta.setSubjectField(new String[] { "date" });
    groupByMeta.setGroupField(new String[] {});
    groupByMeta.setAggregateField(new String[] { "minDate" });
    groupByMeta.setAggregateType(new int[] { TYPE_GROUP_MIN });
    groupByMeta.getFields(rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore);
    verify(rowMeta, times(1)).clear();
    verify(rowMeta, times(1)).addRowMeta(any());
    assertEquals(null, rowMeta.searchValueMeta("minDate").getConversionMask());
}
Also used : ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 34 with ValueMetaDate

use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.

the class GroupByMetaGetFieldsTest method getFieldsWithSubject_WithFormat.

@Test
public void getFieldsWithSubject_WithFormat() {
    ValueMetaDate valueMeta = new ValueMetaDate();
    valueMeta.setConversionMask("yyyy-MM-dd");
    valueMeta.setName("date");
    doReturn(valueMeta).when(rowMeta).searchValueMeta("date");
    groupByMeta.setSubjectField(new String[] { "date" });
    groupByMeta.setGroupField(new String[] {});
    groupByMeta.setAggregateField(new String[] { "maxDate" });
    groupByMeta.setAggregateType(new int[] { TYPE_GROUP_MAX });
    groupByMeta.getFields(rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore);
    verify(rowMeta, times(1)).clear();
    verify(rowMeta, times(1)).addRowMeta(any());
    assertEquals("yyyy-MM-dd", rowMeta.searchValueMeta("maxDate").getConversionMask());
}
Also used : ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 35 with ValueMetaDate

use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.

the class GroupByMetaGetFieldsTest method getFieldsWithoutSubject.

@Test
public void getFieldsWithoutSubject() {
    ValueMetaDate valueMeta = new ValueMetaDate();
    valueMeta.setName("date");
    doReturn(valueMeta).when(rowMeta).searchValueMeta("date");
    groupByMeta.setSubjectField(new String[] { null });
    groupByMeta.setGroupField(new String[] { "date" });
    groupByMeta.setAggregateField(new String[] { "countDate" });
    groupByMeta.setAggregateType(new int[] { TYPE_GROUP_COUNT_ANY });
    groupByMeta.getFields(rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore);
    verify(rowMeta, times(1)).clear();
    verify(rowMeta, times(1)).addRowMeta(any());
    assertNotNull(rowMeta.searchValueMeta("countDate"));
}
Also used : ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)104 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)63 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)59 Test (org.junit.Test)50 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)44 RowMeta (org.pentaho.di.core.row.RowMeta)43 ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)34 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)33 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)25 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)23 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)21 Calendar (java.util.Calendar)17 Date (java.util.Date)17 KettleException (org.pentaho.di.core.exception.KettleException)15 ValueMetaInternetAddress (org.pentaho.di.core.row.value.ValueMetaInternetAddress)15 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)14 ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)13 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)10 KettleStepException (org.pentaho.di.core.exception.KettleStepException)10 SQLException (java.sql.SQLException)8