395b070ea5cd6e73b95ef38020f39d469a4e3b1b
[dmaap/messagerouter/msgrtr.git] / src / test / java / com / att / nsa / cambria / service / impl / ApiKeysServiceImplTest.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 \r
22 package com.att.nsa.cambria.service.impl;\r
23 \r
24 import static org.junit.Assert.*;\r
25 \r
26 import java.io.IOException;\r
27 \r
28 import com.att.nsa.cambria.beans.ApiKeyBean;\r
29 import com.att.nsa.cambria.beans.DMaaPContext;\r
30 import com.att.nsa.configs.ConfigDbException;\r
31 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
32 import com.att.nsa.security.db.NsaApiDb.KeyExistsException;\r
33 \r
34 import org.junit.After;\r
35 import org.junit.Before;\r
36 import org.junit.Test;\r
37 \r
38 public class ApiKeysServiceImplTest {\r
39 \r
40         @Before\r
41         public void setUp() throws Exception {\r
42         }\r
43 \r
44         @After\r
45         public void tearDown() throws Exception {\r
46         }\r
47 \r
48         \r
49         @Test\r
50         public void testGetAllApiKeys() {\r
51                 \r
52         /*      ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
53                 try {\r
54                         service.getAllApiKeys(new DMaaPContext());\r
55                 } catch (NullPointerException e) {\r
56                         // TODO Auto-generated catch block\r
57                         //e.printStackTrace();\r
58                         assertTrue(true);\r
59                 } catch (ConfigDbException e) {\r
60                         // TODO Auto-generated catch block\r
61                         e.printStackTrace();\r
62                 } catch (IOException e) {\r
63                         // TODO Auto-generated catch block\r
64                         e.printStackTrace();\r
65                 }*/\r
66          \r
67         }\r
68         \r
69         @Test\r
70         public void testGetApiKey() {\r
71                 /*\r
72                 ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
73                 try {\r
74                         service.getApiKey(new DMaaPContext(), "k35Hdw6Sde");\r
75                 } catch (NullPointerException e) {\r
76                         // TODO Auto-generated catch block\r
77                         //e.printStackTrace();\r
78                         assertTrue(true);\r
79                 } catch (ConfigDbException e) {\r
80                         // TODO Auto-generated catch block\r
81                         e.printStackTrace();\r
82                 } catch (IOException e) {\r
83                         // TODO Auto-generated catch block\r
84                         e.printStackTrace();\r
85                 }*/\r
86          \r
87         }\r
88         \r
89         @Test\r
90         public void testCreateApiKey() {\r
91                 \r
92         /*      ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
93                 try {\r
94                         service.createApiKey(new DMaaPContext(), new ApiKeyBean("hs647a@att.com", "testing apikey bean"));\r
95                 } catch (NullPointerException e) {\r
96                         // TODO Auto-generated catch block\r
97                         //e.printStackTrace();\r
98                         assertTrue(true);\r
99                 } catch (ConfigDbException e) {\r
100                         // TODO Auto-generated catch block\r
101                         e.printStackTrace();\r
102                 } catch (IOException e) {\r
103                         // TODO Auto-generated catch block\r
104                         e.printStackTrace();\r
105                 } catch (KeyExistsException e) {\r
106                         // TODO Auto-generated catch block\r
107                         e.printStackTrace();\r
108                 } catch(NoClassDefFoundError e) {\r
109                          assertTrue(true);\r
110                 }*/\r
111          \r
112         }\r
113         \r
114         @Test\r
115         public void testUpdateApiKey() {\r
116                 \r
117 /*              ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
118                 try {\r
119                         \r
120                         service.updateApiKey(new DMaaPContext(), "k6dWUcw4N", new ApiKeyBean("hs647a@att.com", "testing apikey bean"));\r
121                 } catch (NullPointerException e) {\r
122                         // TODO Auto-generated catch block\r
123                         //e.printStackTrace();\r
124                         assertTrue(true);\r
125                 } catch (ConfigDbException e) {\r
126                         // TODO Auto-generated catch block\r
127                         e.printStackTrace();\r
128                 } catch (IOException e) {\r
129                         // TODO Auto-generated catch block\r
130                         e.printStackTrace();\r
131                 } catch (AccessDeniedException e) {\r
132                         // TODO Auto-generated catch block\r
133                         e.printStackTrace();\r
134                 }\r
135          */\r
136         }\r
137         \r
138         @Test\r
139         public void testDeleteApiKey() {\r
140                 \r
141         /*      ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
142                 try {\r
143                         \r
144                         service.deleteApiKey(new DMaaPContext(), "k6dWUcw4N");\r
145                 } catch (NullPointerException e) {\r
146                         // TODO Auto-generated catch block\r
147                         //e.printStackTrace();\r
148                         assertTrue(true);\r
149                 } catch (ConfigDbException e) {\r
150                         // TODO Auto-generated catch block\r
151                         e.printStackTrace();\r
152                 } catch (IOException e) {\r
153                         // TODO Auto-generated catch block\r
154                         e.printStackTrace();\r
155                 } catch (AccessDeniedException e) {\r
156                         // TODO Auto-generated catch block\r
157                         e.printStackTrace();\r
158                 }*/\r
159          \r
160         }\r
161 }