Package org.apache.rave.model

Examples of org.apache.rave.model.Page


    @Test
    public void save_Id_Valid_Page_Null() {
        RegionWidgetImpl item = new RegionWidgetImpl();
        String id = "123";
        item.setId(id);
        Page page = new PageImpl();
        page.setRegions(new ArrayList<Region>());

        expect(template.findOne(getQuery(id))).andReturn(page);
        replay(template);

        thrown.expect(IllegalStateException.class);
View Full Code Here


    @Test
    public void save_Id_Null_Page_Valid_Regions_Valid() {
        RegionWidgetImpl widget = new RegionWidgetImpl();

        RegionImpl region = new RegionImpl();
        Page page = new PageImpl();
        String id = "321";
        page.setId(id);
        List<Region> regions = new ArrayList<Region>();
        regions.add(region);
        page.setRegions(regions);
        region.setPage(page);
        region.setId(id);
        widget.setRegion(region);
        List<RegionWidget> widgets = new ArrayList<RegionWidget>();
        widgets.add(widget);
View Full Code Here

    @Test
    public void save_Id_Null_Page_Valid_Regions_Valid_Diff_Id() {
        RegionWidget item = new RegionWidgetImpl();
        RegionImpl region = new RegionImpl();
        item.setRegion(region);
        Page item_Page = new PageImpl();
        region.setPage(item_Page);
        item_Page.setId("3333");
        region.setId("2222");

        Page page = new PageImpl();
        ArrayList<Region> regions = new ArrayList<Region>();
        regions.add(new RegionImpl());
        page.setRegions(regions);
        expect(template.get(item.getRegion().getPage().getId())).andReturn(page);
        replay(template);

        thrown.expect(IllegalStateException.class);
        thrown.expectMessage("Unable to find parent for page");
View Full Code Here

    @Test
    public void save_Id_Null_Page_Null_Region_Valid_Page_Valid_Id_Null() {
        RegionWidget widget = new RegionWidgetImpl();
        Region region = new RegionImpl();
        widget.setRegion(region);
        Page page = new PageImpl();
        region.setPage(page);

        thrown.expect(IllegalStateException.class);
        thrown.expectMessage("Unable to find page for region");
View Full Code Here

    public void save_Id_Null_Page_Valid_Region_Null() {
        RegionWidget item = new RegionWidgetImpl();
        Region region = new RegionImpl();
        item.setRegion(region);
        String id = "123";
        Page page = new PageImpl();
        region.setPage(page);
        page.setId(id);
        page.setRegions(new ArrayList<Region>());

        thrown.expect(IllegalStateException.class);
        thrown.expectMessage("Unable to find parent for page");

        expect(template.get(id)).andReturn(page);
View Full Code Here

    @Test
    public void delete_Valid() {
        RegionWidgetImpl widget = new RegionWidgetImpl();
        String id = "123";
        widget.setId(id);
        Page found = new PageImpl();
        Region region = new RegionImpl();
        List<RegionWidget> regionWidgets = new ArrayList<RegionWidget>();
        regionWidgets.add(widget);
        List<Region> regions = new ArrayList<Region>();
        regions.add(region);
        found.setRegions(regions);
        region.setRegionWidgets(regionWidgets);

        expect(template.findOne(getQuery(id))).andReturn(found);
        expect(template.save(found)).andReturn(null);
        replay(template);
View Full Code Here

        return saved.getRegions().get(index);
    }

    @Override
    public void delete(Region item) {
        Page page;

        if(item.getId() == null) {
            throw new IllegalStateException("Unidentifiable region (null id)");
        } else {
            page = getPageByRegionId(item.getId());
View Full Code Here

        expect(regionRepository.save(region)).andReturn(region);
        replay(regionRepository);

        //create a strict mock that ensures that the appropriate setters are
        //called, rather than checking the return value from the function
        Page curPage = createStrictMock(PageImpl.class);
        expect(curPage.getPageLayout()).andReturn(prevLayout);
        expect(curPage.getRegions()).andReturn(regions);
        curPage.setName(newName);
        curPage.setPageLayout(layout);
        replay(curPage);

        expect(pageRepository.get(PAGE_ID)).andReturn(curPage);
        expect(pageRepository.save(curPage)).andReturn(curPage);
        replay(pageRepository);
View Full Code Here

        expect(regionRepository.save(region)).andReturn(region);
        replay(regionRepository);

        //create a strict mock that ensures that the appropriate setters are
        //called, rather than checking the return value from the function
        Page curPage = createStrictMock(PageImpl.class);
        expect(curPage.getPageLayout()).andReturn(prevLayout);
        expect(curPage.getRegions()).andReturn(regions);
        curPage.setName(newName);
        curPage.setPageLayout(layout);
        replay(curPage);

        expect(pageRepository.get(PAGE_ID)).andReturn(curPage);
        expect(pageRepository.save(curPage)).andReturn(curPage);
        replay(pageRepository);
View Full Code Here

        expect(regionRepository.save(region)).andReturn(region);
        replay(regionRepository);

        //create a strict mock that ensures that the appropriate setters are
        //called, rather than checking the return value from the function
        Page curPage = createStrictMock(PageImpl.class);
        expect(curPage.getPageLayout()).andReturn(prevLayout);
        expect(curPage.getRegions()).andReturn(regions);
        curPage.setName(newName);
        curPage.setPageLayout(layout);
        replay(curPage);

        expect(pageRepository.get(PAGE_ID)).andReturn(curPage);
        expect(pageRepository.save(curPage)).andReturn(curPage);
        replay(pageRepository);
View Full Code Here

TOP

Related Classes of org.apache.rave.model.Page

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.