UserAccount userAcc= getSpringSecurityLoggedUserAccount();
//1- Create Tag, Question and TweetPoll
final Date creationDate = new Date();
/* HashTag **/
final HashTag hashtag1 = createHashTag("romantic");
/* Question **/
final Question question = createQuestion("What is your favorite type of movies?", "");
/* TweetPoll **/
final TweetPoll myTweetPoll = createPublishedTweetPoll(question, userAcc);
/* Poll **/
final Poll myPoll = createPoll(creationDate, question, userAcc, Boolean.TRUE, Boolean.TRUE);
/* Survey **/
final Survey mySurvey = createDefaultSurvey(userAcc.getAccount(), "My First Encuestame Survey", creationDate);
// 2- Add HashTag to TweetPoll, Poll or Survey
myTweetPoll.getHashTags().add(hashtag1);
getTweetPoll().saveOrUpdate(myTweetPoll);
myPoll.getHashTags().add(hashtag1);
getPollDao().saveOrUpdate(myPoll);
mySurvey.getHashTags().add(hashtag1);
getSurveyDaoImp().saveOrUpdate(mySurvey);
// 3- Create TweetPollSavedPublishedStatus -- Create Social network link.
//Total Usage by Social Networks
final SocialAccount socialAccount = createDefaultSettedSocialAccount(getSpringSecurityLoggedUserAccount());
assertNotNull(socialAccount);
final String tweetContent = "Tweet content text";
final TweetPollSavedPublishedStatus tpSaved = createTweetPollSavedPublishedStatus(
myTweetPoll, " ", socialAccount, tweetContent);
tpSaved.setApiType(SocialProvider.TWITTER);
getTweetPoll().saveOrUpdate(tpSaved);
assertNotNull(tpSaved);
// Total Usaged by HashTag (TweetPoll, Poll or Survey)
// Total Usage by HashTag(Hits)
createHashTagHit(hashtag1, "192.1.1.1");
createHashTagHit(hashtag1, "192.1.1.2");
createHashTagHit(hashtag1, "192.1.1.3");
createHashTagHit(hashtag1, "192.1.1.4");
createHashTagHit(hashtag1, "192.1.1.5");
final Long totalHitsbyTag = getFrontEndDao().getTotalHitsbyType(hashtag1.getHashTagId(),
TypeSearchResult.HASHTAG, null);
Assert.assertEquals("Should be equals ", totalHitsbyTag.intValue(), 5);
// 4- Get total Usage by tweetpoll voted.