Package org.apache.rave.model

Examples of org.apache.rave.model.Region


    }

    @Test
    public void renderOpenSocial() {
        Page page = new PageImpl("1", repository.getByUsername(VALID_USER_NAME).getId());
        Region region = new RegionImpl("1", page, 1);
        page.setRegions(Arrays.asList(region));

        WidgetImpl w = new WidgetImpl();
        w.setType("OpenSocial");
        w.setId("1");
        w.setTitle("Wikipedia");
        w.setUrl("http://www.widget-dico.com/wikipedia/google/wikipedia.xml");

        RegionWidget rw = new RegionWidgetImpl("1", w.getId(), region);
        region.setRegionWidgets(Arrays.asList(rw));

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        RenderContext context = new RenderContext();
        context.setProperties(new HashMap());
View Full Code Here


    @Test
    public void get_DifferentId() {
        String id = "234";
        Page page = new PageImpl();
        Region region = new RegionImpl();
        RegionWidgetImpl widget = new RegionWidgetImpl();
        widget.setId("123");
        page.setRegions(Arrays.asList(region));
        region.setPage(page);
        region.setRegionWidgets(Arrays.<RegionWidget>asList(widget));
        widget.setRegion(region);

        expect(template.findOne(getQuery(id))).andReturn(page);
        replay(template);
        RegionWidget result = widgetRepository.get(id);
View Full Code Here

    @Test
    public void get_Valid() {
        String id = "123";
        Page found = new MongoDbPage();
        Region region = new RegionImpl();
        found.setRegions(Arrays.asList(region));
        RegionWidgetImpl widget = new RegionWidgetImpl();
        region.setRegionWidgets(Arrays.<RegionWidget>asList(widget));
        widget.setId("123");
        expect(template.findOne(getQuery(id))).andReturn(found);
        replay(template);

        assertThat(widget, is(sameInstance(widgetRepository.get(id))));
View Full Code Here

        String id = "123";
        widget.setId(id);
        replaced.setId(id);
        replaced.setCollapsed(true);
        Page parent = new PageImpl();
        Region region = new RegionImpl();
        List<Region> regions = new ArrayList<Region>();
        regions.add(region);
        List<RegionWidget> regionWidgets = new ArrayList<RegionWidget>();
        regionWidgets.add(replaced);
        parent.setRegions(regions);
        region.setRegionWidgets(regionWidgets);

        expect(template.findOne(getQuery(id))).andReturn(parent);
        expect(template.save(parent)).andReturn(parent);
        replay(template);

        RegionWidget savedWidget = widgetRepository.save(widget);

        assertTrue(region.getRegionWidgets().contains(widget));
        assertFalse(region.getRegionWidgets().contains(replaced));
        assertThat(savedWidget, is(sameInstance((RegionWidget)widget)));
    }
View Full Code Here

    }

    @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");
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");

        widgetRepository.save(widget);
View Full Code Here

    }

    @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>());

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

    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);

        widgetRepository.delete(widget);

        assertFalse(region.getRegionWidgets().contains(widget));
        verify(template);
    }
View Full Code Here

    }

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

        String regionWidgetId3 = "2874L";
        Page page = new PageImpl("1234L");
        List<Page> pages = Lists.newArrayList();
        List<Region> regions = Lists.newArrayList();
        List<RegionWidget> regionWidgets = Lists.newArrayList();
        Region region = new RegionImpl(id);
        Region region2 = new RegionImpl(id2);
        RegionWidget rw1 = new RegionWidgetImpl(regionWidgetId1);
        RegionWidget rw2 = new RegionWidgetImpl(regionWidgetId2);
        RegionWidget rw3 = new RegionWidgetImpl(regionWidgetId3);
        regions.add(region);
        regions.add(region2);
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.