Class DerbyConsumerPushTest
java.lang.Object
io.github.ajevans.dbcode.dbconsumers.DerbyConsumerPushTest
@TestInstance(PER_CLASS)
@TestMethodOrder(org.junit.jupiter.api.MethodOrderer.OrderAnnotation.class)
@DisplayName("Unit tests for DerbyConsumer, minus GUI")
public class DerbyConsumerPushTest
extends Object
Unit tests for DerbyConsumer, minus GUI, using the slower data push pathway.
This is just functional tests for the slow-loading large-file push pathway. See DerbyConsumerTest for the majority of tests against this class.
Reads defaults and first and last lines from application.properties
to allow for simple replacement of data for fundamental tests.
JUnit 5.
Writes files to user directory.
- Author:
- Andy Evans
- Version: 1.0 01 Mar 2021
-
Field Summary
Fields Modifier and Type Field Description private ConnectionconnectionDatabase connection - set up prior to all tests.private DerbyConsumerdataConsumerData consumer to use.private CruTs2pt1SupplierdataSupplierData supplier to use.private StringdefaultDatabaseDirectoryDirectory database is in - gained from properties.private StringdefaultDatasetDefault database name - gained from properties.private StringdefaultFileDirectoryDirectory files are in - gained from properties.private StringdefaultSourceDefault source file - gained from properties.private StringdefaultSource1stLineDefault source file - gained from properties.private StringdefaultSourceLastLineDefault source file - gained from properties.private StringdefaultTableDefault table name - gained from properties.private StringpropertiesDirectoryDirectory for properties files.private StringstoreDatabase location - constructed from default variables. -
Constructor Summary
Constructors Constructor Description DerbyConsumerPushTest() -
Method Summary
Modifier and Type Method Description (package private) voiddataLoadedTest()Connects to the default database table and checks the first and last lines.voiddisconnect()Cuts database connection.(package private) voidloadData()Runs the application to build the database.(package private) voidmetadataLoadedTest()Connects to the default database table and checks the associated metadata table.voidtableExistsTest()Tests whether the database has the table we expect.
-
Field Details
-
propertiesDirectory
Directory for properties files. -
defaultDatabaseDirectory
Directory database is in - gained from properties. -
defaultFileDirectory
Directory files are in - gained from properties. -
defaultDataset
Default database name - gained from properties. -
defaultTable
Default table name - gained from properties. -
defaultSource
Default source file - gained from properties. -
defaultSource1stLine
Default source file - gained from properties. -
defaultSourceLastLine
Default source file - gained from properties. -
store
Database location - constructed from default variables. -
connection
Database connection - set up prior to all tests. -
dataSupplier
Data supplier to use. -
dataConsumer
Data consumer to use.
-
-
Constructor Details
-
DerbyConsumerPushTest
public DerbyConsumerPushTest()
-
-
Method Details
-
loadData
@BeforeAll @DisplayName("Load data") void loadData()Runs the application to build the database. Uses default locations from the app's META-INF/application.properties file. -
disconnect
@AfterAll @DisplayName("Disconnect from database") public void disconnect()Cuts database connection. -
tableExistsTest
@Order(1) @Test @DisplayName("Test table exists") public void tableExistsTest()Tests whether the database has the table we expect.Uses default table name from the app's META-INF/application.properties file.
-
dataLoadedTest
@Order(2) @Test @DisplayName("Data is loaded into database") void dataLoadedTest()Connects to the default database table and checks the first and last lines.Uses default name from the app's META-INF/application.properties file along with first and last line from the same file.
Validates on first and last lines.
-
metadataLoadedTest
@Order(3) @Test @DisplayName("Metadata is loaded into database") void metadataLoadedTest()Connects to the default database table and checks the associated metadata table.Validates on title.
Uses default name from the app's META-INF/application.properties file.
-