diff options
author | yufei_zhou <yufei.zhou@nokia-sbell.com> | 2017-10-19 14:31:33 +0800 |
---|---|---|
committer | yufei_zhou <yufei.zhou@nokia-sbell.com> | 2017-10-19 14:31:33 +0800 |
commit | 8739e1df33bdfb0155b77252ebcc94e2f087b725 (patch) | |
tree | 08f84be50793b4f2aca914ea6e275f0c9660d25b /nokia/vnfmdriver/vfcadaptorservice | |
parent | e6ef1e3333bff9c9da98873f40bb4e1ac53e4d79 (diff) |
Update http query part
Change-Id: I8b316decb203e3f4efbce8c9d47a88479065dbf6
Issue-ID: VFC-544
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice')
4 files changed, 42 insertions, 7 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java index 319b0e32..ca8e7e2e 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java @@ -49,4 +49,8 @@ public class HttpClientProcessorImpl implements HttpClientProcessorInf{ } return processor.process(url); } + + public void setHttpClientBuilder(HttpClientBuilder httpClientBuilder) { + this.httpClientBuilder = httpClientBuilder; + } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java index bd3e3635..225a228a 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java @@ -48,7 +48,6 @@ public class HttpRequestProcessor { HttpResponse response = httpClient.execute(httpRequest); HttpResult httpResult = buildHttpResult(response); - httpClient.close(); return httpResult; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java index eddc51a5..1fb7138a 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java @@ -58,15 +58,15 @@ public class EnvVariablesInitialization implements ApplicationRunner { } try { - handLcmMsbServiceInfo(); + handleLcmMsbServiceInfo(); } catch (Exception e) { - logger.error("handLcmMsbServiceInfo error", e); + logger.error("handleLcmMsbServiceInfo error", e); } try { - handCatalogMsbServiceInfo(); + handleCatalogMsbServiceInfo(); } catch (Exception e) { - logger.error("handCatalogMsbServiceInfo error", e); + logger.error("handleCatalogMsbServiceInfo error", e); } } @@ -86,13 +86,13 @@ public class EnvVariablesInitialization implements ApplicationRunner { return CommonConstants.SCHEMA_HTTP + "://" + adaptorEnv.getMsbIp() + ":" + adaptorEnv.getMsbPort(); } - private void handLcmMsbServiceInfo() throws ClientProtocolException, IOException { + private void handleLcmMsbServiceInfo() throws ClientProtocolException, IOException { String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion(adaptorEnv.getLcmServiceNameInMsb(), adaptorEnv.getLcmVersionInMsb()); adaptorEnv.setLcmUrlInMsb(urlInMsb); adaptorEnv.setLcmApiUriFront(generateApiUriFront(urlInMsb)); } - private void handCatalogMsbServiceInfo() throws ClientProtocolException, IOException { + private void handleCatalogMsbServiceInfo() throws ClientProtocolException, IOException { String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion(adaptorEnv.getCatalogServiceNameInMsb(), adaptorEnv.getCatalogVersionInMsb()); adaptorEnv.setCatalogUrlInMsb(urlInMsb); adaptorEnv.setCatalogApiUriFront(generateApiUriFront(urlInMsb)); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImplTest.java new file mode 100644 index 00000000..f070eda4 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImplTest.java @@ -0,0 +1,32 @@ +/* + * Copyright 2016-2017, Nokia Corporation + * + * 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.vfc.nfvo.driver.vnfm.svnfm.http.client; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; +import org.junit.Test; + +public class HttpClientProcessorImplTest { + + @Test + public void testMultiClient() throws ClientProtocolException, IOException + { + HttpClientProcessorImpl processor = new HttpClientProcessorImpl(); + processor.setHttpClientBuilder(HttpClientUtils.createHttpClientBuilder()); + } +} |