Search in sources :

Example 21 with JdbcResultRow

use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.

the class DateColumnTranslatorTest method testGregorianNoFormat.

@Test
public void testGregorianNoFormat() throws Exception {
    JdbcResultRow row = new JdbcResultRow();
    row.setFieldValue("testField", gDate, Types.DATE);
    {
        String translated = translator.translate(row, 0);
        assertEquals("2013-08-22", translated);
    }
    {
        String translated = translator.translate(row, "testField");
        assertEquals("2013-08-22", translated);
    }
}
Also used : JdbcResultRow(com.adaptris.jdbc.JdbcResultRow) Test(org.junit.Test)

Example 22 with JdbcResultRow

use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.

the class DoubleColumnTranslatorTest method testFormattedString.

@Test
public void testFormattedString() throws Exception {
    translator.setFormat("%f");
    String floatVal = new String("123");
    JdbcResultRow row = new JdbcResultRow();
    row.setFieldValue("testField", floatVal, Types.DOUBLE);
    {
        String translated = translator.translate(row, 0);
        assertEquals(expected, translated);
    }
    {
        String translated = translator.translate(row, "testField");
        assertEquals(expected, translated);
    }
}
Also used : JdbcResultRow(com.adaptris.jdbc.JdbcResultRow) Test(org.junit.Test)

Example 23 with JdbcResultRow

use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.

the class DoubleColumnTranslatorTest method testFormattedDouble.

@Test
public void testFormattedDouble() throws Exception {
    translator.setFormat("%f");
    Double floatVal = Double.valueOf("123");
    JdbcResultRow row = new JdbcResultRow();
    row.setFieldValue("testField", floatVal, Types.DOUBLE);
    {
        String translated = translator.translate(row, 0);
        assertEquals(expected, translated);
    }
    {
        String translated = translator.translate(row, "testField");
        assertEquals(expected, translated);
    }
}
Also used : JdbcResultRow(com.adaptris.jdbc.JdbcResultRow) Test(org.junit.Test)

Example 24 with JdbcResultRow

use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.

the class FloatColumnTranslatorTest method testFormattedString.

@Test
public void testFormattedString() throws Exception {
    translator.setFormat("%f");
    String floatVal = new String("123");
    JdbcResultRow row = new JdbcResultRow();
    row.setFieldValue("testField", floatVal, Types.FLOAT);
    {
        String translated = translator.translate(row, 0);
        assertEquals(expected, translated);
    }
    {
        String translated = translator.translate(row, "testField");
        assertEquals(expected, translated);
    }
}
Also used : JdbcResultRow(com.adaptris.jdbc.JdbcResultRow) Test(org.junit.Test)

Example 25 with JdbcResultRow

use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.

the class FloatColumnTranslatorTest method testFormattedDouble.

@Test
public void testFormattedDouble() throws Exception {
    translator.setFormat("%f");
    Double floatVal = Double.valueOf("123");
    JdbcResultRow row = new JdbcResultRow();
    row.setFieldValue("testField", floatVal, Types.FLOAT);
    {
        String translated = translator.translate(row, 0);
        assertEquals(expected, translated);
    }
    {
        String translated = translator.translate(row, "testField");
        assertEquals(expected, translated);
    }
}
Also used : JdbcResultRow(com.adaptris.jdbc.JdbcResultRow) Test(org.junit.Test)

Aggregations

JdbcResultRow (com.adaptris.jdbc.JdbcResultRow)69 Test (org.junit.Test)65 OutputStream (java.io.OutputStream)9 StringWriter (java.io.StringWriter)9 WriterOutputStream (org.apache.commons.io.output.WriterOutputStream)9 SQLException (java.sql.SQLException)5 Clob (java.sql.Clob)4 SerialClob (javax.sql.rowset.serial.SerialClob)4 JdbcResultSet (com.adaptris.jdbc.JdbcResultSet)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ArrayList (java.util.ArrayList)3 CoreException (com.adaptris.core.CoreException)2 MetadataElement (com.adaptris.core.MetadataElement)2 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 ServiceException (com.adaptris.core.ServiceException)1 NoSuchElementException (java.util.NoSuchElementException)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1