| 1 | package edu.ucsb.cs156.example.services; | |
| 2 | ||
| 3 | ||
| 4 | import edu.ucsb.cs156.example.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 | /** | |
| 12 |  * This is a service for getting information about the system. | |
| 13 |  *  | |
| 14 |  * 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> | |
| 15 |  *  | |
| 16 |  */ | |
| 17 | ||
| 18 | @Slf4j | |
| 19 | @Service("systemInfo") | |
| 20 | @ConfigurationProperties | |
| 21 | public class SystemInfoServiceImpl extends SystemInfoService { | |
| 22 |    | |
| 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.oauth.login:/oauth2/authorization/google}") | |
| 31 |   private String oauthLogin; | |
| 32 | ||
| 33 |   /** | |
| 34 |    * This method returns the system information. | |
| 35 |    * @see edu.ucsb.cs156.example.models.SystemInfo | |
| 36 |    * @return the system information | |
| 37 |    */ | |
| 38 |   public SystemInfo getSystemInfo() { | |
| 39 |     SystemInfo si = SystemInfo.builder() | |
| 40 |     .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
| 41 |     .showSwaggerUILink(this.showSwaggerUILink) | |
| 42 |     .oauthLogin(this.oauthLogin) | |
| 43 |     .build(); | |
| 44 |   log.info("getSystemInfo returns {}",si); | |
| 45 | 1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/example/services/SystemInfoServiceImpl::getSystemInfo → KILLED |   return si; | 
| 46 |   } | |
| 47 | ||
| 48 | } | |
| Mutations | ||
| 45 | 1.1 |