Package org.encuestame.persistence.domain.survey

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


    /**
     * Test Retrieve {@link Poll} by {@link Question}.
     */
    @Test
    public void testGetPollbyQuestion() {
        final Poll pollByQuestion = getPollDao().getPollbyQuestion(
                this.question.getQid());

        assertEquals("Should be equals", this.poll.getPollId(),
                pollByQuestion.getPollId());
     }
View Full Code Here


    private void createPolls() {

        final UserAccount userAcc2 = createUserAccount("userAcc2",this.user);

        // -5 hours
        final Poll poll1 = createDefaultPoll(this.question, this.userAccount, this.initDate.minusHours(5).toDate(), 25L, 15L);
        poll1.getHashTags().add(initTag);
        getPollDao().saveOrUpdate(poll1);

        // -15 hours
        Poll pollH = createDefaultPoll(this.question, this.userAccount, this.initDate.minusHours(15).toDate(), 45L, 55L);
        pollH.getHashTags().add(initTag);
        getPollDao().saveOrUpdate(pollH);

        // -25 days
        final Poll poll2 = createDefaultPoll(this.question, this.userAccount, this.initDate.minusDays(25).toDate(), 75L, 160L);
        poll2.getHashTags().add(initTag);
        getPollDao().saveOrUpdate(poll2);

        // -25 days
        final Poll poll3 = createDefaultPoll(this.question, this.userAccount, this.initDate.minusDays(25).toDate(), 45L, 10L);
        poll3.getHashTags().add(initTag);
        getPollDao().saveOrUpdate(poll3);

        //-6 days
        createDefaultPoll(this.question, userAcc2, this.initDate.minusDays(6).toDate(), 78L, 35L);

        //-400 days
        Poll longTimePoll = createDefaultPoll(this.question, userAcc2, this.initDate.minusDays(400).toDate(), 120L, 63L);
        longTimePoll.getHashTags().add(initTag);
        getPollDao().saveOrUpdate(longTimePoll);
    }
View Full Code Here

    /**
     * Test Retrieve Total votes by poll and Range.
     */
    @Test
    public void testGetTotalVotesByPollIdAndDateRange(){
        final Poll poll1 = createDefaultPoll(this.question, this.userAccount, this.initDate
                .minusHours(5).toDate(), 25L, 15L);
        final QuestionAnswer questionAnswer = createQuestionAnswer("maybe", this.question, "&93fak");
        final QuestionAnswer questionAnswer2 = createQuestionAnswer("yes", this.question, "jakP22");
        final QuestionAnswer questionAnswer3 = createQuestionAnswer("No", this.question, "Lmd93s");
        createPollResults(questionAnswer, poll1);
        createPollResults(questionAnswer2, poll1);
        createPollResults(questionAnswer3, poll1);
        final Long totalVotes = getPollDao().getTotalVotesByPollIdAndDateRange(poll1.getPollId(), SearchPeriods.SEVENDAYS);
        assertEquals("Should be equals", 3,
                totalVotes.intValue());
    }
View Full Code Here

     */
    @Test
    public void testValidateVoteIP() {
        final String ip = "192.10.1.1";
        final String ip2 = "192.10.1.11";
        final Poll poll1 = createDefaultPoll(this.question, this.userAccount,
                this.initDate.minusHours(8).toDate());
        final QuestionAnswer qAsnwer = createQuestionAnswer("possible",
                this.question, "3fak34");
        createDefaultPollResults(qAsnwer, poll1, ip);

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.