Fixed issues in bpmn package. 25/13025/1
authorseshukm <seshu.kumar.m@huawei.com>
Mon, 18 Sep 2017 07:30:32 +0000 (13:00 +0530)
committerseshukm <seshu.kumar.m@huawei.com>
Mon, 18 Sep 2017 07:30:32 +0000 (13:00 +0530)
Issue-Id: SO-141

Change-Id: Ie08e5a03f1448071ce0d31ca0829b28d791c05fd
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
13 files changed:
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java

index e8dc5af..e9752e0 100644 (file)
@@ -37,9 +37,12 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectWriter;
+import org.openecomp.mso.logger.MsoLogger;
 
 public class ApplicationControllerClient {
 
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+    
        private static final int ACCEPT_SERIES = 100;
        private static final int ERROR_SERIES = 200;
        private static final int REJECT_SERIES = 300;
@@ -113,6 +116,7 @@ public class ApplicationControllerClient {
                        requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class)
                                        .invoke(requestObject, identifier);
                } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
+                   LOGGER.debug("Exception:", e);
                        throw new Exception("Error Building AppC Request: " + e.getMessage());
                }
                return requestObject;
index 74bb59c..d505210 100644 (file)
@@ -13,12 +13,19 @@ import org.openecomp.mso.logger.MsoLogger;
 public class CamundaDBSetup {
        private static boolean isDBConfigured = false;
        private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       
+       private CamundaDBSetup() {
+           /**
+            * Constructor.
+            */
+       }
+       
        public static synchronized void configure() throws SQLException {
                if (isDBConfigured) {
                        return;
                }
 
-               System.out.println("Configuring the Camunda H2 database for MSO");
+               LOGGER.debug ("Configuring the Camunda H2 database for MSO");
 
                Connection connection = null;
                PreparedStatement stmt = null;
@@ -67,7 +74,7 @@ public class CamundaDBSetup {
 
                        isDBConfigured = true;
                } catch (SQLException e) {
-                       System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName());
+                   LOGGER.debug ("CamundaDBSetup caught " + e.getClass().getSimpleName());
                        LOGGER.debug("SQLException :",e);
                } finally {
                        if (stmt != null) {
index 70f67a5..4e67bd1 100644 (file)
@@ -85,14 +85,21 @@ public class PropertyConfiguration {
        private volatile String msoConfigPath = null;
 
        private final ConcurrentHashMap<String, Map<String, String>> propFileCache =
-               new ConcurrentHashMap<String, Map<String, String>>();
+               new ConcurrentHashMap<>();
 
        private final Object CACHELOCK = new Object();
        private FileWatcherThread fileWatcherThread = null;
 
        // The key is the file name
-       private Map<String, TimerTask> timerTaskMap = new HashMap<String, TimerTask>();
+       private Map<String, TimerTask> timerTaskMap = new HashMap<>();
 
+       /**
+     * Private Constructor.
+     */
+    private PropertyConfiguration() {
+        startUp();
+    }
+                       
        /**
         * Singleton holder pattern eliminates locking when accessing the instance
         * and still provides for lazy initialization.
@@ -112,14 +119,7 @@ public class PropertyConfiguration {
         * Returns the list of supported files.
         */
        public static List<String> supportedFiles() {
-               return new ArrayList<String>(SUPPORTED_FILES);
-       }
-
-       /**
-        * Private Constructor.
-        */
-       private PropertyConfiguration() {
-               startUp();
+               return new ArrayList<>(SUPPORTED_FILES);
        }
 
        /**
@@ -245,7 +245,7 @@ public class PropertyConfiguration {
                String fileName = file.getName();
                LOGGER.debug("Reading " + fileName);
 
-               Map<String, String> properties = new HashMap<String, String>();
+               Map<String, String> properties = new HashMap<>();
                Properties newProperties = new Properties();
 
                FileReader reader = null;
index e9110eb..6249040 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -86,7 +87,7 @@ public class ReadConfigTask extends BaseTask {
                                                try {
                                                        stream.close();
                                                } catch (Exception e) {
-                                                       // Do nothing
+                                                   msoLogger.debug("Exception:", e);
                                                }
                                        }
                                }
index 041b3e3..6b3cb5a 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -102,14 +103,14 @@ public class ReadFileTask extends BaseTask {
                                        try {
                                                xmlStream.close();
                                        } catch (Exception e) {
-                                               // Do nothing
+                                           msoLogger.debug("Exception ", e);
                                        }
                                }
                        }
                }
                execution.setVariable(theInputVariable, value);
                execution.setVariable(theOutputVariable, value);
-               System.out.println("ServiceInput - " + execution.getVariable("gServiceInput"));
+               msoLogger.debug ("ServiceInput - " + execution.getVariable("gServiceInput"));
                if (msoLogger.isDebugEnabled()) {
                        msoLogger.debug("Done Executing " + getTaskName());
                }
index b454450..4b34ddf 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO\r
  * ================================================================================\r
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -85,7 +86,7 @@ public class XQueryScriptTask extends BaseTask {
                        getStringField(outputVariable, execution, "outputVariable");\r
 \r
                if (msoLogger.isDebugEnabled()) {\r
-                       System.out.println("scriptFile = " + theScriptFile\r
+                   msoLogger.debug ("scriptFile = " + theScriptFile\r
                                + " xmlInputVariables = " + theXmlInputVariables\r
                                + " atomicInputVariables = " + theAtomicInputVariables\r
                                + "outputVariable = " + theOutputVariable);\r
@@ -141,7 +142,7 @@ public class XQueryScriptTask extends BaseTask {
                for (String atomicInputVariable : atomicInputVariableArray) {\r
                        \r
                        if (msoLogger.isDebugEnabled()) {\r
-                               System.out.println("Injecting object variable '"\r
+                           msoLogger.debug ("Injecting object variable '"\r
                                        + atomicInputVariable + "'");\r
                        }\r
 \r
@@ -235,7 +236,7 @@ public class XQueryScriptTask extends BaseTask {
                                try {\r
                                        xqStream.close();\r
                                } catch (Exception e) {\r
-                                       // Do nothing\r
+                                   msoLogger.debug ("Exception:", e);\r
                                }\r
                        }\r
                }\r
index 54a5732..9dbd4b1 100644 (file)
@@ -144,7 +144,7 @@ public class JsonUtils {
                        jsonObj = (JSONObject) obj;\r
                        keys = jsonObj.keys();\r
                        while (keys.hasNext()) {\r
-                               key = keys.next().toString();\r
+                               key = keys.next();\r
                                // msoLogger.debug("toXMLString(): key is " + k);\r
                                curObj = jsonObj.opt(key);\r
                                if (curObj == null) {\r
@@ -327,7 +327,7 @@ public class JsonUtils {
                                        return null;\r
                                } else {\r
                                        if (rawValue instanceof String) {\r
-                                               msoLogger.debug("getJsonValue(): the raw value is a String Object=" + ((String) rawValue).toString());\r
+                                               msoLogger.debug("getJsonValue(): the raw value is a String Object=" + ((String) rawValue));\r
                                                return (String) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonValue(): the raw value is NOT a String Object=" + rawValue.toString());\r
@@ -356,7 +356,7 @@ public class JsonUtils {
                                        return null;\r
                                } else {\r
                                        if (rawValue instanceof String) {\r
-                                               msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + ((String) rawValue).toString());\r
+                                               msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + ((String) rawValue));\r
                                                return (String) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString());\r
@@ -410,14 +410,13 @@ public class JsonUtils {
         * @return boolean field value associated with keys - default is false\r
         */\r
        public static boolean getJsonBooleanValue(String jsonStr, String keys) {\r
-               String isDebugLogEnabled = "true";\r
                try {\r
                                Object rawValue = getJsonRawValue(jsonStr, keys);\r
                                if (rawValue == null) {\r
                                        return false;\r
                                } else {\r
                                        if (rawValue instanceof Boolean) {\r
-                                               msoLogger.debug("getJsonValue(): the raw value is a Boolean Object=" + ((String) rawValue).toString());\r
+                                               msoLogger.debug("getJsonValue(): the raw value is a Boolean Object=" + ((String) rawValue));\r
                                                return (Boolean) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());\r
@@ -590,7 +589,7 @@ public class JsonUtils {
                try {\r
                        if (jsonObj.has(key)) {\r
                                msoLogger.debug("getJsonValueForKey(): found value for key=" + key);\r
-                               return ((Integer) jsonObj.get(key));\r
+                               return (Integer) jsonObj.get(key);\r
                        } else {\r
                                msoLogger.debug("getJsonValueForKey(): iterating over the keys");\r
                                Iterator <String> itr = jsonObj.keys();\r
@@ -628,12 +627,11 @@ public class JsonUtils {
         * @return String field value associated with key\r
         */\r
        public static Boolean getJsonBooleanValueForKey(JSONObject jsonObj, String key) {\r
-               String isDebugLogEnabled = "true";\r
                Boolean keyValue = false;\r
                try {\r
                        if (jsonObj.has(key)) {\r
                                msoLogger.debug("getJsonBooleanValueForKey(): found value for key=" + key);\r
-                               return ((Boolean) jsonObj.get(key));\r
+                               return (Boolean) jsonObj.get(key);\r
                        } else {\r
                                msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");\r
                                Iterator <String> itr = jsonObj.keys();\r
@@ -863,7 +861,7 @@ public class JsonUtils {
        public Map<String, String> entryArrayToMap(Execution execution, String entryArray) {\r
                msoLogger.debug("Started Entry Array To Map Util Method");\r
 \r
-               Map<String, String> map = new HashMap<String, String>();\r
+               Map<String, String> map = new HashMap<>();\r
 \r
                //Populate Map\r
                String entryListJson = "{ \"entry\":" + entryArray + "}";\r
@@ -895,7 +893,7 @@ public class JsonUtils {
        public Map<String, String> entryArrayToMap(Execution execution, String entryArray, String keyNode, String valueNode) {\r
                msoLogger.debug("Started Entry Array To Map Util Method");\r
 \r
-               Map<String, String> map = new HashMap<String, String>();\r
+               Map<String, String> map = new HashMap<>();\r
                //Populate Map\r
                String entryListJson = "{ \"entry\":" + entryArray + "}";\r
                JSONObject obj = new JSONObject(entryListJson);\r
@@ -926,7 +924,7 @@ public class JsonUtils {
        public List<String> StringArrayToList(Execution execution, String jsonArrayOfStrings) {\r
                msoLogger.debug("Started  String Array To List Util Method");\r
 \r
-               List<String> list = new ArrayList<String>();\r
+               List<String> list = new ArrayList<>();\r
                //Populate List\r
                String stringListJson = "{ \"strings\":" + jsonArrayOfStrings + "}";\r
                JSONObject obj = new JSONObject(stringListJson);\r
index 7b6d429..1cf4340 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -60,7 +61,7 @@ import org.xml.sax.SAXException;
  */
 public final class XmlTool {
 
-       private static final Map<String, Integer> ENTITIES = new HashMap<String, Integer>();
+       private static final Map<String, Integer> ENTITIES = new HashMap<>();
        private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.BPEL);
        static {
                ENTITIES.put("amp", new Integer(38));
@@ -69,6 +70,12 @@ public final class XmlTool {
                ENTITIES.put("gt", new Integer(62));
        }
 
+       /**
+     * Instantiation is not allowed.
+     */
+    private XmlTool() {
+    }
+    
        /**
         * Normalizes and formats XML.  This method consolidates and moves all namespace
         * declarations to the root element.  The result will not have an XML prolog or
@@ -377,10 +384,4 @@ public final class XmlTool {
                // return the modified String representation of the XML
                return Optional.of(writer.toString().trim());
        }
-
-       /**
-        * Instantiation is not allowed.
-        */
-       private XmlTool() {
-       }
 }
index a207633..40539fa 100644 (file)
@@ -2,7 +2,8 @@
  * ============LICENSE_START======================================================= 
  * ONAP - SO 
  * ================================================================================ 
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. 
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. 
@@ -22,9 +23,26 @@ package org.openecomp.mso.bpmn.mock;
 
 import java.io.IOException;
 import java.io.InputStream;
+import org.openecomp.mso.logger.MsoLogger;
 
+/**
+ * 
+ * File utility class.<br/>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version     ONAP  Sep 15, 2017
+ */
 public class FileUtil {
 
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+    
+    private FileUtil() {
+        /**
+         * Constructor.
+         */
+    }
        /**
         * Read the specified resource file and return the contents as a String.
         * 
@@ -42,6 +60,7 @@ public class FileUtil {
                        stream.close();
                        return new String(bytes);
                } catch (IOException e) {
+                   LOGGER.debug("Exception:", e);
                        return "";
                }
        }
index 1f17a8b..848751f 100644 (file)
@@ -127,7 +127,7 @@ public class SDNCAdapterMockTransformer extends ResponseTransformer {
                        } catch (InterruptedException e1) {
                                LOGGER.debug("Exception :",e1);
                        }
-                       System.out.println("Sending callback response:" + callbackUrl);
+                       LOGGER.debug("Sending callback response:" + callbackUrl);
                        ClientRequest request = new ClientRequest(callbackUrl);
                        request.body("text/xml", payLoad);
                        System.err.println(payLoad);
index b782c05..36abbdc 100644 (file)
@@ -117,16 +117,16 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransform
                                // TODO Auto-generated catch block
                                LOGGER.debug("Exception :",e1);
                        }
-                       System.out.println("Sending callback response to url: " + callbackUrl);
+                       LOGGER.debug("Sending callback response to url: " + callbackUrl);
                        ClientRequest request = new ClientRequest(callbackUrl);
                        request.body("text/xml", payLoad);
                        //System.err.println(payLoad);
                        try {
                                ClientResponse result = request.post();
-                               System.out.println("Successfully posted callback? Status: " + result.getStatus());
+                               LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
                        } catch (Exception e) {
                                // TODO Auto-generated catch block
-                               System.out.println("catch error in - request.post() ");
+                           LOGGER.debug("catch error in - request.post() ");
                                LOGGER.debug("Exception :",e);
                        }
                }
index ebedca8..5bcab6a 100644 (file)
@@ -132,18 +132,18 @@ public class VnfAdapterCreateMockTransformer extends ResponseTransformer {
                                // TODO Auto-generated catch block
                                LOGGER.debug("Exception :",e1);
                        }
-                       System.out.println("Sending callback response to url: " + callbackUrl);
+                       LOGGER.debug("Sending callback response to url: " + callbackUrl);
                        ClientRequest request = new ClientRequest(callbackUrl);
                        request.body("text/xml", payLoad);
                        //System.out.println("payLoad: " + payLoad);
 
                        try {
                                ClientResponse result = request.post();
-                               System.out.println("Successfully posted callback? Status: " + result.getStatus());
+                               LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
                                //System.err.println("Successfully posted callback:" + result.getStatus());
                        } catch (Exception e) {
                                // TODO Auto-generated catch block
-                               System.out.println("catch error in - request.post() ");
+                           LOGGER.debug("catch error in - request.post() ");
                                LOGGER.debug("Exception :",e);
                        }
                }
index 81a2bd3..ffef5f9 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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,6 +24,7 @@ package org.openecomp.mso.rest;
 import javax.net.ssl.SSLException;
 
 import org.apache.http.conn.ssl.AbstractVerifier;
+import org.openecomp.mso.logger.MsoLogger;
 
 /**
  * @version 1.0
@@ -31,6 +33,8 @@ import org.apache.http.conn.ssl.AbstractVerifier;
  */
 public class HostNameVerifier extends AbstractVerifier {
 
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+    
     public final void verify(
             final String host,
             final String[] cns,
@@ -38,7 +42,7 @@ public class HostNameVerifier extends AbstractVerifier {
        try {
                verify(host, cns, subjectAlts, true);
        } catch (SSLException sex) {
-               
+           LOGGER.debug("Exception:", sex);
        }
     }