Skip to content

Commit 77ca959

Browse files
author
Lloyd Watkin
committed
Add tests for retrieval of node subscription count as owner/moderator
1 parent de94bb9 commit 77ca959

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

src/test/java/org/buddycloud/channelserver/db/jdbc/JDBCNodeStoreTest.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,21 +1371,50 @@ public void testCanRetrictNodeSubscriptionsCountWithRsm() throws Exception {
13711371
TEST_SERVER1_NODE1_ID, false, TEST_SERVER1_USER1_JID, 1);
13721372
assertEquals(1, result.size());
13731373
}
1374+
1375+
@Test
1376+
public void testCanRetrictNodeSubscriptionsCountForOwnerModeratorWithRsm() throws Exception {
1377+
1378+
dbTester.loadData("node_1");
1379+
// dbTester.loadData("node_2");
1380+
1381+
store.addUserSubscription(new NodeSubscriptionImpl(
1382+
TEST_SERVER1_NODE1_ID, TEST_SERVER1_USER2_JID,
1383+
Subscriptions.subscribed));
13741384

1385+
ResultSet<NodeSubscription> result = store.getNodeSubscriptions(
1386+
TEST_SERVER1_NODE1_ID, true, TEST_SERVER1_USER1_JID, 1);
1387+
assertEquals(1, result.size());
1388+
}
1389+
13751390
@Test
13761391
public void testCanGetCountOfNodeSubscriptions() throws Exception {
13771392
int affiliations = store.countNodeSubscriptions(TEST_SERVER1_NODE1_ID, false);
13781393
assertEquals(0, affiliations);
13791394
}
1395+
1396+
@Test
1397+
public void testCanGetCountOfNodeSubscriptionsForOwnerModerator() throws Exception {
1398+
int affiliations = store.countNodeSubscriptions(TEST_SERVER1_NODE1_ID, true);
1399+
assertEquals(0, affiliations);
1400+
}
13801401

13811402
@Test
13821403
public void testCanGetCountOfNodeSubscriptionsWithResults()
13831404
throws Exception {
13841405
dbTester.loadData("node_1");
1385-
int affiliations = store.countNodeSubscriptions(TEST_SERVER1_NODE1_ID, false);
1386-
assertEquals(4, affiliations);
1406+
int subscriptions = store.countNodeSubscriptions(TEST_SERVER1_NODE1_ID, false);
1407+
assertEquals(4, subscriptions);
13871408
}
13881409

1410+
@Test
1411+
public void testCanGetCountOfNodeSubscriptionsForOwnerModeratorWithResults()
1412+
throws Exception {
1413+
dbTester.loadData("node_1");
1414+
int subscriptions = store.countNodeSubscriptions(TEST_SERVER1_NODE1_ID, true);
1415+
assertEquals(5, subscriptions);
1416+
}
1417+
13891418
@Test
13901419
public void testIsCachedJidForCachedJid() throws Exception {
13911420
dbTester.loadData("node_1");

0 commit comments

Comments
 (0)