Package org.encuestame.persistence.domain.survey

Examples of org.encuestame.persistence.domain.survey.Poll


        final List<HashTagListGraphData> list2 = getStatisticsService().getTotalUsagebyHashtagAndDateRangeListGraph( this.initHashTag.getHashTag(),
                SearchPeriods.ONEYEAR, request);
        Assert.assertEquals("Should be equals", 1, list2.size());
        Assert.assertEquals("Should be equals", Long.valueOf(3), list2.get(0).getValue());
        // poll 1
        final Poll poll1 = createPoll(currentDate.getTime(), question, this.secondary, true, true);
        poll1.getHashTags().add(initHashTag);
        getPollDao().saveOrUpdate(poll1);
        final List<HashTagListGraphData> list3 = getStatisticsService().getTotalUsagebyHashtagAndDateRangeListGraph( this.initHashTag.getHashTag(),
                SearchPeriods.ONEYEAR, request);
        Assert.assertEquals("Should be equals", 1, list3.size());
        Assert.assertEquals("Should be equals", Long.valueOf(4), list3.get(0).getValue());
        // poll 2
        currentDate.add(Calendar.YEAR, -4);
        final Poll poll2 = createPoll(currentDate.getTime(), question, this.secondary, true, true);
        poll2.getHashTags().add(initHashTag);
        getPollDao().saveOrUpdate(poll2);
        final List<HashTagListGraphData> list4 = getStatisticsService().getTotalUsagebyHashtagAndDateRangeListGraph( this.initHashTag.getHashTag(),
                SearchPeriods.ONEYEAR, request);
        Assert.assertEquals("Should be equals", 1, list4.size());
        Assert.assertEquals("Should be equals", Long.valueOf(4), list4.get(0).getValue());
View Full Code Here


        unitPoll.setQuestionBean(question);
        //"ssss", this.answers, "ALL", "APPROVE" ,Boolean.TRUE, this.tagBeanList
        final String[] answer = {"a", "b"};
        final String[] hashtag = {"hastag1", "hastag2"};
        final CreatePollBean cb = createPollBean("ssssssssssss",answer, hashtag, "MODERATE", "ALL", true, null, null);
        final Poll myPoll = this.pollService.createPoll(cb);
        Assert.assertNotNull(myPoll);
    }
View Full Code Here

  public void testRemovePoll() throws EnMeExpcetion {
    //this.answers[3] = "answer Four";
    final String[] answer = {"a", "b"};
        final String[] hashtag = {"hastag1", "hastag2"};
        final CreatePollBean cb = createPollBean("ssssssssssss",answer, hashtag, "APPROVE", "ALL", true, null, null);
    final Poll newPollService = this.pollService.createPoll(cb);

    final List<QuestionAnswer> beforeAnswers = getQuestionDaoImp()
        .getAnswersByQuestionId(newPollService.getQuestion().getQid());
    assertEquals(beforeAnswers.size(), 2);

    this.pollService.removePoll(newPollService.getPollId());

    /*
     * final Poll checkPoll = this.pollService.getPollById(newPollService
     * .getPollId());
     *
     * assertEquals("Should be equals", "poll invalid with this id" +
     * newPollService.getPollId(), checkPoll);
     */

    final List<QuestionAnswer> afterAnswers = getQuestionDaoImp()
        .getAnswersByQuestionId(newPollService.getQuestion().getQid());
    assertEquals(afterAnswers.size(), 0);

  }
View Full Code Here

   
   
    final String[] answer = {"a", "b"};
        final String[] hashtag = {"hastag1", "hastag2"};
        final CreatePollBean cb = createPollBean("dddd",answer, hashtag, "APPROVE", "ALL", true, null, null);
    final Poll myPoll = this.pollService.createPoll(cb);

    Assert.assertNotNull(myPoll);
    final String[] answer1 = {"a", "b"};
        final String[] hashtag2 = {"hastag3", "hastag4"};
        final CreatePollBean cb2 = createPollBean("dddd",answer1, hashtag2, "APPROVE", "ALL", true, null, null);
    final Poll myPoll2 = this.pollService.createPoll(cb2);
    Assert.assertNotNull(myPoll2);

    final List<Poll> retrievePollsbyTagBeforeRemove = getPollDao()
        .getPollByHashTagName(this.tag1.getHashTag(), this.START,
            this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);
View Full Code Here

    final Question q = createDefaultQuestion("question 1");
    final Question q1 = createDefaultQuestion("question 2");
    final QuestionAnswer a = createQuestionAnswer("Yes", q, "1234DF");
    final QuestionAnswer a1 = createQuestionAnswer("No", q, "5678MG");
    final QuestionAnswer a2 = createQuestionAnswer("Maybe", q1, "9101112");
    final Poll p = createDefaultPoll(q, userAccount);

    final Poll mp = this.pollService.getPollByAnswerId(p.getPollId(),
        a.getQuestionAnswerId(), null);
    Assert.assertNotNull(mp);
     // final Poll mp2 = this.pollService.getPollByAnswerId(p.getPollId(), a2.getQuestionAnswerId(), null);

  }
