2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.dmaap.dmf.mr.service.impl;
25 import static org.junit.Assert.assertEquals;
26 import static org.mockito.Matchers.any;
27 import static org.mockito.Matchers.anyBoolean;
28 import static org.mockito.Matchers.anyInt;
29 import static org.mockito.Matchers.anyString;
30 import static org.mockito.Matchers.contains;
31 import static org.mockito.Matchers.eq;
32 import static org.mockito.Mockito.doNothing;
33 import static org.mockito.Mockito.doReturn;
34 import static org.mockito.Mockito.never;
35 import static org.mockito.Mockito.verify;
36 import static org.mockito.Mockito.verifyZeroInteractions;
37 import static org.mockito.Mockito.when;
39 import com.att.nsa.configs.ConfigDbException;
40 import com.att.nsa.security.NsaAcl;
41 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
42 import com.att.nsa.security.db.simple.NsaSimpleApiKey;
43 import java.io.IOException;
44 import java.nio.file.attribute.UserPrincipal;
45 import java.security.Principal;
46 import java.util.Arrays;
47 import java.util.HashSet;
48 import javax.servlet.ServletOutputStream;
49 import javax.servlet.http.HttpServletRequest;
50 import javax.servlet.http.HttpServletResponse;
51 import org.json.JSONException;
52 import org.json.JSONObject;
53 import org.junit.Assert;
54 import org.junit.Before;
55 import org.junit.Rule;
56 import org.junit.Test;
57 import org.junit.rules.ExpectedException;
58 import org.junit.runner.RunWith;
59 import org.mockito.Mock;
60 import org.mockito.Spy;
61 import org.mockito.runners.MockitoJUnitRunner;
62 import org.onap.dmaap.dmf.mr.CambriaApiException;
63 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
64 import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
65 import org.onap.dmaap.dmf.mr.beans.TopicBean;
66 import org.onap.dmaap.dmf.mr.exception.DMaaPAccessDeniedException;
67 import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
68 import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
69 import org.onap.dmaap.dmf.mr.metabroker.Broker1;
70 import org.onap.dmaap.dmf.mr.metabroker.Topic;
71 import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
72 import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
75 @RunWith(MockitoJUnitRunner.class)
76 public class TopicServiceImplTest {
78 private static final String TOPIC_CREATE_PEM = "org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:org.onap.dmaap.mr|create";
79 private static final String TOPIC_DELETE_PEM = "org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:org.onap.dmaap.mr|destroy";
80 private NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
81 private TopicBean topicBean;
84 private TopicServiceImpl topicService;
87 private DMaaPErrorMessages errorMessages;
90 private DMaaPContext dmaapContext;
93 private ConfigurationReader configReader;
96 private ServletOutputStream oStream;
99 private DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;
102 private HttpServletRequest httpServReq;
105 private HttpServletResponse httpServRes;
108 private DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
111 private Topic createdTopic;
114 private NsaAcl nsaAcl;
117 public ExpectedException thrown = ExpectedException.none();
120 public void setUp() throws Exception {
121 configureSpyInstance();
122 topicService.setErrorMessages(errorMessages);
124 when(dmaapContext.getRequest()).thenReturn(httpServReq);
127 private void configureSpyInstance() throws Exception {
128 doReturn(user).when(topicService).getDmaapAuthenticatedUser(any(DMaaPContext.class));
129 doReturn(dmaapKafkaMetaBroker).when(topicService).getMetaBroker(any(DMaaPContext.class));
130 doNothing().when(topicService).respondOk(any(DMaaPContext.class),anyString());
131 doNothing().when(topicService).respondOk(any(DMaaPContext.class),any(JSONObject.class));
132 when(topicService.getPropertyFromAJSCbean("enforced.topic.name.AAF"))
133 .thenReturn("org.onap.dmaap.mr");
134 when(topicService.getPropertyFromAJSCmap("msgRtr.topicfactory.aaf"))
135 .thenReturn("org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:");
138 private void givenTopicBean(String topicName) {
139 topicBean = new TopicBean();
140 topicBean.setTopicName(topicName);
145 public void createTopic_shouldSkipAAFAuthorization_whenCadiIsEnabled_andTopicNameNotEnforced() throws Exception {
147 String topicName = "UNAUTHENTICATED.PRH.REGISTRATION";
149 when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean()))
150 .thenReturn(createdTopic);
152 givenTopicBean(topicName);
155 topicService.createTopic(dmaapContext, topicBean);
158 verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(),
160 verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class));
161 verify(httpServReq, never()).isUserInRole(TOPIC_CREATE_PEM);
165 public void createTopic_shouldSkipAAFAuthorization_whenCADIdisabled() throws Exception {
167 String topicName = "org.onap.dmaap.mr.topic-2";
168 givenTopicBean(topicName);
170 when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean()))
171 .thenReturn(createdTopic);
174 topicService.createTopic(dmaapContext, topicBean);
177 verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(),
179 verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class));
180 verify(httpServReq, never()).isUserInRole(TOPIC_CREATE_PEM);
184 public void createTopic_shouldPass_whenCADIisDisabled_andNoUserInDmaapContext() throws Exception {
186 String topicName = "org.onap.dmaap.mr.topic-3";
187 givenTopicBean(topicName);
189 doReturn(null).when(topicService).getDmaapAuthenticatedUser(dmaapContext);
190 when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean()))
191 .thenReturn(createdTopic);
194 topicService.createTopic(dmaapContext, topicBean);
197 verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(),
199 verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class));
203 public void createTopic_shouldPassWithAAFauthorization_whenCadiIsEnabled_andTopicNameWithEnforcedPrefix() throws Exception {
205 String topicName = "org.onap.dmaap.mr.topic-4";
206 givenTopicBean(topicName);
208 Principal user = new UserPrincipal(){
210 public String getName(){
214 when(topicService.isCadiEnabled()).thenReturn(true);
215 when(httpServReq.isUserInRole(TOPIC_CREATE_PEM)).thenReturn(true);
216 when(httpServReq.getUserPrincipal()).thenReturn(user);
217 when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), eq("user"), anyInt(), anyInt(), anyBoolean()))
218 .thenReturn(createdTopic);
221 topicService.createTopic(dmaapContext, topicBean);
224 verify(httpServReq).isUserInRole(TOPIC_CREATE_PEM);
225 verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), eq("user"), anyInt(), anyInt(), anyBoolean());
226 verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class));
227 verify(topicService, never()).getDmaapAuthenticatedUser(dmaapContext);
231 public void createTopic_shouldFailWithAAFauthorization_whenCadiIsEnabled_andTopicNameWithEnforcedPrefix() throws Exception {
233 thrown.expect(DMaaPAccessDeniedException.class);
235 String topicName = "org.onap.dmaap.mr.topic-5";
236 givenTopicBean(topicName);
238 Principal user = new Principal(){
240 public String getName(){
244 when(topicService.isCadiEnabled()).thenReturn(true);
245 when(httpServReq.isUserInRole(TOPIC_CREATE_PEM)).thenReturn(false);
246 when(httpServReq.getUserPrincipal()).thenReturn(user);
249 topicService.createTopic(dmaapContext, topicBean);
252 verify(httpServReq).isUserInRole(TOPIC_CREATE_PEM);
253 verify(topicService, never()).getDmaapAuthenticatedUser(dmaapContext);
254 verifyZeroInteractions(dmaapKafkaMetaBroker);
255 verifyZeroInteractions(createdTopic);
259 public void createTopic_shouldThrowApiException_whenBrokerThrowsConfigDbException() throws Exception {
261 thrown.expect(CambriaApiException.class);
263 String topicName = "org.onap.dmaap.mr.topic-6";
264 givenTopicBean(topicName);
266 when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), any(), anyInt(), anyInt(), anyBoolean()))
267 .thenThrow(new ConfigDbException("fail"));
270 topicService.createTopic(dmaapContext, topicBean);
273 verifyZeroInteractions(createdTopic);
277 public void createTopic_shouldFailGracefully_whenTopicExistsExceptionOccurs() throws Exception {
279 String topicName = "org.onap.dmaap.mr.topic-7";
280 givenTopicBean(topicName);
282 when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean()))
283 .thenThrow(new Broker1.TopicExistsException("enfTopicNamePlusExtra"));
286 topicService.createTopic(dmaapContext, topicBean);
289 verifyZeroInteractions(createdTopic);
293 public void getValueOrDefault_shouldParseDeafultAndReturnIt_whenGivenValueIsZero() {
296 String defaultPropertyName = "propertyName";
297 when(topicService.getPropertyFromAJSCmap(defaultPropertyName)).thenReturn("6");
300 int extracted = topicService.getValueOrDefault(value, defaultPropertyName);
303 assertEquals(6, extracted);
307 public void getValueOrDefault_shouldReturnGivenValue_whenGreaterThanZero() {
310 String defaultPropertyName = "propertyName";
313 int extracted = topicService.getValueOrDefault(value, defaultPropertyName);
316 assertEquals(value, extracted);
317 verify(topicService, never()).getPropertyFromAJSCmap(defaultPropertyName);
321 public void getValueOrDefault_shouldParseDeafultAndReturnIt_whenGivenValueIsNegative() {
324 String defaultPropertyName = "propertyName";
325 when(topicService.getPropertyFromAJSCmap(defaultPropertyName)).thenReturn("6");
328 int extracted = topicService.getValueOrDefault(value, defaultPropertyName);
331 assertEquals(6, extracted);
335 public void getValueOrDefault_shouldReturnOne_whenGivenValueIsZero_andDefaultNotProvided() {
338 String defaultPropertyName = "propertyName";
339 when(topicService.getPropertyFromAJSCmap(defaultPropertyName)).thenReturn("");
342 int extracted = topicService.getValueOrDefault(value, defaultPropertyName);
345 assertEquals(1, extracted);
349 public void getValueOrDefault_shouldReturnOne_whenGivenValueIsZero_andDefaultNaN() {
352 String defaultPropertyName = "propertyName";
353 when(topicService.getPropertyFromAJSCmap(defaultPropertyName)).thenReturn("a");
356 int extracted = topicService.getValueOrDefault(value, defaultPropertyName);
359 assertEquals(1, extracted);
362 @Test(expected = TopicExistsException.class)
363 public void testGetTopics_null_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
364 TopicExistsException, JSONException, ConfigDbException {
366 Assert.assertNotNull(topicService);
367 when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);
369 topicService.getTopic(dmaapContext, "topicName");
373 public void testGetTopics_NonNull_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
374 TopicExistsException, JSONException, ConfigDbException {
376 Assert.assertNotNull(topicService);
378 when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(createdTopic);
380 when(createdTopic.getName()).thenReturn("topicName");
381 when(createdTopic.getDescription()).thenReturn("topicDescription");
382 when(createdTopic.getOwners()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));
384 when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
385 when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
387 topicService.getTopic(dmaapContext, "topicName");
390 @Test(expected = TopicExistsException.class)
391 public void testGetPublishersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
392 IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
394 Assert.assertNotNull(topicService);
396 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
398 topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
403 public void testGetPublishersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
404 IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
406 Assert.assertNotNull(topicService);
408 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
409 when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
410 topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
413 @Test(expected = TopicExistsException.class)
414 public void testGetConsumersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
415 IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
417 Assert.assertNotNull(topicService);
419 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
421 topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
426 public void testGetConsumersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
427 IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
429 Assert.assertNotNull(topicService);
431 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
433 when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
435 topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
439 public void testGetPublishersByTopicName() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
440 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
442 Assert.assertNotNull(topicService);
444 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
446 topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
449 @Test(expected = TopicExistsException.class)
450 public void testGetPublishersByTopicNameError() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
451 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
453 Assert.assertNotNull(topicService);
455 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
457 topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
461 public void deleteTopic_shouldDeleteTopic_whenUserAuthorizedWithAAF_andTopicExists() throws Exception {
463 String topicName = "org.onap.dmaap.mr.topic-9";
464 when(topicService.isCadiEnabled()).thenReturn(true);
465 when(httpServReq.isUserInRole(TOPIC_DELETE_PEM)).thenReturn(true);
466 when(dmaapKafkaMetaBroker.getTopic(topicName)).thenReturn(createdTopic);
469 topicService.deleteTopic(dmaapContext, topicName);
472 verify(httpServReq).isUserInRole(TOPIC_DELETE_PEM);
473 verify(topicService).respondOk(eq(dmaapContext), contains(topicName));
474 verify(topicService, never()).getDmaapAuthenticatedUser(dmaapContext);
478 public void deleteTopic_shouldSkipAAFauthorization_whenTopicNameNotEnforced() throws Exception {
480 String topicName = "UNAUTHENTICATED.PRH.READY";
481 when(topicService.isCadiEnabled()).thenReturn(true);
482 when(dmaapKafkaMetaBroker.getTopic(topicName)).thenReturn(createdTopic);
485 topicService.deleteTopic(dmaapContext, topicName);
488 verify(httpServReq, never()).isUserInRole(TOPIC_DELETE_PEM);
489 verify(topicService).respondOk(eq(dmaapContext), contains(topicName));
493 public void deleteTopic_shouldDeleteTopic_whenUserAuthorizedInContext_andTopicExists() throws Exception {
495 String topicName = "org.onap.dmaap.mr.topic-10";
496 when(dmaapKafkaMetaBroker.getTopic(topicName)).thenReturn(createdTopic);
499 topicService.deleteTopic(dmaapContext, topicName);
502 verify(httpServReq, never()).isUserInRole(TOPIC_DELETE_PEM);
503 verify(topicService).respondOk(eq(dmaapContext), contains(topicName));
507 public void deleteTopic_shouldNotDeleteTopic_whenUserNotAuthorizedByAAF() throws Exception {
509 String topicName = "org.onap.dmaap.mr.topic-10";
510 thrown.expect(DMaaPAccessDeniedException.class);
512 when(topicService.isCadiEnabled()).thenReturn(true);
513 when(httpServReq.isUserInRole(TOPIC_DELETE_PEM)).thenReturn(false);
516 topicService.deleteTopic(dmaapContext, topicName);
519 verify(httpServReq).isUserInRole(TOPIC_DELETE_PEM);
520 verify(topicService, never()).respondOk(eq(dmaapContext), anyString());
521 verify(topicService, never()).getDmaapAuthenticatedUser(dmaapContext);
525 public void deleteTopic_shouldNotDeleteTopic_whenTopicDoesNotExist() throws Exception {
527 String topicName = "org.onap.dmaap.mr.topic-10";
528 thrown.expect(TopicExistsException.class);
530 when(dmaapKafkaMetaBroker.getTopic(topicName)).thenReturn(null);
533 topicService.deleteTopic(dmaapContext, topicName);
536 verify(topicService, never()).respondOk(eq(dmaapContext), anyString());
540 public void testPermitConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
541 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
543 Assert.assertNotNull(topicService);
544 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
545 TopicBean topicBean = new TopicBean();
546 topicBean.setTopicName("enfTopicNamePlusExtra");
548 topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
551 @Test(expected = TopicExistsException.class)
552 public void testPermitConsumerForTopic_nulltopic()
553 throws DMaaPAccessDeniedException, CambriaApiException, IOException,
554 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
556 Assert.assertNotNull(topicService);
557 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
558 TopicBean topicBean = new TopicBean();
559 topicBean.setTopicName("enfTopicNamePlusExtra");
561 topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
565 public void testdenyConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
566 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
568 Assert.assertNotNull(topicService);
569 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
570 TopicBean topicBean = new TopicBean();
571 topicBean.setTopicName("enfTopicNamePlusExtra");
573 topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
576 @Test(expected = TopicExistsException.class)
577 public void testdenyConsumerForTopic_nulltopic()
578 throws DMaaPAccessDeniedException, CambriaApiException, IOException,
579 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
581 Assert.assertNotNull(topicService);
583 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
584 TopicBean topicBean = new TopicBean();
585 topicBean.setTopicName("enfTopicNamePlusExtra");
587 topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
592 public void testPermitPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
593 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
595 Assert.assertNotNull(topicService);
597 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
598 TopicBean topicBean = new TopicBean();
599 topicBean.setTopicName("enfTopicNamePlusExtra");
601 topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
604 @Test(expected = TopicExistsException.class)
605 public void testPermitPublisherForTopic_nulltopic()
606 throws DMaaPAccessDeniedException, CambriaApiException, IOException,
607 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
609 Assert.assertNotNull(topicService);
611 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
612 TopicBean topicBean = new TopicBean();
613 topicBean.setTopicName("enfTopicNamePlusExtra");
615 topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
619 public void testDenyPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
620 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
622 Assert.assertNotNull(topicService);
624 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
625 TopicBean topicBean = new TopicBean();
626 topicBean.setTopicName("enfTopicNamePlusExtra");
628 topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
632 @Test(expected = TopicExistsException.class)
633 public void testDenyPublisherForTopic_nulltopic()
634 throws DMaaPAccessDeniedException, CambriaApiException, IOException,
635 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
637 Assert.assertNotNull(topicService);
639 when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
640 TopicBean topicBean = new TopicBean();
641 topicBean.setTopicName("enfTopicNamePlusExtra");
643 topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
648 public void testGetAllTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
649 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
651 Assert.assertNotNull(topicService);
653 TopicBean topicBean = new TopicBean();
654 topicBean.setTopicName("enfTopicNamePlusExtra");
656 topicService.getAllTopics(dmaapContext);
660 public void testGetTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
661 TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
663 Assert.assertNotNull(topicService);
665 TopicBean topicBean = new TopicBean();
666 topicBean.setTopicName("enfTopicNamePlusExtra");
668 topicService.getTopics(dmaapContext);