<commit_before>package org.docksidestage.hangar.unit.db;

import javax.sql.DataSource;

import org.docksidestage.hangar.EmbeddedH2UrlFactoryBean;

import com.atomikos.jdbc.AtomikosNonXADataSourceBean;

/**
 * @author jflute
 * @since 0.9.2 (2009/02/18 Wednesday) split from UnitContainerTestCase (2022/04/28 Thursday)
 */
public abstract class H2AtomikosDbArranger {

    public DataSource createDataSource() {
        final AtomikosNonXADataSourceBean bean = new AtomikosNonXADataSourceBean();
        bean.setUniqueResourceName(getUniqueResourceName());
        bean.setDriverClassName("org.h2.Driver");
        final EmbeddedH2UrlFactoryBean factoryBean = new EmbeddedH2UrlFactoryBean();
        factoryBean.setUrlSuffix("/database/" + getDbName());
        factoryBean.setReferenceClassName(EmbeddedH2UrlFactoryBean.class.getName());
        final String url;
        try {
            url = factoryBean.getObject().toString();
        } catch (Exception e) {
            String msg = "The factoryBean was invalid: " + factoryBean;
            throw new IllegalStateException(msg, e);
        }
        bean.setUrl(url.toString());
        bean.setUser("sa");
        bean.setPassword("");
        bean.setPoolSize(20);
        bean.setBorrowConnectionTimeout(60);
        return bean;
    }

    public String getUniqueResourceName() {
        return "NONXADBMS_" + getDbName();
    }

    protected abstract String getDbName();
}
<commit_msg>call bean.setLocalTransactionMode(true) for Atomikos-5.0.9<commit_after>package org.docksidestage.hangar.unit.db;

import javax.sql.DataSource;

import org.docksidestage.hangar.EmbeddedH2UrlFactoryBean;

import com.atomikos.jdbc.AtomikosNonXADataSourceBean;

/**
 * @author jflute
 * @since 0.9.2 (2009/02/18 Wednesday) split from UnitContainerTestCase (2022/04/28 Thursday)
 */
public abstract class H2AtomikosDbArranger {

    public DataSource createDataSource() {
        final AtomikosNonXADataSourceBean bean = new AtomikosNonXADataSourceBean();
        bean.setLocalTransactionMode(true); // needed since 5.0.9?
        bean.setUniqueResourceName(getUniqueResourceName());
        bean.setDriverClassName("org.h2.Driver");
        final EmbeddedH2UrlFactoryBean factoryBean = new EmbeddedH2UrlFactoryBean();
        factoryBean.setUrlSuffix("/database/" + getDbName());
        factoryBean.setReferenceClassName(EmbeddedH2UrlFactoryBean.class.getName());
        final String url;
        try {
            url = factoryBean.getObject().toString();
        } catch (Exception e) {
            String msg = "The factoryBean was invalid: " + factoryBean;
            throw new IllegalStateException(msg, e);
        }
        bean.setUrl(url.toString());
        bean.setUser("sa");
        bean.setPassword("");
        bean.setPoolSize(20);
        bean.setBorrowConnectionTimeout(60);
        return bean;
    }

    public String getUniqueResourceName() {
        return "NONXADBMS_" + getDbName();
    }

    protected abstract String getDbName();
}

{'fraction_non_alphanumeric': 0.10248949240219851, 'fraction_numerical': 0.020691884901390237, 'mean_word_length': 2.911504424778761, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1794685', 'n_tokens_mistral': 935, 'n_tokens_neox': 889, 'n_words': 163}