Search in sources :

Example 76 with ValueMetaDate

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

the class ValueDateUtilTest method shouldCalculateDateWorkingDiff_APR.

@Test
public void shouldCalculateDateWorkingDiff_APR() throws KettleValueException {
    ValueMetaInterface metaA = new ValueMetaDate();
    ValueMetaInterface metaB = new ValueMetaDate();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    // 2009-04-01 00:00:00
    startDate.setTimeInMillis(1238544000000L);
    // 2009-04-30 00:00:00
    endDate.setTimeInMillis(1241049600000L);
    Object workingDayOfAPR = ValueDataUtil.DateWorkingDiff(metaA, endDate.getTime(), metaB, startDate.getTime());
    assertEquals("Working days count in APR ", 22L, workingDayOfAPR);
}
Also used : Calendar(java.util.Calendar) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) Test(org.junit.Test)

Example 77 with ValueMetaDate

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

the class ValueDateUtilTest method shouldCalculateDateWorkingDiff_DEC.

@Test
public void shouldCalculateDateWorkingDiff_DEC() throws KettleValueException {
    ValueMetaInterface metaA = new ValueMetaDate();
    ValueMetaInterface metaB = new ValueMetaDate();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    // 2009-12-01 00:00:00
    startDate.setTimeInMillis(1259625600000L);
    // 2009-12-31 00:00:00
    endDate.setTimeInMillis(1262217600000L);
    Object workingDayOfDEC = ValueDataUtil.DateWorkingDiff(metaA, endDate.getTime(), metaB, startDate.getTime());
    assertEquals("Working days count in DEC ", 23L, workingDayOfDEC);
}
Also used : Calendar(java.util.Calendar) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) Test(org.junit.Test)

Example 78 with ValueMetaDate

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

the class ValueDateUtilTest method shouldCalculateDateWorkingDiff_MAY.

@Test
public void shouldCalculateDateWorkingDiff_MAY() throws KettleValueException {
    ValueMetaInterface metaA = new ValueMetaDate();
    ValueMetaInterface metaB = new ValueMetaDate();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    // 2009-05-01 00:00:00
    startDate.setTimeInMillis(1241136000000L);
    // 2009-05-31 00:00:00
    endDate.setTimeInMillis(1243728000000L);
    Object workingDayOfMAY = ValueDataUtil.DateWorkingDiff(metaA, endDate.getTime(), metaB, startDate.getTime());
    assertEquals("Working days count in MAY ", 21L, workingDayOfMAY);
}
Also used : Calendar(java.util.Calendar) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) Test(org.junit.Test)

Example 79 with ValueMetaDate

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

the class ValueDateUtilTest method shouldCalculateDateWorkingDiff_JUN.

@Test
public void shouldCalculateDateWorkingDiff_JUN() throws KettleValueException {
    ValueMetaInterface metaA = new ValueMetaDate();
    ValueMetaInterface metaB = new ValueMetaDate();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    // 2009-06-01 00:00:00
    startDate.setTimeInMillis(1243814400000L);
    // 2009-06-30 00:00:00
    endDate.setTimeInMillis(1246320000000L);
    Object workingDayOfJUN = ValueDataUtil.DateWorkingDiff(metaA, endDate.getTime(), metaB, startDate.getTime());
    assertEquals("Working days count in JUN ", 22L, workingDayOfJUN);
}
Also used : Calendar(java.util.Calendar) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) Test(org.junit.Test)

Example 80 with ValueMetaDate

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

the class ValueDateUtilTest method shouldCalculateDateWorkingDiff_JAN.

@Test
public void shouldCalculateDateWorkingDiff_JAN() throws KettleValueException {
    ValueMetaInterface metaA = new ValueMetaDate();
    ValueMetaInterface metaB = new ValueMetaDate();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    // 2009-01-01 00:00:00
    startDate.setTimeInMillis(1230768000000L);
    // 2009-01-31 00:00:00
    endDate.setTimeInMillis(1233360000000L);
    Object workingDayOfJAN = ValueDataUtil.DateWorkingDiff(metaA, endDate.getTime(), metaB, startDate.getTime());
    assertEquals("Working days count in JAN ", 22L, workingDayOfJAN);
}
Also used : Calendar(java.util.Calendar) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) 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