| 1 | package edu.ucsb.cs156.rec.services; | |
| 2 | ||
| 3 | ||
| 4 | import edu.ucsb.cs156.rec.models.SystemInfo; | |
| 5 | import lombok.extern.slf4j.Slf4j; | |
| 6 | import org.springframework.beans.factory.annotation.Value; | |
| 7 | import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 8 | import org.springframework.stereotype.Service; | |
| 9 | ||
| 10 | /** | |
| 11 | * This is a service for getting information about the system. | |
| 12 | * | |
| 13 | * This class relies on property values. For hints on testing, see: <a href="https://www.baeldung.com/spring-boot-testing-configurationproperties">https://www.baeldung.com/spring-boot-testing-configurationproperties</a> | |
| 14 | * | |
| 15 | */ | |
| 16 | ||
| 17 | @Slf4j | |
| 18 | @Service("systemInfo") | |
| 19 | @ConfigurationProperties | |
| 20 | public class SystemInfoServiceImpl extends SystemInfoService { | |
| 21 | | |
| 22 | @Value("${spring.h2.console.enabled:false}") | |
| 23 | private boolean springH2ConsoleEnabled; | |
| 24 | ||
| 25 | @Value("${app.showSwaggerUILink:false}") | |
| 26 | private boolean showSwaggerUILink; | |
| 27 | ||
| 28 | @Value("${app.oauth.login:/oauth2/authorization/google}") | |
| 29 | private String oauthLogin; | |
| 30 | ||
| 31 | /** | |
| 32 | * This method returns the system information. | |
| 33 | * @see edu.ucsb.cs156.rec.models.SystemInfo | |
| 34 | * @return the system information | |
| 35 | */ | |
| 36 | public SystemInfo getSystemInfo() { | |
| 37 | SystemInfo si = SystemInfo.builder() | |
| 38 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
| 39 | .showSwaggerUILink(this.showSwaggerUILink) | |
| 40 | .oauthLogin(this.oauthLogin) | |
| 41 | .build(); | |
| 42 | log.info("getSystemInfo returns {}",si); | |
| 43 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/rec/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
| 44 | } | |
| 45 | ||
| 46 | } | |
Mutations | ||
| 43 |
1.1 |