summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.so/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.so/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.so/src/main')
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java6
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java22
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java23
3 files changed, 21 insertions, 30 deletions
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
index 8d3fb59af..824c4340e 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
@@ -251,7 +251,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
}
protected SoModelInfo prepareSoModelInfo() {
- SoModelInfo soModelInfo = new SoModelInfo();
+ var soModelInfo = new SoModelInfo();
soModelInfo.setModelCustomizationId(modelCustomizationId);
soModelInfo.setModelInvariantId(modelInvariantId);
soModelInfo.setModelName(modelName);
@@ -267,7 +267,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
* @return SO request information
*/
protected SoRequestInfo constructRequestInfo() {
- SoRequestInfo soRequestInfo = new SoRequestInfo();
+ var soRequestInfo = new SoRequestInfo();
soRequestInfo.setSource("POLICY");
soRequestInfo.setSuppressRollback(false);
soRequestInfo.setRequestorId("policy");
@@ -323,7 +323,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
* @return SO cloud configuration
*/
protected SoCloudConfiguration constructCloudConfiguration(Tenant tenantItem, CloudRegion cloudRegionItem) {
- SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
+ var cloudConfiguration = new SoCloudConfiguration();
cloudConfiguration.setTenantId(getRequiredText("tenant ID", tenantItem.getTenantId()));
cloudConfiguration.setLcpCloudRegionId(getRequiredText("cloud region ID", cloudRegionItem.getCloudRegionId()));
return cloudConfiguration;
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
index 3d753bb0b..10c673705 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
@@ -28,11 +28,7 @@ import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.aai.domain.yang.CloudRegion;
-import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ModelVer;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.Tenant;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -110,7 +106,7 @@ public class VfModuleCreate extends SoOperation {
*/
@Override
protected Status detmStatus(Response rawResponse, SoResponse response) {
- Status status = super.detmStatus(rawResponse, response);
+ var status = super.detmStatus(rawResponse, response);
if (status == Status.SUCCESS) {
setVfCount(getVfCount() + 1);
@@ -125,15 +121,15 @@ public class VfModuleCreate extends SoOperation {
* @return a pair containing the request URL and the new request
*/
protected Pair<String, SoRequest> makeRequest() {
- final SoModelInfo soModelInfo = prepareSoModelInfo();
- final GenericVnf vnfItem = getVnfItem();
- final ServiceInstance vnfServiceItem = getServiceInstance();
- final Tenant tenantItem = getDefaultTenant();
- final CloudRegion cloudRegionItem = getDefaultCloudRegion();
+ final var soModelInfo = prepareSoModelInfo();
+ final var vnfItem = getVnfItem();
+ final var vnfServiceItem = getServiceInstance();
+ final var tenantItem = getDefaultTenant();
+ final var cloudRegionItem = getDefaultCloudRegion();
final ModelVer vnfModel = getVnfModel();
final ModelVer vnfServiceModel = getServiceModel();
- SoRequest request = new SoRequest();
+ var request = new SoRequest();
request.setOperationType(SoOperationType.SCALE_OUT);
//
@@ -155,8 +151,8 @@ public class VfModuleCreate extends SoOperation {
request.getRequestDetails().getRequestInfo().setInstanceName("vfModuleName");
// relatedInstanceList
- SoRelatedInstanceListElement relatedInstanceListElement1 = new SoRelatedInstanceListElement();
- SoRelatedInstanceListElement relatedInstanceListElement2 = new SoRelatedInstanceListElement();
+ var relatedInstanceListElement1 = new SoRelatedInstanceListElement();
+ var relatedInstanceListElement2 = new SoRelatedInstanceListElement();
relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance());
relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance());
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
index 1881b5c58..09584b487 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
@@ -38,10 +38,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.aai.domain.yang.CloudRegion;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.Tenant;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
@@ -50,7 +46,6 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.pipeline.PipelineControllerFuture;
-import org.onap.policy.so.SoModelInfo;
import org.onap.policy.so.SoOperationType;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoRequestDetails;
@@ -129,7 +124,7 @@ public class VfModuleDelete extends SoOperation {
final String url = getClient().getBaseUrl() + uri;
- Builder builder = HttpRequest.newBuilder(URI.create(url));
+ var builder = HttpRequest.newBuilder(URI.create(url));
builder = builder.header("Content-type", contentType);
builder = addAuthHeader(builder);
@@ -191,7 +186,7 @@ public class VfModuleDelete extends SoOperation {
*/
@Override
protected Status detmStatus(Response rawResponse, SoResponse response) {
- Status status = super.detmStatus(rawResponse, response);
+ var status = super.detmStatus(rawResponse, response);
if (status == Status.SUCCESS) {
setVfCount(getVfCount() - 1);
@@ -206,20 +201,20 @@ public class VfModuleDelete extends SoOperation {
* @return a pair containing the request URL and the new request
*/
protected Pair<String, SoRequest> makeRequest() {
- final SoModelInfo soModelInfo = prepareSoModelInfo();
- final GenericVnf vnfItem = getVnfItem();
- final ServiceInstance vnfServiceItem = getServiceInstance();
- final Tenant tenantItem = getDefaultTenant();
- final CloudRegion cloudRegionItem = getDefaultCloudRegion();
+ final var soModelInfo = prepareSoModelInfo();
+ final var vnfItem = getVnfItem();
+ final var vnfServiceItem = getServiceInstance();
+ final var tenantItem = getDefaultTenant();
+ final var cloudRegionItem = getDefaultCloudRegion();
- SoRequest request = new SoRequest();
+ var request = new SoRequest();
request.setOperationType(SoOperationType.DELETE_VF_MODULE);
//
//
// Do NOT send SO the requestId, they do not support this field
//
- SoRequestDetails details = new SoRequestDetails();
+ var details = new SoRequestDetails();
request.setRequestDetails(details);
details.setRelatedInstanceList(null);
details.setConfigurationParameters(null);