Examples of JpaTag


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

    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.JpaTag

    }


    @Test
    public void convert_valid_jpaTag(){
        JpaTag tag = new JpaTag();
        tag.setKeyword("blazer");
        tag.setEntityId(387L);
        JpaTag jpaTag = jpaTagConverter.convert(tag);
        assertNotNull(jpaTag);
        assertSame(tag, jpaTag);
    }
View Full Code Here

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

    @Test
    @Transactional
    @Rollback(true)
    public void save_valid(){
        JpaTag tag = new JpaTag();
        String ordnance = "ordnance";
        tag.setKeyword(ordnance);
        repository.save(tag);
        Tag foundTag = repository.getByKeyword(ordnance);
        assertNotNull(foundTag);
        assertEquals(tag.getKeyword(), foundTag.getKeyword());
    }
View Full Code Here

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

    @Test
    @Transactional
    @Rollback(true)
    public void delete_valid_jpaTag(){
        String keyword = "misc";
        JpaTag jpaTag = (JpaTag)repository.getByKeyword(keyword);
        assertNotNull(jpaTag);
        repository.delete(jpaTag);
        assertNull(repository.getByKeyword(keyword));
    }
View Full Code Here

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

    @Transactional
    @Rollback(true)
    public void delete_valid_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);
View Full Code Here

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

    public JpaTag convert(Tag source) {
        return source instanceof JpaTag ? (JpaTag)source : createEntity(source);
    }

    private JpaTag createEntity(Tag source) {
        JpaTag convertedTag;
        TypedQuery<JpaTag> query = manager.createNamedQuery(JpaTag.FIND_BY_KEYWORD, JpaTag.class);
        query.setParameter(JpaTag.KEYWORD_PARAM, source.getKeyword());
        convertedTag = JpaUtil.getSingleResult(query.getResultList());

        if (convertedTag == null){
            convertedTag = new JpaTag();
        }
        updateProperties(source, convertedTag);
        return convertedTag;
    }
View Full Code Here

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

        return manager.find(JpaTag.class, Long.parseLong(id));
    }

    @Override
    public Tag save(Tag item) {
        JpaTag tag = converter.convert(item);
        return saveOrUpdate(tag.getEntityId(), manager, tag);
    }
View Full Code Here

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

        return manager.find(JpaTag.class, id);
    }

    @Override
    public Tag save(Tag item) {
        JpaTag tag = converter.convert(item);
        return saveOrUpdate(tag.getEntityId(), manager, tag);
    }
View Full Code Here

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

        return manager.find(JpaTag.class, id);
    }

    @Override
    public Tag save(Tag item) {
        JpaTag tag = converter.convert(item);
        return saveOrUpdate(tag.getEntityId(), manager, tag);
    }
View Full Code Here

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

    @Test
    @Transactional
    @Rollback(true)
    public void save_valid(){
        Tag tag = new JpaTag();
        String ordnance = "ordnance";
        tag.setKeyword(ordnance);
        tag.setWidgets(new ArrayList<WidgetTag>());
        repository.save(tag);
        Tag foundTag = repository.getByKeyword(ordnance);
        assertNotNull(foundTag);
        assertEquals(tag.getKeyword(), foundTag.getKeyword());
        assertEquals(tag.getWidgets().size(), foundTag.getWidgets().size());
    }
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.