55bed194a92e420a55dd8c9097bca96212d13578
[dmaap/messagerouter/msgrtr.git] / src / test / java / com / att / nsa / cambria / service / impl / UIServiceImplTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP Policy Engine\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
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \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
19  */\r
20 \r
21 package com.att.nsa.cambria.service.impl;\r
22 \r
23 import static org.junit.Assert.*;\r
24 \r
25 import java.io.IOException;\r
26 \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
30 \r
31 import org.junit.After;\r
32 import org.junit.Before;\r
33 import org.junit.Test;\r
34 \r
35 public class UIServiceImplTest {\r
36 \r
37         @Before\r
38         public void setUp() throws Exception {\r
39         }\r
40 \r
41         @After\r
42         public void tearDown() throws Exception {\r
43         }\r
44 \r
45         @Test\r
46         public void testHello() {\r
47                 \r
48                 UIServiceImpl service = new UIServiceImpl();\r
49                 try {\r
50                         service.hello(new DMaaPContext());\r
51                 } catch (IOException e) {\r
52                         // TODO Auto-generated catch block\r
53                         e.printStackTrace();\r
54                 }               \r
55                 \r
56                 String trueValue = "True";\r
57                 assertTrue(trueValue.equalsIgnoreCase("True"));\r
58                 \r
59         }\r
60         \r
61         @Test\r
62         public void testGetApiKeysTable() {\r
63                 \r
64                 UIServiceImpl service = new UIServiceImpl();\r
65                 try {\r
66                         service.getApiKeysTable(new DMaaPContext());\r
67                 } catch (NullPointerException e) {\r
68                         // TODO Auto-generated catch block\r
69                         //e.printStackTrace();\r
70                         assertTrue(true);\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
77                 }\r
78          \r
79         }\r
80         \r
81         @Test\r
82         public void testGetApiKey() {\r
83                 \r
84                 UIServiceImpl service = new UIServiceImpl();\r
85                 try {\r
86                         service.getApiKey(new DMaaPContext(), "k56HmWT72J");\r
87                 } catch (NullPointerException e) {\r
88                         // TODO Auto-generated catch block\r
89                         //e.printStackTrace();\r
90                         assertTrue(true);\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
100                 }\r
101          \r
102         }\r
103         \r
104         @Test\r
105         public void testGetTopicsTable() {\r
106                 \r
107                 UIServiceImpl service = new UIServiceImpl();\r
108                 try {\r
109                         service.getTopicsTable(new DMaaPContext());\r
110                 } catch (NullPointerException e) {\r
111                         // TODO Auto-generated catch block\r
112                         //e.printStackTrace();\r
113                         assertTrue(true);\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
123                 }\r
124          \r
125         }\r
126         \r
127         @Test\r
128         public void testGetTopic() {\r
129                 \r
130                 UIServiceImpl service = new UIServiceImpl();\r
131                 try {\r
132                         service.getTopic(new DMaaPContext(), "testTopic");\r
133                 } catch (NullPointerException e) {\r
134                         // TODO Auto-generated catch block\r
135                         //e.printStackTrace();\r
136                         assertTrue(true);\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
146                 }\r
147          \r
148         }\r
149         \r
150 }\r