Package org.opengis.cite.gpkg12
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
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 Summary
Modifier and TypeFieldDescriptionprotected Connection
protected DataSource
A JDBC DataSource for accessing the SQLite database.protected GeoPackageVersion
protected File
A SQLite database file containing a GeoPackage.static final String
Root test suite package (absolute path). -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkPrimaryKey
(String tableName, String pkName, boolean enforcePk) This function checks to determine whether the primary key is valid.void
close()
protected GeoPackageVersion
protected String
getPrimaryKeyColumn
(String tableName, boolean enforcePk) This function returns the name of a single primary key column for the given tablevoid
initCommonFixture
(org.testng.ITestContext testContext) Initializes the common test fixture.protected boolean
isExtendedType
(String tableName, String columnName) This function accounts for extensions to Requirement 5 and 25void
setTestName
(String testName) void
validateClassEnabled
(org.testng.ITestContext testContext)
-
Field Details
-
ROOT_PKG_PATH
Root test suite package (absolute path).- See Also:
-
gpkgFile
A SQLite database file containing a GeoPackage. -
dataSource
A JDBC DataSource for accessing the SQLite database. -
databaseConnection
-
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
- Throws:
SQLException
-
validateClassEnabled
@BeforeTest public void validateClassEnabled(org.testng.ITestContext testContext) throws IOException - Throws:
IOException
-
getPrimaryKeyColumn
This function returns the name of a single primary key column for the given table- Parameters:
tableName
- the name of the tableenforcePk
- 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
This function accounts for extensions to Requirement 5 and 25- Parameters:
tableName
- the table name to inspectcolumnName
- 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
-
getTestName
-
setTestName
-