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.context.annotation.PropertySource; | |
8 | import org.springframework.context.annotation.PropertySources; | |
9 | import org.springframework.stereotype.Service; | |
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 | @PropertySources( | |
19 | @PropertySource("classpath:git.properties") | |
20 | ) | |
21 | @ConfigurationProperties | |
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:20222}") | |
34 | private String endQtrYYYYQ; | |
35 | ||
36 | @Value("${app.sourceRepo:https://github.com/ucsb-cs156-s24/proj-gauchoride-s24-5pm-5}") | |
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 = SystemInfo.builder() | |
51 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
52 | .showSwaggerUILink(this.showSwaggerUILink) | |
53 | .startQtrYYYYQ(this.startQtrYYYYQ) | |
54 | .endQtrYYYYQ(this.endQtrYYYYQ) | |
55 | .sourceRepo(this.sourceRepo) | |
56 | .commitMessage(this.commitMessage) | |
57 | .commitId(this.commitId) | |
58 | .githubUrl(githubUrl(this.sourceRepo, this.commitId)) | |
59 | .build(); | |
60 | log.info("getSystemInfo returns {}",si); | |
61 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/gauchoride/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
62 | } | |
63 | ||
64 | } | |
Mutations | ||
46 |
1.1 2.2 3.3 |
|
61 |
1.1 |