Examples of PollBean


Examples of org.encuestame.utils.web.PollBean

    /**
     * Test {@link PollBean}.
     */
    @Test
    public void testUnitPoll(){
        final PollBean poll = new PollBean();
        poll.setId(1L);
        poll.setCompletedPoll(true);
        poll.setCreateDate(DateUtil.DOJO_DATE_FORMAT.format(new Date()));
        poll.setQuestionBean(new QuestionBean());
        poll.setFinishDate(new Date());
        poll.setPublishPoll(true);
        poll.setCloseNotification(true);
        poll.setHashTags(new ArrayList<HashTagBean>());
        poll.setShowResultsPoll(true);
        assertNotNull(poll.getId());
        assertNotNull(poll.getHashTags());
        assertNotNull(poll.getQuestionBean());
        assertNotNull(poll.getCompletedPoll());
        //assertNotNull(poll.getCreationDate());
        assertNotNull(poll.getFinishDate());
        assertNotNull(poll.getPublishPoll());
        assertNotNull(poll.getCloseNotification());
        assertNotNull(poll.getShowResultsPoll());
    }
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

    public PollBean createUnitPoll(
            final Boolean completedPoll,
            final Date creationDate,
            final Long id,
            final QuestionBean questionBean){
        final PollBean unitPoll = new PollBean();
        unitPoll.setCompletedPoll(completedPoll);
        unitPoll.setCreateDate(DateUtil.DOJO_DATE_FORMAT.format(creationDate));
        unitPoll.setId(id);
        unitPoll.setQuestionBean(questionBean);
        return unitPoll;
    }
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

             final List<HashTagBean> hashTags,
             final Long idPoll,
             final Boolean publishPoll,
             final QuestionBean questionBean,
             final Boolean showResultsPoll){
         final PollBean unitPollComplete = new PollBean();
         unitPollComplete.setCloseNotification(closeNotification);
         unitPollComplete.setCompletedPoll(completedPoll);
         unitPollComplete.setCreateDate(DateUtil.DOJO_DATE_FORMAT.format(creationDate));
         unitPollComplete.setFinishDate(finishDate);
         unitPollComplete.setHashTags(hashTags);
         unitPollComplete.setId(idPoll);
         unitPollComplete.setPublishPoll(publishPoll);
         unitPollComplete.setQuestionBean(questionBean);
         unitPollComplete.setShowResultsPoll(showResultsPoll);
         return unitPollComplete;
     }
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

     * @throws Exception exception
     */
    @Test
    public void testcreatePoll() throws Exception{
        final QuestionBean question = ConvertDomainBean.convertQuestionsToBean(this.question);
        final PollBean unitPoll = ConvertDomainBean.convertPollDomainToBean(this.poll);
        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);
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

     * @throws EnMeExpcetion
     */
    @Test
    public void testUpdateQuestionPoll() throws EnMeExpcetion{
        final Question newQuestion = createQuestion("Why the tooth are white", "pattern");
        final PollBean pb = pollService.updateQuestionPoll(this.poll.getPollId(), newQuestion);
        assertEquals(newQuestion.getQuestion(), pb.getQuestionBean().getQuestionName());
     }
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

   */
  //@Test
  public void testRemoveHashTagsFromPoll() throws EnMeExpcetion {
    final QuestionBean question = ConvertDomainBean
        .convertQuestionsToBean(this.question);
    final PollBean unitPoll = ConvertDomainBean
        .convertPollDomainToBean(this.poll);
    unitPoll.setQuestionBean(question);
   
   
    final String[] answer = {"a", "b"};
        final String[] hashtag = {"hastag1", "hastag2"};
        final CreatePollBean cb = createPollBean("dddd",answer, hashtag, "APPROVE", "ALL", true, null, null);
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

     *
     * @param poll
     * @return unitPoll unitPoll
     */
    public static final PollBean convertPollDomainToBean(final Poll poll) {
        final PollBean unitPoll = new PollBean();
        unitPoll.setId(poll.getPollId());
        unitPoll.setCompletedPoll(poll.getPollCompleted() == null ? false
                : poll.getPollCompleted());
        unitPoll.setCreationDate(poll.getCreateDate() == null ? null
                : DateUtil.SIMPLE_DATE_FORMAT.format(poll.getCreateDate()));
        unitPoll.setCreateDateComparable(poll.getCreateDate());
        unitPoll.setQuestionBean(ConvertDomainBean.convertQuestionsToBean(poll
                .getQuestion()));
        unitPoll.setPublishPoll(poll.getPublish() == null ? false : poll
                .getPublish());
        if (poll.getUpdatedDate() != null) {
            unitPoll.setUpdatedDate(poll.getUpdatedDate());
        }
        unitPoll.setTotalVotes(poll.getNumbervotes() == null ? EnMeUtils.VOTE_MIN
                : Long.valueOf(poll.getNumbervotes()));
        unitPoll.setShowResultsPoll(Boolean.TRUE);
        //poll.getShowResults() == null ? false : poll.getShowResults()
        unitPoll.setLikeVote(poll.getLikeVote() == null ? EnMeUtils.LIKE_DEFAULT
                : Long.valueOf(poll.getLikeVote()));
        unitPoll.setDislikeVote(poll.getDislikeVote() == null ? EnMeUtils.DISLIKE_DEFAULT
                : Long.valueOf(poll.getDislikeVote()));
        unitPoll.setOwnerUsername(poll.getEditorOwner() == null ? null : poll
                .getEditorOwner().getUsername());
        unitPoll.setRelevance(poll.getRelevance() == null ? EnMeUtils.RATE_DEFAULT
                : poll.getRelevance());
        unitPoll.setHits(poll.getHits() == null ? EnMeUtils.VOTE_MIN : poll
                .getHits());
        unitPoll.setFavorite(poll.getFavourites() == null ? false : poll
                .getFavourites());
        unitPoll.setHashTags(ConvertDomainBean
                .convertListHashTagsToBean(new ArrayList<HashTag>(poll
                        .getHashTags())));
        unitPoll.setLatitude(poll.getLocationLatitude() == null ? 0 : poll
                .getLocationLatitude());
        unitPoll.setLongitude(poll.getLocationLongitude() == null ? 0 : poll
                .getLocationLongitude());
        unitPoll.setIsShowAdditionalInfo(poll.getShowAdditionalInfo() == null ? false
                : poll.getShowAdditionalInfo());
        unitPoll.setAdditionalInfo(poll.getAdditionalInfo() == null ? "" : poll
                .getAdditionalInfo());
        unitPoll.setCloseNotification(poll.getNotifications() == null ? false
                : poll.getNotifications());
        unitPoll.setItemType(TypeSearchResult.POLL.toString().toLowerCase());
        unitPoll.setIsPasswordRestriction(poll.getPasswordRestrictions() == null ? false
                : poll.getPasswordRestrictions());
        if (poll.getShowComments() != null) {
            unitPoll.setShowComments(poll.getShowComments().toString());
        }
        unitPoll.setFolderId(poll.getPollFolder() == null ? null : poll
                .getPollFolder().getId());
        unitPoll.setIsCloseAfterDate(poll.getCloseAfterDate() == null ? false
                : poll.getCloseAfterDate());
        unitPoll.setClosedDate(poll.getClosedDate() == null ? null
                : DateUtil.DOJO_DATE_FORMAT.format(poll.getClosedDate()));
        unitPoll.setIsCloseAfterQuota(poll.getCloseAfterquota() == null ? false
                : poll.getCloseAfterquota());
        unitPoll.setClosedQuota(poll.getClosedQuota() == null ? null : poll
                .getClosedQuota());
        unitPoll.setIsIpRestricted(poll.getIpRestriction());
        unitPoll.setIpRestricted(poll.getIpProtection() == null ? "" : poll
                .getIpProtection());
        return unitPoll;
    }
View Full Code Here

Examples of org.encuestame.utils.web.PollBean

      */
     public PollBean createUnitPoll(final Boolean closeNotification, final Boolean completedPoll,
                                    final Date creationDate, final Date finishDate, final String hashPoll,
                                    final Boolean publishPoll, final QuestionBean questionBean,
                                    final Boolean showResultsPoll){
        final PollBean unitPoll = new PollBean();
        unitPoll.setCloseNotification(closeNotification);
        unitPoll.setCompletedPoll(completedPoll);
        unitPoll.setCreateDate(DateUtil.DOJO_DATE_FORMAT.format(creationDate));
        unitPoll.setFinishDate(finishDate);
        unitPoll.setPublishPoll(publishPoll);
        unitPoll.setQuestionBean(questionBean);
        unitPoll.setShowResultsPoll(showResultsPoll);
        return unitPoll;
     }
View Full Code Here

Examples of org.richfaces.demo.poll.PollBean

    JSFClientSession client = jsfSession.getJSFClientSession();
    RichFacesClient ajaxClient = new RichFacesClient(client);
    JSFServerSession server = jsfSession.getJSFServerSession();

    // Get the backing bean to check activity
    PollBean pb = (PollBean)server.getManagedBeanValue(_POLLBEAN);
    assertNotNull("Can't find PollBean",pb);
    // Make sure polling is enabled
    assertTrue("Polling is not enabled in the PollBean",pb.getPollEnabled());
   
    // Get poll control to check status
    UIPoll poll = (UIPoll)server.findComponent(_POLL_ID);
    assertNotNull("Can't find server side poll component",poll);
    int interval = poll.getInterval();
    // Make sure polling is enabled
    assertTrue("Polling is not enabled in the component",poll.isEnabled());
   
    // Make sure the date is updating
    Date startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    Date endDate = pb.getLasttime();
    assertFalse("Date is not being updated in the PollBean",startDate.equals(endDate));
   
    // Get control button and disable polling
    HtmlButtonInput button = (HtmlButtonInput)client.getElement(_BUTTON_ID);
    assertNotNull("Can't find polling control button ["+_BUTTON_ID+"]",button);
    button.click();

    // Wait for polling state to change
    Thread.sleep(interval*2);   
   
    // Make sure we're no longer polling
    assertFalse("Polling should be disabled in the PollBean",pb.getPollEnabled());
    // Check the server-side control also (TBD: This causes IllegalStateException)
//    poll = (UIPoll)server.findComponent(_POLL_ID);
//    assertFalse("Polling should be disabled in the component",poll.isEnabled());
    // Make sure the date is NOT updating
    startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    endDate = pb.getLasttime();
    assertTrue("Date should not be updating in the PollBean",startDate.equals(endDate));
   
    // Turn polling back on (page was updated, therefore we MUST re-get the control)
    button = (HtmlButtonInput)client.getElement(_BUTTON_ID)
    button.click();

    // Wait for polling state to change
    Thread.sleep(interval*2);   
   
    // Make sure we're polling again
    assertTrue("Polling is not enabled in the PollBean",pb.getPollEnabled());
    // Check the server-side control also (TBD: This causes IllegalStateException)   
//    poll = (UIPoll)server.findComponent(_POLL_ID);
//    assertTrue("Polling is not enabled in the component",poll.isEnabled());
    // Make sure the date is updating
    startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    endDate = pb.getLasttime();
    assertFalse("Date is not being updated in the PollBean",startDate.equals(endDate));

  }
View Full Code Here

Examples of org.richfaces.demo.poll.PollBean

    JSFClientSession client = jsfSession.getJSFClientSession();
    RichFacesClient ajaxClient = new RichFacesClient(client);
    JSFServerSession server = jsfSession.getJSFServerSession();
   
    // Get the backing bean to check activity
    PollBean pb = (PollBean)server.getManagedBeanValue(_POLLBEAN);
    assertNotNull("Can't find PollBean",pb);
    // Make sure the date is NOT updating
    Date startDate = pb.getLasttime();
    Thread.sleep(_EXPECTED_POLLING_INTERVAL*4)
    Date endDate = pb.getLasttime();
    assertTrue("Date should not be updating in the PollBean",startDate == endDate || startDate.equals(endDate));   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.