From 6ad41e3ccd398a2721f41ad61c80b7bb03f7d127 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 31 Dec 2018 17:21:27 +0200 Subject: Merge from ECOMP's repository Main Features -------------- - Async-Instantiation jobs mechanism major update; still WIP (package `org.onap.vid.job`) - New features in View/Edit: Activate fabric configuration; show related networks; soft delete - Support AAI service-tree traversal (`AAIServiceTree`) - In-memory cache for SDC models and certain A&AI queries (`CacheProviderWithLoadingCache`) - Upgrade TOSCA Parser and add parsing options; fix malformed TOSCA models - Resolve Cloud-Owner values for MSO - Pass X-ONAP headers to MSO Infrastructure -------------- - Remove codehaus' jackson mapper; use soley fasterxml 2.9.7 - Surefire invokes both TestNG and JUnit tests - Support Kotlin source files - AaiController2 which handles errors in a "Spring manner" - Inline generated-sources and remove jsonschema2pojo Quality -------- - Cumulative bug fixes (A&AI API, UI timeouts, and many more) - Many Sonar issues cleaned-up - Some unused classes removed - Minor changes in vid-automation project, allowing some API verification to run Hard Merges ------------ - HTTP Clients (MSO, A&AI, WebConfig, OutgoingRequestHeadersTest) - Moved `package org.onap.vid.controllers` to `controller`, without plural -- just to keep semantic sync with ECOMP. Reference commit in ECOMP: 3d1141625 Issue-ID: VID-378 Change-Id: I9c8d1e74caa41815891d441fc0760bb5f29c5788 Signed-off-by: Ittay Stern --- .../org/onap/vid/mso/rest/MsoRestClientNew.java | 186 ++++++++++----------- 1 file changed, 92 insertions(+), 94 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java index 37600f7b9..2ff337653 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java @@ -22,10 +22,6 @@ package org.onap.vid.mso.rest; import com.google.common.collect.ImmutableMap; import io.joshworks.restclient.http.HttpResponse; -import java.util.HashMap; -import java.util.Map; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; import org.apache.commons.codec.binary.Base64; import org.eclipse.jetty.util.security.Password; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -35,17 +31,21 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.client.SyncRestClient; import org.onap.vid.model.RequestReferencesContainer; import org.onap.vid.mso.*; +import org.onap.vid.utils.Logging; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import org.onap.vid.utils.Logging; +import java.util.HashMap; +import java.util.Map; /** * Created by pickjonathan on 21/06/2017. */ -public class MsoRestClientNew implements MsoInterface { +public class MsoRestClientNew extends RestMsoImplementation implements MsoInterface { /** * The Constant dateFormat. @@ -70,7 +70,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) { String methodName = "createSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetails, path); @@ -79,7 +79,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint) { String methodName = "createE2eSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetails, path); @@ -89,7 +89,7 @@ public class MsoRestClientNew implements MsoInterface { public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) { String methodName = "createVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetails, path); @@ -99,7 +99,7 @@ public class MsoRestClientNew implements MsoInterface { public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) { String methodName = "createNwInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetails, path); @@ -108,7 +108,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String endpoint) { String methodName = "createVolumeGroupInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetails, path); @@ -117,7 +117,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) { String methodName = "createVfModuleInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetails, path); @@ -126,7 +126,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper scaleOutVFModuleInstance(RequestDetailsWrapper requestDetailsWrapper, String endpoint) { String methodName = "scaleOutVFModuleInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetailsWrapper, path); } @@ -134,7 +134,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String endpoint) { String methodName = "createConfigurationInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return createInstance(requestDetailsWrapper, path); @@ -143,7 +143,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint) { String methodName = "deleteE2eSvcInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return deleteInstance(requestDetails, path); } @@ -151,7 +151,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) { String methodName = "deleteSvcInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return deleteInstance(requestDetails, path); } @@ -159,15 +159,17 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper unassignSvcInstance(RequestDetails requestDetails, String endpoint) { String methodName = "unassignSvcInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); - HttpResponse response = client.post(endpoint, commonHeaders, requestDetails, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); + String path = baseUrl + endpoint; + + HttpResponse response = client.post(path, commonHeaders, requestDetails, String.class); return MsoUtil.wrapResponse(response); } @Override public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) { String methodName = "deleteVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return deleteInstance(requestDetails, path); @@ -176,7 +178,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) { String methodName = "deleteVfModule"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return deleteInstance(requestDetails, path); @@ -185,7 +187,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) { String methodName = "deleteVolumeGroupInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return deleteInstance(requestDetails, path); @@ -194,59 +196,50 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) { String methodName = "deleteNwInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return deleteInstance(requestDetails, path); } @Override - public MsoResponseWrapper getOrchestrationRequest(String endpoint) { + public MsoResponseWrapper getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject, boolean warpException) { String path = baseUrl + endpoint; HttpResponse response = client.get(path, commonHeaders, new HashMap<>(), String.class); return MsoUtil.wrapResponse(response); } - public MsoResponseWrapper getManualTasks(String endpoint) { + @Override + public MsoResponseWrapper getOrchestrationRequest(String endpoint) { String path = baseUrl + endpoint; HttpResponse response = client.get(path, commonHeaders, new HashMap<>(), String.class); return MsoUtil.wrapResponse(response); } - public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String path, RestObject restObject) { - String methodName = "getOrchestrationRequestsForDashboard"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START); - - try { - MsoResponseWrapper w = getOrchestrationRequest(path); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); - - return w; + public MsoResponseWrapper getManualTasks(String endpoint) { + String path = baseUrl + endpoint; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } + HttpResponse response = client.get(path, commonHeaders, new HashMap<>(), String.class); + return MsoUtil.wrapResponse(response); } public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) { String methodName = "getManualTasksByRequestId"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(methodName + START); try { String path = baseUrl + endpoint; MsoResponseWrapper w =getManualTasks(path); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w=" + w.getResponse()); return w; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -254,19 +247,19 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) { String methodName = "completeManualTask"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Complete "); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Complete "); try { String path = baseUrl + endpoint; HttpResponse response = client.post(path, commonHeaders, requestDetails, String.class); MsoResponseWrapper w = MsoUtil.wrapResponse(response); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w=" + w.getResponse()); return w; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -274,7 +267,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) { String methodName = "replaceVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; return replaceInstance(requestDetails, path); } @@ -283,7 +276,7 @@ public class MsoRestClientNew implements MsoInterface { public MsoResponseWrapper deleteConfiguration(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint) { String methodName = "deleteConfiguration"; logger.debug(EELFLoggerDelegate.debugLogger, - dateFormat.format(new Date()) + "<== " + methodName + START); + methodName + START); String path = baseUrl + pmc_endpoint; return deleteInstance(requestDetailsWrapper, path); @@ -292,7 +285,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper setConfigurationActiveStatus(RequestDetails request, String endpoint) { String methodName = "setConfigurationActiveStatus"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { String path = baseUrl + endpoint; @@ -302,8 +295,8 @@ public class MsoRestClientNew implements MsoInterface { HttpResponse response = client.post(path, commonHeaders, request, String.class); return MsoUtil.wrapResponse(response); } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -311,7 +304,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails request, String endpoint) { String methodName = "setPortOnConfigurationStatus"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { String path = baseUrl + endpoint; @@ -320,8 +313,8 @@ public class MsoRestClientNew implements MsoInterface { HttpResponse response = client.post(path, commonHeaders, request, String.class); return MsoUtil.wrapResponse(response); } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -335,28 +328,29 @@ public class MsoRestClientNew implements MsoInterface { public MsoResponseWrapper replaceInstance(org.onap.vid.changeManagement.RequestDetails request, String path) { String methodName = "replaceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Replace VNF, path =[" + path + "]"); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Replace VNF, path =[" + path + "]"); + RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper(); + requestDetailsWrapper.requestDetails = new MsoRequestDetails(request); - HttpResponse response = client.post(path, commonHeaders, request, String.class); + HttpResponse response = client.post(path, commonHeaders, requestDetailsWrapper, String.class); MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(response); int status = msoResponseWrapperObject.getStatus(); if (status == 202) { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + + logger.debug(EELFLoggerDelegate.debugLogger, methodName + ",post succeeded, msoResponseWrapperObject response:" + msoResponseWrapperObject.getResponse()); } else { - logger.error(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + + logger.error(EELFLoggerDelegate.debugLogger, methodName + ": post failed, msoResponseWrapperObject status" + status + ", response:" + msoResponseWrapperObject.getResponse()); - // TODO } return msoResponseWrapperObject; } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } @@ -365,7 +359,7 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) { String methodName = "updateVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); String path = baseUrl + endpoint; RequestDetailsWrapper wrapper = new RequestDetailsWrapper(); @@ -375,20 +369,22 @@ public class MsoRestClientNew implements MsoInterface { public MsoResponseWrapper updateInstance(org.onap.vid.changeManagement.RequestDetails request, String path) { String methodName = "updateInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]"); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Delete, path =[" + path + "]"); - HttpResponse response = client.post(path, commonHeaders, request, String.class); + RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper(); + requestDetailsWrapper.requestDetails = new MsoRequestDetails(request); + HttpResponse response = client.put(path, commonHeaders, requestDetailsWrapper, String.class); MsoResponseWrapper w = MsoUtil.wrapResponse(response); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w=" + w.getResponse()); return w; } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } @@ -396,16 +392,16 @@ public class MsoRestClientNew implements MsoInterface { public void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) { String methodName = "activateServiceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start "); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start "); try { String path = baseUrl + endpoint; HttpResponse response = client.post(path, commonHeaders, requestDetails, String.class); MsoResponseWrapper w = MsoUtil.wrapResponse(response); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w =" + w.getResponse()); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w =" + w.getResponse()); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -413,16 +409,16 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint) { String methodName = "removeRelationshipFromServiceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]"); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]"); String path = baseUrl + endpoint; HttpResponse response = client.post(path, commonHeaders, requestDetails, String.class); return MsoUtil.wrapResponse(response); } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -430,43 +426,45 @@ public class MsoRestClientNew implements MsoInterface { @Override public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath) { String methodName = "addRelationshipToServiceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]"); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]"); String path = baseUrl + addRelationshipsPath; HttpResponse response = client.post(path, commonHeaders, requestDetails, String.class); return MsoUtil.wrapResponse(response); } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @Override - public HttpResponse get(String path, Class responseClass) { + public HttpResponse get(String endpoint, Class responseClass) { + String path = baseUrl + endpoint; return client.get(path, commonHeaders, new HashMap<>(), responseClass); } @Override - public HttpResponse post(String path, RequestDetailsWrapper requestDetailsWrapper, - Class responseClass) { + public HttpResponse post(String endpoint, RequestDetailsWrapper requestDetailsWrapper, Class responseClass) { + String path = baseUrl + endpoint; + return client.post(path, commonHeaders, requestDetailsWrapper, responseClass); } - private MsoResponseWrapper createInstance(Object request, String endpoint) { + private MsoResponseWrapper createInstance(Object request, String path) { String methodName = "createInstance"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(methodName + START); try { - HttpResponse response = client.post(endpoint, commonHeaders, request, String.class); + HttpResponse response = client.post(path, commonHeaders, request, String.class); return MsoUtil.wrapResponse(response); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } } @@ -481,20 +479,20 @@ public class MsoRestClientNew implements MsoInterface { */ private MsoResponseWrapper deleteInstance(Object request, String path) { String methodName = "deleteInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + START); try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]"); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Delete, path =[" + path + "]"); HttpResponse response = client.delete(path, commonHeaders, request, String.class); MsoResponseWrapper w = MsoUtil.wrapResponse(response); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w=" + w.getResponse()); return w; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString()); throw e; } -- cgit 1.2.3-korg