mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/DEV/BELARUS/HEAD-2011_10_05 to HEAD:
31291: ALF-9460 : Archived discussion posts break display of the discussed node when users do not have access to the trash can git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31303 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,7 @@ import org.alfresco.service.cmr.discussion.DiscussionService;
|
||||
import org.alfresco.service.cmr.discussion.PostInfo;
|
||||
import org.alfresco.service.cmr.discussion.PostWithReplies;
|
||||
import org.alfresco.service.cmr.discussion.TopicInfo;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
@@ -1639,6 +1640,62 @@ public class DiscussionServiceImplTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that "fm:post" content is not archived.
|
||||
*/
|
||||
@Test public void alf_9460()
|
||||
{
|
||||
TopicInfo siteTopic;
|
||||
TopicInfo nodeTopic;
|
||||
PostInfo post;
|
||||
PostInfo reply;
|
||||
|
||||
// Nothing to start with
|
||||
PagingResults<TopicInfo> results =
|
||||
DISCUSSION_SERVICE.listTopics(DISCUSSION_SITE.getShortName(), true, new PagingRequest(10));
|
||||
assertEquals(0, results.getPage().size());
|
||||
|
||||
results = DISCUSSION_SERVICE.listTopics(FORUM_NODE, true, new PagingRequest(10));
|
||||
assertEquals(0, results.getPage().size());
|
||||
|
||||
|
||||
// Create two topics, one node and one site based
|
||||
siteTopic = DISCUSSION_SERVICE.createTopic(DISCUSSION_SITE.getShortName(), "Site Title");
|
||||
nodeTopic = DISCUSSION_SERVICE.createTopic(FORUM_NODE, "Node Title");
|
||||
|
||||
testNodesToTidy.add(siteTopic.getNodeRef());
|
||||
testNodesToTidy.add(nodeTopic.getNodeRef());
|
||||
|
||||
for (TopicInfo topic : new TopicInfo[] {siteTopic, nodeTopic})
|
||||
{
|
||||
// Create the first post
|
||||
String contents = "This Is Some Content";
|
||||
post = DISCUSSION_SERVICE.createPost(topic, contents);
|
||||
|
||||
// Add a reply
|
||||
String reply1Contents = "Reply Contents";
|
||||
reply = DISCUSSION_SERVICE.createReply(post, reply1Contents);
|
||||
|
||||
List<AssociationRef> assocs = NODE_SERVICE.getTargetAssocs(reply.getNodeRef(), ContentModel.ASSOC_REFERENCES);
|
||||
|
||||
// check that reply has an association with original post
|
||||
assertNotNull(assocs);
|
||||
assertEquals(1, assocs.size());
|
||||
assertEquals(post.getNodeRef(), assocs.get(0).getTargetRef());
|
||||
|
||||
// delete the original post
|
||||
DISCUSSION_SERVICE.deletePost(post);
|
||||
|
||||
// check that post was deleted
|
||||
assertFalse(NODE_SERVICE.exists(post.getNodeRef()));
|
||||
|
||||
// check that associations to the original post was also deleted
|
||||
assocs = NODE_SERVICE.getTargetAssocs(reply.getNodeRef(), ContentModel.ASSOC_REFERENCES);
|
||||
assertNotNull(assocs);
|
||||
assertEquals(0, assocs.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user