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

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


    @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(getQuery(id))).andReturn(page);
        replay(template);

        thrown.expect(IllegalStateException.class);
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";
View Full Code Here

  @Before
  public void setup(){
        long longId = 19191991L;
        id=Long.toBinaryString(longId);
        page=new PageImpl(id);
        parentId = "12345";
    testName="testName";
    testOwner=new JpaUser(longId);
        parentPage = new PageImpl(parentId);
        subPages = new ArrayList<Page>();

        Page subPage1 = new PageImpl();
        subPage1.setId(SUB_PAGE_1_ID);
        subPage1.setOwnerId(testOwner.getId());
        Page subPage2 = new PageImpl();
        subPage2.setId(SUB_PAGE_2_ID);
        subPage2.setOwnerId(testOwner.getId());

        List<PageUser> pageUsers1 = new ArrayList<PageUser>();
        PageUser pageUser1 = new PageUserImpl();
        pageUser1.setUserId(id);
        pageUser1.setPage(subPage1);
        pageUser1.setRenderSequence(2L);
        pageUsers1.add(pageUser1);
        subPage1.setMembers(pageUsers1);

        List<PageUser> pageUsers2 = new ArrayList<PageUser>();
        PageUser pageUser2 = new PageUserImpl();
        pageUser2.setUserId("");
        pageUser2.setPage(subPage2);
        pageUser2.setRenderSequence(19L);
        pageUsers2.add(pageUser2);

        PageUser pageUser3 = new PageUserImpl();
        pageUser3.setUserId(testOwner.getId());
        pageUser3.setPage(subPage2);
        pageUser3.setRenderSequence(1L);
        pageUsers2.add(pageUser3);
        subPage2.setMembers(pageUsers2);

        subPages.add(subPage1);
        subPages.add(subPage2);
    pageLayout=new PageLayoutImpl();
    renderSequence=1223L;
View Full Code Here

    public void deleteUser() {
        final int NUM_COMMENTS = 33;
        final int NUM_RATINGS = 99;
        final int NUM_WIDGETS_OWNED = 4;
        UserImpl user = new UserImpl(USER_ID, USER_NAME);
        Page page = new PageImpl("1", user.getId());
        List<Page> pages = new ArrayList<Page>();
        pages.add(page);

        expect(userRepository.get(USER_ID)).andReturn(user);
        expect(pageRepository.deletePages(USER_ID, PageType.USER)).andReturn(pages.size());
View Full Code Here

    @Test
    public void registerNewUser_valid(){
        User user = new UserImpl();
        expect(userRepository.save(user)).andReturn(user).once();
        expect(pageTemplateRepository.getDefaultPage(PageType.PERSON_PROFILE)).andReturn(new PageTemplateImpl()).once();
        expect(pageRepository.createPageForUser(isA(UserImpl.class), isA(PageTemplate.class))).andReturn(new PageImpl());
        replay(userRepository, pageTemplateRepository, pageRepository);
        service.registerNewUser(user);
        verify(userRepository, pageTemplateRepository, pageRepository);
    }
View Full Code Here

     * @param pt PageTemplate
     * @param user User
     * @return Page
     */
    private Page convertTemplate(PageTemplate pt, User user) {
        Page p = new PageImpl();
        p.setName(pt.getName());
        p.setPageType(pt.getPageType());
        p.setOwnerId(user.getId());
        PageUser pageUser = new PageUserImpl(user.getId(), p, pt.getRenderSequence());
        pageUser.setPageStatus(PageInvitationStatus.OWNER);
        pageUser.setEditor(true);
        List<PageUser> members = new ArrayList<PageUser>();
        members.add(pageUser);
        p.setMembers(members);

        p.setPageLayout(pt.getPageLayout());
        p.setRegions(convertRegions(pt.getPageTemplateRegions(), p));
        p.setSubPages(convertPages(pt.getSubPageTemplates(), p));
        return p;
    }
View Full Code Here

     * @return list of Page
     */
    private List<Page> convertPages(List<PageTemplate> pageTemplates, Page page){
        List<Page> pages = new ArrayList<Page>();
        for(PageTemplate pt : pageTemplates){
            Page lPage = new PageImpl();
            lPage.setName(pt.getName());
            lPage.setPageType(pt.getPageType());
            lPage.setOwnerId(page.getOwnerId());
            lPage.setPageLayout(pt.getPageLayout());
            lPage.setParentPage(page);
            lPage.setRegions(convertRegions(pt.getPageTemplateRegions(), lPage));

            // create new pageUser tuple
            PageUser pageUser = new PageUserImpl(lPage.getOwnerId(), lPage, pt.getRenderSequence());
            pageUser.setPageStatus(PageInvitationStatus.OWNER);
            pageUser.setEditor(true);
            List<PageUser> members = new ArrayList<PageUser>();
            members.add(pageUser);
            lPage.setMembers(members);
            // recursive call
            lPage.setSubPages((pt.getSubPageTemplates() == null || pt.getSubPageTemplates().isEmpty()) ? null : convertPages(pt.getSubPageTemplates(), lPage));
            pages.add(lPage);
        }
        return pages;
    }
View Full Code Here

    }

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

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

        Region result = repo.get(id);
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");
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);
View Full Code Here

TOP

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

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.