use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ClobColumnTranslatorTest method testClobWrite_ByName.
@Test
public void testClobWrite_ByName() 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, "testField", out);
}
String translated = writer.toString();
assertEquals("SomeData", translated);
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ClobColumnTranslatorTest method testClobIncorrectType.
@Test
public void testClobIncorrectType() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", new Integer(999), Types.CLOB);
try {
translator.translate(row, 0);
fail();
} catch (Exception ex) {
// pass, expected
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ClobColumnTranslatorTest method testClobToString.
@Test
public void testClobToString() throws Exception {
Clob clob = new SerialClob("SomeData".toCharArray());
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", clob, Types.CLOB);
String translated = translator.translate(row, 0);
assertEquals("SomeData", translated);
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ClobColumnTranslatorTest method testClobToStringColumnName.
@Test
public void testClobToStringColumnName() throws Exception {
Clob clob = new SerialClob("SomeData".toCharArray());
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", clob, Types.CLOB);
String translated = translator.translate(row, "testField");
assertEquals("SomeData", translated);
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class ClobColumnTranslatorTest method testClobIncorrectTypeColumnName.
@Test
public void testClobIncorrectTypeColumnName() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", new Integer(999), Types.CLOB);
try {
translator.translate(row, "testField");
fail();
} catch (Exception ex) {
// pass, expected
}
}
Aggregations