2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.dmaap.service;
23 import static org.junit.Assert.assertTrue;
24 import static org.mockito.Matchers.any;
25 import static org.mockito.Matchers.anyString;
27 import java.io.ByteArrayInputStream;
29 //import static org.mockito.Matchers.anyString;
30 //import static org.mockito.Mockito.when;
32 import java.io.IOException;
33 import java.io.InputStream;
35 import javax.servlet.ServletOutputStream;
36 import javax.servlet.http.HttpServletRequest;
37 import javax.servlet.http.HttpServletResponse;
39 import org.json.JSONArray;
40 import org.json.JSONException;
41 import org.json.JSONObject;
42 import org.junit.After;
43 import org.junit.Assert;
44 import org.junit.Before;
45 import org.junit.Test;
46 import org.junit.runner.RunWith;
47 import org.mockito.InjectMocks;
48 import org.mockito.Mock;
49 import org.mockito.MockitoAnnotations;
50 import org.mockito.Spy;
51 import org.onap.dmaap.dmf.mr.CambriaApiException;
52 import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
53 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
54 import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
55 import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
56 import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
57 import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
58 import org.onap.dmaap.dmf.mr.metabroker.Topic;
59 import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticator;
60 import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
61 import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
62 import org.onap.dmaap.dmf.mr.service.MMService;
63 import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
64 import org.onap.dmaap.mmagent.CreateMirrorMaker;
65 import org.onap.dmaap.mmagent.MirrorMaker;
66 import org.onap.dmaap.mmagent.UpdateMirrorMaker;
67 import org.powermock.api.mockito.PowerMockito;
68 import org.powermock.core.classloader.annotations.PowerMockIgnore;
69 import org.powermock.core.classloader.annotations.PrepareForTest;
70 import org.powermock.modules.junit4.PowerMockRunner;
72 import com.att.ajsc.beans.PropertiesMapBean;
73 import com.att.ajsc.filemonitor.AJSCPropertiesMap;
74 import com.att.nsa.configs.ConfigDbException;
75 import com.att.nsa.security.NsaAcl;
76 import com.att.nsa.security.NsaApiKey;
77 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
78 import com.att.nsa.security.db.simple.NsaSimpleApiKey;
80 //@RunWith(MockitoJUnitRunner.class)
81 @RunWith(PowerMockRunner.class)
82 @PowerMockIgnore("jdk.internal.reflect.*")
83 @PrepareForTest({ PropertiesMapBean.class, AJSCPropertiesMap.class })
84 public class MMRestServiceTest {
87 MMRestService mmRestService;
90 private MMService mmservice;
93 CreateMirrorMaker cMirroMaker;
96 UpdateMirrorMaker uMirroMaker;
98 private TopicRestService service = new TopicRestService();
100 private DMaaPErrorMessages errorMessages;
103 DMaaPContext dmaapContext;
106 ConfigurationReader configReader;
109 ServletOutputStream oStream;
112 DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;
118 DMaaPAAFAuthenticator dmaapAAFauthenticator;
121 DMaaPAAFAuthenticatorImpl impl;
127 NsaSimpleApiKey nsaSimpleApiKey;
130 HttpServletRequest httpServReq;
133 HttpServletResponse httpServRes;
139 DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
154 public void setUp() {
156 MockitoAnnotations.initMocks(this);
160 public void tearDown() {
164 public void testCallCreateMirrorMaker() {
165 prepareForTestCommon();
167 // String sampleJson = ""{ messageID:\"test\", createMirrorMaker: {
168 // name:\"test\", consumer:\"test\", producer:\"test\",
169 // whitelist:\"test\",status:\"test\" }}";
170 String sampleJson = "{ messageID:\"test\", createMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\"}}";
171 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
173 mmRestService.callCreateMirrorMaker(inputSteam);
174 } catch (Exception e) {
181 public void testCallCreateMirrorMaker_error4() {
183 prepareForTestCommon();
184 } catch (Exception e) {
188 // String sampleJson = ""{ messageID:\"test\", createMirrorMaker: {
189 // name:\"test\", consumer:\"test\", producer:\"test\",
190 // whitelist:\"test\",status:\"test\" }}";
191 String sampleJson = "{ messageID:\"test\", createMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\"}}";
192 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
194 mmRestService.callCreateMirrorMaker(inputSteam);
195 } catch (Exception e) {
202 public void testCallCreateMirrorMaker_3() {
203 prepareForTestCommon();
205 // String sampleJson = ""{ messageID:\"test\", createMirrorMaker: {
206 // name:\"test\", consumer:\"test\", producer:\"test\",
207 // whitelist:\"test\",status:\"test\" }}";
208 String sampleJson = "{ messageID:\"test\", createMirrorMaker: { name:\"\", consumer:\"test\", producer:\"test\"}}";
209 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
214 public void testCallCreateMirrorMaker_error2() {
215 prepareForTestCommon();
217 // String sampleJson = ""{ messageID:\"test\", createMirrorMaker: {
218 // name:\"test\", consumer:\"test\", producer:\"test\",
219 // whitelist:\"test\",status:\"test\" }}";
220 String sampleJson = "{ messageID:\"test\", createMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\",whitelist:\"test\"}}";
221 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
223 mmRestService.callCreateMirrorMaker(inputSteam);
224 } catch (Exception e) {
232 public void testCallCreateMirrorMaker_error1() {
233 prepareForTestCommon();
235 // String sampleJson = ""{ messageID:\"test\", createMirrorMaker: {
236 // name:\"test\", consumer:\"test\", producer:\"test\",
237 // whitelist:\"test\",status:\"test\" }}";
238 String sampleJson = "{ messageID:\"test\"}";
239 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
241 mmRestService.callCreateMirrorMaker(inputSteam);
242 } catch (Exception e) {
250 public void testCallCreateMirrorMakerCreateAafPermissionError() {
251 prepareForTestCommon();
253 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))
255 String sampleJson = "{ messageID:\"test\"}";
256 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
258 mmRestService.callCreateMirrorMaker(inputSteam);
259 } catch (Exception e) {
267 public void testCallListAllMirrorMaker() {
268 prepareForTestCommon();
270 String sampleJson = "{ messageID:\"test\", createMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}";
271 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
273 mmRestService.callListAllMirrorMaker(inputSteam);
274 } catch (Exception e) {
281 public void testCallListAllMirrorMakerPermissionError() {
282 prepareForTestCommon();
283 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))
285 String sampleJson = "{ messageID:\"test\", createMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}";
286 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
288 mmRestService.callListAllMirrorMaker(inputSteam);
289 } catch (Exception e) {
296 public void testCallUpdateMirrorMaker() {
297 prepareForTestCommon();
299 String sampleJson = "{ messageID:\"test\", updateMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\"}}";
300 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
302 mmRestService.callUpdateMirrorMaker(inputSteam);
303 } catch (Exception e) {
310 public void testCallUpdateMirrorMaker_error1() {
311 prepareForTestCommon();
313 String sampleJson = "{ messageID:\"test@1\", updateMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\"}}";
314 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
316 mmRestService.callUpdateMirrorMaker(inputSteam);
317 } catch (Exception e) {
323 public void testCallUpdateMirrorMaker_error2() {
324 prepareForTestCommon();
326 String sampleJson = "{ messageID:\"test\", updateMirrorMaker: { name:\"\", consumer:\"test\", producer:\"test\"}}";
327 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
329 mmRestService.callUpdateMirrorMaker(inputSteam);
330 } catch (Exception e) {
336 public void testCallUpdateMirrorMaker_error3() {
337 prepareForTestCommon();
339 String sampleJson = "{ messageID:\"test\", updateMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\"}}";
340 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
342 mmRestService.callUpdateMirrorMaker(inputSteam);
343 } catch (Exception e) {
349 public void testCallUpdateMirrorMaker_error4() {
350 prepareForTestCommon();
352 String sampleJson = "{ messageID:\"test\"}}";
353 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
355 mmRestService.callUpdateMirrorMaker(inputSteam);
356 } catch (Exception e) {
363 public void testCallUpdateMirrorMakerAafPermissionError() {
364 prepareForTestCommon();
366 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))
369 String sampleJson = "{ messageID:\"test\"}}";
370 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
372 mmRestService.callUpdateMirrorMaker(inputSteam);
373 } catch (Exception e) {
380 public void testCallDeleteMirrorMaker() {
381 prepareForTestCommon();
383 String sampleJson = "{ messageID:\"test\", deleteMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}";
384 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
386 mmRestService.callDeleteMirrorMaker(inputSteam);
387 } catch (JSONException e) {
389 } catch (Exception e) {
397 public void testCallDeleteMirrorMakerAafPermissionError() {
398 prepareForTestCommon();
399 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))
401 String sampleJson = "{ messageID:\"test\", deleteMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}";
402 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
404 mmRestService.callDeleteMirrorMaker(inputSteam);
405 } catch (JSONException e) {
407 } catch (Exception e) {
415 public void testListWhiteList() {
416 prepareForTestCommon();
418 String sampleJson = "{ name:\"test\", namespace:\"test\"}}";
419 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
420 String msgSubscribe = "[{ messageID:\"test123\", listMirrorMaker:[ {name: \"test\"}]}]";
423 PowerMockito.when(mmservice.subscribe(any(), anyString(), anyString(), anyString())).thenReturn(msgSubscribe);
424 mmRestService.listWhiteList(inputSteam);
425 } catch (Exception e) {
432 public void testListWhiteListAafPermissionError() {
433 prepareForTestCommon();
435 String sampleJson = "{ name:\"test\", namespace:\"test\"}}";
436 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
437 String msgSubscribe = "[{ messageID:\"test123\", listMirrorMaker:[ {name: \"test\"}]}]";
440 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))
442 mmRestService.listWhiteList(inputSteam);
443 } catch (Exception e) {
450 public void testListWhiteListCreatePermissionError() {
451 prepareForTestCommon();
453 String sampleJson = "{ name:\"test\", namespace:\"test\"}}";
454 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
455 String msgSubscribe = "[{ messageID:\"test123\", listMirrorMaker:[ {name: \"test\"}]}]";
458 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf.create"))
460 mmRestService.listWhiteList(inputSteam);
461 } catch (Exception e) {
467 public void testListWhiteListJSONError() {
468 prepareForTestCommon();
470 String sampleJson = "{ namespace:\"test\"}}";
471 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
472 String msgSubscribe = "[{ messageID:\"test123\", listMirrorMaker:[ {name: \"test\"}]}]";
475 mmRestService.listWhiteList(inputSteam);
476 } catch (Exception e) {
486 public void testCreateWhiteList() {
487 prepareForTestCommon();
489 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
490 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
493 mmRestService.createWhiteList(inputSteam);
494 } catch (Exception e) {
501 public void testCreateWhiteListCreatePermissionError() {
502 prepareForTestCommon();
505 .when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf.create"))
508 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
509 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
512 mmRestService.createWhiteList(inputSteam);
513 } catch (Exception e) {
520 public void testCreateWhiteListAafPermissionError() {
521 prepareForTestCommon();
523 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))
526 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
527 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
530 mmRestService.createWhiteList(inputSteam);
531 } catch (Exception e) {
538 public void testCreateWhiteListJSONError() {
539 prepareForTestCommon();
541 String sampleJson = "{ namespace:\"test\", whitelistTopicName:\"test\"}}";
542 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
545 mmRestService.createWhiteList(inputSteam);
546 } catch (Exception e) {
553 public void testDeleteWhiteList() {
554 prepareForTestCommon();
556 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
557 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
559 mmRestService.deleteWhiteList(inputSteam);
560 } catch (Exception e) {
567 public void testDeleteWhiteListMirrorMakerPermissionError() {
568 prepareForTestCommon();
570 .when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf.create"))
572 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
573 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
575 mmRestService.deleteWhiteList(inputSteam);
576 } catch (Exception e) {
584 public void testDeleteWhiteListMirrorMakerAafPermissionError() {
585 prepareForTestCommon();
587 .when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))
589 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
590 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
592 mmRestService.deleteWhiteList(inputSteam);
593 } catch (Exception e) {
601 public void testDeleteWhiteListJsonError() {
602 prepareForTestCommon();
604 String sampleJson = "{ namespace:\"test\", whitelistTopicName:\"test\"}}";
605 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
607 mmRestService.deleteWhiteList(inputSteam);
608 } catch (Exception e) {
615 public void testDeleteWhiteListJsonFormattingError() {
616 prepareForTestCommon();
618 String sampleJson = "{ : namespace:\"test\", whitelistTopicName:\"test\"}}";
619 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
621 mmRestService.deleteWhiteList(inputSteam);
622 } catch (Exception e) {
629 public void testCallPubSubForWhitelist() {
630 prepareForTestCommon();
632 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
633 String msgSubscribe = "[{ messageID:\"test123\", listMirrorMaker:[ {name: \"test\"}]}]";
634 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
636 PowerMockito.when(mmservice.subscribe(any(), anyString(), anyString(), anyString())).thenReturn(msgSubscribe);
637 mmRestService.callPubSubForWhitelist("test123", dmaapContext, inputSteam, new JSONObject (sampleJson)) ;
638 } catch (Exception e) {
644 public void testCallPubSub() {
645 prepareForTestCommon();
647 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
648 String msgSubscribe = "[{ messageID:\"test123\", listMirrorMaker:[ {name: \"test\"}]}]";
649 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
651 PowerMockito.when(mmservice.subscribe(any(), anyString(), anyString(), anyString())).thenReturn(msgSubscribe);
652 mmRestService.callPubSub("test123", dmaapContext, inputSteam, "test", false) ;
653 } catch (Exception e) {
659 public void testCallPubSubForWhitelistNoMsgFromSubscribe() {
660 prepareForTestCommon();
662 String sampleJson = "{ name:\"test\", namespace:\"test\", whitelistTopicName:\"test\"}}";
663 InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());
665 PowerMockito.when(mmservice.subscribe(any(), anyString(), anyString(), anyString())).thenReturn(null);
666 mmRestService.callPubSubForWhitelist("test123", dmaapContext, inputSteam, new JSONObject (sampleJson)) ;
667 } catch (Exception e) {
673 public void testGetListMirrorMaker() {
674 prepareForTestCommon();
676 String sampleJson = "[{ messageID:\"test123\", listMirrorMaker:[\"test\"]}]";
678 mmRestService.getListMirrorMaker(sampleJson, "test123");
679 } catch (Exception e) {
684 private void prepareForTestCommon() {
685 Assert.assertNotNull(mmRestService);
687 PowerMockito.when(dmaapContext.getRequest()).thenReturn(httpServReq);
688 PowerMockito.when(dmaapAAFauthenticator.aafAuthentication(httpServReq, "admin")).thenReturn(true);
689 PowerMockito.when(httpServReq.isUserInRole("admin")).thenReturn(true);
691 PowerMockito.mockStatic(AJSCPropertiesMap.class);
695 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))
696 .thenReturn("admin");
698 .when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf.create"))
699 .thenReturn("aafcreate");
701 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))
702 .thenReturn("admin");
704 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.timeout"))
707 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.topic"))
708 .thenReturn("mirrormaker.topic");
711 .when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.consumergroup"))
712 .thenReturn("mirrormaker.consumergroup");
714 PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.consumerid"))
715 .thenReturn("mirrormaker.consumerid");
717 PowerMockito.when(dmaapContext.getRequest()).thenReturn(httpServReq);
719 PowerMockito.when(httpServReq.isUserInRole("admin")).thenReturn(true);
721 // PowerMockito.when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
722 PowerMockito.when(dmaapAAFauthenticator.aafAuthentication(httpServReq, "admin.aaf")).thenReturn(true);
723 PowerMockito.when(dmaapAAFauthenticator.aafAuthentication(httpServReq, "admin")).thenReturn(true);
724 PowerMockito.when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
725 PowerMockito.when(dmaapAAFauthenticator.aafAuthentication(httpServReq, "admin")).thenReturn(true);
726 PowerMockito.when(dmaapAAFauthenticator.aafAuthentication(httpServReq, "aafcreatetest|create"))
729 PowerMockito.when(cMirroMaker.getCreateMirrorMaker()).thenReturn(mMaker);
731 PowerMockito.when(mMaker.getName()).thenReturn("mirroMakerName");
732 PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
733 PowerMockito.when(dmaapContext.getRequest()).thenReturn(httpServReq);
734 PowerMockito.when(httpServReq.getHeader("Authorization")).thenReturn("Authorization");
736 PowerMockito.when(dmaapContext.getResponse()).thenReturn(httpServRes);
737 PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
738 PowerMockito.when(httpServReq.getMethod()).thenReturn("HEAD");
741 PowerMockito.when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);
742 } catch (ConfigDbException e) {