| 1 | package edu.ucsb.cs.scaffold.services; | |
| 2 | ||
| 3 | import edu.ucsb.cs.scaffold.model.SystemInfo; | |
| 4 | import lombok.extern.slf4j.Slf4j; | |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | import org.springframework.beans.factory.annotation.Value; | |
| 7 | import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 8 | import org.springframework.boot.info.GitProperties; | |
| 9 | import org.springframework.stereotype.Service; | |
| 10 | ||
| 11 | @Slf4j | |
| 12 | @Service("systemInfo") | |
| 13 | @ConfigurationProperties | |
| 14 | public class SystemInfoServiceImpl extends SystemInfoService { | |
| 15 | ||
| 16 | @Value("${spring.h2.console.enabled:false}") | |
| 17 | private boolean springH2ConsoleEnabled; | |
| 18 | ||
| 19 | @Value("${app.showSwaggerUILink:false}") | |
| 20 | private boolean showSwaggerUILink; | |
| 21 | ||
| 22 | @Value("${app.oauth.login:/oauth2/authorization/google}") | |
| 23 | private String oauthLogin; | |
| 24 | ||
| 25 | @Value("${app.sourceRepo:https://github.com/ucsb-cs156/proj-scaffold}") | |
| 26 | private String sourceRepo; | |
| 27 | ||
| 28 | @Autowired(required = false) | |
| 29 | private GitProperties gitProperties; | |
| 30 | ||
| 31 | @Override | |
| 32 | public SystemInfo getSystemInfo() { | |
| 33 | String commitMessage = | |
| 34 |
1
1. getSystemInfo : negated conditional → KILLED |
this.gitProperties != null ? this.gitProperties.get("commit.message.short") : "unknown"; |
| 35 | String commitId = | |
| 36 |
1
1. getSystemInfo : negated conditional → KILLED |
this.gitProperties != null ? this.gitProperties.getShortCommitId() : "unknown"; |
| 37 | ||
| 38 | SystemInfo si = | |
| 39 | SystemInfo.builder() | |
| 40 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
| 41 | .showSwaggerUILink(this.showSwaggerUILink) | |
| 42 | .oauthLogin(this.oauthLogin) | |
| 43 | .sourceRepo(this.sourceRepo) | |
| 44 | .commitMessage(commitMessage) | |
| 45 | .commitId(commitId) | |
| 46 | .githubUrl(this.sourceRepo + "/commit/" + commitId) | |
| 47 | .build(); | |
| 48 | log.info("getSystemInfo returns {}", si); | |
| 49 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs/scaffold/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
| 50 | } | |
| 51 | } | |
Mutations | ||
| 34 |
1.1 |
|
| 36 |
1.1 |
|
| 49 |
1.1 |