Package org.jboss.seam.wiki.core.dao

Examples of org.jboss.seam.wiki.core.dao.WikiNodeDAO


    @Test
    public void findFaqRoot() throws Exception {
        new FacesRequest() {
            protected void invokeApplication() throws Exception {
                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);

                FaqBrowserDAO dao = (FaqBrowserDAO)getInstance(FaqBrowserDAO.class);

                // Start in a subdirectory of the FAQ root
                WikiDirectory faqSubDir = nodeDAO.findWikiDirectory(302l);
                WikiDirectory root = dao.findFaqRootDir(faqSubDir);
                assert root.getId().equals(300l);

                // Start in the root directory (should be the same)
                WikiDirectory faqDir = nodeDAO.findWikiDirectory(300l);
                root = dao.findFaqRootDir(faqDir);
                assert root.getId().equals(300l);

            }
        }.run();
View Full Code Here


        loginAdmin();

        final String conversationId = new FacesRequest() {

            protected void updateModelValues() throws Exception {
                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory forumDir = nodeDAO.findWikiDirectory(100l);
                Contexts.getPageContext().set("currentDirectory", forumDir);
            }

            protected void invokeApplication() throws Exception {
                ForumHome home = (ForumHome)getInstance(ForumHome.class);
                home.newForum();
            }
        }.run();

        new FacesRequest() {

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

            protected void updateModelValues() throws Exception {
                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory forumDir = nodeDAO.findWikiDirectory(100l);
                Contexts.getPageContext().set("currentDirectory", forumDir);
            }

            protected void invokeApplication() throws Exception {
                ForumHome home = (ForumHome)getInstance(ForumHome.class);

                home.getInstance().setName("New Forum");
                home.getInstance().setDescription("This is a new forum");

                assert invokeMethod("#{forumHome.persist}") == null;
            }

            protected void renderResponse() throws Exception {
                Long newId = (Long)getValue("#{forumHome.instance.id}");

                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory newForum = nodeDAO.findWikiDirectory(newId);

                assert newForum.getAreaNumber().equals(100l);

                assert newForum.getFeed() != null;
View Full Code Here

    @Test
    public void findSiblings() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDocument d = dao.findWikiDocument(6l);
                assert d.getName().equals("One");

                assert dao.findSiblingWikiDocumentInDirectory(d, WikiNode.SortableProperty.createdOn, true) == null;
                assert dao.findSiblingWikiDocumentInDirectory(d, WikiNode.SortableProperty.createdOn, false).getId().equals(7l);
            }
        }.run();
    }
View Full Code Here

    @Test
    public void findWikiDirectoryTree() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);

                WikiDirectory root = dao.findWikiDirectory(1l);
                List<WikiTreeNode<WikiDirectory>> tree = dao.findWikiDirectoryTree(root, WikiNode.SortableProperty.name, true);

                Assert.assertEquals(tree.size(), 7);

                Assert.assertEquals(tree.get(0).getLevel(), 1);
                Assert.assertEquals(tree.get(0).getNode().getName(), "AAA");
View Full Code Here

    @Test
    public void findWikiDirectorySubtree() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);

                WikiDirectory root = dao.findWikiDirectory(3l);
                List<WikiTreeNode<WikiDirectory>> tree = dao.findWikiDirectoryTree(root, WikiNode.SortableProperty.name, false);

                Assert.assertEquals(tree.size(), 3);

                Assert.assertEquals(tree.get(0).getLevel(), 1);
                Assert.assertEquals(tree.get(0).getNode().getName(), "CCC");
View Full Code Here

    @Test
    public void findMenuItems() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);

                WikiDirectory root = dao.findWikiDirectory(1l);

                List<WikiTreeNode<WikiDirectory>> tree = dao.findMenuItemTree(root, 3l, 3l, false);
                Assert.assertEquals(tree.size(), 3);
                Assert.assertEquals(tree.get(0).getLevel(), 1);
                Assert.assertEquals(tree.get(0).getNode().getName(), "BBB");
                Assert.assertEquals(tree.get(1).getLevel(), 1);
                Assert.assertEquals(tree.get(1).getNode().getName(), "CCC");
                Assert.assertEquals(tree.get(2).getLevel(), 2);
                Assert.assertEquals(tree.get(2).getNode().getName(), "DDD");

                tree = dao.findMenuItemTree(root, 3l, 1l, false);
                Assert.assertEquals(tree.size(), 3);
                Assert.assertEquals(tree.get(0).getLevel(), 1);
                Assert.assertEquals(tree.get(0).getNode().getName(), "BBB");
                Assert.assertEquals(tree.get(1).getLevel(), 1);
                Assert.assertEquals(tree.get(1).getNode().getName(), "CCC");
                Assert.assertEquals(tree.get(2).getLevel(), 1);
                Assert.assertEquals(tree.get(2).getNode().getName(), "DDD");

                tree = dao.findMenuItemTree(root, 1l, 3l, false);
                Assert.assertEquals(tree.size(), 2);
                Assert.assertEquals(tree.get(0).getLevel(), 1);
                Assert.assertEquals(tree.get(0).getNode().getName(), "BBB");
                Assert.assertEquals(tree.get(1).getLevel(), 1);
                Assert.assertEquals(tree.get(1).getNode().getName(), "CCC");
View Full Code Here

    public void findFeeds() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {

                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDocument document = nodeDAO.findWikiDocument(9l);

                FeedDAO feedDAO = (FeedDAO)getInstance(FeedDAO.class);

                List<WikiFeed> feeds = feedDAO.findFeeds(document);
                assert feeds.size() == 2;
View Full Code Here

    public void isOnSiteFeed() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {

                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDocument document = nodeDAO.findWikiDocument(9l);

                FeedDAO feedDAO = (FeedDAO)getInstance(FeedDAO.class);

                assert feedDAO.isOnSiteFeed(document);
            }
View Full Code Here

    public void findParentFeeds() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {

                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory dir = nodeDAO.findWikiDirectory(2l);

                FeedDAO feedDAO = (FeedDAO)getInstance(FeedDAO.class);

                List<WikiFeed> feeds = feedDAO.findParentFeeds(dir, true);
View Full Code Here

    public void findForumsGuest() throws Exception {
        if (!database.equals(Database.MYSQL)) return;

        new FacesRequest() {
            protected void invokeApplication() throws Exception {
                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory forumDir = nodeDAO.findWikiDirectory(100l);

                ForumDAO dao = (ForumDAO)getInstance(ForumDAO.class);

                Map<Long, ForumInfo> forums = dao.findForums(forumDir);
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.core.dao.WikiNodeDAO

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.