コード例 #1
0
  /**
   * @see org.springframework.test.AbstractTransactionalSpringContextTests#onSetUpInTransaction()
   */
  protected void onSetUpInTransaction() throws Exception {
    super.onSetUpInTransaction();

    gradebookFrameworkService.addGradebook(GRADEBOOK_UID, GRADEBOOK_UID);
    Gradebook gradebook = gradebookManager.getGradebook(GRADEBOOK_UID);

    // Set up a holder for enrollments, teaching assignments, and sections.
    integrationSupport.createCourse(GRADEBOOK_UID, GRADEBOOK_UID, false, false, false);

    List studentUidsList =
        Arrays.asList(
            new String[] {
              "student1", "student2", "student3",
            });
    addUsersEnrollments(gradebook, studentUidsList);

    // Add an internal assignment
    Long gbId = gradebook.getId();
    asn_1Id =
        gradebookManager.createAssignment(
            gbId, ASN_1, new Double(10), null, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);

    // Add a score for the internal assignment
    List assignments = gradebookManager.getAssignments(gbId);
    Assignment asn = null;
    for (Iterator iter = assignments.iterator(); iter.hasNext(); ) {
      Assignment tmp = (Assignment) iter.next();
      if (tmp.getName().equals(ASN_1)) {
        asn = tmp;
        break;
      }
    }
    List gradeRecords = new ArrayList();
    gradeRecords.add(new AssignmentGradeRecord(asn, "student1", new Double(10)));
    gradebookManager.updateAssignmentGradeRecords(asn, gradeRecords);
  }