Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.Page$SubPageComparator


        validPageLayout = new PageLayout();
        validPageLayout.setEntityId(33L);
        validPageLayout.setCode(VALID_PAGE_LAYOUT_CODE);

        defaultPage = new Page(DEFAULT_PAGE_ID);
        defaultPage.setPageLayout(validPageLayout);
        otherPage = new Page(OTHER_PAGE_ID);
        otherPage.setPageLayout(validPageLayout);
       
        allPages = new ArrayList<Page>();
        allPages.add(defaultPage);  
        allPages.add(otherPage);
View Full Code Here


        validPageLayout = new PageLayout();
        validPageLayout.setEntityId(33L);
        validPageLayout.setCode(VALID_PAGE_LAYOUT_CODE);

        defaultPage = new Page(DEFAULT_PAGE_ID);
        defaultPage.setPageLayout(validPageLayout);
        otherPage = new Page(OTHER_PAGE_ID);
        otherPage.setPageLayout(validPageLayout);

        allProfilePages = new ArrayList<Page>();
        allProfilePages.add(defaultPage);
        allProfilePages.add(otherPage);
View Full Code Here

    final int modelSize = 3;
    final String username="Canonical";
        user.setUsername(username);
        user.setEntityId(USER_ID);
    String userProfile = new String(ModelKeys.USER_PROFILE);
        Page personProfile = new Page();
        PageLayout pageLayout = new PageLayout();
        pageLayout.setCode(VALID_PAGE_LAYOUT_CODE);
        personProfile.setPageLayout(pageLayout);
   
    expect(userService.getUserByUsername(username)).andReturn(user).once();
        expect(pageService.getPersonProfilePage(user.getEntityId())).andReturn(personProfile);

    replay(userService, pageService);
View Full Code Here

        //creating a mock user
        final User user = null;
        final ModelMap model = new ModelMap();
        final int modelSize = 4;
        final String username="Canonical";
        Page personProfile = new Page();
        PageLayout pageLayout = new PageLayout();
        pageLayout.setCode("person_profile");
        personProfile.setPageLayout(pageLayout);

        expect(userService.getUserByUsername(username)).andThrow(new UsernameNotFoundException("Username does not exist"));

        replay(userService, pageService);
View Full Code Here

   */
  @RequestMapping(value = {"/{username:.*}"}, method = RequestMethod.GET)
  public String viewProfile(@PathVariable String username, ModelMap model, @RequestParam(required = false) Long referringPageId) {
    logger.debug("Viewing person profile for: " + username);
    User user = userService.getUserByUsername(username);
        Page personProfilePage = pageService.getPersonProfilePage(user.getEntityId());
        addAttributesToModel(model, user, referringPageId);
        model.addAttribute(ModelKeys.PAGE, personProfilePage);
    return ViewNames.getPersonPageView(personProfilePage.getPageLayout().getCode());
  }
View Full Code Here

        assertThat(pages.isEmpty(), is(true));
    }

    @Test
    public void getById_valid_userPage() {
        Page p = repository.get(USER_PAGE_ID);
        assertThat(p, is(notNullValue()));
        assertThat(p.getEntityId(), is(equalTo(USER_PAGE_ID)));
        assertThat(p.getPageType(), is(PageType.USER));
        assertThat(p.getParentPage(), is(nullValue(Page.class)));
        assertThat(p.getSubPages().isEmpty(), is(true));
    }
View Full Code Here

        assertThat(p.getSubPages().isEmpty(), is(true));
    }

    @Test
    public void getById_valid_personProfilePage() {
        Page p = repository.get(PERSON_PROFILE_PAGE_ID);
        assertThat(p.getEntityId(), is(equalTo(PERSON_PROFILE_PAGE_ID)));
        assertThat(p.getPageType(), is(PageType.PERSON_PROFILE));
        assertThat(p.getParentPage(), is(nullValue(Page.class)));
        assertThat(p.getSubPages().isEmpty(), is(false));
    }
View Full Code Here

        assertThat(p.getSubPages().isEmpty(), is(false));
    }

    @Test
    public void getById_valid_subPagePage() {
        Page p = repository.get(SUB_PAGE_ID);
        assertThat(p, is(notNullValue()));
        assertThat(p.getEntityId(), is(equalTo(SUB_PAGE_ID)));
        assertThat(p.getPageType(), is(PageType.SUB_PAGE));
        assertThat(p.getParentPage(), is(notNullValue(Page.class)));
        assertThat(p.getSubPages().isEmpty(), is(true));
    }
View Full Code Here

        assertThat(p.getSubPages().isEmpty(), is(true));
    }

    @Test
    public void getById_invalid() {
        Page p = repository.get(-1L);
        assertThat(p, is(nullValue()));
    }
View Full Code Here

   
    @Test
    @Transactional(readOnly = false)
    @Rollback(true)
    public void createPersonPageForUser_validUser(){
        Page page = repository.createPersonPageForUser(user, defaultPageTemplate);
        assertSame(user, page.getOwner());
        assertEquals(page.getName(), defaultPageTemplate.getName());
        assertNull(page.getParentPage());
        assertEquals(2, page.getSubPages().size());
        assertNotNull(page.getRenderSequence());
        assertNotNull(page.getPageLayout());
        assertEquals("person_profile", page.getPageLayout().getCode());
        assertEquals(1, page.getRegions().size());
        assertEquals(PageType.PERSON_PROFILE, page.getPageType());
        Page subPage1 = page.getSubPages().get(0);
        Page subPage2 = page.getSubPages().get(1);
        assertEquals("Widgets on sub page 1", 2, subPage1.getRegions().get(0).getRegionWidgets().size());
        assertEquals("Widgets on sub page 2", 1, subPage2.getRegions().get(0).getRegionWidgets().size());
        assertEquals("Regions on sub page 1", 1, subPage1.getRegions().size());
        assertEquals("Regions on sub page 2", 1, subPage2.getRegions().size());
        assertNull("no sub pages of sub page 1", subPage1.getSubPages());
        assertNull("no sub pages of sub page 2", subPage2.getSubPages());
        assertEquals("sub page 1 refers to parent page", page.getEntityId(), subPage1.getParentPage().getEntityId());
        assertEquals("sub page 2 refers to parent page", page.getEntityId(), subPage2.getParentPage().getEntityId());
        assertEquals("sub page 1 regions refers to sub page 1", subPage1.getEntityId(), subPage1.getRegions().get(0).getPage().getEntityId());
        assertEquals("sub page 2 regions refers to sub page 2", subPage2.getEntityId(), subPage2.getRegions().get(0).getPage().getEntityId());
        assertEquals("sub page 1 has one column layout", "columns_1", subPage1.getPageLayout().getCode());
        assertEquals("sub page 2 has one column layout", "columns_1", subPage2.getPageLayout().getCode());
        assertEquals(PageType.SUB_PAGE, subPage1.getPageType());
        assertEquals(defaultPageTemplate.getSubPageTemplates().get(0).getName(), subPage1.getName());
        assertEquals(PageType.SUB_PAGE, subPage2.getPageType());
        assertEquals(defaultPageTemplate.getSubPageTemplates().get(1).getName(), subPage2.getName());
        assertSame(user, subPage1.getOwner());
        assertSame(user, subPage2.getOwner());
        assertNotNull(subPage1.getRenderSequence());
        assertNotNull(subPage2.getRenderSequence());
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.Page$SubPageComparator

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.