From cc31e5503fbc9c17ada9e3b324457c3a2d67ec54 Mon Sep 17 00:00:00 2001 From: tangpeng Date: Sat, 30 Mar 2019 07:56:48 +0000 Subject: HTTP/S Modifications Change-Id: I731a37f868a8145f3018314db7c0248a75c8d62d Issue-ID: HOLMES-203 Signed-off-by: tangpeng --- .../holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java | 5 +---- .../holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'rulemgt/src/test/java') diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java index 836b210..82e51a5 100644 --- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java @@ -19,7 +19,6 @@ package org.onap.holmes.rulemgt.bolt.enginebolt; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.any; import static org.hamcrest.Matchers.equalTo; import java.util.HashMap; @@ -27,8 +26,6 @@ import org.apache.http.HttpResponse; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import org.easymock.EasyMock; -import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -78,7 +75,7 @@ public class EngineServiceTest { public void testEngineService_closeHttpClient_ok() throws Exception { PowerMock.resetAll(); CloseableHttpClient closeableHttpClient = HttpsUtils - .getHttpClient(HttpsUtils.DEFUALT_TIMEOUT); + .getConditionalHttpsClient(HttpsUtils.DEFUALT_TIMEOUT); Whitebox.invokeMethod(engineService, "closeHttpClient", closeableHttpClient); } diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java index 4ad213c..53e60c8 100644 --- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java @@ -79,20 +79,20 @@ public class DcaeConfigurationPollingTest { CloseableHttpClient clientMock = createMock(CloseableHttpClient.class); HttpResponse httpResponseMock = createMock(HttpResponse.class); - expect(HttpsUtils.getHttpClient(30000)).andReturn(clientMock); + expect(HttpsUtils.getConditionalHttpsClient(30000)).andReturn(clientMock); expect(HttpsUtils.get(anyObject(HttpGet.class), anyObject(HashMap.class), anyObject(CloseableHttpClient.class))) .andReturn(httpResponseMock); expect(HttpsUtils.extractResponseEntity(httpResponseMock)).andReturn(JSONObject.toJSONString(ruleQueryListResponse)); clientMock.close(); expectLastCall(); - expect(HttpsUtils.getHttpClient(30000)).andReturn(clientMock); + expect(HttpsUtils.getConditionalHttpsClient(30000)).andReturn(clientMock); expect(HttpsUtils.delete(anyObject(HttpDelete.class), anyObject(HashMap.class), anyObject(CloseableHttpClient.class))) .andReturn(httpResponseMock); clientMock.close(); expectLastCall(); - expect(HttpsUtils.getHttpClient(30000)).andReturn(clientMock); + expect(HttpsUtils.getConditionalHttpsClient(30000)).andReturn(clientMock); expect(HttpsUtils.put(anyObject(HttpPut.class), anyObject(HashMap.class), anyObject(HashMap.class), anyObject(StringEntity.class), anyObject(CloseableHttpClient.class))) .andReturn(httpResponseMock); @@ -132,13 +132,13 @@ public class DcaeConfigurationPollingTest { CloseableHttpClient clientMock = createMock(CloseableHttpClient.class); HttpResponse httpResponseMock = createMock(HttpResponse.class); - expect(HttpsUtils.getHttpClient(30000)).andReturn(clientMock); + expect(HttpsUtils.getConditionalHttpsClient(30000)).andReturn(clientMock); expect(HttpsUtils.delete(anyObject(HttpDelete.class), anyObject(HashMap.class), anyObject(CloseableHttpClient.class))) .andReturn(httpResponseMock); clientMock.close(); expectLastCall(); - expect(HttpsUtils.getHttpClient(30000)).andReturn(clientMock); + expect(HttpsUtils.getConditionalHttpsClient(30000)).andReturn(clientMock); expect(HttpsUtils.put(anyObject(HttpPut.class), anyObject(HashMap.class), anyObject(HashMap.class), anyObject(StringEntity.class), anyObject(CloseableHttpClient.class))) .andReturn(httpResponseMock); @@ -164,7 +164,7 @@ public class DcaeConfigurationPollingTest { CloseableHttpClient clientMock = createMock(CloseableHttpClient.class); HttpResponse httpResponseMock = createMock(HttpResponse.class); - expect(HttpsUtils.getHttpClient(30000)).andReturn(clientMock); + expect(HttpsUtils.getConditionalHttpsClient(30000)).andReturn(clientMock); expect(HttpsUtils.get(anyObject(HttpGet.class), anyObject(HashMap.class), anyObject(CloseableHttpClient.class))) .andReturn(httpResponseMock); expect(HttpsUtils.extractResponseEntity(httpResponseMock)).andReturn("{\"correlationRules\": [], \"totalCount\": 0}"); -- cgit 1.2.3-korg