use of teammates.storage.api.FeedbackResponseCommentsDb 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.storage.api.FeedbackResponseCommentsDb 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);
}
use of teammates.storage.api.FeedbackResponseCommentsDb in project teammates by TEAMMATES.
the class FeedbackResponseCommentSearchTest method allTests.
@Test
public void allTests() {
FeedbackResponseCommentsDb commentsDb = new FeedbackResponseCommentsDb();
FeedbackResponseCommentAttributes frc1I1Q1S1C1 = dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q1S1C1");
FeedbackResponseCommentAttributes frc1I1Q2S1C1 = dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q2S1C1");
FeedbackResponseCommentAttributes frc1I3Q1S1C2 = dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q1S1C2");
ArrayList<InstructorAttributes> instructors = new ArrayList<InstructorAttributes>();
______TS("success: search for comments; no results found as instructor doesn't have privileges");
instructors.add(dataBundle.instructors.get("helperOfCourse1"));
FeedbackResponseCommentSearchResultBundle bundle = commentsDb.search("\"self-feedback\"", instructors);
assertEquals(0, bundle.numberOfResults);
assertTrue(bundle.comments.isEmpty());
______TS("success: search for comments; query string does not match any comment");
instructors.clear();
instructors.add(dataBundle.instructors.get("instructor3OfCourse1"));
instructors.add(dataBundle.instructors.get("instructor3OfCourse2"));
bundle = commentsDb.search("non-existent", instructors);
assertEquals(0, bundle.numberOfResults);
assertTrue(bundle.comments.isEmpty());
______TS("success: search for comments; query string matches single comment");
bundle = commentsDb.search("\"Instructor 3 comment to instr1C2 response to student1C2\"", instructors);
verifySearchResults(bundle, frc1I3Q1S1C2);
______TS("success: search for comments in instructor's course; query string matches some comments");
bundle = commentsDb.search("\"self feedback\"", instructors);
verifySearchResults(bundle, frc1I1Q1S1C1, frc1I1Q2S1C1);
______TS("success: search for comments in instructor's course; confirms query string is case insensitive");
bundle = commentsDb.search("\"Instructor 1 COMMENT to student 1 self feedback Question 2\"", instructors);
verifySearchResults(bundle, frc1I1Q2S1C1);
______TS("success: search for comments using feedbackSessionName");
bundle = commentsDb.search("\"First feedback session\"", instructors);
verifySearchResults(bundle, frc1I1Q2S1C1, frc1I1Q1S1C1);
______TS("success: search for comments using Instructor's email");
bundle = commentsDb.search("instructor1@course1.tmt", instructors);
verifySearchResults(bundle, frc1I1Q2S1C1, frc1I1Q1S1C1);
______TS("success: search for comments using Student name");
bundle = commentsDb.search("\"student2 In Course1\"", instructors);
verifySearchResults(bundle, frc1I1Q2S1C1);
______TS("success: search for comments; confirms deleted comments are not included in results");
commentsDb.deleteDocument(frc1I3Q1S1C2);
bundle = commentsDb.search("\"Instructor 3 comment to instr1C2 response to student1C2\"", instructors);
verifySearchResults(bundle);
}
use of teammates.storage.api.FeedbackResponseCommentsDb in project teammates by TEAMMATES.
the class InstructorFeedbackResponseCommentAddActionTest method testAccessControl.
@Override
@Test
protected void testAccessControl() throws Exception {
final FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
final FeedbackResponsesDb frDb = new FeedbackResponsesDb();
final FeedbackResponseCommentsDb frcDb = new FeedbackResponseCommentsDb();
int questionNumber = 1;
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
FeedbackQuestionAttributes question = fqDb.getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), questionNumber);
String giverEmail = "student1InCourse1@gmail.tmt";
String receiverEmail = "student1InCourse1@gmail.tmt";
FeedbackResponseAttributes response = frDb.getFeedbackResponse(question.getId(), giverEmail, receiverEmail);
FeedbackResponseCommentAttributes comment = FeedbackResponseCommentAttributes.builder(fs.getCourseId(), fs.getFeedbackSessionName(), giverEmail, new Text("")).withFeedbackQuestionId(question.getId()).withFeedbackResponseId(response.getId()).build();
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, comment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, comment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.FEEDBACK_QUESTION_ID, comment.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_ID, comment.feedbackResponseId, Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
verifyUnaccessibleWithoutSubmitSessionInSectionsPrivilege(submissionParams);
verifyUnaccessibleWithoutLogin(submissionParams);
verifyUnaccessibleForUnregisteredUsers(submissionParams);
verifyUnaccessibleForStudents(submissionParams);
verifyAccessibleForInstructorsOfTheSameCourse(submissionParams);
verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams);
// remove the comment
frcDb.deleteEntity(comment);
}
use of teammates.storage.api.FeedbackResponseCommentsDb in project teammates by TEAMMATES.
the class InstructorFeedbackResponseCommentDeleteActionTest method testAccessControl.
@Override
@Test
protected void testAccessControl() throws Exception {
final FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
final FeedbackResponsesDb frDb = new FeedbackResponsesDb();
final FeedbackResponseCommentsDb frcDb = new FeedbackResponseCommentsDb();
int questionNumber = 2;
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
FeedbackResponseCommentAttributes comment = typicalBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q2S1C1");
FeedbackResponseAttributes response = typicalBundle.feedbackResponses.get("response1ForQ2S1C1");
FeedbackQuestionAttributes question = fqDb.getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), questionNumber);
response = frDb.getFeedbackResponse(question.getId(), response.giver, response.recipient);
comment = frcDb.getFeedbackResponseComment(response.getId(), comment.giverEmail, comment.createdAt);
comment.feedbackResponseId = response.getId();
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "", Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, String.valueOf(comment.getId()) };
verifyUnaccessibleWithoutSubmitSessionInSectionsPrivilege(submissionParams);
verifyUnaccessibleWithoutLogin(submissionParams);
verifyUnaccessibleForUnregisteredUsers(submissionParams);
verifyUnaccessibleForStudents(submissionParams);
verifyAccessibleForInstructorsOfTheSameCourse(submissionParams);
verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams);
}
Aggregations