use of org.apache.gobblin.writer.commands.MySqlWriterCommands in project incubator-gobblin by apache.
the class JdbcWriterCommandsTest method testMySqlDateTypeRetrieval.
@Test
public void testMySqlDateTypeRetrieval() throws SQLException {
Connection conn = mock(Connection.class);
PreparedStatement pstmt = mock(PreparedStatement.class);
when(conn.prepareStatement(any(String.class))).thenReturn(pstmt);
ResultSet rs = createMockResultSet();
when(pstmt.executeQuery()).thenReturn(rs);
MySqlWriterCommands writerCommands = new MySqlWriterCommands(new State(), conn);
Map<String, JdbcType> actual = writerCommands.retrieveDateColumns("db", "users");
ImmutableMap.Builder<String, JdbcType> builder = ImmutableMap.builder();
builder.put("date_of_birth", JdbcType.DATE);
builder.put("last_modified", JdbcType.TIME);
builder.put("created", JdbcType.TIMESTAMP);
Map<String, JdbcType> expected = builder.build();
Assert.assertEquals(expected, actual);
}
Aggregations