editorconfig: max line length set
max line length warnings removed missing Copyright added useless publics removed unmaintainable Javadoc tags: @author removed helper class warnings removed field default value initialization removed Multiple warnings removed pref: checkstyle warnings removed Checkstyle will fail the build process if it detects violations switch default cases error logger added
This commit is contained in:
@@ -20,17 +20,10 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.handler.codec.CorruptedFrameException;
|
||||
import io.netty.handler.codec.mqtt.MqttMessage;
|
||||
import io.netty.util.Attribute;
|
||||
import io.netty.util.AttributeKey;
|
||||
import io.netty.util.AttributeMap;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class Utils {
|
||||
public final class Utils {
|
||||
|
||||
public static final int MAX_LENGTH_LIMIT = 268435455;
|
||||
|
||||
@@ -188,7 +181,7 @@ public class Utils {
|
||||
flags |= 0x01;
|
||||
}
|
||||
|
||||
flags |= ((message.fixedHeader().qosLevel().value() & 0x03) << 1);
|
||||
flags |= (message.fixedHeader().qosLevel().value() & 0x03) << 1;
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -203,4 +196,7 @@ public class Utils {
|
||||
// }
|
||||
// return protocolVersion == VERSION_3_1_1;
|
||||
// }
|
||||
|
||||
private Utils() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,6 @@ import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author luca <[email protected]>
|
||||
*/
|
||||
public class ConfigurationClassLoaderTest implements IAuthenticator, IAuthorizator {
|
||||
|
||||
Server m_server;
|
||||
|
||||
@@ -16,20 +16,16 @@
|
||||
|
||||
package io.moquette.server;
|
||||
|
||||
import io.moquette.server.config.IConfig;
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
import static io.moquette.BrokerConstants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME;
|
||||
import static io.moquette.BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME;
|
||||
import static io.moquette.BrokerConstants.PORT_PROPERTY_NAME;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
/**
|
||||
* Used to carry integration configurations.
|
||||
*
|
||||
* Created by andrea on 4/7/15.
|
||||
*/
|
||||
public class IntegrationUtils {
|
||||
public final class IntegrationUtils {
|
||||
|
||||
static String localMapDBPath() {
|
||||
String currentDir = System.getProperty("user.dir");
|
||||
@@ -69,4 +65,7 @@ public class IntegrationUtils {
|
||||
}
|
||||
assertFalse(dbFile.exists());
|
||||
}*/
|
||||
|
||||
private IntegrationUtils() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,17 +30,11 @@ import org.eclipse.jetty.websocket.api.annotations.WebSocket;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
@WebSocket
|
||||
public class MQTTWebSocket {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MQTTWebSocket.class);
|
||||
|
||||
private Session session;
|
||||
|
||||
private final CountDownLatch connectSentLatch;
|
||||
|
||||
public MQTTWebSocket() {
|
||||
@@ -50,14 +44,12 @@ public class MQTTWebSocket {
|
||||
@OnWebSocketClose
|
||||
public void onClose(int statusCode, String reason) {
|
||||
System.out.printf("Connection closed: %d - %s%n", statusCode, reason);
|
||||
this.session = null;
|
||||
}
|
||||
|
||||
@OnWebSocketConnect
|
||||
public void onConnect(Session session) throws IOException {
|
||||
System.out.printf("Got connect: %s%n", session);
|
||||
LOG.info("Got connect: %s%n", session);
|
||||
this.session = session;
|
||||
|
||||
// Trivial MQTT Connect message
|
||||
// assertEquals(12, out.readByte()); //remaining length
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.concurrent.*;
|
||||
*/
|
||||
public class MessageCollector implements MqttCallback {
|
||||
|
||||
private class ReceivedMessage {
|
||||
private final class ReceivedMessage {
|
||||
|
||||
private final MqttMessage message;
|
||||
private final String topic;
|
||||
@@ -38,7 +38,7 @@ public class MessageCollector implements MqttCallback {
|
||||
}
|
||||
|
||||
private BlockingQueue<ReceivedMessage> m_messages = new LinkedBlockingQueue<>();
|
||||
private boolean m_connectionLost = false;
|
||||
private boolean m_connectionLost;
|
||||
|
||||
/**
|
||||
* Return the message from the queue if not empty, else return null with wait period.
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.server;
|
||||
|
||||
@@ -18,9 +33,6 @@ import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Created by mackristof on 13/05/2016.
|
||||
*/
|
||||
public class ServerIntegrationDBAuthenticatorTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationDBAuthenticatorTest.class);
|
||||
|
||||
@@ -29,10 +29,6 @@ import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ServerIntegrationFuseTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationPahoTest.class);
|
||||
|
||||
+15
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.server;
|
||||
|
||||
|
||||
@@ -34,10 +34,6 @@ import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ServerIntegrationQoSValidationTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationPahoTest.class);
|
||||
|
||||
@@ -54,40 +54,55 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* <pre>
|
||||
* # generate server certificate chain (valid for 10000 days)
|
||||
* keytool -genkeypair -alias signedtestserver -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000
|
||||
* keytool -genkeypair -alias signedtestserver_sub -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv
|
||||
* keytool -genkeypair -alias signedtestserver -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 \
|
||||
* -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000
|
||||
* keytool -genkeypair -alias signedtestserver_sub -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 \
|
||||
* -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv
|
||||
*
|
||||
* # sign server subcertificate with server certificate (valid for 10000 days)
|
||||
* keytool -certreq -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
|
||||
* keytool -gencert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000 | \
|
||||
* keytool -importcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv
|
||||
* keytool -certreq -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv | \
|
||||
* keytool -gencert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv -validity 10000 | \
|
||||
* keytool -importcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv
|
||||
*
|
||||
* # generate client keypair
|
||||
* keytool -genkeypair -alias signedtestclient -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
* keytool -genkeypair -alias signedtestclient -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 \
|
||||
* -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
*
|
||||
* # create signed client certificate with server subcertificate and import to client keystore (valid for 10000 days)
|
||||
* keytool -certreq -alias signedtestclient -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd | \
|
||||
* keytool -gencert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000 | \
|
||||
* keytool -importcert -alias signedtestclient -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd -noprompt
|
||||
* keytool -gencert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv -validity 10000 | \
|
||||
* keytool -importcert -alias signedtestclient -keystore signedclientkeystore.jks -keypass passw0rd \
|
||||
* -storepass passw0rd -noprompt
|
||||
*
|
||||
* # import server certificates into signed truststore
|
||||
* keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
* keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
* keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore signedclientkeystore.jks \
|
||||
* -keypass passw0rd -storepass passw0rd
|
||||
* keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore signedclientkeystore.jks \
|
||||
* -keypass passw0rd -storepass passw0rd
|
||||
*
|
||||
* # create unsigned client certificate (valid for 10000 days)
|
||||
* keytool -genkeypair -alias unsignedtestclient -dname cn=moquette.eclipse.org -validity 10000 -keyalg RSA -keysize 2048 -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
* keytool -genkeypair -alias unsignedtestclient -dname cn=moquette.eclipse.org -validity 10000 -keyalg RSA \
|
||||
* -keysize 2048 -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
*
|
||||
* # import server certificates into unsigned truststore
|
||||
* keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
* keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
|
||||
* keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore unsignedclientkeystore.jks \
|
||||
* -keypass passw0rd -storepass passw0rd
|
||||
* keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
|
||||
* -storepass passw0rdsrv | \
|
||||
* keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore unsignedclientkeystore.jks \
|
||||
* -keypass passw0rd -storepass passw0rd
|
||||
* </pre>
|
||||
* </p>
|
||||
*
|
||||
* @author andrea / konradm
|
||||
*/
|
||||
public class ServerIntegrationSSLClientAuthTest {
|
||||
|
||||
|
||||
@@ -49,8 +49,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Check that Moquette could also handle SSL.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ServerIntegrationSSLTest {
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Integration test to check the function of Moquette with a WebSocket channel.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ServerIntegrationWebSocketTest {
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@ import java.util.Properties;
|
||||
import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ServerLowlevelMessagesIntegrationTests {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServerLowlevelMessagesIntegrationTests.class);
|
||||
|
||||
@@ -30,10 +30,6 @@ import java.util.Properties;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ServerRestartIntegrationTest {
|
||||
|
||||
static MqttClientPersistence s_dataStore;
|
||||
@@ -63,7 +59,6 @@ public class ServerRestartIntegrationTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
String dbPath = IntegrationUtils.localMapDBPath();
|
||||
startServer();
|
||||
|
||||
m_subscriber = new MqttClient("tcp://localhost:1883", "Subscriber", s_dataStore);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.server.config;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package io.moquette.server.config;
|
||||
|
||||
import io.moquette.BrokerConstants;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import java.io.Reader;
|
||||
@@ -24,13 +23,8 @@ import java.io.StringReader;
|
||||
import java.text.ParseException;
|
||||
import java.util.Properties;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ConfigurationParserTest {
|
||||
|
||||
ConfigurationParser m_parser;
|
||||
@@ -96,13 +90,4 @@ public class ConfigurationParserTest {
|
||||
assertEquals("localhost", props.getProperty("host"));
|
||||
assertEquals("multi word string property", props.getProperty("fake"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to verify default options.
|
||||
*/
|
||||
private void verifyDefaults(Properties props) {
|
||||
assertEquals(BrokerConstants.PORT, Integer.parseInt(props.getProperty(BrokerConstants.PORT_PROPERTY_NAME)));
|
||||
assertEquals(BrokerConstants.HOST, props.getProperty(BrokerConstants.HOST_PROPERTY_NAME));
|
||||
assertNull(props.getProperty(BrokerConstants.WEB_SOCKET_PORT_PROPERTY_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,6 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pkhanal
|
||||
*
|
||||
*/
|
||||
public class ConnectionIT {
|
||||
|
||||
Server m_server;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.spi;
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ import static org.mockito.Matchers.refEq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class BrokerInterceptorTest {
|
||||
|
||||
// value to check for changes after every notification
|
||||
|
||||
@@ -22,8 +22,6 @@ import io.moquette.spi.security.IAuthenticator;
|
||||
|
||||
/**
|
||||
* Test utility to implements authenticator instance.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
class MockAuthenticator implements IAuthenticator {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertTrue;
|
||||
/**
|
||||
* Some useful assertions used by Netty's EmbeddedChannel in tests.
|
||||
*/
|
||||
class NettyChannelAssertions {
|
||||
final class NettyChannelAssertions {
|
||||
|
||||
static void assertEqualsConnAck(MqttConnectReturnCode expectedCode, Object connAck) {
|
||||
assertEqualsConnAck(null, expectedCode, connAck);
|
||||
@@ -54,4 +54,6 @@ class NettyChannelAssertions {
|
||||
// assertEquals(expectedCode, connAckMsg.getReturnCode());
|
||||
}
|
||||
|
||||
private NettyChannelAssertions() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ import static io.moquette.spi.impl.ProtocolProcessor.lowerQosToTheSubscriptionDe
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ProtocolProcessorTest {
|
||||
|
||||
static final String FAKE_CLIENT_ID = "FAKE_123";
|
||||
@@ -263,7 +259,7 @@ public class ProtocolProcessorTest {
|
||||
|
||||
m_processor.processSubscribe(m_channel, msg);
|
||||
assertEquals(1, subscriptions.size());
|
||||
|
||||
|
||||
//Exercise
|
||||
m_processor.processSubscribe(m_channel, msg);
|
||||
|
||||
@@ -311,7 +307,8 @@ public class ProtocolProcessorTest {
|
||||
@Test
|
||||
public void testPublishOfRetainedMessage_afterNewSubscription() throws Exception {
|
||||
// simulate a connect that register a clientID to an IoSession
|
||||
final Subscription subscription = new Subscription(FAKE_PUBLISHER_ID, new Topic(FAKE_TOPIC), MqttQoS.AT_MOST_ONCE);
|
||||
final Subscription subscription =
|
||||
new Subscription(FAKE_PUBLISHER_ID, new Topic(FAKE_TOPIC), MqttQoS.AT_MOST_ONCE);
|
||||
|
||||
// subscriptions.matches(topic) redefine the method to return true
|
||||
SubscriptionsStore subs = new SubscriptionsStore() {
|
||||
|
||||
@@ -43,10 +43,6 @@ import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ProtocolProcessor_CONNECT_Test {
|
||||
|
||||
EmbeddedChannel m_session;
|
||||
|
||||
@@ -23,9 +23,6 @@ import java.io.StringReader;
|
||||
import java.text.ParseException;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author andrea
|
||||
*/
|
||||
public class ACLFileParserTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -22,9 +22,6 @@ import io.moquette.spi.impl.subscriptions.Topic;
|
||||
import java.text.ParseException;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author andrea
|
||||
*/
|
||||
public class AuthorizationsCollectorTest {
|
||||
|
||||
private static final Authorization RW_ANEMOMETER = new Authorization(new Topic("/weather/italy/anemometer"));
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.spi.impl.security;
|
||||
|
||||
@@ -12,9 +27,6 @@ import java.sql.*;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Created by mackristof on 12/05/2016.
|
||||
*/
|
||||
public class DBAuthenticatorTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DBAuthenticatorTest.class);
|
||||
|
||||
@@ -21,10 +21,7 @@ import org.junit.Test;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class FileAuthenticatorTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -27,10 +27,6 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class SubscriptionsStoreTest {
|
||||
|
||||
private SubscriptionsStore store;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.spi.impl.subscriptions;
|
||||
|
||||
import io.moquette.spi.ISessionsStore;
|
||||
@@ -5,9 +21,6 @@ import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by andrea on 03/03/17.
|
||||
*/
|
||||
public class TreeNodeTest {
|
||||
|
||||
@Test
|
||||
@@ -54,7 +67,8 @@ public class TreeNodeTest {
|
||||
|
||||
TreeNode updatedRoot = root.removeClientSubscriptions("Client1");
|
||||
|
||||
assertFalse("Remove a subscription shouldn't remove intermediate empty nodes", updatedRoot.m_children.isEmpty());
|
||||
assertFalse("Remove a subscription shouldn't remove intermediate empty nodes",
|
||||
updatedRoot.m_children.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ import java.util.concurrent.TimeUnit;
|
||||
/**
|
||||
* Class used just to send and receive MQTT messages without any protocol login in action, just use
|
||||
* the encoder/decoder part.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class Client {
|
||||
|
||||
@@ -46,7 +44,7 @@ public class Client {
|
||||
final ClientNettyMQTTHandler handler = new ClientNettyMQTTHandler();
|
||||
EventLoopGroup workerGroup;
|
||||
Channel m_channel;
|
||||
private boolean m_connectionLost = false;
|
||||
private boolean m_connectionLost;
|
||||
private ICallback callback;
|
||||
private String clientId;
|
||||
private MqttMessage receivedMsg;
|
||||
|
||||
@@ -24,10 +24,6 @@ import io.netty.handler.codec.mqtt.MqttMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
@ChannelHandler.Sharable
|
||||
class ClientNettyMQTTHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.testclient;
|
||||
|
||||
@@ -21,7 +36,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* This class is used to have a fluent interface to interact with a server. Inspired by
|
||||
* org.kaazing.robot
|
||||
*/
|
||||
public class RawClient {
|
||||
public final class RawClient {
|
||||
|
||||
@ChannelHandler.Sharable
|
||||
class RawMessageHandler extends ChannelInboundHandlerAdapter {
|
||||
@@ -52,7 +67,7 @@ public class RawClient {
|
||||
EventLoopGroup workerGroup;
|
||||
Channel m_channel;
|
||||
|
||||
private boolean connected = false;
|
||||
private boolean connected;
|
||||
private ByteBuf heapBuffer;
|
||||
private CountDownLatch disconnectLatch;
|
||||
private final Semaphore readableBytesSem;
|
||||
|
||||
Reference in New Issue
Block a user