Package com.apress.progwt.client.domain.dto

Examples of com.apress.progwt.client.domain.dto.PostsList


            rtn.addAttribute("uniqueForumID", uniqueForumID);

        } else {

            RecentForumPostTopic rfpt = new RecentForumPostTopic();
            PostsList postList = schoolService.getForum(rfpt, 0, 15);

            ForumBootstrap bootstrap = new ForumBootstrap(gwtSerializer,
                    postList, rfpt);

            rtn.addAttribute("bootstrap", bootstrap);
View Full Code Here


            model.addAttribute("message", "Couldn't find school "
                    + schoolName);
            return getNotFoundView();
        }

        PostsList forumPosts = schoolService.getForum(school, 0, 10);
        ForumBootstrap forumBootstrap = new ForumBootstrap(serializer,
                forumPosts, school);
        model.addAttribute("forumBootstrap", forumBootstrap);

        model.addAttribute("school", school);
View Full Code Here

    }

    public void testForumReplies() throws SiteException {
        School s = new School(500);
        PostsList posts = schoolService.getForum(s, 0, 10);

        for (ForumPost fp : posts.getPosts()) {
            System.out.println("fp: " + fp + " REPL "
                    + fp.getReplies().size());
        }
    }
View Full Code Here

        ForumPost fp = new SchoolForumPost(sc, currentUser, TITLE, TEXT,
                null);

        executeWithToken(new SaveForumPostCommand(fp), false);

        PostsList posts = schoolService.getForum(sc, 0, 10);

        assertEquals(1, posts.getTotalCount());
        assertEquals(1, posts.getPosts().size());

        ForumPost saved = posts.getPosts().get(0);
        assertNotNull(saved);
        assertEquals(SchoolForumPost.class, saved.getClass());
        assertTrue(saved.getId() > 0);
        assertEquals(TITLE, saved.getPostTitle());
        assertEquals(TEXT, saved.getPostString());
        assertEquals(0, saved.getReplyCount());

        assertEquals(null, saved.getThreadPost());

        assertEquals(currentUser, saved.getAuthor());

        // save a second post to the same thread
        ForumPost fp2 = new SchoolForumPost(sc, currentUser, TITLE, TEXT,
                saved);
        executeWithToken(new SaveForumPostCommand(fp2), false);

        // assert that there's still just 1 top level thread
        posts = schoolService.getForum(sc, 0, 10);
        assertEquals(1, posts.getTotalCount());
        assertEquals(1, posts.getPosts().size());

        // relies on setting the inverse side of the association for
        // testing
        assertEquals(1, posts.getPosts().get(0).getReplyCount());
        assertEquals(1, saved.getReplyCount());

        // get the posts in this thread
        posts = schoolService.getForum(saved, 0, 10);
        assertEquals(2, posts.getTotalCount());
        assertEquals(2, posts.getPosts().size());

        ForumPost saved1 = posts.getPosts().get(0);
        assertEquals(saved, saved1);
        ForumPost saved2 = posts.getPosts().get(1);
        assertNotNull(saved2);
        assertEquals(SchoolForumPost.class, saved2.getClass());
        assertTrue(saved2.getId() > 0);
        assertEquals(TITLE, saved2.getPostTitle());
        assertEquals(TEXT, saved2.getPostString());
View Full Code Here

        // the actual set.
        for (ForumPost fp : posts) {
            fp.setReplyCount(fp.getReplies().size());
        }

        PostsList rtn = new PostsList(posts, getRowCount(crit));

        return rtn;
    }
View Full Code Here

                                .getId()))).addOrder(Order.asc("date"));

        List<ForumPost> posts = getHibernateTemplate().findByCriteria(
                crit, start, max);

        PostsList rtn = new PostsList(posts, getRowCount(crit));

        return rtn;
    }
View Full Code Here

                Order.desc("date"));

        List<ForumPost> posts = getHibernateTemplate().findByCriteria(
                crit, start, max);

        PostsList rtn = new PostsList(posts, getRowCount(crit));

        return rtn;
    }
View Full Code Here

        School sc = schoolDAO
                .getSchoolFromName("Jarvis Christian College");
        assertNotNull(sc);

        // assert that there are no posts for the school
        PostsList threads = schoolDAO.getSchoolThreads(sc.getId(), 0, 10);
        assertNotNull(threads);
        assertEquals(0, threads.getTotalCount());
        assertEquals(0, threads.getPosts().size());

        User u = userDAO.getUserByUsername("test");
        assertNotNull(u);

        // Create a first thread for this school
        ForumPost post = new SchoolForumPost(sc, u, A, A, null);
        post = (ForumPost) schoolDAO.save(post);

        threads = schoolDAO.getSchoolThreads(sc.getId(), 0, 10);
        assertEquals(1, threads.getTotalCount());
        assertEquals(1, threads.getPosts().size());

        ForumPost saved = threads.getPosts().get(0);
        assertNotNull(saved.getDate());
        assertEquals(sc, saved.getTopic());

        // save a second post in the same thread
        ForumPost post2 = new SchoolForumPost(sc, u, null, A, saved);
        post2 = (ForumPost) schoolDAO.save(post2);

        // should only be 1 top level thread still.
        threads = schoolDAO.getSchoolThreads(sc.getId(), 0, 10);
        assertEquals(1, threads.getTotalCount());
        assertEquals(1, threads.getPosts().size());

        PostsList post1Thread = schoolDAO.getPostsForThread(post, 0, 10);
        assertEquals(2, post1Thread.getTotalCount());
        assertEquals(2, post1Thread.getPosts().size());
    }
View Full Code Here

TOP

Related Classes of com.apress.progwt.client.domain.dto.PostsList

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.