1 | package edu.ucsb.cs156.organic.services; | |
2 | ||
3 | ||
4 | import lombok.extern.slf4j.Slf4j; | |
5 | import org.springframework.beans.factory.annotation.Value; | |
6 | import org.springframework.boot.context.properties.ConfigurationProperties; | |
7 | import org.springframework.context.annotation.PropertySource; | |
8 | import org.springframework.context.annotation.PropertySources; | |
9 | import org.springframework.stereotype.Service; | |
10 | ||
11 | import edu.ucsb.cs156.organic.models.SystemInfo; | |
12 | ||
13 | // This class relies on property values | |
14 | // For hints on testing, see: https://www.baeldung.com/spring-boot-testing-configurationproperties | |
15 | ||
16 | @Slf4j | |
17 | @Service("systemInfo") | |
18 | @ConfigurationProperties | |
19 | @PropertySources( | |
20 | @PropertySource("classpath:git.properties") | |
21 | ) | |
22 | public class SystemInfoServiceImpl extends SystemInfoService { | |
23 | | |
24 | @Value("${spring.h2.console.enabled:false}") | |
25 | private boolean springH2ConsoleEnabled; | |
26 | ||
27 | @Value("${app.showSwaggerUILink:false}") | |
28 | private boolean showSwaggerUILink; | |
29 | ||
30 | @Value("${app.sourceRepo:https://github.com/ucsb-cs156/proj-organic}") | |
31 | private String sourceRepo; | |
32 | ||
33 | @Value("${git.commit.message.short:unknown}") | |
34 | private String commitMessage; | |
35 | ||
36 | @Value("${git.commit.id.abbrev:unknown}") | |
37 | private String commitId; | |
38 | ||
39 | public static String githubUrl(String repo, String commit) { | |
40 |
3
1. githubUrl : negated conditional → KILLED 2. githubUrl : negated conditional → KILLED 3. githubUrl : replaced return value with "" for edu/ucsb/cs156/organic/services/SystemInfoServiceImpl::githubUrl → KILLED |
return commit != null && repo != null ? repo + "/commit/" + commit : null; |
41 | } | |
42 | ||
43 | public SystemInfo getSystemInfo() { | |
44 | SystemInfo si = SystemInfo.builder() | |
45 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
46 | .showSwaggerUILink(this.showSwaggerUILink) | |
47 | .sourceRepo(this.sourceRepo) | |
48 | .commitMessage(this.commitMessage) | |
49 | .commitId(this.commitId) | |
50 | .githubUrl(githubUrl(this.sourceRepo, this.commitId)) | |
51 | ||
52 | .build(); | |
53 | log.info("getSystemInfo returns {}",si); | |
54 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/organic/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
55 | } | |
56 | ||
57 | } | |
Mutations | ||
40 |
1.1 2.2 3.3 |
|
54 |
1.1 |