summaryrefslogtreecommitdiffstats
path: root/dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java
diff options
context:
space:
mode:
authorShiwei Tian <tian.shiwei@zte.com.cn>2018-04-16 16:59:14 +0800
committerShiwei Tian <tian.shiwei@zte.com.cn>2018-04-16 16:59:14 +0800
commit60604fc38e3e1547c8fbec3378a9f38eb9f2896f (patch)
treeeb77281eabe023b614ffd88d34e37508a9ae17fe /dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java
parentbfe7264117cdcf6aa570db8643676e73a7158ef0 (diff)
fix https timeout get connection
Issue-ID: HOLMES-104 Change-Id: If76dcc6be77f698820fe4c7b9ae4f1d28f75e4c2 Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java')
-rw-r--r--dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java b/dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java
index 04a42cd..97932f0 100644
--- a/dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java
+++ b/dmaap-dsa/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java
@@ -17,6 +17,7 @@ package org.onap.holmes.dsa.dmaappolling;
import java.util.HashMap;
import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.glassfish.hk2.api.ServiceLocator;
import org.junit.Before;
@@ -36,6 +37,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
import java.util.List;
+import static org.easymock.EasyMock.anyObject;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -117,23 +119,22 @@ public class SubscriberTest {
"\"specificProblem\": \"specificProblem\"," +
"\"vfStatus\": \"vfStatus\"" +
"}}}";
-
+ Subscriber subscriber = new Subscriber();
+ subscriber.setUrl("https://www.onap.org");
+ subscriber.setConsumerGroup("group");
+ subscriber.setConsumer("consumer");
List<String> responseList = new ArrayList<>();
responseList.add(eventString);
String responseJson = GsonUtil.beanToJson(responseList);
PowerMockito.mockStatic(HttpsUtils.class);
HttpResponse httpResponse = PowerMockito.mock(HttpResponse.class);
- PowerMockito.when(HttpsUtils.get(Matchers.eq("https://www.onap.org/group/consumer"),
+ PowerMockito.when(HttpsUtils.get(Matchers.any(HttpGet.class),
Matchers.any(HashMap.class), Matchers.any(CloseableHttpClient.class))).thenReturn(httpResponse);
PowerMockito.when(HttpsUtils.extractResponseEntity(httpResponse)).thenReturn(responseJson);
PowerMock.replayAll();
- Subscriber subscriber = new Subscriber();
- subscriber.setUrl("https://www.onap.org");
- subscriber.setConsumerGroup("group");
- subscriber.setConsumer("consumer");
List<VesAlarm> vesAlarms = subscriber.subscribe();
PowerMock.verifyAll();