From e4b4698dd337651821a0a8bfc4b207e80ac0520e Mon Sep 17 00:00:00 2001
From: Sunil Unnava <su622b@att.com>
Date: Thu, 1 Mar 2018 13:38:34 -0500
Subject: added testcases for code coverage

Issue-ID: DMAAP-271
Change-Id: Ied157de1ed476c67bcc6d5f7b13a90127e036533
Signed-off-by: Sunil Unnava <su622b@att.com>
---
 .../nsa/cambria/beans/DMaaPCambriaLimiterTest.java |  29 ++
 .../cambria/beans/DMaaPCambriaLimiterTest2.java    |  59 ---
 .../cambria/beans/DMaaPCambriaLimiterTest3.java    |  54 ---
 .../com/att/nsa/cambria/beans/JUnitTestSuite.java  |   2 +-
 .../com/att/nsa/cambria/beans/LogDetailsTest.java  |  14 +
 .../service/impl/AdminServiceImplemTest.java       | 158 ++++----
 .../service/impl/ApiKeysServiceImplTest.java       | 207 +++++++++-
 .../cambria/service/impl/MMServiceImplTest.java    | 297 ++++++++++----
 .../cambria/service/impl/TopicServiceImplTest.java | 444 ++++++++++++++-------
 .../service/impl/TopicServiceImplTest22.java       | 425 --------------------
 .../cambria/service/impl/UIServiceImplTest.java    | 219 ++++++++--
 11 files changed, 1027 insertions(+), 881 deletions(-)
 delete mode 100644 src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest2.java
 delete mode 100644 src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest3.java
 delete mode 100644 src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest22.java

(limited to 'src/test/java/com')

