From 171ec7b74a11658277f9e9fe1dcc893a8225db9e Mon Sep 17 00:00:00 2001 From: seshukm Date: Tue, 12 Sep 2017 16:13:47 +0530 Subject: Fix for SONAR critical issues Issue-Id : SO-117 Change-Id: Icdc64605b475e20af7e871135af327f7d0e38792 Signed-off-by: seshukm --- .../mso/bpmn/mock/SDNCAdapterMockTransformer.java | 12 +++++++----- .../mock/SDNCAdapterNetworkTopologyMockTransformer.java | 11 ++++++++--- .../mso/bpmn/mock/VnfAdapterCreateMockTransformer.java | 10 ++++++++-- .../mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java | 9 ++++++--- .../mso/bpmn/mock/VnfAdapterQueryMockTransformer.java | 14 +++++++++----- .../mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java | 13 ++++++++----- .../mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java | 14 +++++++++----- 7 files changed, 55 insertions(+), 28 deletions(-) (limited to 'bpmn/MSOMockServer/src/main/java') diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java index 33a65e6fe1..1f17a8bf31 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java @@ -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,6 +23,7 @@ package org.openecomp.mso.bpmn.mock; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; +import org.openecomp.mso.logger.MsoLogger; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; @@ -29,6 +31,7 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.openecomp.mso.logger.MsoLogger; /** * * Simulates SDNC Adapter Callback response @@ -36,6 +39,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class SDNCAdapterMockTransformer extends ResponseTransformer { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private String callbackResponse; private String requestId; @@ -121,8 +125,7 @@ public class SDNCAdapterMockTransformer extends ResponseTransformer { //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :",e1); } System.out.println("Sending callback response:" + callbackUrl); ClientRequest request = new ClientRequest(callbackUrl); @@ -132,8 +135,7 @@ public class SDNCAdapterMockTransformer extends ResponseTransformer { ClientResponse result = request.post(); //System.err.println("Successfully posted callback:" + result.getStatus()); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index 673ac005a8..b782c05d38 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -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. @@ -29,8 +30,12 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.openecomp.mso.logger.MsoLogger; + public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private String callbackResponse; private String requestId; @@ -110,7 +115,7 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransform sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :",e1); } System.out.println("Sending callback response to url: " + callbackUrl); ClientRequest request = new ClientRequest(callbackUrl); @@ -122,7 +127,7 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransform } catch (Exception e) { // TODO Auto-generated catch block System.out.println("catch error in - request.post() "); - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java index 1e32077ff1..ebedca8550 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -6,6 +6,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. @@ -27,6 +28,7 @@ import javax.xml.ws.Endpoint; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; +import org.openecomp.mso.logger.MsoLogger; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; @@ -34,12 +36,15 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.openecomp.mso.logger.MsoLogger; /** * Please describe the VnfAdapterCreateMockTransformer.java class * */ public class VnfAdapterCreateMockTransformer extends ResponseTransformer { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private String notifyCallbackResponse; private String ackResponse; @@ -71,6 +76,7 @@ public class VnfAdapterCreateMockTransformer extends ResponseTransformer { responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { + LOGGER.debug("Exception :",ex); System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); @@ -124,7 +130,7 @@ public class VnfAdapterCreateMockTransformer extends ResponseTransformer { sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :",e1); } System.out.println("Sending callback response to url: " + callbackUrl); ClientRequest request = new ClientRequest(callbackUrl); @@ -138,7 +144,7 @@ public class VnfAdapterCreateMockTransformer extends ResponseTransformer { } catch (Exception e) { // TODO Auto-generated catch block System.out.println("catch error in - request.post() "); - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java index 553aed6c3d..b2c25fc108 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -6,6 +6,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. @@ -25,19 +26,20 @@ package org.openecomp.mso.bpmn.mock; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; +import org.openecomp.mso.logger.MsoLogger; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; - /** * Please describe the VnfAdapterCreateMockTransformer.java class * */ public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private String notifyCallbackResponse; private String ackResponse; @@ -72,6 +74,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { + LOGGER.debug("Exception :",ex); System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); @@ -125,7 +128,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :",e1); } System.out.println("Sending callback response to url: " + callbackUrl); ClientRequest request = new ClientRequest(callbackUrl); @@ -138,7 +141,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { } catch (Exception e) { // TODO Auto-generated catch block System.out.println("catch error in - request.post() "); - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java index c1d27d5b39..5aae3394aa 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -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. @@ -25,6 +26,7 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; +import org.openecomp.mso.logger.MsoLogger; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; @@ -32,6 +34,7 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.openecomp.mso.logger.MsoLogger; /** * Please describe the VnfAdapterQueryMockTransformer.java class * @@ -40,6 +43,8 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private String notifyCallbackResponse; private String ackResponse; private String messageId; @@ -84,6 +89,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { + LOGGER.debug("Exception :",ex); System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); @@ -139,8 +145,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :",e1); } ClientRequest request = new ClientRequest(callbackUrl); request.body("text/xml", payLoad); @@ -149,8 +154,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ ClientResponse result = request.post(); //System.err.println("Successfully posted callback:" + result.getStatus()); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 5207fa02b2..45a67dea4f 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -5,7 +5,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. @@ -32,12 +33,15 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.openecomp.mso.logger.MsoLogger; /** * Please describe the VnfAdapterCreateMockTransformer.java class * */ public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private String notifyCallbackResponse; private String ackResponse; private String messageId; @@ -74,6 +78,7 @@ public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { + LOGGER.debug("Exception :",ex); System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); @@ -125,8 +130,7 @@ public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :",e1); } System.out.println("Sending callback response to url: " + callbackUrl); ClientRequest request = new ClientRequest(callbackUrl); @@ -137,9 +141,8 @@ public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { System.out.println("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() "); - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java index e84e57c63c..d67ffcdb56 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -5,7 +5,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. @@ -25,6 +26,7 @@ package org.openecomp.mso.bpmn.mock; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; +import org.openecomp.mso.logger.MsoLogger; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; @@ -32,12 +34,15 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.openecomp.mso.logger.MsoLogger; /** * Please describe the VnfAdapterUpdateMockTransformer.java class * */ public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private String notifyCallbackResponse; private String requestId; private String ackResponse; @@ -74,6 +79,7 @@ public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { + LOGGER.debug("Exception :",ex); System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); @@ -125,8 +131,7 @@ public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + LOGGER.debug("Exception :", e1); } System.out.println("Sending callback response to url: " + callbackUrl); ClientRequest request = new ClientRequest(callbackUrl); @@ -137,9 +142,8 @@ public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { System.out.println("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() "); - e.printStackTrace(); + LOGGER.debug("Exception :",e); } } -- cgit 1.2.3-korg