Search in sources :

Example 21 with ValueMetaBinary

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

the class VerticaDatabaseMetaIT method testGetOneByteBinaryFieldDefinition.

@Test
public void testGetOneByteBinaryFieldDefinition() {
    ValueMetaInterface vm = new ValueMetaBinary("TestFieldBinary", 1, 1);
    String expDefaultBinaryField = "VARBINARY(1)";
    DatabaseInterface databaseInterface = new VerticaDatabaseMeta();
    String defaultBinaryField = databaseInterface.getFieldDefinition(vm, TECHNICAL_KEY_NAME, PRIMARY_KEY_NAME, false, false, false);
    String assertMessage = defaultBinaryField + " should be equal to expected " + expDefaultBinaryField;
    assertTrue(assertMessage, expDefaultBinaryField.equals(defaultBinaryField));
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 22 with ValueMetaBinary

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

the class VerticaDatabaseMetaIT method testGetMaximumByteBinaryFieldDefinition.

@Test
public void testGetMaximumByteBinaryFieldDefinition() {
    ValueMetaInterface vm = new ValueMetaBinary("TestFieldBinary", 65000, 1);
    String expDefaultBinaryField = "VARBINARY(65000)";
    DatabaseInterface databaseInterface = new VerticaDatabaseMeta();
    String defaultBinaryField = databaseInterface.getFieldDefinition(vm, TECHNICAL_KEY_NAME, PRIMARY_KEY_NAME, false, false, false);
    String assertMessage = defaultBinaryField + " should be equal to expected " + expDefaultBinaryField;
    assertTrue(assertMessage, expDefaultBinaryField.equals(defaultBinaryField));
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 23 with ValueMetaBinary

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

the class VerticaDatabaseMetaIT method testGetDefaultBinaryFieldDefinition.

@Test
public void testGetDefaultBinaryFieldDefinition() {
    ValueMetaInterface vm = new ValueMetaBinary("TestFieldBinary", -1, 1);
    String expDefaultBinaryField = "VARBINARY";
    DatabaseInterface databaseInterface = new VerticaDatabaseMeta();
    String defaultBinaryField = databaseInterface.getFieldDefinition(vm, TECHNICAL_KEY_NAME, PRIMARY_KEY_NAME, false, false, false);
    String assertMessage = defaultBinaryField + " should be equal to expected " + expDefaultBinaryField;
    assertTrue(assertMessage, expDefaultBinaryField.equals(defaultBinaryField));
}
Also used : ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 24 with ValueMetaBinary

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

the class JaninoStepIT method createRowMetaInterface.

public RowMetaInterface createRowMetaInterface() {
    RowMetaInterface rm = new RowMeta();
    ValueMetaInterface[] valuesMeta = { new ValueMetaString("string"), new ValueMetaInteger("integer"), new ValueMetaNumber("number"), new ValueMetaBigNumber("bigdecimal"), new ValueMetaDate("date"), new ValueMetaBinary("binary"), new ValueMetaBoolean("bool"), new ValueMetaTimestamp("timestamp"), new ValueMetaInternetAddress("inetaddress") };
    for (int i = 0; i < valuesMeta.length; i++) {
        rm.addValueMeta(valuesMeta[i]);
    }
    return rm;
}
Also used : ValueMetaTimestamp(org.pentaho.di.core.row.value.ValueMetaTimestamp) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaInternetAddress(org.pentaho.di.core.row.value.ValueMetaInternetAddress) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaBigNumber(org.pentaho.di.core.row.value.ValueMetaBigNumber) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate)

Example 25 with ValueMetaBinary

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

the class CheckSumTest method testHexOutput_sha1_compatibilityMode.

@Test
public void testHexOutput_sha1_compatibilityMode() throws Exception {
    MockRowListener results = executeHexTest(3, true, "xyz", new ValueMetaString("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("66FD7417FD7E024C46526C2F6D35FD754FFD52FD", results.getWritten().get(0)[1]);
    results = executeHexTest(3, true, 10.8, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("78FDFD3DFDFDE80656FD0AFD5AFDFD10FDFD68", results.getWritten().get(0)[1]);
    results = executeHexTest(3, true, 10.82, new ValueMetaNumber("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("74FD3D4C2DFD7CFD31FD563A72FD5DFD461F04FD", 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, true, input, new ValueMetaBinary("test"), false);
    assertEquals(1, results.getWritten().size());
    assertEquals("FD7D0B5B60663BFD5E0DFDFD3B44FD673738315A", 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