initial upgrade of h2

This commit is contained in:
Jeremy Long
2017-08-07 18:37:03 -04:00
parent b44862f713
commit 9fd8f1c898
11 changed files with 22 additions and 16 deletions

View File

@@ -16,14 +16,14 @@ engine.version.url=https://jeremylong.github.io/DependencyCheck/current.txt
# below contains a %s then the data.directory will replace the %s.
data.directory=[JAR]/data
#if the filename has a %s it will be replaced with the current expected version
data.file_name=dc.h2.db
data.file_name=odc.h2.db
### if you increment the DB version then you must increment the database file path
### in the mojo.properties, task.properties (maven and ant respectively), and
### the gradle PurgeDataExtension.
data.version=3.0
data.connection_string=jdbc:h2:file:%s;FILE_LOCK=SERIALIZED;AUTOCOMMIT=ON;
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
# user name and password for the database connection. The inherent case is to use H2.

View File

@@ -48,7 +48,7 @@ public abstract class BaseDBTestCase extends BaseTest {
}
public static void ensureDBExists() throws Exception {
File f = new File("./target/data/dc.h2.db");
File f = new File("./target/data/odc.h2.db");
if (f.exists() && f.isFile() && f.length() < 71680) {
f.delete();
}
@@ -70,9 +70,10 @@ public abstract class BaseDBTestCase extends BaseTest {
d.mkdir();
continue;
}
File o = new File(dataPath, entry.getName());
o.createNewFile();
try (FileOutputStream fos = new FileOutputStream(o, false);
//File o = new File(dataPath, entry.getName());
//o.createNewFile();
dataFile.createNewFile();
try (FileOutputStream fos = new FileOutputStream(dataFile, false);
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
IOUtils.copy(zin, dest);
} catch (Throwable ex) {

View File

@@ -37,7 +37,7 @@ public class BaseTest {
@AfterClass
public static void tearDownClass() throws Exception {
File f = new File("./target/data/dc.h2.db");
File f = new File("./target/data/odc.h2.db");
if (f.exists() && f.isFile() && f.length() < 71680) {
System.err.println("------------------------------------------------");
System.err.println("------------------------------------------------");

View File

@@ -116,6 +116,11 @@ public class EngineModeIT extends BaseTest {
assertThat(Files.exists(directory), is(true));
assertThat(Files.isDirectory(directory), is(true));
Path database = directory.resolve(Settings.getString(Settings.KEYS.DB_FILE_NAME));
System.err.println(database.toString());
for (String f : directory.toFile().list()) {
System.err.println(f);
}
assertThat(Files.exists(database), is(exists));
}
}

View File

@@ -16,9 +16,9 @@ engine.version.url=https://jeremylong.github.io/DependencyCheck/current.txt
# below contains a %s then the data.directory will replace the %s.
data.directory=[JAR]/data
#if the filename has a %s it will be replaced with the current expected version
data.file_name=dc.h2.db
data.file_name=odc.h2.db
data.version=3.0
data.connection_string=jdbc:h2:file:%s;FILE_LOCK=SERIALIZED;AUTOCOMMIT=ON;
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
# user name and password for the database connection. The inherent case is to use H2.