Class CommonFixture

java.lang.Object
org.opengis.cite.gpkg12.CommonFixture
Direct Known Subclasses:
AttributeTests, CRSWKT, DataContentsTests, ExtensionsTests, FeaturesFixture, MetadataTests, RTEBase, RTreeIndexTests, SchemaTests, SpatialReferenceSystemsTests, SQLiteContainerTests, TileFixture

public class CommonFixture extends Object
A supporting base class that sets up a common test fixture. These configuration methods are invoked before any that may be defined in a subclass.
  • Field Details

    • ROOT_PKG_PATH

      public static final String ROOT_PKG_PATH
      Root test suite package (absolute path).
      See Also:
    • gpkgFile

      protected File gpkgFile
      A SQLite database file containing a GeoPackage.
    • dataSource

      protected DataSource dataSource
      A JDBC DataSource for accessing the SQLite database.
    • databaseConnection

      protected Connection databaseConnection
    • geopackageVersion

      protected GeoPackageVersion geopackageVersion
  • Constructor Details

    • CommonFixture

      public CommonFixture()
  • Method Details

    • initCommonFixture

      @BeforeClass public void initCommonFixture(org.testng.ITestContext testContext) throws SQLException, IOException
      Initializes the common test fixture. The fixture includes the following components:
      • a File representing a GeoPackage;
      • a DataSource for accessing a SQLite database.
      Parameters:
      testContext - The test context that contains all the information for a test run, including suite attributes.
      Throws:
      SQLException - If a database access error occurs.
      IOException - If attempts to detect the database version fail
    • close

      @AfterClass public void close() throws SQLException
      Throws:
      SQLException
    • validateClassEnabled

      @BeforeTest public void validateClassEnabled(org.testng.ITestContext testContext) throws IOException
      Throws:
      IOException
    • getPrimaryKeyColumn

      protected String getPrimaryKeyColumn(String tableName, boolean enforcePk) throws SQLException
      This function returns the name of a single primary key column for the given table
      Parameters:
      tableName - the name of the table
      enforcePk - true: the column must be a primary key false: default to the first column as long as it is an integer
      Returns:
      the name of the primary key column
      Throws:
      SQLException - on any error
    • isExtendedType

      protected boolean isExtendedType(String tableName, String columnName) throws SQLException
      This function accounts for extensions to Requirement 5 and 25
      Parameters:
      tableName - the table name to inspect
      columnName - the column name to inspect
      Returns:
      true: this table/column is an exception to Requirement 5 and should be skipped
      Throws:
      SQLException - on any error
    • checkPrimaryKey

      protected void checkPrimaryKey(String tableName, String pkName, boolean enforcePk) throws SQLException
      This function checks to determine whether the primary key is valid. Checking the notnull column of PRAGMA table_info is insufficient. See https://github.com/opengeospatial/geopackage/issues/282 for more details.
      Parameters:
      tableName - the name of the table (required)
      pkName - the name of the required primary key (may be null, in which case it is detected)
      enforcePk - true: the column must be a primary key, false: the column may be PK-like, an integer with unique values
      Throws:
      SQLException - on any error
    • getGeopackageVersion

      protected GeoPackageVersion getGeopackageVersion()
    • getTestName

      public String getTestName()
    • setTestName

      public void setTestName(String testName)