Package org.encuestame.persistence.domain.question

Examples of org.encuestame.persistence.domain.question.Question


   */
  @Test
  @Category(DefaultTest.class)
  public void testSearchTweetsPollScheduled() throws EnMeExpcetion {

    final Question question1 = createQuestion("Why the sky is blue ?",
        "html");
    final DateTime dt = new DateTime();
    final TweetPoll tp = createTweetPollPublicated(true, true, dt.toDate(),
        this.userAccount, question1);
    tp.setScheduleTweetPoll(Boolean.TRUE);
View Full Code Here


  }

  @Test
  public void testSearchTweetsPollFavourites() throws EnMeExpcetion {

    final Question question1 = createQuestion("Why the sea is big? ",
        "html");
    final DateTime dt = new DateTime();
    final TweetPoll tp = createTweetPollPublicated(true, true, dt.toDate(),
        this.userAccount, question1);
View Full Code Here

   * @throws EnMeExpcetion
   */
  @Test
  public void testsearchTweetsPollsLastWeek() throws EnMeExpcetion {

    final Question question1 = createQuestion("Why the sea is salad?",
        "html");
    final DateTime dt = new DateTime();
    final TweetPoll tp = createTweetPollPublicated(true, true, dt
        .minusDays(3).toDate(), this.userAccount, question1);
    tp.setTweetPollFolder(this.folder);
View Full Code Here

   *
   * @throws EnMeExpcetion
   */
  @Test
  public void testSearchTweetsPollsToday() throws EnMeExpcetion {
    final Question question1 = createQuestion("Why the sea is saltz?",
        "html");

    final Question question2 = createQuestion("Why the sea is blue ?",
        "html");
    final DateTime dt = new DateTime();
    final TweetPoll tp = createTweetPollPublicated(true, true, dt.toDate(),
        this.userAccount, question1);
    tp.setScheduleTweetPoll(Boolean.TRUE);
View Full Code Here

   * @throws EnMeNoResultsFoundException
   */
  @Test
  public void testUpdateTweetPoll() throws EnMeNoResultsFoundException {

    final Question question1 = createQuestion("Why the sea is salad? 3",
        "html");
    final DateTime dt = new DateTime();
    final TweetPoll tp = createTweetPollPublicated(true, true, dt.toDate(),
        this.userAccount, question1);

View Full Code Here

   * @throws EnMeNoResultsFoundException
   *
   */
  @Test
  public void testRemoveTweetpolls() throws EnMeNoResultsFoundException {
    final Question myFirstQuestion = createQuestion(
        "What is your favorite kind of movie?",
        this.userAccount.getAccount());

    final Question mySecondQuestion = createQuestion(
        "What is your favorite kind of song?",
        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(
        this.userAccount.getAccount(), myFirstQuestion, new Date());
    tweetPoll1.setTweetPollFolder(tpFolder);
    tweetPoll1.getHashTags().add(tag1);
    tweetPoll1.getHashTags().add(tag2);

    getTweetPoll().saveOrUpdate(tweetPoll1);

    // Create QuestionsAnswers
    final TweetPoll myTweetpoll = tweetPoll1;

    final QuestionAnswer questAns1 = createQuestionAnswer("yes",
        myFirstQuestion, "1234555");
    final QuestionAnswer questAns2 = createQuestionAnswer("no",
        myFirstQuestion, "12346666");
    final QuestionAnswer questAns3 = createQuestionAnswer("no",
        myFirstQuestion, "123466667");

    // Tweetpoll switch
    final TweetPollSwitch tps1 = createTweetPollSwitch(questAns1,
        tweetPoll1);
    final TweetPollSwitch tps2 = createTweetPollSwitch(questAns2,
        tweetPoll1);

    // TweetPoll Result
    createTweetPollResult(tps1, "192.168.0.1");
    createTweetPollResult(tps1, "192.168.0.2");
    createTweetPollResult(tps2, "192.168.0.3");

    // Social Accounts & Providers
    final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.userAccount);

    final List<SocialProvider> providers = new ArrayList<SocialProvider>();
    providers.add(SocialProvider.FACEBOOK);
    providers.add(SocialProvider.LINKEDIN);

    // Create TweetPollSavedPublished - Social Links
    createTweetPollSavedPublishStatus(tweetPoll1, socialAccount,
        SocialProvider.FACEBOOK);
    createTweetPollSavedPublishStatus(tweetPoll1, socialAccount,
        SocialProvider.TWITTER);

    /* ***** BEFORE ***** */

    // Retrieve all TwweetpollSwitch associated
    final List<TweetPollSwitch> tpSwitchs = getTweetPoll()
        .getListAnswersByTweetPollAndDateRange(tweetPoll1);

    for (TweetPollSwitch tweetPollSwitch : tpSwitchs) {
      final List<TweetPollResult> tpollsResult = getTweetPoll()
          .getTweetPollResultsByTweetPollSwitch(tweetPollSwitch);

    }

    final List<TweetPollSavedPublishedStatus> TpollSaved = getTweetPoll()
        .getLinksByTweetPoll(tweetPoll1, null, null,
            TypeSearchResult.TWEETPOLL);

    /* Retrieve Tweetpolls folders by Folder ID */
    Assert.assertEquals(tweetPoll1.getHashTags().size(), 2);

    /* Retrieve Question Answers * */
    Assert.assertEquals(tweetPoll1.getHashTags().size(), 2);

    // Check total Answers
    final List<QuestionAnswer> totalAnswers = getQuestionDaoImp()
        .getAnswersByQuestionId(tweetPoll1.getQuestion().getQid());

    Assert.assertEquals(totalAnswers.size(), 3);

    // Check if exist TweetPoll
    Assert.assertNotNull(getTweetPoll().getTweetPollById(
        myTweetpoll.getTweetPollId()));

    Assert.assertNotNull(getQuestionDaoImp().retrieveQuestionById(
        myTweetpoll.getQuestion().getQid()));

    /*
     *  **************************** REMOVE
     * ************************************
     */
    this.getTweetPollService().removeTweetPoll(tweetPoll1);

    List<TweetPollSwitch> tpSwitchsAfter = getTweetPoll()
        .getListAnswersByTweetPollAndDateRange(myTweetpoll);
    Assert.assertEquals(tpSwitchsAfter.size(), 0);

    // Check Tweetpollresult
    for (TweetPollSwitch tweetPollSwitch : tpSwitchsAfter) {
      final List<TweetPollResult> tpollsResult = getTweetPoll()
          .getTweetPollResultsByTweetPollSwitch(tweetPollSwitch);
    }

    // Check TweetpollSaved
    final List<TweetPollSavedPublishedStatus> TpollSavedAfter = getTweetPoll()
        .getLinksByTweetPoll(myTweetpoll, null, null,
            TypeSearchResult.TWEETPOLL);
    Assert.assertEquals(TpollSavedAfter.size(), 0);

    // Check Hashtag
    final List<TweetPoll> tpollsbyHashtag = getTweetPoll()
        .getTweetpollByHashTagName(tagName, 0, 10,
            TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);
    Assert.assertEquals(tpollsbyHashtag.size(), 0);

    // Check QuestionAnswer
    final List<QuestionAnswer> totalAnswersAfter = getQuestionDaoImp()
        .getAnswersByQuestionId(tweetPoll1.getQuestion().getQid());
    Assert.assertEquals(totalAnswersAfter.size(), 0);

    // Check TweetPoll
    final TweetPoll tpollAfter = getTweetPoll().getTweetPollById(
        myTweetpoll.getTweetPollId());
    Assert.assertNull(tpollAfter);

    // Check Question
    final Question questionAfter = getQuestionDaoImp()
        .retrieveQuestionById(myTweetpoll.getQuestion().getQid());

    Assert.assertNull(questionAfter);

  }
View Full Code Here

    /**
    * Test Questions Domain.
    **/
    @Test
    public void testQuestions(){
        final Question questions = new Question();
        questions.setQuestion("What is your Name");
        questions.setQidKey("2");
        questions.setHits(0L);
        questions.setSharedQuestion(Boolean.FALSE);
        questions.setSlugQuestion(" "+RandomStringUtils.randomAscii(10));
        questions.getQuestionColettions().add(createQuestionCollect("options"));
        questions.setAccountQuestion(createAccount());
        getQuestionDaoImp().saveOrUpdate(questions);
        assertNotNull(questions.getQid());

    }
View Full Code Here

        // 2- Add survey sections
        final SurveySection section = createDefaultSection("Overview", mySurvey);
        Assert.assertNotNull(mySurvey);

        // 4- Add question to survey sections.
        /** Fist question**/
        final Question question = addQuestionSection("First Question", section, this.user);
        final Question question2 = addQuestionSection("Second Question", section, this.user);
        Assert.assertNotNull(question);
        Assert.assertNotNull(question2);

        // 5- Add answer to the questions.
        final QuestionAnswer answerYes = createQuestionAnswer("Yes", question, "123");
View Full Code Here

     /** Test Comments **/
     @Test
     public void testComments(){
         final Comment comments = new Comment();
         final UserAccount user = createUserAccount("diana", createAccount());
         final Question question = createQuestion("Who I am?", "");
         final TweetPoll tpoll = createPublishedTweetPoll(user.getAccount(), question);
         comments.setComment("First comment");
         comments.setCreatedAt(new Date());
         comments.setLikeVote(1L);
         comments.setDislikeVote(2L);
View Full Code Here

     }

     /** Test Poll. **/
     public void testPoll(){
         final Poll poll = new Poll();
         final Question question = createQuestion("Where do you live?", "");
         final UserAccount user = createUserAccount("diana", createAccount());
         final PollFolder pollFolder = createPollFolder("My polls", user);
         poll.setPollCompleted(null);
         poll.setCreateDate(Calendar.getInstance().getTime());
         poll.setEndDate(Calendar.getInstance().getTime());
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.question.Question

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.