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.lang.reflect.Constructor;
26 import java.lang.reflect.InvocationTargetException;
27 import java.lang.reflect.Method;
28 import java.util.ArrayList;
29 import java.util.concurrent.TimeUnit;
31 import org.junit.After;
32 import org.junit.Before;
33 import org.junit.Test;
35 import org.onap.dmaap.mr.client.HostSelector;
36 import org.onap.dmaap.mr.client.MRPublisher.message;
37 import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
39 public class MRBatchingPublisherMockTest {
40 private MRBatchingPublisherMock pub = null;
42 private MRBatchingPublisherMock.Entry entry = null;
45 public void setUp() throws Exception {
46 pub = new MRBatchingPublisherMock();
47 entry = pub.new Entry("partition", "msg");
52 public void tearDown() throws Exception {
57 public void testToString() {
65 public void testAddListener() {
67 pub.addListener(null);
73 public void testGetCaptures() {
81 public void testGetCaptures2() {
83 pub.getCaptures(null);
89 public void testReceived() {
97 public void testResend() {
105 public void testSend() {
107 pub.send("partition", "msg");
113 public void testSend2() {
121 public void testSend3() {
122 //sending message m obj
123 pub.send(new ArrayList<message>());
129 public void testSend4() {
130 //sending collection of message m objects
131 pub.send(new message("partition", "msg"));
137 public void testSendBatchWithResponse() {
139 pub.sendBatchWithResponse();
145 public void testLogTo() {
153 public void testClearApiCredentials() {
155 pub.clearApiCredentials();
161 public void testSetApiCredentials() {
163 pub.setApiCredentials("apikey", "apisecret");
169 public void testClose() {
177 public void testClose2() {
179 pub.close(100, null);
185 public void testGetPendingMessageCount() {
187 pub.getPendingMessageCount();