add test cases after the kafka 11 upgrade changes
[dmaap/messagerouter/messageservice.git] / src / test / java / com / att / nsa / dmaap / service / TopicRestServiceTest.java
index 8778602..8ef1391 100644 (file)
@@ -23,9 +23,12 @@ package com.att.nsa.dmaap.service;
 import static org.junit.Assert.*;\r
 \r
 import static org.mockito.Matchers.anyString;\r
+import static org.mockito.Matchers.any;\r
 import static org.mockito.Mockito.when;\r
 \r
 import java.io.IOException;\r
+import java.util.ConcurrentModificationException;\r
+\r
 import javax.servlet.ServletOutputStream;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
@@ -47,20 +50,20 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;\r
 \r
 import com.att.ajsc.beans.PropertiesMapBean;\r
-import com.att.nsa.cambria.CambriaApiException;\r
-import com.att.nsa.cambria.beans.DMaaPContext;\r
-import com.att.nsa.cambria.beans.DMaaPKafkaMetaBroker;\r
-import com.att.nsa.cambria.beans.TopicBean;\r
-import com.att.nsa.cambria.constants.CambriaConstants;\r
-import com.att.nsa.cambria.exception.DMaaPAccessDeniedException;\r
-import com.att.nsa.cambria.exception.DMaaPErrorMessages;\r
-import com.att.nsa.cambria.metabroker.Broker.TopicExistsException;\r
-import com.att.nsa.cambria.metabroker.Topic;\r
-import com.att.nsa.cambria.security.DMaaPAAFAuthenticator;\r
-import com.att.nsa.cambria.security.DMaaPAuthenticator;\r
-import com.att.nsa.cambria.service.TopicService;\r
-import com.att.nsa.cambria.utils.ConfigurationReader;\r
-import com.att.nsa.cambria.utils.DMaaPResponseBuilder;\r
+import com.att.dmf.mr.CambriaApiException;\r
+import com.att.dmf.mr.beans.DMaaPContext;\r
+import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
+import com.att.dmf.mr.beans.TopicBean;\r
+import com.att.dmf.mr.constants.CambriaConstants;\r
+import com.att.dmf.mr.exception.DMaaPAccessDeniedException;\r
+import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
+import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
+import com.att.dmf.mr.metabroker.Topic;\r
+import com.att.dmf.mr.security.DMaaPAAFAuthenticator;\r
+import com.att.dmf.mr.security.DMaaPAuthenticator;\r
+import com.att.dmf.mr.service.TopicService;\r
+import com.att.dmf.mr.utils.ConfigurationReader;\r
+import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
 import com.att.nsa.configs.ConfigDbException;\r
 import com.att.nsa.security.NsaAcl;\r
 import com.att.nsa.security.NsaApiKey;\r
