CreateStudentRepositoriesJob.java

1
package edu.ucsb.cs156.frontiers.jobs;
2
3
import edu.ucsb.cs156.frontiers.entities.Course;
4
import edu.ucsb.cs156.frontiers.entities.CourseStaff;
5
import edu.ucsb.cs156.frontiers.entities.RosterStudent;
6
import edu.ucsb.cs156.frontiers.enums.OrgStatus;
7
import edu.ucsb.cs156.frontiers.enums.RepositoryCreationTarget;
8
import edu.ucsb.cs156.frontiers.enums.RepositoryPermissions;
9
import edu.ucsb.cs156.frontiers.services.RepositoryService;
10
import edu.ucsb.cs156.frontiers.services.jobs.JobContext;
11
import edu.ucsb.cs156.frontiers.services.jobs.JobContextConsumer;
12
import lombok.Builder;
13
14
@Builder
15
public class CreateStudentRepositoriesJob implements JobContextConsumer {
16
  Course course;
17
  RepositoryService repositoryService;
18
  String repositoryPrefix;
19
  Boolean isPrivate;
20
  RepositoryPermissions permissions;
21
  @Builder.Default RepositoryCreationTarget creationTarget = RepositoryCreationTarget.STUDENTS_ONLY;
22
23
  @Override
24
  public void accept(JobContext ctx) throws Exception {
25
    ctx.log("Processing...");
26
27
    // Process students
28 2 1. accept : negated conditional → KILLED
2. accept : negated conditional → KILLED
    if (creationTarget == RepositoryCreationTarget.STUDENTS_ONLY
29
        || creationTarget == RepositoryCreationTarget.STUDENTS_AND_STAFF) {
30
      for (RosterStudent student : course.getRosterStudents()) {
31 1 1. accept : negated conditional → KILLED
        if (student.getGithubLogin() != null
32 1 1. accept : negated conditional → KILLED
            && (student.getOrgStatus() == OrgStatus.MEMBER
33 1 1. accept : negated conditional → KILLED
                || student.getOrgStatus() == OrgStatus.OWNER)) {
34 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createStudentRepository → KILLED
          repositoryService.createStudentRepository(
35
              course, student, repositoryPrefix, isPrivate, permissions);
36
        }
37
      }
38
    }
39
40
    // Process staff
41 2 1. accept : negated conditional → KILLED
2. accept : negated conditional → KILLED
    if (creationTarget == RepositoryCreationTarget.STAFF_ONLY
42
        || creationTarget == RepositoryCreationTarget.STUDENTS_AND_STAFF) {
43
      for (CourseStaff staff : course.getCourseStaff()) {
44 1 1. accept : negated conditional → KILLED
        if (staff.getGithubLogin() != null
45 1 1. accept : negated conditional → KILLED
            && (staff.getOrgStatus() == OrgStatus.MEMBER
46 1 1. accept : negated conditional → KILLED
                || staff.getOrgStatus() == OrgStatus.OWNER)) {
47 1 1. accept : removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createStaffRepository → KILLED
          repositoryService.createStaffRepository(
48
              course, staff, repositoryPrefix, isPrivate, permissions);
49
        }
50
      }
51
    }
52
53
    ctx.log("Done");
54
  }
55
}

Mutations

28

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testStaffOnlyDoesntCallForNoLogin()]
negated conditional → KILLED

2.2
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testStaffOnlyDoesntCallForNoLogin()]
negated conditional → KILLED

31

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testCreateStudentRepository_public()]
negated conditional → KILLED

32

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testCreateStudentRepository_public()]
negated conditional → KILLED

33

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:expectDoesntCallForNotMember()]
negated conditional → KILLED

34

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testCreateStudentRepository_public()]
removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createStudentRepository → KILLED

41

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:expectDoesntCallForNoLogin()]
negated conditional → KILLED

2.2
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:expectDoesntCallForNoLogin()]
negated conditional → KILLED

44

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testStaffOnlyOwnerStatus()]
negated conditional → KILLED

45

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testStaffOnlyDoesntCallForNotMember()]
negated conditional → KILLED

46

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testStaffOnlyOwnerStatus()]
negated conditional → KILLED

47

1.1
Location : accept
Killed by : edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.jobs.CreateStudentRepositoriesJobTest]/[method:testStaffOnlyOwnerStatus()]
removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createStaffRepository → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0