2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package com.att.nsa.dmaap.service;
\r
23 import static org.junit.Assert.*;
\r
25 import java.lang.reflect.InvocationTargetException;
\r
26 import java.lang.reflect.Method;
\r
28 import org.junit.After;
\r
29 import org.junit.Before;
\r
30 import org.junit.Test;
\r
32 import org.onap.dmaap.dmf.mr.CambriaApiException;
\r
33 import com.att.nsa.configs.ConfigDbException;
\r
34 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
\r
36 public class UIRestServicesTest {
\r
38 private UIRestServices service = null;
\r
41 public void setUp() throws Exception {
\r
42 service = new UIRestServices();
\r
46 public void tearDown() throws Exception {
\r
50 public void testHello() {
\r
54 } catch (NullPointerException e) {
\r
61 public void testGetApiKeysTable() {
\r
64 service.getApiKeysTable();
\r
65 } catch (NullPointerException e) {
\r
73 public void testGetApiKey() {
\r
76 service.getApiKey("apikey");
\r
77 } catch (NullPointerException e) {
\r
84 public void testGetTopicsTable() {
\r
87 service.getTopicsTable();
\r
88 } catch (NullPointerException e) {
\r
95 public void testGetTopic() {
\r
98 service.getTopic("topicName");
\r
99 } catch (NullPointerException e) {
\r
106 public void testGetDmaapContext() {
\r
107 Class clazz = null;
\r
108 Method method = null;
\r
110 clazz = Class.forName("UIRestServices");
\r
111 Object obj = clazz.newInstance();
\r
112 method = clazz.getDeclaredMethod("getDmaapContext", null);
\r
113 method.setAccessible(true);
\r
114 method.invoke(obj, null);
\r
115 } catch (ClassNotFoundException e) {
\r
116 // TODO Auto-generated catch block
\r
117 e.printStackTrace();
\r
118 } catch (NoSuchMethodException e) {
\r
119 // TODO Auto-generated catch block
\r
120 e.printStackTrace();
\r
121 } catch (SecurityException e) {
\r
122 // TODO Auto-generated catch block
\r
123 e.printStackTrace();
\r
124 } catch (InstantiationException e) {
\r
125 // TODO Auto-generated catch block
\r
126 e.printStackTrace();
\r
127 } catch (IllegalAccessException e) {
\r
128 // TODO Auto-generated catch block
\r
129 e.printStackTrace();
\r
130 } catch (IllegalArgumentException e) {
\r
131 // TODO Auto-generated catch block
\r
132 e.printStackTrace();
\r
133 } catch (InvocationTargetException e) {
\r
134 // TODO Auto-generated catch block
\r
135 e.printStackTrace();
\r