Package org.encuestame.persistence.domain.question

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


     * @throws ServletException
     *
     */
    @Test
    public void testGetFrontendItems() throws ServletException, IOException{
        final Question question = createQuestion("abcdefg", "pattern");
        final TweetPoll tp = createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), getSpringSecurityLoggedUserAccount(), question);
        final Poll poll = createPoll(new Date(), question, getSpringSecurityLoggedUserAccount(), Boolean.TRUE, Boolean.TRUE);
        tp.setRelevance(50L);
        poll.setRelevance(30L);
        getTweetPoll().saveOrUpdate(tp);
View Full Code Here


     * @throws ServletException
     * @throws IOException
     */
    @Test
    public void testgetUserRatedTop() throws ServletException, IOException {
        final Question question = createQuestion("abcdefg", "pattern");
        createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(),
                getSpringSecurityLoggedUserAccount(), question);
        createPoll(new Date(), question, getSpringSecurityLoggedUserAccount(),
                Boolean.TRUE, Boolean.TRUE);
        initService("/api/common/frontend/topusers.json", MethodJson.GET);
View Full Code Here

                final SurveySection section = getSurveyService()
                        .retrieveSurveySectionById(sectionId);
                final QuestionPattern questionPattern = QuestionPattern
                        .getQuestionPattern(pattern);
                final UserAccount account = getUserAccount();
                final Question questionAdded = getSurveyService().addQuestionToSurveySection(question,
                        account, section,
                        questionPattern, null);
                final Map<String, Object> jsonResponse = new HashMap<String, Object>();
                jsonResponse.put("newQuestion", questionAdded);
                setItemResponse(jsonResponse);
View Full Code Here

                final Survey survey = getSurveyService()
                        .getSurveyById(surveyId);
                final QuestionAnswer qAnswer = getSurveyService()
                        .getQuestionAnswerById(qanswer);
                final Question question = getSurveyService().getQuestionById(
                        questionId);
                final SurveyResult surveyResult = getSurveyService()
                        .saveSurveyResult(qAnswer, survey, question,
                                txtResponse);
                jsonResponse.put("surveyResult", surveyResult);
View Full Code Here

   */
  @Test
  public void testSaveSurveyResponses() throws ServletException, IOException {
    Assert.assertNotNull(survey);
    createDefaultSection("SurveySection 2", this.survey);
    final Question myQuestion = createDefaultQuestion("Who is the best football player");
    final QuestionAnswer qAnswer1 = createQuestionAnswer("D.Beckam",
        myQuestion, "");
    createQuestionAnswer("L.Messi", myQuestion, "");

    // Search All surveys.
    initService("/api/survey/save.json", MethodJson.GET);
    setParameter("sid", this.survey.getSid().toString());
    setParameter("question", myQuestion.getQid().toString());
    setParameter("answer", qAnswer1.getQuestionAnswerId().toString());
    setParameter("txtResponse", "50");

    final JSONObject response = callJsonService();
    final JSONObject sucess = getSucess(response);

    final JSONObject objectQuestion = (JSONObject) sucess
        .get("surveyResult");

    final JSONObject questionValue = (JSONObject) objectQuestion
        .get("question");

    Assert.assertEquals(questionValue.get("question").toString(),
        myQuestion.getQuestion());
  }
View Full Code Here

     */
    @Before
    public void initJsonService(){
        this.userAccount = getSpringSecurityLoggedUserAccount();
        this.initQuestion = createQuestion("Bayern  VS Borussia?", userAccount.getAccount());
        final Question question = createQuestion("Real Madrid VS Barcelona?", userAccount.getAccount());
        final Question question1 = createQuestion("Real Madrid or Barcelona?", userAccount.getAccount());
        final Question question2 = createQuestion("Real Madrid or Barcelona?", userAccount.getAccount());
        final Question question3 = createQuestion("Real Madrid or Barcelona?", userAccount.getAccount());
        this.tp1 = createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), userAccount, question);
        createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), userAccount, question1);
        createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), userAccount, question2);
        createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), userAccount, question3);
        DateTime dt = creationDate.minusDays(3);
View Full Code Here

     *
     */
    @Before
    public void initService() {
        final UserAccount user = createUserAccount("jota", createAccount());
        final Question question = createQuestion("question1", user.getAccount());
        this.tweetPoll = createTweetPollPublicated(true, true, new Date(), user, question);
        final SocialAccount socialAccount = createSocialAccount(
                getProperty("twitter.test.token"),
                getProperty("twitter.test.tokenSecret"),
                user,
View Full Code Here

     */
    //@Test
    public void retrieveItemsbyDate() throws ServletException, IOException{
        // Search poll published today.
        final Date todayDate = new Date();
        final Question question = createQuestion("What is your favourite movie", "pattern");
        final Poll poll = createPoll(todayDate, question,
                          getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                          Boolean.TRUE);
        Assert.assertNotNull(poll);
        initService("/api/survey/poll/search.json", MethodJson.GET);
View Full Code Here

     * @throws IOException
     */
    private void changePropertyPoll(final String property) throws ServletException, IOException{
         // Search poll published today.
        final Date todayDate = new Date();
        final Question question = createQuestion("What is your favourite movie", "pattern");
        final Poll poll = createPoll(todayDate, question,
                          getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                          Boolean.TRUE);
        Assert.assertNotNull(poll);
        //change-open-status
View Full Code Here

     */
    @Test
    public void changeWrongPropertyPoll() throws ServletException, IOException{
        // Search poll published today.
       final Date todayDate = new Date();
       final Question question = createQuestion("What is your favourite movie", "pattern");
       final Poll poll = createPoll(todayDate, question,
                         getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                         Boolean.TRUE);
       Assert.assertNotNull(poll);
       //change-open-status
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.