2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package com.att.nsa.cambria.metrics.publisher;
\r
23 import static org.junit.Assert.*;
\r
25 import java.util.ArrayList;
\r
26 import java.util.Collection;
\r
28 import org.junit.After;
\r
29 import org.junit.Before;
\r
30 import org.junit.Test;
\r
32 import com.att.dmf.mr.listener.DME2EndPointLoader;
\r
33 import com.att.dmf.mr.metrics.publisher.CambriaConsumer;
\r
34 import com.att.dmf.mr.metrics.publisher.CambriaPublisherUtility;
\r
35 import com.att.dmf.mr.metrics.publisher.DMaaPCambriaClientFactory;
\r
37 public class DMaaPCambriaClientFactoryTest {
\r
39 private Collection<String> hostSet;
\r
41 private String[] hostSetArray;
\r
43 public void setUp() throws Exception {
\r
44 hostSet = new ArrayList<String>();
\r
46 hostSetArray = new String[10];
\r
48 for (int i = 0; i < 10; i++) {
\r
49 hostSet.add("host" + (i+1));
\r
50 hostSetArray[i] = "host" + (i+1);
\r
56 public void tearDown() throws Exception {
\r
60 public void testCreateConsumer() {
\r
64 DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic");
\r
70 public void testCreateConsumer2() {
\r
74 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic");
\r
75 } catch (NullPointerException e) {
\r
83 public void testCreateConsumer3() {
\r
85 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "filter");
\r
91 public void testCreateConsumer4() {
\r
92 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23");
\r
98 public void testCreateConsumer5() {
\r
100 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20);
\r
106 public void testCreateConsumer6() {
\r
109 DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");
\r
115 public void testCreateConsumer7() {
\r
117 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");
\r
123 public void testCreateSimplePublisher() {
\r
125 DMaaPCambriaClientFactory.createSimplePublisher("hostList", "testTopic");
\r
131 public void testCreateBatchingPublisher() {
\r
133 DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50);
\r
139 public void testCreateBatchingPublisher2() {
\r
141 DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50, true);
\r
147 public void testCreateBatchingPublisher3() {
\r
149 DMaaPCambriaClientFactory.createBatchingPublisher(hostSetArray, "testTopic", 100, 50, true);
\r
155 public void testCreateBatchingPublisher4() {
\r
157 DMaaPCambriaClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 50, true);
\r
163 public void $testInject() {
\r
165 DMaaPCambriaClientFactory factory = new DMaaPCambriaClientFactory();
\r
166 factory.$testInject(null);
\r