Package org.encuestame.persistence.domain

Examples of org.encuestame.persistence.domain.HashTag


    @Test
    public void testgetTweetpollByHashTagName2() {

        final Calendar calendar = Calendar.getInstance();

        final HashTag hashtag2 = createHashTag("paola");
        final HashTag hashtag3 = createHashTag("juan");

        getTweetPoll().saveOrUpdate(this.tweetPoll);
        final TweetPoll tweetPoll1 = createPublishedTweetPoll(
                secondary.getAccount(),
                createQuestion("question1", secondary.getAccount()),
View Full Code Here


        assertNotNull(this.tweetPoll);
        final Integer limit = 4;

        final Calendar calendar = Calendar.getInstance();
        // Create hashtags
        final HashTag hashtag2 = createHashTag("paola");
        final HashTag hashtag3 = createHashTag("juan");
        // Add hashtags to tweetPoll
        this.tweetPoll.getHashTags().add(hashtag2);
        this.tweetPoll.getHashTags().add(hashtag3);
        getTweetPoll().saveOrUpdate(this.tweetPoll);
        // Publish tweetpoll
View Full Code Here

    /**
     * Test get total tweetpolls published by hashtag.
     */
    @Test
    public void testGetTweetPollsbyHashTagNameAndDateRange() {
        final HashTag myHashTag = createHashTag("preferences");
        final Calendar releaseDate = Calendar.getInstance();
        releaseDate.add(Calendar.DATE, -2);
        final Question myFirstQuestion = createQuestion(
                "What is your favorite kind of movie?", secondary.getAccount());
        final Question mySecondQuestion = createQuestion(
                "What is your favorite kind of song?", secondary.getAccount());
        final TweetPoll tweetPoll = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tweetPoll.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll);
        assertNotNull(tweetPoll);
        releaseDate.add(Calendar.DATE, -4);
        final TweetPoll tweetPoll2 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll2.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll2);
        assertNotNull(tweetPoll2);

        final List<TweetPoll> tweetPollsbyHashTag = getTweetPoll()
                .getTweetPollsbyHashTagNameAndDateRange(myHashTag.getHashTag(),
                        SearchPeriods.SEVENDAYS);
        Assert.assertEquals("Should be", 2, tweetPollsbyHashTag.size());
    }
View Full Code Here

    /**
     *
     */
    @Test
    public void testTpollsByHashTagNameAndDateRange() {
        final HashTag myHashTag = createHashTag("preferences");
        final Calendar releaseDate = Calendar.getInstance();

        final Question myFirstQuestion = createQuestion(
                "What is your favorite kind of movie?", secondary.getAccount());
        final Question mySecondQuestion = createQuestion(
                "What is your favorite kind of song?", secondary.getAccount());

        // FIRST TP
        final TweetPoll tweetPoll = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tweetPoll.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll);
        assertNotNull(tweetPoll);

         //SECOND TP
        releaseDate.add(Calendar.HOUR, -1);
        final TweetPoll tweetPoll2 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll2.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll2);
        assertNotNull(tweetPoll2);

        // THIRD TP
        releaseDate.add(Calendar.HOUR, -4);
        final TweetPoll tweetPoll3 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll3.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll3);
        assertNotNull(tweetPoll3);

//        // FOURTH TP
        releaseDate.add(Calendar.DATE, -7);
        releaseDate.add(Calendar.HOUR, -5);
        final TweetPoll tweetPoll4 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll4.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll4);
        assertNotNull(tweetPoll4);

        // FIFTH
        releaseDate.add(Calendar.WEEK_OF_MONTH, -7);
        final TweetPoll tweetPoll5 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll5.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll5);
        assertNotNull(tweetPoll5);

        // SIXTH
        releaseDate.add(Calendar.YEAR, -1);
        final TweetPoll tweetPoll6 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll6.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll6);
        assertNotNull(tweetPoll6);

        // SEVENTH
        releaseDate.add(Calendar.YEAR, -2);
        final TweetPoll tweetPoll7 = createPublishedTweetPoll(
                this.secondary.getAccount(), mySecondQuestion,
                releaseDate.getTime());
        tweetPoll7.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tweetPoll7);
        assertNotNull(tweetPoll7);

        List<Object[]> tweetPollsbyHashTag = null;

        tweetPollsbyHashTag = getTweetPoll()
                .getTweetPollsRangeStats(myHashTag.getHashTag(), SearchPeriods.ALLTIME);
        Assert.assertEquals("Should be", 6, tweetPollsbyHashTag.size());

        tweetPollsbyHashTag = getTweetPoll()
                 .getTweetPollsRangeStats(myHashTag.getHashTag(),
                         SearchPeriods.TWENTYFOURHOURS);
        Assert.assertEquals("Should be", 3, tweetPollsbyHashTag.size());

       tweetPollsbyHashTag = getTweetPoll()
              .getTweetPollsRangeStats(myHashTag.getHashTag(),
                      SearchPeriods.THIRTYDAYS);
       Assert.assertEquals("Should be", 4, tweetPollsbyHashTag.size());

       tweetPollsbyHashTag = getTweetPoll()
               .getTweetPollsRangeStats(myHashTag.getHashTag(),
                       SearchPeriods.ONEYEAR);
       Assert.assertEquals("Should be", 5, tweetPollsbyHashTag.size());
    }
View Full Code Here

     * Get total hashTagHits by range.
     */
    @Test
    public void testGetTotalHashTagHitsbyDateRange(){
        final Calendar myDate = Calendar.getInstance();
        final HashTag hashTag1 = createHashTag("software2");

        final String ipAddress1 = "192.168.1.1";
        final String ipAddress2 = "192.168.1.2";

        final Hit hit1 = createHashTagHit(hashTag1, ipAddress1);
        final Hit hit2 = createHashTagHit(hashTag1, ipAddress2);

        hit1.setHitDate(myDate.getTime());
        getTweetPoll().saveOrUpdate(hit1);

        // It created today, setted with minus 5 days. so the new date is between friday or Saturday ago
        // out of range
        myDate.add(Calendar.DATE, -9);
        hit2.setHitDate(myDate.getTime());
        getTweetPoll().saveOrUpdate(hit2);

        // Retrieve hits for tag Id in the last 7 days.
        List<Hit> myHits = getFrontEndDao().getHashTagHitsbyDateRange( hashTag1.getHashTagId(), 7);
        assertEquals("Should be equals", 1, myHits.size());
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.HashTag

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.