diff options
author | Liam Fallon <liam.fallon@ericsson.com> | 2018-01-16 18:42:01 +0000 |
---|---|---|
committer | Liam Fallon <liam.fallon@ericsson.com> | 2018-01-16 18:47:17 +0000 |
commit | 59d71c593d295b2bd48a9971d89635f95759a0a2 (patch) | |
tree | 8cbdbd5180979b0c3aeb19739716462983bcb1cc /controlloop/common/eventmanager/src | |
parent | 2b9b989f99700ebc11f77d8da2df4538fe7105d2 (diff) |
Fix Sonar Technical Debt, Unit Test for APPC POJOs
Mainly making fields private, fixing field and methods to follow Java guidelines, and adding getter and setter methods. Unit test added for all classes in org.onap.policy.appc
Change-Id: If3db740bc146a09f8f7387f02c12b048ad00b201
Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Issue-ID: POLICY-455
Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Diffstat (limited to 'controlloop/common/eventmanager/src')
2 files changed, 7 insertions, 8 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index 5084d4cbc..0ce3bc5c3 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -47,7 +47,6 @@ import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.guard.Util; -import org.onap.policy.so.SOResponse; import org.onap.policy.so.SOResponseWrapper; import org.onap.policy.vfc.VFCResponse; import org.slf4j.Logger; @@ -324,7 +323,7 @@ public class ControlLoopOperationManager implements Serializable { // Integer operationAttempt = null; try { - operationAttempt = Integer.parseInt(appcResponse.CommonHeader.SubRequestID); + operationAttempt = Integer.parseInt(appcResponse.getCommonHeader().getSubRequestID()); } catch (NumberFormatException e) { // // We cannot tell what happened if this doesn't exist @@ -335,7 +334,7 @@ public class ControlLoopOperationManager implements Serializable { // // Sanity check the response message // - if (appcResponse.Status == null) { + if (appcResponse.getStatus() == null) { // // We cannot tell what happened if this doesn't exist // @@ -345,7 +344,7 @@ public class ControlLoopOperationManager implements Serializable { // // Get the Response Code // - ResponseCode code = ResponseCode.toResponseCode(appcResponse.Status.Code); + ResponseCode code = ResponseCode.toResponseCode(appcResponse.getStatus().getCode()); if (code == null) { // // We are unaware of this code @@ -370,7 +369,7 @@ public class ControlLoopOperationManager implements Serializable { // // We'll consider these two codes as exceptions // - this.completeOperation(operationAttempt, appcResponse.getStatus().Description, PolicyResult.FAILURE_EXCEPTION); + this.completeOperation(operationAttempt, appcResponse.getStatus().getDescription(), PolicyResult.FAILURE_EXCEPTION); if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) { return null; } @@ -379,7 +378,7 @@ public class ControlLoopOperationManager implements Serializable { // // // - this.completeOperation(operationAttempt, appcResponse.getStatus().Description, PolicyResult.SUCCESS); + this.completeOperation(operationAttempt, appcResponse.getStatus().getDescription(), PolicyResult.SUCCESS); if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) { return null; } @@ -388,7 +387,7 @@ public class ControlLoopOperationManager implements Serializable { // // // - this.completeOperation(operationAttempt, appcResponse.getStatus().Description, PolicyResult.FAILURE); + this.completeOperation(operationAttempt, appcResponse.getStatus().getDescription(), PolicyResult.FAILURE); if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) { return null; } diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java index a20731aaf..36feaaf93 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java @@ -74,7 +74,7 @@ public class PolicyEngineJUnitImpl implements PolicyEngine { } if (obj instanceof Request) { Request request = (Request) obj; - logger.debug("Request: {} subrequest {}", request.Action, request.CommonHeader.SubRequestID); + logger.debug("Request: {} subrequest {}", request.getAction(), request.getCommonHeader().getSubRequestID()); } else if (obj instanceof LCMRequestWrapper) { LCMRequestWrapper dmaapRequest = (LCMRequestWrapper) obj; |