use of org.talend.components.jdbc.tjdbcconnection.TJDBCConnectionProperties in project components by Talend.
the class JDBCConnectionTestIT method testConnection.
public void testConnection() {
TJDBCConnectionDefinition definition = new TJDBCConnectionDefinition();
TJDBCConnectionProperties properties = DBTestUtils.createCommonJDBCConnectionProperties(allSetting, definition);
JDBCSourceOrSink sourceOrSink = new JDBCSourceOrSink();
sourceOrSink.initialize(null, properties);
ValidationResult result = sourceOrSink.validate(null);
assertTrue(result.getStatus() == ValidationResult.Result.OK);
try (Connection conn1 = sourceOrSink.getConnection(null);
Connection conn2 = sourceOrSink.getConnection(null)) {
assertTrue(conn1 == conn2);
assertTrue(!conn1.isClosed());
} catch (ClassNotFoundException | SQLException e) {
Assert.fail(e.getMessage());
}
}
Aggregations