mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 00:03:43 +01:00
initial upgrade of h2
This commit is contained in:
@@ -106,7 +106,7 @@ public class Purge extends Task {
|
||||
populateSettings();
|
||||
File db;
|
||||
try {
|
||||
db = new File(Settings.getDataDirectory(), "dc.h2.db");
|
||||
db = new File(Settings.getDataDirectory(), "odc.h2.db");
|
||||
if (db.exists()) {
|
||||
if (db.delete()) {
|
||||
log("Database file purged; local copy of the NVD has been removed", Project.MSG_INFO);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class App {
|
||||
}
|
||||
File db;
|
||||
try {
|
||||
db = new File(Settings.getDataDirectory(), "dc.h2.db");
|
||||
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.h2.db"));
|
||||
if (db.exists()) {
|
||||
if (db.delete()) {
|
||||
LOGGER.info("Database file purged; local copy of the NVD has been removed");
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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("------------------------------------------------");
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PurgeMojo extends BaseDependencyCheckMojo {
|
||||
populateSettings();
|
||||
File db;
|
||||
try {
|
||||
db = new File(Settings.getDataDirectory(), "dc.h2.db");
|
||||
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.h2.db"));
|
||||
if (db.exists()) {
|
||||
if (db.delete()) {
|
||||
getLog().info("Database file purged; local copy of the NVD has been removed");
|
||||
|
||||
@@ -1010,7 +1010,7 @@ public final class Settings {
|
||||
// yes, for H2 this path won't actually exists - but this is sufficient to get the value needed
|
||||
final File dbFile = new File(directory, fileName);
|
||||
final String cString = String.format(connStr, dbFile.getCanonicalPath());
|
||||
LOGGER.debug("Connection String: '{}'", cString);
|
||||
LOGGER.error("Connection String: '{}'", cString);
|
||||
return cString;
|
||||
}
|
||||
return connStr;
|
||||
|
||||
@@ -15,9 +15,9 @@ engine.version.url=http://jeremylong.github.io/DependencyCheck/current.txt
|
||||
# will not be used. The data.directory will be resolved and if the connection string
|
||||
# below contains a %s then the data.directory will replace the %s.
|
||||
data.directory=[JAR]/data
|
||||
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:h2:file:%s;AUTO_SERVER=TRUE;AUTOCOMMIT=ON;
|
||||
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
||||
|
||||
|
||||
Reference in New Issue
Block a user