* @throws EnMeNoResultsFoundException
*/
@Test
public void testGetTotalUsagebyHashtagAndDateRangeGraph() throws EnMeSearchException,
EnMeNoResultsFoundException {
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());
// TP 1
final TweetPoll tp1 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp1.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp1);
assertNotNull(tp1);
// TP 2
releaseDate.add(Calendar.HOUR, -1);
final TweetPoll tp2 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp2.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp2);
assertNotNull(tp2);
// TP 3
releaseDate.add(Calendar.HOUR, -3);
final TweetPoll tp3 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp3.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp3);
assertNotNull(tp3);
// TP 4
releaseDate.add(Calendar.DATE, -1);
releaseDate.add(Calendar.HOUR, -5);
final TweetPoll tp4 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp4.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp4);
assertNotNull(tp4);
// TP 5
releaseDate.add(Calendar.DATE, -1);
final TweetPoll tp5 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp5.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp5);
assertNotNull(tp5);
// TP 6
releaseDate.add(Calendar.DATE, -1);
releaseDate.add(Calendar.HOUR, -2);
final TweetPoll tp6 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp6.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp6);
assertNotNull(tp6);
// TP 7
releaseDate.add(Calendar.YEAR, -1);
final TweetPoll tp7 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp7.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp7);
assertNotNull(tp7);
// TP 8
releaseDate.add(Calendar.MONTH, -1);
final TweetPoll tp8 = createPublishedTweetPoll(
this.secondary.getAccount(), myFirstQuestion,
releaseDate.getTime());
tp8.getHashTags().add(myHashTag);
getTweetPoll().saveOrUpdate(tp8);
assertNotNull(tp8);
final List<ItemStatDetail> itemStatDetail = new ArrayList<ItemStatDetail>();
final ItemStatDetail isd1 = this.createItemStatDetail(tp1.getTweetPollId(),
tp1.getCreateDate());
final ItemStatDetail isd2 = this.createItemStatDetail(tp2.getTweetPollId(),
tp2.getCreateDate());
final ItemStatDetail isd3 = this.createItemStatDetail(tp3.getTweetPollId(),
tp3.getCreateDate());
final ItemStatDetail isd4 = this.createItemStatDetail(tp4.getTweetPollId(),
tp4.getCreateDate());
final ItemStatDetail isd5 = this.createItemStatDetail(tp5.getTweetPollId(),
tp5.getCreateDate());
final ItemStatDetail isd6 = this.createItemStatDetail(tp6.getTweetPollId(),
tp6.getCreateDate());
final ItemStatDetail isd7 = this.createItemStatDetail(tp7.getTweetPollId(),
tp7.getCreateDate());
final ItemStatDetail isd8 = this.createItemStatDetail(tp7.getTweetPollId(),
tp8.getCreateDate());
itemStatDetail.add(isd1);
itemStatDetail.add(isd2);
itemStatDetail.add(isd3);
itemStatDetail.add(isd4);
itemStatDetail.add(isd5);
itemStatDetail.add(isd6);
itemStatDetail.add(isd7);
itemStatDetail.add(isd8);
final List<HashTagDetailStats> compareHashtagListGraph = getStatisticsService()
.compareHashtagListGraph(itemStatDetail, SearchPeriods.ALLTIME,
this.request);
List<HashTagDetailStats> getHashtagAndDateRangeGraphList = getStatisticsService()
.getTotalUsagebyHashtagAndDateRangeGraph(
myHashTag.getHashTag(), SearchPeriods.ALLTIME,
this.request);
}