Rename test classes in policy/engine
[policy/engine.git] / ONAP-PDP-REST / src / test / java / org / onap / policy / pdp / rest / api / test / GetDictionaryServiceTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-PDP-REST
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.policy.pdp.rest.api.test;
21
22 import static org.junit.Assert.assertNotNull;
23 import static org.junit.Assert.assertNull;
24
25 import java.lang.reflect.Method;
26
27 import org.junit.Test;
28 import org.onap.policy.api.DictionaryParameters;
29 import org.onap.policy.pdp.rest.api.services.GetDictionaryService;
30
31 public class GetDictionaryServiceTest {
32         
33         @Test
34         public void dictionaryJsonTest() throws Exception{
35                 Method formatDictionary = GetDictionaryService.class.getDeclaredMethod("formatDictionaryJson", String.class);
36                 formatDictionary.setAccessible(true);
37                 String input="{\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\","
38                                 + "\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\","
39                                 + "\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\",\"key\":\"value\"}";
40                 DictionaryParameters dp = new DictionaryParameters();
41                 dp.setDictionary("test");
42                 GetDictionaryService gds = new GetDictionaryService(dp, null);
43                 String result = (String) formatDictionary.invoke(gds, input);
44                 assertNotNull(result);
45                 //
46                 dp.setDictionary("OnapName");
47                 gds = new GetDictionaryService(dp, null);
48                 result = (String) formatDictionary.invoke(gds, input);
49                 assertNotNull(result);
50                 //
51                 dp.setDictionary("Attribute");
52                 gds = new GetDictionaryService(dp, null);
53                 result = (String) formatDictionary.invoke(gds, input);
54                 assertNotNull(result);
55                 //
56                 dp.setDictionary("Action");
57                 gds = new GetDictionaryService(dp, null);
58                 result = (String) formatDictionary.invoke(gds, input);
59                 assertNotNull(result);
60                 //
61                 dp.setDictionary("BRMSParamTemplate");
62                 gds = new GetDictionaryService(dp, null);
63                 result = (String) formatDictionary.invoke(gds, input);
64                 assertNotNull(result);
65                 //
66                 dp.setDictionary("VSCLAction");
67                 gds = new GetDictionaryService(dp, null);
68                 result = (String) formatDictionary.invoke(gds, input);
69                 assertNotNull(result);
70                 //
71                 dp.setDictionary("VNFType");
72                 gds = new GetDictionaryService(dp, null);
73                 result = (String) formatDictionary.invoke(gds, input);
74                 assertNotNull(result);
75                 //
76                 dp.setDictionary("PEPOptions");
77                 gds = new GetDictionaryService(dp, null);
78                 result = (String) formatDictionary.invoke(gds, input);
79                 assertNotNull(result);
80                 //
81                 dp.setDictionary("Varbind");
82                 gds = new GetDictionaryService(dp, null);
83                 result = (String) formatDictionary.invoke(gds, input);
84                 assertNotNull(result);
85                 //
86                 dp.setDictionary("Service");
87                 gds = new GetDictionaryService(dp, null);
88                 result = (String) formatDictionary.invoke(gds, input);
89                 assertNotNull(result);
90                 //
91                 dp.setDictionary("Site");
92                 gds = new GetDictionaryService(dp, null);
93                 result = (String) formatDictionary.invoke(gds, input);
94                 assertNotNull(result);
95                 //
96                 dp.setDictionary("Settings");
97                 gds = new GetDictionaryService(dp, null);
98                 result = (String) formatDictionary.invoke(gds, input);
99                 assertNotNull(result);
100                 //
101                 dp.setDictionary("DescriptiveScope");
102                 gds = new GetDictionaryService(dp, null);
103                 result = (String) formatDictionary.invoke(gds, input);
104                 assertNotNull(result);
105                 //
106                 dp.setDictionary("Enforcer");
107                 gds = new GetDictionaryService(dp, null);
108                 result = (String) formatDictionary.invoke(gds, input);
109                 assertNotNull(result);
110                 //
111                 dp.setDictionary("ActionList");
112                 gds = new GetDictionaryService(dp, null);
113                 result = (String) formatDictionary.invoke(gds, input);
114                 assertNotNull(result);
115                 //
116                 dp.setDictionary("ProtocolList");
117                 gds = new GetDictionaryService(dp, null);
118                 result = (String) formatDictionary.invoke(gds, input);
119                 assertNotNull(result);
120                 //
121                 dp.setDictionary("Zone");
122                 gds = new GetDictionaryService(dp, null);
123                 result = (String) formatDictionary.invoke(gds, input);
124                 assertNotNull(result);
125                 //
126                 dp.setDictionary("SecurityZone");
127                 gds = new GetDictionaryService(dp, null);
128                 result = (String) formatDictionary.invoke(gds, input);
129                 assertNotNull(result);
130                 //
131                 dp.setDictionary("PrefixList");
132                 gds = new GetDictionaryService(dp, null);
133                 result = (String) formatDictionary.invoke(gds, input);
134                 assertNotNull(result);
135                 //
136                 dp.setDictionary("AddressGroup");
137                 gds = new GetDictionaryService(dp, null);
138                 result = (String) formatDictionary.invoke(gds, input);
139                 assertNotNull(result);
140                 //
141                 dp.setDictionary("ServiceGroup");
142                 gds = new GetDictionaryService(dp, null);
143                 result = (String) formatDictionary.invoke(gds, input);
144                 assertNotNull(result);
145                 //
146                 dp.setDictionary("ServiceList");
147                 gds = new GetDictionaryService(dp, null);
148                 result = (String) formatDictionary.invoke(gds, input);
149                 assertNotNull(result);
150                 //
151                 dp.setDictionary("TermList");
152                 gds = new GetDictionaryService(dp, null);
153                 result = (String) formatDictionary.invoke(gds, input);
154                 assertNotNull(result);
155                 //
156                 dp.setDictionary("RuleList");
157                 gds = new GetDictionaryService(dp, null);
158                 result = (String) formatDictionary.invoke(gds, input);
159                 assertNotNull(result);
160                 //
161                 dp.setDictionary("FirewallRuleList");
162                 gds = new GetDictionaryService(dp, null);
163                 result = (String) formatDictionary.invoke(gds, input);
164                 assertNotNull(result);
165                 //
166                 dp.setDictionary("Term");
167                 gds = new GetDictionaryService(dp, null);
168                 result = (String) formatDictionary.invoke(gds, input);
169                 assertNotNull(result);
170                 //
171                 dp.setDictionary("MicroServiceLocation");
172                 gds = new GetDictionaryService(dp, null);
173                 result = (String) formatDictionary.invoke(gds, input);
174                 assertNotNull(result);
175                 //
176                 dp.setDictionary("MicroServiceConfigName");
177                 gds = new GetDictionaryService(dp, null);
178                 result = (String) formatDictionary.invoke(gds, input);
179                 assertNotNull(result);
180                 //
181                 dp.setDictionary("DCAEUUID");
182                 gds = new GetDictionaryService(dp, null);
183                 result = (String) formatDictionary.invoke(gds, input);
184                 assertNotNull(result);
185                 //
186                 dp.setDictionary("MicroServiceModels");
187                 gds = new GetDictionaryService(dp, null);
188                 result = (String) formatDictionary.invoke(gds, input);
189                 assertNotNull(result);
190                 //
191                 dp.setDictionary("PolicyScopeService");
192                 gds = new GetDictionaryService(dp, null);
193                 result = (String) formatDictionary.invoke(gds, input);
194                 assertNotNull(result);
195                 //
196                 dp.setDictionary("PolicyScopeResource");
197                 gds = new GetDictionaryService(dp, null);
198                 result = (String) formatDictionary.invoke(gds, input);
199                 assertNotNull(result);
200                 //
201                 dp.setDictionary("PolicyScopeType");
202                 gds = new GetDictionaryService(dp, null);
203                 result = (String) formatDictionary.invoke(gds, input);
204                 assertNotNull(result);
205                 //
206                 dp.setDictionary("PolicyScopeClosedLoop");
207                 gds = new GetDictionaryService(dp, null);
208                 result = (String) formatDictionary.invoke(gds, input);
209                 assertNotNull(result);
210                 //
211                 dp.setDictionary("GroupPolicyScopeList");
212                 gds = new GetDictionaryService(dp, null);
213                 result = (String) formatDictionary.invoke(gds, input);
214                 assertNotNull(result);
215                 //
216                 dp.setDictionary("RiskType");
217                 gds = new GetDictionaryService(dp, null);
218                 result = (String) formatDictionary.invoke(gds, input);
219                 assertNotNull(result);
220                 //
221                 dp.setDictionary("SafePolicyWarning");
222                 gds = new GetDictionaryService(dp, null);
223                 result = (String) formatDictionary.invoke(gds, input);
224                 assertNotNull(result);
225                 //
226                 dp.setDictionary("MicroServiceDictionary");
227                 gds = new GetDictionaryService(dp, null);
228                 result = (String) formatDictionary.invoke(gds, input);
229                 assertNotNull(result);
230         }
231 }