2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.policy.pdp.rest.api.test;
22 import static org.junit.Assert.assertNotNull;
23 import static org.junit.Assert.assertNull;
25 import java.lang.reflect.Method;
27 import org.junit.Test;
28 import org.onap.policy.api.DictionaryParameters;
29 import org.onap.policy.pdp.rest.api.services.GetDictionaryService;
31 public class getDictionaryTest {
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);
46 dp.setDictionary("OnapName");
47 gds = new GetDictionaryService(dp, null);
48 result = (String) formatDictionary.invoke(gds, input);
49 assertNotNull(result);
51 dp.setDictionary("Attribute");
52 gds = new GetDictionaryService(dp, null);
53 result = (String) formatDictionary.invoke(gds, input);
54 assertNotNull(result);
56 dp.setDictionary("Action");
57 gds = new GetDictionaryService(dp, null);
58 result = (String) formatDictionary.invoke(gds, input);
59 assertNotNull(result);
61 dp.setDictionary("BRMSParamTemplate");
62 gds = new GetDictionaryService(dp, null);
63 result = (String) formatDictionary.invoke(gds, input);
64 assertNotNull(result);
66 dp.setDictionary("VSCLAction");
67 gds = new GetDictionaryService(dp, null);
68 result = (String) formatDictionary.invoke(gds, input);
69 assertNotNull(result);
71 dp.setDictionary("VNFType");
72 gds = new GetDictionaryService(dp, null);
73 result = (String) formatDictionary.invoke(gds, input);
74 assertNotNull(result);
76 dp.setDictionary("PEPOptions");
77 gds = new GetDictionaryService(dp, null);
78 result = (String) formatDictionary.invoke(gds, input);
79 assertNotNull(result);
81 dp.setDictionary("Varbind");
82 gds = new GetDictionaryService(dp, null);
83 result = (String) formatDictionary.invoke(gds, input);
84 assertNotNull(result);
86 dp.setDictionary("Service");
87 gds = new GetDictionaryService(dp, null);
88 result = (String) formatDictionary.invoke(gds, input);
89 assertNotNull(result);
91 dp.setDictionary("Site");
92 gds = new GetDictionaryService(dp, null);
93 result = (String) formatDictionary.invoke(gds, input);
94 assertNotNull(result);
96 dp.setDictionary("Settings");
97 gds = new GetDictionaryService(dp, null);
98 result = (String) formatDictionary.invoke(gds, input);
99 assertNotNull(result);
101 dp.setDictionary("DescriptiveScope");
102 gds = new GetDictionaryService(dp, null);
103 result = (String) formatDictionary.invoke(gds, input);
104 assertNotNull(result);
106 dp.setDictionary("Enforcer");
107 gds = new GetDictionaryService(dp, null);
108 result = (String) formatDictionary.invoke(gds, input);
109 assertNotNull(result);
111 dp.setDictionary("ActionList");
112 gds = new GetDictionaryService(dp, null);
113 result = (String) formatDictionary.invoke(gds, input);
114 assertNotNull(result);
116 dp.setDictionary("ProtocolList");
117 gds = new GetDictionaryService(dp, null);
118 result = (String) formatDictionary.invoke(gds, input);
119 assertNotNull(result);
121 dp.setDictionary("Zone");
122 gds = new GetDictionaryService(dp, null);
123 result = (String) formatDictionary.invoke(gds, input);
124 assertNotNull(result);
126 dp.setDictionary("SecurityZone");
127 gds = new GetDictionaryService(dp, null);
128 result = (String) formatDictionary.invoke(gds, input);
129 assertNotNull(result);
131 dp.setDictionary("PrefixList");
132 gds = new GetDictionaryService(dp, null);
133 result = (String) formatDictionary.invoke(gds, input);
134 assertNotNull(result);
136 dp.setDictionary("AddressGroup");
137 gds = new GetDictionaryService(dp, null);
138 result = (String) formatDictionary.invoke(gds, input);
139 assertNotNull(result);
141 dp.setDictionary("ServiceGroup");
142 gds = new GetDictionaryService(dp, null);
143 result = (String) formatDictionary.invoke(gds, input);
144 assertNotNull(result);
146 dp.setDictionary("ServiceList");
147 gds = new GetDictionaryService(dp, null);
148 result = (String) formatDictionary.invoke(gds, input);
149 assertNotNull(result);
151 dp.setDictionary("TermList");
152 gds = new GetDictionaryService(dp, null);
153 result = (String) formatDictionary.invoke(gds, input);
154 assertNotNull(result);
156 dp.setDictionary("RuleList");
157 gds = new GetDictionaryService(dp, null);
158 result = (String) formatDictionary.invoke(gds, input);
159 assertNotNull(result);
161 dp.setDictionary("FirewallRuleList");
162 gds = new GetDictionaryService(dp, null);
163 result = (String) formatDictionary.invoke(gds, input);
164 assertNotNull(result);
166 dp.setDictionary("Term");
167 gds = new GetDictionaryService(dp, null);
168 result = (String) formatDictionary.invoke(gds, input);
169 assertNotNull(result);
171 dp.setDictionary("MicroServiceLocation");
172 gds = new GetDictionaryService(dp, null);
173 result = (String) formatDictionary.invoke(gds, input);
174 assertNotNull(result);
176 dp.setDictionary("MicroServiceConfigName");
177 gds = new GetDictionaryService(dp, null);
178 result = (String) formatDictionary.invoke(gds, input);
179 assertNotNull(result);
181 dp.setDictionary("DCAEUUID");
182 gds = new GetDictionaryService(dp, null);
183 result = (String) formatDictionary.invoke(gds, input);
184 assertNotNull(result);
186 dp.setDictionary("MicroServiceModels");
187 gds = new GetDictionaryService(dp, null);
188 result = (String) formatDictionary.invoke(gds, input);
189 assertNotNull(result);
191 dp.setDictionary("PolicyScopeService");
192 gds = new GetDictionaryService(dp, null);
193 result = (String) formatDictionary.invoke(gds, input);
194 assertNotNull(result);
196 dp.setDictionary("PolicyScopeResource");
197 gds = new GetDictionaryService(dp, null);
198 result = (String) formatDictionary.invoke(gds, input);
199 assertNotNull(result);
201 dp.setDictionary("PolicyScopeType");
202 gds = new GetDictionaryService(dp, null);
203 result = (String) formatDictionary.invoke(gds, input);
204 assertNotNull(result);
206 dp.setDictionary("PolicyScopeClosedLoop");
207 gds = new GetDictionaryService(dp, null);
208 result = (String) formatDictionary.invoke(gds, input);
209 assertNotNull(result);
211 dp.setDictionary("GroupPolicyScopeList");
212 gds = new GetDictionaryService(dp, null);
213 result = (String) formatDictionary.invoke(gds, input);
214 assertNotNull(result);
216 dp.setDictionary("RiskType");
217 gds = new GetDictionaryService(dp, null);
218 result = (String) formatDictionary.invoke(gds, input);
219 assertNotNull(result);
221 dp.setDictionary("SafePolicyWarning");
222 gds = new GetDictionaryService(dp, null);
223 result = (String) formatDictionary.invoke(gds, input);
224 assertNotNull(result);
226 dp.setDictionary("MicroServiceDictionary");
227 gds = new GetDictionaryService(dp, null);
228 result = (String) formatDictionary.invoke(gds, input);
229 assertNotNull(result);