use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ClobColumnTranslatorTest method testClobWrite.
@Test
public void testClobWrite() throws Exception {
Clob clob = new TestClob("SomeData");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", clob, Types.CLOB);
StringWriter writer = new StringWriter();
try (OutputStream out = new WriterOutputStream(writer)) {
translator.write(row, 0, out);
}
String translated = writer.toString();
assertEquals("SomeData", translated);
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ColumnHelperTest method testTranslate.
@Test
public void testTranslate() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", Integer.valueOf(1), Types.INTEGER);
{
String translated = translate(row, 0);
assertEquals("1", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DateColumnTranslatorTest method testDateNoFormat.
@Test
public void testDateNoFormat() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", date, Types.DATE);
{
String translated = translator.translate(row, 0);
assertEquals("2013-08-22", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("2013-08-22", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DateColumnTranslatorTest method testString.
@Test
public void testString() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", "2013-08-22", Types.DATE);
try {
translator.translate(row, 0);
fail();
} catch (Exception ex) {
// pass, expected
}
try {
translator.translate(row, "testField");
fail();
} catch (Exception ex) {
// pass, expected
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DateColumnTranslatorTest method testGregorianFormatted.
@Test
public void testGregorianFormatted() throws Exception {
translator.setDateFormat("yyyy");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", gDate, Types.DATE);
{
String translated = translator.translate(row, 0);
assertEquals("2013", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("2013", translated);
}
}
Aggregations