Package org.apache.rave.model

Examples of org.apache.rave.model.Region


    @Test(expected = UnsupportedOperationException.class)
    public void removeWidgetFromPage_lockedRegionWidget() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        Region region = new RegionImpl(REGION_ID);
        region.setLocked(true);
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setLocked(true);
        regionWidget.setRegion(region);

        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget);
View Full Code Here


        String newName = "new page name";
        String layoutName = "layout name";
        String layoutCode = "CODE";

        List<Region> regions = new ArrayList<Region>();
        Region region = new RegionImpl("99");
        region.setRenderOrder(1);
        regions.add(new RegionImpl());
        regions.add(region);

        PageLayout prevLayout = new PageLayoutImpl();
        prevLayout.setNumberOfRegions(2L);
View Full Code Here

    public void updatePage_removeRegion_noWidgets() {
        String newName = "new page name";
        String layoutName = "layout name";

        List<Region> regions = new ArrayList<Region>();
        Region region = createStrictMock(Region.class);
        expect(region.getRegionWidgets()).andReturn(new ArrayList<RegionWidget>());
        expect(region.getRenderOrder()).andReturn(1);
        replay(region);
        regions.add(region);

        Region deletedRegion = createStrictMock(Region.class);
        expect(deletedRegion.getRegionWidgets()).andReturn(new ArrayList<RegionWidget>());
        replay(deletedRegion);
        regions.add(deletedRegion);

        PageLayout prevLayout = createStrictMock(PageLayoutImpl.class);
        expect(prevLayout.getNumberOfRegions()).andReturn(new Long(2)).anyTimes();
View Full Code Here


        List<RegionWidget> newLastWidgetColumn = new ArrayList<RegionWidget>();

        List<Region> regions = new ArrayList<Region>();
        Region region = createStrictMock(Region.class);
        expect(region.getRegionWidgets()).andReturn(newLastWidgetColumn).times(2);
        expect(region.getRenderOrder()).andReturn(1);
        replay(region);
        regions.add(region);


        RegionWidget widget = createStrictMock(RegionWidget.class);
        widget.setRegion(region);
        widget.setRenderOrder(1);
        replay(widget);
        List<RegionWidget> movedWidgets = new ArrayList<RegionWidget>();
        movedWidgets.add(widget);

        Region deletedRegion = createStrictMock(Region.class);
        expect(deletedRegion.getRegionWidgets()).andReturn(movedWidgets);
        replay(deletedRegion);
        regions.add(deletedRegion);

        PageLayout prevLayout = createStrictMock(PageLayoutImpl.class);
        expect(prevLayout.getNumberOfRegions()).andReturn(new Long(2)).anyTimes();
View Full Code Here

        replay(widget);
        List<RegionWidget> newLastWidgetColumn = new ArrayList<RegionWidget>();
        newLastWidgetColumn.add(widget);

        List<Region> regions = new ArrayList<Region>();
        Region region = createStrictMock(Region.class);
        expect(region.getRegionWidgets()).andReturn(newLastWidgetColumn).times(2);
        expect(region.getRenderOrder()).andReturn(1);
        replay(region);
        regions.add(region);


        widget = createStrictMock(RegionWidget.class);
        widget.setRegion(region);
        widget.setRenderOrder(1);
        expect(widget.getRenderOrder()).andReturn(1).anyTimes();
        replay(widget);
        List<RegionWidget> movedWidgets = new ArrayList<RegionWidget>();
        movedWidgets.add(widget);

        Region deletedRegion = createStrictMock(Region.class);
        expect(deletedRegion.getRegionWidgets()).andReturn(movedWidgets);
        replay(deletedRegion);
        regions.add(deletedRegion);

        PageLayout prevLayout = createStrictMock(PageLayoutImpl.class);
        expect(prevLayout.getNumberOfRegions()).andReturn(new Long(2)).anyTimes();
View Full Code Here

    private List<Region> createEmptyRegionList(long numberOfRegions) {
        List<Region> regions = new ArrayList<Region>();
        int regionCount;
        for (regionCount = 0; regionCount < numberOfRegions; regionCount++) {
              Region region = new RegionImpl();
              regions.add(region);
        }
        return regions;
    }
View Full Code Here

        Page toPageValue = new PageImpl();
        toPageValue.setRegions(new ArrayList<Region>());
        toPageValue.getRegions().add(originalRegion);
        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);
        region.setRegionWidgets(Lists.<RegionWidget>newArrayList());

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        region.getRegionWidgets().add(regionWidget);

        expect(pageRepository.get(TO_PAGE_ID)).andReturn(toPageValue);
        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget).times(2);
        expect(regionRepository.save(originalRegion)).andReturn(originalRegion);
        expect(regionRepository.save(region)).andReturn(region);

        replay(pageRepository, regionWidgetRepository, regionRepository);

        RegionWidget updatedRegionWidget = pageService.moveRegionWidgetToPage(VALID_REGION_WIDGET_ID, TO_PAGE_ID);

        verify(pageRepository);
        verify(regionWidgetRepository);
        verifyPositions(0, regionWidget, true);
        assertThat(region.getRegionWidgets().isEmpty(), is(true));

    }
View Full Code Here

        Page toPageValue = new PageImpl();
        toPageValue.setRegions(new ArrayList<Region>());
        toPageValue.getRegions().add(originalRegion);
        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        regionWidget.setLocked(true);
View Full Code Here

        Page toPageValue = new PageImpl();
        toPageValue.setRegions(new ArrayList<Region>());
        toPageValue.getRegions().add(originalRegion);
        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        regionWidget.setLocked(true);
View Full Code Here

        Page toPageValue = new PageImpl();
        toPageValue.setRegions(new ArrayList<Region>());
        toPageValue.getRegions().add(originalRegion);
        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        regionWidget.setLocked(true);
View Full Code Here

TOP

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

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.