Update http query part 57/19657/1
authoryufei_zhou <yufei.zhou@nokia-sbell.com>
Thu, 19 Oct 2017 06:31:33 +0000 (14:31 +0800)
committeryufei_zhou <yufei.zhou@nokia-sbell.com>
Thu, 19 Oct 2017 06:31:33 +0000 (14:31 +0800)
Change-Id: I8b316decb203e3f4efbce8c9d47a88479065dbf6
Issue-ID: VFC-544
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImplTest.java [new file with mode: 0644]

index 319b0e3..ca8e7e2 100644 (file)
@@ -49,4 +49,8 @@ public class HttpClientProcessorImpl implements HttpClientProcessorInf{
                }
                return processor.process(url);
        }
+
+       public void setHttpClientBuilder(HttpClientBuilder httpClientBuilder) {
+               this.httpClientBuilder = httpClientBuilder;
+       }
 }
index bd3e363..225a228 100644 (file)
@@ -48,7 +48,6 @@ public class HttpRequestProcessor {
                HttpResponse response = httpClient.execute(httpRequest);
                
                HttpResult httpResult = buildHttpResult(response);
-               httpClient.close();
                
                return httpResult;
        }
index eddc51a..1fb7138 100644 (file)
@@ -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 (file)
index 0000000..f070eda
--- /dev/null
@@ -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());
+       }
+}