Package org.encuestame.persistence.domain

Examples of org.encuestame.persistence.domain.HashTag


     * Create Hash Tag.
     * @param hashTagName
     * @return
     */
    public HashTag createHashTag(final String hashTagName){
        final HashTag hashTag = new HashTag();
        hashTag.setHashTag(hashTagName.toLowerCase());
        hashTag.setHits(0L);
        hashTag.setUpdatedDate(new Date());
        hashTag.setSize(0L);
        getHashTagDao().saveOrUpdate(hashTag);
        return hashTag;
    }
View Full Code Here


     * @param hashTagName name
     * @param hits total hits.
     * @return {@link HashTag}
     */
    public HashTag createHashTag(final String hashTagName, final Long hits){
        final HashTag hastag = this.createHashTag(hashTagName);
        hastag.setHits(hits);
        getHashTagDao().saveOrUpdate(hastag);
        return hastag;
    }
View Full Code Here

     * @param hashTagName
     * @param hits
     * @return
     */
    public HashTag createHashTag(final String hashTagName, final Long hits, final Long size){
        final HashTag hastag = this.createHashTag(hashTagName);
        hastag.setHits(hits);
        hastag.setSize(size);
        hastag.setUpdatedDate(new Date());
        getHashTagDao().saveOrUpdate(hastag);
        return hastag;
    }
View Full Code Here

   *
   * @throws EnMeNoResultsFoundException
   */
  @Test
  public void testAddHashtagToTweetPoll() throws EnMeNoResultsFoundException {
    final HashTag ht = createHashTag("xx");
    final HashTagBean tagBean = this.createHashTagBean("Hashtag bean", 20L,
        ht.getSize().intValue());
    final Question question1 = createQuestion("Why the sea is salad?",
        "html");
    final TweetPoll tp = createTweetPollPublicated(true, true, new Date(),
        this.userAccount, question1);
    final HashTag ht2 = getTweetPollService().addHashtagToTweetPoll(tp,
        tagBean);
    assertEquals("Should be equals", tagBean.getHashTagName(),
        ht2.getHashTag());
  }
View Full Code Here

   * @throws EnMeSearchException
   */
  @Test
  public void testRetrieveHashTagsByGeo() throws EnMeSearchException {

    final HashTag hashtag3 = createHashTag("ana");

    this.initTweetPoll.setLocationLatitude(40.4167F);
    this.initTweetPoll.setLocationLongitude(-3.70325F);
    this.initTweetPoll.getHashTags().add(this.initHashTag);
    this.initTweetPoll.getHashTags().add(hashtag3);
    getTweetPoll().saveOrUpdate(this.initTweetPoll);
    assertNotNull(this.initTweetPoll);

    final TweetPoll tp2 = this.createTweetPollTest(
        "What is your favorite television show?",
        this.initDate.toDate());

    tp2.setLocationLatitude(40.4167F);
    tp2.setLocationLongitude(-3.70325F);
    tp2.getHashTags().add(hashtag3);
    getTweetPoll().saveOrUpdate(tp2);

    assertNotNull(tp2);
   
    final List<ItemGeoLocationBean> items = locationService
        .retreiveHashTagUsebyGeoLo(510d, 30,
            TypeSearchResult.ALL, 2.16991870F, 41.3879169F,
            hashtag3.getHashTag(), SearchPeriods.ALLTIME)
    Assert.assertEquals(items.size(), 2);
  }
