Package org.codehaus.swizzle.confluence

Examples of org.codehaus.swizzle.confluence.PageSummary


        // check that the page was added using getPages
        List pages = this.rpc.getPages(this.spaceKey);
        boolean found = false;
        for (int i = 0; i < pages.size() && !found; i++) {
            PageSummary summary = (PageSummary) pages.get(i);
            if (summary.getTitle().equals(title)) {
                found = true;
                assertEquals(this.spaceKey, summary.getSpace());
            }
        }
        assertTrue("Adding page failed. There should be a page entitled \"" + title + "\" in this space", found);

        // also check that the page was added using getPage
        Page page = this.rpc.getPage(id);
        assertEquals(id, page.getId());
        assertEquals(title, page.getTitle());
        assertEquals(this.spaceKey, page.getSpace());
        assertEquals(content, page.getContent());

        // modify the page
        String newContent = "Some Other Content";
        resultPage.setContent(newContent);
        Page modifiedPage = this.rpc.storePage(resultPage);

        // check that the page was modified
        assertEquals(id, modifiedPage.getId());
        assertEquals(title, modifiedPage.getTitle());
        assertEquals(this.spaceKey, modifiedPage.getSpace());
        assertEquals(newContent, modifiedPage.getContent());
        assertTrue(resultPage.getVersion() < modifiedPage.getVersion());

        // check again in a different way
        modifiedPage = this.rpc.getPage(id);
        assertEquals(id, modifiedPage.getId());
        assertEquals(title, modifiedPage.getTitle());
        assertEquals(this.spaceKey, modifiedPage.getSpace());
        assertEquals(newContent, modifiedPage.getContent());
        assertTrue(resultPage.getVersion() < modifiedPage.getVersion());

        // check page history
        List oldVersions = this.rpc.getPageHistory(id);
        assertEquals(2, oldVersions.size());

        PageHistorySummary phs0 = (PageHistorySummary) oldVersions.get(0);
        assertEquals(resultPage.getVersion(), phs0.getVersion());
        assertNotNull(phs0.getModified());
        assertNotNull(phs0.getId());

        Page page0 = this.rpc.getPage(phs0.getId());
        assertEquals(page.getContent(), page0.getContent());
        assertEquals(page.getVersion(), page0.getVersion());

        // search for the page
        // List searchResults = rpc.search(title, 1);
        // assertEquals(1, searchResults.size());
        // SearchResult searchResult = (SearchResult)searchResults.get(0);
        // assertEquals(id, searchResult.getId());
        // assertNotNull(searchResult.getExcerpt());
        // assertEquals(title, searchResult.getTitle());
        // assertEquals("page", searchResult.getType());
        // assertNotNull(searchResult.getUrl());

        // remove the page
        this.rpc.removePage(id);

        // check that the page was really removed
        pages = this.rpc.getPages(this.spaceKey);
        found = false;
        for (int i = 0; i < pages.size() && !found; i++) {
            PageSummary summary = (PageSummary) pages.get(i);
            assertFalse("Remove page failed. Page still present.", summary.getId().equals(id));
        }
    }
View Full Code Here


            // Only read pages from the Main space in this test since we're sure Guest users
            // are allowed to read them.
            if (key.equals("Main")) {
                List pages = rpc.getPages(key);
                for (int j = 0; j < pages.size(); j++) {
                    PageSummary pageSummary = (PageSummary) pages.get(j);
                    String id = pageSummary.getId();
                    rpc.getPage(id);
                }
            }
        }
    }
View Full Code Here

TOP

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

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.