protected void setUp() throws Exception {
   super.setUp();
   params = new HashMap();
   results = new HashMap();
   interceptors = new ArrayList();
   exceptionMappings = new ArrayList();
 }
  protected void onSetUp() throws Exception {
    super.onSetUp();

    /*
    	What we need to test:

    	The Sakai authz side will be interested in two types of roles: Instructor and Student.

    	From the CM side, a section's official instructor will get the "Instructor" role.

    	Users with an enrollment status of "E" or "W" will get the "Student" role. Other enrollment statuses
    	("X", etc.,) will result in non-membership. A dropped status will result in non-membership.

    	Remaining users who are members of the section will be mapped "teacher" to "Instructor" and
    	"learner" to "Student". Other types of membership will be discarded.

    	No attention will be paid to memberships atg the CourseOffering or CourseSet levels.

    	When a user is mapped to multiple roles, they're preferred in the order: "Instructor", "Student".

    	Sakai's arcane site authorization approach involves gluing course management EIDs together into
    	"realm provider" strings. The default provider uses a plus sign as the glue. Check this doesn't
    	block EIDs that contain the "+" character.
    */

    addUser(officialInstructorOfA);
    addUser(unofficialInstructorOfA);
    addUser(adminOfOfferingA);
    addUser(instructorOfB);
    addUser(deptAdminOfADept);
    addUser(deptAdminAndGsi);
    addUser(deptAdminOfBDept);
    addUser(waitListedStudentALec1);
    addUser(studentADis1);
    addUser(enrolledStudentBLec1);
    addUser(droppedStudentALec1);
    addUser(expelledStudentALec1);
    addUser(unofficialStudentALec1);
    addUser(gsiALec1);
    addUser(taAsEnrollmentALec1);

    courseManagementAdmin.createCourseSet(deptA, deptA, deptA, "DEPT", null);
    courseManagementAdmin.addOrUpdateCourseSetMembership(
        deptAdminOfADept, "DeptAdmin", deptA, "active");
    courseManagementAdmin.addOrUpdateCourseSetMembership(
        deptAdminAndGsi, "DeptAdmin", deptA, "active");
    courseManagementAdmin.createCourseSet(deptB, deptB, deptB, "DEPT", null);
    courseManagementAdmin.addOrUpdateCourseSetMembership(
        deptAdminOfBDept, "DeptAdmin", deptB, "active");
    courseManagementAdmin.createAcademicSession(term1, term1, term1, null, null);
    courseManagementAdmin.createCanonicalCourse(canonicalA, canonicalA, canonicalA);
    courseManagementAdmin.createCanonicalCourse(canonicalB, canonicalB, canonicalB);
    courseManagementAdmin.createCourseOffering(
        courseOfferingA, courseOfferingA, courseOfferingA, "open", term1, canonicalA, null, null);
    courseManagementAdmin.addOrUpdateCourseOfferingMembership(
        adminOfOfferingA, "CourseAdmin", courseOfferingA, null);
    courseManagementAdmin.createCourseOffering(
        courseOfferingB, courseOfferingB, courseOfferingB, "open", term1, canonicalB, null, null);
    courseManagementAdmin.addCourseOfferingToCourseSet(deptA, courseOfferingA);
    courseManagementAdmin.addCourseOfferingToCourseSet(deptB, courseOfferingB);

    Set<String> officialInstructors = new HashSet<String>();
    officialInstructors.add(officialInstructorOfA);
    courseManagementAdmin.createEnrollmentSet(
        enrollmentALec1,
        enrollmentALec1,
        enrollmentALec1,
        "lecture",
        "4",
        courseOfferingA,
        officialInstructors);
    courseManagementAdmin.createEnrollmentSet(
        enrollmentBLec1, enrollmentBLec1, enrollmentBLec1, "lecture", "4", courseOfferingB, null);

    courseManagementAdmin.createSection(
        sectionALec1,
        sectionALec1,
        sectionALec1,
        "lecture",
        null,
        courseOfferingA,
        enrollmentALec1);
    courseManagementAdmin.createSection(
        sectionADis1, sectionADis1, sectionADis1, "discussion", null, courseOfferingA, null);
    courseManagementAdmin.createSection(
        sectionBLec1,
        sectionBLec1,
        sectionBLec1,
        "lecture",
        null,
        courseOfferingB,
        enrollmentBLec1);

    courseManagementAdmin.addOrUpdateCourseOfferingMembership(
        unofficialInstructorOfA, "teacher", courseOfferingA, "active");

    courseManagementAdmin.addOrUpdateEnrollment(
        waitListedStudentALec1, enrollmentALec1, "W", "4", "letter");
    courseManagementAdmin.addOrUpdateEnrollment(
        enrolledStudentBLec1, enrollmentBLec1, "E", "4", "letter");
    courseManagementAdmin.addOrUpdateEnrollment(
        droppedStudentALec1, enrollmentALec1, "E", "4", "letter");
    courseManagementAdmin.removeEnrollment(droppedStudentALec1, enrollmentALec1);
    courseManagementAdmin.addOrUpdateEnrollment(
        expelledStudentALec1, enrollmentALec1, "X", "4", "letter");
    courseManagementAdmin.addOrUpdateEnrollment(
        taAsEnrollmentALec1, enrollmentALec1, "VeryWellTrusted", "4", "letter");

    courseManagementAdmin.addOrUpdateSectionMembership(
        studentADis1, "learner", sectionADis1, "active");
    courseManagementAdmin.addOrUpdateSectionMembership(gsiALec1, "GSI", sectionALec1, "active");
    courseManagementAdmin.addOrUpdateSectionMembership(
        deptAdminAndGsi, "GSI", sectionALec1, "active");
    courseManagementAdmin.addOrUpdateSectionMembership(
        instructorOfB, "teacher", sectionBLec1, "active");

    // Now let's make some course sites.
    Site site = siteService.addSite(courseOfferingA, "course");
    site.setProviderGroupId(groupProvider.packId(new String[] {sectionALec1, sectionADis1}));
    siteService.save(site);

    // Add an unofficial student to the site. The save will wipe out the provided users!
    AuthzGroup authzGroup = authzGroupService.getAuthzGroup(site.getReference());
    authzGroup.addMember(unofficialStudentALec1, "Student", true, false);
    authzGroupService.save(authzGroup);

    site = siteService.addSite(sectionALec1, "course");
    site.setProviderGroupId(sectionALec1);
    siteService.save(site);

    site = siteService.addSite(courseOfferingB, "course");
    site.setProviderGroupId(sectionBLec1);
    siteService.save(site);
  }