View Full Code Here

        this.userAccount.getAccount());

    final TweetPollFolder tpFolder = createTweetPollFolder(
        "My Tp1111 folder", this.userAccount);

    final HashTag tag1 = createHashTag("romantic");
    final HashTag tag2 = createHashTag("suspense");
    final String tagName = tag1.getHashTag();
    final Long questionId = myFirstQuestion.getQid();

    // FIRST TP
    final TweetPoll tweetPoll1 = createPublishedTweetPoll(
View Full Code Here

    /**
     * Test Get total surveys by hashTags.
     */
    @Test
    public void testGetSurveysByHashTags() {
        final HashTag hashtag1 = createHashTag("home");
        final HashTag hashtag2 = createHashTag("technology");
        final HashTag hashtag3 = createHashTag("internet");

        final Survey mySurvey = createDefaultSurvey(this.user, "Survey test",
                new Date());

        mySurvey.getHashTags().add(hashtag1);
View Full Code Here

     * Test get total surveys by hashtag and date range.
     */
    @Test
    public void testGetSurveysbyHashTagNameAndDateRange(){
        final Calendar myDate = Calendar.getInstance();
        final HashTag hashtag1 = createHashTag("home");
        final Survey mySurvey = createDefaultSurvey(this.user, "Survey test",
                myDate.getTime());
        mySurvey.getHashTags().add(hashtag1);
        getSurveyDaoImp().saveOrUpdate(mySurvey);

        myDate.add(Calendar.DATE, -4);
        final Survey mySurvey2 = createDefaultSurvey(this.user, "Survey test 2",
                myDate.getTime());
        mySurvey2.getHashTags().add(hashtag1);
        getSurveyDaoImp().saveOrUpdate(mySurvey2);

        final List<Survey> getTotalSurveysbyHashTag = getSurveyDaoImp().getSurveysbyHashTagNameAndDateRange(hashtag1.getHashTag(), SearchPeriods.SEVENDAYS);
        assertEquals("Should be equals", 2, getTotalSurveysbyHashTag.size());
    }
View Full Code Here

    /**
     * Test get total polls by hashTag.
     */
    @Test
    public void testGetTotalPollsByHashTag() {
        final HashTag hashtag1 = createHashTag("roses");
        final HashTag hashtag2 = createHashTag("red");
        final HashTag hashtag3 = createHashTag("flowers");

        final Poll poll1 = createPoll(myDate.getTime(), this.question,
                "DPMU12", this.userAccount, Boolean.TRUE, Boolean.TRUE);
        poll1.getHashTags().add(hashtag1);
        poll1.getHashTags().add(hashtag2);
        poll1.getHashTags().add(hashtag3);
        getPollDao().saveOrUpdate(poll1);

        final Poll poll2 = createPoll(myDate.getTime(), this.question,
                "DPMU13", this.userAccount, Boolean.TRUE, Boolean.TRUE);

        poll2.getHashTags().add(hashtag3);
        poll2.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(poll2);

        final Poll poll3 = createPoll(myDate.getTime(), this.question,
                "DPMU14", this.userAccount, Boolean.TRUE, Boolean.TRUE);
        poll3.getHashTags().add(hashtag3);
        getPollDao().saveOrUpdate(poll3);
        final List<Poll> totalUsagePoll = getPollDao().getPollByHashTagName(
                hashtag1.getHashTag(), this.START, this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);

        Assert.assertEquals("Should be", 2, totalUsagePoll.size());

        final List<Poll> totalUsagePoll2 = getPollDao().getPollByHashTagName(
                hashtag2.getHashTag(), this.START, this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);

        Assert.assertEquals("Should be", 1, totalUsagePoll2.size());

        final List<Poll> totalUsagePoll3 = getPollDao().getPollByHashTagName(
                hashtag3.getHashTag(), this.START, this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);
        Assert.assertEquals("Should be", 3, totalUsagePoll3.size());
    }
View Full Code Here

     */
    @Test
    public void testGetPollsbyHashTagNameAndDateRange(){
        final Calendar myDate = Calendar.getInstance();
        final Question myQuestion = createQuestion("what are your favorite flowers?", this.userAccount.getAccount());
        final HashTag hashtag1 = createHashTag("roses");

        final Poll poll1 = createPoll(myDate.getTime(), myQuestion,
                "DPMU12", this.userAccount, Boolean.TRUE, Boolean.TRUE);
        poll1.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(poll1);
        myDate.add(Calendar.DATE, -2);


        final Question myQuestion2 = createQuestion("What was your best gift for valentines day?", this.userAccount.getAccount());
        final Poll poll2 = createPoll(myDate.getTime(), myQuestion2,
                "DPMU19", this.userAccount, Boolean.TRUE, Boolean.TRUE);
        poll2.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(poll2);
        final List<Poll> getTotalPollsbyHashTag = getPollDao().getPollsbyHashTagNameAndDateRange(hashtag1.getHashTag(), SearchPeriods.SEVENDAYS);
        Assert.assertEquals("Should be", 2, getTotalPollsbyHashTag.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.