Update for default configs
Update to allow for default config properties if some are not specified with the start server and properties passed in. Updated the tests to match and also moved a few more things into the Constants.java file.
This commit is contained in:
@@ -22,7 +22,9 @@ import java.io.FileReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.eclipse.moquette.commons.Constants;
|
import org.eclipse.moquette.commons.Constants;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -42,11 +44,24 @@ class ConfigurationParser {
|
|||||||
private Properties m_properties = new Properties();
|
private Properties m_properties = new Properties();
|
||||||
|
|
||||||
ConfigurationParser() {
|
ConfigurationParser() {
|
||||||
|
createDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigurationParser(Properties properties) {
|
||||||
|
createDefaults();
|
||||||
|
for (Entry<Object, Object> entrySet : m_properties.entrySet()) {
|
||||||
|
if (properties.containsKey(entrySet.getKey())) {
|
||||||
|
entrySet.setValue(properties.get(entrySet.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createDefaults() {
|
||||||
m_properties.put("port", Integer.toString(Constants.PORT));
|
m_properties.put("port", Integer.toString(Constants.PORT));
|
||||||
m_properties.put("host", Constants.HOST);
|
m_properties.put("host", Constants.HOST);
|
||||||
m_properties.put("websocket_port", Integer.toString(Constants.WEBSOCKET_PORT));
|
m_properties.put("websocket_port", Integer.toString(Constants.WEBSOCKET_PORT));
|
||||||
m_properties.put("password_file", "");
|
m_properties.put("password_file", "");
|
||||||
m_properties.put("persistent_store", System.getProperty("user.home") + File.separator + "moquette_store.mapdb");
|
m_properties.put(Constants.PERSISTENT_STORE_PROPERTY_NAME, Constants.DEFAULT_PERSISTENT_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.eclipse.moquette.commons.Constants;
|
||||||
import org.eclipse.moquette.spi.impl.SimpleMessaging;
|
import org.eclipse.moquette.spi.impl.SimpleMessaging;
|
||||||
import org.eclipse.moquette.server.netty.NettyAcceptor;
|
import org.eclipse.moquette.server.netty.NettyAcceptor;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -33,6 +35,7 @@ public class Server {
|
|||||||
|
|
||||||
private ServerAcceptor m_acceptor;
|
private ServerAcceptor m_acceptor;
|
||||||
SimpleMessaging messaging;
|
SimpleMessaging messaging;
|
||||||
|
Properties m_properties;
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
final Server server = new Server();
|
final Server server = new Server();
|
||||||
@@ -68,26 +71,28 @@ public class Server {
|
|||||||
} catch (ParseException pex) {
|
} catch (ParseException pex) {
|
||||||
LOG.warn("An error occurred in parsing configuration, fallback on default configuration", pex);
|
LOG.warn("An error occurred in parsing configuration, fallback on default configuration", pex);
|
||||||
}
|
}
|
||||||
Properties configProps = confParser.getProperties();
|
m_properties = confParser.getProperties();
|
||||||
startServer(configProps);
|
startServer(m_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the server with the given properties.
|
* Starts the server with the given properties.
|
||||||
*
|
*
|
||||||
* Its need at least the following properties:
|
* Its suggested to at least have the following properties:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>port</li>
|
* <li>port</li>
|
||||||
* <li>password_file</li>
|
* <li>password_file</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public void startServer(Properties configProps) throws IOException {
|
public void startServer(Properties configProps) throws IOException {
|
||||||
LOG.info("Persistent store file: " + configProps.get("persistent_store"));
|
ConfigurationParser confParser = new ConfigurationParser(configProps);
|
||||||
|
m_properties = confParser.getProperties();
|
||||||
|
LOG.info("Persistent store file: " + m_properties.get(Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
messaging = SimpleMessaging.getInstance();
|
messaging = SimpleMessaging.getInstance();
|
||||||
messaging.init(configProps);
|
messaging.init(m_properties);
|
||||||
|
|
||||||
m_acceptor = new NettyAcceptor();
|
m_acceptor = new NettyAcceptor();
|
||||||
m_acceptor.initialize(messaging, configProps);
|
m_acceptor.initialize(messaging, m_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopServer() {
|
public void stopServer() {
|
||||||
@@ -96,4 +101,8 @@ public class Server {
|
|||||||
m_acceptor.close();
|
m_acceptor.close();
|
||||||
System.out.println("Server stopped");
|
System.out.println("Server stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Properties getProperties() {
|
||||||
|
return m_properties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,15 +45,10 @@ public class ServerIntegrationFuseTest {
|
|||||||
MQTT m_mqtt;
|
MQTT m_mqtt;
|
||||||
BlockingConnection m_subscriber;
|
BlockingConnection m_subscriber;
|
||||||
BlockingConnection m_publisher;
|
BlockingConnection m_publisher;
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
|
||||||
|
|
||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
properties = new Properties();
|
|
||||||
properties.put(PERSISTENT_STORE_PROPERTY_NAME, PERSISTENT_STORE_FILE_NAME);
|
|
||||||
m_server = new Server();
|
m_server = new Server();
|
||||||
m_server.startServer(properties);
|
m_server.startServer(new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -78,7 +73,7 @@ public class ServerIntegrationFuseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,9 @@ public class ServerIntegrationPahoTest {
|
|||||||
static MqttClientPersistence s_dataStore;
|
static MqttClientPersistence s_dataStore;
|
||||||
static MqttClientPersistence s_pubDataStore;
|
static MqttClientPersistence s_pubDataStore;
|
||||||
|
|
||||||
|
|
||||||
Server m_server;
|
Server m_server;
|
||||||
IMqttClient m_client;
|
IMqttClient m_client;
|
||||||
TestCallback m_callback;
|
TestCallback m_callback;
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTests() {
|
public static void beforeTests() {
|
||||||
@@ -50,16 +46,14 @@ public class ServerIntegrationPahoTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
properties = new Properties();
|
|
||||||
properties.put(PERSISTENT_STORE_PROPERTY_NAME, PERSISTENT_STORE_FILE_NAME);
|
|
||||||
m_server = new Server();
|
m_server = new Server();
|
||||||
m_server.startServer(properties);
|
m_server.startServer(new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
assertFalse(String.format("The DB storagefile %s already exists", properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME)), dbFile.exists());
|
assertFalse(String.format("The DB storagefile %s already exists", m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME)), dbFile.exists());
|
||||||
|
|
||||||
startServer();
|
startServer();
|
||||||
|
|
||||||
@@ -75,7 +69,7 @@ public class ServerIntegrationPahoTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-8
@@ -51,10 +51,6 @@ public class ServerIntegrationQoSValidationTest {
|
|||||||
IMqttClient m_publisher;
|
IMqttClient m_publisher;
|
||||||
TestCallback m_callback;
|
TestCallback m_callback;
|
||||||
|
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTests() {
|
public static void beforeTests() {
|
||||||
String tmpDir = System.getProperty("java.io.tmpdir");
|
String tmpDir = System.getProperty("java.io.tmpdir");
|
||||||
@@ -63,10 +59,8 @@ public class ServerIntegrationQoSValidationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
properties = new Properties();
|
|
||||||
properties.put(PERSISTENT_STORE_PROPERTY_NAME, PERSISTENT_STORE_FILE_NAME);
|
|
||||||
m_server = new Server();
|
m_server = new Server();
|
||||||
m_server.startServer(properties);
|
m_server.startServer(new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -95,7 +89,7 @@ public class ServerIntegrationQoSValidationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,10 +61,6 @@ public class ServerIntegrationSSLTest {
|
|||||||
IMqttClient m_client;
|
IMqttClient m_client;
|
||||||
TestCallback m_callback;
|
TestCallback m_callback;
|
||||||
|
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTests() {
|
public static void beforeTests() {
|
||||||
String tmpDir = System.getProperty("java.io.tmpdir");
|
String tmpDir = System.getProperty("java.io.tmpdir");
|
||||||
@@ -74,16 +70,14 @@ public class ServerIntegrationSSLTest {
|
|||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
String file = getClass().getResource("/").getPath();
|
String file = getClass().getResource("/").getPath();
|
||||||
System.setProperty("moquette.path", file);
|
System.setProperty("moquette.path", file);
|
||||||
properties = new Properties();
|
|
||||||
properties.put(PERSISTENT_STORE_PROPERTY_NAME, PERSISTENT_STORE_FILE_NAME);
|
|
||||||
m_server = new Server();
|
m_server = new Server();
|
||||||
m_server.startServer(properties);
|
m_server.startServer(new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
assertFalse(String.format("The DB storagefile %s already exists", properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME)), dbFile.exists());
|
assertFalse(String.format("The DB storagefile %s already exists", m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME)), dbFile.exists());
|
||||||
|
|
||||||
startServer();
|
startServer();
|
||||||
|
|
||||||
@@ -101,7 +95,7 @@ public class ServerIntegrationSSLTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-8
@@ -45,15 +45,9 @@ public class ServerIntegrationWebSocketTest {
|
|||||||
Server m_server;
|
Server m_server;
|
||||||
WebSocketClient client;
|
WebSocketClient client;
|
||||||
|
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
|
||||||
|
|
||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
properties = new Properties();
|
|
||||||
properties.put(PERSISTENT_STORE_PROPERTY_NAME, PERSISTENT_STORE_FILE_NAME);
|
|
||||||
m_server = new Server();
|
m_server = new Server();
|
||||||
m_server.startServer(properties);
|
m_server.startServer(new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -67,7 +61,7 @@ public class ServerIntegrationWebSocketTest {
|
|||||||
client.stop();
|
client.stop();
|
||||||
|
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-8
@@ -51,15 +51,9 @@ public class ServerLowlevelMessagesIntegrationTests {
|
|||||||
Client m_client;
|
Client m_client;
|
||||||
MQTT m_subscriberDef;
|
MQTT m_subscriberDef;
|
||||||
|
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
|
||||||
|
|
||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
properties = new Properties();
|
|
||||||
properties.put(PERSISTENT_STORE_PROPERTY_NAME, PERSISTENT_STORE_FILE_NAME);
|
|
||||||
m_server = new Server();
|
m_server = new Server();
|
||||||
m_server.startServer(properties);
|
m_server.startServer(new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -78,7 +72,7 @@ public class ServerLowlevelMessagesIntegrationTests {
|
|||||||
Thread.sleep(300); //to let the close event pass before server stop event
|
Thread.sleep(300); //to let the close event pass before server stop event
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
LOG.debug("After asked server to stop");
|
LOG.debug("After asked server to stop");
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ServerRestartIntegrationTest {
|
|||||||
BlockingConnection m_publisher;
|
BlockingConnection m_publisher;
|
||||||
Properties properties;
|
Properties properties;
|
||||||
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
private final static String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store";
|
||||||
private final static String PERSISTENT_STORE_FILE_NAME = "store.mapdb";
|
private final static String PERSISTENT_STORE_FILE_NAME = System.getProperty("user.home") + File.separator + "moquette_store.mapdb";
|
||||||
|
|
||||||
protected void startServer() throws IOException {
|
protected void startServer() throws IOException {
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
@@ -73,7 +73,7 @@ public class ServerRestartIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ public class ServerRestartIntegrationTest {
|
|||||||
|
|
||||||
//shutdown the server
|
//shutdown the server
|
||||||
m_server.stopServer();
|
m_server.stopServer();
|
||||||
File dbFile = new File(properties.getProperty(PERSISTENT_STORE_PROPERTY_NAME));
|
File dbFile = new File(m_server.getProperties().getProperty(org.eclipse.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ package org.eclipse.moquette.spi.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.moquette.spi.impl.subscriptions.Subscription;
|
import org.eclipse.moquette.spi.impl.subscriptions.Subscription;
|
||||||
import org.eclipse.moquette.spi.persistence.MapDBPersistentStore;
|
import org.eclipse.moquette.spi.persistence.MapDBPersistentStore;
|
||||||
import org.eclipse.moquette.proto.messages.AbstractMessage;
|
import org.eclipse.moquette.proto.messages.AbstractMessage;
|
||||||
@@ -36,16 +34,14 @@ import org.junit.Before;
|
|||||||
public class MapDBPersistentStoreTest {
|
public class MapDBPersistentStoreTest {
|
||||||
|
|
||||||
MapDBPersistentStore m_storageService;
|
MapDBPersistentStore m_storageService;
|
||||||
Properties properties;
|
|
||||||
private final static String PERSISTENT_STORE_PATH = System.getProperty("user.home") + File.separator + "moquette_store.mapdb";
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
File dbFile = new File(PERSISTENT_STORE_PATH);
|
File dbFile = new File(org.eclipse.moquette.commons.Constants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME);
|
||||||
assertFalse(String.format("The DB storagefile %s already exists", PERSISTENT_STORE_PATH), dbFile.exists());
|
assertFalse(String.format("The DB storagefile %s already exists", org.eclipse.moquette.commons.Constants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME), dbFile.exists());
|
||||||
|
|
||||||
m_storageService = new MapDBPersistentStore(PERSISTENT_STORE_PATH);
|
m_storageService = new MapDBPersistentStore(org.eclipse.moquette.commons.Constants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME);
|
||||||
m_storageService.initStore();
|
m_storageService.initStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +51,7 @@ public class MapDBPersistentStoreTest {
|
|||||||
m_storageService.close();
|
m_storageService.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
File dbFile = new File(PERSISTENT_STORE_PATH);
|
File dbFile = new File(org.eclipse.moquette.commons.Constants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME);
|
||||||
if (dbFile.exists()) {
|
if (dbFile.exists()) {
|
||||||
dbFile.delete();
|
dbFile.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.moquette.commons;
|
package org.eclipse.moquette.commons;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains some useful constants.
|
* Contains some useful constants.
|
||||||
*/
|
*/
|
||||||
@@ -23,4 +25,7 @@ public class Constants {
|
|||||||
public static final int WEBSOCKET_PORT = 8080;
|
public static final int WEBSOCKET_PORT = 8080;
|
||||||
public static final String HOST = "0.0.0.0";
|
public static final String HOST = "0.0.0.0";
|
||||||
public static final int DEFAULT_CONNECT_TIMEOUT = 10;
|
public static final int DEFAULT_CONNECT_TIMEOUT = 10;
|
||||||
|
public static final String DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME = "moquette_store.mapdb";
|
||||||
|
public static final String DEFAULT_PERSISTENT_PATH = System.getProperty("user.home") + File.separator + DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME;
|
||||||
|
public static final String PERSISTENT_STORE_PROPERTY_NAME = "persistence_store";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user