Fixed checkStyle and ErrorProne warns
This commit is contained in:
@@ -64,15 +64,16 @@ public class ClientSessionTest {
|
||||
subscriptionsDirectory.add(oldSubscription);
|
||||
|
||||
// Subscribe on /topic again that overrides the previous subscription.
|
||||
Subscription overrindingSubscription = new Subscription(sessionClean.clientID, new Topic("/topic"), EXACTLY_ONCE);
|
||||
sessionClean.subscribe(overrindingSubscription);
|
||||
subscriptionsDirectory.add(overrindingSubscription);
|
||||
Subscription overridingSubscription = new Subscription(sessionClean.clientID, new Topic("/topic"),
|
||||
EXACTLY_ONCE);
|
||||
sessionClean.subscribe(overridingSubscription);
|
||||
subscriptionsDirectory.add(overridingSubscription);
|
||||
|
||||
// Verify
|
||||
List<Subscription> subscriptions = subscriptionsDirectory.matches(new Topic("/topic"));
|
||||
assertEquals("Only one subscription must match /topic", 1, subscriptions.size());
|
||||
Subscription sub = subscriptions.get(0);
|
||||
assertEquals("Matching subscription MUST have higher QoS",
|
||||
overrindingSubscription.getRequestedQos(), sub.getRequestedQos());
|
||||
overridingSubscription.getRequestedQos(), sub.getRequestedQos());
|
||||
}
|
||||
}
|
||||
|
||||
+17
-15
@@ -23,7 +23,6 @@ import io.moquette.spi.ISessionsStore;
|
||||
import io.moquette.spi.impl.security.PermitAllAuthorizator;
|
||||
import io.moquette.spi.impl.subscriptions.*;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.embedded.EmbeddedChannel;
|
||||
import io.netty.handler.codec.mqtt.*;
|
||||
|
||||
@@ -33,6 +32,7 @@ import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.CONNECTION_ACCEP
|
||||
import static io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader.from;
|
||||
import static io.netty.handler.codec.mqtt.MqttQoS.AT_LEAST_ONCE;
|
||||
import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@@ -104,11 +104,10 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
|
||||
final String clientId = NettyUtils.clientID(channel);
|
||||
Subscription expectedSubscription = new Subscription(clientId, new Topic(topic), desiredQos);
|
||||
verifySubscriptionExists(channel, m_sessionStore, expectedSubscription);
|
||||
verifySubscriptionExists(m_sessionStore, expectedSubscription);
|
||||
}
|
||||
|
||||
protected static void verifySubscriptionExists(Channel channel, ISessionsStore sessionsStore, Subscription expectedSubscription) {
|
||||
final String clientId = NettyUtils.clientID(channel);
|
||||
protected static void verifySubscriptionExists(ISessionsStore sessionsStore, Subscription expectedSubscription) {
|
||||
final Subscription subscription = sessionsStore.subscriptionStore().reload(expectedSubscription);
|
||||
assertEquals(expectedSubscription, subscription);
|
||||
}
|
||||
@@ -166,7 +165,7 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
.topicName(topic)
|
||||
.retained(retained)
|
||||
.qos(qos)
|
||||
.payload(Unpooled.copiedBuffer(HELLO_WORLD_MQTT.getBytes())).build();
|
||||
.payload(Unpooled.copiedBuffer(HELLO_WORLD_MQTT.getBytes(UTF_8))).build();
|
||||
this.m_processor.internalPublish(publish, "INTRPUBL");
|
||||
}
|
||||
|
||||
@@ -180,7 +179,7 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
.topicName(topic)
|
||||
.retained(retained)
|
||||
.qos(qos)
|
||||
.payload(Unpooled.copiedBuffer(HELLO_WORLD_MQTT.getBytes())).build();
|
||||
.payload(Unpooled.copiedBuffer(HELLO_WORLD_MQTT.getBytes(UTF_8))).build();
|
||||
this.m_processor.processPublish(m_channel, publish);
|
||||
}
|
||||
|
||||
@@ -188,33 +187,37 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
publishToAs(this.m_channel, clientId, topic, qos, messageId, retained);
|
||||
}
|
||||
|
||||
protected void publishToAs(EmbeddedChannel channel, String clientId, String topic, MqttQoS qos, int messageId, boolean retained) {
|
||||
protected void publishToAs(EmbeddedChannel channel, String clientId, String topic, MqttQoS qos, int messageId,
|
||||
boolean retained) {
|
||||
publishToAs(channel, clientId, topic, HELLO_WORLD_MQTT, qos, messageId, retained);
|
||||
}
|
||||
|
||||
protected void publishToAs(EmbeddedChannel channel, String clientId, String topic, String payload, MqttQoS qos, int messageId, boolean retained) {
|
||||
protected void publishToAs(EmbeddedChannel channel, String clientId, String topic, String payload, MqttQoS qos,
|
||||
int messageId, boolean retained) {
|
||||
NettyUtils.userName(channel, clientId);
|
||||
MqttPublishMessage publish = MqttMessageBuilders.publish()
|
||||
.topicName(topic)
|
||||
.retained(retained)
|
||||
.messageId(messageId)
|
||||
.qos(qos)
|
||||
.payload(Unpooled.copiedBuffer(payload.getBytes())).build();
|
||||
.payload(Unpooled.copiedBuffer(payload.getBytes(UTF_8))).build();
|
||||
this.m_processor.processPublish(channel, publish);
|
||||
}
|
||||
|
||||
protected void publishQoS2ToAs(EmbeddedChannel channel, String clientId, String topic, int messageId, boolean retained) {
|
||||
protected void publishQoS2ToAs(EmbeddedChannel channel, String clientId, String topic, int messageId,
|
||||
boolean retained) {
|
||||
publishQoS2ToAs(channel, clientId, topic, HELLO_WORLD_MQTT, messageId, retained);
|
||||
}
|
||||
|
||||
protected void publishQoS2ToAs(EmbeddedChannel channel, String clientId, String topic, String payload, int messageId, boolean retained) {
|
||||
protected void publishQoS2ToAs(EmbeddedChannel channel, String clientId, String topic, String payload,
|
||||
int messageId, boolean retained) {
|
||||
NettyUtils.userName(channel, clientId);
|
||||
MqttPublishMessage publish = MqttMessageBuilders.publish()
|
||||
.topicName(topic)
|
||||
.retained(retained)
|
||||
.messageId(messageId)
|
||||
.qos(MqttQoS.EXACTLY_ONCE)
|
||||
.payload(Unpooled.copiedBuffer(payload.getBytes())).build();
|
||||
.payload(Unpooled.copiedBuffer(payload.getBytes(UTF_8))).build();
|
||||
this.m_processor.processPublish(channel, publish);
|
||||
|
||||
verifyPubrecIsReceived(channel, messageId);
|
||||
@@ -236,7 +239,6 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
assertEquals(messageId, Utils.messageId(pubComp));
|
||||
}
|
||||
|
||||
|
||||
protected void connect() {
|
||||
connectAsClient(FAKE_CLIENT_ID);
|
||||
}
|
||||
@@ -307,7 +309,7 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
|
||||
protected void verifyPublishIsReceived(EmbeddedChannel channel) {
|
||||
final MqttPublishMessage publishReceived = channel.readOutbound();
|
||||
String payloadMessage = new String(publishReceived.payload().array());
|
||||
String payloadMessage = new String(publishReceived.payload().array(), UTF_8);
|
||||
assertEquals("Sent and received payload must be identical", HELLO_WORLD_MQTT, payloadMessage);
|
||||
}
|
||||
|
||||
@@ -321,7 +323,7 @@ abstract class AbstractProtocolProcessorCommonUtils {
|
||||
|
||||
protected void verifyPublishIsReceived(EmbeddedChannel channel, String expectedPayload, MqttQoS expectedQoS) {
|
||||
final MqttPublishMessage publishReceived = channel.readOutbound();
|
||||
String payloadMessage = new String(publishReceived.payload().array());
|
||||
String payloadMessage = new String(publishReceived.payload().array(), UTF_8);
|
||||
assertEquals("Sent and received payload must be identical", expectedPayload, payloadMessage);
|
||||
assertEquals("Expected QoS don't match", expectedQoS, publishReceived.fixedHeader().qosLevel());
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.junit.Test;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Matchers.refEq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -126,7 +127,7 @@ public class BrokerInterceptorTest {
|
||||
public void testNotifyTopicPublished() throws Exception {
|
||||
interceptor.notifyTopicPublished(
|
||||
MqttMessageBuilders.publish().qos(MqttQoS.AT_MOST_ONCE)
|
||||
.payload(Unpooled.copiedBuffer("Hello".getBytes())).build(),
|
||||
.payload(Unpooled.copiedBuffer("Hello".getBytes(UTF_8))).build(),
|
||||
"cli1234",
|
||||
"cli1234");
|
||||
interval();
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import io.moquette.spi.security.IAuthenticator;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
/**
|
||||
* Test utility to implements authenticator instance.
|
||||
*/
|
||||
@@ -33,6 +35,7 @@ class MockAuthenticator implements IAuthenticator {
|
||||
m_userPwds = userPwds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkValid(String clientId, String username, byte[] password) {
|
||||
if (!m_clientIds.contains(clientId)) {
|
||||
return false;
|
||||
@@ -43,7 +46,7 @@ class MockAuthenticator implements IAuthenticator {
|
||||
if (password == null) {
|
||||
return false;
|
||||
}
|
||||
return m_userPwds.get(username).equals(new String(password));
|
||||
return m_userPwds.get(username).equals(new String(password, UTF_8));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import static io.moquette.spi.impl.NettyChannelAssertions.assertConnAckAccepted;
|
||||
import static io.moquette.spi.impl.ProtocolProcessor.lowerQosToTheSubscriptionDesired;
|
||||
import static io.netty.handler.codec.mqtt.MqttQoS.AT_LEAST_ONCE;
|
||||
import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@@ -61,7 +62,6 @@ public class ProtocolProcessorTest extends AbstractProtocolProcessorCommonUtils
|
||||
static final List<InterceptHandler> EMPTY_OBSERVERS = Collections.emptyList();
|
||||
static final BrokerInterceptor NO_OBSERVERS_INTERCEPTOR = new BrokerInterceptor(EMPTY_OBSERVERS);
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws InterruptedException {
|
||||
initializeProcessorAndSubsystems();
|
||||
@@ -143,7 +143,7 @@ public class ProtocolProcessorTest extends AbstractProtocolProcessorCommonUtils
|
||||
|
||||
// Exercise
|
||||
MqttPublishMessage msg = MqttMessageBuilders.publish().topicName(FAKE_TOPIC).qos(AT_MOST_ONCE)
|
||||
.retained(false).payload(Unpooled.copiedBuffer("Hello".getBytes())).build();
|
||||
.retained(false).payload(Unpooled.copiedBuffer("Hello".getBytes(UTF_8))).build();
|
||||
NettyUtils.userName(m_channel, "FakeCLI");
|
||||
m_processor.processPublish(m_channel, msg);
|
||||
|
||||
@@ -269,7 +269,7 @@ public class ProtocolProcessorTest extends AbstractProtocolProcessorCommonUtils
|
||||
List<Subscription> emptySubs = Collections.emptyList();
|
||||
when(subs.matches(any(Topic.class))).thenReturn(emptySubs);
|
||||
|
||||
StoredMessage retainedMessage = new StoredMessage("Hello".getBytes(), MqttQoS.EXACTLY_ONCE, "/topic");
|
||||
StoredMessage retainedMessage = new StoredMessage("Hello".getBytes(UTF_8), MqttQoS.EXACTLY_ONCE, "/topic");
|
||||
retainedMessage.setRetained(true);
|
||||
retainedMessage.setClientID(FAKE_PUBLISHER_ID);
|
||||
m_messagesStore.storeRetained(new Topic("/topic"), retainedMessage);
|
||||
|
||||
@@ -69,7 +69,8 @@ public class ProtocolProcessor_CONNECT_Test {
|
||||
subscriptions.init(sessionsRepository);
|
||||
m_processor = new ProtocolProcessor();
|
||||
m_processor.init(subscriptions, m_messagesStore, m_sessionStore, m_mockAuthenticator, true,
|
||||
new PermitAllAuthorizator(), NO_OBSERVERS_INTERCEPTOR, new SessionsRepository(this.m_sessionStore, null));
|
||||
new PermitAllAuthorizator(), NO_OBSERVERS_INTERCEPTOR,
|
||||
new SessionsRepository(this.m_sessionStore, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -286,7 +287,7 @@ public class ProtocolProcessor_CONNECT_Test {
|
||||
FAKE_CLIENT_ID,
|
||||
new Topic(ProtocolProcessorTest.FAKE_TOPIC),
|
||||
MqttQoS.AT_MOST_ONCE);
|
||||
verifySubscriptionExists(m_session, m_sessionStore, expectedSubscription);
|
||||
verifySubscriptionExists(m_sessionStore, expectedSubscription);
|
||||
assertEqualsSubAck(m_session.readOutbound());
|
||||
|
||||
// disconnect
|
||||
@@ -300,7 +301,7 @@ public class ProtocolProcessor_CONNECT_Test {
|
||||
assertTrue("Connection is accepted and therefore should remain open.", m_session.isOpen());
|
||||
|
||||
// verify that the first subscription is still preserved
|
||||
verifySubscriptionExists(m_session, m_sessionStore, expectedSubscription);
|
||||
verifySubscriptionExists(m_sessionStore, expectedSubscription);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -201,7 +201,8 @@ public class ProtocolProcessor_VariousUseCases_Test extends AbstractProtocolProc
|
||||
}
|
||||
|
||||
@Test
|
||||
public void avoidMultipleNotificationsAfterMultipleReconnection_cleanSessionFalseQoS1() throws InterruptedException {
|
||||
public void avoidMultipleNotificationsAfterMultipleReconnection_cleanSessionFalseQoS1()
|
||||
throws InterruptedException {
|
||||
connect();
|
||||
subscribe("/topic", AT_LEAST_ONCE);
|
||||
disconnect();
|
||||
@@ -221,7 +222,6 @@ public class ProtocolProcessor_VariousUseCases_Test extends AbstractProtocolProc
|
||||
verifyPublishIsReceived("Hello MQTT 2", AT_LEAST_ONCE);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testConnectSubPub_cycle_getTimeout_on_second_disconnect_issue142() throws InterruptedException {
|
||||
connect();
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.*;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -70,7 +72,7 @@ public class DBAuthenticatorTest {
|
||||
JDBC_H2_MEM_TEST,
|
||||
"SELECT PASSWORD FROM ACCOUNT WHERE LOGIN=?",
|
||||
SHA_256);
|
||||
assertTrue(dbAuthenticator.checkValid(null, "dbuser", "password".getBytes()));
|
||||
assertTrue(dbAuthenticator.checkValid(null, "dbuser", "password".getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,7 +82,7 @@ public class DBAuthenticatorTest {
|
||||
JDBC_H2_MEM_TEST,
|
||||
"SELECT PASSWORD FROM ACCOUNT WHERE LOGIN=?",
|
||||
SHA_256);
|
||||
assertFalse(dbAuthenticator.checkValid(null, "dbuser2", "password".getBytes()));
|
||||
assertFalse(dbAuthenticator.checkValid(null, "dbuser2", "password".getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,7 +92,7 @@ public class DBAuthenticatorTest {
|
||||
JDBC_H2_MEM_TEST,
|
||||
"SELECT PASSWORD FROM ACCOUNT WHERE LOGIN=?",
|
||||
SHA_256);
|
||||
assertFalse(dbAuthenticator.checkValid(null, "dbuser", "wrongPassword".getBytes()));
|
||||
assertFalse(dbAuthenticator.checkValid(null, "dbuser", "wrongPassword".getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -18,6 +18,8 @@ package io.moquette.spi.impl.security;
|
||||
|
||||
import io.moquette.spi.security.IAuthenticator;
|
||||
import org.junit.Test;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -29,7 +31,7 @@ public class FileAuthenticatorTest {
|
||||
String file = getClass().getResource("/password_file.conf").getPath();
|
||||
IAuthenticator auth = new FileAuthenticator(null, file);
|
||||
|
||||
assertTrue(auth.checkValid(null, "testuser", "passwd".getBytes()));
|
||||
assertTrue(auth.checkValid(null, "testuser", "passwd".getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -37,14 +39,14 @@ public class FileAuthenticatorTest {
|
||||
String file = getClass().getResource("/password_file.conf").getPath();
|
||||
IAuthenticator auth = new FileAuthenticator(null, file);
|
||||
|
||||
assertFalse(auth.checkValid(null, "testuser2", "passwd".getBytes()));
|
||||
assertFalse(auth.checkValid(null, "testuser2", "passwd".getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadPasswordFile_verifyDirectoryRef() {
|
||||
IAuthenticator auth = new FileAuthenticator("", "");
|
||||
|
||||
assertFalse(auth.checkValid(null, "testuser2", "passwd".getBytes()));
|
||||
assertFalse(auth.checkValid(null, "testuser2", "passwd".getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-4
@@ -83,10 +83,11 @@ public class CTrieSubscriptionDirectoryMatchingTest {
|
||||
sut.add(financeAnySub);
|
||||
|
||||
// Verify
|
||||
assertThat(sut.recursiveMatch(asTopic("finance/stock"), sut.root)).containsExactlyInAnyOrder(financeAnySub, anySub);
|
||||
assertThat(sut.recursiveMatch(asTopic("finance/stock/ibm"), sut.root)).containsExactlyInAnyOrder(financeAnySub, anySub);
|
||||
|
||||
System.out.println(sut.dumpTree());
|
||||
assertThat(sut.recursiveMatch(asTopic("finance/stock"), sut.root))
|
||||
.containsExactlyInAnyOrder(financeAnySub, anySub);
|
||||
assertThat(sut.recursiveMatch(asTopic("finance/stock/ibm"), sut.root))
|
||||
.containsExactlyInAnyOrder(financeAnySub, anySub);
|
||||
// System.out.println(sut.dumpTree());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+7
-14
@@ -144,8 +144,8 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
@Test
|
||||
public void givenTreeWithSomeNodeWhenRemoveMultipleTimes() {
|
||||
sut.add(clientSubOnTopic("TempSensor1", "test"));
|
||||
|
||||
// make sure no TNode exceptions
|
||||
|
||||
// make sure no TNode exceptions
|
||||
sut.removeSubscription(asTopic("test"), "TempSensor1");
|
||||
sut.removeSubscription(asTopic("test"), "TempSensor1");
|
||||
sut.removeSubscription(asTopic("test"), "TempSensor1");
|
||||
@@ -192,35 +192,30 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
sut.add(clientSubOnTopic("TempSensor1", "/temp/2"));
|
||||
|
||||
//Exercise
|
||||
|
||||
sut.removeSubscription(asTopic("/temp"), "TempSensor1");
|
||||
|
||||
final Set<Subscription> matchingSubs1 = sut.recursiveMatch(asTopic("/temp/1"), sut.root);
|
||||
final Set<Subscription> matchingSubs2 = sut.recursiveMatch(asTopic("/temp/2"), sut.root);
|
||||
|
||||
//Verify
|
||||
|
||||
// not clear to me, but I believe /temp unsubscribe should not unsub you from downstream /temp/1 or /temp/2
|
||||
|
||||
final Subscription expectedMatchingsub1 = new Subscription("TempSensor1", asTopic("/temp/1"));
|
||||
assertThat(matchingSubs1).contains(expectedMatchingsub1);
|
||||
final Subscription expectedMatchingsub2 = new Subscription("TempSensor1", asTopic("/temp/2"));
|
||||
assertThat(matchingSubs2).contains(expectedMatchingsub2);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenTreeWithDeepNodeWhenRemoveContainedSubscriptionThenNodeIsUpdated() {
|
||||
sut.add(clientSubOnTopic("TempSensor1", "/bah/bin/bash"));
|
||||
|
||||
sut.removeSubscription(asTopic("/bah/bin/bash"),"TempSensor1");
|
||||
sut.removeSubscription(asTopic("/bah/bin/bash"), "TempSensor1");
|
||||
|
||||
//Verify
|
||||
final Optional<CNode> matchedNode = sut.lookup(asTopic("/bah/bin/bash"));
|
||||
assertFalse("Node on path /temp can't be present", matchedNode.isPresent());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMatchSubscriptionNoWildcards() {
|
||||
sut.add(clientSubOnTopic("TempSensor1", "/temp"));
|
||||
@@ -237,7 +232,7 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
public void testRemovalInnerTopicOffRootSameClient() {
|
||||
sut.add(clientSubOnTopic("TempSensor1", "temp"));
|
||||
sut.add(clientSubOnTopic("TempSensor1", "temp/1"));
|
||||
|
||||
|
||||
//Exercise
|
||||
final Set<Subscription> matchingSubs1 = sut.recursiveMatch(asTopic("temp"), sut.root);
|
||||
final Set<Subscription> matchingSubs2 = sut.recursiveMatch(asTopic("temp/1"), sut.root);
|
||||
@@ -249,7 +244,7 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
assertThat(matchingSubs1).contains(expectedMatchingsub1);
|
||||
assertThat(matchingSubs2).contains(expectedMatchingsub2);
|
||||
|
||||
sut.removeSubscription(asTopic("temp"),"TempSensor1");
|
||||
sut.removeSubscription(asTopic("temp"), "TempSensor1");
|
||||
|
||||
//Exercise
|
||||
final Set<Subscription> matchingSubs3 = sut.recursiveMatch(asTopic("temp"), sut.root);
|
||||
@@ -275,7 +270,7 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
assertThat(matchingSubs1).contains(expectedMatchingsub1);
|
||||
assertThat(matchingSubs2).contains(expectedMatchingsub2);
|
||||
|
||||
sut.removeSubscription(asTopic("temp"),"TempSensor1");
|
||||
sut.removeSubscription(asTopic("temp"), "TempSensor1");
|
||||
|
||||
//Exercise
|
||||
final Set<Subscription> matchingSubs3 = sut.recursiveMatch(asTopic("temp"), sut.root);
|
||||
@@ -301,7 +296,7 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
assertThat(matchingSubs1).contains(expectedMatchingsub1);
|
||||
assertThat(matchingSubs2).contains(expectedMatchingsub2);
|
||||
|
||||
sut.removeSubscription(asTopic("temp/1"),"TempSensor2");
|
||||
sut.removeSubscription(asTopic("temp/1"), "TempSensor2");
|
||||
|
||||
//Exercise
|
||||
final Set<Subscription> matchingSubs3 = sut.recursiveMatch(asTopic("temp"), sut.root);
|
||||
@@ -311,5 +306,3 @@ public class CTrieSubscriptionDirectoryTest {
|
||||
assertThat(matchingSubs4).doesNotContain(expectedMatchingsub2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -122,7 +122,6 @@ public class TopicTest {
|
||||
assertEquals(Topic.asTopic("a/b"), Topic.asTopic("/a/b").exceptHeadToken());
|
||||
}
|
||||
|
||||
|
||||
public static TopicAssert assertThat(Topic topic) {
|
||||
return new TopicAssert(topic);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user