Small cleanup and fixed tests
This commit is contained in:
parent
6a81f5de16
commit
55ceb0bf34
4 changed files with 6 additions and 13 deletions
|
|
@ -56,7 +56,6 @@ distributions {
|
||||||
main {
|
main {
|
||||||
contents {
|
contents {
|
||||||
from 'hal.conf.example'
|
from 'hal.conf.example'
|
||||||
from 'hal-default.db'
|
|
||||||
from 'logging.properties'
|
from 'logging.properties'
|
||||||
|
|
||||||
from "${buildDir}/resources"
|
from "${buildDir}/resources"
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ public class HalContext {
|
||||||
private static final Logger logger = LogUtil.getLogger();
|
private static final Logger logger = LogUtil.getLogger();
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
public static final String PROPERTY_DB_VERSION = "hal.db_version";
|
|
||||||
public static final String PROPERTY_HTTP_PORT = "hal.http_port";
|
public static final String PROPERTY_HTTP_PORT = "hal.http_port";
|
||||||
public static final String PROPERTY_MAP_BACKGROUND_IMAGE = "hal.map_bgimage";
|
public static final String PROPERTY_MAP_BACKGROUND_IMAGE = "hal.map_bgimage";
|
||||||
|
|
||||||
|
|
@ -41,9 +40,8 @@ public class HalContext {
|
||||||
|
|
||||||
public static final String RESOURCE_WEB_ROOT = HalContext.RESOURCE_ROOT + "/resource/web";
|
public static final String RESOURCE_WEB_ROOT = HalContext.RESOURCE_ROOT + "/resource/web";
|
||||||
|
|
||||||
private static final String CONF_FILE = "hal.conf";
|
private static final String CONF_FILE = "hal.conf";
|
||||||
static final String DB_FILE = "hal.db";
|
static final String DB_FILE = "hal.db";
|
||||||
private static final String DEFAULT_DB_FILE = HalContext.RESOURCE_ROOT + "/resource/hal-default.db";
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private static DBConnection db; // TODO: Should probably be a db pool as we have multiple threads accessing the DB
|
private static DBConnection db; // TODO: Should probably be a db pool as we have multiple threads accessing the DB
|
||||||
|
|
@ -70,17 +68,13 @@ public class HalContext {
|
||||||
logger.info("No hal.conf file found");
|
logger.info("No hal.conf file found");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileUtil.find(DEFAULT_DB_FILE) == null){
|
|
||||||
logger.severe("Unable to find default DB: " + DEFAULT_DB_FILE);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init DB
|
// Init DB
|
||||||
File dbFile = FileUtil.find(DB_FILE);
|
File dbFile = FileUtil.find(DB_FILE);
|
||||||
db = new DBConnection(DBConnection.DBMS.SQLite, DB_FILE);
|
db = new DBConnection(DBConnection.DBMS.SQLite, DB_FILE);
|
||||||
|
|
||||||
if (dbFile == null){
|
if (dbFile == null){
|
||||||
logger.info("No database file found, creating new DB...");
|
logger.severe("Unable to find Hal DB: " + DB_FILE);
|
||||||
|
System.exit(1);
|
||||||
} else {
|
} else {
|
||||||
dbConf = db.exec("SELECT * FROM conf", new PropertiesSQLResult());
|
dbConf = db.exec("SELECT * FROM conf", new PropertiesSQLResult());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import zutil.log.LogUtil;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
|
||||||
public class SensorDataAggregationDaemonTest {
|
public class SensorDataAggregationDaemonTest {
|
||||||
private static final String DEFAULT_DB_FILE = "resource/resource/hal-default.db";
|
private static final String DEFAULT_DB_FILE = "resource/resource/hal-core-reference.db";
|
||||||
|
|
||||||
private static DBConnection db;
|
private static DBConnection db;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import java.sql.SQLException;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DB upgrade class for Hal-Core
|
* The DB upgrade class for Hal-Zigbee plugin
|
||||||
*/
|
*/
|
||||||
public class ZigbeeHalDatabaseUpgrade extends HalDatabaseUpgrade {
|
public class ZigbeeHalDatabaseUpgrade extends HalDatabaseUpgrade {
|
||||||
private static final int REFERENCE_DB_VERSION = 1;
|
private static final int REFERENCE_DB_VERSION = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue