Search in sources :

Example 86 with ValueMetaNumber

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

the class CheckSumTest method testHexOutput_sha1.

@Test
public void testHexOutput_sha1() throws Exception {
    MockRowListener results = executeHexTest(3, false, "xyz", new ValueMetaString("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("66b27417d37e024c46526c2f6d358a754fc552f3", results.getWritten().get(0)[1]);
    results = executeHexTest(3, false, 10.8, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("78aef53da0b8d7a80656c80aa35ad6d410b7f068", results.getWritten().get(0)[1]);
    results = executeHexTest(3, false, 10.82, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("749f3d4c2db67c9f3186563a72ef5da9461f0496", results.getWritten().get(0)[1]);
    byte[] input = IOUtils.toByteArray(getFile("/org/pentaho/di/trans/steps/loadfileinput/files/pentaho_splash.png").getContent().getInputStream());
    results = executeHexTest(3, false, input, new ValueMetaBinary("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("e67d0b5b60663b8a5e0df1d23b44de673738315a", results.getWritten().get(0)[1]);
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) Test(org.junit.Test)

Example 87 with ValueMetaNumber

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

the class CheckSumTest method testHexOutput_md5.

@Test
public void testHexOutput_md5() throws Exception {
    MockRowListener results = executeHexTest(2, false, "xyz", new ValueMetaString("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("d16fb36f0911f878998c136191af705e", results.getWritten().get(0)[1]);
    results = executeHexTest(2, false, 10.8, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("372df98e33ac1bf6b26d225361ba7eb5", results.getWritten().get(0)[1]);
    results = executeHexTest(2, false, 10.82, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("68b142f87143c917f29d178aa1715957", results.getWritten().get(0)[1]);
    byte[] input = IOUtils.toByteArray(getFile("/org/pentaho/di/trans/steps/loadfileinput/files/pentaho_splash.png").getContent().getInputStream());
    results = executeHexTest(2, false, input, new ValueMetaBinary("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("8d808ff9051fdbfd8050f762daddf813", results.getWritten().get(0)[1]);
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) Test(org.junit.Test)

Example 88 with ValueMetaNumber

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

the class CheckSumTest method testHexOutput_adler32.

@Test
public void testHexOutput_adler32() throws Exception {
    MockRowListener results = executeHexTest(1, false, "xyz", new ValueMetaString("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("47645036"), results.getWritten().get(0)[1]);
    results = executeHexTest(1, false, 10.8, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("32243912"), results.getWritten().get(0)[1]);
    results = executeHexTest(1, false, 10.82, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("48627962"), results.getWritten().get(0)[1]);
    byte[] input = IOUtils.toByteArray(getFile("/org/pentaho/di/trans/steps/loadfileinput/files/pentaho_splash.png").getContent().getInputStream());
    results = executeHexTest(1, false, input, new ValueMetaBinary("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("1586189688"), results.getWritten().get(0)[1]);
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) Test(org.junit.Test)

Example 89 with ValueMetaNumber

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

the class CheckSumTest method testHexOutput_crc32.

@Test
public void testHexOutput_crc32() throws Exception {
    MockRowListener results = executeHexTest(0, false, "xyz", new ValueMetaString("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("3951999591"), results.getWritten().get(0)[1]);
    results = executeHexTest(0, false, 10.8, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("1857885434"), results.getWritten().get(0)[1]);
    results = executeHexTest(0, false, 10.82, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("1205016603"), results.getWritten().get(0)[1]);
    byte[] input = IOUtils.toByteArray(getFile("/org/pentaho/di/trans/steps/loadfileinput/files/pentaho_splash.png").getContent().getInputStream());
    results = executeHexTest(0, false, input, new ValueMetaBinary("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals(Long.valueOf("1508231614"), results.getWritten().get(0)[1]);
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) Test(org.junit.Test)

Example 90 with ValueMetaNumber

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

the class CheckSumTest method testHexOutput_sha1_compatibilityMode_oldChecksumBehaviourMode.

@Test
public void testHexOutput_sha1_compatibilityMode_oldChecksumBehaviourMode() throws Exception {
    MockRowListener results = executeHexTest(3, true, "xyz", new ValueMetaString("test"), true);
    assertEquals(1, results.getWritten().size());
    assertEquals("66FD7417FD7E024C46526C2F6D35FD754FFD52FD", results.getWritten().get(0)[1]);
    results = executeHexTest(3, true, 10.8, new ValueMetaNumber("test"), true);
    assertEquals(1, results.getWritten().size());
    assertEquals("78FDFD3DFDFDE80656FD0AFD5AFDFD10FDFD68", results.getWritten().get(0)[1]);
    results = executeHexTest(3, true, 10.82, new ValueMetaNumber("test"), true);
    assertEquals(1, results.getWritten().size());
    assertEquals("74FD3D4C2DFD7CFD31FD563A72FD5DFD461F04FD", results.getWritten().get(0)[1]);
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) Test(org.junit.Test)

Aggregations

ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)95 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)75 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)52 Test (org.junit.Test)51 RowMeta (org.pentaho.di.core.row.RowMeta)39 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)34 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)34 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)32 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)30 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)25 ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)20 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)16 ValueMetaInternetAddress (org.pentaho.di.core.row.value.ValueMetaInternetAddress)15 KettleException (org.pentaho.di.core.exception.KettleException)12 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)11 KettleStepException (org.pentaho.di.core.exception.KettleStepException)7 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 RowSet (org.pentaho.di.core.RowSet)6 RowAdapter (org.pentaho.di.trans.step.RowAdapter)6