@@ -73,10 +76,10 @@ import com.att.nsa.security.db.simple.NsaSimpleApiKey;
 public class TopicRestServiceTest {\r
 \r
        @InjectMocks\r
-       TopicRestService topicService;\r
+       TopicRestService topicRestService;\r
 \r
        @Mock\r
-       private TopicService tService;\r
+       private TopicService topicService;\r
 \r
        private TopicRestService service = new TopicRestService();\r
        @Mock\r
@@ -137,7 +140,7 @@ public class TopicRestServiceTest {
        public void testGetTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -156,14 +159,14 @@ public class TopicRestServiceTest {
 \r
                when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);\r
 \r
-               topicService.getTopics();\r
+               topicRestService.getTopics();\r
        }\r
 \r
        @Test\r
        public void testGetTopics_nullAuth() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -182,13 +185,13 @@ public class TopicRestServiceTest {
 \r
                when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);\r
 \r
-               topicService.getTopics();\r
+               topicRestService.getTopics();\r
        }\r
 \r
        @Test\r
        public void testGetTopics_error() throws DMaaPAccessDeniedException, TopicExistsException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -207,13 +210,13 @@ public class TopicRestServiceTest {
 \r
                when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);\r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).getTopics(dmaapContext);\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).getTopics(any());\r
                } catch (JSONException | ConfigDbException | IOException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.getTopics();\r
+                       topicRestService.getTopics();\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -223,7 +226,7 @@ public class TopicRestServiceTest {
        public void testGetAllTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -238,14 +241,14 @@ public class TopicRestServiceTest {
 \r
                when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
 \r
-               topicService.getAllTopics();\r
+               topicRestService.getAllTopics();\r
        }\r
 \r
        @Test\r
        public void testGetAllTopics_nullAuth() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
                assertTrue(true);\r
@@ -259,13 +262,13 @@ public class TopicRestServiceTest {
 \r
                when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
 \r
-               topicService.getAllTopics();\r
+               topicRestService.getAllTopics();\r
        }\r
 \r
        @Test\r
        public void testGetAllTopics_error() throws DMaaPAccessDeniedException, TopicExistsException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
                assertTrue(true);\r
@@ -280,13 +283,13 @@ public class TopicRestServiceTest {
                when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).getAllTopics(dmaapContext);\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).getAllTopics(any());\r
                } catch (JSONException | ConfigDbException | IOException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.getAllTopics();\r
+                       topicRestService.getAllTopics();\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -296,7 +299,7 @@ public class TopicRestServiceTest {
        public void testGetTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -311,14 +314,14 @@ public class TopicRestServiceTest {
 \r
                when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
 \r
-               topicService.getTopic("topicName");\r
+               topicRestService.getTopic("topicName");\r
        }\r
 \r
        @Test\r
        public void testGetTopic_nullAuth() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -333,13 +336,13 @@ public class TopicRestServiceTest {
 \r
                when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
 \r
-               topicService.getTopic("topicName");\r
+               topicRestService.getTopic("topicName");\r
        }\r
 \r
        @Test\r
        public void testGetTopic_error() throws DMaaPAccessDeniedException, ConfigDbException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -355,13 +358,13 @@ public class TopicRestServiceTest {
                when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).getTopic(dmaapContext, "topicName");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).getTopic(any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.getTopic("topicName");\r
+                       topicRestService.getTopic("topicName");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -371,7 +374,7 @@ public class TopicRestServiceTest {
        public void testCreateTopic()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -381,13 +384,13 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.createTopic(topicBean);\r
+               topicRestService.createTopic(topicBean);\r
        }\r
 \r
        @Test\r
        public void testCreateTopic_error() {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -398,7 +401,7 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).createTopic(dmaapContext, topicBean);\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).createTopic(any(), any());\r
                } catch (TopicExistsException | IOException | AccessDeniedException | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                } catch (CambriaApiException excp) {\r
@@ -406,13 +409,13 @@ public class TopicRestServiceTest {
                }\r
 \r
                try {\r
-                       topicService.createTopic(topicBean);\r
+                       topicRestService.createTopic(topicBean);\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
 \r
                try {\r
-                       PowerMockito.doThrow(new TopicExistsException("error")).when(tService).createTopic(dmaapContext, topicBean);\r
+                       PowerMockito.doThrow(new TopicExistsException("error")).when(topicService).createTopic(any(), any());\r
                } catch (TopicExistsException | IOException | AccessDeniedException | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                } catch (CambriaApiException excp) {\r
@@ -420,13 +423,13 @@ public class TopicRestServiceTest {
                }\r
 \r
                try {\r
-                       topicService.createTopic(topicBean);\r
+                       topicRestService.createTopic(topicBean);\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
 \r
                try {\r
-                       PowerMockito.doThrow(new AccessDeniedException()).when(tService).createTopic(dmaapContext, topicBean);\r
+                       PowerMockito.doThrow(new AccessDeniedException()).when(topicService).createTopic(any(), any());\r
                } catch (TopicExistsException | IOException | AccessDeniedException | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                } catch (CambriaApiException excp) {\r
@@ -434,7 +437,7 @@ public class TopicRestServiceTest {
                }\r
 \r
                try {\r
-                       topicService.createTopic(topicBean);\r
+                       topicRestService.createTopic(topicBean);\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -444,7 +447,7 @@ public class TopicRestServiceTest {
        public void testDeleteTopic()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -454,14 +457,14 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.deleteTopic("enfTopicNamePlusExtra");\r
+               topicRestService.deleteTopic("enfTopicNamePlusExtra");\r
        }\r
 \r
        @Test\r
        public void testDeleteTopic_error()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -472,28 +475,28 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).deleteTopic(dmaapContext, "enfTopicNamePlusExtra");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).deleteTopic(any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.deleteTopic("enfTopicNamePlusExtra");\r
+                       topicRestService.deleteTopic("enfTopicNamePlusExtra");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
 \r
                try {\r
-                       PowerMockito.doThrow(new AccessDeniedException()).when(tService).deleteTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra");\r
+                       PowerMockito.doThrow(new AccessDeniedException()).when(topicService).deleteTopic(any(),\r
+                                       any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.deleteTopic("enfTopicNamePlusExtra");\r
+                       topicRestService.deleteTopic("enfTopicNamePlusExtra");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -503,7 +506,7 @@ public class TopicRestServiceTest {
        public void testGetPublishersByTopicName()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -513,13 +516,13 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.getPublishersByTopicName("enfTopicNamePlusExtra");\r
+               topicRestService.getPublishersByTopicName("enfTopicNamePlusExtra");\r
        }\r
 \r
        @Test\r
        public void testGetPublishersByTopicName_error() {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -530,14 +533,14 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).getPublishersByTopicName(dmaapContext,\r
-                                       "enfTopicNamePlusExtra");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).getPublishersByTopicName(any(),\r
+                                       any());\r
                } catch (TopicExistsException | ConfigDbException | IOException e) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.getPublishersByTopicName("enfTopicNamePlusExtra");\r
+                       topicRestService.getPublishersByTopicName("enfTopicNamePlusExtra");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -547,24 +550,24 @@ public class TopicRestServiceTest {
        public void testPermitPublisherForTopic()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-               when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
+               when(dmaaPAuthenticator.authenticate(any())).thenReturn(nsaSimpleApiKey);\r
                when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
                when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
 \r
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.permitPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
+               topicRestService.permitPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
        }\r
 \r
        @Test\r
        public void testPermitPublisherForTopic_error()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -575,29 +578,29 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).permitPublisherForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "producerID");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).permitPublisherForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.permitPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
+                       topicRestService.permitPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
 \r
                try {\r
-                       PowerMockito.doThrow(new AccessDeniedException()).when(tService).permitPublisherForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "producerID");\r
+                       PowerMockito.doThrow(new AccessDeniedException()).when(topicService).permitPublisherForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.permitPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
+                       topicRestService.permitPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -607,7 +610,7 @@ public class TopicRestServiceTest {
        public void testDenyPublisherForTopic()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -617,14 +620,14 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.denyPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
+               topicRestService.denyPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
        }\r
 \r
        @Test\r
        public void testDenyPublisherForTopic_error()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -635,29 +638,29 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).denyPublisherForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "producerID");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).denyPublisherForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.denyPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
