/**
* Test lookup mechanisms ...
*/
public void testCommentLookups() throws Exception {
WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
List comments = null;
// we need some comments to play with
CommentData comment1 = TestUtils.setupComment("comment1", testEntry);
CommentData comment2 = TestUtils.setupComment("comment2", testEntry);
CommentData comment3 = TestUtils.setupComment("comment3", testEntry);
TestUtils.endSession(true);
// get all comments
comments = null;
comments = mgr.getComments(null, null, null, null, null, null, null, null, false, 0, -1);
assertNotNull(comments);
assertEquals(3, comments.size());
// get all comments for entry
comments = null;
comments = mgr.getComments(null, testEntry, null, null, null, null, null, null, false, 0, -1);
assertNotNull(comments);
assertEquals(3, comments.size());
// make some changes
comment3.setPending(Boolean.TRUE);
comment3.setApproved(Boolean.FALSE);
mgr.saveComment(comment3);
// get pending comments
comments = null;
comments = mgr.getComments(null, null, null, null, null, Boolean.TRUE, null, null, false, 0, -1);
assertNotNull(comments);
assertEquals(1, comments.size());
// get approved comments
comments = null;
comments = mgr.getComments(null, null, null, null, null, null, Boolean.TRUE, null, false, 0, -1);
assertNotNull(comments);
assertEquals(2, comments.size());
// get comments with offset
comments = null;
comments = mgr.getComments(null, null, null, null, null, null, null, null, false, 1, -1);
assertNotNull(comments);
assertEquals(2, comments.size());
// remove test comments
TestUtils.teardownComment(comment1.getId());