Package org.jtalks.jcommune.web.dto

Examples of org.jtalks.jcommune.web.dto.SimplePageDto


        SimplePage page = null;
        try {
            page = simplePageService.getPageByPathName(pagePathName);
        } finally {
            if (page != null) {
                SimplePageDto pageDto = new SimplePageDto(page);

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


    @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

        simplePage.setContent("Content");
        simplePage.setPathName(pagePathName);

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

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

        //check expectations
        verify(simplePageService).getPageByPathName(PATH_NAME);

        //check result
        assertViewName(modelAndView, "simplePage");
        SimplePageDto actualSimplePage = assertAndReturnModelAttributeOfType(modelAndView, "simplePageDto", SimplePageDto.class);
        assertEqualsSimplePageAndSimplePageDto(actualSimplePage, simplePage);
    }
View Full Code Here

        //check expectations
        verify(simplePageService).getPageByPathName(PATH_NAME);

        //check result
        assertViewName(modelAndView, "simplePageEditor");
        SimplePageDto actualSimplePage = assertAndReturnModelAttributeOfType(modelAndView, "simplePageDto", SimplePageDto.class);
        assertEqualsSimplePageAndSimplePageDto(actualSimplePage, simplePage);
    }
View Full Code Here

        controller.showEditPage(PATH_NAME);
    }

    @Test
    public void updatePageTest() throws NotFoundException {
        SimplePageDto pageDto = new SimplePageDto();
        pageDto.setId(PAGE_ID);
        pageDto.setNameText(NAME);
        pageDto.setContentText(CONTENT);
        pageDto.setPathName(PATH_NAME);
        BindingResult bindingResult = new BeanPropertyBindingResult(pageDto, "simplePageDto");
        ModelAndView mav = controller.update(pageDto, bindingResult, PATH_NAME);
        assertViewName(mav, "redirect:/pages/" + PATH_NAME);
        verify(simplePageService).updatePage(any(SimplePageInfoContainer.class));
    }
View Full Code Here

    }

    @Test
    public void updatePageWithErrorTest() throws NotFoundException {
        //create Dto
        SimplePageDto pageDto = new SimplePageDto();
        pageDto.setId(PAGE_ID);
        pageDto.setNameText(NAME);
        pageDto.setContentText(CONTENT);
        pageDto.setPathName(PATH_NAME);

        //create Mock-object
        BeanPropertyBindingResult resultWithErrors = mock(BeanPropertyBindingResult.class);
        when(resultWithErrors.hasErrors()).thenReturn(true);
        ModelAndView mav = controller.update(pageDto, resultWithErrors, PATH_NAME);
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.web.dto.SimplePageDto

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.