public class TUtilTestProperties extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TUtilTestProperties.DbConnectionInfo |
| Constructor and Description |
|---|
TUtilTestProperties() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assumeDatabase()
Callable from JUnit fixures, this will "ignore" a JUnit tests when the database
is unconfigured.
|
static boolean |
getBoolean(String propertyName,
boolean defaultValue)
Find boolean value stored in test.properties file based on property name.
|
static TUtilTestProperties.DbConnectionInfo |
getDbConn() |
static String |
getDbSID()
Returns the SID for the test database.
|
static String |
getDbString()
Get the database connection string.
|
static File |
getLogFile()
Returns the location for the JUnit test log file, or null if none is assigned.
|
static TestLogSink |
getLogSink() |
static TestLogSink |
getLogSinkIfLogging()
Get a log sink if logging is actually on.
|
static PrintWriter |
getLogWriter() |
static String |
getPropertiesLocation() |
static DataSource |
getRawDataSource()
Returns a raw, unaltered datasource to the ViewPoint test database.
|
static String |
getString(String propertyName,
String defaultValue)
Find string value stored in test.properties file based on property name.
|
static TestProperties |
getTestProperties() |
static String |
getViewpointLoginName()
This returns the ViewPoint user name to use as the 'current user' when database
related tests are running.
|
static boolean |
hasDbConfig()
Check if a database config is present.
|
static void |
initLocale()
Important for locale specifics in tests
By default all tests are written for Dutch locale
|
static void |
initLogging() |
static boolean |
isLogging() |
static Connection |
makeRawConnection() |
static void |
setCommitDisabled(boolean on)
When set to true, all connections allocated on the same thread will have the "disable commit"
flag set (see
ConnectionPool.setCommitDisabled(boolean). |
@Nonnull public static TestProperties getTestProperties()
public static String getPropertiesLocation()
public static boolean hasDbConfig()
public static String getDbString()
hasDbConfig() to check if a test database is configured
if the test needs to be conditional.public static final void assumeDatabase()
public static TUtilTestProperties.DbConnectionInfo getDbConn()
public static String getDbSID()
public static String getViewpointLoginName()
public static DataSource getRawDataSource()
public static void initLocale()
public static Connection makeRawConnection() throws Exception
Exceptionpublic static void setCommitDisabled(boolean on)
ConnectionPool.setCommitDisabled(boolean). This allows changes to a test database
without commiting those changes. The result of the test should be tested using the same database
connection as the one altering the data.on - public static void initLogging()
public static boolean isLogging()
@Nullable public static File getLogFile()
@Nullable public static PrintWriter getLogWriter()
@Nullable public static TestLogSink getLogSinkIfLogging()
public static TestLogSink getLogSink()
public static boolean getBoolean(@Nonnull String propertyName, boolean defaultValue)
propertyName - name of property requested from properties filedefaultValue - default value returned if property can't be found@Nullable public static String getString(@Nonnull String propertyName, @Nullable String defaultValue)
propertyName - name of property requested from properties filedefaultValue - default value returned if property can't be foundCopyright © 2017 etc.to. All rights reserved.