ALF-9153 Avoid fetching too much un-used data when rendering a Discussions Topic to JSON with the reply count

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29773 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-15 16:44:47 +00:00
parent f7e691b593
commit 4f59c0b4eb
3 changed files with 63 additions and 1 deletions

View File

@@ -246,6 +246,8 @@ public class DiscussionServiceImplTest
// The topic has no primary post
assertEquals(null, DISCUSSION_SERVICE.getPrimaryPost(topic));
// Which means no recent post
assertEquals(null, DISCUSSION_SERVICE.getMostRecentPost(topic));
// Get with an arbitrary name gives nothing
@@ -288,6 +290,10 @@ public class DiscussionServiceImplTest
// Topic will now have a primary post
assertNotNull(DISCUSSION_SERVICE.getPrimaryPost(topic));
assertEquals(post.getNodeRef(), DISCUSSION_SERVICE.getPrimaryPost(topic).getNodeRef());
// The new post will be the most recent one
assertNotNull(DISCUSSION_SERVICE.getMostRecentPost(topic));
assertEquals(post.getNodeRef(), DISCUSSION_SERVICE.getMostRecentPost(topic).getNodeRef());
// Topic will now have one post listed
@@ -355,6 +361,15 @@ public class DiscussionServiceImplTest
assertNotNull(objects);
assertEquals(topic.getNodeRef(), objects.getFirst().getNodeRef());
assertEquals(reply1.getNodeRef(), objects.getSecond().getNodeRef());
// The primary post will be unchanged
assertNotNull(DISCUSSION_SERVICE.getPrimaryPost(topic));
assertEquals(post.getNodeRef(), DISCUSSION_SERVICE.getPrimaryPost(topic).getNodeRef());
// But the most recent will be the newest reply
assertNotNull(DISCUSSION_SERVICE.getMostRecentPost(topic));
assertEquals(reply2.getNodeRef(), DISCUSSION_SERVICE.getMostRecentPost(topic).getNodeRef());
// Check the overall count now