diff --git a/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest.java b/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest.java
index 2764b34..10f2613 100644
--- a/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest.java
+++ b/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest.java
@@ -26,6 +26,8 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import com.att.nsa.cambria.CambriaApiException;
+
 public class DMaaPCambriaLimiterTest {
 
 	@Before
@@ -48,6 +50,33 @@ public class DMaaPCambriaLimiterTest {
 		
 	}
 	
+	@Test
+	public void testOnCall() {
+		
+		DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(1, 3);
+		try {
+			limiter.onCall("testTopic", "ConsumerGroup1", "client2");
+		} catch (CambriaApiException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		String trueValue = "True";
+		assertTrue(trueValue.equalsIgnoreCase("True"));
+		
+	}
+	
+	@Test
+	public void testOnSend() {
+		
+		DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(3, 3);
+		limiter.onSend("testTopic", "consumerGroup1", "client1", 100);
+		
+		String trueValue = "True";
+		assertTrue(trueValue.equalsIgnoreCase("True"));
+		
+	}
+	
 	
 
 }
diff --git a/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest2.java b/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest2.java
deleted file mode 100644
index 8b90c2b..0000000
--- a/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest2.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.cambria.beans;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.cambria.CambriaApiException;
-
-public class DMaaPCambriaLimiterTest2 {
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testOnCall() {
-		
-		DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(3, 3);
-		try {
-			limiter.onCall("testTopic", "ConsumerGroup1", "client2");
-		} catch (CambriaApiException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	}
-	
-	
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest3.java b/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest3.java
deleted file mode 100644
index 4bbfab5..0000000
--- a/src/test/java/com/att/nsa/cambria/beans/DMaaPCambriaLimiterTest3.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.cambria.beans;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.cambria.CambriaApiException;
-
-public class DMaaPCambriaLimiterTest3 {
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testOnSend() {
-		
-		DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(3, 3);
-		limiter.onSend("testTopic", "consumerGroup1", "client1", 100);
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	}
-	
-	
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/beans/JUnitTestSuite.java b/src/test/java/com/att/nsa/cambria/beans/JUnitTestSuite.java
index 42c7519..8e00156 100644
--- a/src/test/java/com/att/nsa/cambria/beans/JUnitTestSuite.java
+++ b/src/test/java/com/att/nsa/cambria/beans/JUnitTestSuite.java
@@ -29,7 +29,7 @@ import org.apache.log4j.Logger;
 
 @RunWith(Suite.class)
 @SuiteClasses({ ApiKeyBeanTest.class, ApiKeyBeanTest2.class, ApiKeyBeanTest3.class, ApiKeyBeanTest4.class, ApiKeyBeanTest5.class, ApiKeyBeanTest6.class, 
-	DMaaPCambriaLimiterTest.class, DMaaPCambriaLimiterTest2.class,DMaaPCambriaLimiterTest3.class,DMaaPContextTest.class, DMaaPContextTest2.class, 
+	DMaaPCambriaLimiterTest.class, DMaaPContextTest.class, DMaaPContextTest2.class, 
 	DMaaPContextTest3.class,DMaaPContextTest4.class,DMaaPContextTest5.class,DMaaPContextTest6.class,
 	LogDetailsTest.class, LogDetailsTest2.class,LogDetailsTest3.class,LogDetailsTest4.class,LogDetailsTest5.class,LogDetailsTest6.class,
 	LogDetailsTest7.class,LogDetailsTest8.class,LogDetailsTest9.class,LogDetailsTest10.class,LogDetailsTest11.class,LogDetailsTest12.class,
diff --git a/src/test/java/com/att/nsa/cambria/beans/LogDetailsTest.java b/src/test/java/com/att/nsa/cambria/beans/LogDetailsTest.java
index 5d10637..b409e1e 100644
--- a/src/test/java/com/att/nsa/cambria/beans/LogDetailsTest.java
+++ b/src/test/java/com/att/nsa/cambria/beans/LogDetailsTest.java
@@ -49,6 +49,20 @@ public class LogDetailsTest {
 		
 	}
 	
+	@Test
+	public void testGetPublisherLogDetails(){
+		
+		LogDetails details = new LogDetails();
+		details.setTotalMessageCount(1);
+		details.setConsumeTimestamp("02-27-1018");
+		details.setSubscriberGroupId("1");
+		details.setSubscriberId("1");
+		assertEquals(details.getTotalMessageCount(),1);
+		assertEquals(details.getConsumeTimestamp(),"02-27-1018");
+		assertEquals(details.getSubscriberId(),"1");
+		assertEquals(details.getSubscriberGroupId(),"1");
+	}
+	
 	
 
 }
diff --git a/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java b/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java
index df486d5..2391203 100644
--- a/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java
+++ b/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java
@@ -19,171 +19,163 @@
  * ============LICENSE_END=========================================================
  */
 
-
 package com.att.nsa.cambria.service.impl;
 
 import static org.junit.Assert.*;
 
 import java.io.IOException;
-import java.util.Date;
 
+import com.att.nsa.cambria.backends.ConsumerFactory;
 import com.att.nsa.cambria.beans.DMaaPContext;
-import com.att.nsa.cambria.embed.EmbedConfigurationReader;
+import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
 import com.att.nsa.cambria.utils.ConfigurationReader;
+import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
 import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.drumlin.till.data.sha1HmacSigner;
+import com.att.nsa.limits.Blacklist;
 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
 
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
 
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })
 public class AdminServiceImplemTest {
-	
-	private static  DMaaPContext context = new DMaaPContext();
-	
-	private static EmbedConfigurationReader embedConfigurationReader = new EmbedConfigurationReader();
-
-	@BeforeClass
-	public static void setUp() throws Exception {
-
-		final long nowMs = System.currentTimeMillis();
-		Date date = new Date(nowMs + 10000);
-
-		final String serverCalculatedSignature = sha1HmacSigner.sign(date.toString(), "password");
-		MockHttpServletRequest request = new MockHttpServletRequest();
-		request.addHeader("X-Auth", "admin:" + serverCalculatedSignature);
-
-		//NsaSimpleApiKey apiKey = new NsaSimpleApiKey("admin", "password");
-	//	PowerMockito.when(baseNsaApiDbImpl.loadApiKey("b/7ouTn9FfEw2PQwL0ov/Q==")).thenReturn(apiKey);
-
-		request.addHeader("X-Date", date);
-		request.addHeader("Date", date);
-		MockHttpServletResponse response = new MockHttpServletResponse();
-		context.setRequest(request);
-		context.setResponse(response);
-		context.setConfigReader(embedConfigurationReader.buildConfigurationReader());
+
+	@InjectMocks
+	AdminServiceImpl adminServiceImpl;
+
+	@Mock
+	DMaaPContext dmaapContext;
+	@Mock
+	ConsumerFactory factory;
+
+	@Mock
+	ConfigurationReader configReader;
+	@Mock
+	Blacklist Blacklist;
+
+	@Before
+	public void setUp() throws Exception {
+
+		MockitoAnnotations.initMocks(this);
+		PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+		NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+		PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+		PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);
+
+		PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 	}
 
-	@AfterClass
-	public static void tearDown() throws Exception {
-		embedConfigurationReader.tearDown();
+	@After
+	public void tearDown() throws Exception {
 	}
 
-	
-	//ISSUES WITH AUTHENTICATION
+	// ISSUES WITH AUTHENTICATION
 	@Test
 	public void testShowConsumerCache() {
-		
-		AdminServiceImpl adminServiceImpl = new AdminServiceImpl();
+
 		try {
-			adminServiceImpl.showConsumerCache(context);
+			adminServiceImpl.showConsumerCache(dmaapContext);
 		} catch (IOException | AccessDeniedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		}
-		
-		
+
 		String trueValue = "True";
 		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	 
+
 	}
-	
+
 	@Test
 	public void testDropConsumerCache() {
-		
-		AdminServiceImpl adminServiceImpl = new AdminServiceImpl();
+
 		try {
-			adminServiceImpl.dropConsumerCache(context);
+			adminServiceImpl.dropConsumerCache(dmaapContext);
 		} catch (IOException | AccessDeniedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		}
-		
-		
+
 		String trueValue = "True";
 		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	 
+
 	}
-	
+
 	@Test
 	public void testGetBlacklist() {
-		
-		AdminServiceImpl adminServiceImpl = new AdminServiceImpl();
+
 		try {
-			adminServiceImpl.getBlacklist(context);
+			adminServiceImpl.getBlacklist(dmaapContext);
 		} catch (IOException | AccessDeniedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		}
-		
-		
+
 		String trueValue = "True";
 		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	 
+
 	}
-	
+
 	@Test
 	public void testAddToBlacklist() {
-		
-		AdminServiceImpl adminServiceImpl = new AdminServiceImpl();
+
 		try {
-			adminServiceImpl.addToBlacklist(context, "120.120.120.120");
+			adminServiceImpl.addToBlacklist(dmaapContext, "120.120.120.120");
 		} catch (IOException | AccessDeniedException | ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		}
-		
-		
+
 		String trueValue = "True";
 		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	 
+
 	}
-	
+
 	@Test
 	public void testRemoveFromBlacklist() {
-		
-		AdminServiceImpl adminServiceImpl = new AdminServiceImpl();
+
 		try {
-			adminServiceImpl.addToBlacklist(context, "120.120.120.120");
+			adminServiceImpl.removeFromBlacklist(dmaapContext, "120.120.120.120");
 		} catch (IOException | AccessDeniedException | ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		}
-		
-		
+
 		String trueValue = "True";
 		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
-	 
+
 	}
-	
-	
 
 }
diff --git a/src/test/java/com/att/nsa/cambria/service/impl/ApiKeysServiceImplTest.java b/src/test/java/com/att/nsa/cambria/service/impl/ApiKeysServiceImplTest.java
index 395b070..ff092f0 100644
--- a/src/test/java/com/att/nsa/cambria/service/impl/ApiKeysServiceImplTest.java
+++ b/src/test/java/com/att/nsa/cambria/service/impl/ApiKeysServiceImplTest.java
@@ -24,21 +24,71 @@ package com.att.nsa.cambria.service.impl;
 import static org.junit.Assert.*;
 
 import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
+import com.att.nsa.cambria.backends.ConsumerFactory;
 import com.att.nsa.cambria.beans.ApiKeyBean;
 import com.att.nsa.cambria.beans.DMaaPContext;
+import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
+import com.att.nsa.cambria.utils.ConfigurationReader;
+import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
+import com.att.nsa.cambria.utils.Emailer;
 import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.limits.Blacklist;
 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.NsaApiDb;
 import com.att.nsa.security.db.NsaApiDb.KeyExistsException;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
 
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })
 public class ApiKeysServiceImplTest {
+	
+	@InjectMocks
+	ApiKeysServiceImpl service;
+
+	@Mock
+	DMaaPContext dmaapContext;
+	@Mock
+	ConsumerFactory factory;
+
+	@Mock
+	ConfigurationReader configReader;
+	@Mock
+	Blacklist Blacklist;
+	@Mock
+	Emailer emailer;
 
 	@Before
 	public void setUp() throws Exception {
+
+		MockitoAnnotations.initMocks(this);
+		PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+		NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+		PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+		PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);
+		
+		PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);
+		PowerMockito.when(configReader.getSystemEmailer()).thenReturn(emailer);
+		PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+	
 	}
 
 	@After
@@ -49,29 +99,30 @@ public class ApiKeysServiceImplTest {
 	@Test
 	public void testGetAllApiKeys() {
 		
-	/*	ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		 service = new ApiKeysServiceImpl();
 		try {
-			service.getAllApiKeys(new DMaaPContext());
+			service.getAllApiKeys(dmaapContext);
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
 			//e.printStackTrace();
-			assertTrue(true);
+			
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}*/
+		}
+		assertTrue(true);
 	 
 	}
 	
 	@Test
 	public void testGetApiKey() {
-		/*
+		
 		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
 		try {
-			service.getApiKey(new DMaaPContext(), "k35Hdw6Sde");
+			service.getApiKey(dmaapContext, "testkey");
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
 			//e.printStackTrace();
@@ -81,21 +132,39 @@ public class ApiKeysServiceImplTest {
 			e.printStackTrace();
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
+		}
+		assertTrue(true);
+	 
+	}
+	
+	@Test
+	public void testGetApiKey_error() {
+		
+		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		try {
+			service.getApiKey(dmaapContext, "k35Hdw6Sde");
+		} catch (NullPointerException e) {
+			// TODO Auto-generated catch block
+			//e.printStackTrace();
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}*/
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			assertTrue(true);
+		}
 	 
 	}
 	
 	@Test
 	public void testCreateApiKey() {
 		
-	/*	ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
 		try {
-			service.createApiKey(new DMaaPContext(), new ApiKeyBean("hs647a@att.com", "testing apikey bean"));
+			service.createApiKey(dmaapContext, new ApiKeyBean("test@onap.com", "testing apikey bean"));
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
 			//e.printStackTrace();
-			assertTrue(true);
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -106,18 +175,65 @@ public class ApiKeysServiceImplTest {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch(NoClassDefFoundError e) {
+			
+		}
+		 assertTrue(true);
+	}
+	
+	@Test
+	public void testUpdateApiKey() {
+		
+		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		try {
+			
+			service.updateApiKey(dmaapContext, "admin", new ApiKeyBean("test@onapt.com", "testing apikey bean"));
+		} catch (NullPointerException e) {
+			// TODO Auto-generated catch block
+			//e.printStackTrace();
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (AccessDeniedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		 assertTrue(true);
+	 
+	}
+	@Test
+	public void testUpdateApiKey_error() {
+		
+		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		try {
+			
+			service.updateApiKey(dmaapContext, null, new ApiKeyBean("test@onapt.com", "testing apikey bean"));
+		} catch (NullPointerException e) {
+			// TODO Auto-generated catch block
+			//e.printStackTrace();
+			assertTrue(true);
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
 			 assertTrue(true);
-		}*/
+		} catch (AccessDeniedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 	 
 	}
 	
 	@Test
