Package org.apache.rave.portal.model

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


    }

    @Test
    public void getByPageLayoutCode_Valid() {
        String codename = "codename";
        MongoDbPageLayout found = new MongoDbPageLayout();
        expect(template.findOne(new Query(where("code").is(codename)), MongoDbPageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn(found);
        replay(template);

        assertThat((MongoDbPageLayout) pageLayoutRepository.getByPageLayoutCode(codename), is(sameInstance(found)));
    }
View Full Code Here


        pageLayoutRepository.get(id);
    }

    @Test
    public void save_Valid() {
        PageLayout item1 = new MongoDbPageLayout();
        item1.setCode("blah1");
        expect(template.findOne(new Query(where("code").is(item1.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn(null);
        template.save(isA(MongoDbPageLayout.class), eq(CollectionNames.PAGE_LAYOUT_COLLECTION));
        expectLastCall();
        replay(template);

        PageLayout saved = pageLayoutRepository.save(item1);

        assertThat(saved, is(instanceOf(MongoDbPageLayout.class)));
        assertThat(saved.getCode(), is(sameInstance(item1.getCode())));
        assertThat(saved.getNumberOfRegions(), is(sameInstance(item1.getNumberOfRegions())));
        assertThat(saved.getRenderSequence(), is(sameInstance(item1.getRenderSequence())));
        assertThat(saved.isUserSelectable(), is(sameInstance(item1.isUserSelectable())));
    }
View Full Code Here

        assertThat(saved.isUserSelectable(), is(sameInstance(item1.isUserSelectable())));
    }

    @Test
    public void save_Null(){
        PageLayout item1 = new MongoDbPageLayout();
        item1.setCode("blah1");
        item1.setNumberOfRegions((long)123);
        item1.setRenderSequence((long)432);
        item1.setUserSelectable(true);
        MongoDbPageLayout toSave = new MongoDbPageLayout();
        expect(template.findOne(new Query(where("code").is(item1.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn(toSave);
        template.save(isA(MongoDbPageLayout.class), eq(CollectionNames.PAGE_LAYOUT_COLLECTION));
        expectLastCall();
        replay(template);
View Full Code Here

        assertThat(saved.isUserSelectable(), is(sameInstance(item1.isUserSelectable())));
    }

    @Test
    public void delete_Valid(){
        PageLayout item = new MongoDbPageLayout();
        item.setCode("123");
        expect(template.findOne(new Query(where("code").is(item.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn((MongoDbPageLayout)item);

          template.remove(item);
        expectLastCall();
        replay(template);
View Full Code Here

        throw new NotImplementedException("No use for an id");
    }

    @Override
    public PageLayout save(PageLayout item) {
        MongoDbPageLayout toSave = (MongoDbPageLayout)getByPageLayoutCode(item.getCode());
        if(toSave == null) {
            toSave = new MongoDbPageLayout();
        }
        update(item, toSave);
        template.save(toSave, PAGE_LAYOUT_COLLECTION);
        return toSave;
    }
View Full Code Here

        throw new NotImplementedException("No use for an id");
    }

    @Override
    public PageLayout save(PageLayout item) {
        MongoDbPageLayout toSave = (MongoDbPageLayout)getByPageLayoutCode(item.getCode());
        if(toSave == null) {
            toSave = new MongoDbPageLayout();
        }
        update(item, toSave);
        template.save(toSave, PAGE_LAYOUT_COLLECTION);
        return toSave;
    }
View Full Code Here

    }

    @Test
    public void getByPageLayoutCode_Valid() {
        String codename = "codename";
        MongoDbPageLayout found = new MongoDbPageLayout();
        expect(template.findOne(new Query(where("code").is(codename)), MongoDbPageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn(found);
        replay(template);

        assertThat((MongoDbPageLayout) pageLayoutRepository.getByPageLayoutCode(codename), is(sameInstance(found)));
    }
View Full Code Here

        pageLayoutRepository.get(id);
    }

    @Test
    public void save_Valid() {
        PageLayout item1 = new MongoDbPageLayout();
        item1.setCode("blah1");
        expect(template.findOne(new Query(where("code").is(item1.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn(null);
        template.save(isA(MongoDbPageLayout.class), eq(CollectionNames.PAGE_LAYOUT_COLLECTION));
        expectLastCall();
        replay(template);

        PageLayout saved = pageLayoutRepository.save(item1);

        assertThat(saved, is(instanceOf(MongoDbPageLayout.class)));
        assertThat(saved.getCode(), is(sameInstance(item1.getCode())));
        assertThat(saved.getNumberOfRegions(), is(sameInstance(item1.getNumberOfRegions())));
        assertThat(saved.getRenderSequence(), is(sameInstance(item1.getRenderSequence())));
        assertThat(saved.isUserSelectable(), is(sameInstance(item1.isUserSelectable())));
    }
View Full Code Here

        assertThat(saved.isUserSelectable(), is(sameInstance(item1.isUserSelectable())));
    }

    @Test
    public void save_Null(){
        PageLayout item1 = new MongoDbPageLayout();
        item1.setCode("blah1");
        item1.setNumberOfRegions((long)123);
        item1.setRenderSequence((long)432);
        item1.setUserSelectable(true);
        MongoDbPageLayout toSave = new MongoDbPageLayout();
        expect(template.findOne(new Query(where("code").is(item1.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn(toSave);
        template.save(isA(MongoDbPageLayout.class), eq(CollectionNames.PAGE_LAYOUT_COLLECTION));
        expectLastCall();
        replay(template);
View Full Code Here

        assertThat(saved.isUserSelectable(), is(sameInstance(item1.isUserSelectable())));
    }

    @Test
    public void delete_Valid(){
        PageLayout item = new MongoDbPageLayout();
        item.setCode("123");
        expect(template.findOne(new Query(where("code").is(item.getCode())), pageLayoutRepository.CLASS, CollectionNames.PAGE_LAYOUT_COLLECTION)).andReturn((MongoDbPageLayout)item);

          template.remove(item);
        expectLastCall();
        replay(template);
View Full Code Here

TOP

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

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.