modify dockerfile to fix jenkins staing jobs
change relative directory of ADD command
run code formatter command
Issue-ID: NONRTRIC-79
Signed-off-by: YongchaoWu <yongchao.wu@est.tech>
Change-Id: I08e19fc640af8f230c155e9192479e3ae049a32f
diff --git a/policy-agent/Dockerfile b/policy-agent/Dockerfile
index f28414c..1c5f210 100644
--- a/policy-agent/Dockerfile
+++ b/policy-agent/Dockerfile
@@ -26,7 +26,7 @@
EXPOSE 8081
ADD /config/application.yaml /opt/app/policy-agent/config/
-ADD /target/policy-agent-1.0.0-SNAPSHOT.jar /opt/app/policy-agent/
+ADD target/policy-agent-1.0.0-SNAPSHOT.jar /opt/app/policy-agent/
RUN chmod -R 777 /opt/app/policy-agent/config/
diff --git a/policy-agent/config/application.yaml b/policy-agent/config/application.yaml
index e373ac6..b41c381 100644
--- a/policy-agent/config/application.yaml
+++ b/policy-agent/config/application.yaml
@@ -18,6 +18,7 @@
org.onap.dcaegen2.collectors.datafile: WARN
file: /var/log/policy-agent/application.log
app:
- filepath: /opt/app/policy-agent/config/application_configuration.json
+ filepath: src/test/resources/test_application_configuration.json
+
server:
port : 8081
diff --git a/policy-agent/config/application_configuration.json b/policy-agent/config/application_configuration.json
deleted file mode 100644
index 7033c4a..0000000
--- a/policy-agent/config/application_configuration.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "config": {
- "//description": "Application configuration",
- "ric": [
- {
- "name": "ric1",
- "baseUrl": "http://localhost:8080/",
- "managedElementIds": [
- "kista_1",
- "kista_2"
- ]
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
index 97f9f4c..aab0363 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
@@ -20,12 +20,17 @@
package org.oransc.policyagent.controllers;
-import java.util.Collection;
-import java.util.Vector;
-
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+import java.util.Collection;
+import java.util.Vector;
+
import org.oransc.policyagent.configuration.ApplicationConfig;
import org.oransc.policyagent.exceptions.ServiceException;
import org.oransc.policyagent.repository.ImmutablePolicy;
@@ -45,11 +50,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
@RestController
@Api(value = "Policy Management API")
public class PolicyController {
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java
index 844d6e8..6831d4c 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java
@@ -20,13 +20,13 @@
package org.oransc.policyagent.controllers;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
import java.time.Duration;
import java.util.Collection;
import java.util.Vector;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
import org.oransc.policyagent.exceptions.ServiceException;
import org.oransc.policyagent.repository.Service;
import org.oransc.policyagent.repository.Services;
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/tasks/RepositorySupervision.java b/policy-agent/src/main/java/org/oransc/policyagent/tasks/RepositorySupervision.java
index d68c123..7984a62 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/tasks/RepositorySupervision.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/tasks/RepositorySupervision.java
@@ -23,14 +23,15 @@
import org.oransc.policyagent.clients.A1Client;
import org.oransc.policyagent.repository.Policies;
import org.oransc.policyagent.repository.Ric;
-import org.oransc.policyagent.repository.Rics;
import org.oransc.policyagent.repository.Ric.RicState;
+import org.oransc.policyagent.repository.Rics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -87,20 +88,20 @@
private Mono<Ric> checkActive(Ric ric) {
logger.debug("Handling active ric {}", ric);
a1Client.getPolicyIdentities(ric.getConfig().baseUrl()) //
- .filter(policyId -> !policies.containsPolicy(policyId)) //
- .doOnNext(policyId -> logger.debug("Deleting policy {}", policyId))
- .flatMap(policyId -> a1Client.deletePolicy(ric.getConfig().baseUrl(), policyId)) //
- .subscribe();
+ .filter(policyId -> !policies.containsPolicy(policyId)) //
+ .doOnNext(policyId -> logger.debug("Deleting policy {}", policyId))
+ .flatMap(policyId -> a1Client.deletePolicy(ric.getConfig().baseUrl(), policyId)) //
+ .subscribe();
return Mono.just(ric);
}
private Mono<Ric> checkNotReachable(Ric ric) {
logger.debug("Handling not reachable ric {}", ric);
a1Client.getPolicyIdentities(ric.getConfig().baseUrl()) //
- .filter(policyId -> !policies.containsPolicy(policyId)) //
- .doOnNext(policyId -> logger.debug("Deleting policy {}", policyId))
- .flatMap(policyId -> a1Client.deletePolicy(ric.getConfig().baseUrl(), policyId)) //
- .subscribe(null, null, () -> ric.setState(RicState.ACTIVE));
+ .filter(policyId -> !policies.containsPolicy(policyId)) //
+ .doOnNext(policyId -> logger.debug("Deleting policy {}", policyId))
+ .flatMap(policyId -> a1Client.deletePolicy(ric.getConfig().baseUrl(), policyId)) //
+ .subscribe(null, null, () -> ric.setState(RicState.ACTIVE));
return Mono.just(ric);
}
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/tasks/StartupService.java b/policy-agent/src/main/java/org/oransc/policyagent/tasks/StartupService.java
index 8bfa81e..fd92746 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/tasks/StartupService.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/tasks/StartupService.java
@@ -32,6 +32,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java b/policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
index 268c7a4..3d712a3 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
@@ -20,8 +20,8 @@
package org.oransc.policyagent.tasks;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.awaitility.Awaitility.await;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
@@ -43,8 +43,9 @@
import org.oransc.policyagent.repository.Policy;
import org.oransc.policyagent.repository.PolicyType;
import org.oransc.policyagent.repository.Ric;
-import org.oransc.policyagent.repository.Rics;
import org.oransc.policyagent.repository.Ric.RicState;
+import org.oransc.policyagent.repository.Rics;
+
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/tasks/StartupServiceTest.java b/policy-agent/src/test/java/org/oransc/policyagent/tasks/StartupServiceTest.java
index 10c3271..8bcda08 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/tasks/StartupServiceTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/tasks/StartupServiceTest.java
@@ -33,6 +33,7 @@
import static org.oransc.policyagent.repository.Ric.RicState.NOT_REACHABLE;
import java.util.Vector;
+
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
@@ -46,6 +47,7 @@
import org.oransc.policyagent.repository.PolicyTypes;
import org.oransc.policyagent.repository.Ric;
import org.oransc.policyagent.repository.Rics;
+
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;