Package org.jtalks.jcommune.model.dto

Examples of org.jtalks.jcommune.model.dto.PageRequest


        return dto;
    }


    private void prepareViewTopicMocks(Topic topic, String page) throws NotFoundException {
        PageRequest pageable = new PageRequest(page, 15);
        Page<Post> postsPage = new PageImpl<>(topic.getPosts(), pageable, 30L);
        when(userService.getCurrentUser()).thenReturn(topic.getTopicStarter());
        when(topicFetchService.get(TOPIC_ID)).thenReturn(topic);
        when(breadcrumbBuilder.getForumBreadcrumb(topic)).thenReturn(new ArrayList<Breadcrumb>());
        when(postService.getPosts(topic, page)).thenReturn(postsPage);
View Full Code Here


    @Test
    public void testGetTopicsUpdatedSince() {
        int size = 5;
        createAndSaveTopicList(size);
        PageRequest pageRequest = new PageRequest("1", size);
        DateTime lastLogin = new DateTime().minusDays(1);

        Page<Topic> page = dao.getTopicsUpdatedSince(lastLogin, pageRequest, ObjectsFactory.getDefaultUser());

        assertEquals(page.getContent().size(), 0);
View Full Code Here

    public void testGetUpdateTopicsUpdatedSinceWithPagingAndRegisteredUser() {
        int listSize = 5;
        int pageSize = 2;
        int lastPage = listSize / pageSize;
        List<Topic> createdTopicList = createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest(
                String.valueOf(lastPage), pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        JCUser user = new JCUser("Current", null, null);
        user.setGroups(ObjectsFactory.getDefaultGroupList());
View Full Code Here

    @Test
    public void testGetUpdateTopicsUpdatedSinceWithPagingAndRegisteredUserPageTooLow() {
        int listSize = 5;
        int pageSize = 2;
        List<Topic> createdTopicList = createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest("0", pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        JCUser user = new JCUser("Current", null, null);
        user.setGroups(ObjectsFactory.getDefaultGroupList());
        PersistedObjectsFactory.createAndSaveViewTopicsBranchesEntity(createdTopicList.get(0).getBranch().getId(),
View Full Code Here

    public void testGetUpdateTopicsUpdatedSinceWithPagingAndRegisteredUserPageTooBig() {
        int listSize = 5;
        int pageSize = 2;
        int lastPage = 3;
        List<Topic> createdTopicList = createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest("1000",
                pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        JCUser user = new JCUser("Current", null, null);
        user.setGroups(ObjectsFactory.getDefaultGroupList());
View Full Code Here

    public void testGetUpdateTopicsUpdatedSinceWithPagingAndAnonymousUser() {
        int listSize = 5;
        int pageSize = 2;
        int lastPage = listSize / pageSize;
        List<Topic> createdTopicList = createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest(
                String.valueOf(lastPage), pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        PersistedObjectsFactory.createAndSaveViewTopicsBranchesEntity(
                createdTopicList.get(0).getBranch().getId(), "anonymousUser", true);
View Full Code Here

    @Test
    public void testGetUpdateTopicsUpdatedSinceWithPagingAndAnonymousUserPageTooLow() {
        int listSize = 5;
        int pageSize = 2;
        List<Topic> createdTopicList = createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest("0", pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        PersistedObjectsFactory.createAndSaveViewTopicsBranchesEntity(
                createdTopicList.get(0).getBranch().getId(), "anonymousUser", true);
        Page<Topic> page = dao.getTopicsUpdatedSince(lastLogin, pageRequest, new AnonymousUser());
View Full Code Here

    public void testGetUpdateTopicsUpdatedSinceWithPagingAndAnonymousUserPageTooBig() {
        int listSize = 5;
        int pageSize = 2;
        int lastPage = 3;
        List<Topic> createdTopicList = createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest("1000",
                pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        PersistedObjectsFactory.createAndSaveViewTopicsBranchesEntity(
                createdTopicList.get(0).getBranch().getId(), "anonymousUser", true);
View Full Code Here

    public void testGetUpdateTopicsUpdatedForNoneExistingBranchAndUserGroup() {
        int listSize = 5;
        int pageSize = 2;
        int lastPage = listSize / pageSize;
        createAndSaveTopicList(listSize);
        PageRequest pageRequest = new PageRequest(
                String.valueOf(lastPage), pageSize);
        DateTime lastLogin = new DateTime().minusDays(1);

        PersistedObjectsFactory.createAndSaveViewTopicsBranchesEntity(22l, "noneExistingGroup", true);
        Page<Topic> page = dao.getTopicsUpdatedSince(lastLogin, pageRequest, new AnonymousUser());
View Full Code Here

    }

    @Test
    public void testGetUnansweredTopicsForRegisteredUsers() {
        JCUser user = createAndSaveTopicsWithUnansweredTopics();
        PageRequest pageRequest = new PageRequest("1", 2);

        Page<Topic> result = dao.getUnansweredTopics(pageRequest, user);
        assertEquals(result.getContent().size(), 2);
        assertEquals(result.getTotalElements(), 2);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.dto.PageRequest

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.