Package com.dodo.blog.model

Examples of com.dodo.blog.model.Tag


    @GetModel( name = TAG_FORM )
    public Tag getModel()
    {
        Long id = getLongParameter( TAG_ID );

        Tag tag;
        if ( id != null )
        {
            tag = tagService.getTagById( id );
        }
        else
        {
            tag = new Tag();
        }

        return tag;
    }
View Full Code Here


    @Test
    public void testCreateTagsUri() throws Exception
    {
        Assert.assertEquals( "", UriConstructor.createTagUri( null ) );

        Tag tag = new Tag();
        Assert.assertEquals( "", UriConstructor.createTagUri( tag ) );

        tag = new Tag();
        tag.setName( "HTML5" );
        Assert.assertEquals( "/articles/tag/html5", UriConstructor.createTagUri( tag ) );
    }
View Full Code Here

    public List<Article> getArticles( ArticlesRequest request )
    {
        if ( request.getTag() != null )
        {
            List<Article> tagList = new ArrayList<Article>();
            Tag tag = tagService.getTagByNormalizedName( request.getTag() );

            // return empty result if tag was not found
            if ( tag == null )
            {
                return tagList;
View Full Code Here

    }

    @Test
    public void testGetArticlesByTag() throws Exception
    {
        Tag tag = saveTag();

        for ( int i = 0; i < 30; i++ )
        {
            Article article = new Article();
            article.setTag_1( tag.getId() );
            articleService.saveArticle( article );

            article = new Article();
            article.setTag_2( tag.getId() );
            articleService.saveArticle( article );
        }

        ArticlesRequest request = new ArticlesRequest( -1, 20 );
        request.setTag( "google-app-engine" );
View Full Code Here

        return article;
    }

    private Tag saveTag()
    {
        Tag tag = new Tag();
        tag.setName( "Google App Engine" );

        tagService.saveTag( tag );

        return tag;
    }
View Full Code Here

    }

    @Test
    public void testGetTagByNormalizedName()
    {
        Tag tag = saveTag();
        tag = tagService.getTagById( tag.getId() );

        Assert.assertEquals( "google-app-engine", tag.getNormalizedName() );
    }
View Full Code Here

    }

    @Test
    public void testDeleteTag()
    {
        Tag tag = saveTag();

        Long id = tag.getId();
        tagService.deleteTag( id );
        Assert.assertNull( tagService.getTagById( id ) );
    }
View Full Code Here

        Assert.assertEquals( "Google App Engine", tags.get( 0 ).getName() );
    }

    private Tag saveTag()
    {
        Tag tag = new Tag();
        tag.setName( "Google App Engine" );
        tagService.saveTag( tag );

        return tag;
    }
View Full Code Here

TOP

Related Classes of com.dodo.blog.model.Tag

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.