Multiple Sonar Fixes 09/79809/3
authorDriptaroop Das <driptaroop.das@in.ibm.com>
Wed, 6 Mar 2019 19:49:14 +0000 (01:19 +0530)
committerPatrick Brady <patrick.brady@att.com>
Wed, 13 Mar 2019 22:34:05 +0000 (22:34 +0000)
Multiple Sonar Fixes

Issue-ID: APPC-1525
Change-Id: I58b8adc0e53a00c6d3de05c921dafdd3dd9fe118
Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/ConnectionBuilder.java
appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/MetricActivator.java
appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java
appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java
appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/aai/TestAaiService.java

index 77c9af6..c96b9d5 100644 (file)
@@ -139,7 +139,7 @@ public class ConnectionBuilder implements Closeable {
      */
 
     public ConnectionBuilder(int mode, int timeout)
-            throws SSLException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException,APPCException{
+            throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException,APPCException{
         RequestConfig config = RequestConfig.custom().setSocketTimeout(timeout).build();
         if (mode == 1) {
             SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
index 4d3c4e4..37ccac5 100644 (file)
 
 package org.onap.appc;
 
-import org.onap.appc.metricservice.MetricService;
-import org.onap.appc.metricservice.impl.MetricServiceImpl;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
+import org.onap.appc.metricservice.MetricService;
+import org.onap.appc.metricservice.impl.MetricServiceImpl;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
 
 
 public class MetricActivator implements BundleActivator {
@@ -44,7 +43,7 @@ public class MetricActivator implements BundleActivator {
         MetricService impl = new MetricServiceImpl();
         String regName = MetricService.class.getName();
         logger.debug("Registering Metric service " + regName);
-        ServiceRegistration registration = bundleContext.registerService(regName, impl, null);
+        bundleContext.registerService(regName, impl, null);
         logger.debug("Registered Metric service " + regName);
     }
 
index 4e1da8a..3902f86 100644 (file)
@@ -27,10 +27,6 @@ package org.onap.appc.aai.client.aai;
 
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
 import org.onap.appc.aai.client.AppcAaiClientConstant;
@@ -43,6 +39,11 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class AaiService {
 
     private static final EELFLogger log = EELFManager.getInstance().getLogger(AaiService.class);
@@ -240,8 +241,8 @@ public class AaiService {
 
     }
 
-    public void insertVnfcs(Map<String, String> params, SvcLogicContext ctx, int vnfcRefLen, int vmCount,
-        String vfModuleIdFromRequest)
+    public void insertVnfcs(Map<String, String> params, SvcLogicContext ctx, int vmCount,
+                            String vfModuleIdFromRequest)
         throws AaiServiceInternalException, SvcLogicException {
         log.info("Received insertVnfcs call with params : " + params);
 
@@ -311,7 +312,7 @@ public class AaiService {
         }
     }
 
-    public List<String> getVnfcData(Map<String, String> params, SvcLogicContext ctx, int vnfcRefLen, int vmCount) {
+    public List<String> getVnfcData(Map<String, String> params, SvcLogicContext ctx, int vmCount) {
 
         String prefix = params.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
         prefix = StringUtils.isNotBlank(prefix) ? (prefix + ".") : "";
@@ -471,7 +472,7 @@ public class AaiService {
           * if all records do not have the same group-notation value, write the new vnfc record to A&AI inventory without a group-notation value and continue to the next VM in the vnfc_reference table.  A 501 intermediate error message should be sent after all new VNFC records have been added to A&AI.
           * If all records match, use the same group-notation value for the new vnfc record as found in the existing vnfc records.
           */
-            groupNotation = getGroupNotationForExistigValue(ctx, prefix, vnfcFuncCode, vmCount);
+            groupNotation = getGroupNotationForExistigValue(ctx, vnfcFuncCode, vmCount);
         }
 
         log.info("RETURNED GROUPNOTATION " + groupNotation);
@@ -500,8 +501,8 @@ public class AaiService {
         return null;
     }
 
-    public String getGroupNotationForExistigValue(SvcLogicContext ctx, String prefix, String vnfcFuncCode,
-        int vmCount) {
+    public String getGroupNotationForExistigValue(SvcLogicContext ctx, String vnfcFuncCode,
+                                                  int vmCount) {
         String vfModuleId = ctx.getAttribute("req-vf-module-id"); //Coming from request-params
         boolean first = true;
         String aaiGroupNotationValue = null;
@@ -733,7 +734,7 @@ public class AaiService {
 
         String vnfId = params.get("vnfId");
         String vfModuleId = params.get("vfModuleId");
-        String resourceKey = "generic-vnf.vnf-id = '" + vnfId +
+        String resourceKey = STR_VNF_ID + vnfId +
             "' AND vf-module.vf-module-id = '" + vfModuleId + "'";
         String queryPrefix = "vfModuleInfo";
         String resourceType = "vf-module";
index d1ba153..e756b14 100644 (file)
@@ -318,7 +318,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin {
                 aai.updateVnfStatusWithOAMAddress(inParams, ctx);
             }
 
-            aai.insertVnfcs(inParams, ctx, vnfcRefLen, vmCount,vfModuleIdFromRequest);
+            aai.insertVnfcs(inParams, ctx, vmCount,vfModuleIdFromRequest);
 
             ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
                 AppcAaiClientConstant.OUTPUT_STATUS_SUCCESS);
@@ -508,7 +508,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin {
         return params;
     }
 
-    public void getVfModuleModelInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getVfModuleModelInfo(Map<String, String> inParams, SvcLogicContext ctx) {
         log.info("vfModuleInfo()::Retrieving vf-module information :" + inParams.toString());
         String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
         try {
@@ -568,7 +568,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin {
 
     }
 
-    public void getFormattedValue(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getFormattedValue(Map<String, String> inParams, SvcLogicContext ctx) {
         log.info("getFormattedValue()::Formatting values :" + inParams.toString());
         String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
         try {
index 9087a7f..bf22606 100644 (file)
@@ -121,7 +121,7 @@ public class TestAaiService {
         SvcLogicContext ctx = new SvcLogicContext();
         inParams.put("AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX", "prefix.");
         ctx.setAttribute("tmp.vnfInfo.vm[1].vnfc-name", "nullnull001");
-        aaiService.insertVnfcs(inParams, ctx, 2, 2, null);
+        aaiService.insertVnfcs(inParams, ctx, 2, null);
     }
 
     @Test
@@ -132,7 +132,7 @@ public class TestAaiService {
         SvcLogicContext ctx = new SvcLogicContext();
         inParams.put("AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX", "prefix.");
         ctx.setAttribute("tmp.vnfInfo.vm[1].vnfc-name", "nullnull001");
-        aaiService.getVnfcData(inParams, ctx, 1, 1);
+        aaiService.getVnfcData(inParams, ctx, 1);
     }
 
     @Test
@@ -367,7 +367,7 @@ public class TestAaiService {
 
         mockAai.populateAllVnfInfo1(ctx, "tmp.vnfInfo");
 
-        mockAai.insertVnfcs(inParams, ctx, 2, 2,"vfModuleId1");
+        mockAai.insertVnfcs(inParams, ctx, 2,"vfModuleId1");
 
 
     }
@@ -387,7 +387,7 @@ public class TestAaiService {
 
         mockAai.populateAllVnfInfo1(ctx, "tmp.vnfInfo");
 
-        mockAai.insertVnfcs(inParams, ctx, 2, 2, null);
+        mockAai.insertVnfcs(inParams, ctx, 2, null);
 
         assertEquals(ctx.getAttribute("tmp.vnfInfo.vm[0].vnfc-name"), "dbjx0001vm001dbj001");
         assertEquals(ctx.getAttribute("tmp.vnfInfo.vm[0].vnfc-function-code"), "dbj");
@@ -414,7 +414,7 @@ public class TestAaiService {
 
         mockAai.populateAllVnfInfo1(ctx, "tmp.vnfInfo");
 
-        mockAai.insertVnfcs(inParams, ctx, 2, 2,null);
+        mockAai.insertVnfcs(inParams, ctx, 2,null);
 
 
 
@@ -464,22 +464,22 @@ public class TestAaiService {
         ctx.setAttribute("tmp.vnfInfo.vm[0].vnfc-function-code", "fc1");
         ctx.setAttribute("tmp.vnfInfo.vm[0].group-notation", "gn2");
         MockAaiService aai=new MockAaiService(aaiClient);
-        String groupNotationValue1 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 2);
+        String groupNotationValue1 = aai.getGroupNotationForExistigValue(ctx, "fc1", 2);
         assertEquals (groupNotationValue1,null);
 
         ctx.setAttribute("tmp.vnfInfo.vm[0].group-notation", "gn1");
         ctx.setAttribute("tmp.vnfInfo.vm[1].group-notation", "gn1");
-        String groupNotationValue2 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 2);
+        String groupNotationValue2 = aai.getGroupNotationForExistigValue(ctx, "fc1", 2);
         assertEquals (groupNotationValue2,"gn1");
 
         ctx.setAttribute("tmp.vnfInfo.vm[2].vf-module-id", "vfmodule01");
         ctx.setAttribute("tmp.vnfInfo.vm[2].vnfc-function-code", "fc1");
         ctx.setAttribute("tmp.vnfInfo.vm[2].group-notation", "gn2");
-        String groupNotationValue3 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 3);
+        String groupNotationValue3 = aai.getGroupNotationForExistigValue(ctx, "fc1", 3);
         assertEquals (groupNotationValue3,null);
 
         ctx.setAttribute("tmp.vnfInfo.vm[2].group-notation", "gn1");
-        String groupNotationValue4 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 3);
+        String groupNotationValue4 = aai.getGroupNotationForExistigValue(ctx, "fc1", 3);
         assertEquals (groupNotationValue4,"gn1");
 
     }