public abstract class DatabaseResource extends Object implements TestRule
Modifier and Type | Field and Description |
---|---|
protected String |
beanFactoryReferenceLocation |
protected String |
beanRefFactoryReferenceId |
static String |
BUILD_ENVIRONMENT_DEFAULT |
static long |
BUILD_TIMESTAMP |
static String |
HSQLDB_SRC_DATABASE_CREATE_SCRIPT |
static String |
HSQLDB_SRC_DATABASE_DIRECTORY |
protected static Log |
log
Logger.
|
protected Class<?> |
testClass |
protected Set<File> |
toDestroy |
Modifier | Constructor and Description |
---|---|
protected |
DatabaseResource(String configName,
String beanFactoryReferenceLocation,
String beanRefFactoryReferenceId,
boolean writeDb) |
Modifier and Type | Method and Description |
---|---|
void |
addToDestroy(File dir) |
protected void |
after(Description description) |
Statement |
apply(Statement base,
Description description) |
protected void |
before(Description description) |
void |
copyDb(File sourceDirectory,
File targetDirectory,
boolean readonly,
Properties p,
boolean destroyAfterTest) |
void |
copyDb(File sourceDirectory,
String targetDbDirectoryName,
boolean readonly,
Properties p) |
Connection |
createEmptyDb(File directory,
String dbName) |
Connection |
createEmptyDb(File directory,
String dbName,
Properties p) |
Connection |
createEmptyDb(String dbDirectory,
String dbName) |
Connection |
createEmptyDb(String dbDirectory,
String dbName,
Properties p) |
String |
getBuildEnvironment() |
protected String |
getBuildEnvironment(String defaultEnvironement) |
protected String[] |
getConfigArgs() |
protected abstract String |
getConfigFilesPrefix()
Return configuration files prefix (i.e.
|
protected String |
getI18nBundleName() |
protected List<String> |
getImportScriptSql(File scriptFile) |
File |
getResourceDirectory() |
File |
getResourceDirectory(String name) |
static File |
getTestSpecificDirectory(Class<?> testClass,
String name) |
protected void |
initConfiguration(String configFilename)
Convenience methods that could be override to initialize other configuration
|
protected void |
initI18n() |
protected boolean |
isWriteDb() |
void |
setProperty(File file,
String key,
String value) |
protected static final Log log
public static final String BUILD_ENVIRONMENT_DEFAULT
public static final String HSQLDB_SRC_DATABASE_DIRECTORY
public static final String HSQLDB_SRC_DATABASE_CREATE_SCRIPT
public static long BUILD_TIMESTAMP
protected final String beanFactoryReferenceLocation
protected final String beanRefFactoryReferenceId
protected DatabaseResource(String configName, String beanFactoryReferenceLocation, String beanRefFactoryReferenceId, boolean writeDb)
protected abstract String getConfigFilesPrefix()
public File getResourceDirectory(String name)
public File getResourceDirectory()
protected boolean isWriteDb()
public Statement apply(Statement base, Description description)
apply
in interface TestRule
public void addToDestroy(File dir)
public void setProperty(File file, String key, String value) throws IOException
IOException
public void copyDb(File sourceDirectory, String targetDbDirectoryName, boolean readonly, Properties p) throws IOException
IOException
public void copyDb(File sourceDirectory, File targetDirectory, boolean readonly, Properties p, boolean destroyAfterTest) throws IOException
IOException
protected void after(Description description) throws IOException
IOException
public Connection createEmptyDb(String dbDirectory, String dbName) throws IOException, SQLException
IOException
SQLException
public Connection createEmptyDb(String dbDirectory, String dbName, Properties p) throws IOException, SQLException
IOException
SQLException
public static File getTestSpecificDirectory(Class<?> testClass, String name) throws IOException
IOException
public Connection createEmptyDb(File directory, String dbName) throws SQLException, IOException
SQLException
IOException
public Connection createEmptyDb(File directory, String dbName, Properties p) throws SQLException, IOException
SQLException
IOException
protected List<String> getImportScriptSql(File scriptFile) throws IOException
IOException
public String getBuildEnvironment()
protected String getBuildEnvironment(String defaultEnvironement)
protected String[] getConfigArgs()
protected void initConfiguration(String configFilename)
configFilename
- configArgs
- protected void initI18n() throws IOException
IOException
protected String getI18nBundleName()
Copyright © 2012–2014 IFREMER. All rights reserved.