Changed the way a Client session is active and moved to event and states of Channel for CONNECT and DISCONNET messages

This commit is contained in:
andsel
2016-11-05 18:29:08 +01:00
parent 8e43f75f70
commit 7508275cf7
6 changed files with 107 additions and 37 deletions
@@ -382,7 +382,7 @@ public class ProtocolProcessorTest {
@Test
public void publishNoPublishToInactiveSession() {
//create an inactive session for Subscriber
m_sessionStore.createNewSession("Subscriber", false).deactivate();
m_sessionStore.createNewSession("Subscriber", false);
SubscriptionsStore mockedSubscriptions = mock(SubscriptionsStore.class);
Subscription inactiveSub = new Subscription("Subscriber", "/topic", QOSType.LEAST_ONE);
@@ -455,8 +455,8 @@ public class ProtocolProcessorTest {
memStore.initStore();
IMessagesStore memoryMessageStore = memStore.messagesStore();
ISessionsStore sessionsStore = memStore.sessionsStore();
sessionsStore.createNewSession("Sub A", false).activate();
sessionsStore.createNewSession("Sub B", false).activate();
sessionsStore.createNewSession("Sub A", false);
sessionsStore.createNewSession("Sub B", false);
Subscription subQos1 = new Subscription("Sub A", "a/b", QOSType.LEAST_ONE);
Subscription subQos2 = new Subscription("Sub B", "a/+", QOSType.EXACTLY_ONCE);
@@ -379,7 +379,7 @@ public class SubscriptionsStoreTest {
ISessionsStore sessionsStore = memStore.sessionsStore();
aStore.init(sessionsStore);
//subscribe a not active clientID1 to /topic
sessionsStore.createNewSession("FAKE_CLI_ID_1", true).deactivate();
sessionsStore.createNewSession("FAKE_CLI_ID_1", true);
Subscription slashSub = new Subscription("FAKE_CLI_ID_1", "/topic", AbstractMessage.QOSType.MOST_ONE);
sessionsStore.addNewSubscription(slashSub);
aStore.add(slashSub.asClientTopicCouple());