Fix invocationId usage, trim whitespaces from VES 46/86546/7
authoremartin <ephraim.martin@est.tech>
Tue, 7 May 2019 10:41:55 +0000 (10:41 +0000)
committeremartin <ephraim.martin@est.tech>
Tue, 7 May 2019 10:41:55 +0000 (10:41 +0000)
*Set InvocationId from existing component
*Remove extra whitespaces from output VES

Change-Id: Ib3221ddc0dcf917828bfccfd05bd66de6cb0dac5
Issue-ID: DCAEGEN2-1460
Signed-off-by: emartin <ephraim.martin@est.tech>
pom.xml
src/main/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSender.java
src/main/resources/mapping.ftl
version.properties

diff --git a/pom.xml b/pom.xml
index 135a361..2addd1e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
 
     <groupId>org.onap.dcaegen2.services</groupId>
     <artifactId>pm-mapper</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>1.1.0-SNAPSHOT</version>
 
     <parent>
         <groupId>org.onap.oparent</groupId>
index c8e29f3..ba57387 100644 (file)
@@ -89,7 +89,8 @@ public class RequestSender {
      * @throws Exception\r
      */\r
     public String send(String method, final String urlString, final String body, final String encodedCredentials) throws Exception {\r
-        final UUID invocationID = logger.invoke(ONAPLogConstants.InvocationMode.SYNCHRONOUS);\r
+       String invocationID = Optional.ofNullable((String)MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID))\r
+            .orElse(logger.invoke(ONAPLogConstants.InvocationMode.SYNCHRONOUS).toString());\r
         String requestID =  Optional.ofNullable((String)MDC.get(ONAPLogConstants.MDCs.REQUEST_ID))\r
             .orElse( UUID.randomUUID().toString());\r
         String result = "";\r
@@ -134,11 +135,11 @@ public class RequestSender {
         return result;\r
     }\r
 \r
-    private HttpURLConnection getHttpURLConnection(String method, URL url, UUID invocationID, String requestID) throws IOException {\r
+    private HttpURLConnection getHttpURLConnection(String method, URL url, String invocationID, String requestID) throws IOException {\r
         HttpURLConnection connection = (HttpURLConnection) url.openConnection();\r
         connection.setReadTimeout(DEFAULT_READ_TIMEOUT);\r
         connection.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID, requestID);\r
-        connection.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID, invocationID.toString());\r
+        connection.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID, invocationID);\r
         connection.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME, MapperConfig.CLIENT_NAME);\r
         connection.setRequestMethod(method);\r
 \r
index 6743a5a..ca6fce8 100644 (file)
@@ -18,6 +18,7 @@
   SPDX-License-Identifier: Apache-2.0
   ============LICENSE_END=========================================================
  -->
+<#compress>
 <#assign fileHeader = xml.measCollecFile.fileHeader>
 <#assign fileFooter = xml.measCollecFile.fileFooter>
 <#assign measData = xml.measCollecFile.measData>
     "measDataCollection": <@measDataCollection/>
 }
 </#macro>
+</#compress>
\ No newline at end of file
index 32acbf9..99f53cd 100644 (file)
@@ -1,5 +1,5 @@
 major=1
-minor=0
+minor=1
 patch=0
 base_version=${major}.${minor}.${patch}
 release_version=${base_version}