forked from Qortal/qortal
e9d8b3e6e3
NB: we're still using HSQLDB svn r5836 Updated README.md Added log4j2.properties file for logging! Imported CIYAM-AT jar into project-local Maven repo CIYAM-AT related: ATData ATStateData ATTransactionData DeployATTransactionData AT DeployATTransaction ATRepository HSQLDBATRepository HSQLDBDeployATTransactionRepository ATTests DeployATTransactionTransformer Fixed Block so correct block hash and timestamps are generated, especially when previous/next block versions differ. Added extra call in BlockTransformer to aid this. Fixed GenesisTransaction.isValid's incorrect amount test. Fixed comments in TransferAssetTransaction and incorrect use of BlockChain.getVotingReleaseTimestamp() instead of BlockChain.getAssetsReleaseTimestamp(). Added new TYPEs to HSQLDBDatabaseUpdates, and set LOB granularity to 1KB for AT use. Added AT_address column to DeployATTransactions in HSQLDB. Added ATs, ATStates and ATTransactions tables. (You will need to discard existing database and rebuild). Fixed incorrect byte array output in IssueAssetTransactionTransformer, where Asset "references" were not processed correctly. Added support for BigDecimal serialization to a byte-array size other than the standard 8.
58 lines
1.3 KiB
Java
58 lines
1.3 KiB
Java
package test;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
import org.junit.Test;
|
|
|
|
import repository.DataException;
|
|
import repository.Repository;
|
|
import repository.RepositoryManager;
|
|
|
|
public class RepositoryTests extends Common {
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger(RepositoryTests.class);
|
|
|
|
@Test
|
|
public void testGetRepository() throws DataException {
|
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
|
assertNotNull(repository);
|
|
}
|
|
}
|
|
|
|
@Test
|
|
public void testMultipleInstances() throws DataException {
|
|
int n_instances = 5;
|
|
Repository[] repositories = new Repository[n_instances];
|
|
|
|
for (int i = 0; i < n_instances; ++i) {
|
|
repositories[i] = RepositoryManager.getRepository();
|
|
assertNotNull(repositories[i]);
|
|
}
|
|
|
|
for (int i = 0; i < n_instances; ++i) {
|
|
repositories[i].close();
|
|
repositories[i] = null;
|
|
}
|
|
}
|
|
|
|
@Test
|
|
public void testAccessAfterClose() throws DataException {
|
|
try (Repository repository = RepositoryManager.getRepository()) {
|
|
assertNotNull(repository);
|
|
|
|
repository.close();
|
|
|
|
try {
|
|
repository.discardChanges();
|
|
fail();
|
|
} catch (NullPointerException | DataException e) {
|
|
}
|
|
|
|
LOGGER.warn("Expect \"repository already closed\" complaint below");
|
|
}
|
|
}
|
|
|
|
}
|