ALF-9153 Discussions Topic Finding (lucene based) on the Java Service for getting topics by tag

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29890 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-18 16:11:40 +00:00
parent 6172585955
commit 53778ee973
4 changed files with 190 additions and 1 deletions

View File

@@ -546,6 +546,8 @@ public class DiscussionServiceImplTest
{
PagingResults<TopicInfo> topics;
PagingResults<PostInfo> posts;
final String TAG_1 = "topic_tag_one";
final String TAG_2 = "topic_tag_two";
// To start with, there will be no topics
@@ -581,6 +583,46 @@ public class DiscussionServiceImplTest
assertEquals("NT2", topics.getPage().get(1).getTitle());
assertEquals("NT3", topics.getPage().get(2).getTitle());
// Add tags to a few
siteT2.getTags().add(TAG_1);
nodeT2.getTags().add(TAG_1);
nodeT2.getTags().add(TAG_2);
nodeT3.getTags().add(TAG_1);
DISCUSSION_SERVICE.updateTopic(siteT2);
DISCUSSION_SERVICE.updateTopic(nodeT2);
DISCUSSION_SERVICE.updateTopic(nodeT3);
// Find without tags
topics = DISCUSSION_SERVICE.findTopics(DISCUSSION_SITE.getShortName(), null, new PagingRequest(10));
assertEquals(2, topics.getPage().size());
assertEquals("ST1", topics.getPage().get(0).getTitle());
assertEquals("ST2", topics.getPage().get(1).getTitle());
topics = DISCUSSION_SERVICE.findTopics(FORUM_NODE, null, new PagingRequest(10));
assertEquals(3, topics.getPage().size());
assertEquals("NT1", topics.getPage().get(0).getTitle());
assertEquals("NT2", topics.getPage().get(1).getTitle());
assertEquals("NT3", topics.getPage().get(2).getTitle());
// Find with tags
topics = DISCUSSION_SERVICE.findTopics(DISCUSSION_SITE.getShortName(), TAG_1, new PagingRequest(10));
assertEquals(1, topics.getPage().size());
assertEquals("ST2", topics.getPage().get(0).getTitle());
topics = DISCUSSION_SERVICE.findTopics(FORUM_NODE, TAG_1, new PagingRequest(10));
assertEquals(2, topics.getPage().size());
assertEquals("NT2", topics.getPage().get(0).getTitle());
assertEquals("NT3", topics.getPage().get(1).getTitle());
topics = DISCUSSION_SERVICE.findTopics(DISCUSSION_SITE.getShortName(), TAG_2, new PagingRequest(10));
assertEquals(0, topics.getPage().size());
topics = DISCUSSION_SERVICE.findTopics(FORUM_NODE, TAG_2, new PagingRequest(10));
assertEquals(1, topics.getPage().size());
assertEquals("NT2", topics.getPage().get(0).getTitle());
// Alter the creation date on a couple, see the ordering change
pushAuditableDatesBack(siteT2, 2, 2);