Examples of TagImpl


Examples of org.apache.rave.portal.model.impl.TagImpl

    @Autowired
    JpaTagConverter jpaTagConverter;

    @Test
    public void convert_valid_tagImpl(){
        TagImpl tag = new TagImpl("blazer");
        JpaTag jpaTag = jpaTagConverter.convert(tag);
        assertNotNull(jpaTag);
        assertEquals(tag.getKeyword(), jpaTag.getKeyword());
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

        int offset = 2;
        int pagesize = 10;
        String tagKeyword = "test";
        List<Widget> widgets = Lists.newArrayList();
        Widget widget = new WidgetImpl();
        Tag tag = new TagImpl();
        expect(template.find(isA(Query.class))).andReturn(widgets);
        replay(template);
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    }

    @Test
    public void getAll(){
        List<Tag> tags = Arrays.<Tag>asList(new TagImpl(), new TagImpl());

        expect(tagTemplate.find(new Query())).andReturn(tags);
        replay(tagTemplate);

        List<Tag> result = repo.getAll();
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    }

    @Test
    public void getByKeyword() {
        String keyword = "key";
        Tag t = new TagImpl("1", keyword);
        expect(tagTemplate.findOne(Query.query(Criteria.where("keyword").is(keyword)))).andReturn(t);
        replay(tagTemplate);

        Tag fromRepo = repo.getByKeyword(keyword);
        assertThat(fromRepo.getKeyword(), is(equalTo(keyword)));
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    @Test
    public void get() {
        String keyword = "key";
        String id = "1";
        Tag t = new TagImpl(id, keyword);
        expect(tagTemplate.get(id)).andReturn(t);
        replay(tagTemplate);

        Tag fromRepo = repo.get(id);
        assertThat(fromRepo.getId(), is(equalTo(id)));
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    }

    @Test
    public void save(){
        String keyword = "KEYWORD";
        Tag tag = new TagImpl("ID", keyword);
        expect(tagTemplate.count(Query.query(Criteria.where("keyword").is(keyword)))).andReturn(0L);
        expect(tagTemplate.save(tag)).andReturn(tag);
        replay(tagTemplate);
        Tag returned = repo.save(tag);
        verify(tagTemplate);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    }

    @Test
    public void save_more(){
        String keyword = "KEYWORD";
        Tag tag = new TagImpl("ID", keyword);
        expect(tagTemplate.count(Query.query(Criteria.where("keyword").is(keyword)))).andReturn(1L);
        replay(tagTemplate);
        Tag returned = repo.save(tag);
        verify(tagTemplate);
        assertThat(returned, is(sameInstance(tag)));
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    }

    @Test
    public void delete(){
        String id ="id";
        Tag tag = new TagImpl(id, "keyword");
        tagTemplate.remove(Query.query(Criteria.where("_id").is(id)));
        expectLastCall();
        replay(tagTemplate);

        repo.delete(tag);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

    }

    private Tag getTag(String keyword) {
        Tag tag = tagService.getTagByKeyword(keyword);
        if (tag == null) {
            tag = new TagImpl(keyword);
            tag = tagService.save(tag);
        }
        return tag;
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.TagImpl

        String keyword = "misc";
        // make sure we do have a tag with the keyword in the db
        JpaTag control = (JpaTag)repository.getByKeyword(keyword);
        assertNotNull(control);
        // create a tag with the keyword not of JpaTag.class for branch coverage
        TagImpl tag = new TagImpl(keyword);
        assertNotNull(tag);
        repository.delete(tag);
        assertNull(repository.getByKeyword(keyword));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.