use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.
the class DatabaseConnectionCase method testConnectWithNullProperties.
@Test
public void testConnectWithNullProperties() throws Exception {
DatabaseConnection con = configure(createConnection());
con.setConnectionProperties(null);
LifecycleHelper.init(con);
LifecycleHelper.start(con);
con.connect();
}
use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.
the class DatabaseConnectionCase method testConnectWithoutDebugMode.
@Test
public void testConnectWithoutDebugMode() throws Exception {
DatabaseConnection conn = configure(createConnection());
conn.setDebugMode(false);
LifecycleHelper.init(conn);
conn.connect();
}
use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.
the class DatabaseConnectionCase method testConnectionDataSource.
@Test
public void testConnectionDataSource() throws Exception {
DatabaseConnection con = configure(createConnection());
try {
LifecycleHelper.init(con);
LifecycleHelper.start(con);
assertNotNull(con.asDataSource());
assertNotNull(con.asDataSource().getConnection());
} finally {
LifecycleHelper.stop(con);
LifecycleHelper.close(con);
}
}
use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.
the class DatabaseConnectionCase method testSetConnectionAttempts.
@Test
public void testSetConnectionAttempts() throws Exception {
DatabaseConnection con = createConnection();
assertNull(con.getConnectionAttempts());
assertEquals(-1, con.connectionAttempts());
con.setConnectionAttempts(Integer.valueOf(1));
assertEquals(Integer.valueOf(1), con.getConnectionAttempts());
assertEquals(1, con.connectionAttempts());
con.setConnectionAttempts(null);
assertNull(con.getConnectionAttempts());
assertEquals(-1, con.connectionAttempts());
}
use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.
the class DatabaseConnectionCase method testConnectionWhenNotInitialised.
@Test
public void testConnectionWhenNotInitialised() throws Exception {
DatabaseConnection con = configure(createConnection());
try {
con.connect();
fail("Expected failure as not initialised");
} catch (Exception e) {
// Expected
;
}
}
Aggregations