Package org.apache.rave.portal.model

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


    }
   
    @Test
    public void getDefaultPersonPage_valid(){
        // get default page template
        PageTemplate pt = pageTemplateRepository.getDefaultPersonPage();
        // default page tests
        assertNotNull(pt);
        assertEquals("Template for person profile pages", pt.getDescription());
        assertEquals("Person Profile", pt.getName());
        assertEquals(PageType.PERSON_PROFILE, pt.getPageType());
        assertEquals(0, pt.getRenderSequence());
        assertTrue(pt.isDefaultTemplate());
        assertEquals("# of regions for parent page", 1, pt.getPageTemplateRegions().size());
        assertEquals("person_profile", pt.getPageLayout().getCode());
        assertEquals("# of widgets on parent page region", 2, pt.getPageTemplateRegions().get(0).getPageTemplateWidgets().size());
        assertEquals("# of sub pages for parent page",2, pt.getSubPageTemplates().size());
        // get default page sub pages
        PageTemplate subPage1 = pt.getSubPageTemplates().get(0);
        PageTemplate subPage2 = pt.getSubPageTemplates().get(1);
        // sub page 1 tests
        assertNotNull(subPage1);
        assertEquals("Template for the About sub page for the person profile", subPage1.getDescription());
        assertEquals("About", subPage1.getName());
        assertEquals(PageType.SUB_PAGE, subPage1.getPageType());
        assertEquals(0, subPage1.getRenderSequence());
        assertFalse(subPage1.isDefaultTemplate());
        assertEquals("# of regions for sub page 1", 1, subPage1.getPageTemplateRegions().size());
        assertEquals("columns_1", subPage1.getPageLayout().getCode());
        assertEquals("# of widgets on sub page 1 region 1", 2, subPage1.getPageTemplateRegions().get(0).getPageTemplateWidgets().size());
        assertEquals("# of sub pages for sub page 1", 0, subPage1.getSubPageTemplates().size());
        // sub page 2 tests
        assertNotNull(subPage2);
        assertEquals("Template for the My Activity sub page for the person profile", subPage2.getDescription());
        assertEquals("My Activity", subPage2.getName());
        assertEquals(PageType.SUB_PAGE, subPage2.getPageType());
        assertEquals(1, subPage2.getRenderSequence());
        assertFalse(subPage2.isDefaultTemplate());
        assertEquals("# of regions for sub page 2", 1, subPage2.getPageTemplateRegions().size());
        assertEquals("columns_1", subPage2.getPageLayout().getCode());
        assertEquals("# of widgets on sub page 2 region 1", 1, subPage2.getPageTemplateRegions().get(0).getPageTemplateWidgets().size());
        assertEquals("# of sub pages for sub page 2", 0, subPage2.getSubPageTemplates().size());
        // parent page region tests
        PageTemplateRegion ptRegion1 = pt.getPageTemplateRegions().get(0);
        assertEquals(pt.getEntityId(), ptRegion1.getPageTemplate().getEntityId());
        assertEquals(0, ptRegion1.getRenderSequence());
        assertEquals(2, ptRegion1.getPageTemplateWidgets().size());
        assertTrue(ptRegion1.isLocked());
        // parent page region 1 widget 1 tests
        PageTemplateWidget ptw1 = ptRegion1.getPageTemplateWidgets().get(0);
        assertEquals(ptw1.getPageTemplateRegion().getEntityId(), ptRegion1.getEntityId());
        assertEquals(0, ptw1.getRenderSeq());
        assertNotNull(ptw1.getWidget());
        assertTrue(ptw1.isLocked());
        // parent page region widget 2 tests
        PageTemplateWidget ptw2 = ptRegion1.getPageTemplateWidgets().get(1);
        assertEquals(ptw2.getPageTemplateRegion().getEntityId(), ptRegion1.getEntityId());
        assertEquals(1, ptw2.getRenderSeq());
        assertNotNull(ptw2.getWidget());
        assertTrue(ptw2.isLocked());
        // sub page 1 region 1 tests
        PageTemplateRegion sp1Region1 = subPage1.getPageTemplateRegions().get(0);
        assertEquals(subPage1.getEntityId(), sp1Region1.getPageTemplate().getEntityId());
        assertEquals(0, sp1Region1.getRenderSequence());
        assertEquals(2, sp1Region1.getPageTemplateWidgets().size());
        assertTrue(sp1Region1.isLocked());
        // sub page 1 region 1 widget 1 tests
        PageTemplateWidget spw1 = sp1Region1.getPageTemplateWidgets().get(0);
        assertEquals(spw1.getPageTemplateRegion().getEntityId(), sp1Region1.getEntityId());
        assertEquals(0, spw1.getRenderSeq());
        assertNotNull(spw1.getWidget());
        assertTrue(spw1.isLocked());
        // sub page 1 region 1 widget 2 tests
        PageTemplateWidget spw2 = sp1Region1.getPageTemplateWidgets().get(1);
        assertEquals(spw2.getPageTemplateRegion().getEntityId(), sp1Region1.getEntityId());
        assertEquals(1, spw2.getRenderSeq());
        assertNotNull(spw2.getWidget());
        assertTrue(spw2.isLocked());
        // sub page 2 region tests
        PageTemplateRegion sp2Region1 = subPage2.getPageTemplateRegions().get(0);
        assertEquals(subPage2.getEntityId(), sp2Region1.getPageTemplate().getEntityId());
        assertEquals(0, sp2Region1.getRenderSequence());
        assertEquals(1, sp2Region1.getPageTemplateWidgets().size());
        assertTrue(sp2Region1.isLocked());
        // sub page 2 region widget 1 tests
        PageTemplateWidget sp2w1 = sp2Region1.getPageTemplateWidgets().get(0);
View Full Code Here


        return CollectionUtils.<PageTemplate>toBaseTypedList(templates);
    }

    @Override
    public PageTemplate getDefaultPage(PageType pageType) {
        PageTemplate temp = template.findOne(new Query(where("pageType").is(pageType.getPageType().toUpperCase()).andOperator(where("defaultTemplate").is(true))), MongoDbPageTemplate.class, PAGE_TEMPLATE_COLLECTION);
        converter.hydrate(temp, PageTemplate.class);
        return temp;
    }
