diff options
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
5 files changed, 23 insertions, 106 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index 862c46ad19..308834038e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -54,7 +54,6 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils(this) CatalogDbUtils cutils = new CatalogDbUtils() - DecomposeJsonUtil decomposeJsonUtil = new DecomposeJsonUtil() /** * This method gets and validates the incoming @@ -185,7 +184,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { utils.log("DEBUG", "obtained VNF list") // Only one match here JSONObject vnfObject = vnfs[0] - vnf = decomposeJsonUtil.JsonToVnfResource(vnfObject.toString()) + vnf = DecomposeJsonUtil.jsonToVnfResource(vnfObject.toString()) } utils.log("DEBUG", "Read vnfResource", isDebugLogEnabled) if (vnf == null) { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 823223fbd8..dfa390c296 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -115,14 +115,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask { protected String httpPost(String url, HttpPost httpPost) throws RouteException { logger.info("AbstractSdncOperationTask.httpPost begin!"); - CloseableHttpClient httpClient = HttpClients.createDefault(); String result = null; - boolean var15 = false; String errorMsg; label91: { - try { - var15 = true; + try(CloseableHttpClient httpClient = HttpClients.createDefault()) { CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); result = EntityUtils.toString(closeableHttpResponse.getEntity()); logger.info("result = {}", result); @@ -133,42 +130,14 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } closeableHttpResponse.close(); - var15 = false; break label91; - } catch (IOException var19) { + } catch (IOException e) { errorMsg = url + ":httpPostWithJSON connect faild"; logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); - throwsRouteException(errorMsg, var19, "POST_CONNECT_FAILD"); - var15 = false; - } finally { - if(var15) { - try { - httpClient.close(); - } catch (IOException var16) { - String errorMsg1 = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg1); - throwsRouteException(errorMsg1, var16, "CLOSE_CONNECT_FAILD"); - } - - } - } - - try { - httpClient.close(); - } catch (IOException var17) { - errorMsg = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg); - throwsRouteException(errorMsg, var17, "CLOSE_CONNECT_FAILD"); + throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD"); } } - try { - httpClient.close(); - } catch (IOException var18) { - errorMsg = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg); - throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD"); - } logger.info("AbstractSdncOperationTask.httpPost end!"); return result; } @@ -223,78 +192,27 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private String httpGet(String url, HttpGet httpGet) throws RouteException { logger.info("AbstractSdncOperationTask.httpGet begin!"); - boolean var16 = false; - CloseableHttpClient httpClient = HttpClients.createDefault(); String result = ""; String errorMsg; - label109: - { - label110: - { - try { - var16 = true; - CloseableHttpResponse e = httpClient.execute(httpGet); - result = EntityUtils.toString(e.getEntity()); - logger.info("result = {}", result); - if (e.getStatusLine().getStatusCode() != 200) { - logger.info("exception: fail for status code = {}", e.getStatusLine().getStatusCode()); + try(CloseableHttpClient httpClient = HttpClients.createDefault()) { + CloseableHttpResponse e = httpClient.execute(httpGet); + result = EntityUtils.toString(e.getEntity()); + logger.info("result = {}", result); + if (e.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", e.getStatusLine().getStatusCode()); throw new RouteException(result, "SERVICE_GET_ERR"); } - e.close(); - var16 = false; - break label110; - } catch (ClientProtocolException var21) { - errorMsg = url + ":httpGetWithJSON connect faild"; - logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, var21, "GET_CONNECT_FAILD"); - var16 = false; - } catch (IOException var22) { - errorMsg = url + ":httpGetWithJSON connect faild"; - logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, var22, "GET_CONNECT_FAILD"); - var16 = false; - break label109; - } finally { - if (var16) { - try { - httpClient.close(); - } catch (IOException var17) { - String errorMsg1 = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg1); - throwsRouteException(errorMsg1, var17, "CLOSE_CONNECT_FAILD"); - } - - } - } + } catch (ClientProtocolException e) { + errorMsg = url + ":httpGetWithJSON connect faild"; + logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, e, "GET_CONNECT_FAILD"); + } catch (IOException e) { + errorMsg = url + ":httpGetWithJSON connect faild"; + logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, e, "GET_CONNECT_FAILD"); + } - try { - httpClient.close(); - } catch (IOException var19) { - errorMsg = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, var19, "CLOSE_CONNECT_FAILD"); - } - - } - - try { - httpClient.close(); - } catch (IOException var20) { - errorMsg = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, var20, "CLOSE_CONNECT_FAILD"); - } - - } - - try { - httpClient.close(); - } catch (IOException var18) { - errorMsg = url + ":close httpClient faild"; - logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD"); - } logger.info("AbstractSdncOperationTask.httpGet end!"); return result; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 698f0c54dc..60bc83b0ea 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -77,7 +77,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody.toString(), "SDNC", ""); + LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("SdncNetworkTopologyOperationTask.Send2SdncDirectly end!"); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 89d0958c75..602894475c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -77,7 +77,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody.toString(), "SDNC", ""); + LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("SdncServiceTopologyOperationTask.Send2SdncDirectly end!"); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java index 21c00918d3..571db76399 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java @@ -79,8 +79,8 @@ public class CreateGenericALaCarteServiceInstanceTest extends WorkflowTest { MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", ""); MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceByName("RAATest-1", ""); - MockNodeQueryServiceInstanceById("RaaTest-1-id", ""); + MockNodeQueryServiceInstanceByName("RAATest-1", null); + MockNodeQueryServiceInstanceById("RaaTest-1-id", null); //SDNC mockSDNCAdapter(200); //DB |