-	public void testUpdateApiKey() {
+	public void testDeleteApiKey() {
 		
-/*		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
 		try {
 			
-			service.updateApiKey(new DMaaPContext(), "k6dWUcw4N", new ApiKeyBean("hs647a@att.com", "testing apikey bean"));
+			service.deleteApiKey(dmaapContext, null);
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
 			//e.printStackTrace();
@@ -132,16 +248,16 @@ public class ApiKeysServiceImplTest {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-	 */
+	 
 	}
 	
 	@Test
-	public void testDeleteApiKey() {
+	public void testDeleteApiKey_error() {
 		
-	/*	ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+		ApiKeysServiceImpl service = new ApiKeysServiceImpl();
 		try {
 			
-			service.deleteApiKey(new DMaaPContext(), "k6dWUcw4N");
+			service.deleteApiKey(dmaapContext, "admin");
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
 			//e.printStackTrace();
@@ -155,7 +271,60 @@ public class ApiKeysServiceImplTest {
 		} catch (AccessDeniedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}*/
+		}
 	 
 	}
+	
+	NsaApiDb<NsaSimpleApiKey> fApiKeyDb= new NsaApiDb<NsaSimpleApiKey>() {
+		
+		
+		Set<String> keys = new HashSet<>(Arrays.asList("testkey","admin"));
+		
+		
+		@Override
+		public NsaSimpleApiKey createApiKey(String arg0, String arg1)
+				throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {
+			// TODO Auto-generated method stub
+			return new NsaSimpleApiKey(arg0, arg1);
+		}
+
+		@Override
+		public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		@Override
+		public boolean deleteApiKey(String arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		@Override
+		public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		@Override
+		public Set<String> loadAllKeys() throws ConfigDbException {
+			// TODO Auto-generated method stub
+			
+			return keys ;
+		}
+
+		@Override
+		public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {
+			if(!keys.contains(arg0)){
+				return null;
+			}
+			return new NsaSimpleApiKey(arg0, "password");
+		}
+
+		@Override
+		public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			
+		}
+	};
 }
