package org.postgresql.test.xa;

import java.sql.Connection;

import junit.framework.TestSuite;

import org.postgresql.test.TestUtil;

public class XATestSuite extends TestSuite {
    public static TestSuite suite() throws Exception {
        Class.forName("org.postgresql.Driver");
        TestSuite suite = new TestSuite();
        Connection connection = TestUtil.openDB();

        try
        {
            if (TestUtil.haveMinimumServerVersion(connection, "8.1"))
            {
                suite.addTestSuite(XADataSourceTest.class);
            }
        }
        finally
        {
            connection.close();
        }
        return suite;
    }
}

@@ -53,16 +53,70 @@
 nection;
+%0Aimport java.sql.Statement;%0Aimport java.sql.ResultSet;
 %0A%0Aimport
@@ -551,49 +551,499 @@
     
-suite.addTestSuite(XADataSourceTest.class
+Statement stmt = connection.createStatement();%0A                ResultSet rs = stmt.executeQuery(%22SHOW max_prepared_transactions%22);%0A                rs.next();%0A                int mpt = rs.getInt(1);%0A                if (mpt %3E 0) %7B%0A                    suite.addTestSuite(XADataSourceTest.class);%0A                %7D else %7B%0A                    System.out.println(%22Skipping XA tests because max_prepared_transactions = 0.%22);%0A                %7D%0A                rs.close();%0A                stmt.close(
 );%0A 

Disable the XA tests if the server doesn't allow any prepared transactions, which is the default starting with the 8.4 release.