View Full Code Here

    @Test
    public void getAllPersonProfilePages_noPersonPage() {
        List<Page> VALID_PAGES = new ArrayList<Page>();
        Page personPage = new PageImpl();
        PageTemplate pageTemplate = new PageTemplateImpl();
        UserImpl user = new UserImpl();

        expect(pageRepository.getAllPages(VALID_USER_ID, PageType.PERSON_PROFILE)).andReturn(VALID_PAGES);
        expect(userService.getUserById(isA(String.class))).andReturn(user).once();
        expect(pageTemplateRepository.getDefaultPage(PageType.PERSON_PROFILE)).andReturn(pageTemplate).once();
View Full Code Here

    @Test
    public void addNewUserPage_noExistingPages() {
        final String PAGE_NAME = "my new page";
        final Long EXPECTED_RENDER_SEQUENCE = 1L;
        PageTemplate pageTemplate = new PageTemplateImpl() ;
        Page expectedPage = new PageImpl();
        expectedPage.setName(PAGE_NAME);
        expectedPage.setOwnerId(user.getId());
        expectedPage.setPageLayout(pageLayout);
        expectedPage.setRegions(createEmptyRegionList(pageLayout.getNumberOfRegions()));
View Full Code Here

    @Test
    public void addNewUserPage_noExistingPages_and_have_template() {
        final String PAGE_NAME = "my new page";
        final Long EXPECTED_RENDER_SEQUENCE = 1L;
        PageTemplate pageTemplate = new PageTemplateImpl();
        Page userPage = new PageImpl();
        userPage.setName("Page Template");
        userPage.setRegions(createEmptyRegionList(pageLayout.getNumberOfRegions()));

        Page expectedPage = new PageImpl();
View Full Code Here

    @Test
    public void addNewDefaultUserPage() {

        final Long EXPECTED_RENDER_SEQUENCE = 1L;
        PageTemplate pageTemplate = new PageTemplateImpl();
        Page expectedPage = new PageImpl();
        expectedPage.setName(defaultPageName);
        expectedPage.setOwnerId(user.getId());
        expectedPage.setPageLayout(pageLayout);
        expectedPage.setRegions(createEmptyRegionList(pageLayout.getNumberOfRegions()));
View Full Code Here

    }

    @Test
    public void getAll_Valid() {
        List<MongoDbPageTemplate> templates = new ArrayList<MongoDbPageTemplate>();
        PageTemplate temp = new MongoDbPageTemplate();
        templates.add((MongoDbPageTemplate)temp);
        expect(template.findAll(MongoDbPageTemplate.class, CollectionNames.PAGE_TEMPLATE_COLLECTION)).andReturn(templates);
        converter.hydrate(temp, PageTemplate.class);
        expectLastCall();
        replay(template, converter);
View Full Code Here

        expect(template.findOne(new Query(where("pageType").is(pageType.getPageType().toUpperCase()).andOperator(where("defaultTemplate").is(true))), MongoDbPageTemplate.class, CollectionNames.PAGE_TEMPLATE_COLLECTION)).andReturn(found);
        converter.hydrate(found, PageTemplate.class);
        expectLastCall();
        replay(converter, template);

        PageTemplate returned = templateRepository.getDefaultPage(pageType);

        assertThat((MongoDbPageTemplate)returned, is(sameInstance(found)));
    }
View Full Code Here

        assertThat((MongoDbPageTemplate)returned, is(sameInstance(found)));
    }

    @Test
    public void save_Valid(){
        PageTemplate pageTemplate = new PageTemplateImpl();
        MongoDbPageTemplate converted = new MongoDbPageTemplate();

        expect(converter.convert(pageTemplate, PageTemplate.class)).andReturn(converted);
        template.save(converted, CollectionNames.PAGE_TEMPLATE_COLLECTION);
        expectLastCall();
        converter.hydrate(converted, PageTemplate.class);
        expectLastCall();
        replay(converter, template);

        PageTemplate saved = templateRepository.save(pageTemplate);
        assertThat(converted, is(sameInstance(saved)));
    }
View Full Code Here

    }
   
    @Test
    public void getDefaultPersonPage_valid(){
        // get default page template
        PageTemplate pt = pageTemplateRepository.getDefaultPage(PageType.PERSON_PROFILE);
        // default page tests
        assertNotNull(pt);
        assertEquals("Template for person profile pages", pt.getDescription());
        assertEquals("Person Profile", pt.getName());
        assertEquals(PageType.PERSON_PROFILE, pt.getPageType());
        assertEquals(0, pt.getRenderSequence());
        assertTrue(pt.isDefaultTemplate());
        assertEquals("# of regions for parent page", 1, pt.getPageTemplateRegions().size());
        assertEquals("person_profile", pt.getPageLayout().getCode());
        assertEquals("# of widgets on parent page region", 2, pt.getPageTemplateRegions().get(0).getPageTemplateWidgets().size());
        assertEquals("# of sub pages for parent page",2, pt.getSubPageTemplates().size());
        // get default page sub pages
        PageTemplate subPage1 = pt.getSubPageTemplates().get(0);
        PageTemplate subPage2 = pt.getSubPageTemplates().get(1);
        // sub page 1 tests
        assertNotNull(subPage1);
        assertEquals("Template for the About sub page for the person profile", subPage1.getDescription());
        assertEquals("About", subPage1.getName());
        assertEquals(PageType.SUB_PAGE, subPage1.getPageType());
        assertEquals(0, subPage1.getRenderSequence());
        assertFalse(subPage1.isDefaultTemplate());
        assertEquals("# of regions for sub page 1", 1, subPage1.getPageTemplateRegions().size());
        assertEquals("columns_1", subPage1.getPageLayout().getCode());
        assertEquals("# of widgets on sub page 1 region 1", 2, subPage1.getPageTemplateRegions().get(0).getPageTemplateWidgets().size());
        assertEquals("# of sub pages for sub page 1", 0, subPage1.getSubPageTemplates().size());
        // sub page 2 tests
        assertNotNull(subPage2);
        assertEquals("Template for the My Activity sub page for the person profile", subPage2.getDescription());
        assertEquals("My Activity", subPage2.getName());
        assertEquals(PageType.SUB_PAGE, subPage2.getPageType());
        assertEquals(1, subPage2.getRenderSequence());
        assertFalse(subPage2.isDefaultTemplate());
        assertEquals("# of regions for sub page 2", 1, subPage2.getPageTemplateRegions().size());
        assertEquals("columns_1", subPage2.getPageLayout().getCode());
        assertEquals("# of widgets on sub page 2 region 1", 1, subPage2.getPageTemplateRegions().get(0).getPageTemplateWidgets().size());
        assertEquals("# of sub pages for sub page 2", 0, subPage2.getSubPageTemplates().size());
        // parent page region tests
        PageTemplateRegion ptRegion1 = pt.getPageTemplateRegions().get(0);
        assertEquals(pt.getEntityId(), ptRegion1.getPageTemplate().getEntityId());
        assertEquals(0, ptRegion1.getRenderSequence());
        assertEquals(2, ptRegion1.getPageTemplateWidgets().size());
        assertTrue(ptRegion1.isLocked());
        // parent page region 1 widget 1 tests
        PageTemplateWidget ptw1 = ptRegion1.getPageTemplateWidgets().get(0);
        assertEquals(ptw1.getPageTemplateRegion().getEntityId(), ptRegion1.getEntityId());
        assertEquals(0, ptw1.getRenderSeq());
        assertNotNull(ptw1.getWidget());
        assertTrue(ptw1.isLocked());
        // parent page region widget 2 tests
        PageTemplateWidget ptw2 = ptRegion1.getPageTemplateWidgets().get(1);
        assertEquals(ptw2.getPageTemplateRegion().getEntityId(), ptRegion1.getEntityId());
        assertEquals(1, ptw2.getRenderSeq());
        assertNotNull(ptw2.getWidget());
        assertTrue(ptw2.isLocked());
        // sub page 1 region 1 tests
        PageTemplateRegion sp1Region1 = subPage1.getPageTemplateRegions().get(0);
        assertEquals(subPage1.getEntityId(), sp1Region1.getPageTemplate().getEntityId());
        assertEquals(0, sp1Region1.getRenderSequence());
        assertEquals(2, sp1Region1.getPageTemplateWidgets().size());
        assertTrue(sp1Region1.isLocked());
        // sub page 1 region 1 widget 1 tests
        PageTemplateWidget spw1 = sp1Region1.getPageTemplateWidgets().get(0);
        assertEquals(spw1.getPageTemplateRegion().getEntityId(), sp1Region1.getEntityId());
        assertEquals(0, spw1.getRenderSeq());
        assertNotNull(spw1.getWidget());
        assertTrue(spw1.isLocked());
        // sub page 1 region 1 widget 2 tests
        PageTemplateWidget spw2 = sp1Region1.getPageTemplateWidgets().get(1);
        assertEquals(spw2.getPageTemplateRegion().getEntityId(), sp1Region1.getEntityId());
        assertEquals(1, spw2.getRenderSeq());
        assertNotNull(spw2.getWidget());
        assertTrue(spw2.isLocked());
        // sub page 2 region tests
        PageTemplateRegion sp2Region1 = subPage2.getPageTemplateRegions().get(0);
        assertEquals(subPage2.getEntityId(), sp2Region1.getPageTemplate().getEntityId());
        assertEquals(0, sp2Region1.getRenderSequence());
        assertEquals(1, sp2Region1.getPageTemplateWidgets().size());
        assertTrue(sp2Region1.isLocked());
        // sub page 2 region widget 1 tests
        PageTemplateWidget sp2w1 = sp2Region1.getPageTemplateWidgets().get(0);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.PageTemplate

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.