add testcases
[dmaap/messagerouter/msgrtr.git] / src / test / java / org / onap / dmaap / mr / cambria / backends / kafka / KafkaPublisherTest.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.backends.kafka;
22
23 import static org.junit.Assert.assertNotNull;
24 import static org.junit.Assert.assertTrue;
25
26 import java.io.IOException;
27
28 import org.apache.kafka.clients.producer.Producer;
29 import org.junit.After;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.junit.runner.RunWith;
33 import org.mockito.InjectMocks;
34 import org.mockito.Mock;
35 import org.mockito.MockitoAnnotations;
36 import org.onap.dmaap.dmf.mr.backends.Publisher.message;
37 import org.onap.dmaap.dmf.mr.backends.kafka.KafkaPublisher;
38 import org.onap.dmaap.dmf.mr.beans.LogDetails;
39 import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
40 import org.onap.dmaap.dmf.mr.utils.Utils;
41 import org.powermock.api.mockito.PowerMockito;
42 import org.powermock.core.classloader.annotations.PrepareForTest;
43 import org.powermock.modules.junit4.PowerMockRunner;
44
45 import com.att.ajsc.filemonitor.AJSCPropertiesMap;
46 import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
47
48 @RunWith(PowerMockRunner.class)
49 @PrepareForTest({ Utils.class })
50 public class KafkaPublisherTest {
51
52         @Before
53         public void setUp() throws Exception {
54                 MockitoAnnotations.initMocks(this);
55                 PowerMockito.mockStatic(Utils.class);
56                 PowerMockito.when(Utils.isCadiEnabled()).thenReturn(true);
57
58         }
59
60         @After
61         public void tearDown() throws Exception {
62         }
63
64         @Test
65         public void testPublisherInit() {
66                 
67                 
68
69                 try {
70                         try {
71                                 KafkaPublisher kafkaPublisher = new KafkaPublisher(null);
72                         } catch (missingReqdSetting e) {
73                                 assertTrue(true);
74                         }
75                 } catch (LinkageError e) {
76                         assertTrue(true);
77                 }
78
79         }
80
81         
82
83 }