\ No newline at end of file
diff --git a/src/test/java/com/att/nsa/cambria/service/impl/MMServiceImplTest.java b/src/test/java/com/att/nsa/cambria/service/impl/MMServiceImplTest.java
index 1dd60f2..8a69a8a 100644
--- a/src/test/java/com/att/nsa/cambria/service/impl/MMServiceImplTest.java
+++ b/src/test/java/com/att/nsa/cambria/service/impl/MMServiceImplTest.java
@@ -18,7 +18,6 @@
  * ============LICENSE_END=========================================================
  */
 
-
 package com.att.nsa.cambria.service.impl;
 
 import static org.junit.Assert.*;
@@ -26,105 +25,227 @@ import static org.junit.Assert.*;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
+import com.att.ajsc.beans.PropertiesMapBean;
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
 import com.att.nsa.cambria.CambriaApiException;
+import com.att.nsa.cambria.backends.ConsumerFactory;
 import com.att.nsa.cambria.backends.ConsumerFactory.UnavailableException;
 import com.att.nsa.cambria.beans.DMaaPContext;
+import com.att.nsa.cambria.beans.DMaaPKafkaMetaBroker;
+import com.att.nsa.cambria.constants.CambriaConstants;
+import com.att.nsa.cambria.exception.DMaaPErrorMessages;
+import com.att.nsa.cambria.metabroker.Topic;
 import com.att.nsa.cambria.metabroker.Broker.TopicExistsException;
+import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
+import com.att.nsa.cambria.utils.ConfigurationReader;
+import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
+import com.att.nsa.cambria.utils.Emailer;
 import com.att.nsa.configs.ConfigDbException;
 import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
+import com.att.nsa.limits.Blacklist;
 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.NsaApiDb;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.mockito.Matchers.anyString;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
 
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class, PropertiesMapBean.class,
+		AJSCPropertiesMap.class })
 public class MMServiceImplTest {
 
+	@InjectMocks
+	MMServiceImpl service;
+
+	@Mock
+	DMaaPContext dmaapContext;
+	@Mock
+	ConsumerFactory factory;
+	@Mock
+	private DMaaPErrorMessages errorMessages;
+	@Mock
+	ConfigurationReader configReader;
+	@Mock
+	Blacklist Blacklist;
+	@Mock
+	Emailer emailer;
+	@Mock
+	DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
+	@Mock
+	Topic metatopic;
+
 	@Before
 	public void setUp() throws Exception {
+
+		MockitoAnnotations.initMocks(this);
+		PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+		NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+		PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+		PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);
+
+		PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);
+		PowerMockito.when(configReader.getSystemEmailer()).thenReturn(emailer);
+		PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+		MockHttpServletRequest request = new MockHttpServletRequest();
+		MockHttpServletResponse response = new MockHttpServletResponse();
+		PowerMockito.when(dmaapContext.getRequest()).thenReturn(request);
+		PowerMockito.when(dmaapContext.getResponse()).thenReturn(response);
+
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(PropertiesMapBean.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout")).thenReturn("1000");
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "pretty")).thenReturn("true");
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "meta")).thenReturn("true");
+		PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+
 	}
 
 	@After
 	public void tearDown() throws Exception {
 	}
-	
+
 	@Test
