From 172be7073ec345f65e7a40cd95da3a97bdbc0f57 Mon Sep 17 00:00:00 2001 From: "k.kazak" Date: Tue, 12 Feb 2019 15:22:29 +0100 Subject: fix major sonar bug Removed useless 'instanceof' operator as it always resolves as true Replaced it with checking for null Removed unused imports Added information about modifications on the top Added junit tests for the method Change-Id: I7a902ad2852e0ed0d507a6309857a1bab74921de Issue-ID: SO-1491 Signed-off-by: k.kazak --- .../so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/main') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 0082545fa1..99bda80e4f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -48,7 +50,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; import org.onap.so.client.aai.AAICommonObjectMapperProvider; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; @@ -58,13 +59,11 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CvnfcCustomization; -import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; @@ -439,8 +438,7 @@ public class WorkflowAction { CollectionResourceCustomization networkCollection = null; int count = 0; for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){ - if(catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID()) - instanceof NetworkCollectionResourceCustomization) { + if(catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID()) != null) { networkCollection = collectionCust; count++; } -- cgit 1.2.3-korg