Package org.apache.rave.portal.model.impl

Examples of org.apache.rave.portal.model.impl.RegionWidgetImpl


        assertThat(returned, is(sameInstance((RegionWidget)widget)));
    }

    @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


        widgetRepository.save(item);
    }

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

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

        widgetRepository.save(widget);
View Full Code Here

        widgetRepository.save(widget);
    }

    @Test
    public void save_Id_Null_Page_Null_Region_Valid_Page_Null() {
        RegionWidget widget = new RegionWidgetImpl();
        Region region = new RegionImpl();
        widget.setRegion(region);

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

        widgetRepository.save(widget);
View Full Code Here

        widgetRepository.save(widget);
    }

    @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

        widgetRepository.save(widget);
    }

    @Test
    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>());
View Full Code Here

        widgetRepository.save(item);
    }

    @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>();
View Full Code Here

        verify(template);
    }

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

        expect(template.findOne(new Query(where("regions").elemMatch(where("regionWidgets").elemMatch(where("_id").is(id)))))).andReturn(page);
        replay(template);
View Full Code Here

        widgetRepository.delete(item);
    }

    @Test
    public void delete_DifferentId() {
        RegionWidgetImpl widget = new RegionWidgetImpl();
        Region region = new RegionImpl();
        Page page = new PageImpl();
        page.setRegions(Arrays.asList(region));
        region.setRegionWidgets(Arrays.<RegionWidget>asList(widget));
        widget.setId("345345");

        RegionWidgetImpl item = new RegionWidgetImpl();
        String id = "4344";
        item.setId(id);

        expect(template.findOne(new Query(where("regions").elemMatch(where("regionWidgets").elemMatch(where("_id").is(id)))))).andReturn(page);
        replay(template);

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

        page2.getMembers().add(pageUser2);

        targetRegion = new RegionImpl("2");
        targetRegion.setLocked(false);
        targetRegion.setRegionWidgets(new ArrayList<RegionWidget>());
        targetRegion.getRegionWidgets().add(new RegionWidgetImpl("1", validWidget.getId(), targetRegion, 0));
        targetRegion.getRegionWidgets().add(new RegionWidgetImpl("2", validWidget.getId(), targetRegion, 1));
        targetRegion.getRegionWidgets().add(new RegionWidgetImpl("3", validWidget.getId(), targetRegion, 2));
        targetRegion.setPage(page);

        originalRegion = new RegionImpl("2");
        originalRegion.setLocked(false);
        originalRegion.setRegionWidgets(new ArrayList<RegionWidget>());
        originalRegion.getRegionWidgets().add(new RegionWidgetImpl("4", validWidget.getId(), targetRegion, 0));
        originalRegion.getRegionWidgets().add(new RegionWidgetImpl("5", validWidget.getId(), targetRegion, 1));
        originalRegion.getRegionWidgets().add(new RegionWidgetImpl("6", validWidget.getId(), targetRegion, 2));

        lockedRegion = new RegionImpl();
        lockedRegion.setLocked(true);
        lockedRegion.setPage(page);

        pageList = new ArrayList<Page>();
        pageList.add(page2);
        pageList.add(page);

        pageUserList = new ArrayList<PageUser>();
        pageUserList.add(pageUser);
        pageUserList.add(pageUser2);

        validRegionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        validRegionWidget.setWidgetId(validWidget.getId());
        validRegionWidget.setRegion(originalRegion);
    }
View Full Code Here

    @Test
    public void removeWidgetFromPage_validWidget() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setRegion(new RegionImpl(REGION_ID));
        Region region = new RegionImpl();

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

TOP

Related Classes of org.apache.rave.portal.model.impl.RegionWidgetImpl

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.