public class TopiaDatabase
extends org.junit.rules.TestWatcher
public class MyTest {
\@Rule
public final TopiaDatabase db = new TopiaDatabase();
\@Test
public void testMethod() throws TopiaException {
TopiaContext tx = db.beginTransaction();
...
}
The db created will be unique for each test method (and for each build also).
You don't need to close any transaction, it will be done for you and the end
of each method test.| Modifier and Type | Field and Description |
|---|---|
static String |
TIMESTAMP
A time-stamp, allow to make multiple build and keep the tests data.
|
| Constructor and Description |
|---|
TopiaDatabase() |
TopiaDatabase(String configurationPath) |
| Modifier and Type | Method and Description |
|---|---|
TopiaContext |
beginTransaction() |
void |
finished(org.junit.runner.Description description) |
Properties |
getDbConfiguration() |
TopiaContext |
getRootCtxt() |
File |
getTestBasedir() |
static File |
getTestSpecificDirectory(Class<?> testClassName,
String methodName) |
protected void |
onDbConfigurationCreate(Properties configuration,
File testDir,
String dbPath) |
protected void |
starting(org.junit.runner.Description description) |
public static final String TIMESTAMP
public TopiaDatabase()
public TopiaDatabase(String configurationPath)
protected void starting(org.junit.runner.Description description)
starting in class org.junit.rules.TestWatcherpublic void finished(org.junit.runner.Description description)
finished in class org.junit.rules.TestWatcherpublic File getTestBasedir()
public TopiaContext getRootCtxt()
public Properties getDbConfiguration()
public TopiaContext beginTransaction()
throws TopiaException
TopiaExceptionprotected void onDbConfigurationCreate(Properties configuration, File testDir, String dbPath)
Copyright © 2004–2014 CodeLutin. All rights reserved.