Merge pull request #259 from AndreasMager/protocol-processor-test-fixed

Protocol processor test fixed
This commit is contained in:
Andrea Selva
2017-02-01 13:36:17 +01:00
committed by GitHub
2 changed files with 10 additions and 3 deletions
@@ -462,6 +462,13 @@ public class ProtocolProcessorTest {
.build(); .build();
m_processor.processPublish(m_channel, msg); m_processor.processPublish(m_channel, msg);
Collection<IMessagesStore.StoredMessage> messages = m_messagesStore.searchMatching(new IMatchingCondition() {
public boolean match(String key) {
return SubscriptionsStore.matchTopics(key, FAKE_TOPIC);
}
});
assertFalse(messages.isEmpty());
//Exercise //Exercise
MqttPublishMessage cleanPubMsg = MessageBuilder.publish() MqttPublishMessage cleanPubMsg = MessageBuilder.publish()
.topicName(FAKE_TOPIC) .topicName(FAKE_TOPIC)
@@ -473,7 +480,7 @@ public class ProtocolProcessorTest {
m_processor.processPublish(m_channel, cleanPubMsg); m_processor.processPublish(m_channel, cleanPubMsg);
//Verify //Verify
Collection<IMessagesStore.StoredMessage> messages = m_messagesStore.searchMatching(new IMatchingCondition() { messages = m_messagesStore.searchMatching(new IMatchingCondition() {
public boolean match(String key) { public boolean match(String key) {
return SubscriptionsStore.matchTopics(key, FAKE_TOPIC); return SubscriptionsStore.matchTopics(key, FAKE_TOPIC);
} }
@@ -42,7 +42,7 @@ public class PublishMessage extends MessageIDMessage {
} }
public ByteBuffer getPayload() { public ByteBuffer getPayload() {
return m_payload; return m_payload.duplicate();
} }
public void setPayload(ByteBuffer payload) { public void setPayload(ByteBuffer payload) {