update the testcases after the kafka 11 changes
[dmaap/messagerouter/msgrtr.git] / src / main / java / com / att / dmf / mr / service / impl / AdminServiceImpl.java
@@ -8,18 +8,18 @@
  *  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=========================================================
- *
+ *  
  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
  *  
  *******************************************************************************/
-package com.att.nsa.cambria.service.impl;
+package com.att.dmf.mr.service.impl;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -30,21 +30,22 @@ import org.json.JSONException;
 import org.json.JSONObject;
 import org.springframework.stereotype.Component;
 
+import com.att.dmf.mr.backends.Consumer;
+import com.att.dmf.mr.backends.ConsumerFactory;
+import com.att.dmf.mr.beans.DMaaPContext;
+import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;
+import com.att.dmf.mr.service.AdminService;
+import com.att.dmf.mr.utils.DMaaPResponseBuilder;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-import com.att.nsa.cambria.backends.Consumer;
-import com.att.nsa.cambria.backends.ConsumerFactory;
-import com.att.nsa.cambria.beans.DMaaPContext;
-import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
-import com.att.nsa.cambria.service.AdminService;
-import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
 import com.att.nsa.configs.ConfigDbException;
 import com.att.nsa.limits.Blacklist;
 import com.att.nsa.security.NsaApiKey;
 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+//import com.att.sa.highlandPark.util.HpJsonUtil;
 
 /**
- * @author author
+ * @author muzainulhaque.qazi
  *
  */
 @Component
@@ -125,7 +126,26 @@ public class AdminServiceImpl implements AdminService {
                adminAuthenticate ( dMaaPContext );
 
                DMaaPResponseBuilder.respondOk ( dMaaPContext,
-                       new JSONObject().put ( "blacklist", setToJsonArray ( getIpBlacklist (dMaaPContext).asSet() ) ) );
+                       new JSONObject().put ( "blacklist",
+                                       setToJsonArray ( getIpBlacklist (dMaaPContext).asSet() ) ) );
+       }
+       
+       public static JSONArray setToJsonArray ( Set<?> fields )
+       {
+               return collectionToJsonArray ( fields );
+       }
+       
+       public static JSONArray collectionToJsonArray ( Collection<?> fields )
+       {
+               final JSONArray a = new JSONArray ();
+               if ( fields != null )
+               {
+                       for ( Object o : fields )
+                       {
+                               a.put ( o );
+                       }
+               }
+               return a;
        }
        
        /**
@@ -161,28 +181,10 @@ public class AdminServiceImpl implements AdminService {
        {
                
                final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dMaaPContext);
-               if ( (user == null || !user.getKey ().equals ( "admin" )) )
+               if ( user == null || !user.getKey ().equals ( "admin" ) )
                {
                        throw new AccessDeniedException ();
                }
        }
-       
-       public static JSONArray setToJsonArray ( Set<?> fields )
-       {
-               return collectionToJsonArray ( fields );
-       }
-
-       public static JSONArray collectionToJsonArray ( Collection<?> fields )
-       {
-               final JSONArray a = new JSONArray ();
-               if ( fields != null )
-               {
-                       for ( Object o : fields )
-                       {
-                               a.put ( o );
-                       }
-               }
-               return a;
-       }
 
 }