Package org.codehaus.swizzle.confluence

Examples of org.codehaus.swizzle.confluence.Comment


        // no id in pageProperties means storePage will add
        Page resultPage = rpc.storePage(p);
        pageId = resultPage.getId();

        // add and remove one comment (makes test more realistic)
        Comment comment = new Comment();
        comment.setPageId(pageId);
        comment.setContent("Dummy Comment");
        Comment commentResult = rpc.addComment(comment);
        rpc.removeComment(commentResult.getId());
    }
View Full Code Here


    {
        // first check that the page has no comments
        assertEquals(0, rpc.getComments(pageId).size());

        // then add some comments
        Comment comment = new Comment();
        comment.setPageId(pageId);
        comment.setContent("Comment1");
        Comment c1 = rpc.addComment(comment);
        assertNotNull(c1.getId());
        assertEquals(pageId, c1.getPageId());
        assertEquals("Comment1", c1.getContent());
        assertNotNull(c1.getUrl());
        comment.setContent("Comment2");
        Comment c2 = rpc.addComment(comment);
        assertNotNull(c2.getId());
        assertEquals(pageId, c2.getPageId());
        assertEquals("Comment2", c2.getContent());
        assertNotNull(c2.getUrl());

        // check that the page has the comments
        assertEquals(2, rpc.getComments(pageId).size());
        Comment c11 = rpc.getComment(c1.getId());
        assertEquals(c1.getId(), c11.getId());
        assertEquals(c1.getTitle(), c11.getTitle());
        assertEquals(c1.getPageId(), c11.getPageId());
        assertEquals(c1.getContent(), c11.getContent());
        assertEquals(c1.getCreated(), c11.getCreated());
        assertEquals(c1.getCreator(), c11.getCreator());
        assertEquals(c1.getUrl(), c11.getUrl());
        Comment c22 = rpc.getComment(c2.getId());
        assertEquals(c2.getId(), c22.getId());
        assertEquals(c2.getTitle(), c22.getTitle());
        assertEquals(c2.getPageId(), c22.getPageId());
        assertEquals(c2.getContent(), c22.getContent());
        assertEquals(c2.getCreated(), c22.getCreated());
        assertEquals(c2.getCreator(), c22.getCreator());
        assertEquals(c2.getUrl(), c22.getUrl());

        // delete 1st comment
        assertTrue(rpc.removeComment(c1.getId()));
        // check that 1st comment is still there
        assertEquals(1, rpc.getComments(pageId).size());
View Full Code Here

    }

    public void testAddComment() throws Exception
    {
        String content = String.format("This is a new comment!!! %s", random.nextInt());
        Comment comment = new Comment();
        comment.setPageId(TestConstants.TEST_PAGE_WITH_COMMENTS);
        comment.setContent(content);

        comment = rpc.addComment(comment);
        TestUtils.banner("TEST: getComments()");
        System.out.format("%s\n", comment);

        assertNotSame("NEW", comment.getId());
        assertEquals(content, comment.getContent());
        assertEquals(String.format("XWiki.%s", TestConstants.USERNAME), comment.getCreator());
    }
View Full Code Here

    }

    public void testRemoveComment() throws Exception
    {
        List<Comment> comments = rpc.getComments(TestConstants.TEST_PAGE_WITH_COMMENTS);
        Comment comment = comments.get(random.nextInt(comments.size()));

        Boolean result = rpc.removeComment(comment.getId());
        TestUtils.banner("TEST: removeComment()");
        System.out.format("Comment removed = %b\n", result);

        comments = rpc.getComments(TestConstants.TEST_PAGE_WITH_COMMENTS);
        boolean found = false;
        for (Comment c : comments) {
            if (c.getId().equals(comment.getId())) {
                found = true;
                break;
            }
        }
View Full Code Here

        addComment("This is the first comment.");
    }

    private Comment addComment(String content) throws Exception
    {
        Comment comment = new Comment();
        comment.setPageId(TestConstants.TEST_PAGE_WITH_COMMENTS);
        comment.setContent(content);
        return rpc.addComment(comment);
    }
