Examples of SurveyBean


Examples of org.encuestame.utils.web.SurveyBean

    /**
     * Test {@link SurveyBean}.
     */
    @Test
    public void testSurveyBean(){
        final SurveyBean surveyBean = new SurveyBean();
        final Calendar myDate = Calendar.getInstance();
        final List<HashTagBean> tagBean = new ArrayList<HashTagBean>();
        tagBean.add(createUnitHashTag("Europa", 1L));
        tagBean.add(createUnitHashTag("Asia", 2L));
        tagBean.add(createUnitHashTag("Africa", 3L));

        surveyBean.setSid(1L);
        surveyBean.setTicket(1);
        surveyBean.setStartDate(myDate.getTime());
        myDate.add(Calendar.DATE, +8);
        surveyBean.setEndDate(myDate.getTime());
        myDate.add(Calendar.DATE, +2);
        surveyBean.setDateInterview(myDate.getTime());
        surveyBean.setComplete("complete");
        surveyBean.setOwnerUsername("paola");
        surveyBean.setCustomMessage(Boolean.TRUE);
        surveyBean.setCustomStartMessages("Custom start messages");
        surveyBean.setMultipleResponse(MultipleResponse.SINGLE);
        surveyBean.setCustomFinalMessage(CustomFinalMessage.FINALMESSAGE);
        surveyBean.setShowProgressBar(Boolean.TRUE);
        surveyBean.setOptionalTitle("Optional Title");
        surveyBean.setPasswordRestrictions(Boolean.FALSE);
        surveyBean.setIpRestriction(Boolean.TRUE);
        surveyBean.setPassProtection("");
        surveyBean.setIpProtection("");
        surveyBean.setCloseAfterDate(Boolean.FALSE);
        myDate.add(Calendar.DATE, +2);
        surveyBean.setClosedDate(myDate.getTime());
        surveyBean.setCloseAfterquota(Boolean.TRUE);
        surveyBean.setClosedQuota(20);
        surveyBean.setShowResults(Boolean.TRUE);
        surveyBean.setNumbervotes(10L);
        surveyBean.setHits(25L);
        surveyBean.setShowAdditionalInfo(Boolean.TRUE);
        surveyBean.setAdditionalInfo("Additional Info");
        surveyBean.setNotifications(Boolean.TRUE);
        surveyBean.setName("My first Survey");
        surveyBean.setRelevance(85L);
        surveyBean.setCreatedAt(myDate.getTime());
        surveyBean.setLikeVote(300L);
        surveyBean.setDislikeVote(150L);
        surveyBean.setFavorites(Boolean.TRUE);
        surveyBean.setHashTags(tagBean);
        surveyBean.setTotalComments(25L);

        assertNotNull(surveyBean.getSid());
        assertNotNull(surveyBean.getTicket());
        assertNotNull(surveyBean.getStartDate());
        assertNotNull(surveyBean.getEndDate());
        assertNotNull(surveyBean.getDateInterview());
        assertNotNull(surveyBean.getComplete());
        assertNotNull(surveyBean.getOwnerUsername());
        assertNotNull(surveyBean.getCustomMessage());
        assertNotNull(surveyBean.getCustomStartMessages());
        assertNotNull(surveyBean.getMultipleResponse());
        assertNotNull(surveyBean.getShowProgressBar());
        assertNotNull(surveyBean.getOptionalTitle());
        assertNotNull(surveyBean.getPasswordRestrictions());
        assertNotNull(surveyBean.getIpRestriction());
        assertNotNull(surveyBean.getPassProtection());
        assertNotNull(surveyBean.getIpProtection());
        assertNotNull(surveyBean.getCloseAfterDate());
        assertNotNull(surveyBean.getClosedDate());
        assertNotNull(surveyBean.getClosedQuota());
        assertNotNull(surveyBean.getShowResults());
        assertNotNull(surveyBean.getNumbervotes());
        assertNotNull(surveyBean.getHits());
        assertNotNull(surveyBean.getShowAdditionalInfo());
        assertNotNull(surveyBean.getAdditionalInfo());
        assertNotNull(surveyBean.getNotifications());
        assertNotNull(surveyBean.getName());
        assertNotNull(surveyBean.getRelevance());
        assertNotNull(surveyBean.getCreatedAt());
        assertNotNull(surveyBean.getLikeVote());
        assertNotNull(surveyBean.getDislikeVote());
        assertNotNull(surveyBean.getFavorites());
        assertNotNull(surveyBean.getHashTags());
        assertNotNull(surveyBean.getTotalComments());
    }
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

     * Test search surveys by today date.
     * @throws EnMeExpcetion
     */
    @Test
    public void testSearchSurveysToday() throws EnMeExpcetion {
        final SurveyBean surveyBean = createSurveyBean("My first survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                this.mySurveyDate.getTime());
        surveyService.createSurvey(surveyBean, this.request);
        final String mykeyword = "";
        final List<SurveyBean> surveyBeanList = surveyService.filterSurveyItemsByType(
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

     * @throws EnMeExpcetion
     */
    @Test
    public void testSearchSurveysLastWeek() throws EnMeExpcetion {
        mySurveyDate.add(Calendar.DATE, -3);
        final SurveyBean surveyBean = createSurveyBean("My first survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                this.mySurveyDate.getTime());
        surveyService.createSurvey(surveyBean, this.request);
        final List<SurveyBean> surveyBeanList = surveyService
                .searchSurveysLastWeek(getUsernameLogged(), this.MAX_RESULTS,
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

        final Calendar lastWeek = Calendar.getInstance();
        lastWeek.add(Calendar.DATE, -8);

        // First Survey Bean created today .
        final SurveyBean surveyBean = createSurveyBean("My first survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                this.mySurveyDate.getTime());

        // Second Survey Bean created last month.
        final SurveyBean surveyBean2 = createSurveyBean("My Second survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                lastMonth.getTime());

        // Third Survey Bean created 3 days ago.
        final SurveyBean surveyBean3 = createSurveyBean("My Third survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                lastWeek.getTime());

        surveyService.createSurvey(surveyBean, this.request);
        surveyService.createSurvey(surveyBean2, this.request);
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

     * Test search favorite surveys.
     * @throws EnMeExpcetion
     */
    @Test
    public void testSearchFavoriteSurveys() throws EnMeExpcetion {
        final SurveyBean surveyBean = createSurveyBean("My first survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                this.mySurveyDate.getTime());
        surveyBean.setFavorites(Boolean.TRUE);
        surveyService.createSurvey(surveyBean, this.request);
        final List<SurveyBean> surveyBeanList = surveyService
                .searchSurveysFavourites(getUsernameLogged(), this.MAX_RESULTS,
                        this.START_RESULTS);
      assertEquals("should be equals", 1, surveyBeanList.size());
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

     * @throws EnMeExpcetion
     */
    @Test
    public void testSearchbySurveyName() throws EnMeExpcetion {
        final String keyWord = "first";
        final SurveyBean surveyBean = createSurveyBean("My first survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                this.mySurveyDate.getTime());

        final SurveyBean surveyBean2 = createSurveyBean("My Second survey",
                getSpringSecurityLoggedUserAccount().getUsername(),
                this.mySurveyDate.getTime());
        surveyService.createSurvey(surveyBean, this.request);
        surveyService.createSurvey(surveyBean2, this.request);
        final List<SurveyBean> surveyBeanList = surveyService
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

    @Test
    public void testGetSurveysByFolder() throws EnMeExpcetion{
        final FolderBean fbean = surveyService.createSurveyFolder(
                "My First Folder", this.myUsername);
        Assert.assertNotNull(fbean);
        final SurveyBean mySurveyBean = createSurveyBean("My Second survey",
                this.myUsername, this.mySurveyDate.getTime());
        final Survey mySurvey = surveyService.createSurvey(mySurveyBean, this.request);
        surveyService.addSurveyToFolder(fbean.getId(), this.myUsername,
                mySurvey.getSid());
        final List<Survey> listSurvey = surveyService.retrieveSurveyByFolder(
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

   
    @Test
    public void testCreateSurvey() throws EnMeExpcetion{
      // Create survey with section default
      final SurveyBean surveyBean = createSurveyBean("default survey", getSpringSecurityLoggedUserAccount().toString(), new Date());
      final Survey newSurvey = surveyService.createSurvey(surveyBean, this.request);  
     
      // Create new Section
      final UnitSurveySection unitSection = createSurveySection("default 2", "default 2", newSurvey);
      surveyService.createSurveySection(unitSection, newSurvey);
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

     *
     * @param survey
     * @return
     */
    public static final SurveyBean convertSurveyDomaintoBean(final Survey survey) {
        final SurveyBean unitSurvey = new SurveyBean();
        unitSurvey.setSid(survey.getSid());
        unitSurvey.setTicket(survey.getTicket());
        unitSurvey.setStartDate(survey.getStartDate());
        unitSurvey.setEndDate(survey.getEndDate());
        unitSurvey.setDateInterview(survey.getDateInterview());
        unitSurvey.setComplete(survey.getComplete());
        // unitSurvey.setUnitUserBean(ConvertDomainBean.convertUserSessionToUserBean(survey.getSecUsers()));
        unitSurvey.setCustomMessage(survey.getCustomMessage());
        unitSurvey.setCustomStartMessages(survey.getCustomStartMessages());
        // unitSurvey.setCustomFinalMessage(survey.getCustomFinalMessage());
        unitSurvey.setShowProgressBar(survey.getShowProgressBar());
        unitSurvey.setOptionalTitle(survey.getOptionalTitle());
        unitSurvey.setPasswordRestrictions(survey.getPasswordRestrictions());
        unitSurvey.setIpProtection(survey.getIpProtection());
        unitSurvey.setIpRestriction(survey.getIpRestriction());
        unitSurvey.setPassProtection(survey.getPassProtection());
        unitSurvey.setCloseAfterDate(survey.getCloseAfterDate());
        unitSurvey.setClosedDate(survey.getClosedDate());
        unitSurvey.setCloseAfterquota(survey.getCloseAfterquota());
        unitSurvey.setClosedQuota(survey.getClosedQuota());
        unitSurvey.setShowResults(Boolean.TRUE); //survey.getShowResults()
        unitSurvey.setNumbervotes(survey.getNumbervotes());
        unitSurvey.setHits(survey.getHits() == null ? EnMeUtils.VOTE_MIN : survey
                .getHits());
        unitSurvey.setAdditionalInfo(survey.getAdditionalInfo());
        unitSurvey.setShowAdditionalInfo(survey.getShowAdditionalInfo());
        unitSurvey.setNotifications(survey.getNotifications());
        unitSurvey.setName(survey.getName());
        unitSurvey.setRelevance(survey.getRelevance());
        unitSurvey.setSurveySlugName(survey.getSurveySlugName());
        unitSurvey.setCreatedAt(survey.getCreateDate());
        unitSurvey.setTotalVotes(survey.getNumbervotes() == null ? EnMeUtils.VOTE_MIN
                : Long.valueOf(survey.getNumbervotes()));
        unitSurvey.setLikeVote(survey.getLikeVote() == null ? EnMeUtils.LIKE_DEFAULT
                : Long.valueOf(survey.getLikeVote()));
        unitSurvey.setDislikeVote(survey.getDislikeVote() == null ? EnMeUtils.DISLIKE_DEFAULT
                : Long.valueOf(survey.getDislikeVote()));
        unitSurvey.setHashTags(ConvertDomainBean
                .convertListHashTagsToBean(new ArrayList<HashTag>(survey
                        .getHashTags())));
    //    unitSurvey.setItemType(TypeSearchResult.POLL.toString().toLowerCase());

        return unitSurvey;
View Full Code Here

Examples of org.encuestame.utils.web.SurveyBean

      * @param ownerUsername
      * @param createdAt
      * @return
      */
     public SurveyBean createSurveyBean(final String surveyName, final String ownerUsername, final Date createdAt) {
         final SurveyBean surveyBean = new SurveyBean();
         surveyBean.setTicket(1);
         surveyBean.setOwnerUsername(ownerUsername);
         surveyBean.setName(surveyName);
         surveyBean.setCreatedAt(createdAt);
         return surveyBean;
     }
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.