use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionEditActionTest method testExecuteAndPostProcessConstSumOption.
@Test
public void testExecuteAndPostProcessConstSumOption() {
DataBundle dataBundle = loadDataBundle("/FeedbackSessionQuestionTypeTest.json");
removeAndRestoreDataBundle(dataBundle);
InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("constSumSession");
FeedbackQuestionAttributes fq = FeedbackQuestionsLogic.inst().getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), 1);
FeedbackResponsesDb frDb = new FeedbackResponsesDb();
______TS("Edit text");
// There are already responses for this question
assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
String[] editTextParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONSTSUM", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Split points among the options.(edited)", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTS, "100", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHOPTION, "50", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHRECIPIENT, "30", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSPEROPTION, "false", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, "3", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-0", "Grades", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-1", "Fun", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMTORECIPIENTS, "false", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
InstructorFeedbackQuestionEditAction a = getAction(editTextParams);
RedirectResult r = getRedirectResult(a);
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "CONSTSUM+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
assertFalse(r.isError);
// All existing responses should remain
assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
______TS("Edit points");
String[] editPointsParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONSTSUM", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Split points among the options.(edited)", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTS, "1000", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHOPTION, "300", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHRECIPIENT, "500", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSPEROPTION, "false", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, "3", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-0", "Grades", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-1", "Fun", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMTORECIPIENTS, "false", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
a = getAction(editPointsParams);
r = getRedirectResult(a);
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "CONSTSUM+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
assertFalse(r.isError);
// All existing responses should be deleted as the options are edited
assertTrue(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
}
use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindParticularStudentsActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
StudentAttributes studentNotSubmitFeedback = typicalBundle.students.get("student5InCourse1");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
______TS("Unsuccessful case: Not enough parameters");
String[] paramsNoCourseId = new String[] { Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName() };
verifyAssumptionFailure(paramsNoCourseId);
String[] paramsNoFeedback = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId() };
verifyAssumptionFailure(paramsNoFeedback);
______TS("Unsuccessful case: No user to remind, warning message generated");
String[] paramsNoUserToRemind = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName() };
InstructorFeedbackRemindParticularStudentsAction action = getAction(paramsNoUserToRemind);
RedirectResult rr = getRedirectResult(action);
assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSEMPTYRECIPIENT));
verifyNoTasksAdded(action);
______TS("Unsuccessful case: Feedback session not open, warning message generated");
fs = typicalBundle.feedbackSessions.get("awaiting.session");
String[] paramsFeedbackSessionNotOpen = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), Const.ParamsNames.SUBMISSION_REMIND_USERLIST, studentNotSubmitFeedback.getEmail() };
action = getAction(paramsFeedbackSessionNotOpen);
rr = getRedirectResult(action);
assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSESSIONNOTOPEN));
verifyNoTasksAdded(action);
______TS("Successful case: Typical case");
fs = typicalBundle.feedbackSessions.get("session1InCourse1");
String[] paramsTypical = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), Const.ParamsNames.SUBMISSION_REMIND_USERLIST, studentNotSubmitFeedback.getEmail() };
action = getAction(paramsTypical);
rr = getRedirectResult(action);
assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT));
verifySpecifiedTasksAdded(action, TaskQueue.FEEDBACK_SESSION_REMIND_PARTICULAR_USERS_EMAIL_QUEUE_NAME, 1);
}
use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindParticularStudentsPageActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
String instructorId = instructor1OfCourse1.googleId;
CourseAttributes course = typicalBundle.courses.get("typicalCourse1");
FeedbackSessionAttributes fsa = typicalBundle.feedbackSessions.get("session1InCourse1");
gaeSimulation.loginAsInstructor(instructorId);
______TS("Not enough parameters");
verifyAssumptionFailure();
______TS("Typical case");
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fsa.getFeedbackSessionName() };
InstructorFeedbackRemindParticularStudentsPageAction a = getAction(submissionParams);
ShowPageResult r = getShowPageResult(a);
assertFalse(r.isError);
assertEquals("", r.getStatusMessage());
InstructorFeedbackRemindParticularStudentsPageData pageData = (InstructorFeedbackRemindParticularStudentsPageData) r.data;
assertEquals(6, pageData.getResponseStatus().studentsWhoDidNotRespond.size());
assertEquals(3, pageData.getResponseStatus().studentsWhoResponded.size());
assertTrue(pageData.getResponseStatus().studentsWhoResponded.contains("student1InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student2InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoResponded.contains("student3InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student4InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoResponded.contains("student5InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student6InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor1@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor2@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor3@course1.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor4@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("helper@course1.tmt"));
}
use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackResponseCommentDeleteActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
removeAndRestoreTypicalDataBundle();
FeedbackQuestionsDb feedbackQuestionsDb = new FeedbackQuestionsDb();
FeedbackResponsesDb feedbackResponsesDb = new FeedbackResponsesDb();
FeedbackResponseCommentsDb feedbackResponseCommentsDb = new FeedbackResponseCommentsDb();
int questionNumber = 1;
FeedbackQuestionAttributes feedbackQuestion = feedbackQuestionsDb.getFeedbackQuestion("First feedback session", "idOfTypicalCourse1", questionNumber);
String giverEmail = "student1InCourse1@gmail.tmt";
String receiverEmail = "student1InCourse1@gmail.tmt";
FeedbackResponseAttributes feedbackResponse = feedbackResponsesDb.getFeedbackResponse(feedbackQuestion.getId(), giverEmail, receiverEmail);
FeedbackResponseCommentAttributes feedbackResponseComment = typicalBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q1S1C1");
feedbackResponseComment = feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponse.getId(), feedbackResponseComment.giverEmail, feedbackResponseComment.createdAt);
assertNotNull("response comment not found", feedbackResponseComment);
InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor.googleId);
______TS("Unsuccessful case: not enough parameters");
verifyAssumptionFailure();
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment to first response", Const.ParamsNames.USER_ID, instructor.googleId };
verifyAssumptionFailure(submissionParams);
______TS("Typical successful case");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient" };
InstructorFeedbackResponseCommentDeleteAction action = getAction(submissionParams);
AjaxResult result = getAjaxResult(action);
InstructorFeedbackResponseCommentAjaxPageData data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertNull(feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponseComment.feedbackResponseId, feedbackResponseComment.giverEmail, feedbackResponseComment.createdAt));
assertEquals("", result.getStatusMessage());
______TS("Non-existent feedback response comment");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, // non-existent feedback response comment id
Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, "123123123123123", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertNull(feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponseComment.feedbackResponseId, feedbackResponseComment.giverEmail, feedbackResponseComment.createdAt));
assertEquals("", result.getStatusMessage());
______TS("Instructor is not feedback response comment giver");
gaeSimulation.loginAsInstructor("idOfInstructor2OfCourse1");
questionNumber = 2;
feedbackQuestion = feedbackQuestionsDb.getFeedbackQuestion("First feedback session", "idOfTypicalCourse1", questionNumber);
giverEmail = "student2InCourse1@gmail.tmt";
feedbackResponse = feedbackResponsesDb.getFeedbackResponse(feedbackQuestion.getId(), giverEmail, receiverEmail);
feedbackResponseComment = typicalBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q2S1C1");
feedbackResponseComment = feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponse.getId(), feedbackResponseComment.giverEmail, feedbackResponseComment.createdAt);
assertNotNull("response comment not found", feedbackResponseComment);
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertNull(feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponseComment.feedbackResponseId, feedbackResponseComment.giverEmail, feedbackResponseComment.createdAt));
assertEquals("", result.getStatusMessage());
}
use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackResponseCommentEditActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() throws Exception {
FeedbackQuestionsDb feedbackQuestionsDb = new FeedbackQuestionsDb();
FeedbackResponsesDb feedbackResponsesDb = new FeedbackResponsesDb();
FeedbackResponseCommentsDb feedbackResponseCommentsDb = new FeedbackResponseCommentsDb();
int questionNumber = 1;
FeedbackQuestionAttributes feedbackQuestion = feedbackQuestionsDb.getFeedbackQuestion("First feedback session", "idOfTypicalCourse1", questionNumber);
String giverEmail = "student1InCourse1@gmail.tmt";
String receiverEmail = "student1InCourse1@gmail.tmt";
FeedbackResponseAttributes feedbackResponse = feedbackResponsesDb.getFeedbackResponse(feedbackQuestion.getId(), giverEmail, receiverEmail);
FeedbackResponseCommentAttributes feedbackResponseComment = typicalBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q1S1C1");
feedbackResponseComment = feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponse.getId(), feedbackResponseComment.giverEmail, feedbackResponseComment.createdAt);
assertNotNull("response comment not found", feedbackResponseComment);
InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor.googleId);
______TS("Unsuccessful csae: not enough parameters");
verifyAssumptionFailure();
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment to first response", Const.ParamsNames.USER_ID, instructor.googleId };
verifyAssumptionFailure(submissionParams);
______TS("Typical successful case for unpublished session");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER,INSTRUCTORS", Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO, "GIVER,INSTRUCTORS" };
InstructorFeedbackResponseCommentEditAction action = getAction(submissionParams);
AjaxResult result = getAjaxResult(action);
InstructorFeedbackResponseCommentAjaxPageData data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
______TS("Null show comments and show giver permissions");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
______TS("Empty show comments and show giver permissions");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "", Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO, "" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
______TS("Typical successful case for unpublished session public to various recipients");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "RECEIVER" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "OWN_TEAM_MEMBERS" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "RECEIVER_TEAM_MEMBERS" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "STUDENTS" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
______TS("Non-existent feedback response comment id");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, "123123123123123", Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER,INSTRUCTORS", Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO, "GIVER,INSTRUCTORS" };
try {
action = getAction(submissionParams);
result = getAjaxResult(action);
} catch (AssertionError e) {
assertEquals("FeedbackResponseComment should not be null", e.getMessage());
}
______TS("Instructor is not feedback response comment giver");
gaeSimulation.loginAsInstructor("idOfInstructor2OfCourse1");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER,INSTRUCTORS", Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO, "GIVER,INSTRUCTORS" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
______TS("Typical successful case for published session");
gaeSimulation.loginAsInstructor(instructor.googleId);
FeedbackSessionAttributes fs = FeedbackSessionsLogic.inst().getFeedbackSession(feedbackResponseComment.feedbackSessionName, feedbackResponseComment.courseId);
FeedbackSessionsLogic.inst().publishFeedbackSession(fs);
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited for published session)", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER,INSTRUCTORS" };
action = getAction(submissionParams);
result = getAjaxResult(action);
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertFalse(data.isError);
assertEquals("", result.getStatusMessage());
______TS("Unsuccessful case: empty comment text");
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient" };
action = getAction(submissionParams);
result = getAjaxResult(action);
assertEquals("", result.getStatusMessage());
data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
assertTrue(data.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSE_COMMENT_EMPTY, data.errorMessage);
}
Aggregations