mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-12 10:15:49 +00:00
Make sure unit test use a different lists directory, and delete it before and after each test.
This commit is contained in:
parent
0db681eeda
commit
4b8bcd265b
@ -1,5 +1,6 @@
|
|||||||
package org.qortal.test.arbitrary;
|
package org.qortal.test.arbitrary;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -22,6 +23,7 @@ import org.qortal.test.common.TransactionUtils;
|
|||||||
import org.qortal.test.common.transaction.TestTransaction;
|
import org.qortal.test.common.transaction.TestTransaction;
|
||||||
import org.qortal.utils.Base58;
|
import org.qortal.utils.Base58;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
@ -32,11 +34,13 @@ public class ArbitraryDataStoragePolicyTests extends Common {
|
|||||||
@Before
|
@Before
|
||||||
public void beforeTest() throws DataException {
|
public void beforeTest() throws DataException {
|
||||||
Common.useDefaultSettings();
|
Common.useDefaultSettings();
|
||||||
|
this.deleteListsDirectory();
|
||||||
ArbitraryDataStorageManager.getInstance().start();
|
ArbitraryDataStorageManager.getInstance().start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void afterTest() throws DataException {
|
public void afterTest() throws DataException {
|
||||||
|
this.deleteListsDirectory();
|
||||||
ArbitraryDataStorageManager.getInstance().shutdown();
|
ArbitraryDataStorageManager.getInstance().shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,4 +235,14 @@ public class ArbitraryDataStoragePolicyTests extends Common {
|
|||||||
return transactionData;
|
return transactionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteListsDirectory() {
|
||||||
|
// Delete lists directory if exists
|
||||||
|
Path listsPath = Paths.get(Settings.getInstance().getListsPath());
|
||||||
|
try {
|
||||||
|
FileUtils.deleteDirectory(listsPath.toFile());
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,6 @@
|
|||||||
"bootstrapFilenamePrefix": "test-",
|
"bootstrapFilenamePrefix": "test-",
|
||||||
"dataPath": "data-test",
|
"dataPath": "data-test",
|
||||||
"tempDataPath": "data-test/_temp",
|
"tempDataPath": "data-test/_temp",
|
||||||
|
"listsPath": "lists-test",
|
||||||
"storagePolicy": "FOLLOWED_AND_VIEWED"
|
"storagePolicy": "FOLLOWED_AND_VIEWED"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user