aboutsummaryrefslogtreecommitdiffstats
path: root/appc-event-listener
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-20 13:59:56 +0000
committerTakamune Cho <takamune.cho@att.com>2019-02-21 16:33:16 +0000
commit6ac907b4b1c6fba52307fb64847efac4706ddc1a (patch)
treea430ecf8c67871158f6f1cca6383e5428613345a /appc-event-listener
parent168de15f727a0a571af48f626a03a9ed8ade8b4a (diff)
Test coverage for HttpClientUtil
Add new test class and increase coverage Issue-ID: APPC-1462 Change-Id: Ie0de18d9c22c3913c5b57bc1f2de2e8758c26ed0 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-event-listener')
-rw-r--r--appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/util/HttpClientUtil.java2
-rw-r--r--appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/util/HttpClientUtilTest.java40
2 files changed, 41 insertions, 1 deletions
diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/util/HttpClientUtil.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/util/HttpClientUtil.java
index dea692910..2b8e887bf 100644
--- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/util/HttpClientUtil.java
+++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/util/HttpClientUtil.java
@@ -75,7 +75,7 @@ public class HttpClientUtil {
ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
client = new DefaultHttpClient(ccm, params);
} catch (Exception e) {
- log.info("Creating Default Http Client with no params"+e.getMessage());
+ log.info("Creating Default Http Client with no params " + e.getMessage(), e);
client = new DefaultHttpClient();
}
} else if ("http".equals(protocol)) {
diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/util/HttpClientUtilTest.java b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/util/HttpClientUtilTest.java
new file mode 100644
index 000000000..084d51ed0
--- /dev/null
+++ b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/util/HttpClientUtilTest.java
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2019 Ericsson
+ * ================================================================================
+ * 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.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.listener.util;
+
+import static org.junit.Assert.assertTrue;
+import org.apache.http.client.HttpClient;
+import org.junit.Test;
+import org.onap.appc.exceptions.APPCException;
+
+public class HttpClientUtilTest {
+
+ @Test
+ public void testHttps() throws APPCException {
+ assertTrue(HttpClientUtil.getHttpClient("https") instanceof HttpClient);
+ }
+
+ @Test
+ public void testHttp() throws APPCException {
+ assertTrue(HttpClientUtil.getHttpClient("http") instanceof HttpClient);
+ }
+}