Search in sources :

Example 6 with DatabaseConnection

use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.

the class DatabaseConnectionCase method testConnectionWhenInitialised.

@Test
public void testConnectionWhenInitialised() throws Exception {
    DatabaseConnection con = configure(createConnection());
    LifecycleHelper.init(con);
    con.connect();
}
Also used : DatabaseConnection(com.adaptris.core.jdbc.DatabaseConnection) Test(org.junit.Test)

Example 7 with DatabaseConnection

use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.

the class DatabaseConnectionCase method testConnectionWhenStopped.

@Test
public void testConnectionWhenStopped() throws Exception {
    DatabaseConnection con = configure(createConnection());
    LifecycleHelper.init(con);
    LifecycleHelper.start(con);
    LifecycleHelper.stop(con);
    try {
        con.connect();
        fail("Expected failure as not initialised");
    } catch (Exception e) {
        // Expected
        ;
    }
}
Also used : DatabaseConnection(com.adaptris.core.jdbc.DatabaseConnection) Test(org.junit.Test)

Example 8 with DatabaseConnection

use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.

the class DatabaseConnectionCase method testXmlRoundTrip.

@Test
public void testXmlRoundTrip() throws Exception {
    DatabaseConnection conn1 = configure(createConnection());
    DatabaseConnection conn2 = roundTrip(conn1, DefaultMarshaller.getDefaultMarshaller());
    assertRoundtripEquality(conn1, conn2);
}
Also used : DatabaseConnection(com.adaptris.core.jdbc.DatabaseConnection) Test(org.junit.Test)

Example 9 with DatabaseConnection

use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.

the class DatabaseConnectionCase method testConnectWithDebugModeAndAlwaysValidate.

@Test
public void testConnectWithDebugModeAndAlwaysValidate() throws Exception {
    DatabaseConnection conn = configure(createConnection());
    conn.setDebugMode(true);
    conn.setAlwaysValidateConnection(true);
    LifecycleHelper.init(conn);
    conn.connect();
}
Also used : DatabaseConnection(com.adaptris.core.jdbc.DatabaseConnection) Test(org.junit.Test)

Example 10 with DatabaseConnection

use of com.adaptris.core.jdbc.DatabaseConnection in project interlok by adaptris.

the class JdbcServiceListTest method testServiceList_SequenceNumber_NoAutoCommit.

@Test
public void testServiceList_SequenceNumber_NoAutoCommit() throws Exception {
    createDatabase();
    JdbcServiceList service = createServiceCollection();
    DatabaseConnection c = createJdbcConnection();
    c.setAutoCommit(false);
    service.setConnection(c);
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    service.add(createSequenceNumberService(null, getName(), SequenceNumberCase.DEFAULT_ID));
    execute(service, msg);
    doStandardAssertions(msg);
    assertTrue(msg.getObjectHeaders().containsKey(JdbcConstants.OBJ_METADATA_DATABASE_CONNECTION_KEY));
    Connection sqlCon = (Connection) msg.getObjectHeaders().get(JdbcConstants.OBJ_METADATA_DATABASE_CONNECTION_KEY);
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Connection(java.sql.Connection) AdvancedJdbcPooledConnection(com.adaptris.core.jdbc.AdvancedJdbcPooledConnection) DatabaseConnection(com.adaptris.core.jdbc.DatabaseConnection) JdbcPooledConnection(com.adaptris.core.jdbc.JdbcPooledConnection) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection) DatabaseConnection(com.adaptris.core.jdbc.DatabaseConnection) Test(org.junit.Test)

Aggregations

DatabaseConnection (com.adaptris.core.jdbc.DatabaseConnection)20 Test (org.junit.Test)20 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 AdvancedJdbcPooledConnection (com.adaptris.core.jdbc.AdvancedJdbcPooledConnection)3 JdbcConnection (com.adaptris.core.jdbc.JdbcConnection)3 JdbcPooledConnection (com.adaptris.core.jdbc.JdbcPooledConnection)3 Connection (java.sql.Connection)3 NullService (com.adaptris.core.NullService)2 ServiceException (com.adaptris.core.ServiceException)2 KeyValuePairSet (com.adaptris.util.KeyValuePairSet)1 TimeInterval (com.adaptris.util.TimeInterval)1