summaryrefslogtreecommitdiffstats
path: root/controlloop/common/actors/actor.so/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-09-21 16:55:04 -0400
committerJim Hahn <jrh3@att.com>2018-09-21 17:30:59 -0400
commit3c52de0725c942fe1f2fdeb05c8960645bc66f01 (patch)
tree929243eef3e87f0397b02d211262eff31492a35f /controlloop/common/actors/actor.so/src/main
parentd85e766c5538de762820132ac723d928f5a9bf89 (diff)
more sonar issues in drools-applications
Modified SO code to not return null lists for various buildXxxParam methods. Fixed commit message. Added additional junit coverage to SO code. Added additional junit coverage to SO code - cover more error cases. Extracted another constant. Change-Id: I65a27f2a1af1cfd8dd98bddab9ca1e862a3fa6fb Issue-ID: POLICY-1129 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/actors/actor.so/src/main')
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java31
1 files changed, 18 insertions, 13 deletions
diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
index 8775e68a6..7c0214bfb 100644
--- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
@@ -272,10 +272,10 @@ public class SOActorServiceProvider implements Actor {
request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
// Request Parameters
- request.getRequestDetails().setRequestParameters(buildRequestParameters(policy));
+ buildRequestParameters(policy, request.getRequestDetails());
// Configuration Parameters
- request.getRequestDetails().setConfigurationParameters(buildConfigurationParameters(policy));
+ buildConfigurationParameters(policy, request.getRequestDetails());
// Save the instance IDs for the VNF and service to static fields
// vfModuleId is not required for the create vf-module
preserveInstanceIds(vnfItem.getGenericVnf().getVnfId(), vnfServiceItem.getServiceInstance()
@@ -400,39 +400,44 @@ public class SOActorServiceProvider implements Actor {
* Builds the request parameters from the policy payload.
*
* @param policy the policy
- * @return the request parameters, or {@code null} if the payload is {@code null}
+ * @param request request into which to stick the request parameters
*/
- private SORequestParameters buildRequestParameters(Policy policy) {
+ private void buildRequestParameters(Policy policy, SORequestDetails request) {
+ // assume null until proven otherwise
+ request.setRequestParameters(null);
+
if (policy.getPayload() == null) {
- return null;
+ return;
}
String json = policy.getPayload().get(REQ_PARAM_NM);
if (json == null) {
- return null;
+ return;
}
- return Serialization.gsonPretty.fromJson(json, SORequestParameters.class);
+ request.setRequestParameters(Serialization.gsonPretty.fromJson(json, SORequestParameters.class));
}
/**
* Builds the configuration parameters from the policy payload.
*
* @param policy the policy
- * @return the configuration parameters, or {@code null} if the payload is
- * {@code null}
+ * @param request request into which to stick the configuration parameters
*/
- private List<Map<String, String>> buildConfigurationParameters(Policy policy) {
+ private void buildConfigurationParameters(Policy policy, SORequestDetails request) {
+ // assume null until proven otherwise
+ request.setConfigurationParameters(null);
+
if (policy.getPayload() == null) {
- return null;
+ return;
}
String json = policy.getPayload().get(CONFIG_PARAM_NM);
if (json == null) {
- return null;
+ return;
}
- return Serialization.gsonPretty.fromJson(json, CONFIG_TYPE);
+ request.setConfigurationParameters(Serialization.gsonPretty.fromJson(json, CONFIG_TYPE));
}
/**