2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.dmaap.mr.test.support;
23 import static org.junit.Assert.assertTrue;
25 import java.io.IOException;
26 import java.util.ArrayList;
27 import java.util.concurrent.TimeUnit;
29 import org.junit.After;
30 import org.junit.Before;
31 import org.junit.Test;
33 import org.onap.dmaap.mr.client.HostSelector;
34 import org.onap.dmaap.mr.client.MRPublisher.message;
35 import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Entry;
37 public class MRConsumerMockTest {
38 private MRConsumerMock cons = null;
39 private MRConsumerMock.Entry entry = null;
42 public void setUp() throws Exception {
43 cons = new MRConsumerMock();
44 entry = cons.new Entry(100, 200, "statusMsg");
49 public void tearDown() throws Exception {
54 public void testClose() {
62 public void testRun() {
65 } catch (IOException e) {
66 // TODO Auto-generated catch block
75 public void testSetApiCredentials() {
76 cons.setApiCredentials("apikey", "apisecret");
82 public void testClearApiCredentials() {
83 cons.clearApiCredentials();
89 public void testAdd() {
96 public void testAddImmediateMsg() {
97 cons.addImmediateMsg("ImmediateMsg");
103 public void testAddDelayedMsg() {
104 cons.addDelayedMsg(100, "msg");
110 public void testAddImmediateMsgGroup() {
111 cons.addImmediateMsgGroup(new ArrayList<String>());
117 public void testAddDelayedMsgGroup() {
118 cons.addDelayedMsgGroup(100,new ArrayList<String>());
124 public void testAddImmediateError() {
125 cons.addImmediateError(200, "OK");
131 public void testFetch() {
134 } catch (IOException e) {
135 // TODO Auto-generated catch block
143 public void testFetch2() {
145 cons.fetch(100, 200);
146 } catch (IOException e) {
147 // TODO Auto-generated catch block
155 public void testLogTo() {
162 public void testFetchWithReturnConsumerResponse() {
163 cons.fetchWithReturnConsumerResponse();
169 public void testGetchWithReturnConsumerResponse() {
170 cons.fetchWithReturnConsumerResponse(100,200);