Bugfix 31/8831/1
authorPatrikBuhr <patrik.buhr@est.tech>
Fri, 5 Aug 2022 06:43:51 +0000 (08:43 +0200)
committerPatrikBuhr <patrik.buhr@est.tech>
Fri, 5 Aug 2022 06:46:48 +0000 (08:46 +0200)
Missing app.auth-token-file in application.yaml would not default to an empty string.
Formatting

Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-743
Change-Id: Ic30d29b5720d4e2a81664712526ec1fdea6e512d

15 files changed:
pom.xml
src/main/java/org/oransc/ics/clients/SecurityContext.java
src/main/java/org/oransc/ics/configuration/ApplicationConfig.java
src/main/java/org/oransc/ics/controllers/VoidResponse.java
src/main/java/org/oransc/ics/controllers/a1e/A1eEiJobStatus.java
src/main/java/org/oransc/ics/controllers/a1e/A1eEiTypeInfo.java
src/main/java/org/oransc/ics/controllers/r1consumer/ConsumerInfoTypeInfo.java
src/main/java/org/oransc/ics/controllers/r1consumer/ConsumerJobInfo.java
src/main/java/org/oransc/ics/controllers/r1consumer/ConsumerJobStatus.java
src/main/java/org/oransc/ics/controllers/r1consumer/ConsumerTypeRegistrationInfo.java
src/main/java/org/oransc/ics/controllers/r1consumer/ConsumerTypeSubscriptionInfo.java
src/main/java/org/oransc/ics/controllers/r1producer/ProducerInfoTypeInfo.java
src/main/java/org/oransc/ics/controllers/r1producer/ProducerRegistrationInfo.java
src/main/java/org/oransc/ics/controllers/r1producer/ProducerStatusInfo.java
src/test/java/org/oransc/ics/MockInformationService.java

diff --git a/pom.xml b/pom.xml
index 52fde2a..7451773 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
         <exec.skip>true</exec.skip>
     </properties>
-    <dependencies>
-        <dependency>
-            <groupId>org.springdoc</groupId>
-            <artifactId>springdoc-openapi-ui</artifactId>
-            <version>1.6.6</version>
-        </dependency>
+    <dependencies>        
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
             <optional>true</optional>
         </dependency>
         <!-- TEST -->
+        <dependency>
+            <groupId>org.springdoc</groupId>
+            <artifactId>springdoc-openapi-ui</artifactId>
+            <version>1.6.6</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
index aadc1bf..f11b669 100644 (file)
@@ -47,7 +47,7 @@ public class SecurityContext {
     @Setter
     private Path authTokenFilePath;
 
-    public SecurityContext(@Value("${app.auth-token-file:\"\"}") String authTokenFilename) {
+    public SecurityContext(@Value("${app.auth-token-file:}") String authTokenFilename) {
         if (!authTokenFilename.isEmpty()) {
             this.authTokenFilePath = Path.of(authTokenFilename);
         }
@@ -63,7 +63,7 @@ public class SecurityContext {
         }
         try {
             long lastModified = authTokenFilePath.toFile().lastModified();
-            if (lastModified != this.tokenTimestamp) {
+            if (tokenTimestamp == 0 || lastModified != this.tokenTimestamp) {
                 this.authToken = Files.readString(authTokenFilePath);
                 this.tokenTimestamp = lastModified;
             }
index f076789..50c6daa 100644 (file)
@@ -60,7 +60,7 @@ public class ApplicationConfig {
     @Value("${app.webclient.trust-store}")
     private String sslTrustStore = "";
 
-    @Value("${app.webclient.http.proxy-host:\"\"}")
+    @Value("${app.webclient.http.proxy-host:}")
     private String httpProxyHost = "";
 
     @Value("${app.webclient.http.proxy-port:0}")
index 4f69a7a..e369acd 100644 (file)
@@ -22,7 +22,6 @@ package org.oransc.ics.controllers;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "Void", description = "Void/empty ")
 public class VoidResponse {
     private VoidResponse() {
index 1f22e9a..e635f2e 100644 (file)
@@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "EiJobStatusObject", description = "Status for an EI job")
 public class A1eEiJobStatus {
 
index eac18f3..edf7297 100644 (file)
@@ -22,7 +22,6 @@ package org.oransc.ics.controllers.a1e;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "EiTypeObject", description = "Information for an EI type")
 public class A1eEiTypeInfo {
 
index cce345c..1f11c15 100644 (file)
@@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "consumer_information_type", description = "Information for an Information type")
 public class ConsumerInfoTypeInfo {
 
index 696e827..7babf87 100644 (file)
@@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "consumer_job", description = "Information for an Information Job")
 public class ConsumerJobInfo {
 
index 715f88f..78657fd 100644 (file)
@@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
 
 import java.util.Collection;
 
-
 @Schema(name = "consumer_job_status", description = "Status for an Information Job")
 public class ConsumerJobStatus {
 
index f3010c9..fa4ea99 100644 (file)
@@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "consumer_type_registration_info", description = "Information for an Information type")
 public class ConsumerTypeRegistrationInfo {
 
index fc8fc24..84e8e9d 100644 (file)
@@ -26,7 +26,6 @@ import com.google.gson.annotations.SerializedName;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.EqualsAndHashCode;
 
-
 @EqualsAndHashCode
 @Schema(name = "consumer_type_subscription_info", description = "Information for an information type subscription")
 public class ConsumerTypeSubscriptionInfo {
index beca34a..45c5a93 100644 (file)
@@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "producer_info_type_info", description = "Information for an Information Type")
 public class ProducerInfoTypeInfo {
 
index 3493bad..ee82546 100644 (file)
@@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
 
 import java.util.Collection;
 
-
 @Schema(name = "producer_registration_info", description = "Information for an Information Producer")
 public class ProducerRegistrationInfo {
 
index c29af8f..9a04023 100644 (file)
@@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 
-
 @Schema(name = "producer_status", description = "Status for an Info Producer")
 public class ProducerStatusInfo {
 
index 65c19a8..fc21315 100644 (file)
 package org.oransc.ics;
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
 import org.springframework.boot.web.server.LocalServerPort;
 import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
 
-@ExtendWith(SpringExtension.class)
 @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
 @TestPropertySource(
     properties = { //