use of org.apache.activemq.store.jdbc.adapter.TransactDatabaseLocker in project activemq-artemis by apache.
the class ConfigTest method testJdbcLockConfigOverride.
@Test
public void testJdbcLockConfigOverride() throws Exception {
JDBCPersistenceAdapter adapter = new JDBCPersistenceAdapter();
Mockery context = new Mockery();
final DataSource dataSource = context.mock(DataSource.class);
final Connection connection = context.mock(Connection.class);
final DatabaseMetaData metadata = context.mock(DatabaseMetaData.class);
final ResultSet result = context.mock(ResultSet.class);
adapter.setDataSource(dataSource);
adapter.setCreateTablesOnStartup(false);
context.checking(new Expectations() {
{
allowing(dataSource).getConnection();
will(returnValue(connection));
allowing(connection).getMetaData();
will(returnValue(metadata));
allowing(connection);
allowing(metadata).getDriverName();
will(returnValue("Microsoft_SQL_Server_2005_jdbc_driver"));
allowing(result).next();
will(returnValue(true));
}
});
adapter.start();
assertTrue("has the locker override", adapter.getLocker() instanceof TransactDatabaseLocker);
adapter.stop();
}
Aggregations