diff options
author | 2018-01-16 18:42:01 +0000 | |
---|---|---|
committer | 2018-01-16 18:47:17 +0000 | |
commit | 59d71c593d295b2bd48a9971d89635f95759a0a2 (patch) | |
tree | 8cbdbd5180979b0c3aeb19739716462983bcb1cc /controlloop/common/actors/actor.appc/src/main/java | |
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/actors/actor.appc/src/main/java')
-rw-r--r-- | controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java index d525c4c85..41a99496c 100644 --- a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java +++ b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java @@ -41,15 +41,15 @@ public class APPCActorServiceProvider implements Actor { private static final ImmutableList<String> recipes = ImmutableList.of("Restart", "Rebuild", "Migrate", "ModifyConfig"); private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>() - .put("Restart", ImmutableList.of("VM")) - .put("Rebuild", ImmutableList.of("VM")) - .put("Migrate", ImmutableList.of("VM")) - .put("ModifyConfig", ImmutableList.of("VNF")) - .build(); + .put("Restart", ImmutableList.of("VM")) + .put("Rebuild", ImmutableList.of("VM")) + .put("Migrate", ImmutableList.of("VM")) + .put("ModifyConfig", ImmutableList.of("VNF")) + .build(); private static final ImmutableMap<String, List<String>> payloads = new ImmutableMap.Builder<String, List<String>>() - .put("ModifyConfig", ImmutableList.of("generic-vnf.vnf-id")) - .build(); - + .put("ModifyConfig", ImmutableList.of("generic-vnf.vnf-id")) + .build(); + @Override public String actor() { return "APPC"; @@ -77,52 +77,52 @@ public class APPCActorServiceProvider implements Actor { * * @param onset * the event that is reporting the alert for policy - * to perform an action + * to perform an action * @param operation * the control loop operation specifying the actor, - * operation, target, etc. + * operation, target, etc. * @param policy * the policy the was specified from the yaml generated - * by CLAMP or through the Policy GUI/API + * by CLAMP or through the Policy GUI/API * @return an APPC request conforming to the legacy API * @throws AAIException */ public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, - Policy policy, String targetVnf) { + Policy policy, String targetVnf) { /* * Construct an APPC request */ Request request = new Request(); - request.CommonHeader = new CommonHeader(); - request.CommonHeader.RequestID = onset.requestID; - request.CommonHeader.SubRequestID = operation.subRequestId; - request.Action = policy.getRecipe().substring(0, 1).toUpperCase() - + policy.getRecipe().substring(1); - + request.setCommonHeader(new CommonHeader()); + request.getCommonHeader().setRequestID(onset.requestID); + request.getCommonHeader().setSubRequestID(operation.subRequestId); + request.setAction(policy.getRecipe().substring(0, 1).toUpperCase() + + policy.getRecipe().substring(1)); + /* * For now Policy generates the PG Streams as a demo, in the * future the payload can be provided by CLAMP */ - request.Payload.put("generic-vnf.vnf-id", targetVnf); - + request.getPayload().put("generic-vnf.vnf-id", targetVnf); + PGRequest pgRequest = new PGRequest(); pgRequest.pgStreams = new PGStreams(); - + PGStream pgStream; for (int i = 0; i < 5; i++) { - pgStream = new PGStream(); - pgStream.streamId = "fw_udp"+(i+1); - pgStream.isEnabled = "true"; - pgRequest.pgStreams.pgStream.add(pgStream); + pgStream = new PGStream(); + pgStream.streamId = "fw_udp"+(i+1); + pgStream.isEnabled = "true"; + pgRequest.pgStreams.pgStream.add(pgStream); } - request.Payload.put("pg-streams", pgRequest.pgStreams); - + request.getPayload().put("pg-streams", pgRequest.pgStreams); + /* * Return the request */ - + return request; } - - + + } |