Package com.agiletec.plugins.jpsurvey.apsadmin.survey

Examples of com.agiletec.plugins.jpsurvey.apsadmin.survey.SurveyAction


  //TODO FARE CONTROLLO NUMERI ERRORI E CAMPI
  public void testSaveSurvey() throws Throwable {
    String result = null;
    Survey poll = this.prepareSurveyForTest(false,false);
    Survey questionnaire = this.prepareSurveyForTest(true,false);
    SurveyAction action = null;
    try {
      this.setUserOnSession("admin");
      this.getSurveyManager().saveSurvey(poll);
      this.getSurveyManager().saveSurvey(questionnaire);
      // updating wrong ID
View Full Code Here


  }
 
  public void testAssociateSurveyImageEntry() throws Throwable {
    Survey survey = this.prepareSurveyForTest(true, false);
    Survey actual = null;
    SurveyAction action = null;
    String result = null;
    try {
      this.setUserOnSession("admin");
      this.getSurveyManager().saveSurvey(survey);
      assertNotNull(survey);
      // Test with invalid strutsAction
      this.initAction("/do/jpsurvey/Survey", "associateSurveyImageEntry");
      this.addParameter("surveyId", survey.getId());
      this.addParameter("questionnaire", true);
      this.addParameter("checkCookie", true);
      this.addParameter("description-it", "mucca");
      this.addParameter("title-it", "lilla");
      this.addParameter("imageDescription-it", "cioccolatosa");
      this.addParameter("resourceTypeCode", "Image");
      this.addParameter("groupName", Group.FREE_GROUP_NAME);
      this.addParameter("startDate", "10/06/2009");
      this.addParameter("strutsAction", ApsAdminSystemConstants.ADD);
      this.addParameter("profileUser", 0);
      this.addParameter("gatherUserInfo", survey.isGatherUserInfo());
      this.addParameter("imageId", 22);
      result = this.executeAction();
      action = (SurveyAction) this.getAction();
      assertNotNull(result);
      assertEquals(action.INPUT, result);
      assertEquals((Integer)survey.getId(), action.getSurveyId());
      // test with valid parameters
      this.initAction("/do/jpsurvey/Survey", "associateSurveyImageEntry");
      this.addParameter("surveyId", survey.getId());
//      this.addParameter("questionnaire", true);
      this.addParameter("checkCookie", false);
      this.addParameter("description-it", "mucca");
      this.addParameter("title-it", "lilla");
      this.addParameter("imageDescription-it", "cioccolatosa");
      this.addParameter("resourceTypeCode", "Image");
      this.addParameter("groupName", Group.FREE_GROUP_NAME);
      this.addParameter("startDate", "10/06/2009");
      this.addParameter("strutsAction", ApsAdminSystemConstants.EDIT);
      this.addParameter("profileUser", 0);
      this.addParameter("gatherUserInfo", survey.isGatherUserInfo());
      this.addParameter("imageId", 22);
      result = this.executeAction();
      action = (SurveyAction) this.getAction();
      assertNotNull(result);
      assertEquals(action.SUCCESS, result);
      assertNotNull(action.getSurveyId());
      actual = this.getSurveyManager().loadSurvey(survey.getId());
      assertEquals("cioccolatosa", actual.getImageDescriptions().get("it"));
    } catch (Throwable t) {
      throw t;
    } finally {
View Full Code Here

      this.getSurveyManager().deleteSurvey(survey.getId());
    }
  }

  public void testRemoveImage() throws Throwable {
    SurveyAction action = null;
    String result = null;
    Survey survey = this.prepareSurveyForTest(true, true);
    Survey verify = null;
    ApsProperties prop = null;
    try {
View Full Code Here

    }
  }
 
  public void testTrashSurvey() throws Throwable {
    String result = null;
    SurveyAction action = null;
    try {
      this.setUserOnSession("admin");
      // test with no survey ID
      this.initAction("/do/jpsurvey/Survey", "trashSurvey");
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(Action.INPUT, result);
      // test with unknown survey ID
      this.initAction("/do/jpsurvey/Survey", "trashSurvey");
      this.addParameter("surveyId", -1);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(Action.INPUT, result);
      action = (SurveyAction) this.getAction();
      assertNotNull(action.getTitles());
      assertTrue(action.getTitles().isEmpty());
      // test with known survey ID
      this.initAction("/do/jpsurvey/Survey", "trashSurvey");
      this.addParameter("surveyId", 1);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(Action.SUCCESS, result);
      action = (SurveyAction) this.getAction();
      assertNotNull(action.getSurvey().getTitles());
      assertEquals(2, action.getSurvey().getTitles().size());
    } catch (Throwable t) {
      throw t;
    }
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpsurvey.apsadmin.survey.SurveyAction

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.