Examples of SimplePage


Examples of org.jtalks.jcommune.model.entity.SimplePage

     * @throws NotFoundException when page was not found or not exist
     */
    @RequestMapping(value = "/pages/{pagePathName}/edit", method = RequestMethod.GET)
    public ModelAndView showEditPage(@PathVariable(PAGE_PATH_NAME) String pagePathName) throws NotFoundException {
        checkPermissionToCreateAndEditPage();
        SimplePage page = simplePageService.getPageByPathName(pagePathName);

        SimplePageDto pageDto = new SimplePageDto(page);

        return new ModelAndView("simplePageEditor")
                .addObject(PAGE_DTO, pageDto);
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

        return new ModelAndView("redirect:/pages/" + pagePathName);
    }

    @RequestMapping(value = "/pages/create/{pagePathName}", method = RequestMethod.GET)
    public ModelAndView createPage(@PathVariable(PAGE_PATH_NAME) String pagePathName) {
        SimplePage simplePage = new SimplePage();
        simplePage.setName("Title");
        simplePage.setContent("Content");
        simplePage.setPathName(pagePathName);

        JCUser userCreator = userService.getCurrentUser();
        simplePageService.createPage(simplePage, userCreator);
        SimplePageDto simplePageDto = new SimplePageDto(simplePage);
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

    /*===== Common methods =====*/

    @Test
    public void testGet() {
        SimplePage simplePage = ObjectsFactory.getDefaultSimplePage();
        session.save(simplePage);

        SimplePage result = dao.get(simplePage.getId());

        assertNotNull(result);
        assertEquals(result.getId(), simplePage.getId());
        assertEquals(result.getName(), simplePage.getName());
        assertEquals(result.getContent(), simplePage.getContent());
        assertEquals(result.getPathName(), simplePage.getPathName());
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

        assertEquals(result.getPathName(), simplePage.getPathName());
    }

    @Test
    public void testGetInvalidId() {
        SimplePage simplePage = dao.get(-567890L);
        assertNull(simplePage);
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

    @Test
    public void testUpdate() {
        String newName = "newName";
        String newContent = "newContent";
        SimplePage simplePage = ObjectsFactory.getDefaultSimplePage();
        session.save(simplePage);

        simplePage.setName(newName);
        simplePage.setContent(newContent);

        dao.saveOrUpdate(simplePage);
        session.flush();
        session.evict(simplePage);
        SimplePage result = (SimplePage) session.get(SimplePage.class, simplePage.getId());

        assertEquals(result.getName(), newName);
        assertEquals(result.getContent(), newContent);
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

        assertEquals(result.getContent(), newContent);
    }

    @Test
    public void testIsExist() {
        SimplePage simplePage = ObjectsFactory.getDefaultSimplePage();
        session.save(simplePage);
        assertTrue(dao.isExist(simplePage.getId()));
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

    /* SimplePageHibernateDao specific methods */

    @Test
    public void testCreatePage() {
        SimplePage simplePage = ObjectsFactory.getDefaultSimplePage();
        session.save(simplePage);

        dao.createPage(simplePage);
        session.evict(simplePage);
        SimplePage result = (SimplePage) session.get(SimplePage.class, simplePage.getId());

        assertNotNull(result);
        assertEquals(simplePage.getId(), result.getId());
        assertEquals(simplePage.getName(), result.getName());
        assertEquals(simplePage.getContent(), result.getContent());
        assertEquals(simplePage.getPathName(), result.getPathName());
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

        assertEquals(simplePage.getPathName(), result.getPathName());
    }

    @Test
    public void testGetPageByPathName() {
        SimplePage simplePage = ObjectsFactory.getDefaultSimplePage();
        session.save(simplePage);

        SimplePage result = dao.getPageByPathName(simplePage.getPathName());

        assertNotNull(result);
        assertEquals(simplePage.getId(), result.getId());
        assertEquals(simplePage.getName(), result.getName());
        assertEquals(simplePage.getContent(), result.getContent());
        assertEquals(simplePage.getPathName(), result.getPathName());
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

        assertEquals(simplePage.getPathName(), result.getPathName());
    }

    @Test
    public void testGetPageByPathNameNotExist() {
        SimplePage simplePage = ObjectsFactory.getDefaultSimplePage();
        session.save(simplePage);

        SimplePage result = dao.getPageByPathName("not Exist Path Name");

        assertNull(result);
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.SimplePage

        simplePageService = new TransactionalSimplePageService(dao, groupDao, securityService);
    }

    @Test
    void testUpdate() throws NotFoundException {
        SimplePage simplePage = new SimplePage(NAME, CONTENT, PATH_NAME);
        simplePage.setId(ID);


        String updatedName = "new name";
        String updatedContent = "new content";

        SimplePageInfoContainer simplePageInfoContainer = new SimplePageInfoContainer(ID, updatedName, updatedContent);

        when(dao.isExist(simplePage.getId())).thenReturn(true);
        when(dao.get(simplePage.getId())).thenReturn(simplePage);

        simplePageService.updatePage(simplePageInfoContainer);
        assertEquals(simplePage.getName(), updatedName);
        assertEquals(simplePage.getContent(), updatedContent);

        verify(dao).get(ID);
        verify(dao).isExist(ID);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.