summaryrefslogtreecommitdiffstats
path: root/controlloop/common/actors/actor.appclcm/src
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@ericsson.com>2018-01-18 10:55:53 +0000
committerLiam Fallon <liam.fallon@ericsson.com>2018-01-18 11:06:22 +0000
commitb2a9a8adbcf036780bf47c5c94dbf65a088ab540 (patch)
treef594ceccac054e76a67e83de0712cf3896d0c8c7 /controlloop/common/actors/actor.appclcm/src
parentbdf5640a2c68a0899363503dafa0f7cb1557e4a6 (diff)
Fix Tech Debt/JUnit on control loop event 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.controlloop Issue-ID: POLICY-455 Change-Id: I445b7cfaf9eb921a230bbb72b06ff4455fe003ce Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Diffstat (limited to 'controlloop/common/actors/actor.appclcm/src')
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java8
-rw-r--r--controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java40
2 files changed, 24 insertions, 24 deletions
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index 0f4a00423..8e416cb63 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -211,7 +211,7 @@ public class AppcLcmActorServiceProvider implements Actor {
*/
LCMRequestWrapper dmaapRequest = new LCMRequestWrapper();
dmaapRequest.setVersion("2.0");
- dmaapRequest.setCorrelationId(onset.requestID + "-" + operation.subRequestId);
+ dmaapRequest.setCorrelationId(onset.getRequestID() + "-" + operation.getSubRequestId());
dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
dmaapRequest.setType("request");
@@ -220,9 +220,9 @@ public class AppcLcmActorServiceProvider implements Actor {
/* The common header is a required field for all APPC requests. */
LCMCommonHeader requestCommonHeader = new LCMCommonHeader();
- requestCommonHeader.setOriginatorId(onset.requestID.toString());
- requestCommonHeader.setRequestId(onset.requestID);
- requestCommonHeader.setSubRequestId(operation.subRequestId);
+ requestCommonHeader.setOriginatorId(onset.getRequestID().toString());
+ requestCommonHeader.setRequestId(onset.getRequestID());
+ requestCommonHeader.setSubRequestId(operation.getSubRequestId());
appcRequest.setCommonHeader(requestCommonHeader);
diff --git a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
index d446968ef..b498566da 100644
--- a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
@@ -66,24 +66,24 @@ public class AppcLcmServiceProviderTest {
* generic-vnf.vnf-id and a target type of VM.
*/
onsetEvent = new VirtualControlLoopEvent();
- onsetEvent.closedLoopControlName = "closedLoopControlName-Test";
- onsetEvent.requestID = UUID.randomUUID();
- onsetEvent.closedLoopEventClient = "tca.instance00001";
- onsetEvent.target_type = ControlLoopTargetType.VM;
- onsetEvent.target = "generic-vnf.vnf-name";
- onsetEvent.from = "DCAE";
- onsetEvent.closedLoopAlarmStart = Instant.now();
- onsetEvent.AAI = new HashMap<>();
- onsetEvent.AAI.put("generic-vnf.vnf-name", "fw0001vm001fw001");
- onsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+ onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
+ onsetEvent.setRequestID(UUID.randomUUID());
+ onsetEvent.setClosedLoopEventClient("tca.instance00001");
+ onsetEvent.setTargetType(ControlLoopTargetType.VM);
+ onsetEvent.setTarget("generic-vnf.vnf-name");
+ onsetEvent.setFrom("DCAE");
+ onsetEvent.setClosedLoopAlarmStart(Instant.now());
+ onsetEvent.setAAI(new HashMap<>());
+ onsetEvent.getAAI().put("generic-vnf.vnf-name", "fw0001vm001fw001");
+ onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
/* Construct an operation with an APPC actor and restart operation. */
operation = new ControlLoopOperation();
- operation.actor = "APPC";
- operation.operation = "Restart";
- operation.target = "VM";
- operation.end = Instant.now();
- operation.subRequestId = "1";
+ operation.setActor("APPC");
+ operation.setOperation("Restart");
+ operation.setTarget("VM");
+ operation.setEnd(Instant.now());
+ operation.setSubRequestId("1");
/* Construct a policy specifying to restart vm. */
policy = new Policy();
@@ -98,13 +98,13 @@ public class AppcLcmServiceProviderTest {
/* A sample DMAAP request wrapper. */
dmaapRequest = new LCMRequestWrapper();
- dmaapRequest.setCorrelationId(onsetEvent.requestID.toString() + "-" + "1");
+ dmaapRequest.setCorrelationId(onsetEvent.getRequestID().toString() + "-" + "1");
dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
dmaapRequest.setType("request");
/* A sample DMAAP response wrapper */
dmaapResponse = new LCMResponseWrapper();
- dmaapResponse.setCorrelationId(onsetEvent.requestID.toString() + "-" + "1");
+ dmaapResponse.setCorrelationId(onsetEvent.getRequestID().toString() + "-" + "1");
dmaapResponse.setRpcName(policy.getRecipe().toLowerCase());
dmaapResponse.setType("response");
@@ -125,9 +125,9 @@ public class AppcLcmServiceProviderTest {
appcRequest.setActionIdentifiers(actionIdentifiers);
LCMCommonHeader commonHeader = new LCMCommonHeader();
- commonHeader.setRequestId(onsetEvent.requestID);
+ commonHeader.setRequestId(onsetEvent.getRequestID());
commonHeader.setSubRequestId("1");
- commonHeader.setOriginatorId(onsetEvent.requestID.toString());
+ commonHeader.setOriginatorId(onsetEvent.getRequestID().toString());
appcRequest.setCommonHeader(commonHeader);
@@ -184,7 +184,7 @@ public class AppcLcmServiceProviderTest {
/* A common header is required and cannot be null */
assertNotNull(appcRequest.getCommonHeader());
- assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.requestID);
+ assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestID());
/* An action is required and cannot be null */
assertNotNull(appcRequest.getAction());