Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.Region


    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


    @Test
    public void get_null(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region region = new RegionImpl("1111L");
        regions.add(region);
        page.setRegions(regions);

        expect(template.findOne(new Query(Criteria.where("regions").elemMatch(Criteria.where("_id").is("2222L"))))).andReturn(page);
        replay(template);

        Region result = repo.get("2222L");
        assertNull(result);

    }
View Full Code Here

    @Test
    public void save(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl("1111L");
        regions.add(item);
        page.setRegions(regions);

        expect(template.findOne(new Query(Criteria.where("regions").elemMatch(Criteria.where("_id").is("1111L"))))).andReturn(page);
        expect(template.save(isA(Page.class))).andReturn(page);
        replay(template);

        Region result = repo.save(item);
        assertThat(result.getId(), is(equalTo("1111L")));
        assertThat(result, is(sameInstance(item)));

    }
View Full Code Here

    @Test
    public void save_null(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl();
        item.setPage(page);
        regions.add(item);
        page.setRegions(regions);

        expect(template.get("1234L")).andReturn(page);
        expect(template.save(isA(Page.class))).andReturn(page);
        replay(template);

        Region result = repo.save(item);
        assertNull(result.getId());

    }
View Full Code Here

    @Test
     public void delete(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl("1111L");
        regions.add(item);
        page.setRegions(regions);

        expect(template.findOne(new Query(Criteria.where("regions").elemMatch(Criteria.where("_id").is("1111L"))))).andReturn(page);
        expect(template.save(isA(Page.class))).andReturn(page);
View Full Code Here

    @Test (expected = IllegalStateException.class)
    public void delete_null(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl();
        regions.add(item);
        page.setRegions(regions);

        repo.delete(item);
    }
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.portal.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.