class DbUnitDatabaseConnectionDecorator implements TestClassDecorator {

    @Override
    public void beforeAll(final TestInvocation invocation) throws Exception {
        final ExecutionContext context = invocation.getContext();
        final BasicDataSource ds = (BasicDataSource) context.getData(Constants.KEY_DATA_SOURCE);

        final IDatabaseConnection connection = DatabaseConnectionFactory.openConnection(ds);
        connection.getConfig().setPropertiesByString(
                DbUnitConfigurationLoader.loadConfiguration(ResourceLocator.getResource("dbunit.properties")));
        context.storeData(Constants.KEY_CONNECTION, connection);
    }

}