summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.cds/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-07 18:07:09 -0400
committerJim Hahn <jrh3@att.com>2021-05-07 18:13:22 -0400
commit71a2c192c13200c5f864bca610e1ba6cf99e8e82 (patch)
treeca4b6f8cc12a00b494b3337215bac6e2eca9a8e0 /models-interactions/model-actors/actor.cds/src/main
parentda708d64dc27f36ed5da733fca14ebfb4cc2832b (diff)
Fix sonars in policy-models actors
Fixed: - use "var" - don't throw generic Exception Issue-ID: POLICY-3094 Change-Id: I020addb9511fd665b5fed48e7d40719e27039224 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.cds/src/main')
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java4
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java17
2 files changed, 10 insertions, 11 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
index 4da23f1a8..53ad5689a 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +20,6 @@
package org.onap.policy.controlloop.actor.cds;
import java.util.concurrent.CompletableFuture;
-import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.onap.policy.cds.api.CdsProcessorListener;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -55,7 +55,7 @@ public class CdsActorServiceManager implements CdsProcessorListener {
@Override
public void onMessage(final ExecutionServiceOutput message) {
LOGGER.info("Received notification from CDS: {}", message);
- EventType eventType = message.getStatus().getEventType();
+ var eventType = message.getStatus().getEventType();
switch (eventType) {
case EVENT_COMPONENT_PROCESSING:
LOGGER.info("CDS is processing the message: {}", message);
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
index 44d51813a..87eaa9572 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Struct;
-import com.google.protobuf.Struct.Builder;
import com.google.protobuf.util.JsonFormat;
import java.util.Collections;
import java.util.HashMap;
@@ -168,13 +167,13 @@ public class GrpcOperation extends OperationPartial {
}
protected String getServiceInstanceId() {
- ServiceInstance serviceInstance =
- getRequiredProperty(OperationProperties.AAI_SERVICE, "Target service instance");
+ var serviceInstance = (ServiceInstance) getRequiredProperty(OperationProperties.AAI_SERVICE,
+ "Target service instance");
return serviceInstance.getServiceInstanceId();
}
protected String getVnfId() {
- GenericVnf genericVnf = getRequiredProperty(OperationProperties.AAI_RESOURCE_VNF, "Target generic vnf");
+ var genericVnf = (GenericVnf) getRequiredProperty(OperationProperties.AAI_RESOURCE_VNF, "Target generic vnf");
return genericVnf.getVnfId();
}
@@ -240,7 +239,7 @@ public class GrpcOperation extends OperationPartial {
// Embed payload from policy to ConfigDeployRequest object, serialize and inject
// into grpc request.
String cbaActionName = params.getOperation();
- CdsActionRequest request = new CdsActionRequest();
+ var request = new CdsActionRequest();
request.setPolicyPayload(payload);
request.setActionName(cbaActionName);
request.setResolutionKey(UUID.randomUUID().toString());
@@ -260,7 +259,7 @@ public class GrpcOperation extends OperationPartial {
request.setAdditionalEventParams(additionalParams);
}
- Builder struct = Struct.newBuilder();
+ var struct = Struct.newBuilder();
try {
String requestStr = request.generateCdsPayload();
Preconditions.checkState(!Strings.isNullOrEmpty(requestStr),
@@ -272,11 +271,11 @@ public class GrpcOperation extends OperationPartial {
}
// Build CDS gRPC request common-header
- CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(CdsActorConstants.ORIGINATOR_ID)
+ var commonHeader = CommonHeader.newBuilder().setOriginatorId(CdsActorConstants.ORIGINATOR_ID)
.setRequestId(params.getRequestId().toString()).setSubRequestId(getSubRequestId()).build();
// Build CDS gRPC request action-identifier
- ActionIdentifiers actionIdentifiers =
+ var actionIdentifiers =
ActionIdentifiers.newBuilder().setBlueprintName(cbaName).setBlueprintVersion(cbaVersion)
.setActionName(cbaActionName).setMode(CdsActorConstants.CDS_MODE).build();