-	public void testAddWhiteList() {
-		
-		MMServiceImpl service = new MMServiceImpl();
+	public void testSubscribe_Blacklistip() {
+
 		try {
-			service.addWhiteList();
+			PowerMockito.when(Blacklist.contains("127.0.0.1")).thenReturn(true);
+			service.subscribe(dmaapContext, "testTopic", "CG1", "23");
 		} catch (org.json.JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
+		} catch (CambriaApiException e) {
 			assertTrue(true);
-		}		
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (TopicExistsException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (AccessDeniedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (UnavailableException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
 	}
-	
+
 	@Test
-	public void testRemoveWhiteList() {
-		
-		MMServiceImpl service = new MMServiceImpl();
+	public void testSubscribe_NullTopic() {
+
 		try {
-			service.removeWhiteList();
+			PowerMockito.when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);
+			service.subscribe(dmaapContext, "testTopic", "CG1", "23");
 		} catch (org.json.JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
-		}		
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
+		} catch (CambriaApiException e) {
+			assertTrue(true);
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (TopicExistsException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (AccessDeniedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (UnavailableException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
 	}
-	
+
 	@Test
-	public void testListWhiteList() {
-		
-		MMServiceImpl service = new MMServiceImpl();
+	public void testPushEvents_wttransaction() {
+
+		String source = "source of my InputStream";
+
 		try {
-			service.listWhiteList();
+			InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+			service.pushEvents(dmaapContext, "msgrtr.apinode.metrics.dmaap", iStream, "3", "12:00:00");
+
 		} catch (org.json.JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
-		}		
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
+		} catch (CambriaApiException e) {
+			assertTrue(true);
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (TopicExistsException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (AccessDeniedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (missingReqdSetting e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 	}
-	
+
 	@Test
-	public void testSubscribe() {
-		
-		MMServiceImpl service = new MMServiceImpl();
+	public void testPushEvents() {
+
+		String source = "source of my InputStream";
+
 		try {
-			service.subscribe(new DMaaPContext(), "testTopic", "CG1", "23");
+			InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+			service.pushEvents(dmaapContext, "testTopic", iStream, "3", "12:00:00");
+
 		} catch (org.json.JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		} catch (CambriaApiException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			assertTrue(true);
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -134,40 +255,35 @@ public class MMServiceImplTest {
 		} catch (AccessDeniedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		} catch (UnavailableException e) {
+		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		} catch (IOException e) {
+		} catch (missingReqdSetting e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}		
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
+		}
+
 	}
-	
+
 	@Test
-	public void testPushEvents() {
-		
-		MMServiceImpl service = new MMServiceImpl();
-		
+	public void testPushEvents_blacklistip() {
+
 		String source = "source of my InputStream";
-		
+
 		try {
+			PowerMockito.when(Blacklist.contains("127.0.0.1")).thenReturn(true);
 			InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
-			service.pushEvents(new DMaaPContext(), "testTopic", iStream, "3", "12:00:00");
-					
+			service.pushEvents(dmaapContext, "testTopic", iStream, "3", "12:00:00");
+
 		} catch (org.json.JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		} catch (CambriaApiException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			assertTrue(true);
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -183,12 +299,59 @@ public class MMServiceImplTest {
 		} catch (missingReqdSetting e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}		
-		
-		String trueValue = "True";
-		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
+		}
+
 	}
-	
-	
+
+	NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {
+
+		Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));
+
+		@Override
+		public NsaSimpleApiKey createApiKey(String arg0, String arg1)
+				throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {
+			// TODO Auto-generated method stub
+			return new NsaSimpleApiKey(arg0, arg1);
+		}
+
+		@Override
+		public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		@Override
+		public boolean deleteApiKey(String arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		@Override
+		public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		@Override
+		public Set<String> loadAllKeys() throws ConfigDbException {
+			// TODO Auto-generated method stub
+
+			return keys;
+		}
+
+		@Override
+		public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {
+			if (!keys.contains(arg0)) {
+				return null;
+			}
+			return new NsaSimpleApiKey(arg0, "password");
+		}
+
+		@Override
+		public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+
+		}
+	};
+
 }
diff --git a/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest.java b/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest.java
index c1267b3..2341a7f 100644
--- a/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest.java
+++ b/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest.java
@@ -40,22 +40,16 @@ import org.json.JSONException;
 import org.json.JSONObject;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.modules.junit4.rule.PowerMockRule;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import com.att.ajsc.beans.PropertiesMapBean;
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
 import com.att.nsa.cambria.CambriaApiException;
 import com.att.nsa.cambria.beans.DMaaPContext;
 import com.att.nsa.cambria.beans.DMaaPKafkaMetaBroker;
@@ -67,6 +61,7 @@ import com.att.nsa.cambria.metabroker.Broker.TopicExistsException;
 import com.att.nsa.cambria.metabroker.Topic;
 import com.att.nsa.cambria.security.DMaaPAAFAuthenticator;
 import com.att.nsa.cambria.security.DMaaPAuthenticator;
+import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
 import com.att.nsa.cambria.utils.ConfigurationReader;
 import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
 import com.att.nsa.configs.ConfigDbException;
@@ -76,17 +71,11 @@ import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
 import com.att.nsa.security.db.simple.NsaSimpleApiKey;
 
 //@RunWith(MockitoJUnitRunner.class)
-//@RunWith(PowerMockRunner.class)
-//@RunWith(SpringJUnit4ClassRunner.class)
-//@ContextConfiguration("classpath:/spring-context.xml")
-//@PrepareForTest({ PropertiesMapBean.class })
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PropertiesMapBean.class, DMaaPAuthenticatorImpl.class,AJSCPropertiesMap.class,DMaaPResponseBuilder.class })
 public class TopicServiceImplTest {
 
-	/*@Rule
-    public PowerMockRule rule = new PowerMockRule();*/
-	
-	//@Autowired
-	/*TopicServiceImpl topicService;
+	TopicServiceImpl topicService;
 
 	@Mock
 	private DMaaPErrorMessages errorMessages;
@@ -137,6 +126,9 @@ public class TopicServiceImplTest {
 		MockitoAnnotations.initMocks(this);
 		topicService = new TopicServiceImpl();
 		topicService.setErrorMessages(errorMessages);
+		NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+		PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+		PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
 	}
 
 	@Test(expected = DMaaPAccessDeniedException.class)
@@ -337,7 +329,7 @@ public class TopicServiceImplTest {
 		when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
 		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
 	}
-	
+
 	@Test(expected = TopicExistsException.class)
 	public void testGetConsumersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
 			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
@@ -371,54 +363,51 @@ public class TopicServiceImplTest {
 		when(httpServReq.getMethod()).thenReturn("HEAD");
 
 		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		
+
 		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
 
 		topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
 	}
-	
-//	@Test
-//	public void testDeleteTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-//			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
-//
-//		Assert.assertNotNull(topicService);
-//
-//		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-//		
-//		 PowerMockito.mockStatic(AJSCPropertiesMap.class);
-//		 
-//		 PowerMockito.when(AJSCPropertiesMap.
-//				 getProperty(CambriaConstants.msgRtr_prop,"msgRtr.topicfactory.aaf")).thenReturn("topicFactoryAAF");
-//		
-//		
-//		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-//		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-//		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-//		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-//		when(httpServReq.getMethod()).thenReturn("HEAD");
-//
-//		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-//		
-//		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
-//
-//		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
-//	}
-//	
-//	
-//	
-	
-	@Test(expected = TopicExistsException.class)
-	public void testPermitPublisherForTopic_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+	@Test
+	public void testGetPublishersByTopicName() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
-		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("topicFactoryAAF");
+
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
+		when(dmaapContext.getResponse()).thenReturn(httpServRes);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(httpServReq.getMethod()).thenReturn("HEAD");
+
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
+
+		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+
+		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
+	}
+	
+	@Test(expected=TopicExistsException.class)
+	public void testGetPublishersByTopicNameError() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
+
 		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("topicFactoryAAF");
+
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
 		when(dmaapContext.getResponse()).thenReturn(httpServRes);
@@ -427,173 +416,350 @@ public class TopicServiceImplTest {
 
 		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
 
-		topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.name", "producerId");
+		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+
+		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
 	}
-	
+
 	@Test
-	public void testPermitPublisherForTopic_NonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	public void testdeleteTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		
-		
-		topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.name", "producerId");
+		topicService.deleteTopic(dmaapContext, "topicNamespace.topic");
 	}
 	
-	
-	@Test(expected = TopicExistsException.class)
-	public void testDenyPublisherForTopic_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	@Test(expected=TopicExistsException.class)
+	public void testdeleteTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
+		topicService.deleteTopic(dmaapContext, "topicNamespace.topic");
+	}
+	
+	@Test(expected=DMaaPAccessDeniedException.class)
+	public void testdeleteTopic_authHeader() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
 
-		topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.name", "producerId");
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
+		PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(null);
+		topicService.deleteTopic(dmaapContext, "topicNamespace.topic");
 	}
 	
 	@Test
-	public void testDenyPublisherForTopic_NonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	public void testPermitConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		
-		
-		topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.name", "producerId");
+		topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
 	}
 	
-	@Test(expected = TopicExistsException.class)
-	public void testPermitConsumerForTopic_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	@Test(expected=TopicExistsException.class)
+	public void testPermitConsumerForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.name", "consumerID");
+		topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
 	}
 	
 	@Test
-	public void testPermitConsumerForTopic_NonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	public void testdenyConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
+
+		topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
+	}
+	
+	@Test(expected=TopicExistsException.class)
+	public void testdenyConsumerForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
+
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
+
+		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		
-		
-		topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.name", "consumerID");
+		topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
 	}
 	
 	
-	@Test(expected = TopicExistsException.class)
-	public void testDenyConsumerForTopic_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	@Test
+	public void testPermitPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
+		topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
+	}
+	
+	@Test(expected=TopicExistsException.class)
+	public void testPermitPublisherForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
+
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
 
-		topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.name", "consumerID");
+		topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
 	}
 	
 	@Test
-	public void testDenyConsumerForTopic_NonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+	public void testDenyPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
 
 		Assert.assertNotNull(topicService);
 
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
 		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
 		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
+
+		topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");;
+	}
+	
+	@Test(expected=TopicExistsException.class)
+	public void testDenyPublisherForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
+
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
+
+		topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");;
+	}
+	
+	@Test
+	public void testGetAllTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
+
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
 		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+		when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
 		when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
+
+		topicService.getAllTopics(dmaapContext);
+	}
+	
+	@Test
+	public void testGetTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+			TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+		Assert.assertNotNull(topicService);
+
+		// PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.mockStatic(AJSCPropertiesMap.class);
+		PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+				.thenReturn("hello");
+		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+		when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
 		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
+
+		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+		when(dmaapContext.getConfigReader()).thenReturn(configReader);
 		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
+		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+		TopicBean topicBean = new TopicBean();
+		topicBean.setTopicName("enfTopicNamePlusExtra");
+
+		topicService.getTopics(dmaapContext);
+	}
+	
+
 
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		
-		
-		topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.name", "consumerID");
-	}*/
 }
diff --git a/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest22.java b/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest22.java
deleted file mode 100644
index d9361f9..0000000
--- a/src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest22.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.cambria.service.impl;
-
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.ajsc.beans.PropertiesMapBean;
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.nsa.cambria.CambriaApiException;
-import com.att.nsa.cambria.beans.DMaaPContext;
-import com.att.nsa.cambria.beans.DMaaPKafkaMetaBroker;
-import com.att.nsa.cambria.beans.TopicBean;
-import com.att.nsa.cambria.constants.CambriaConstants;
-import com.att.nsa.cambria.exception.DMaaPAccessDeniedException;
-import com.att.nsa.cambria.exception.DMaaPErrorMessages;
-import com.att.nsa.cambria.metabroker.Broker.TopicExistsException;
-import com.att.nsa.cambria.metabroker.Topic;
-import com.att.nsa.cambria.security.DMaaPAAFAuthenticator;
-import com.att.nsa.cambria.security.DMaaPAuthenticator;
-import com.att.nsa.cambria.utils.ConfigurationReader;
-import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
-import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.NsaAcl;
-import com.att.nsa.security.NsaApiKey;
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;
-
-//@RunWith(MockitoJUnitRunner.class)
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ PropertiesMapBean.class })
-public class TopicServiceImplTest22 {
-
-	
-	TopicServiceImpl topicService;
-
-	@Mock
-	private DMaaPErrorMessages errorMessages;
-
-	@Mock
-	DMaaPContext dmaapContext;
-
-	@Mock
-	ConfigurationReader configReader;
-
-	@Mock
-	ServletOutputStream oStream;
-
-	@Mock
-	DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;
-
-	@Mock
-	DMaaPAAFAuthenticator dmaapAAFauthenticator;
-	@Mock
-	NsaApiKey user;
-
-	@Mock
-	NsaSimpleApiKey nsaSimpleApiKey;
-
-	@Mock
-	HttpServletRequest httpServReq;
-
-	@Mock
-	HttpServletResponse httpServRes;
-
-	@Mock
-	DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
-
-	@Mock
-	Topic createdTopic;
-
-	@Mock
-	NsaAcl nsaAcl;
-
-	@Mock
-	JSONObject jsonObj;
-
-	@Mock
-	JSONArray jsonArray;
-
-	@Before
-	public void setUp() {
-		MockitoAnnotations.initMocks(this);
-		topicService = new TopicServiceImpl();
-		topicService.setErrorMessages(errorMessages);
-	}
-
-	@Test(expected = DMaaPAccessDeniedException.class)
-	public void testCreateTopicWithEnforcedName()
-			throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(PropertiesMapBean.class);
-
-		when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
-				.thenReturn("enfTopicName");
-
-		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-
-		TopicBean topicBean = new TopicBean();
-		topicBean.setTopicName("enfTopicNamePlusExtra");
-
-		topicService.createTopic(dmaapContext, topicBean);
-	}
-
-	@Test
-	public void testCreateTopicWithTopicNameNotEnforced()
-			throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(PropertiesMapBean.class);
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-
-		when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
-				.thenReturn("enfTopicName");
-
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-
-		when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
-		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-
-		when(nsaAcl.isActive()).thenReturn(true);
-		when(nsaAcl.getUsers()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));
-
-		when(createdTopic.getName()).thenReturn("topicName");
-		when(createdTopic.getOwner()).thenReturn("Owner");
-		when(createdTopic.getDescription()).thenReturn("Description");
-		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
-		when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
-
-		when(dmaapKafkaMetaBroker.createTopic(anyString(), anyString(), anyString(), anyInt(), anyInt(), anyBoolean()))
-				.thenReturn(createdTopic);
-
-		TopicBean topicBean = new TopicBean();
-		topicBean.setTopicName("NotEnforcedTopicName");
-
-		topicService.createTopic(dmaapContext, topicBean);
-
-		verify(dmaapKafkaMetaBroker, times(1)).createTopic(anyString(), anyString(), anyString(), anyInt(), anyInt(),
-				anyBoolean());
-	}
-
-	@Test(expected = DMaaPAccessDeniedException.class)
-	public void testCreateTopicNoUserInContextAndNoAuthHeader()
-			throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(PropertiesMapBean.class);
-
-		when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
-				.thenReturn("enfTopicName");
-
-		when(httpServReq.getHeader("Authorization")).thenReturn(null);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
-
-		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-
-		TopicBean topicBean = new TopicBean();
-		topicBean.setTopicName("enfTopicNamePlusExtra");
-
-		topicService.createTopic(dmaapContext, topicBean);
-	}
-
-	@Test(expected = DMaaPAccessDeniedException.class)
-	public void testCreateTopicNoUserInContextAndAuthHeaderAndPermitted()
-			throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(PropertiesMapBean.class);
-
-		when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
-				.thenReturn("enfTopicName");
-
-		when(httpServReq.getHeader("Authorization")).thenReturn("Authorization");
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
-
-		when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-
-		// when(dmaapAAFauthenticator.aafAuthentication(httpServReq,
-		// anyString())).thenReturn(false);
-
-		TopicBean topicBean = new TopicBean();
-		topicBean.setTopicName("enfTopicNamePlusExtra");
-
-		topicService.createTopic(dmaapContext, topicBean);
-	}
-
-	@Test(expected = TopicExistsException.class)
-	public void testGetTopics_null_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
-			TopicExistsException, JSONException, ConfigDbException {
-
-		Assert.assertNotNull(topicService);
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);
-
-		topicService.getTopic(dmaapContext, "topicName");
-	}
-
-	@Test
-	public void testGetTopics_NonNull_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
-			TopicExistsException, JSONException, ConfigDbException {
-
-		Assert.assertNotNull(topicService);
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-
-		when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(createdTopic);
-
-		when(createdTopic.getName()).thenReturn("topicName");
-		when(createdTopic.getDescription()).thenReturn("topicDescription");
-		when(createdTopic.getOwners()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));
-
-		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
-		when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
-
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(httpServRes.getOutputStream()).thenReturn(oStream);
-
-		topicService.getTopic(dmaapContext, "topicName");
-	}
-
-	@Test(expected = TopicExistsException.class)
-	public void testGetPublishersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
-
-		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
-
-	}
-
-	@Test
-	public void testGetPublishersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
-		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
-	}
-	
-	@Test(expected = TopicExistsException.class)
-	public void testGetConsumersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
-
-		topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
-
-	}
-
-	@Test
-	public void testGetConsumersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
-
-		Assert.assertNotNull(topicService);
-
-		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-		when(httpServReq.getMethod()).thenReturn("HEAD");
-
-		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-		
-		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
-
-		topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
-	}
-	
-//	@Test
-//	public void testDeleteTopic() throws DMaaPAccessDeniedException, CambriaApiException,
-//			IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
-//
-//		Assert.assertNotNull(topicService);
-//
-//		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
-//		
-//		 PowerMockito.mockStatic(AJSCPropertiesMap.class);
-//		 
-//		 PowerMockito.when(AJSCPropertiesMap.
-//				 getProperty(CambriaConstants.msgRtr_prop,"msgRtr.topicfactory.aaf")).thenReturn("topicFactoryAAF");
-//		
-//		
-//		when(dmaapContext.getConfigReader()).thenReturn(configReader);
-//		when(dmaapContext.getRequest()).thenReturn(httpServReq);
-//		when(dmaapContext.getResponse()).thenReturn(httpServRes);
-//		when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
-//		when(httpServReq.getMethod()).thenReturn("HEAD");
-//
-//		when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
-//		
-//		when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
-//
-//		topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
-//	}
-//	
-//	
-//	
-	
-	  /*@Test public void testdeleteTopic() throws DMaaPAccessDeniedException,
-	  CambriaApiException, IOException, TopicExistsException, JSONException,
-	  ConfigDbException, AccessDeniedException {
-	  
-	  Assert.assertNotNull(topicService);
-	  
-	  //PowerMockito.mockStatic(AJSCPropertiesMap.class);
-	  PowerMockito.mockStatic(AJSCPropertiesMap.class);
-	  PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.
-	  msgRtr_prop,"msgRtr.topicfactory.aaf")) .thenReturn("hello");
-	  
-	  when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
-	  when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
-	  when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
-	  when(dmaapContext.getRequest()).thenReturn(httpServReq);
-	  
-	  when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
-	  when(dmaapContext.getConfigReader()).thenReturn(configReader);
-	  
-	  TopicBean topicBean = new TopicBean();
-	  topicBean.setTopicName("enfTopicNamePlusExtra");
-	  
-	  topicService.deleteTopic(dmaapContext, "topicNamespace.topic"); }*/
-	 
-	
-}
diff --git a/src/test/java/com/att/nsa/cambria/service/impl/UIServiceImplTest.java b/src/test/java/com/att/nsa/cambria/service/impl/UIServiceImplTest.java
index 55bed19..0523337 100644
--- a/src/test/java/com/att/nsa/cambria/service/impl/UIServiceImplTest.java
+++ b/src/test/java/com/att/nsa/cambria/service/impl/UIServiceImplTest.java
@@ -21,21 +21,73 @@
 package com.att.nsa.cambria.service.impl;
 
 import static org.junit.Assert.*;
