Examples of WeblogEntryComment


Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

        List<String> approvedList = new ArrayList();
        List<String> spamList = new ArrayList();
       
        Iterator it = comments.iterator();
        while (it.hasNext()) {
            WeblogEntryComment comment = (WeblogEntryComment)it.next();
            allComments.add(comment.getId());
           
            if(WeblogEntryComment.APPROVED.equals(comment.getStatus())) {
                approvedList.add(comment.getId());
            } else if(WeblogEntryComment.SPAM.equals(comment.getStatus())) {
                spamList.add(comment.getId());
            }
        }
       
        // list of ids we are working on
        String[] idArray = (String[]) allComments.toArray(new String[allComments.size()]);
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

        WeblogEntry entry4 = TestUtils.setupWeblogEntry("entry4",
                testWeblog.getDefaultCategory(), blog2, user1);
        WeblogEntry entry5 = TestUtils.setupWeblogEntry("entry5",
                testWeblog.getDefaultCategory(), blog2, user1);
              
        WeblogEntryComment comment1 = TestUtils.setupComment("comment1", entry1);
        WeblogEntryComment comment2 = TestUtils.setupComment("comment2", entry1);
       
        WeblogEntryComment comment3 = TestUtils.setupComment("comment3", entry3);
        WeblogEntryComment comment4 = TestUtils.setupComment("comment4", entry3);
        WeblogEntryComment comment5 = TestUtils.setupComment("comment5", entry3);
        TestUtils.endSession(true);

        try {
            blog1 = umgr.getWebsite(blog1.getId());
            blog2 = umgr.getWebsite(blog2.getId());
           
            assertEquals(2L, blog1.getEntryCount());
            assertEquals(3L, blog2.getEntryCount());
            assertEquals(5L, wmgr.getEntryCount());

            assertEquals(2L, blog1.getCommentCount());
            assertEquals(3L, blog2.getCommentCount());
            assertEquals(5L, wmgr.getCommentCount());

            assertEquals(4L, umgr.getWeblogCount());
            assertEquals(2L, umgr.getUserCount());
           
        } finally {
           
            TestUtils.teardownComment(comment1.getId());
            TestUtils.teardownComment(comment2.getId());
            TestUtils.teardownComment(comment3.getId());
            TestUtils.teardownComment(comment4.getId());
            TestUtils.teardownComment(comment5.getId());

            TestUtils.teardownWeblogEntry(entry1.getId());
            TestUtils.teardownWeblogEntry(entry2.getId());
            TestUtils.teardownWeblogEntry(entry3.getId());
            TestUtils.teardownWeblogEntry(entry4.getId());
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

            log.debug("Sending notification email to all subscribers");
           
            // Get all the subscribers to this comment thread
            List comments = entry.getComments(true, true);
            for (Iterator it = comments.iterator(); it.hasNext();) {
                WeblogEntryComment comment = (WeblogEntryComment) it.next();
                if (!StringUtils.isEmpty(comment.getEmail())) {
                    // If user has commented twice,
                    // count the most recent notify setting
                    if (comment.getNotify().booleanValue()) {
                        // only add those with valid email
                        if (comment.getEmail().matches(EMAIL_ADDR_REGEXP)) {
                            subscribers.add(comment.getEmail());
                        }
                    } else {
                        // remove user who doesn't want to be notified
                        subscribers.remove(comment.getEmail());
                    }
                }
            }
        } else {
            log.debug("Sending notification email only to weblog owner");
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

        List comments = getComments(
                website, entry, searchString, startDate, endDate,
                status, true, 0, -1);
        int count = 0;
        for (Iterator it = comments.iterator(); it.hasNext();) {
            WeblogEntryComment comment = (WeblogEntryComment) it.next();
            removeComment(comment);
            count++;
        }
        return count;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

     * Convenience method for creating a comment.
     */
    public static WeblogEntryComment setupComment(String content, WeblogEntry entry)
            throws Exception {
       
        WeblogEntryComment testComment = new WeblogEntryComment();
        testComment.setName("test");
        testComment.setEmail("test");
        testComment.setUrl("test");
        testComment.setRemoteHost("foofoo");
        testComment.setContent("this is a test comment");
        testComment.setPostTime(new java.sql.Timestamp(new java.util.Date().getTime()));
        testComment.setWeblogEntry(getManagedWeblogEntry(entry));
        testComment.setStatus(WeblogEntryComment.APPROVED);
       
        // store testComment
        WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
        mgr.saveComment(testComment);
       
        // flush to db
        WebloggerFactory.getWeblogger().flush();
       
        // query for object
        WeblogEntryComment comment = mgr.getComment(testComment.getId());
       
        if(comment == null)
            throw new WebloggerException("error setting up comment");
       
        return comment;
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

     */
    public static void teardownComment(String id) throws Exception {
       
        // lookup the comment
        WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
        WeblogEntryComment comment = mgr.getComment(id);
       
        // remove the comment
        mgr.removeComment(comment);
       
        // flush to db
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

        TestUtils.teardownUser(user.getId());
    }
   
    public void testExcessSizeCommentValidator() {
        RollerMessages msgs = new RollerMessages();
        WeblogEntryComment comment = createEmptyComment();

        // string that exceeds default excess size threshold of 1000
        StringBuffer sb = new StringBuffer();
        for (int i=0; i<101; i++) {
            sb.append("0123456789");
        }
       
        comment.setContent("short stuff");
        assertEquals(100, mgr.validateComment(comment, msgs));

        comment.setContent(sb.toString());
        assertTrue(mgr.validateComment(comment, msgs) != 100);
    }
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

        assertTrue(mgr.validateComment(comment, msgs) != 100);
    }
   
    public void testExcessLinksCommentValidator() {
        RollerMessages msgs = new RollerMessages();
        WeblogEntryComment comment = createEmptyComment();
       
        comment.setContent("<a href=\"http://example.com\">link1</a>");
        assertEquals(100, mgr.validateComment(comment, msgs));

        // String that exceeds default excess links threshold of 3
        comment.setContent(
            "<a href=\"http://example.com\">link1</a>" +
            "<a href=\"http://example.com\">link2</a>" +
            "<a href=\"http://example.com\">link3</a>" +
            "<a href=\"http://example.com\">link4</a>" +
            "<a href=\"http://example.com\">link5</a>"
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

        assertTrue(mgr.validateComment(comment, msgs) != 100);       
    }
   
    public void testBlacklistCommentValidator() {
        RollerMessages msgs = new RollerMessages();
        WeblogEntryComment comment = createEmptyComment();
      
        comment.setContent("nice friendly stuff");
        assertEquals(100, mgr.validateComment(comment, msgs));

        comment.setContent("blah blah 01-suonerie.com blah");
        assertTrue(mgr.validateComment(comment, msgs) != 100);
   
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.WeblogEntryComment

//        comment.setName("viagra-test-123");
//        assertTrue(mgr.validateComment(comment, msgs) != 100);
//    }
   
    private WeblogEntryComment createEmptyComment() {
        WeblogEntryComment comment = new WeblogEntryComment();
        comment.setUrl("http://example.com");
        comment.setName("Mortimer Snerd");
        comment.setEmail("mortimer@snerd.com");
        comment.setWeblogEntry(entry);
        return comment;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.