Class LightAirApi
java.lang.Object
net.sf.lightair.LightAirApi
- All Implemented Interfaces:
Keywords
- Direct Known Subclasses:
Api
Light Air's programmatic API.
The general contract is to initialize(String) and shutdown()
and in between perform either generateXsd() call
or (a series of) setup(Map) and verify(Map) or
await(Map) calls.
To generate XSD files:
Api.initialize(Api.getPropertiesFileName()); Api.generateXsd(); Api.shutdown();
To set up and verify database:
Map<String, List<String>> fileNames = new HashMap<>();
fileNames.put(Keywords.DEFAULT_PROFILE, Arrays.asList("my-dataset-1.xml", "my-dataset-2.xml"));
Api.initialize(Api.getPropertiesFileName());
Api.setup(fileNames);
// ...execute function under test...
Api.verify(fileNames);
// ...or for asynchronous functionality:
Api.await(fileNames);
// ...possibly repeat setup and verify / await for other tests...
Api.shutdown();
-
Field Summary
FieldsFields inherited from interface Keywords
ACTUAL, ANY_TOKEN, ARRAY_ELEMENT_SEPARATOR, ARRAY_INTEGER, ARRAY_LONG, ARRAY_STRING, AUTO_INDEX_DIRECTORY, AUTO_TOKEN, BIGDECIMAL, BLOB, BOOLEAN, BYTE, BYTES, CLOB, COLUMN, COLUMNS, DATA_TYPE, DATABASE_CONNECTION_URL, DATABASE_DRIVER_CLASS_NAME, DATABASE_PASSWORD, DATABASE_SCHEMA, DATABASE_USER_NAME, DATE, DATE_TOKEN, DECIMAL_DIGITS, DEFAULT_AUTO_INDEX_DIRECTORY, DEFAULT_PROFILE, DEFAULT_PROPERTIES_FILE_NAME, DEFAULT_XSD_DIRECTORY, DIFFERENCES, DIFFERENT, DOUBLE, ENV_DATABASE_CONNECTION_URL, ENV_DATABASE_DRIVER_CLASS_NAME, ENV_DATABASE_PASSWORD, ENV_DATABASE_SCHEMA, ENV_DATABASE_USER_NAME, ENV_TIME_DIFFERENCE_LIMIT_MILLIS, EXPECTED, FIXED_NSTRING, FIXED_STRING, FLOAT, INTEGER, JDBC_DATA_TYPE, JSON, JSONB, LONG, MISSING, NCLOB, NOT_NULL, NSTRING, NULL_TOKEN, PARAMETERS, SHORT, SIZE, SQL, STRING, TABLE, TIME, TIME_DIFFERENCE_LIMIT_MILLIS, TIME_TOKEN, TIMESTAMP, TIMESTAMP_TOKEN, UNEXPECTED, UUID, VALUE, VARIABLE_PREFIX, XSD_DIRECTORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidVerify database after an asynchronous test.static voidensureInitialized(String propertiesFileName) Initialize Light Air if it is not initialized already.static voidShutdown Light Air to properly release resources, like DB connections, if it is not shutdown already.static voidGenerate XSD files from the database structure.static StringGet the file name of the main properties file.static voidinitialize(String propertiesFileName) Initialize Light Air.static voidRe-initialize already initialized Light Air.static voidReset the clock to be used for time-based data types processing to system time in the system default time zone.static voidSet the clock to be used for time-based data types processing.static voidsetFixedTime(ZonedDateTime fixedTime) Set a fixed time to be used for time-based data types processing.static voidSetup database.static voidshutdown()Shutdown previously initialized Light Air to properly release resources, like DB connections.static voidVerify database.
-
Field Details
-
PROPERTIES_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
LightAirApi
public LightAirApi()
-
-
Method Details
-
getPropertiesFileName
Get the file name of the main properties file.- Returns:
- file name
-
initialize
Initialize Light Air.NOTE: ALWAYS call
shutdown()after initialize() to properly release resources.- Parameters:
propertiesFileName- file name of the main Light Air properties
-
shutdown
public static void shutdown()Shutdown previously initialized Light Air to properly release resources, like DB connections. -
reInitialize
public static void reInitialize()Re-initialize already initialized Light Air.Reloads the properties file(s) and cleanly re-initializes Light Air.
-
ensureInitialized
Initialize Light Air if it is not initialized already.- Parameters:
propertiesFileName- file name of the main Light Air properties
-
ensureShutdown
public static void ensureShutdown()Shutdown Light Air to properly release resources, like DB connections, if it is not shutdown already. -
generateXsd
public static void generateXsd()Generate XSD files from the database structure. -
setup
-
verify
-
await
Verify database after an asynchronous test.Verifies the database repeatedly until either the result is successful or timeout has expired.
- Parameters:
fileNames- map of profile names to lists of names of verification dataset files for the profile
-
setClock
Set the clock to be used for time-based data types processing.- Parameters:
clock- Clock instance to be used
-
setFixedTime
Set a fixed time to be used for time-based data types processing.- Parameters:
fixedTime- Time to fix
-
resetClock
public static void resetClock()Reset the clock to be used for time-based data types processing to system time in the system default time zone.
-