+import static org.mockito.Mockito.when;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
+import com.att.nsa.cambria.backends.ConsumerFactory;
 import com.att.nsa.cambria.beans.DMaaPContext;
+import com.att.nsa.cambria.beans.DMaaPKafkaMetaBroker;
+import com.att.nsa.cambria.metabroker.Topic;
+import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
+import com.att.nsa.cambria.utils.ConfigurationReader;
+import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
 import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.NsaApiDb;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
 
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })
 public class UIServiceImplTest {
 
+	@InjectMocks
+	UIServiceImpl service;
+
+	@Mock
+	DMaaPContext dmaapContext;
+	@Mock
+	ConsumerFactory factory;
+
+	@Mock
+	ConfigurationReader configReader;
+
+	@Mock
+	DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
+
+	@Mock
+	Topic metatopic;
+
 	@Before
 	public void setUp() throws Exception {
+		MockitoAnnotations.initMocks(this);
+		PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+		NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+		PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+		PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+
+		PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);
+		PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+		PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+		PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
 	}
 
 	@After
@@ -44,29 +96,27 @@ public class UIServiceImplTest {
 
 	@Test
 	public void testHello() {
-		
-		UIServiceImpl service = new UIServiceImpl();
+
 		try {
-			service.hello(new DMaaPContext());
+			service.hello(dmaapContext);
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}		
-		
+		}
+
 		String trueValue = "True";
 		assertTrue(trueValue.equalsIgnoreCase("True"));
-		
+
 	}
