Merge "Default should be an object on TOSCA properties"
diff --git a/models-base/pom.xml b/models-base/pom.xml
index 5cd00b3..d9cd648 100644
--- a/models-base/pom.xml
+++ b/models-base/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-base</artifactId>
diff --git a/models-dao/pom.xml b/models-dao/pom.xml
index 8d1b723..a3567ec 100644
--- a/models-dao/pom.xml
+++ b/models-dao/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-dao</artifactId>
diff --git a/models-decisions/pom.xml b/models-decisions/pom.xml
index f9d609a..8592f07 100644
--- a/models-decisions/pom.xml
+++ b/models-decisions/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-decisions</artifactId>
diff --git a/models-errors/pom.xml b/models-errors/pom.xml
index 3fa4baa..8420540 100644
--- a/models-errors/pom.xml
+++ b/models-errors/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-errors</artifactId>
diff --git a/models-examples/pom.xml b/models-examples/pom.xml
index f9a5fa7..ccfba39 100644
--- a/models-examples/pom.xml
+++ b/models-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-examples</artifactId>
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.native.Drools.yaml b/models-examples/src/main/resources/policytypes/onap.policies.native.Drools.yaml
index 382999f..95c87e1 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.native.Drools.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.native.Drools.yaml
@@ -111,7 +111,7 @@
onap.datatypes.drools.controller.relation:
derived_from: tosca.datatypes.Root
properties:
- controllerName:
+ name:
type: string
required: true
description: the name of drools controller policy
diff --git a/models-interactions/model-actors/actor.aai/pom.xml b/models-interactions/model-actors/actor.aai/pom.xml
index 4b2dc45..521d7bc 100644
--- a/models-interactions/model-actors/actor.aai/pom.xml
+++ b/models-interactions/model-actors/actor.aai/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.aai</artifactId>
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
index d89d835..a4b3065 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
@@ -26,7 +26,6 @@
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
@@ -70,8 +69,6 @@
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
Map<String, Object> headers = makeHeaders();
- headers.put("Accept", MediaType.APPLICATION_JSON);
-
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
String path = getPath() + URI_SEP + URLEncoder.encode(getTargetEntity(), StandardCharsets.UTF_8);
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
index fe11798..add9c64 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
@@ -24,7 +24,6 @@
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
@@ -65,9 +64,7 @@
@Override
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
- Map<String, Object> headers = makeHeaders();
-
- headers.put("Accept", MediaType.APPLICATION_JSON);
+ final Map<String, Object> headers = makeHeaders();
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
index 14edc3a..c44e9d8 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
+import javax.ws.rs.core.MediaType;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
/**
@@ -44,6 +45,7 @@
headers.put("X-FromAppId", "POLICY");
headers.put("X-TransactionId", params.getRequestId().toString());
+ headers.put("Accept", MediaType.APPLICATION_JSON);
return headers;
}
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
index 1f481ae..9479d06 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
@@ -70,5 +70,6 @@
protected void verifyHeaders(Map<String, Object> headers) {
assertEquals("POLICY", headers.get("X-FromAppId").toString());
assertEquals(params.getRequestId().toString(), headers.get("X-TransactionId"));
+ assertEquals("application/json", headers.get("Accept").toString());
}
}
diff --git a/models-interactions/model-actors/actor.appc/pom.xml b/models-interactions/model-actors/actor.appc/pom.xml
index 765f764..74b208e 100644
--- a/models-interactions/model-actors/actor.appc/pom.xml
+++ b/models-interactions/model-actors/actor.appc/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.appc</artifactId>
diff --git a/models-interactions/model-actors/actor.appclcm/pom.xml b/models-interactions/model-actors/actor.appclcm/pom.xml
index e4c48cf..1450fb6 100644
--- a/models-interactions/model-actors/actor.appclcm/pom.xml
+++ b/models-interactions/model-actors/actor.appclcm/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.appclcm</artifactId>
diff --git a/models-interactions/model-actors/actor.cds/pom.xml b/models-interactions/model-actors/actor.cds/pom.xml
index a01c32b..a467807 100644
--- a/models-interactions/model-actors/actor.cds/pom.xml
+++ b/models-interactions/model-actors/actor.cds/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.cds</artifactId>
<dependencies>
diff --git a/models-interactions/model-actors/actor.cds/src/test/resources/org/onap/policy/simulators/cds/my_artifact-subscribe.json b/models-interactions/model-actors/actor.cds/src/test/resources/org/onap/policy/simulators/cds/my_artifact-subscribe.json
new file mode 100644
index 0000000..307ee93
--- /dev/null
+++ b/models-interactions/model-actors/actor.cds/src/test/resources/org/onap/policy/simulators/cds/my_artifact-subscribe.json
@@ -0,0 +1,27 @@
+{
+ "commonHeader": {
+ "timestamp": "2020-03-20T14:00:25.217Z",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "flag": {
+ },
+ "originatorId": "sdnc"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "my_artifact",
+ "blueprintVersion": "1.0.0",
+ "actionName": "subscribe",
+ "mode": "sync"
+ },
+ "status": {
+ "code": 200,
+ "message": "success",
+ "eventType": "EVENT_COMPONENT_EXECUTED",
+ "timestamp": "2020-07-02T14:56:25.608Z"
+ },
+ "payload": {
+ "subscription-response": {
+ "status": "success"
+ }
+ }
+}
\ No newline at end of file
diff --git a/models-interactions/model-actors/actor.guard/pom.xml b/models-interactions/model-actors/actor.guard/pom.xml
index cf2b2ff..9c82ecc 100644
--- a/models-interactions/model-actors/actor.guard/pom.xml
+++ b/models-interactions/model-actors/actor.guard/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.guard</artifactId>
diff --git a/models-interactions/model-actors/actor.sdnc/pom.xml b/models-interactions/model-actors/actor.sdnc/pom.xml
index 37df2b7..9fa0102 100644
--- a/models-interactions/model-actors/actor.sdnc/pom.xml
+++ b/models-interactions/model-actors/actor.sdnc/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.sdnc</artifactId>
diff --git a/models-interactions/model-actors/actor.sdnr/pom.xml b/models-interactions/model-actors/actor.sdnr/pom.xml
index 813e113..9e0613e 100644
--- a/models-interactions/model-actors/actor.sdnr/pom.xml
+++ b/models-interactions/model-actors/actor.sdnr/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.sdnr</artifactId>
diff --git a/models-interactions/model-actors/actor.so/pom.xml b/models-interactions/model-actors/actor.so/pom.xml
index 78599f2..96a9510 100644
--- a/models-interactions/model-actors/actor.so/pom.xml
+++ b/models-interactions/model-actors/actor.so/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.so</artifactId>
diff --git a/models-interactions/model-actors/actor.test/pom.xml b/models-interactions/model-actors/actor.test/pom.xml
index 4c3b7d9..4c83822 100644
--- a/models-interactions/model-actors/actor.test/pom.xml
+++ b/models-interactions/model-actors/actor.test/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.test</artifactId>
diff --git a/models-interactions/model-actors/actor.vfc/pom.xml b/models-interactions/model-actors/actor.vfc/pom.xml
index d03ff5c..54a8fb8 100644
--- a/models-interactions/model-actors/actor.vfc/pom.xml
+++ b/models-interactions/model-actors/actor.vfc/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actor.vfc</artifactId>
diff --git a/models-interactions/model-actors/actorServiceProvider/pom.xml b/models-interactions/model-actors/actorServiceProvider/pom.xml
index 3c2ad0a..b2570f3 100644
--- a/models-interactions/model-actors/actorServiceProvider/pom.xml
+++ b/models-interactions/model-actors/actorServiceProvider/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>actorServiceProvider</artifactId>
diff --git a/models-interactions/model-actors/pom.xml b/models-interactions/model-actors/pom.xml
index 4e30c59..0d0679c 100644
--- a/models-interactions/model-actors/pom.xml
+++ b/models-interactions/model-actors/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models-interactions</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
diff --git a/models-interactions/model-impl/aai/pom.xml b/models-interactions/model-impl/aai/pom.xml
index 6a823be..c33dc54 100644
--- a/models-interactions/model-impl/aai/pom.xml
+++ b/models-interactions/model-impl/aai/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>aai</artifactId>
diff --git a/models-interactions/model-impl/appc/pom.xml b/models-interactions/model-impl/appc/pom.xml
index 51f131b..09c066c 100644
--- a/models-interactions/model-impl/appc/pom.xml
+++ b/models-interactions/model-impl/appc/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>appc</artifactId>
diff --git a/models-interactions/model-impl/appclcm/pom.xml b/models-interactions/model-impl/appclcm/pom.xml
index 6d438b9..60b9aee 100644
--- a/models-interactions/model-impl/appclcm/pom.xml
+++ b/models-interactions/model-impl/appclcm/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>appclcm</artifactId>
diff --git a/models-interactions/model-impl/cds/pom.xml b/models-interactions/model-impl/cds/pom.xml
index 347bad6..73ca43c 100644
--- a/models-interactions/model-impl/cds/pom.xml
+++ b/models-interactions/model-impl/cds/pom.xml
@@ -25,7 +25,7 @@
<parent>
<artifactId>model-impl</artifactId>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>cds</artifactId>
diff --git a/models-interactions/model-impl/events/pom.xml b/models-interactions/model-impl/events/pom.xml
index 89bfd84..e543d03 100644
--- a/models-interactions/model-impl/events/pom.xml
+++ b/models-interactions/model-impl/events/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>events</artifactId>
diff --git a/models-interactions/model-impl/guard/pom.xml b/models-interactions/model-impl/guard/pom.xml
index 19e1c67..6626c59 100644
--- a/models-interactions/model-impl/guard/pom.xml
+++ b/models-interactions/model-impl/guard/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>guard</artifactId>
diff --git a/models-interactions/model-impl/pom.xml b/models-interactions/model-impl/pom.xml
index 8ea0b77..dd068ee 100644
--- a/models-interactions/model-impl/pom.xml
+++ b/models-interactions/model-impl/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models-interactions</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
diff --git a/models-interactions/model-impl/rest/pom.xml b/models-interactions/model-impl/rest/pom.xml
index 72a081e..2c0d5ab 100644
--- a/models-interactions/model-impl/rest/pom.xml
+++ b/models-interactions/model-impl/rest/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>rest</artifactId>
diff --git a/models-interactions/model-impl/sdnc/pom.xml b/models-interactions/model-impl/sdnc/pom.xml
index 54b2b38..997d25f 100644
--- a/models-interactions/model-impl/sdnc/pom.xml
+++ b/models-interactions/model-impl/sdnc/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>sdnc</artifactId>
diff --git a/models-interactions/model-impl/sdnr/pom.xml b/models-interactions/model-impl/sdnr/pom.xml
index 3114725..c2e4a02 100644
--- a/models-interactions/model-impl/sdnr/pom.xml
+++ b/models-interactions/model-impl/sdnr/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>sdnr</artifactId>
diff --git a/models-interactions/model-impl/so/pom.xml b/models-interactions/model-impl/so/pom.xml
index 9a9a8ab..a6f8bc3 100644
--- a/models-interactions/model-impl/so/pom.xml
+++ b/models-interactions/model-impl/so/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>so</artifactId>
diff --git a/models-interactions/model-impl/vfc/pom.xml b/models-interactions/model-impl/vfc/pom.xml
index 014a646..f9137d3 100644
--- a/models-interactions/model-impl/vfc/pom.xml
+++ b/models-interactions/model-impl/vfc/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>model-impl</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>vfc</artifactId>
diff --git a/models-interactions/model-simulators/pom.xml b/models-interactions/model-simulators/pom.xml
index e496fc0..2a1fe2d 100644
--- a/models-interactions/model-simulators/pom.xml
+++ b/models-interactions/model-simulators/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models-interactions</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.models.policy-models-interactions</groupId>
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
index 3418780..222bd7f 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
@@ -29,18 +29,26 @@
import io.grpc.stub.StreamObserver;
import java.io.IOException;
import java.net.InetSocketAddress;
+import java.time.Instant;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput.Builder;
import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class CdsSimulator {
+public class CdsSimulator implements Runnable {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CdsSimulator.class);
+
@Getter
private final int port;
@@ -77,16 +85,15 @@
@Override
public StreamObserver<ExecutionServiceInput> process(
- final StreamObserver<ExecutionServiceOutput> responseObserver) {
+ final StreamObserver<ExecutionServiceOutput> responseObserver) {
return new StreamObserver<ExecutionServiceInput>() {
@Override
public void onNext(final ExecutionServiceInput executionServiceInput) {
+ LOGGER.info("Received request input to CDS: {}", executionServiceInput);
try {
- String responseString = getResponseString(executionServiceInput, countOfSuccesfulEvents);
- Builder builder = ExecutionServiceOutput.newBuilder();
- JsonFormat.parser().ignoringUnknownFields().merge(responseString, builder);
+ Builder builder = getResponse(executionServiceInput, countOfSuccesfulEvents);
TimeUnit.MILLISECONDS.sleep(requestedResponseDelayMs);
responseObserver.onNext(builder.build());
} catch (InvalidProtocolBufferException e) {
@@ -111,13 +118,25 @@
};
server = NettyServerBuilder.forAddress(new InetSocketAddress(host, port)).addService(testCdsBlueprintServerImpl)
- .build();
+ .build();
}
+ /**
+ * Start the server.
+ *
+ * @throws IOException IO exception.
+ */
public void start() throws IOException {
server.start();
+ // The grpc server uses daemon threads by default. Hence the application will exit as soon the main thread
+ // completes. So, wrap the server in a non-daemon thread and call awaitTermination to keep the thread alive
+ // until the server is terminated.
+ new Thread(this).start();
}
+ /**
+ * Stop the server.
+ */
public void stop() {
server.shutdown();
}
@@ -127,9 +146,11 @@
*
* @param executionServiceInput service input
* @param countOfSuccesfulEvents number of successive successful events
- * @return responseString
+ * @return builder for ExecutionServiceOutput response
+ * @throws InvalidProtocolBufferException when response string cannot be converted
*/
- public String getResponseString(ExecutionServiceInput executionServiceInput, int countOfSuccesfulEvents) {
+ public Builder getResponse(ExecutionServiceInput executionServiceInput, int countOfSuccesfulEvents)
+ throws InvalidProtocolBufferException {
String resourceName = "DefaultResponseEvent";
if (!StringUtils.isBlank(executionServiceInput.getActionIdentifiers().getActionName())) {
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
@@ -141,11 +162,33 @@
} else {
resourceName = resourceName + ".json";
}
+ LOGGER.info("Fetching response from {}", resourceName);
String responseString = ResourceUtils.getResourceAsString(resourceLocation + resourceName);
- if (responseString == null) {
- responseString = ResourceUtils.getResourceAsString(resourceLocation
- + "DefaultResponseEvent.json");
+ Builder builder = ExecutionServiceOutput.newBuilder();
+ if (null == responseString) {
+ LOGGER.info("Expected response file {} not found in {}", resourceName, resourceLocation);
+ ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+ builder.setCommonHeader(executionServiceInput.getCommonHeader());
+ builder.setActionIdentifiers(actionIdentifiers);
+ builder.setPayload(executionServiceInput.getPayload());
+ builder.setStatus(Status.newBuilder().setCode(500).setMessage("failure")
+ .setErrorMessage("failed to get get cba file name(" + actionIdentifiers.getBlueprintName()
+ + "), version(" + actionIdentifiers.getBlueprintVersion() + ") from db : file check failed.")
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE).setTimestamp(Instant.now().toString()));
+ } else {
+ LOGGER.debug("Returning response from CDS Simulator: {}", responseString);
+ JsonFormat.parser().ignoringUnknownFields().merge(responseString, builder);
}
- return responseString;
+ return builder;
+ }
+
+ @Override
+ public void run() {
+ try {
+ server.awaitTermination();
+ } catch (InterruptedException e) {
+ LOGGER.info("gRPC server is terminated");
+ Thread.currentThread().interrupt();
+ }
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
index efc4036..d9fb52b 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
@@ -52,7 +52,7 @@
private static final String CANNOT_PROCESS_PARAMETERS = "cannot parse parameters ";
private static final String CANNOT_CONNECT = "cannot connect to port ";
- private static final String LOCALHOST = "localhost";
+ public static final String LOCALHOST = "localhost";
private Util() {
// Prevent instantiation of this class
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java
index fea03e3..07ec0dc 100644
--- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java
+++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java
@@ -24,6 +24,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.protobuf.util.JsonFormat;
import io.grpc.ManagedChannel;
import io.grpc.internal.DnsNameResolverProvider;
import io.grpc.internal.PickFirstLoadBalancerProvider;
@@ -42,9 +43,11 @@
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput.Builder;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.common.utils.resources.ResourceUtils;
public class CdsSimulatorTest {
@@ -52,9 +55,15 @@
private CdsSimulator sim;
+ /**
+ * Starts the simulator, allocating a unique port for each test so we don't have to
+ * wait for the prior server to shut down.
+ */
@Before
public void setUp() throws Exception {
- sim = Util.buildCdsSim();
+ int port = NetworkUtil.allocPort();
+ sim = new CdsSimulator(Util.LOCALHOST, port);
+ sim.start();
}
@After
@@ -65,8 +74,10 @@
@Test
public void test() throws Exception {
String reqstr = IOUtils.toString(getClass().getResource("cds/cds.request.json"), StandardCharsets.UTF_8);
- ExecutionServiceInput request = coder.decode(reqstr, ExecutionServiceInput.class);
- ManagedChannel channel = NettyChannelBuilder.forAddress("localhost", sim.getPort())
+ Builder builder = ExecutionServiceInput.newBuilder();
+ JsonFormat.parser().ignoringUnknownFields().merge(reqstr, builder);
+ ExecutionServiceInput request = builder.build();
+ ManagedChannel channel = NettyChannelBuilder.forAddress(Util.LOCALHOST, sim.getPort())
.nameResolverFactory(new DnsNameResolverProvider())
.loadBalancerFactory(new PickFirstLoadBalancerProvider()).usePlaintext().build();
@@ -117,13 +128,16 @@
}
@Test
- public void testGetResponseString() throws IOException, CoderException, ParseException {
- CdsSimulator cdsSimulator = new CdsSimulator("localhost", sim.getPort());
+ public void testGetResponse() throws IOException, CoderException, ParseException {
+ CdsSimulator cdsSimulator = new CdsSimulator(Util.LOCALHOST, sim.getPort());
String reqstr = ResourceUtils.getResourceAsString(
"org/onap/policy/simulators/cds/cds.request.json");
String responseqstr = ResourceUtils.getResourceAsString(
"org/onap/policy/simulators/cds/pm_control-create-subscription.json");
ExecutionServiceInput request = coder.decode(reqstr, ExecutionServiceInput.class);
- assertEquals(responseqstr, cdsSimulator.getResponseString(request, 0));
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput.Builder esoBuilder =
+ ExecutionServiceOutput.newBuilder();
+ JsonFormat.parser().ignoringUnknownFields().merge(responseqstr, esoBuilder);
+ assertEquals(esoBuilder.toString(), cdsSimulator.getResponse(request, 0).toString());
}
}
diff --git a/models-interactions/pom.xml b/models-interactions/pom.xml
index d0e7f44..e0f5ab5 100644
--- a/models-interactions/pom.xml
+++ b/models-interactions/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-interactions</artifactId>
<packaging>pom</packaging>
diff --git a/models-pap/pom.xml b/models-pap/pom.xml
index c782753..8abed9a 100644
--- a/models-pap/pom.xml
+++ b/models-pap/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-pap</artifactId>
diff --git a/models-pdp/pom.xml b/models-pdp/pom.xml
index fdb5022..8190476 100644
--- a/models-pdp/pom.xml
+++ b/models-pdp/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-pdp</artifactId>
diff --git a/models-provider/pom.xml b/models-provider/pom.xml
index 362552c..2cb4091 100644
--- a/models-provider/pom.xml
+++ b/models-provider/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-provider</artifactId>
diff --git a/models-sim/models-sim-dmaap/pom.xml b/models-sim/models-sim-dmaap/pom.xml
index bb71eef..487cec7 100644
--- a/models-sim/models-sim-dmaap/pom.xml
+++ b/models-sim/models-sim-dmaap/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models.sim</groupId>
<artifactId>policy-models-sim</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-sim-dmaap</artifactId>
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterGroup.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterGroup.java
index 11da575..9719ae9 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterGroup.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterGroup.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/models-sim/packages/models-simulator-docker/pom.xml b/models-sim/packages/models-simulator-docker/pom.xml
index c6f4717..b9c181f 100644
--- a/models-sim/packages/models-simulator-docker/pom.xml
+++ b/models-sim/packages/models-simulator-docker/pom.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2020 Bell Canada.
+ Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -23,8 +24,8 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.models.sim</groupId>
- <artifactId>policy-models-sim</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <artifactId>models-sim-packages</artifactId>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>models-simulator-docker</artifactId>
@@ -43,6 +44,8 @@
<docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
<docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
+ <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
+ <sonar.skip>true</sonar.skip>
</properties>
<build>
@@ -166,7 +169,7 @@
<dependency>
<groupId>org.onap.policy.models.sim</groupId>
<artifactId>models-simulator-tarball</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>${project.version}</version>
<classifier>tarball</classifier>
<type>tar.gz</type>
</dependency>
diff --git a/models-sim/packages/models-simulator-tarball/pom.xml b/models-sim/packages/models-simulator-tarball/pom.xml
index 9fb1fb5..c8c2088 100644
--- a/models-sim/packages/models-simulator-tarball/pom.xml
+++ b/models-sim/packages/models-simulator-tarball/pom.xml
@@ -3,6 +3,7 @@
ONAP
================================================================================
Copyright (C) 2020 Bell Canada.
+ Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,8 +27,8 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.models.sim</groupId>
- <artifactId>policy-models-sim</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <artifactId>models-sim-packages</artifactId>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>models-simulator-tarball</artifactId>
@@ -35,11 +36,16 @@
<name>${project.artifactId}</name>
<description>A module that runs all "simulators", including DMaaP.</description>
+ <properties>
+ <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
+ <sonar.skip>true</sonar.skip>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.onap.policy.models.sim</groupId>
<artifactId>policy-models-simulators</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
</dependencies>
diff --git a/models-sim/packages/models-simulator-tarball/src/main/assembly.xml b/models-sim/packages/models-simulator-tarball/src/main/assembly.xml
index 9a2fd65..47395e1 100644
--- a/models-sim/packages/models-simulator-tarball/src/main/assembly.xml
+++ b/models-sim/packages/models-simulator-tarball/src/main/assembly.xml
@@ -46,5 +46,14 @@
<outputDirectory>etc${file.separator}ssl</outputDirectory>
<lineEnding>keep</lineEnding>
</fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/resources/etc
+ </directory>
+ <includes>
+ <include>*.xml</include>
+ </includes>
+ <outputDirectory>etc</outputDirectory>
+ <lineEnding>unix</lineEnding>
+ </fileSet>
</fileSets>
</assembly>
diff --git a/models-sim/packages/models-simulator-tarball/src/main/resources/etc/logback.xml b/models-sim/packages/models-simulator-tarball/src/main/resources/etc/logback.xml
new file mode 100644
index 0000000..131b0fe
--- /dev/null
+++ b/models-sim/packages/models-simulator-tarball/src/main/resources/etc/logback.xml
@@ -0,0 +1,42 @@
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2020 AT&T Intellectual Property.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<configuration scan="true" scanPeriod="30 seconds" debug="false">
+
+ <!--
+ This is only used for testing and only a snapshot docker image is generated,
+ thus it is not necessary for the messages to following the ONAP standard.
+ Therefore, keeping it short so it's easier to wade through the output.
+
+ Also sending all output to stdout instead of to a log file; it can be viewed
+ via "docker logs" or captured by kubernetes.
+ -->
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d %level %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration>
diff --git a/models-sim/packages/pom.xml b/models-sim/packages/pom.xml
index 1492255..ceabde6 100644
--- a/models-sim/packages/pom.xml
+++ b/models-sim/packages/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models.sim</groupId>
<artifactId>policy-models-sim</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>models-sim-packages</artifactId>
diff --git a/models-sim/policy-models-sim-pdp/pom.xml b/models-sim/policy-models-sim-pdp/pom.xml
index 18d6160..22425df 100644
--- a/models-sim/policy-models-sim-pdp/pom.xml
+++ b/models-sim/policy-models-sim-pdp/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.policy.models.sim</groupId>
<artifactId>policy-models-sim</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-sim-pdp</artifactId>
<name>policy-models-sim-pdp</name>
diff --git a/models-sim/policy-models-simulators/pom.xml b/models-sim/policy-models-simulators/pom.xml
index 9cd19e4..c129783 100644
--- a/models-sim/policy-models-simulators/pom.xml
+++ b/models-sim/policy-models-simulators/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.sim</groupId>
<artifactId>policy-models-sim</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-simulators</artifactId>
diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java
index a0fafbc..f82423c 100644
--- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java
+++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java
@@ -83,18 +83,22 @@
}
DmaapSimParameterGroup dmaapProv = params.getDmaapProvider();
- String dmaapName = dmaapProv.getName();
- String provName = dmaapName.replace("simulator", "provider");
+ String dmaapName = (dmaapProv != null ? dmaapProv.getName() : null);
// dmaap provider
- AtomicReference<DmaapSimProvider> provRef = new AtomicReference<>();
- addAction(provName, () -> provRef.set(buildDmaapProvider(dmaapProv)), () -> provRef.get().shutdown());
+ if (dmaapProv != null) {
+ String provName = dmaapName.replace("simulator", "provider");
+ AtomicReference<DmaapSimProvider> provRef = new AtomicReference<>();
+ addAction(provName, () -> provRef.set(buildDmaapProvider(dmaapProv)), () -> provRef.get().shutdown());
+ }
CdsServerParameters cdsServer = params.getGrpcServer();
// Cds Simulator
- AtomicReference<CdsSimulator> cdsSim = new AtomicReference<>();
- addAction(cdsServer.getName(), () -> cdsSim.set(buildCdsSimulator(cdsServer)), () -> cdsSim.get().stop());
+ if (cdsServer != null) {
+ AtomicReference<CdsSimulator> cdsSim = new AtomicReference<>();
+ addAction(cdsServer.getName(), () -> cdsSim.set(buildCdsSimulator(cdsServer)), () -> cdsSim.get().stop());
+ }
// REST server simulators
// @formatter:off
@@ -276,7 +280,7 @@
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false");
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true");
- if (dmaapName.equals(params.getName())) {
+ if (dmaapName != null && dmaapName.equals(params.getName())) {
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
String.join(",", CambriaMessageBodyHandler.class.getName(),
GsonMessageBodyHandler.class.getName(),
diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java
index 788829f..4b60d5e 100644
--- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java
+++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java
@@ -27,14 +27,14 @@
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.BeanValidator;
-import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.common.parameters.ObjectValidationResult;
+import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
/**
* Simulator parameters.
*/
@Getter
-@NotNull
public class SimulatorParameters {
/**
@@ -77,6 +77,24 @@
public BeanValidationResult validate(String containerName) {
BeanValidationResult result = new BeanValidator().validateTop(containerName, this);
+ if (dmaapProvider != null) {
+ // do not want full validation of the provider, so validate the relevant
+ // fields ourselves
+ BeanValidationResult subResult = new BeanValidationResult("dmaapProvider", dmaapProvider);
+ subResult.validateNotNull("name", dmaapProvider.getName());
+ if (dmaapProvider.getTopicSweepSec() < 1) {
+ ObjectValidationResult fieldResult =
+ new ObjectValidationResult("topicSweepSec", dmaapProvider.getTopicSweepSec(),
+ ValidationStatus.INVALID, "is below the minimum value: 1");
+ subResult.addResult(fieldResult);
+ }
+ result.addResult(subResult);
+ }
+
+ if (grpcServer != null) {
+ result.addResult(grpcServer.validate());
+ }
+
result.validateList("restServers", restServers, params -> params.validate("restServers"));
result.validateList("topicServers", topicServers, params -> params.validate("topicServers"));
diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java
index e9e8cbd..f5598e2 100644
--- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java
+++ b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java
@@ -109,7 +109,7 @@
@Test
public void testConstructor() throws Exception {
- assertThatIllegalArgumentException().isThrownBy(() -> new Main("invalidSimParameters.json"))
+ assertThatIllegalArgumentException().isThrownBy(() -> new Main("invalidDmaapProvider.json"))
.withMessage("invalid simulator parameters");
}
@@ -125,7 +125,7 @@
Main.main(new String[] {PARAMETER_FILE});
// don't need to wait long, because buildXxx() does the wait for us
- for (int port = 6666; port <= 6670; ++port) {
+ for (int port : new int[] {6666, 6667, 6668, 6669, 6670, 6680}) {
assertTrue("simulator on port " + port, NetworkUtil.isTcpPortOpen(HOST, port, 1, 100));
}
@@ -133,6 +133,13 @@
checkAai();
}
+ @Test
+ public void testMainMinimalParameters() {
+ Main.main(new String[] {"minParameters.json"});
+ assertNotNull(Main.getInstance());
+ assertTrue(Main.getInstance().isAlive());
+ }
+
private void checkAai() throws HttpClientConfigException {
BusTopicParams params = BusTopicParams.builder().clientName("client").hostname(HOST).port(6666).useHttps(true)
.allowSelfSignedCerts(true).basePath("aai").build();
diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java
index 5294ca4..8094ca4 100644
--- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java
+++ b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.models.simulators;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -34,14 +35,51 @@
@Test
public void testValidate() throws CoderException {
- // some fields missing
- BeanValidationResult result = new SimulatorParameters().validate("InvalidParams");
- assertFalse(result.isValid());
- assertNotNull(result.getResult());
-
- // everything populated
SimulatorParameters params = new StandardCoder().decode(new File("src/test/resources/simParameters.json"),
SimulatorParameters.class);
assertNull(params.validate("ValidParams").getResult());
}
+
+ @Test
+ public void testValidateEmptyRestServer() throws CoderException {
+ SimulatorParameters params = new StandardCoder()
+ .decode(new File("src/test/resources/emptyRestServer.json"), SimulatorParameters.class);
+ assertNull(params.validate("ValidParams").getResult());
+ }
+
+ @Test
+ public void testValidateInvalidDmaapProvider() throws CoderException {
+ SimulatorParameters params = new StandardCoder()
+ .decode(new File("src/test/resources/invalidDmaapProvider.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidDmaapParams");
+ assertFalse(result.isValid());
+ assertNotNull(result.getResult());
+ }
+
+ @Test
+ public void testValidateInvalidDmaapName() throws CoderException {
+ SimulatorParameters params = new StandardCoder().decode(
+ new File("src/test/resources/invalidDmaapName.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidDmaapParams");
+ assertFalse(result.isValid());
+ assertThat(result.getResult()).contains("item \"name\" value \"null\"");
+ }
+
+ @Test
+ public void testValidateInvalidTopicSweep() throws CoderException {
+ SimulatorParameters params = new StandardCoder().decode(
+ new File("src/test/resources/invalidTopicSweep.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidDmaapParams");
+ assertFalse(result.isValid());
+ assertThat(result.getResult()).contains("topicSweepSec");
+ }
+
+ @Test
+ public void testValidateInvalidGrpcServer() throws CoderException {
+ SimulatorParameters params = new StandardCoder()
+ .decode(new File("src/test/resources/invalidGrpcServer.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidGrpcParams");
+ assertFalse(result.isValid());
+ assertNotNull(result.getResult());
+ }
}
diff --git a/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json b/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json
new file mode 100644
index 0000000..4a86253
--- /dev/null
+++ b/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json
@@ -0,0 +1,11 @@
+{
+ "dmaapProvider": {
+ "name": "DMaaP simulator",
+ "topicSweepSec": 300,
+ "restServerParameters": {}
+ },
+ "restServers": [],
+ "topicSinks": [],
+ "topicSources": [],
+ "topicServers": []
+}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json
new file mode 100644
index 0000000..889c4c8
--- /dev/null
+++ b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json
@@ -0,0 +1,10 @@
+{
+ "dmaapProvider": {
+ "name": null,
+ "topicSweepSec":300
+ },
+ "restServers": [],
+ "topicSinks": [],
+ "topicSources": [],
+ "topicServers": []
+}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json
new file mode 100644
index 0000000..ff67901
--- /dev/null
+++ b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json
@@ -0,0 +1,7 @@
+{
+ "dmaapProvider": {},
+ "restServers": [],
+ "topicSinks": [],
+ "topicSources": [],
+ "topicServers": []
+}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidGrpcServer.json b/models-sim/policy-models-simulators/src/test/resources/invalidGrpcServer.json
new file mode 100644
index 0000000..86e4253
--- /dev/null
+++ b/models-sim/policy-models-simulators/src/test/resources/invalidGrpcServer.json
@@ -0,0 +1,7 @@
+{
+ "grpcServer": {},
+ "restServers": [],
+ "topicSinks": [],
+ "topicSources": [],
+ "topicServers": []
+}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidSimParameters.json b/models-sim/policy-models-simulators/src/test/resources/invalidSimParameters.json
deleted file mode 100644
index 2c63c08..0000000
--- a/models-sim/policy-models-simulators/src/test/resources/invalidSimParameters.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json b/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json
new file mode 100644
index 0000000..11a37d5
--- /dev/null
+++ b/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json
@@ -0,0 +1,10 @@
+{
+ "dmaapProvider": {
+ "name": "DMaaP simulator",
+ "topicSweepSec":0
+ },
+ "restServers": [],
+ "topicSinks": [],
+ "topicSources": [],
+ "topicServers": []
+}
diff --git a/models-sim/policy-models-simulators/src/test/resources/minParameters.json b/models-sim/policy-models-simulators/src/test/resources/minParameters.json
new file mode 100644
index 0000000..c7ea498
--- /dev/null
+++ b/models-sim/policy-models-simulators/src/test/resources/minParameters.json
@@ -0,0 +1,14 @@
+{
+ "restServers": [
+ {
+ "name": "A&AI simulator",
+ "providerClass": "org.onap.policy.simulators.AaiSimulatorJaxRs",
+ "host": "localhost",
+ "port": 6766,
+ "https": true
+ }
+ ],
+ "topicSinks": [],
+ "topicSources": [],
+ "topicServers": []
+}
diff --git a/models-sim/policy-models-simulators/src/test/resources/simParameters.json b/models-sim/policy-models-simulators/src/test/resources/simParameters.json
index 1d1c0aa..df8de6f 100644
--- a/models-sim/policy-models-simulators/src/test/resources/simParameters.json
+++ b/models-sim/policy-models-simulators/src/test/resources/simParameters.json
@@ -1,10 +1,7 @@
{
"dmaapProvider": {
"name": "DMaaP simulator",
- "topicSweepSec": 300,
- "restServerParameters": {
-
- }
+ "topicSweepSec": 300
},
"restServers": [
{
diff --git a/models-sim/pom.xml b/models-sim/pom.xml
index ce9cfae..40eb2a1 100644
--- a/models-sim/pom.xml
+++ b/models-sim/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.models.sim</groupId>
diff --git a/models-tosca/pom.xml b/models-tosca/pom.xml
index 9c79ee0..5369120 100644
--- a/models-tosca/pom.xml
+++ b/models-tosca/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<artifactId>policy-models-tosca</artifactId>
diff --git a/pom.xml b/pom.xml
index 5b518f1..b7e9a91 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models</artifactId>
- <version>2.3.2-SNAPSHOT</version>
+ <version>2.3.5-SNAPSHOT</version>
<packaging>pom</packaging>
<name>policy-models</name>
diff --git a/releases/2.3.2.yaml b/releases/2.3.2.yaml
new file mode 100644
index 0000000..775ce71
--- /dev/null
+++ b/releases/2.3.2.yaml
@@ -0,0 +1,4 @@
+distribution_type: 'maven'
+version: '2.3.2'
+project: 'policy-models'
+log_dir: 'policy-models-maven-stage-master/493/'
diff --git a/releases/2.3.3.yaml b/releases/2.3.3.yaml
new file mode 100644
index 0000000..bf62bba
--- /dev/null
+++ b/releases/2.3.3.yaml
@@ -0,0 +1,4 @@
+distribution_type: 'maven'
+version: '2.3.3'
+project: 'policy-models'
+log_dir: 'policy-models-maven-stage-master/495/'
diff --git a/releases/2.3.4.yaml b/releases/2.3.4.yaml
new file mode 100644
index 0000000..164a967
--- /dev/null
+++ b/releases/2.3.4.yaml
@@ -0,0 +1,4 @@
+distribution_type: 'maven'
+version: '2.3.4'
+project: 'policy-models'
+log_dir: 'policy-models-maven-stage-master/496/'
diff --git a/version.properties b/version.properties
index 16dbea1..c0e0aca 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=2
minor=3
-patch=2
+patch=5
base_version=${major}.${minor}.${patch}