1 | package edu.ucsb.cs156.happiercows.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.happiercows.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.startQtrYYYYQ:20221}") | |
31 | private String startQtrYYYYQ; | |
32 | ||
33 | @Value("${app.endQtrYYYYQ:20243}") | |
34 | private String endQtrYYYYQ; | |
35 | ||
36 | @Value("${app.sourceRepo}") | |
37 | private String sourceRepo = "https://github.com/ucsb-cs156/proj-happycows"; | |
38 | ||
39 | @Value("${git.commit.message.short:unknown}") | |
40 | private String commitMessage; | |
41 | ||
42 | @Value("${git.commit.id.abbrev:unknown}") | |
43 | private String commitId; | |
44 | ||
45 | public static String githubUrl(String repo, String commit) { | |
46 |
3
1. githubUrl : negated conditional → KILLED 2. githubUrl : negated conditional → KILLED 3. githubUrl : replaced return value with "" for edu/ucsb/cs156/happiercows/services/SystemInfoServiceImpl::githubUrl → KILLED |
return commit != null && repo != null ? repo + "/commit/" + commit : null; |
47 | } | |
48 | ||
49 | @Value("${app.oauth.login:/oauth2/authorization/google}") | |
50 | private String oauthLogin; | |
51 | ||
52 | public SystemInfo getSystemInfo() { | |
53 | SystemInfo si = SystemInfo.builder() | |
54 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
55 | .showSwaggerUILink(this.showSwaggerUILink) | |
56 | .startQtrYYYYQ(this.startQtrYYYYQ) | |
57 | .endQtrYYYYQ(this.endQtrYYYYQ) | |
58 | .sourceRepo(this.sourceRepo) | |
59 | .commitMessage(this.commitMessage) | |
60 | .commitId(this.commitId) | |
61 | .githubUrl(githubUrl(this.sourceRepo, this.commitId)) | |
62 | .oauthLogin(this.oauthLogin) | |
63 | .build(); | |
64 | log.info("getSystemInfo returns {}",si); | |
65 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/happiercows/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
66 | } | |
67 | ||
68 | } | |
Mutations | ||
46 |
1.1 2.2 3.3 |
|
65 |
1.1 |