CourseDataJobsRepository.java

1
package edu.ucsb.cs156.courses.repositories;
2
3
import java.util.Collection;
4
import java.util.Map;
5
import lombok.RequiredArgsConstructor;
6
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
7
import org.springframework.stereotype.Repository;
8
9
/** Queries the job library's existing table without adding another entity or schema migration. */
10
@Repository
11
@RequiredArgsConstructor
12
public class CourseDataJobsRepository {
13
  private final NamedParameterJdbcTemplate jdbc;
14
15
  public boolean existsByJobNameAndStatusIn(String jobName, Collection<String> statuses) {
16 2 1. existsByJobNameAndStatusIn : replaced boolean return with false for edu/ucsb/cs156/courses/repositories/CourseDataJobsRepository::existsByJobNameAndStatusIn → KILLED
2. existsByJobNameAndStatusIn : replaced boolean return with true for edu/ucsb/cs156/courses/repositories/CourseDataJobsRepository::existsByJobNameAndStatusIn → KILLED
    return Boolean.TRUE.equals(
17
        jdbc.queryForObject(
18
            "select exists (select 1 from jobs where job_name = :name and status in (:statuses))",
19
            Map.of("name", jobName, "statuses", statuses),
20
            Boolean.class));
21
  }
22
23
  public void failQueuedSubmission(String name) {
24
    jdbc.update(
25
        "update jobs set status = 'failed' where job_name = :name and status = 'queued'",
26
        Map.of("name", name));
27
  }
28
}

Mutations

16

1.1
Location : existsByJobNameAndStatusIn
Killed by : edu.ucsb.cs156.courses.services.CourseDataLoadConcurrencyTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.CourseDataLoadConcurrencyTests]/[method:dispatchFailureMarksOnlyItsQueuedRowFailedAndAllowsRetry()]
replaced boolean return with false for edu/ucsb/cs156/courses/repositories/CourseDataJobsRepository::existsByJobNameAndStatusIn → KILLED

2.2
Location : existsByJobNameAndStatusIn
Killed by : edu.ucsb.cs156.courses.services.CourseDataLoadConcurrencyTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.CourseDataLoadConcurrencyTests]/[method:dispatchFailureMarksOnlyItsQueuedRowFailedAndAllowsRetry()]
replaced boolean return with true for edu/ucsb/cs156/courses/repositories/CourseDataJobsRepository::existsByJobNameAndStatusIn → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1