Package org.codehaus.swizzle.confluence

Examples of org.codehaus.swizzle.confluence.Page


        return (page.getParentId() != null) ? getPage(confluence, page.getParentId()) : null;
    }

    private Page createPage(String pageTitle) {
        System.out.println("Creating page [" + pageTitle + "]...");
        Page page = new Page();
        page.setSpace(this.confluenceSpace);
        page.setTitle(pageTitle);
        page.setContent("{children}\n");
        return page;
    }
View Full Code Here


        if (validate(username) && validate(password)) {
            try {
                final String endpoint = "https://cwiki.apache.org/confluence/rpc/xmlrpc";
                final Confluence confluence = new Confluence(endpoint);
                confluence.login(username, password);
                final Page page = confluence.getPage("OPENEJB", "Validation Keys Audit Report");
                page.setContent(confluenceOutput);
                confluence.storePage(page);
                confluence.logout();
            } catch (final Exception e) {
                e.printStackTrace();
            }
View Full Code Here

        String endpoint = "http://docs.codehaus.org/rpc/xmlrpc";

        Confluence confluence = new Confluence(endpoint);
        confluence.login(username, password);

        Page page = confluence.getPage("SWIZZLE", "Test Page");

        page.setContent("This is the new content for the the test");

        confluence.storePage(page);

        confluence.logout();
    }
View Full Code Here

        } catch (Exception e) {
            // Now we throw exception if the space already exists
        }

        pageTitle = "SomeContainerPage";
        Page p = new Page();
        p.setSpace(spaceKey);
        p.setTitle(pageTitle);
        p.setContent("");
        // 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");
View Full Code Here

        space.setName("Some Name");

        rpc.addSpace(space);

        String pageTitle = "SomePage";
        Page p = new Page();
        p.setSpace(spaceKey);
        p.setTitle(pageTitle);
        p.setContent("Dummy Comment");
        Page resultPage = rpc.storePage(p);
        pageId = resultPage.getId();
    }
View Full Code Here

    {
        String title = "SomeNewPage";
        String content = "Some Content";

        // add the page
        Page p = new Page();
        p.setSpace(this.spaceKey);
        p.setTitle(title);
        p.setContent(content);
        // no id in p means storePage will add
        Page resultPage = this.rpc.storePage(p);

        String id = resultPage.getId();

        assertEquals(title, resultPage.getTitle());
        assertEquals(this.spaceKey, resultPage.getSpace());
        assertEquals(content, resultPage.getContent());
        assertNotNull(id);

        // 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);
View Full Code Here

    {
        String title = "SomeOtherPage";
        String content1 = "Content v1";

        // add the page
        Page p = new Page();
        p.setSpace(this.spaceKey);
        p.setTitle(title);
        p.setContent(content1);
        p.setParentId("Main.WebHome");
        Page page1 = this.rpc.storePage(p);

        // modify the page
        String content2 = "Content v2";
        p.setContent(content2);
        p.setId(page1.getId());
        p.setVersion(page1.getVersion());
        Page page2 = this.rpc.storePage(p);

        // modify the page again
        String content3 = "Content v3";
        p.setContent(content3);
        p.setId(page2.getId());
        p.setVersion(page2.getVersion());
        Page page3 = this.rpc.storePage(p);

        // get page history
        List historyObjs = this.rpc.getPageHistory(page3.getId());
        assertEquals(3, historyObjs.size());
        PageHistorySummary phs1 = (PageHistorySummary) historyObjs.get(1);
        assertEquals(page1.getVersion() + 1, phs1.getVersion());

        // This ensures that getting the page from XmlRpc uses the date of the version, and not the current date
        // See XWIKI-2821
        Thread.sleep(2000);

        Page p1 = this.rpc.getPage(phs1.getId());
        assertEquals(page2.getVersion(), p1.getVersion());
        assertEquals(page2.getContent(), p1.getContent());
        assertEquals(page2.getCreated(), p1.getCreated());
        assertEquals(page2.getCreator(), p1.getCreator());
        assertEquals(page2.getModified(), p1.getModified());
        assertEquals(page2.getModifier(), p1.getModifier());
        assertEquals(page2.getParentId(), p1.getParentId());
       
        assertEquals(page2.getSpace(), p1.getSpace());
        assertEquals(page2.getTitle(), p1.getTitle());
        // assertFalse(page2.getUrl().equals(p1.getUrl()));

        PageHistorySummary phs2 = (PageHistorySummary) historyObjs.get(0);
        // assertEquals(page3.getVersion(), phs2.getVersion());
        Page p2 = this.rpc.getPage(phs2.getId());
        // assertEquals(page3.getVersion(), p2.getVersion());
        // assertEquals(page3.getContent(), p2.getContent());
        // assertEquals(page3.getCreated(), p2.getCreated());
        // assertEquals(page3.getCreator(), p2.getCreator());
        // assertEquals(page3.getModified(), p2.getModified());
        // assertEquals(page3.getModifier(), p2.getModifier());
        // assertEquals(page3.getParentId(), p2.getParentId());
        // assertEquals(page3.getSpace(), p2.getSpace());
        // assertEquals(page3.getTitle(), p2.getTitle());
        // assertFalse(page3.getUrl().equals(p2.getUrl()));

        // get history of page from history
        // confluence does not allow this
        // ("This is not the most recent version of this page")
        historyObjs = this.rpc.getPageHistory(p2.getId());
        // assertEquals(1, historyObjs.size());
        phs1 = (PageHistorySummary) historyObjs.get(0);
        assertEquals(page1.getVersion(), phs1.getVersion());
        p1 = this.rpc.getPage(phs1.getId());
        assertEquals(page1.getVersion(), p1.getVersion());
View Full Code Here

        if (validate(username) && validate(password)) {
            try {
                final String endpoint = "https://cwiki.apache.org/confluence/rpc/xmlrpc";
                final Confluence confluence = new Confluence(endpoint);
                confluence.login(username, password);
                final Page page = confluence.getPage("OPENEJB", "Validation Keys Audit Report");
                page.setContent(confluenceOutput);
                confluence.storePage(page);
                confluence.logout();
            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here

        if (validate(username) && validate(password)) {
            try {
                String endpoint = "https://cwiki.apache.org/confluence/rpc/xmlrpc";
                Confluence confluence = new Confluence(endpoint);
                confluence.login(username, password);
                Page page = confluence.getPage("OPENEJB", "Validation Keys Audit Report");
                page.setContent(confluenceOutput);
                confluence.storePage(page);
                confluence.logout();
            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here

        if (validate(username) && validate(password)) {
            try {
                final String endpoint = "https://cwiki.apache.org/confluence/rpc/xmlrpc";
                final Confluence confluence = new Confluence(endpoint);
                confluence.login(username, password);
                final Page page = confluence.getPage("OPENEJB", "Validation Keys Audit Report");
                page.setContent(confluenceOutput);
                confluence.storePage(page);
                confluence.logout();
            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here

TOP

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

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.