Fixed runtime loading of persistence implementation

This commit is contained in:
andsel
2017-06-18 11:01:25 +02:00
parent e848ecf9bc
commit 16a9a0ccd0
8 changed files with 77 additions and 89 deletions
@@ -36,7 +36,7 @@ public class ClientSessionTest {
@Before
public void setUp() {
store = new SubscriptionsDirectory();
MemoryStorageService storageService = new MemoryStorageService();
MemoryStorageService storageService = new MemoryStorageService(null, null);
this.sessionsStore = storageService.sessionsStore();
store.init(sessionsStore);
@@ -80,7 +80,7 @@ public class ProtocolProcessorTest {
// sleep to let the messaging batch processor to process the initEvent
Thread.sleep(300);
MemoryStorageService memStorage = new MemoryStorageService();
MemoryStorageService memStorage = new MemoryStorageService(null, null);
m_messagesStore = memStorage.messagesStore();
m_sessionStore = memStorage.sessionsStore();
// m_messagesStore.initStore();
@@ -117,7 +117,7 @@ public class ProtocolProcessorTest {
};
// simulate a connect that register a clientID to an IoSession
MemoryStorageService storageService = new MemoryStorageService();
MemoryStorageService storageService = new MemoryStorageService(null, null);
subs.init(storageService.sessionsStore());
m_processor.init(
subs,
@@ -165,7 +165,7 @@ public class ProtocolProcessorTest {
};
// simulate a connect that register a clientID to an IoSession
MemoryStorageService storageService = new MemoryStorageService();
MemoryStorageService storageService = new MemoryStorageService(null, null);
subs.init(storageService.sessionsStore());
m_processor.init(subs, m_messagesStore, m_sessionStore, null, true, new PermitAllAuthorizator(),
NO_OBSERVERS_INTERCEPTOR);
@@ -322,7 +322,7 @@ public class ProtocolProcessorTest {
}
}
};
MemoryStorageService storageService = new MemoryStorageService();
MemoryStorageService storageService = new MemoryStorageService(null, null);
subs.init(storageService.sessionsStore());
// simulate a connect that register a clientID to an IoSession
@@ -60,7 +60,7 @@ public class ProtocolProcessor_CONNECT_Test {
// sleep to let the messaging batch processor to process the initEvent
Thread.sleep(300);
MemoryStorageService memStorage = new MemoryStorageService();
MemoryStorageService memStorage = new MemoryStorageService(null, null);
m_messagesStore = memStorage.messagesStore();
m_sessionStore = memStorage.sessionsStore();
// m_messagesStore.initStore();
@@ -42,7 +42,7 @@ public class SubscriptionsDirectoryTest {
@Before
public void setUp() throws IOException {
store = new SubscriptionsDirectory();
MemoryStorageService storageService = new MemoryStorageService();
MemoryStorageService storageService = new MemoryStorageService(null, null);
this.sessionsStore = storageService.sessionsStore();
store.init(sessionsStore);
@@ -212,7 +212,7 @@ public class SubscriptionsDirectoryTest {
Topic subscription = new Topic(s);
Topic topic = new Topic(t);
store = new SubscriptionsDirectory();
MemoryStorageService memStore = new MemoryStorageService();
MemoryStorageService memStore = new MemoryStorageService(null, null);
ISessionsStore aSessionsStore = memStore.sessionsStore();
aSessionsStore.createNewSession("FAKE_CLI_ID_1", false);
store.init(aSessionsStore);
@@ -226,7 +226,7 @@ public class SubscriptionsDirectoryTest {
Topic subscription = new Topic(s);
Topic topic = new Topic(t);
store = new SubscriptionsDirectory();
MemoryStorageService memStore = new MemoryStorageService();
MemoryStorageService memStore = new MemoryStorageService(null, null);
store.init(memStore.sessionsStore());
Subscription sub = new Subscription("FAKE_CLI_ID_1", subscription, MqttQoS.AT_MOST_ONCE);
this.subscriptionsStore.addNewSubscription(sub);
@@ -278,7 +278,7 @@ public class SubscriptionsDirectoryTest {
@Test
public void removeSubscription_withDifferentClients_subscribedSameTopic() {
SubscriptionsDirectory aStore = new SubscriptionsDirectory();
MemoryStorageService memStore = new MemoryStorageService();
MemoryStorageService memStore = new MemoryStorageService(null, null);
ISessionsStore sessionsStore = memStore.sessionsStore();
aStore.init(sessionsStore);
// subscribe a not active clientID1 to /topic