1 | package edu.ucsb.cs156.gauchoride.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.stereotype.Service; | |
8 | import org.springframework.context.annotation.PropertySource; | |
9 | import org.springframework.context.annotation.PropertySources; | |
10 | ||
11 | import edu.ucsb.cs156.gauchoride.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:20242}") | |
31 | private String startQtrYYYYQ; | |
32 | ||
33 | @Value("${app.endQtrYYYYQ:20243}") | |
34 | private String endQtrYYYYQ; | |
35 | ||
36 | @Value("${app.sourceRepo:https://github.com/ucsb-cs156/proj-gauchoride}") | |
37 | private String sourceRepo; | |
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/gauchoride/services/SystemInfoServiceImpl::githubUrl → KILLED |
return commit != null && repo != null ? repo + "/commit/" + commit : null; |
47 | } | |
48 | ||
49 | public SystemInfo getSystemInfo() { | |
50 | SystemInfo si = | |
51 | SystemInfo.builder() | |
52 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
53 | .showSwaggerUILink(this.showSwaggerUILink) | |
54 | .startQtrYYYYQ(this.startQtrYYYYQ) | |
55 | .endQtrYYYYQ(this.endQtrYYYYQ) | |
56 | .sourceRepo(this.sourceRepo) | |
57 | .commitMessage(this.commitMessage) | |
58 | .commitId(this.commitId) | |
59 | .githubUrl(githubUrl(this.sourceRepo, this.commitId)) | |
60 | .build(); | |
61 | log.info("getSystemInfo returns {}", si); | |
62 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/gauchoride/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
63 | } | |
64 | ||
65 | } | |
Mutations | ||
46 |
1.1 2.2 3.3 |
|
62 |
1.1 |