-	
+
 	@Test
 	public void testGetApiKeysTable() {
-		
-		UIServiceImpl service = new UIServiceImpl();
+
 		try {
-			service.getApiKeysTable(new DMaaPContext());
+			service.getApiKeysTable(dmaapContext);
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
@@ -75,18 +125,18 @@ public class UIServiceImplTest {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-	 
+		assertTrue(true);
+
 	}
-	
+
 	@Test
 	public void testGetApiKey() {
-		
-		UIServiceImpl service = new UIServiceImpl();
+
 		try {
-			service.getApiKey(new DMaaPContext(), "k56HmWT72J");
+			service.getApiKey(dmaapContext, "admin");
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
+			// e.printStackTrace();
 			assertTrue(true);
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
@@ -95,22 +145,46 @@ public class UIServiceImplTest {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			assertTrue(true);
+		}
+
+	}
+
+	@Test
+	public void testGetApiKey_invalidkey() {
+
+		try {
+			service.getApiKey(dmaapContext, "k56HmWT72J");
+		} catch (NullPointerException e) {
+			// TODO Auto-generated catch block
+			// e.printStackTrace();
+			assertTrue(true);
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			assertTrue(true);
 		}
-	 
+
 	}
-	
+
 	@Test
 	public void testGetTopicsTable() {
-		
-		UIServiceImpl service = new UIServiceImpl();
+
 		try {
-			service.getTopicsTable(new DMaaPContext());
+			List<Topic> topics = new ArrayList<Topic>();
+			topics.add(metatopic);
+			when(dmaapKafkaMetaBroker.getAllTopics()).thenReturn(topics);
+			service.getTopicsTable(dmaapContext);
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
-			assertTrue(true);
+			// e.printStackTrace();
+
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -121,19 +195,20 @@ public class UIServiceImplTest {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-	 
+		assertTrue(true);
+
 	}
-	
+
 	@Test
 	public void testGetTopic() {
-		
-		UIServiceImpl service = new UIServiceImpl();
+
 		try {
-			service.getTopic(new DMaaPContext(), "testTopic");
+			when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(metatopic);
+			service.getTopic(dmaapContext, "testTopic");
 		} catch (NullPointerException e) {
 			// TODO Auto-generated catch block
-			//e.printStackTrace();
-			assertTrue(true);
+			// e.printStackTrace();
+
 		} catch (ConfigDbException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -144,7 +219,83 @@ public class UIServiceImplTest {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-	 
+		assertTrue(true);
+	}
+
+	@Test
+	public void testGetTopic_nulltopic() {
+
+		try {
+			when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+			service.getTopic(dmaapContext, "testTopic");
+		} catch (NullPointerException e) {
+			// TODO Auto-generated catch block
+			// e.printStackTrace();
+		} catch (ConfigDbException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			assertTrue(true);
+		}
+
 	}
-	
+
+	NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {
+
+		Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));
+
+		@Override
+		public NsaSimpleApiKey createApiKey(String arg0, String arg1)
+				throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {
+			// TODO Auto-generated method stub
+			return new NsaSimpleApiKey(arg0, arg1);
+		}
+
+		@Override
+		public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		@Override
+		public boolean deleteApiKey(String arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		@Override
+		public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {
+			Map<String, NsaSimpleApiKey> map = new HashMap<String, NsaSimpleApiKey>();
+			map.put("testkey", new NsaSimpleApiKey("testkey", "password"));
+			map.put("admin", new NsaSimpleApiKey("admin", "password"));
+
+			return map;
+		}
+
+		@Override
+		public Set<String> loadAllKeys() throws ConfigDbException {
+			// TODO Auto-generated method stub
+
+			return keys;
+		}
+
+		@Override
+		public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {
+			if (!keys.contains(arg0)) {
+				return null;
+			}
+			return new NsaSimpleApiKey(arg0, "password");
+		}
+
+		@Override
+		public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+			// TODO Auto-generated method stub
+
+		}
+	};
+
 }
-- 
cgit