+                       topicRestService.denyPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
 \r
                try {\r
-                       PowerMockito.doThrow(new AccessDeniedException()).when(tService).denyPublisherForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "producerID");\r
+                       PowerMockito.doThrow(new AccessDeniedException()).when(topicService).denyPublisherForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.denyPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
+                       topicRestService.denyPublisherForTopic("enfTopicNamePlusExtra", "producerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -668,7 +671,7 @@ public class TopicRestServiceTest {
        public void testGetConsumersByTopicName() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -678,14 +681,14 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.getConsumersByTopicName("enfTopicNamePlusExtra");\r
+               topicRestService.getConsumersByTopicName("enfTopicNamePlusExtra");\r
        }\r
 \r
        @Test\r
        public void testGetConsumersByTopicName_error() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -696,14 +699,14 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).getConsumersByTopicName(dmaapContext,\r
-                                       "enfTopicNamePlusExtra");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).getConsumersByTopicName(any(),\r
+                                       any());\r
                } catch (TopicExistsException | ConfigDbException | IOException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.getConsumersByTopicName("enfTopicNamePlusExtra");\r
+                       topicRestService.getConsumersByTopicName("enfTopicNamePlusExtra");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -713,27 +716,27 @@ public class TopicRestServiceTest {
        public void testPermitConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-               when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
+               when(dmaaPAuthenticator.authenticate(any())).thenReturn(nsaSimpleApiKey);\r
                when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
                when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
 \r
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.permitConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
+               topicRestService.permitConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
        }\r
 \r
        @Test\r
        public void testPermitConsumerForTopic_error() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-               when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
+               when(dmaaPAuthenticator.authenticate(any())).thenReturn(nsaSimpleApiKey);\r
                when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
                when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
 \r
@@ -741,15 +744,15 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).permitConsumerForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "consumerID");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).permitConsumerForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.permitConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
+                       topicRestService.permitConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
@@ -759,7 +762,7 @@ public class TopicRestServiceTest {
        public void testPermitConsumerForTopicWithException() throws DMaaPAccessDeniedException, CambriaApiException,\r
                        IOException, TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -769,14 +772,14 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.permitConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
+               topicRestService.permitConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
        }\r
 \r
        @Test\r
        public void testDenyConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -786,14 +789,14 @@ public class TopicRestServiceTest {
                TopicBean topicBean = new TopicBean();\r
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
-               topicService.denyConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
+               topicRestService.denyConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
        }\r
 \r
        @Test\r
        public void testDenyConsumerForTopic_error() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, AccessDeniedException {\r
 \r
-               Assert.assertNotNull(topicService);\r
+               Assert.assertNotNull(topicRestService);\r
 \r
                when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
                when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
@@ -804,29 +807,29 @@ public class TopicRestServiceTest {
                topicBean.setTopicName("enfTopicNamePlusExtra");\r
 \r
                try {\r
-                       PowerMockito.doThrow(new IOException()).when(tService).denyConsumerForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "consumerID");\r
+                       PowerMockito.doThrow(new IOException()).when(topicService).denyConsumerForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.denyConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
+                       topicRestService.denyConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r
 \r
                try {\r
-                       PowerMockito.doThrow(new AccessDeniedException()).when(tService).denyConsumerForTopic(dmaapContext,\r
-                                       "enfTopicNamePlusExtra", "consumerID");\r
+                       PowerMockito.doThrow(new AccessDeniedException()).when(topicService).denyConsumerForTopic(any(),\r
+                                       any(), any());\r
                } catch (TopicExistsException | ConfigDbException | IOException | AccessDeniedException\r
                                | DMaaPAccessDeniedException excp) {\r
                        assertTrue(false);\r
                }\r
 \r
                try {\r
-                       topicService.denyConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
+                       topicRestService.denyConsumerForTopic("enfTopicNamePlusExtra", "consumerID");\r
                } catch (CambriaApiException excp) {\r
                        assertTrue(true);\r
                }\r