Search in sources :

Example 26 with ValueMetaBinary

use of org.pentaho.di.core.row.value.ValueMetaBinary 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 27 with ValueMetaBinary

use of org.pentaho.di.core.row.value.ValueMetaBinary 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 28 with ValueMetaBinary

use of org.pentaho.di.core.row.value.ValueMetaBinary 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 29 with ValueMetaBinary

use of org.pentaho.di.core.row.value.ValueMetaBinary 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 30 with ValueMetaBinary

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

the class CheckSumTest method testHexOutput_sha256.

@Test
public void testHexOutput_sha256() throws Exception {
    MockRowListener results = executeHexTest(4, false, "xyz", new ValueMetaString("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("3608bca1e44ea6c4d268eb6db02260269892c0b42b86bbf1e77a6fa16c3c9282", results.getWritten().get(0)[1]);
    results = executeHexTest(4, false, 10.8, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("b52b603f9ec86c382a8483cad4f788f2f927535a76ad1388caedcef5e3c3c813", results.getWritten().get(0)[1]);
    results = executeHexTest(4, false, 10.82, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("45cbb96ff9625490cd675a7a39fecad6c167c1ed9b8957f53224fcb3e4a1e4a1", results.getWritten().get(0)[1]);
    byte[] input = IOUtils.toByteArray(getFile("/org/pentaho/di/trans/steps/loadfileinput/files/pentaho_splash.png").getContent().getInputStream());
    results = executeHexTest(4, false, input, new ValueMetaBinary("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("6914d0cb9296d658569570c23924ea4822be73f0ee3bc46d11651fb4041a43e1", 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)

Aggregations

ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)31 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)29 Test (org.junit.Test)24 ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)20 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)15 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)13 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)13 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)13 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)12 ValueMetaInternetAddress (org.pentaho.di.core.row.value.ValueMetaInternetAddress)11 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)10 RowMeta (org.pentaho.di.core.row.RowMeta)6 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)6 StepMeta (org.pentaho.di.trans.step.StepMeta)3 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 Mockito.doAnswer (org.mockito.Mockito.doAnswer)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Answer (org.mockito.stubbing.Answer)2 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2