update the package name
[dmaap/messagerouter/msgrtr.git] / src / test / java / org / onap / dmaap / mr / cambria / metrics / publisher / DMaaPCambriaClientFactoryTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21  package org.onap.dmaap.mr.cambria.metrics.publisher;
22
23 import static org.junit.Assert.*;
24
25 import java.util.ArrayList;
26 import java.util.Collection;
27
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Test;
31
32 import org.onap.dmaap.dmf.mr.listener.DME2EndPointLoader;
33 import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaConsumer;
34 import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaPublisherUtility;
35 import org.onap.dmaap.dmf.mr.metrics.publisher.DMaaPCambriaClientFactory;
36
37 public class DMaaPCambriaClientFactoryTest {
38         
39         private Collection<String> hostSet;
40         
41         private String[] hostSetArray; 
42         @Before
43         public void setUp() throws Exception {
44                 hostSet = new ArrayList<String>();
45                 
46                 hostSetArray = new String[10];
47                 
48                 for (int i = 0; i < 10; i++) {
49                         hostSet.add("host" + (i+1));
50                         hostSetArray[i] = "host" + (i+1);
51                 }
52                 
53         }
54
55         @After
56         public void tearDown() throws Exception {
57         }
58
59         @Test
60         public void testCreateConsumer() {
61                 
62                 
63                 
64                 DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic");
65                 assertTrue(true);
66                 
67         }
68         
69         @Test
70         public void testCreateConsumer2() {
71                 
72                 
73                 try {
74                         DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic");
75                 } catch (NullPointerException e) {
76                         assertTrue(true);
77                 }
78                 
79                 
80         }
81         
82         @Test
83         public void testCreateConsumer3() {
84                 
85                 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "filter");
86                 assertTrue(true);
87                 
88         }
89         
90         @Test
91         public void testCreateConsumer4() {
92                 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23");
93                 assertTrue(true);
94                 
95         }
96         
97         @Test
98         public void testCreateConsumer5() {
99                 
100                 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20);
101                 assertTrue(true);
102                 
103         }
104         
105         @Test
106         public void testCreateConsumer6() {
107                 
108                 
109                 DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");
110                 assertTrue(true);
111                 
112         }
113         
114         @Test
115         public void testCreateConsumer7() {
116                 
117                 DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");
118                 assertTrue(true);
119                 
120         }
121         
122         @Test
123         public void testCreateSimplePublisher() {
124                 
125                 DMaaPCambriaClientFactory.createSimplePublisher("hostList", "testTopic");
126                 assertTrue(true);
127                 
128         }
129         
130         @Test
131         public void testCreateBatchingPublisher() {
132                 
133                 DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50);
134                 assertTrue(true);
135                 
136         }
137         
138         @Test
139         public void testCreateBatchingPublisher2() {
140                 
141                 DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50, true);
142                 assertTrue(true);
143                 
144         }
145         
146         @Test
147         public void testCreateBatchingPublisher3() {
148                 
149                 DMaaPCambriaClientFactory.createBatchingPublisher(hostSetArray, "testTopic", 100, 50, true);
150                 assertTrue(true);
151                 
152         }
153         
154         @Test
155         public void testCreateBatchingPublisher4() {
156                 
157                 DMaaPCambriaClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 50, true);
158                 assertTrue(true);
159                 
160         }
161         
162         @Test
163         public void $testInject() {
164                 
165                 DMaaPCambriaClientFactory factory = new DMaaPCambriaClientFactory();
166                 factory.$testInject(null);
167                 assertTrue(true);
168                 
169         }
170         
171 }