Package org.apache.rave.model

Examples of org.apache.rave.model.Page


    }

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

    @Test
    public void getAll(){
        String id = "1111L";
        String id2 = "2222L";
        Page page = new PageImpl("1234L");
        List<Page> pages = Lists.newArrayList();
        List<Region> regions = Lists.newArrayList();
        Region region = new RegionImpl(id);
        Region region2 = new RegionImpl(id2);
        regions.add(region);
        regions.add(region2);
        pages.add(page);
        page.setRegions(regions);


        Query q = new Query();
        expect(template.find(q)).andReturn(pages);
        replay(template);
View Full Code Here

    @Test
    public void getLimitedList(){
        String id = "1111L";
        String id2 = "2222L";
        Page page = new PageImpl("1234L");
        List<Page> pages = Lists.newArrayList();
        List<Region> regions = Lists.newArrayList();
        Region region = new RegionImpl(id);
        Region region2 = new RegionImpl(id2);
        regions.add(region);
        regions.add(region2);
        pages.add(page);
        page.setRegions(regions);

        Query q = new Query();
        expect(template.find(q)).andReturn(pages);
        replay(template);
View Full Code Here

    @Test
    public void getCount(){
        String id = "1111L";
        String id2 = "2222L";
        Page page = new PageImpl("1234L");
        List<Page> pages = Lists.newArrayList();
        List<Region> regions = Lists.newArrayList();
        Region region = new RegionImpl(id);
        Region region2 = new RegionImpl(id2);
        regions.add(region);
        regions.add(region2);
        pages.add(page);
        page.setRegions(regions);

        Query q = new Query();
        expect(template.find(q)).andReturn(pages);
        replay(template);
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);
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);
View Full Code Here

    }

    @Test
    public void get_Null() {
        String id = "321";
        Page found = new MongoDbPage();
        found.setRegions(new ArrayList<Region>());
        expect(template.findOne(getQuery(id))).andReturn(found);
        replay(template);
        assertNull(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);
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.