Package org.jboss.seam.wiki.core.action

Examples of org.jboss.seam.wiki.core.action.DocumentHome


            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                docHome.getTextEditor().setValue("[=>http://foo.bar]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[=>http://foo.bar]");

                docHome.getTextEditor().setValue("[=>https://foo.bar]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[=>https://foo.bar]");

                docHome.getTextEditor().setValue("[=>ftp://foo.bar]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[=>ftp://foo.bar]");

                docHome.getTextEditor().setValue("[=>mailto:foo@bar.tld]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[=>mailto:foo@bar.tld]");

                docHome.getTextEditor().setValue("[Foo Bar=>http://foo.bar]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[Foo Bar=>http://foo.bar]");

                docHome.getTextEditor().setValue("[Foo Bar=>https://foo.bar]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[Foo Bar=>https://foo.bar]");

                docHome.getTextEditor().setValue("[Foo Bar=>ftp://foo.bar]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[Foo Bar=>ftp://foo.bar]");

                docHome.getTextEditor().setValue("[Foo Bar=>mailto:foo@bar.tld]");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                assert docHome.getInstance().getContent().equals("[Foo Bar=>mailto:foo@bar.tld]");

            }

        }.run();
    }
View Full Code Here


            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                WikiLinkResolver resolver = (WikiLinkResolver)getInstance("wikiLinkResolver");
                Map<String, WikiLink> links = new HashMap<String, WikiLink>();

                docHome.getTextEditor().setValue("[=>hhh://1234]");
                resolver.resolveLinkText(3l, links, "hhh://1234");
                assert links.size()==1;
                assert links.get("hhh://1234").getUrl().equals("http://opensource.atlassian.com/projects/hibernate/browse/HHH-1234");
            }
View Full Code Here

            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                WikiLinkResolver resolver = (WikiLinkResolver)getInstance("wikiLinkResolver");

                checkLink(resolver, 7l, "[=>Two]", "[=>wiki://7]");
                checkLink(resolver, 7l, "[Foo Bar=>Two]", "[Foo Bar=>wiki://7]");
View Full Code Here

            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                WikiLinkResolver resolver = (WikiLinkResolver)getInstance("wikiLinkResolver");

                final String FRAGMENT = "#foo123.,; baz -?!()/&";
View Full Code Here

            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                WikiLinkResolver resolver = (WikiLinkResolver)getInstance("wikiLinkResolver");

                checkLink(resolver, 30l, "[=>BBB|Test Image]", "[=>wiki://30]");
            }
View Full Code Here

            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                assert docHome.getInstance().getOutgoingLinks().size() == 0;
                docHome.getTextEditor().setValue("[=>Two] and [=>Three] and [=>BBB|Test Image]");

                assert invokeMethod("#{documentHome.update}").equals("updated");

                assert docHome.getInstance().getContent().equals("[=>wiki://7] and [=>wiki://8] and [=>wiki://30]");
                assert docHome.getInstance().getOutgoingLinks().size() == 3;

            }

        }.run();
View Full Code Here

            protected void beforeRequest() {
                setParameter("nodeId", "6");
            }

            protected void renderResponse() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                WikiDocument doc = docHome.getInstance();

                // Header
                doc.setHeader("[<=testMacro1[param1=value1]]\n[<=testMacro2]\nfoo");
                docHome.syncMacros(doc);
                assert doc.getHeaderMacros().size() == 2;
                assert doc.getHeaderMacrosString().contains("testMacro1");
                assert doc.getHeaderMacrosString().contains("testMacro2");
                assert doc.getHeader().contains("[<=testMacro1[param1=value1]]\n");
                assert doc.getHeader().contains("[<=testMacro2]\n");
View Full Code Here

            protected void beforeRequest() {
                setParameter("nodeId", "6");
            }

            protected void renderResponse() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                WikiDocument doc = (WikiDocument)getValue("#{currentDocument}");
                assert doc != null;
                assert doc.getId().equals(6l);

                assert doc.getRevision() == 3;

                assert docHome.isHistoricalFilesPresent();
                assert docHome.getHistoricalFiles().size() == 3;

                // Sorted by revision descending
                assert docHome.getHistoricalFiles().get(0).getRevision() == 2;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(0).getLastModifiedByUsername().equals("admin");
                assert docHome.getHistoricalFiles().get(0).getLastModifiedOn() != null;
                assert !docHome.getHistoricalFiles().get(0).getLastModifiedOn().equals(doc.getLastModifiedOn());

                assert docHome.getHistoricalFiles().get(1).getRevision() == 1;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(1).getLastModifiedByUsername().equals("guest");
                assert docHome.getHistoricalFiles().get(1).getLastModifiedOn() != null;
                assert !docHome.getHistoricalFiles().get(1).getLastModifiedOn().equals(doc.getLastModifiedOn());

                assert docHome.getHistoricalFiles().get(2).getRevision() == 0;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(2).getLastModifiedByUsername().equals("admin");
                assert docHome.getHistoricalFiles().get(2).getLastModifiedOn() == null;
            }

        }.run();
    }
View Full Code Here

            protected void beforeRequest() {
                setParameter("cid", conversationId);
            }

            protected void invokeApplication() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                docHome.getInstance().setName("Test Name");
                docHome.getTextEditor().setValue("Test Content");

                assert invokeMethod("#{documentHome.persist}").equals("persisted");

            }
View Full Code Here

            }

            protected void invokeApplication() throws Exception {
                assert Conversation.instance().isLongRunning();

                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                docHome.syncInstanceToEditor(docHome.getParentNode().getId(), docHome.getInstance());
                docHome.getTextEditor().setValue("New text");
                docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
                docHome.setMinorRevision(false);

                assert invokeMethod("#{documentHome.update}").equals("updated");
            }

        }.run();

        new NonFacesRequest("/wiki.xhtml") {

            protected void beforeRequest() {
                setParameter("nodeId", "6");
            }

            protected void renderResponse() throws Exception {
                DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
                assert docHome.getInstance().getId().equals(6l); // Init!

                assert docHome.isHistoricalFilesPresent();
                assert docHome.getHistoricalFiles().size() == 4;

                // Sorted by revision descending
                assert docHome.getHistoricalFiles().get(0).getRevision() == 3;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(0).getLastModifiedByUsername().equals("admin");
                assert docHome.getHistoricalFiles().get(0).getLastModifiedOn() != null;

                assert docHome.getHistoricalFiles().get(1).getRevision() == 2;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(1).getLastModifiedByUsername().equals("admin");
                assert docHome.getHistoricalFiles().get(1).getLastModifiedOn() != null;

                assert docHome.getHistoricalFiles().get(2).getRevision() == 1;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(2).getLastModifiedByUsername().equals("guest");
                assert docHome.getHistoricalFiles().get(2).getLastModifiedOn() != null;

                assert docHome.getHistoricalFiles().get(3).getRevision() == 0;
                assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
                assert docHome.getHistoricalFiles().get(3).getLastModifiedByUsername().equals("admin");
                assert docHome.getHistoricalFiles().get(3).getLastModifiedOn() == null;
            }

        }.run();
    }
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.core.action.DocumentHome

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.