From 6056c8e731a910abe233c6cc2cd7d69364355c2a Mon Sep 17 00:00:00 2001 From: Murali Date: Wed, 6 Sep 2017 13:53:22 +0000 Subject: Remove the use of open-o library Change-Id: Ib55f9ce65c4312cb1672aaf0f25f6bfc1d5d9a21 Jira:VNFSDK-34 Signed-off-by: Murali --- .../hooks/functiontest/FunctionTestExceutor.java | 13 ++- .../onap/vnfsdk/marketplace/rest/RestfulUtil.java | 104 --------------------- 2 files changed, 6 insertions(+), 111 deletions(-) delete mode 100644 vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulUtil.java (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main') diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java index bbe2cf34..17422c44 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java @@ -34,8 +34,7 @@ import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest; import org.onap.vnfsdk.marketplace.rest.RestConstant; import org.onap.vnfsdk.marketplace.rest.RestResponse; import org.onap.vnfsdk.marketplace.rest.RestfulClient; -import org.onap.vnfsdk.marketplace.rest.RestfulUtil; -import org.openo.baseservice.roa.util.restclient.RestfulResponse; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -167,7 +166,7 @@ public class FunctionTestExceutor paramsMap.put(CommonConstant.HttpContext.URL, CommonConstant.functionTest.FUNCTEST_RESULT_URL + key); paramsMap.put(CommonConstant.HttpContext.METHOD_TYPE, CommonConstant.MethodType.GET); - RestfulResponse response = RestfulUtil.sendRestRequest(paramsMap, null, null); + /*RestfulResponse response = RestfulUtil.sendRestRequest(paramsMap, null, null); if(!checkValidRestResponse(response)) { logger.error("Respone for getTestResultsByFuncTestKeyMsb is not valid !!!"); @@ -181,8 +180,8 @@ public class FunctionTestExceutor else { logger.info("NULL Function Test Results via MSB for Key:" + key); - } - return response.getResponseContent(); + } */ + return null; } /** @@ -200,14 +199,14 @@ public class FunctionTestExceutor return true; } - private static boolean checkValidRestResponse(RestfulResponse rsp) + /*private static boolean checkValidRestResponse(RestfulResponse rsp) { if ((rsp == null) || (RestConstant.RESPONSE_CODE_200 != rsp.getStatus() && RestConstant.RESPONSE_CODE_201 != rsp.getStatus())) { return false; } return true; - } + }*/ @SuppressWarnings("deprecation") private static HttpEntity buildRequest(InputStream inputStream) diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulUtil.java deleted file mode 100644 index 5dc8e333..00000000 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestfulUtil.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2016 Huawei Technologies Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.vnfsdk.marketplace.rest; - -import java.util.HashMap; -import java.util.Map; - -import org.openo.baseservice.remoteservice.exception.ServiceException; -import org.openo.baseservice.roa.util.restclient.Restful; -import org.openo.baseservice.roa.util.restclient.RestfulFactory; -import org.openo.baseservice.roa.util.restclient.RestfulParametes; -import org.openo.baseservice.roa.util.restclient.RestfulResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RestfulUtil { - - private static final Logger LOGGER = LoggerFactory.getLogger(RestfulUtil.class); - - private RestfulUtil() { - } - - /** - * Interface for Sending Request via REST - * @param paramsMap - * @param params - * @param queryParam - * @return - */ - public static RestfulResponse sendRestRequest(Map paramsMap, String params,Map queryParam) - { - if(null == paramsMap) - { - LOGGER.error("sendRestResponse : Input validation failed !"); - return null; - } - - String url = paramsMap.get(RestConstant.HttpContext.URL); - String methodType = paramsMap.get(RestConstant.HttpContext.METHOD_TYPE); - - RestfulResponse rsp = null; - Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP); - - try - { - RestfulParametes restfulParametes = new RestfulParametes(); - Map headerMap = new HashMap(3); - headerMap.put(RestConstant.HttpContext.CONTENT_TYPE, RestConstant.HttpContext.MEDIA_TYPE_JSON); - restfulParametes.setHeaderMap(headerMap); - - if(null != params) - { - restfulParametes.setRawData(params); - } - - if(null != queryParam) - { - for(Map.Entry curEntity : queryParam.entrySet()) - { - restfulParametes.putHttpContextHeader(curEntity.getKey(), curEntity.getValue()); - } - } - if(rest != null) - { - if(RestConstant.MethodType.GET.equalsIgnoreCase(methodType)) - { - rsp = rest.get(url, restfulParametes, null); - } - else if(RestConstant.MethodType.POST.equalsIgnoreCase(methodType)) - { - rsp = rest.post(url, restfulParametes, null); - } - else if(RestConstant.MethodType.PUT.equalsIgnoreCase(methodType)) - { - rsp = rest.put(url, restfulParametes, null); - } - else if(RestConstant.MethodType.DELETE.equalsIgnoreCase(methodType)) - { - rsp = rest.delete(url, restfulParametes, null); - } - } - } - catch(ServiceException e) - { - LOGGER.error("sendRestResponse, get restful response catch exception {}", e); - } - return rsp; - } -} -- cgit 1.2.3-korg