View Full Code Here

   * Test for retrieve poll results.
   */
  @Test
  public void testGetResultVotes(){
          final Question quest = createQuestion("Do you like action movies", "Yes/No");
          final Poll poll = createPoll(new Date(), quest, "ACTMOV", this.userAccount, Boolean.TRUE, Boolean.TRUE);
          final QuestionAnswer qansw = createQuestionAnswer("Yes", quest, "2023");
          final QuestionAnswer qansw2 =createQuestionAnswer("No", quest, "2024");
          // Create poll results for QuestionAnswer2 = 3
          createPollResults(qansw2, poll);
          createPollResults(qansw2, poll);
View Full Code Here

        getSpringSecurityLoggedUserAccount().getAccount(),
        NotificationEnum.TWEETPOL_CREATED, false,
        DateUtil.getCurrentCalendarDate());

    DateUtil.getCalendarDate().add(Calendar.DATE, -1);
     final Poll poll1 = createDefaultPoll(question, getSpringSecurityLoggedUserAccount());
    createNotification2(poll1.getQuestion().getQuestion(),
        getSpringSecurityLoggedUserAccount().getAccount(),
        NotificationEnum.POLL_CREATED, false,
        DateUtil.getCurrentCalendarDate());

      DateUtil.getCalendarDate().add(Calendar.DATE, -8);
      final Poll poll2 = createDefaultPoll(question, getSpringSecurityLoggedUserAccount());
    createNotification2(poll2.getQuestion().getQuestion(),
        getSpringSecurityLoggedUserAccount().getAccount(),
        NotificationEnum.POLL_CREATED, false,
        DateUtil.getCurrentCalendarDate());
    }
View Full Code Here

        .convertDegreesToRadians(latitude);
    final double longitudeInRadians = EnMeUtils
        .convertDegreesToRadians(longitude);
    List<TweetPollSavedPublishedStatus> tpSavedPublished = new ArrayList<TweetPollSavedPublishedStatus>();
    TweetPoll itemTweetPoll;
    Poll itemPoll;

    if (itemType.equals(TypeSearchResult.ALL)) {
      // POLL
      List<Object[]> distanceFromOriginTweetPoll = this
          .getItemsByDistanceFromOrigin(range, maxItem,
              TypeSearchResult.TWEETPOLL, longitudeInRadians,
              latitudeInRadians, this.earth_radius, period);
      log.debug("Retrieved items by distance -->"
          + distanceFromOriginTweetPoll.size());

      for (Object[] objects : distanceFromOriginTweetPoll) {
        itemTweetPoll = this.getTweetPollById((Long) objects[0]);
        tpSavedPublished = getTweetPollDao().getLinksByTweetPoll(
            itemTweetPoll, null, null, TypeSearchResult.TWEETPOLL);

        log.debug("Tweetpolls published on social networks -->"
            + itemTweetPoll.getTweetPollId());

        socialGeoBean.addAll(ConvertDomainBean
            .convertTweetPollSavedPublishedToSocialGeoLocationBean(
                tpSavedPublished,
                itemTweetPoll.getTweetPollId(), itemType,
                (Float) objects[1], (Float) objects[2],
                objects[3].toString(), (Double) objects[4]));
      }
      // POLL
      List<Object[]> distanceFromOriginPoll = this
          .getItemsByDistanceFromOrigin(range, maxItem,
              TypeSearchResult.POLL, longitudeInRadians,
              latitudeInRadians, this.earth_radius, period);
      log.debug("Retrieved items by distance -->"
          + distanceFromOriginTweetPoll.size());

      for (Object[] objects : distanceFromOriginPoll) {
        itemPoll = this.getPollById((Long) objects[0]);
        tpSavedPublished = getTweetPollDao().getLinksByTweetPoll(
            null, null, itemPoll, TypeSearchResult.POLL);

        log.debug("Polls published on social networks -->"
            + itemPoll.getPollId());

        socialGeoBean.addAll(ConvertDomainBean
            .convertTweetPollSavedPublishedToSocialGeoLocationBean(
                tpSavedPublished,
                itemPoll.getPollId(), itemType,
                (Float) objects[1], (Float) objects[2],
                objects[3].toString(), (Double) objects[4]));
      }

View Full Code Here

    tweetPoll.setLocationLongitude(-3.70325F);
    getTweetPoll().saveOrUpdate(tweetPoll);
    assertNotNull(tweetPoll);
   
    // Create Poll
    final Poll myPoll = createPoll(
        myCalendarDate.getTime(),
        createQuestion("What is your favorite futboll team?",
            secondary.getAccount()), this.secondary, Boolean.TRUE,
        Boolean.TRUE);

    myPoll.setLocationLatitude(40.4167F);
    myPoll.setLocationLongitude(-3.70325F);
    getPollDao().saveOrUpdate(myPoll);
    assertNotNull(myPoll);

    final Survey mySurvey = createDefaultSurvey(this.secondary.getAccount());
    mySurvey.setLocationLatitude(40.4167F);
    mySurvey.setLocationLongitude(-3.70325F);
    getSurveyDaoImp().saveOrUpdate(mySurvey);
    assertNotNull(mySurvey);

    final List<ItemGeoLocationBean> distanceFromOrigin = getLocationService()
        .retrieveItemsByGeo(510d, 30, TypeSearchResult.ALL,
            2.16991870F, 41.3879169F, SearchPeriods.SEVENDAYS);
    Assert.assertEquals(distanceFromOrigin.size(), 3);
    Assert.assertEquals(distanceFromOrigin.get(0).getLatitude(), tweetPoll.getLocationLatitude());
    Assert.assertEquals(distanceFromOrigin.get(1).getLatitude(), myPoll.getLocationLatitude());
  }
View Full Code Here

  @Test
  public void testPublishPollOnMultiplesTweetAccounts() {

    final Question otherQuestion = createDefaultQuestion("What is your favorite android app");

    final Poll myPoll = createDefaultPoll(otherQuestion, this.userAccount);

    final List<TweetPollSavedPublishedStatus> itemsPublished = tweetPollService
        .publishMultiplesOnSocialAccounts(this.socialBeans, null,
            this.tweetText, TypeSearchResult.POLL, myPoll, null);
    assertEquals("Should be equals", 1, itemsPublished.size());
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.survey.Poll

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.