Package org.apache.rave.model

Examples of org.apache.rave.model.PageTemplate


    }

    @Test
    public void getAll_Valid() {
        List<PageTemplate> templates = new ArrayList<PageTemplate>();
        PageTemplate temp = new MongoDbPageTemplate();
        templates.add((MongoDbPageTemplate)temp);
        expect(template.find(new Query())).andReturn(templates);
        replay(template);

        List<PageTemplate> returned = templateRepository.getAll();
View Full Code Here


        PageType pageType = PageType.get("user");
        MongoDbPageTemplate found = new MongoDbPageTemplate();
        expect(template.findOne(new Query(where("pageType").is(pageType.getPageType().toUpperCase()).andOperator(where("defaultTemplate").is(true))))).andReturn(found);
        replay(template);

        PageTemplate returned = templateRepository.getDefaultPage(pageType.toString());

        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(template.save(eq(converted))).andReturn(converted);
        replay(template);

        PageTemplate saved = templateRepository.save(pageTemplate);
        assertThat(converted, is(sameInstance(saved)));
    }
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.getAllPagesForUserType(VALID_USER_ID, PageType.PERSON_PROFILE.toString())).andReturn(VALID_PAGES);
        expect(userService.getUserById(isA(String.class))).andReturn(user).once();
        expect(pageTemplateRepository.getDefaultPage(PageType.PERSON_PROFILE.toString())).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

        assertThat(converter.convert(template), is(sameInstance(template)));
    }

    @Test
    public void nullConversion() {
        PageTemplate template = null;
        assertThat(converter.convert(template), is(nullValue()));
    }
View Full Code Here

    }


    @Test
    public void convertValid() {
        PageTemplate template = new PageTemplateImpl("1");
        template.setName("name");
        template.setSubPageTemplates(new ArrayList<PageTemplate>());
        template.setDefaultTemplate(true);
        template.setRenderSequence(1);
        template.setPageTemplateRegions(new ArrayList<PageTemplateRegion>());
        template.setPageLayout(new PageLayoutImpl());
        template.setParentPageTemplate(new PageTemplateImpl("1"));
        template.setDescription("Description");
        template.setPageType(PageType.USER.toString());

        JpaPageTemplate jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
        assertThat(jpaTemplate, is(instanceOf(JpaPageTemplate.class)));
        assertThat(jpaTemplate.getId().toString(), is(equalTo(template.getId())));
        assertThat(jpaTemplate.getPageType(), is(equalTo(template.getPageType())));
        assertThat(jpaTemplate.getName(), is(equalTo(template.getName())));
        assertThat(jpaTemplate.getDescription(), is(equalTo(template.getDescription())));
        assertThat(jpaTemplate.getParentPageTemplate(), is(instanceOf(JpaPageTemplate.class)));
        assertThat(jpaTemplate.getPageLayout(), is(instanceOf(JpaPageLayout.class)));
        assertThat(jpaTemplate.getPageTemplateRegions(), is(equalTo(template.getPageTemplateRegions())));
        assertThat(jpaTemplate.getRenderSequence(), is(equalTo(template.getRenderSequence())));
        assertThat(jpaTemplate.isDefaultTemplate(), is(equalTo(template.isDefaultTemplate())));
        assertThat(jpaTemplate.getSubPageTemplates(), is(equalTo(template.getSubPageTemplates())));
    }
View Full Code Here

        assertThat(pageTemplateList.size(), is(equalTo(1)));
    }

    @Test
    public void get_valid(){
        PageTemplate pageTemplateList = pageTemplateRepository.get("1");
        assertNotNull(pageTemplateList);
        assertThat(pageTemplateList.getId(), is(equalTo("1")));
        assertThat(pageTemplateList.getPageType(), is(equalTo("PERSON_PROFILE")));
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.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.