1 | package edu.ucsb.cs156.organic.jobs; | |
2 | ||
3 | ||
4 | import org.springframework.security.core.Authentication; | |
5 | import org.springframework.security.core.context.SecurityContextHolder; | |
6 | ||
7 | import edu.ucsb.cs156.organic.services.jobs.JobContext; | |
8 | import edu.ucsb.cs156.organic.services.jobs.JobContextConsumer; | |
9 | import lombok.Builder; | |
10 | ||
11 | @Builder | |
12 | public class TestJob implements JobContextConsumer { | |
13 | ||
14 | private boolean fail; | |
15 | private int sleepMs; | |
16 | | |
17 | @Override | |
18 | public void accept(JobContext ctx) throws Exception { | |
19 | // Ensure this is not null | |
20 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | |
21 | ||
22 |
1
1. accept : removed call to edu/ucsb/cs156/organic/services/jobs/JobContext::log → KILLED |
ctx.log("Hello World! from test job!"); |
23 |
1
1. accept : removed call to java/lang/Thread::sleep → KILLED |
Thread.sleep(sleepMs); |
24 |
1
1. accept : negated conditional → KILLED |
if (fail) { |
25 | throw new Exception("Fail!"); | |
26 | } | |
27 |
1
1. accept : removed call to edu/ucsb/cs156/organic/services/jobs/JobContext::log → KILLED |
ctx.log("Goodbye from test job!"); |
28 | } | |
29 | } | |
Mutations | ||
22 |
1.1 |
|
23 |
1.1 |
|
24 |
1.1 |
|
27 |
1.1 |