Package org.apache.rave.model

Examples of org.apache.rave.model.PageTemplate


        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);

        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

    }

    @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 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

        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

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.