Fixed failing tests
This commit is contained in:
@@ -19,11 +19,12 @@ import io.moquette.broker.subscriptions.Topic;
|
||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||
|
||||
public interface IRetainedRepository {
|
||||
|
||||
void cleanRetained(Topic topic);
|
||||
|
||||
void retain(Topic topic, MqttPublishMessage msg);
|
||||
|
||||
boolean isEmtpy();
|
||||
boolean isEmpty();
|
||||
|
||||
MqttPublishMessage retainedOnTopic(String topic);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ final class MemoryRetainedRepository implements IRetainedRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmtpy() {
|
||||
public boolean isEmpty() {
|
||||
return storage.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
+1
-6
@@ -79,11 +79,6 @@ public class CTrieSubscriptionDirectory implements ISubscriptionsDirectory {
|
||||
return Optional.of(inode.mainNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Subscription> matches(Topic topic) {
|
||||
return new ArrayList<>(matchQosSharpening(topic));
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a topic string return the clients subscriptions that matches it. Topic string can't
|
||||
* contain character # and + because they are reserved to listeners subscriptions, and not topic
|
||||
@@ -113,7 +108,7 @@ public class CTrieSubscriptionDirectory implements ISubscriptionsDirectory {
|
||||
return new HashSet<>(subsGroupedByClient.values());
|
||||
}
|
||||
|
||||
Set<Subscription> recursiveMatch(Topic topic, INode inode) {
|
||||
private Set<Subscription> recursiveMatch(Topic topic, INode inode) {
|
||||
CNode cnode = inode.mainNode();
|
||||
if (Token.MULTI.equals(cnode.token)) {
|
||||
return cnode.subscriptions;
|
||||
|
||||
@@ -32,8 +32,6 @@ public interface ISubscriptionsDirectory {
|
||||
|
||||
void removeSubscription(Topic topic, String clientID);
|
||||
|
||||
List<Subscription> matches(Topic topic);
|
||||
|
||||
int size();
|
||||
|
||||
String dumpTree();
|
||||
|
||||
@@ -241,7 +241,7 @@ public class PostOfficePublishTest {
|
||||
.topicName(NEWS_TOPIC).build());
|
||||
|
||||
// Verify
|
||||
assertTrue("QoS0 MUST clean retained message for topic", retainedRepository.isEmtpy());
|
||||
assertTrue("QoS0 MUST clean retained message for topic", retainedRepository.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -403,7 +403,7 @@ public class PostOfficePublishTest {
|
||||
.topicName(NEWS_TOPIC).build());
|
||||
|
||||
// Verify
|
||||
assertTrue("Retained message for topic /news must be cleared", retainedRepository.isEmtpy());
|
||||
assertTrue("Retained message for topic /news must be cleared", retainedRepository.isEmpty());
|
||||
}
|
||||
|
||||
private void assertMessageIsRetained(String expectedTopicName) {
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package io.moquette.broker.config;
|
||||
|
||||
import io.moquette.broker.config.ConfigurationParser;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.text.ParseException;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ public class ServerIntegrationWebSocketTest {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
client.stop();
|
||||
|
||||
m_server.stopServer();
|
||||
IntegrationUtils.clearTestStorage();
|
||||
}
|
||||
|
||||
@SuppressWarnings("FutureReturnValueIgnored")
|
||||
|
||||
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import io.moquette.BrokerConstants;
|
||||
import io.moquette.integration.IntegrationUtils;
|
||||
import io.moquette.testclient.RawClient;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -53,6 +54,7 @@ public class ConnectionIT {
|
||||
dbFile.delete());
|
||||
}
|
||||
assertFalse(dbFile.exists());
|
||||
IntegrationUtils.clearTestStorage();
|
||||
}
|
||||
|
||||
@Test(timeout = 3000)
|
||||
|
||||
Reference in New Issue
Block a user