2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2018 IBM.
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.client;
25 import static org.junit.Assert.assertTrue;
27 import java.io.IOException;
28 import java.util.ArrayList;
29 import java.util.Collection;
31 import org.junit.After;
32 import org.junit.Before;
33 import org.junit.Test;
36 public class MRClientFactoryTest {
38 private Collection<String> hostSet = new ArrayList<String>();
40 private String[] hostArray = new String[10];
43 public void setUp() throws Exception {
45 for (int i = 0; i < 10; i++) {
46 hostSet.add("host" + (i + 1));
47 hostArray[i] = "host" + (i + 1);
52 public void tearDown() throws Exception {
57 public void testCreateConsumer() {
59 MRClientFactory.createConsumer("hostList hostList2", "testTopic");
65 public void testCreateConsumer2() {
67 MRClientFactory.createConsumer(hostSet, "testTopic");
73 public void testCreateConsumer3() {
75 MRClientFactory.createConsumer(hostSet, "testTopic", "filter");
81 public void testCreateConsumer4() {
83 MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22");
89 public void testCreateConsumer5() {
91 MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100);
97 public void testCreateConsumer6() {
99 MRClientFactory.createConsumer("hostList", "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");
105 public void testCreateConsumer7() {
107 MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");
113 public void testCreateSimplePublisher() {
115 MRClientFactory.createSimplePublisher("hostList", "testTopic");
121 public void testCreateBatchingPublisher1() {
123 MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10);
129 public void testCreateBatchingPublisher2() {
131 MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10, true);
137 public void testCreateBatchingPublisher3() {
139 MRClientFactory.createBatchingPublisher(hostArray, "testTopic", 100, 10, true);
145 public void testCreateBatchingPublisher4() {
147 MRClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 10, true);
153 public void testCreateBatchingPublisher5() {
155 MRClientFactory.createBatchingPublisher("host", "testTopic", "username", "password", 100, 10, true,
162 public void testCreateBatchingPublisher6() {
165 MRClientFactory.createBatchingPublisher("/producer");
166 } catch (IOException e) {
167 // TODO Auto-generated catch block
175 public void testCreateBatchingPublisher7() {
178 MRClientFactory.createBatchingPublisher("/producer", true);
179 } catch (IOException e) {
180 // TODO Auto-generated catch block
188 public void testCreateIdentityManager() {
190 MRClientFactory.createIdentityManager(hostSet, "apikey", "apisecret");
197 public void testCreateTopicManager() {
199 MRClientFactory.createTopicManager(hostSet, "apikey", "apisecret");
206 public void testCreateConsumer8() {
209 MRClientFactory.createConsumer("/consumer");
210 } catch (IOException e) {
211 // TODO Auto-generated catch block
220 public void testCreateConsumer9() {
222 MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", "protocolFlag",
230 public void testCreateConsumer10() {
232 MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", 1, 2, "protocolFlag",
240 public void test$testInject() {
242 MRClientFactory.$testInject(null);