forked from Qortal/qortal
Added feature to allow repository to be kept intact after running certain tests
This commit is contained in:
parent
987446cf7f
commit
ba7b9f3ad8
@ -61,6 +61,7 @@ public class Common {
|
|||||||
|
|
||||||
|
|
||||||
public static final String testSettingsFilename = "test-settings-v2.json";
|
public static final String testSettingsFilename = "test-settings-v2.json";
|
||||||
|
public static boolean shouldRetainRepositoryAfterTest = false;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Load/check settings, which potentially sets up blockchain config, etc.
|
// Load/check settings, which potentially sets up blockchain config, etc.
|
||||||
@ -126,6 +127,7 @@ public class Common {
|
|||||||
|
|
||||||
public static void useSettings(String settingsFilename) throws DataException {
|
public static void useSettings(String settingsFilename) throws DataException {
|
||||||
Common.useSettingsAndDb(settingsFilename, true);
|
Common.useSettingsAndDb(settingsFilename, true);
|
||||||
|
setShouldRetainRepositoryAfterTest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void useDefaultSettings() throws DataException {
|
public static void useDefaultSettings() throws DataException {
|
||||||
@ -207,7 +209,16 @@ public class Common {
|
|||||||
RepositoryManager.setRepositoryFactory(repositoryFactory);
|
RepositoryManager.setRepositoryFactory(repositoryFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setShouldRetainRepositoryAfterTest(boolean shouldRetain) {
|
||||||
|
shouldRetainRepositoryAfterTest = shouldRetain;
|
||||||
|
}
|
||||||
|
|
||||||
public static void deleteTestRepository() throws DataException {
|
public static void deleteTestRepository() throws DataException {
|
||||||
|
if (shouldRetainRepositoryAfterTest) {
|
||||||
|
// Don't delete if we've requested to keep the db intact
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Delete repository directory if exists
|
// Delete repository directory if exists
|
||||||
Path repositoryPath = Paths.get(Settings.getInstance().getRepositoryPath());
|
Path repositoryPath = Paths.get(Settings.getInstance().getRepositoryPath());
|
||||||
try {
|
try {
|
||||||
|
@ -509,6 +509,7 @@ public class IntegrityTests extends Common {
|
|||||||
@Ignore("Checks 'live' repository")
|
@Ignore("Checks 'live' repository")
|
||||||
@Test
|
@Test
|
||||||
public void testRepository() throws DataException {
|
public void testRepository() throws DataException {
|
||||||
|
Common.setShouldRetainRepositoryAfterTest(true);
|
||||||
Settings.fileInstance("settings.json"); // use 'live' settings
|
Settings.fileInstance("settings.json"); // use 'live' settings
|
||||||
|
|
||||||
String repositoryUrlTemplate = "jdbc:hsqldb:file:%s" + File.separator + "blockchain;create=false;hsqldb.full_log_replay=true";
|
String repositoryUrlTemplate = "jdbc:hsqldb:file:%s" + File.separator + "blockchain;create=false;hsqldb.full_log_replay=true";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user