aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java2
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/PdpStatusParameters.java3
-rw-r--r--services/services-onappf/src/main/resources/config/OnapPfConfig.json1
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java2
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java28
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParameters.json1
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json1
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json1
-rw-r--r--services/services-onappf/src/test/resources/TestConfigParameters.json1
9 files changed, 36 insertions, 4 deletions
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java
index b72ef805f..b1f38d688 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java
@@ -22,7 +22,6 @@ package org.onap.policy.apex.services.onappf.handler;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.policy.apex.services.onappf.ApexStarterConstants;
import org.onap.policy.apex.services.onappf.parameters.PdpStatusParameters;
import org.onap.policy.apex.services.onappf.parameters.ToscaPolicyTypeIdentifierParameters;
@@ -54,6 +53,7 @@ public class PdpMessageHandler {
public PdpStatus createPdpStatusFromParameters(final String instanceId,
final PdpStatusParameters pdpStatusParameters) {
final PdpStatus pdpStatus = new PdpStatus();
+ pdpStatus.setPdpGroup(pdpStatusParameters.getPdpGroup());
pdpStatus.setPdpType(pdpStatusParameters.getPdpType());
pdpStatus.setState(PdpState.PASSIVE);
pdpStatus.setHealthy(PdpHealthStatus.HEALTHY);
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/PdpStatusParameters.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/PdpStatusParameters.java
index 962a98e4c..d4c61375e 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/PdpStatusParameters.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/PdpStatusParameters.java
@@ -21,9 +21,7 @@
package org.onap.policy.apex.services.onappf.parameters;
import java.util.List;
-
import lombok.Getter;
-
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.Min;
import org.onap.policy.common.parameters.annotations.NotBlank;
@@ -45,6 +43,7 @@ public class PdpStatusParameters extends ParameterGroupImpl {
private String pdpType;
private String description;
private List<ToscaPolicyTypeIdentifierParameters> supportedPolicyTypes;
+ private String pdpGroup;
public PdpStatusParameters() {
super(PdpStatusParameters.class.getSimpleName());
diff --git a/services/services-onappf/src/main/resources/config/OnapPfConfig.json b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
index 95e28a325..76595a6e2 100644
--- a/services/services-onappf/src/main/resources/config/OnapPfConfig.json
+++ b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
@@ -8,6 +8,7 @@
"https": true
},
"pdpStatusParameters":{
+ "pdpGroup": "defaultGroup",
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
index c8d61f539..b26a1f1a2 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
@@ -42,6 +42,7 @@ public class CommonTestData {
public static final String PDP_NAME = "apex-pdp";
public static final String VERSION = "0.0.1";
public static final String PDP_TYPE = "apex";
+ public static final String PDP_GROUP = "defaultGroup";
public static final String DESCRIPTION = "Pdp status for HealthCheck";
public static final String POLICY_NAME = "onap.controllloop.operational.apex.BBS";
public static final String POLICY_VERSION = "0.0.1";
@@ -145,6 +146,7 @@ public class CommonTestData {
public Map<String, Object> getPdpStatusParametersMap(final boolean isEmpty) {
final Map<String, Object> map = new TreeMap<>();
if (!isEmpty) {
+ map.put("pdpGroup", PDP_GROUP);
map.put("timeIntervalMs", TIME_INTERVAL);
map.put("pdpName", PDP_NAME);
map.put("version", VERSION);
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java
index e8a3f7ee0..95cf35093 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestPdpStatusParameters.java
@@ -21,11 +21,12 @@
package org.onap.policy.apex.services.onappf.parameters;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import java.util.Map;
import org.junit.Test;
-import org.onap.policy.apex.services.onappf.parameters.PdpStatusParameters;
import org.onap.policy.common.parameters.GroupValidationResult;
/**
@@ -46,6 +47,7 @@ public class TestPdpStatusParameters {
assertEquals(CommonTestData.PDP_TYPE, pdpStatusParameters.getPdpType());
assertEquals(CommonTestData.DESCRIPTION, pdpStatusParameters.getDescription());
assertEquals(CommonTestData.SUPPORTED_POLICY_TYPES, pdpStatusParameters.getSupportedPolicyTypes());
+ assertEquals(CommonTestData.PDP_GROUP, pdpStatusParameters.getPdpGroup());
}
@Test
@@ -56,4 +58,28 @@ public class TestPdpStatusParameters {
assertNull(result.getResult());
assertTrue(result.isValid());
}
+
+ @Test
+ public void testPdpStatusParameters_nullPdpGroup() throws Exception {
+ Map<String, Object> pdpStatusParametersMap = testData.getPdpStatusParametersMap(false);
+ pdpStatusParametersMap.remove("pdpGroup");
+ final PdpStatusParameters pdpStatusParameters =
+ testData.toObject(pdpStatusParametersMap, PdpStatusParameters.class);
+ final GroupValidationResult validationResult = pdpStatusParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"pdpGroup\" type \"java.lang.String\" value \"null\" INVALID"));
+ }
+
+ @Test
+ public void testPdpStatusParameters_emptyPdpGroup() throws Exception {
+ Map<String, Object> pdpStatusParametersMap = testData.getPdpStatusParametersMap(false);
+ pdpStatusParametersMap.put("pdpGroup", "");
+ final PdpStatusParameters pdpStatusParameters =
+ testData.toObject(pdpStatusParametersMap, PdpStatusParameters.class);
+ final GroupValidationResult validationResult = pdpStatusParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"pdpGroup\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string"));
+ }
}
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json b/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
index 202368589..4e58200a4 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
@@ -8,6 +8,7 @@
"https": true
},
"pdpStatusParameters":{
+ "pdpGroup": "defaultGroup",
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json b/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json
index bce20da9d..061237ff0 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json
@@ -8,6 +8,7 @@
"https": true
},
"pdpStatusParameters":{
+ "pdpGroup": "defaultGroup",
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json b/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
index c26a0a654..67e5bcb36 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
@@ -8,6 +8,7 @@
"https": true
},
"pdpStatusParameters":{
+ "pdpGroup": "defaultGroup",
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
diff --git a/services/services-onappf/src/test/resources/TestConfigParameters.json b/services/services-onappf/src/test/resources/TestConfigParameters.json
index 202368589..4e58200a4 100644
--- a/services/services-onappf/src/test/resources/TestConfigParameters.json
+++ b/services/services-onappf/src/test/resources/TestConfigParameters.json
@@ -8,6 +8,7 @@
"https": true
},
"pdpStatusParameters":{
+ "pdpGroup": "defaultGroup",
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",