2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019-2020 Nordix Foundation.
4 * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.models.tosca.simple.serialization;
24 import static org.junit.Assert.assertEquals;
25 import static org.junit.Assert.assertNotNull;
26 import static org.junit.Assert.assertTrue;
28 import java.util.Iterator;
30 import java.util.Map.Entry;
31 import org.junit.Before;
32 import org.junit.Test;
33 import org.onap.policy.common.utils.coder.CoderException;
34 import org.onap.policy.common.utils.coder.StandardCoder;
35 import org.onap.policy.common.utils.resources.ResourceUtils;
36 import org.onap.policy.models.base.PfConceptKey;
37 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
38 import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical;
39 import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues;
40 import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
41 import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType;
42 import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty;
43 import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
44 import org.slf4j.Logger;
45 import org.slf4j.LoggerFactory;
46 import org.yaml.snakeyaml.Yaml;
49 * Test serialization of monitoring policy types.
51 * @author Chenfei Gao (cgao@research.att.com)
53 public class MonitoringPolicyTypeSerializationTest {
55 private static final String DATATYPE_ROOT = "tosca.datatypes.Root";
57 private static final String STRING_TEXT = "string";
59 private static final String DCAE = "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server";
61 private static final String MONITORING = "onap.policies.Monitoring";
63 private static final String THRESHOLDS = "onap.datatypes.monitoring.thresholds";
65 private static final String TCA = "onap.datatypes.monitoring.tca_policy";
67 private static final String METRICS = "onap.datatypes.monitoring.metricsPerEventName";
69 private static final String VERSION_100 = "1.0.0";
71 private static final String VERSION_000 = "0.0.0";
73 private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringPolicyTypeSerializationTest.class);
75 private static final String MONITORING_TCA_YAML = "policytypes/onap.policies.monitoring.tcagen2.yaml";
76 private static final String MONITORING_COLLECTORS_YAML =
77 "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml";
79 private StandardCoder coder;
83 coder = new StandardCoder();
87 public void testDeserialization() throws Exception {
89 JpaToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML);
90 verifyTcaInputDeserialization(serviceTemplateFromYaml);
93 serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_COLLECTORS_YAML);
94 verifyCollectorInputDeserialization(serviceTemplateFromYaml);
98 public void testSerialization() throws Exception {
100 JpaToscaServiceTemplate tcaServiceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML);
101 String serializedServiceTemplateTca = serializeMonitoringServiceTemplate(tcaServiceTemplateFromYaml);
103 ToscaServiceTemplate toscaServiceTemplateFromJsonTca =
104 coder.decode(serializedServiceTemplateTca, ToscaServiceTemplate.class);
106 JpaToscaServiceTemplate serviceTemplateFromJsonTca = new JpaToscaServiceTemplate();
107 serviceTemplateFromJsonTca.fromAuthorative(toscaServiceTemplateFromJsonTca);
108 String serializedServiceTemplateTcaOut = serializeMonitoringServiceTemplate(serviceTemplateFromJsonTca);
109 assertEquals(serializedServiceTemplateTca, serializedServiceTemplateTcaOut);
112 JpaToscaServiceTemplate collectorServiceTemplateFromYaml =
113 deserializeMonitoringInputYaml(MONITORING_COLLECTORS_YAML);
114 String serializedServiceTemplateCollector =
115 serializeMonitoringServiceTemplate(collectorServiceTemplateFromYaml);
116 ToscaServiceTemplate toscaServiceTemplateFromJsonCollector =
117 coder.decode(serializedServiceTemplateCollector, ToscaServiceTemplate.class);
118 JpaToscaServiceTemplate serviceTemplateFromJsonCollector = new JpaToscaServiceTemplate();
119 serviceTemplateFromJsonCollector.fromAuthorative(toscaServiceTemplateFromJsonCollector);
120 String serializedServiceTemplateCollectorsOut =
121 serializeMonitoringServiceTemplate(serviceTemplateFromJsonCollector);
122 assertEquals(serializedServiceTemplateCollector, serializedServiceTemplateCollectorsOut);
125 private JpaToscaServiceTemplate deserializeMonitoringInputYaml(String resourcePath) throws Exception {
127 Yaml yaml = new Yaml();
128 String policyTypeYaml = ResourceUtils.getResourceAsString(resourcePath);
129 Object yamlObject = yaml.load(policyTypeYaml);
130 String yamlAsJsonString = coder.encode(yamlObject);
131 ToscaServiceTemplate serviceTemplate = coder.decode(yamlAsJsonString, ToscaServiceTemplate.class);
133 JpaToscaServiceTemplate jpaToscaServiceTemplate = new JpaToscaServiceTemplate();
134 jpaToscaServiceTemplate.fromAuthorative(serviceTemplate);
135 return jpaToscaServiceTemplate;
138 private void verifyTcaInputDeserialization(JpaToscaServiceTemplate serviceTemplate) {
140 // Sanity check the entire structure
141 assertNotNull(serviceTemplate);
142 LOGGER.info(serviceTemplate.validate("").toString());
143 assertTrue(serviceTemplate.validate("").isValid());
145 // Check tosca_definitions_version
146 assertEquals("tosca_simple_yaml_1_1_0", serviceTemplate.getToscaDefinitionsVersion());
148 // Check policy_types
149 Map<PfConceptKey, JpaToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap();
150 assertEquals(2, policyTypesConceptMap.size());
151 Iterator<Entry<PfConceptKey, JpaToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator();
153 Entry<PfConceptKey, JpaToscaPolicyType> firstPolicyType = policyTypesIter.next();
154 assertEquals(MONITORING, firstPolicyType.getKey().getName());
155 assertEquals(VERSION_100, firstPolicyType.getKey().getVersion());
156 assertEquals("tosca.policies.Root", firstPolicyType.getValue().getDerivedFrom().getName());
157 assertEquals("a base policy type for all policies that govern monitoring provisioning",
158 firstPolicyType.getValue().getDescription());
160 Entry<PfConceptKey, JpaToscaPolicyType> secondPolicyType = policyTypesIter.next();
161 assertEquals("onap.policies.monitoring.tcagen2", secondPolicyType.getKey().getName());
162 assertEquals(VERSION_100, secondPolicyType.getKey().getVersion());
163 assertEquals(MONITORING, secondPolicyType.getValue().getDerivedFrom().getName());
164 assertEquals(1, secondPolicyType.getValue().getProperties().size());
166 JpaToscaProperty property = secondPolicyType.getValue().getProperties().values().iterator().next();
167 assertEquals("onap.policies.monitoring.tcagen2", property.getKey().getParentKeyName());
168 assertEquals(VERSION_100, property.getKey().getParentKeyVersion());
169 assertEquals("tca.policy", property.getKey().getLocalName());
170 assertEquals(TCA, property.getType().getName());
171 assertEquals("TCA Policy JSON", property.getDescription());
174 Map<PfConceptKey, JpaToscaDataType> dataTypesConceptMap = serviceTemplate.getDataTypes().getConceptMap();
175 assertEquals(3, dataTypesConceptMap.size());
176 Iterator<Entry<PfConceptKey, JpaToscaDataType>> dataTypesIter = dataTypesConceptMap.entrySet().iterator();
178 Entry<PfConceptKey, JpaToscaDataType> firstDataType = dataTypesIter.next();
179 assertEquals(METRICS, firstDataType.getKey().getName());
180 JpaToscaDataType firstDataTypeVal = firstDataType.getValue();
181 assertEquals(DATATYPE_ROOT, firstDataTypeVal.getDerivedFrom().getName());
182 assertEquals(VERSION_000, firstDataTypeVal.getDerivedFrom().getVersion());
183 assertEquals(6, firstDataTypeVal.getProperties().size());
184 Iterator<JpaToscaProperty> firstDataTypePropertiesIter = firstDataTypeVal.getProperties().values().iterator();
186 JpaToscaProperty firstDataTypeFirstProperty = firstDataTypePropertiesIter.next();
187 assertEquals(METRICS, firstDataTypeFirstProperty.getKey().getParentKeyName());
188 assertEquals("controlLoopSchemaType", firstDataTypeFirstProperty.getKey().getLocalName());
189 assertEquals(STRING_TEXT, firstDataTypeFirstProperty.getType().getName());
190 assertTrue(firstDataTypeFirstProperty.isRequired());
191 assertEquals("Specifies Control Loop Schema Type for the event Name e.g. VNF, VM",
192 firstDataTypeFirstProperty.getDescription());
193 assertEquals(1, firstDataTypeFirstProperty.getConstraints().size());
194 assertEquals("org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues",
195 firstDataTypeFirstProperty.getConstraints().iterator().next().getClass().getName());
197 ((JpaToscaConstraintValidValues) (firstDataTypeFirstProperty.getConstraints().iterator().next()))
198 .getValidValues().size());
200 JpaToscaProperty firstDataTypeSecondProperty = firstDataTypePropertiesIter.next();
201 assertEquals(METRICS, firstDataTypeSecondProperty.getKey().getParentKeyName());
202 assertEquals("eventName", firstDataTypeSecondProperty.getKey().getLocalName());
203 assertEquals(STRING_TEXT, firstDataTypeSecondProperty.getType().getName());
204 assertTrue(firstDataTypeSecondProperty.isRequired());
205 assertEquals("Event name to which thresholds need to be applied", firstDataTypeSecondProperty.getDescription());
207 JpaToscaProperty firstDataTypeThirdProperty = firstDataTypePropertiesIter.next();
208 assertEquals(METRICS, firstDataTypeThirdProperty.getKey().getParentKeyName());
209 assertEquals("policyName", firstDataTypeThirdProperty.getKey().getLocalName());
210 assertEquals(STRING_TEXT, firstDataTypeThirdProperty.getType().getName());
211 assertTrue(firstDataTypeThirdProperty.isRequired());
212 assertEquals("TCA Policy Scope Name", firstDataTypeThirdProperty.getDescription());
214 JpaToscaProperty firstDataTypeFourthProperty = firstDataTypePropertiesIter.next();
215 assertEquals(METRICS, firstDataTypeFourthProperty.getKey().getParentKeyName());
216 assertEquals("policyScope", firstDataTypeFourthProperty.getKey().getLocalName());
217 assertEquals(STRING_TEXT, firstDataTypeFourthProperty.getType().getName());
218 assertTrue(firstDataTypeFourthProperty.isRequired());
219 assertEquals("TCA Policy Scope", firstDataTypeFourthProperty.getDescription());
221 JpaToscaProperty firstDataTypeFifthProperty = firstDataTypePropertiesIter.next();
222 assertEquals(METRICS, firstDataTypeFifthProperty.getKey().getParentKeyName());
223 assertEquals("policyVersion", firstDataTypeFifthProperty.getKey().getLocalName());
224 assertEquals(STRING_TEXT, firstDataTypeFifthProperty.getType().getName());
225 assertTrue(firstDataTypeFifthProperty.isRequired());
226 assertEquals("TCA Policy Scope Version", firstDataTypeFifthProperty.getDescription());
228 JpaToscaProperty firstDataTypeSixthProperty = firstDataTypePropertiesIter.next();
229 assertEquals(METRICS, firstDataTypeSixthProperty.getKey().getParentKeyName());
230 assertEquals("thresholds", firstDataTypeSixthProperty.getKey().getLocalName());
231 assertEquals("list", firstDataTypeSixthProperty.getType().getName());
232 assertTrue(firstDataTypeSixthProperty.isRequired());
233 assertEquals("Thresholds associated with eventName", firstDataTypeSixthProperty.getDescription());
234 assertNotNull(firstDataTypeSixthProperty.getEntrySchema());
235 assertEquals(THRESHOLDS, firstDataTypeSixthProperty.getEntrySchema().getType().getName());
237 Entry<PfConceptKey, JpaToscaDataType> secondDataType = dataTypesIter.next();
238 assertEquals(TCA, secondDataType.getKey().getName());
239 JpaToscaDataType secondDataTypeVal = secondDataType.getValue();
240 assertEquals(DATATYPE_ROOT, secondDataTypeVal.getDerivedFrom().getName());
241 assertEquals(VERSION_000, secondDataTypeVal.getDerivedFrom().getVersion());
242 assertEquals(2, secondDataTypeVal.getProperties().size());
243 Iterator<JpaToscaProperty> secondDataTypePropertiesIter = secondDataTypeVal.getProperties().values().iterator();
245 JpaToscaProperty secondDataTypeFirstProperty = secondDataTypePropertiesIter.next();
246 assertEquals(TCA, secondDataTypeFirstProperty.getKey().getParentKeyName());
247 assertEquals("domain", secondDataTypeFirstProperty.getKey().getLocalName());
248 assertEquals(STRING_TEXT, secondDataTypeFirstProperty.getType().getName());
249 assertTrue(secondDataTypeFirstProperty.isRequired());
250 assertEquals("Domain name to which TCA needs to be applied", secondDataTypeFirstProperty.getDescription());
251 assertEquals("measurementsForVfScaling", secondDataTypeFirstProperty.getDefaultValue());
252 assertEquals(1, secondDataTypeFirstProperty.getConstraints().size());
253 assertTrue(secondDataTypeFirstProperty.getConstraints().iterator().next() instanceof JpaToscaConstraintLogical);
254 assertEquals("measurementsForVfScaling",
255 ((JpaToscaConstraintLogical) (secondDataTypeFirstProperty.getConstraints().iterator().next()))
258 JpaToscaProperty secondDataTypeSecondProperty = secondDataTypePropertiesIter.next();
259 assertEquals(TCA, secondDataTypeSecondProperty.getKey().getParentKeyName());
260 assertEquals("metricsPerEventName", secondDataTypeSecondProperty.getKey().getLocalName());
261 assertEquals("list", secondDataTypeSecondProperty.getType().getName());
262 assertTrue(secondDataTypeSecondProperty.isRequired());
263 assertEquals("Contains eventName and threshold details that need to be applied to given eventName",
264 secondDataTypeSecondProperty.getDescription());
265 assertNotNull(secondDataTypeSecondProperty.getEntrySchema());
266 assertEquals(METRICS, secondDataTypeSecondProperty.getEntrySchema().getType().getName());
268 Entry<PfConceptKey, JpaToscaDataType> thirdDataType = dataTypesIter.next();
269 assertEquals(THRESHOLDS, thirdDataType.getKey().getName());
270 JpaToscaDataType thirdDataTypeVal = thirdDataType.getValue();
271 assertEquals(DATATYPE_ROOT, thirdDataTypeVal.getDerivedFrom().getName());
272 assertEquals(VERSION_000, thirdDataTypeVal.getDerivedFrom().getVersion());
273 assertEquals(7, thirdDataTypeVal.getProperties().size());
274 Iterator<JpaToscaProperty> thirdDataTypePropertiesIter = thirdDataTypeVal.getProperties().values().iterator();
276 JpaToscaProperty thirdDataTypeFirstProperty = thirdDataTypePropertiesIter.next();
277 assertEquals(THRESHOLDS, thirdDataTypeFirstProperty.getKey().getParentKeyName());
278 assertEquals("closedLoopControlName", thirdDataTypeFirstProperty.getKey().getLocalName());
279 assertEquals(STRING_TEXT, thirdDataTypeFirstProperty.getType().getName());
280 assertTrue(thirdDataTypeFirstProperty.isRequired());
281 assertEquals("Closed Loop Control Name associated with the threshold",
282 thirdDataTypeFirstProperty.getDescription());
284 JpaToscaProperty thirdDataTypeSecondProperty = thirdDataTypePropertiesIter.next();
285 assertEquals(THRESHOLDS, thirdDataTypeSecondProperty.getKey().getParentKeyName());
286 assertEquals("closedLoopEventStatus", thirdDataTypeSecondProperty.getKey().getLocalName());
287 assertEquals(STRING_TEXT, thirdDataTypeSecondProperty.getType().getName());
288 assertTrue(thirdDataTypeSecondProperty.isRequired());
289 assertEquals("Closed Loop Event Status of the threshold", thirdDataTypeSecondProperty.getDescription());
290 assertNotNull(thirdDataTypeSecondProperty.getConstraints());
291 assertEquals(1, thirdDataTypeSecondProperty.getConstraints().size());
292 assertEquals("JpaToscaConstraintValidValues(validValues=[ONSET, ABATED])",
293 thirdDataTypeSecondProperty.getConstraints().iterator().next().toString());
294 assertTrue(thirdDataTypeSecondProperty.getConstraints().iterator()
295 .next() instanceof JpaToscaConstraintValidValues);
297 ((JpaToscaConstraintValidValues) (thirdDataTypeSecondProperty.getConstraints().iterator().next()))
298 .getValidValues().size());
300 JpaToscaProperty thirdDataTypeThirdProperty = thirdDataTypePropertiesIter.next();
301 assertEquals(THRESHOLDS, thirdDataTypeThirdProperty.getKey().getParentKeyName());
302 assertEquals("direction", thirdDataTypeThirdProperty.getKey().getLocalName());
303 assertEquals(STRING_TEXT, thirdDataTypeThirdProperty.getType().getName());
304 assertTrue(thirdDataTypeThirdProperty.isRequired());
305 assertEquals("Direction of the threshold", thirdDataTypeThirdProperty.getDescription());
306 assertNotNull(thirdDataTypeThirdProperty.getConstraints());
307 assertEquals(1, thirdDataTypeThirdProperty.getConstraints().size());
309 "JpaToscaConstraintValidValues(validValues=[LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL, EQUAL])",
310 thirdDataTypeThirdProperty.getConstraints().iterator().next().toString());
312 ((JpaToscaConstraintValidValues) (thirdDataTypeThirdProperty.getConstraints().iterator().next()))
313 .getValidValues().size());
315 JpaToscaProperty thirdDataTypeFourthProperty = thirdDataTypePropertiesIter.next();
316 assertEquals(THRESHOLDS, thirdDataTypeFourthProperty.getKey().getParentKeyName());
317 assertEquals("fieldPath", thirdDataTypeFourthProperty.getKey().getLocalName());
318 assertEquals(STRING_TEXT, thirdDataTypeFourthProperty.getType().getName());
319 assertTrue(thirdDataTypeFourthProperty.isRequired());
320 assertEquals("Json field Path as per CEF message which needs to be analyzed for TCA",
321 thirdDataTypeFourthProperty.getDescription());
322 assertNotNull(thirdDataTypeFourthProperty.getConstraints());
323 assertEquals(1, thirdDataTypeFourthProperty.getConstraints().size());
325 ((JpaToscaConstraintValidValues) (thirdDataTypeFourthProperty.getConstraints().iterator().next()))
326 .getValidValues().size());
328 JpaToscaProperty thirdDataTypeFifthProperty = thirdDataTypePropertiesIter.next();
329 assertEquals(THRESHOLDS, thirdDataTypeFifthProperty.getKey().getParentKeyName());
330 assertEquals("severity", thirdDataTypeFifthProperty.getKey().getLocalName());
331 assertEquals(STRING_TEXT, thirdDataTypeFifthProperty.getType().getName());
332 assertTrue(thirdDataTypeFifthProperty.isRequired());
333 assertEquals("Threshold Event Severity", thirdDataTypeFifthProperty.getDescription());
334 assertNotNull(thirdDataTypeFifthProperty.getConstraints());
335 assertEquals(1, thirdDataTypeFifthProperty.getConstraints().size());
336 assertEquals("JpaToscaConstraintValidValues(validValues=[CRITICAL, MAJOR, MINOR, WARNING, NORMAL])",
337 thirdDataTypeFifthProperty.getConstraints().iterator().next().toString());
339 ((JpaToscaConstraintValidValues) (thirdDataTypeFifthProperty.getConstraints().iterator().next()))
340 .getValidValues().size());
343 JpaToscaProperty thirdDataTypeSixthProperty = thirdDataTypePropertiesIter.next();
344 assertEquals(THRESHOLDS, thirdDataTypeSixthProperty.getKey().getParentKeyName());
345 assertEquals("thresholdValue", thirdDataTypeSixthProperty.getKey().getLocalName());
346 assertEquals("integer", thirdDataTypeSixthProperty.getType().getName());
347 assertTrue(thirdDataTypeSixthProperty.isRequired());
348 assertEquals("Threshold value for the field Path inside CEF message",
349 thirdDataTypeSixthProperty.getDescription());
351 JpaToscaProperty thirdDataTypeSeventhProperty = thirdDataTypePropertiesIter.next();
352 assertEquals(THRESHOLDS, thirdDataTypeSeventhProperty.getKey().getParentKeyName());
353 assertEquals("version", thirdDataTypeSeventhProperty.getKey().getLocalName());
354 assertEquals(STRING_TEXT, thirdDataTypeSeventhProperty.getType().getName());
355 assertTrue(thirdDataTypeSeventhProperty.isRequired());
356 assertEquals("Version number associated with the threshold", thirdDataTypeSeventhProperty.getDescription());
359 private void verifyCollectorInputDeserialization(JpaToscaServiceTemplate serviceTemplate) {
361 // Sanity check the entire structure
362 assertNotNull(serviceTemplate);
363 LOGGER.info(serviceTemplate.validate("").toString());
364 assertTrue(serviceTemplate.validate("").isValid());
366 // Check tosca_definitions_version
367 assertEquals("tosca_simple_yaml_1_1_0", serviceTemplate.getToscaDefinitionsVersion());
369 // Check policy_types
370 Map<PfConceptKey, JpaToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap();
371 assertEquals(2, policyTypesConceptMap.size());
372 Iterator<Entry<PfConceptKey, JpaToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator();
374 Entry<PfConceptKey, JpaToscaPolicyType> firstPolicyType = policyTypesIter.next();
375 assertEquals(MONITORING, firstPolicyType.getKey().getName());
376 assertEquals(VERSION_100, firstPolicyType.getKey().getVersion());
377 assertEquals("tosca.policies.Root", firstPolicyType.getValue().getDerivedFrom().getName());
378 assertEquals("a base policy type for all policies that govern monitoring provisioning",
379 firstPolicyType.getValue().getDescription());
381 Entry<PfConceptKey, JpaToscaPolicyType> secondPolicyType = policyTypesIter.next();
382 assertEquals(DCAE, secondPolicyType.getKey().getName());
383 assertEquals(VERSION_100, secondPolicyType.getKey().getVersion());
384 assertEquals("onap.policies.Monitoring", secondPolicyType.getValue().getDerivedFrom().getName());
385 assertEquals(2, secondPolicyType.getValue().getProperties().size());
387 Iterator<JpaToscaProperty> propertiesIter = secondPolicyType.getValue().getProperties().values().iterator();
389 JpaToscaProperty firstProperty = propertiesIter.next();
390 assertEquals(DCAE, firstProperty.getKey().getParentKeyName());
391 assertEquals(VERSION_100, firstProperty.getKey().getParentKeyVersion());
392 assertEquals("buscontroller_feed_publishing_endpoint", firstProperty.getKey().getLocalName());
393 assertEquals(STRING_TEXT, firstProperty.getType().getName());
394 assertEquals("DMAAP Bus Controller feed endpoint", firstProperty.getDescription());
396 JpaToscaProperty secondProperty = propertiesIter.next();
397 assertEquals(DCAE, secondProperty.getKey().getParentKeyName());
398 assertEquals(VERSION_100, secondProperty.getKey().getParentKeyVersion());
399 assertEquals("datafile.policy", secondProperty.getKey().getLocalName());
400 assertEquals(STRING_TEXT, secondProperty.getType().getName());
401 assertEquals("datafile Policy JSON as string", secondProperty.getDescription());
404 private String serializeMonitoringServiceTemplate(JpaToscaServiceTemplate serviceTemplate) throws CoderException {
405 ToscaServiceTemplate toscaServiceTemplate = serviceTemplate.toAuthorative();
406 return coder.encode(toscaServiceTemplate);