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