2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2021 Orange.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.dmaap.mr.test.support;
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.onap.dmaap.mr.client.MRPublisher.Message;
30 import java.util.ArrayList;
32 import static org.junit.Assert.assertTrue;
34 public class MRBatchingPublisherMockTest {
35 private MRBatchingPublisherMock pub = null;
37 private MRBatchingPublisherMock.Entry entry = null;
40 public void setUp() throws Exception {
41 pub = new MRBatchingPublisherMock();
42 entry = pub.new Entry("partition", "msg");
47 public void tearDown() throws Exception {
52 public void testToString() {
60 public void testAddListener() {
62 pub.addListener(null);
68 public void testGetCaptures() {
76 public void testGetCaptures2() {
78 pub.getCaptures(null);
84 public void testReceived() {
92 public void testResend() {
100 public void testSend() {
102 pub.send("partition", "msg");
108 public void testSend2() {
116 public void testSend3() {
117 //sending message m obj
118 pub.send(new ArrayList<Message>());
124 public void testSend4() {
125 //sending collection of message m objects
126 pub.send(new Message("partition", "msg"));
132 public void testSendBatchWithResponse() {
134 pub.sendBatchWithResponse();
140 public void testLogTo() {
148 public void testClearApiCredentials() {
150 pub.clearApiCredentials();
156 public void testSetApiCredentials() {
158 pub.setApiCredentials("apikey", "apisecret");
164 public void testClose() {
172 public void testClose2() {
174 pub.close(100, null);
180 public void testGetPendingMessageCount() {
182 pub.getPendingMessageCount();