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.cambria.service.impl;
\r
23 import static org.junit.Assert.*;
\r
25 import java.io.IOException;
\r
27 import com.att.nsa.cambria.beans.DMaaPContext;
\r
28 import com.att.nsa.configs.ConfigDbException;
\r
29 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
\r
31 import org.junit.After;
\r
32 import org.junit.Before;
\r
33 import org.junit.Test;
\r
35 public class UIServiceImplTest {
\r
38 public void setUp() throws Exception {
\r
42 public void tearDown() throws Exception {
\r
46 public void testHello() {
\r
48 UIServiceImpl service = new UIServiceImpl();
\r
50 service.hello(new DMaaPContext());
\r
51 } catch (IOException e) {
\r
52 // TODO Auto-generated catch block
\r
53 e.printStackTrace();
\r
56 String trueValue = "True";
\r
57 assertTrue(trueValue.equalsIgnoreCase("True"));
\r
62 public void testGetApiKeysTable() {
\r
64 UIServiceImpl service = new UIServiceImpl();
\r
66 service.getApiKeysTable(new DMaaPContext());
\r
67 } catch (NullPointerException e) {
\r
68 // TODO Auto-generated catch block
\r
69 //e.printStackTrace();
\r
71 } catch (ConfigDbException e) {
\r
72 // TODO Auto-generated catch block
\r
73 e.printStackTrace();
\r
74 } catch (IOException e) {
\r
75 // TODO Auto-generated catch block
\r
76 e.printStackTrace();
\r
82 public void testGetApiKey() {
\r
84 UIServiceImpl service = new UIServiceImpl();
\r
86 service.getApiKey(new DMaaPContext(), "k56HmWT72J");
\r
87 } catch (NullPointerException e) {
\r
88 // TODO Auto-generated catch block
\r
89 //e.printStackTrace();
\r
91 } catch (ConfigDbException e) {
\r
92 // TODO Auto-generated catch block
\r
93 e.printStackTrace();
\r
94 } catch (IOException e) {
\r
95 // TODO Auto-generated catch block
\r
96 e.printStackTrace();
\r
97 } catch (Exception e) {
\r
98 // TODO Auto-generated catch block
\r
99 e.printStackTrace();
\r
105 public void testGetTopicsTable() {
\r
107 UIServiceImpl service = new UIServiceImpl();
\r
109 service.getTopicsTable(new DMaaPContext());
\r
110 } catch (NullPointerException e) {
\r
111 // TODO Auto-generated catch block
\r
112 //e.printStackTrace();
\r
114 } catch (ConfigDbException e) {
\r
115 // TODO Auto-generated catch block
\r
116 e.printStackTrace();
\r
117 } catch (IOException e) {
\r
118 // TODO Auto-generated catch block
\r
119 e.printStackTrace();
\r
120 } catch (Exception e) {
\r
121 // TODO Auto-generated catch block
\r
122 e.printStackTrace();
\r
128 public void testGetTopic() {
\r
130 UIServiceImpl service = new UIServiceImpl();
\r
132 service.getTopic(new DMaaPContext(), "testTopic");
\r
133 } catch (NullPointerException e) {
\r
134 // TODO Auto-generated catch block
\r
135 //e.printStackTrace();
\r
137 } catch (ConfigDbException e) {
\r
138 // TODO Auto-generated catch block
\r
139 e.printStackTrace();
\r
140 } catch (IOException e) {
\r
141 // TODO Auto-generated catch block
\r
142 e.printStackTrace();
\r
143 } catch (Exception e) {
\r
144 // TODO Auto-generated catch block
\r
145 e.printStackTrace();
\r