Fixed test interdependency due to H2 storage in integration tests

This commit is contained in:
andsel
2018-11-24 12:06:31 +01:00
parent 9df60774a7
commit f165fd968f
3 changed files with 8 additions and 17 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ dependencies {
compile group: 'io.netty', name: 'netty-transport-native-epoll', version: nettyVersion, classifier: 'linux-x86_64'
// <classifier>${os.detected.name}-${os.detected.arch}</classifier>
compile group: 'com.h2database', name: 'h2-mvstore', version: '1.4.192'
compile group: 'com.h2database', name: 'h2-mvstore', version: '1.4.196'
compile group: 'com.zaxxer', name: 'HikariCP', version:'2.4.7'
@@ -33,7 +33,7 @@ dependencies {
testCompile group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version:'1.12'
testCompile group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version:'1.2.0'
testCompile group: 'org.eclipse.jetty.websocket', name: 'websocket-client', version:'9.2.0.M1'
testCompile group: 'com.h2database', name: 'h2', version:'1.4.192'
testCompile group: 'com.h2database', name: 'h2', version:'1.4.196'
testRuntime group: 'io.netty', name: 'netty-tcnative', version: '2.0.10.Final', classifier: 'linux-x86_64'
}
@@ -39,6 +39,7 @@ class DumpTreeVisitor implements CTrieSubscriptionDirectory.IVisitor<String> {
for (Subscription couple : node.subscriptions) {
subScriptionsStr
.append("{filter=").append(couple.topicFilter).append(", ")
.append("qos=").append(couple.getRequestedQos()).append(", ")
.append("client='").append(couple.clientId).append("'}");
counter++;
if (counter < node.subscriptions.size()) {
@@ -21,16 +21,14 @@ import io.moquette.broker.config.IConfig;
import io.moquette.broker.config.MemoryConfig;
import org.eclipse.paho.client.mqttv3.IMqttClient;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
@@ -42,21 +40,12 @@ public class ServerIntegrationQoSValidationTest {
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationPahoTest.class);
Server m_server;
static MqttClientPersistence s_subDataStore;
static MqttClientPersistence s_pubDataStore;
IMqttClient m_subscriber;
IMqttClient m_publisher;
MessageCollector m_callback;
IConfig m_config;
@BeforeClass
public static void beforeTests() {
String tmpDir = System.getProperty("java.io.tmpdir");
s_subDataStore = new MqttDefaultFilePersistence(tmpDir + File.separator + "subscriber");
s_pubDataStore = new MqttDefaultFilePersistence(tmpDir + File.separator + "publisher");
}
protected void startServer() throws IOException {
m_server = new Server();
final Properties configProps = IntegrationUtils.prepareTestProperties();
@@ -68,12 +57,12 @@ public class ServerIntegrationQoSValidationTest {
public void setUp() throws Exception {
startServer();
m_subscriber = new MqttClient("tcp://localhost:1883", "Subscriber", s_subDataStore);
m_subscriber = new MqttClient("tcp://localhost:1883", "Subscriber", new MemoryPersistence());
m_callback = new MessageCollector();
m_subscriber.setCallback(m_callback);
m_subscriber.connect();
m_publisher = new MqttClient("tcp://localhost:1883", "Publisher", s_pubDataStore);
m_publisher = new MqttClient("tcp://localhost:1883", "Publisher", new MemoryPersistence());
m_publisher.connect();
}
@@ -88,6 +77,7 @@ public class ServerIntegrationQoSValidationTest {
}
m_server.stopServer();
IntegrationUtils.clearTestStorage();
}
@Test