Throw an exception if the file handler can't read/write to the DB
This commit is contained in:
@@ -22,6 +22,7 @@ package testItems.sql;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.sql.repo.AbstractDhRepo;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
@@ -29,9 +30,9 @@ import java.util.Map;
|
||||
public class TestCompoundKeyRepo extends AbstractDhRepo<DhChunkPos, TestCompoundKeyDto>
|
||||
{
|
||||
|
||||
public TestCompoundKeyRepo(String databaseType, String databaseLocation) throws SQLException
|
||||
public TestCompoundKeyRepo(String databaseType, File databaseFile) throws SQLException
|
||||
{
|
||||
super(databaseType, databaseLocation, TestCompoundKeyDto.class);
|
||||
super(databaseType, databaseFile, TestCompoundKeyDto.class);
|
||||
|
||||
// note: this should only ever be done with the test repo.
|
||||
// All long term tables should be created using a sql Script.
|
||||
|
||||
@@ -21,6 +21,7 @@ package testItems.sql;
|
||||
|
||||
import com.seibel.distanthorizons.core.sql.repo.AbstractDhRepo;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
@@ -28,9 +29,9 @@ import java.util.Map;
|
||||
public class TestPrimaryKeyRepo extends AbstractDhRepo<Integer, TestSingleKeyDto>
|
||||
{
|
||||
|
||||
public TestPrimaryKeyRepo(String databaseType, String databaseLocation) throws SQLException
|
||||
public TestPrimaryKeyRepo(String databaseType, File databaseFile) throws SQLException
|
||||
{
|
||||
super(databaseType, databaseLocation, TestSingleKeyDto.class);
|
||||
super(databaseType, databaseFile, TestSingleKeyDto.class);
|
||||
|
||||
// note: this should only ever be done with the test repo.
|
||||
// All long term tables should be created using a sql Script.
|
||||
|
||||
@@ -259,7 +259,7 @@ public class CompressionTest
|
||||
File uncompressedDatabaseFile = new File(uncompressedDatabaseFilePath);
|
||||
Assert.assertTrue(uncompressedDatabaseFile.exists());
|
||||
|
||||
FullDataSourceV2Repo uncompressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", uncompressedDatabaseFilePath);
|
||||
FullDataSourceV2Repo uncompressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", uncompressedDatabaseFile);
|
||||
|
||||
|
||||
String compressedDatabaseFilePath = TEST_DIR + "/output/" + DB_FILE_NAME_PREFIX + "_" + compressorName + ".sqlite";
|
||||
@@ -267,7 +267,7 @@ public class CompressionTest
|
||||
compressedDatabaseFile.mkdirs();
|
||||
compressedDatabaseFile.delete();
|
||||
Assert.assertTrue(!compressedDatabaseFile.exists());
|
||||
FullDataSourceV2Repo compressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", compressedDatabaseFilePath);
|
||||
FullDataSourceV2Repo compressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", uncompressedDatabaseFile);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DhRepoSqliteTest
|
||||
TestPrimaryKeyRepo primaryKeyRepo = null;
|
||||
try
|
||||
{
|
||||
primaryKeyRepo = new TestPrimaryKeyRepo(DATABASE_TYPE, DB_FILE_NAME);
|
||||
primaryKeyRepo = new TestPrimaryKeyRepo(DATABASE_TYPE, new File(DB_FILE_NAME));
|
||||
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ public class DhRepoSqliteTest
|
||||
}
|
||||
|
||||
// check that the update scripts aren't run multiple times
|
||||
TestPrimaryKeyRepo altDataRepoOne = new TestPrimaryKeyRepo(DATABASE_TYPE, DB_FILE_NAME);
|
||||
TestPrimaryKeyRepo altDataRepoTwo = new TestPrimaryKeyRepo(DATABASE_TYPE, DB_FILE_NAME);
|
||||
TestPrimaryKeyRepo altDataRepoOne = new TestPrimaryKeyRepo(DATABASE_TYPE, new File(DB_FILE_NAME));
|
||||
TestPrimaryKeyRepo altDataRepoTwo = new TestPrimaryKeyRepo(DATABASE_TYPE, new File(DB_FILE_NAME));
|
||||
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ public class DhRepoSqliteTest
|
||||
TestCompoundKeyRepo compoundKeyRepo = null;
|
||||
try
|
||||
{
|
||||
compoundKeyRepo = new TestCompoundKeyRepo(DATABASE_TYPE, DB_FILE_NAME);
|
||||
compoundKeyRepo = new TestCompoundKeyRepo(DATABASE_TYPE, new File(DB_FILE_NAME));
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user