1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
/*-------------------------------------------------------------------------
*
* Copyright (c) 2007-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc4/Jdbc4TestSuite.java,v 1.8 2008/10/08 18:43:51 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.test.jdbc4;
import junit.framework.TestSuite;
import java.sql.*;
import org.postgresql.test.TestUtil;
/*
* Executes all known tests for JDBC4
*/
public class Jdbc4TestSuite extends TestSuite
{
/*
* The main entry point for JUnit
*/
public static TestSuite suite() throws Exception
{
Class.forName("org.postgresql.Driver");
TestSuite suite = new TestSuite();
suite.addTestSuite(LOBTest.class);
suite.addTestSuite(DatabaseMetaDataTest.class);
suite.addTestSuite(ArrayTest.class);
Connection connection = TestUtil.openDB();
try
{
if (TestUtil.haveMinimumServerVersion(connection, "8.3"))
{
suite.addTestSuite(UUIDTest.class);
if (isXmlEnabled(connection)) {
suite.addTestSuite(XmlTest.class);
}
}
}
finally
{
connection.close();
}
return suite;
}
/**
* Not all servers will have been complied --with-libxml.
*/
private static boolean isXmlEnabled(Connection conn) {
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT '<a>b</a>'::xml");
rs.close();
stmt.close();
return true;
} catch (SQLException sqle) {
return false;
}
}
}
|