| 1 | package edu.ucsb.cs156.happiercows.jobs; | |
| 2 | ||
| 3 | ||
| 4 | import org.springframework.security.core.Authentication; | |
| 5 | import org.springframework.security.core.context.SecurityContextHolder; | |
| 6 | ||
| 7 | import edu.ucsb.cs156.happiercows.services.jobs.JobContext; | |
| 8 | import edu.ucsb.cs156.happiercows.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/happiercows/services/jobs/JobContext::log → KILLED | 
            ctx.log("Hello World! from test job!"); | 
| 23 | 
1
1. accept : negated conditional → KILLED | 
            if (authentication == null) { | 
| 24 | 
1
1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED | 
                ctx.log("authentication is null"); | 
| 25 |             } else { | |
| 26 | 
1
1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED | 
                ctx.log("authentication is not null"); | 
| 27 |             } | |
| 28 | 
1
1. accept : removed call to java/lang/Thread::sleep → KILLED | 
            Thread.sleep(sleepMs); | 
| 29 | 
1
1. accept : negated conditional → KILLED | 
            if (fail) { | 
| 30 |                 throw new Exception("Fail!"); | |
| 31 |             } | |
| 32 | 
1
1. accept : removed call to edu/ucsb/cs156/happiercows/services/jobs/JobContext::log → KILLED | 
            ctx.log("Goodbye from test job!"); | 
| 33 |     } | |
| 34 | } | |
Mutations | ||
| 22 | 
 
 1.1  | 
|
| 23 | 
 
 1.1  | 
|
| 24 | 
 
 1.1  | 
|
| 26 | 
 
 1.1  | 
|
| 28 | 
 
 1.1  | 
|
| 29 | 
 
 1.1  | 
|
| 32 | 
 
 1.1  |