MR Java 11 Uplift
[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.PowerMockIgnore;
43 import org.powermock.core.classloader.annotations.PrepareForTest;
44 import org.powermock.modules.junit4.PowerMockRunner;
45
46 import com.att.ajsc.filemonitor.AJSCPropertiesMap;
47 import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
48
49 @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
50 @RunWith(PowerMockRunner.class)
51 @PrepareForTest({ Utils.class })
52 public class KafkaPublisherTest {
53
54         @Before
55         public void setUp() throws Exception {
56                 MockitoAnnotations.initMocks(this);
57                 PowerMockito.mockStatic(Utils.class);
58                 PowerMockito.when(Utils.isCadiEnabled()).thenReturn(true);
59
60         }
61
62         @After
63         public void tearDown() throws Exception {
64         }
65
66         @Test
67         public void testPublisherInit() {
68                 
69                 
70
71                 try {
72                         try {
73                                 KafkaPublisher kafkaPublisher = new KafkaPublisher(null);
74                         } catch (missingReqdSetting e) {
75                                 assertTrue(true);
76                         }
77                 } catch (LinkageError e) {
78                         assertTrue(true);
79                 }
80
81         }
82
83         
84
85 }