View Full Code Here

    }

    public void testAddComment() throws Exception
    {
        String content = String.format("This is a new comment!!! %s", random.nextInt());
        Comment comment = addComment(content);

        TestUtils.banner("TEST: getComments()");
        System.out.format("%s\n", comment);

        assertNotSame("NEW", comment.getId());
        assertEquals(content, comment.getContent());
        assertEquals(String.format("XWiki.%s", TestConstants.USERNAME), comment.getCreator());
    }
View Full Code Here

    }

    public void testRemoveComment() throws Exception
    {
        List<Comment> comments = rpc.getComments(TestConstants.TEST_PAGE_WITH_COMMENTS);
        Comment comment = comments.get(random.nextInt(comments.size()));

        Boolean result = rpc.removeComment(comment.getId());
        TestUtils.banner("TEST: removeComment()");
        System.out.format("Comment removed = %b\n", result);

        comments = rpc.getComments(TestConstants.TEST_PAGE_WITH_COMMENTS);
        boolean found = false;
        for (Comment c : comments) {
            if (c.getId().equals(comment.getId())) {
                found = true;
                break;
            }
        }
View Full Code Here

        // no id in pageProperties means storePage will add
        Page resultPage = rpc.storePage(p);
        pageId = resultPage.getId();

        // add and remove one comment (makes test more realistic)
        Comment comment = new Comment();
        comment.setPageId(pageId);
        comment.setContent("Dummy Comment");
        Comment commentResult = rpc.addComment(comment);
        rpc.removeComment(commentResult.getId());
    }
View Full Code Here

    {
        // first check that the page has no comments
        assertEquals(0, rpc.getComments(pageId).size());

        // then add some comments
        Comment comment = new Comment();
        comment.setPageId(pageId);
        comment.setContent("Comment1");
        Comment c1 = rpc.addComment(comment);
        assertNotNull(c1.getId());
        assertEquals(pageId, c1.getPageId());
        assertEquals("Comment1", c1.getContent());
        assertNotNull(c1.getUrl());
        comment.setContent("Comment2");
        Comment c2 = rpc.addComment(comment);
        assertNotNull(c2.getId());
        assertEquals(pageId, c2.getPageId());
        assertEquals("Comment2", c2.getContent());
        assertNotNull(c2.getUrl());

        // check that the page has the comments
        assertEquals(2, rpc.getComments(pageId).size());
        Comment c11 = rpc.getComment(c1.getId());
        assertEquals(c1.getId(), c11.getId());
        assertEquals(c1.getTitle(), c11.getTitle());
        assertEquals(c1.getPageId(), c11.getPageId());
        assertEquals(c1.getContent(), c11.getContent());
        assertEquals(c1.getCreated(), c11.getCreated());
        assertEquals(c1.getCreator(), c11.getCreator());
        assertURLEquals(c1.getUrl(), c11.getUrl());
        Comment c22 = rpc.getComment(c2.getId());
        assertEquals(c2.getId(), c22.getId());
        assertEquals(c2.getTitle(), c22.getTitle());
        assertEquals(c2.getPageId(), c22.getPageId());
        assertEquals(c2.getContent(), c22.getContent());
        assertEquals(c2.getCreated(), c22.getCreated());
        assertEquals(c2.getCreator(), c22.getCreator());
        assertURLEquals(c2.getUrl(), c22.getUrl());

        // delete 1st comment
        assertTrue(rpc.removeComment(c1.getId()));
        // check that 1st comment is still there
        assertEquals(1, rpc.getComments(pageId).size());
View Full Code Here

TOP

Related Classes of org.codehaus.swizzle.confluence.Comment

Copyright © 2018 www.massapicom. 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.