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:20243}") | |
31 | private String startQtrYYYYQ; | |
32 | ||
33 | @Value("${app.endQtrYYYYQ:20244}") | |
34 | private String endQtrYYYYQ; | |
35 | ||
36 | @Value("${app.sourceRepo}") | |
37 | private String sourceRepo = "https://github.com/ucsb-cs156/proj-happycows"; | |
38 | ||
39 | @Value("${app.oauth.login:/oauth2/authorization/google}") | |
40 | private String oauthLogin; | |
41 | ||
42 | @Value("${git.commit.message.short:commit message not found}") | |
43 | private String commitMessage; | |
44 | ||
45 | @Value("${git.commit.id.abbrev:commit id not found}") | |
46 | private String commitId; | |
47 | ||
48 | public static String githubUrl(String repo, String commit) { | |
49 |
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; |
50 | } | |
51 | ||
52 | public SystemInfo getSystemInfo() { | |
53 | SystemInfo si = | |
54 | SystemInfo.builder() | |
55 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
56 | .showSwaggerUILink(this.showSwaggerUILink) | |
57 | .startQtrYYYYQ(this.startQtrYYYYQ) | |
58 | .endQtrYYYYQ(this.endQtrYYYYQ) | |
59 | .sourceRepo(this.sourceRepo) | |
60 | .commitMessage(this.commitMessage) | |
61 | .commitId(this.commitId) | |
62 | .githubUrl(githubUrl(this.sourceRepo, this.commitId)) | |
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 | } | |
Mutations | ||
49 |
1.1 2.2 3.3 |
|
65 |
1.1 |