Minor change, moved const definition from Constants inside parser-commons to BrokerConstants inside broker project

This commit is contained in:
andsel
2015-12-08 14:04:35 +01:00
parent f41f7dafb9
commit 8c88567c78
16 changed files with 113 additions and 91 deletions
@@ -15,15 +15,13 @@
*/
package io.moquette.server;
import io.moquette.commons.Constants;
import io.moquette.BrokerConstants;
import io.moquette.server.config.IConfig;
import io.moquette.server.config.MemoryConfig;
import io.moquette.spi.impl.security.IAuthenticator;
import io.moquette.spi.impl.security.IAuthorizator;
import org.junit.After;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -49,7 +47,7 @@ public class ConfigurationClassLoaderTest implements IAuthenticator, IAuthorizat
@After
public void tearDown() throws Exception {
m_server.stopServer();
File dbFile = new File(m_config.getProperty(io.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME));
File dbFile = new File(m_config.getProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME));
if (dbFile.exists()) {
dbFile.delete();
}
@@ -58,7 +56,7 @@ public class ConfigurationClassLoaderTest implements IAuthenticator, IAuthorizat
@Test
public void loadAuthenticator() throws Exception {
Properties props = new Properties(IntegrationUtils.prepareTestPropeties());
props.setProperty(Constants.AUTHENTICATOR_CLASS_NAME, "io.moquette.server.ConfigurationClassLoaderTest");
props.setProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME, "io.moquette.server.ConfigurationClassLoaderTest");
startServer(props);
assertTrue(true);
m_server.stopServer();
@@ -67,7 +65,7 @@ public class ConfigurationClassLoaderTest implements IAuthenticator, IAuthorizat
@Test
public void loadAuthorizator() throws Exception {
Properties props = new Properties(IntegrationUtils.prepareTestPropeties());
props.setProperty(Constants.AUTHORIZATOR_CLASS_NAME, "io.moquette.server.ConfigurationClassLoaderTest");
props.setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME, "io.moquette.server.ConfigurationClassLoaderTest");
startServer(props);
assertTrue(true);
m_server.stopServer();
@@ -20,8 +20,8 @@ import io.moquette.server.config.IConfig;
import java.io.File;
import java.util.Properties;
import static io.moquette.commons.Constants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME;
import static io.moquette.commons.Constants.PERSISTENT_STORE_PROPERTY_NAME;
import static io.moquette.BrokerConstants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME;
import static io.moquette.BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME;
import static org.junit.Assert.assertFalse;
/**
@@ -34,7 +34,7 @@ import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import io.moquette.commons.Constants;
import io.moquette.BrokerConstants;
import org.eclipse.paho.client.mqttv3.IMqttClient;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
@@ -75,11 +75,11 @@ public class ServerIntegrationSSLTest {
m_server = new Server();
Properties sslProps = new Properties();
sslProps.put(io.moquette.commons.Constants.SSL_PORT_PROPERTY_NAME, "8883");
sslProps.put(Constants.JKS_PATH_PROPERTY_NAME, "serverkeystore.jks");
sslProps.put(Constants.KEY_STORE_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
sslProps.put(Constants.KEY_MANAGER_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
sslProps.put(Constants.PERSISTENT_STORE_PROPERTY_NAME, IntegrationUtils.localMapDBPath());
sslProps.put(BrokerConstants.SSL_PORT_PROPERTY_NAME, "8883");
sslProps.put(BrokerConstants.JKS_PATH_PROPERTY_NAME, "serverkeystore.jks");
sslProps.put(BrokerConstants.KEY_STORE_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
sslProps.put(BrokerConstants.KEY_MANAGER_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
sslProps.put(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME, IntegrationUtils.localMapDBPath());
m_server.startServer(sslProps);
}
@@ -15,6 +15,7 @@
*/
package io.moquette.server;
import io.moquette.BrokerConstants;
import io.moquette.server.config.MemoryConfig;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
@@ -69,7 +70,7 @@ public class ServerIntegrationWebSocketTest {
@Test
public void checkPlainConnect() throws Exception {
LOG.info("*** checkPlainConnect ***");
String destUri = "ws://localhost:" + io.moquette.commons.Constants.WEBSOCKET_PORT;
String destUri = "ws://localhost:" + BrokerConstants.WEBSOCKET_PORT;
MQTTWebSocket socket = new MQTTWebSocket();
client.start();
@@ -15,7 +15,7 @@
*/
package io.moquette.server.config;
import io.moquette.commons.Constants;
import io.moquette.BrokerConstants;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -101,7 +101,7 @@ public class ConfigurationParserTest {
* Helper method to verify default options.
*/
private void verifyDefaults(Properties props) {
Assert.assertEquals(Constants.PORT, Integer.parseInt(props.getProperty("port")));
Assert.assertEquals(Constants.HOST, props.getProperty("host"));
Assert.assertEquals(BrokerConstants.PORT, Integer.parseInt(props.getProperty("port")));
Assert.assertEquals(BrokerConstants.HOST, props.getProperty("host"));
}
}
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import io.moquette.commons.Constants;
import io.moquette.BrokerConstants;
import io.moquette.server.Server;
import io.moquette.testclient.RawClient;
import org.junit.After;
@@ -52,9 +52,9 @@ public class ConnectionIT {
public void tearDown() throws Exception {
m_server.stopServer();
File dbFile = new File(Constants.DEFAULT_PERSISTENT_PATH);
File dbFile = new File(BrokerConstants.DEFAULT_PERSISTENT_PATH);
if (dbFile.exists()) {
assertTrue("Error deleting the moquette db file " + Constants.DEFAULT_PERSISTENT_PATH, dbFile.delete());
assertTrue("Error deleting the moquette db file " + BrokerConstants.DEFAULT_PERSISTENT_PATH, dbFile.delete());
}
assertFalse(dbFile.exists());
}
@@ -15,8 +15,7 @@
*/
package io.moquette.spi.persistence;
import io.moquette.commons.Constants;
import static io.moquette.commons.Constants.*;
import io.moquette.BrokerConstants;
import io.moquette.server.IntegrationUtils;
import io.moquette.server.config.IConfig;
import io.moquette.server.config.MemoryConfig;
@@ -48,9 +47,9 @@ public class MapDBPersistentStoreTest {
@Before
public void setUp() throws Exception {
IntegrationUtils.cleanPersistenceFile(Constants.DEFAULT_PERSISTENT_PATH);
IntegrationUtils.cleanPersistenceFile(BrokerConstants.DEFAULT_PERSISTENT_PATH);
Properties props = new Properties();
props.setProperty(PERSISTENT_STORE_PROPERTY_NAME, DEFAULT_PERSISTENT_PATH);
props.setProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME, BrokerConstants.DEFAULT_PERSISTENT_PATH);
IConfig conf = new MemoryConfig(props);
m_storageService = new MapDBPersistentStore(conf);
m_storageService.initStore();
@@ -64,7 +63,7 @@ public class MapDBPersistentStoreTest {
m_storageService.close();
}
IntegrationUtils.cleanPersistenceFile(Constants.DEFAULT_PERSISTENT_PATH);
IntegrationUtils.cleanPersistenceFile(BrokerConstants.DEFAULT_PERSISTENT_PATH);
}
@Test
@@ -15,7 +15,7 @@
*/
package io.moquette.testclient;
import io.moquette.commons.Constants;
import io.moquette.BrokerConstants;
import io.moquette.parser.netty.MQTTDecoder;
import io.moquette.parser.netty.MQTTEncoder;
import io.netty.bootstrap.Bootstrap;
@@ -50,7 +50,7 @@ public class Client {
private boolean m_connectionLost = false;
public Client(String host) {
this(host, Constants.PORT);
this(host, BrokerConstants.PORT);
}
public Client(String host, int port) {