}
public void testPublishBlogEntryNowAndCheckCommentsReindexed() throws Exception {
blog.getPluginProperties().setProperty(IpAddressListener.WHITELIST_KEY, "127.0.0.1");
BlogService service = new BlogService();
BlogEntry blogEntry = new BlogEntry(blog);
blogEntry.setDate(new Date(100000));
blogEntry.setPublished(false);
service.putBlogEntry(blogEntry);
Comment comment = blogEntry.createComment("title", "body", "author", "email", "website", "avatar", "127.0.0.1");
blogEntry.addComment(comment);
service.putBlogEntry(blogEntry);
String commentId = comment.getGuid();
assertTrue(blog.getResponseIndex().getApprovedResponses().contains(commentId));
// now execute the action
request.setParameter("entry", blogEntry.getId());
request.setParameter("publishDate", "now");
request.setParameter("submit", "Publish");
View view = action.process(request, response);
blogEntry = (BlogEntry)blog.getRecentBlogEntries(1).get(0);
assertTrue(blogEntry.isPublished());
assertEquals(new Date().getTime(), blogEntry.getDate().getTime(), 1000);
// check that the original comment has been unindexed
assertFalse(blog.getResponseIndex().getApprovedResponses().contains(commentId));
assertTrue(blog.getResponseIndex().getApprovedResponses().contains(blogEntry.getComments().get(0).getGuid()));
}