Changed the subscription tree to work as persistent tree
This commit is contained in:
+27
-1
@@ -76,7 +76,7 @@ public class SubscriptionsStoreTest {
|
||||
}
|
||||
|
||||
@Test(expected = ParseException.class)
|
||||
public void testParseTopicMultiNotAferSeparatorNotValid() throws ParseException {
|
||||
public void testParseTopicMultiNotAfterSeparatorNotValid() throws ParseException {
|
||||
store.parseTopic("finance#");
|
||||
}
|
||||
|
||||
@@ -397,6 +397,32 @@ public class SubscriptionsStoreTest {
|
||||
assertFalse(subscriptions.contains(client1SubQoS0)); //client1SubQoS2 should override client1SubQoS0
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecreatePath_emptyRoot() {
|
||||
TreeNode oldRoot = new TreeNode(null);
|
||||
final SubscriptionsStore.NodeCouple resp = store.recreatePath("/finance", oldRoot);
|
||||
|
||||
//Verify
|
||||
assertNotNull(resp.root);
|
||||
assertNull(resp.root.m_token);
|
||||
assertEquals(1, resp.root.m_children.size());
|
||||
assertEquals(resp.createdNode, resp.root.m_children.get(0).m_children.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecreatePath_1layer_tree() {
|
||||
TreeNode oldRoot = new TreeNode(null);
|
||||
final SubscriptionsStore.NodeCouple respFinance = store.recreatePath("/finance", oldRoot);
|
||||
final SubscriptionsStore.NodeCouple respPlus = store.recreatePath("/+", respFinance.root);
|
||||
|
||||
//Verify
|
||||
assertNotNull(respPlus.root);
|
||||
assertNull(respPlus.root.m_token);
|
||||
assertEquals(1, respPlus.root.m_children.size());
|
||||
assertTrue(respPlus.root.m_children.get(0).m_children.contains(respPlus.createdNode));
|
||||
assertTrue(respPlus.root.m_children.get(0).m_children.contains(respFinance.createdNode));
|
||||
}
|
||||
|
||||
private static Token[] asArray(Object... l) {
|
||||
Token[] tokens = new Token[l.length];
|
||||
for (int i = 0; i < l.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user