<commit_before>package org.postgresql.test.xa;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Random;

import javax.sql.XAConnection;
import javax.sql.XADataSource;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;


import org.postgresql.test.TestUtil;
import org.postgresql.xa.PGXADataSource;

import junit.framework.TestCase;

public class XADataSourceTest extends TestCase {

    private XADataSource _ds;

    private Connection _conn;

	private XAConnection xaconn;
	private XAResource xaRes;
    private Connection conn;
	
    public XADataSourceTest(String name) {
        super(name);
		
		_ds = new PGXADataSource();
		((PGXADataSource)_ds).setServerName(TestUtil.getServer());
		((PGXADataSource)_ds).setUser(TestUtil.getUser());
		((PGXADataSource)_ds).setPassword(TestUtil.getPassword());
		((PGXADataSource)_ds).setDatabaseName(TestUtil.getDatabase());
    }

    protected void setUp() throws SQLException {
        _conn = TestUtil.openDB();

        TestUtil.createTable(_conn, "testxa1", "foo int");

		clearAllPrepared();
		
		_conn.setAutoCommit(false);
		
		xaconn = _ds.getXAConnection();
		xaRes = xaconn.getXAResource();
		conn = xaconn.getConnection();
    }
<commit_msg>Include port number in datasource setup so we connect to the correct server.<commit_after>package org.postgresql.test.xa;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Random;

import javax.sql.XAConnection;
import javax.sql.XADataSource;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;


import org.postgresql.test.TestUtil;
import org.postgresql.xa.PGXADataSource;

import junit.framework.TestCase;

public class XADataSourceTest extends TestCase {

    private XADataSource _ds;

    private Connection _conn;

	private XAConnection xaconn;
	private XAResource xaRes;
    private Connection conn;
	
    public XADataSourceTest(String name) {
        super(name);
		
		_ds = new PGXADataSource();
		((PGXADataSource)_ds).setServerName(TestUtil.getServer());
		((PGXADataSource)_ds).setPortNumber(TestUtil.getPort());
		((PGXADataSource)_ds).setUser(TestUtil.getUser());
		((PGXADataSource)_ds).setPassword(TestUtil.getPassword());
		((PGXADataSource)_ds).setDatabaseName(TestUtil.getDatabase());
		((PGXADataSource)_ds).setPrepareThreshold(TestUtil.getPrepareThreshold());
    }

    protected void setUp() throws SQLException {
        _conn = TestUtil.openDB();

        TestUtil.createTable(_conn, "testxa1", "foo int");

		clearAllPrepared();
		
		_conn.setAutoCommit(false);
		
		xaconn = _ds.getXAConnection();
		xaRes = xaconn.getXAResource();
		conn = xaconn.getConnection();
    }

{'fraction_non_alphanumeric': 0.1141396933560477, 'fraction_numerical': 0.0006814310051107325, 'mean_word_length': 4.895582329317269, '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': '6261579', 'n_tokens_mistral': 984, 'n_tokens_neox': 944, 'n_words': 174}