Merge "Fix more sonar issues in models: yaml to dao"
[policy/models.git] / models-tosca / src / test / java / org / onap / policy / models / tosca / authorative / provider / AuthorativeToscaProviderPolicyTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  Modifications Copyright (C) 2019 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
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.models.tosca.authorative.provider;
23
24 import static org.assertj.core.api.Assertions.assertThatThrownBy;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertNotNull;
27 import static org.junit.Assert.assertTrue;
28
29 import java.util.ArrayList;
30 import java.util.List;
31 import java.util.Map;
32 import java.util.Properties;
33
34 import org.eclipse.persistence.config.PersistenceUnitProperties;
35 import org.junit.After;
36 import org.junit.Before;
37 import org.junit.Test;
38 import org.onap.policy.common.utils.coder.CoderException;
39 import org.onap.policy.common.utils.coder.StandardCoder;
40 import org.onap.policy.common.utils.resources.ResourceUtils;
41 import org.onap.policy.models.base.PfConceptKey;
42 import org.onap.policy.models.base.PfModelException;
43 import org.onap.policy.models.dao.DaoParameters;
44 import org.onap.policy.models.dao.PfDao;
45 import org.onap.policy.models.dao.PfDaoFactory;
46 import org.onap.policy.models.dao.impl.DefaultPfDao;
47 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
48 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
49 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
50 import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
51 import org.yaml.snakeyaml.Yaml;
52
53 /**
54  * Test of the {@link AuthorativeToscaProvider} class.
55  *
56  * @author Liam Fallon (liam.fallon@est.tech)
57  */
58 public class AuthorativeToscaProviderPolicyTest {
59     private static final String VERSION = "version";
60     private static final String VCPE_JSON = "policies/vCPE.policy.monitoring.input.tosca.json";
61     private static final String POLICY_AND_VERSION = "onap.restart.tca:1.0.0";
62     private static final String POLICY1 = "onap.restart.tca";
63     private static final String DAO_IS_NULL = "dao is marked @NonNull but is null";
64     private static final String VERSION_100 = "1.0.0";
65     private PfDao pfDao;
66     private StandardCoder standardCoder;
67
68     /**
69      * Set up the DAO towards the database.
70      *
71      * @throws Exception on database errors
72      */
73     @Before
74     public void setupDao() throws Exception {
75         final DaoParameters daoParameters = new DaoParameters();
76         daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
77
78         daoParameters.setPersistenceUnit("ToscaConceptTest");
79
80         Properties jdbcProperties = new Properties();
81         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy");
82         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY");
83
84         // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
85         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver");
86         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb");
87
88         daoParameters.setJdbcProperties(jdbcProperties);
89
90         pfDao = new PfDaoFactory().createPfDao(daoParameters);
91         pfDao.init(daoParameters);
92     }
93
94     /**
95      * Set up GSON.
96      */
97     @Before
98     public void setupGson() {
99         standardCoder = new StandardCoder();
100     }
101
102     @After
103     public void teardown() {
104         pfDao.close();
105     }
106
107     @Test
108     public void testPoliciesGet() throws Exception {
109         assertThatThrownBy(() -> {
110             new AuthorativeToscaProvider().getPolicies(null, null, null);
111         }).hasMessage(DAO_IS_NULL);
112
113         assertThatThrownBy(() -> {
114             new AuthorativeToscaProvider().getPolicyList(null, null, null);
115         }).hasMessage(DAO_IS_NULL);
116
117         createPolicyTypes();
118
119         ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
120                 ResourceUtils.getResourceAsString(VCPE_JSON),
121                 ToscaServiceTemplate.class);
122
123         assertNotNull(toscaServiceTemplate);
124         ToscaServiceTemplate createdServiceTemplate =
125                 new AuthorativeToscaProvider().createPolicies(pfDao, toscaServiceTemplate);
126
127         PfConceptKey policyKey = new PfConceptKey(POLICY_AND_VERSION);
128
129         ToscaPolicy beforePolicy =
130                 toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
131         ToscaPolicy createdPolicy =
132                 createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
133         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
134         assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
135
136         ToscaServiceTemplate gotServiceTemplate =
137                 new AuthorativeToscaProvider().getPolicies(pfDao, policyKey.getName(), policyKey.getVersion());
138
139         ToscaPolicy gotPolicy =
140                 gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
141         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
142         assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
143
144         List<ToscaPolicy> gotPolicyList =
145                 new AuthorativeToscaProvider().getPolicyList(pfDao, POLICY1, VERSION_100);
146         assertEquals(1, gotPolicyList.size());
147         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
148
149         gotPolicyList = new AuthorativeToscaProvider().getPolicyList(pfDao, POLICY1, null);
150         assertEquals(1, gotPolicyList.size());
151         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
152
153         gotPolicyList = new AuthorativeToscaProvider().getPolicyList(pfDao, null, null);
154         assertEquals(1, gotPolicyList.size());
155         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
156
157         gotPolicyList = new AuthorativeToscaProvider().getPolicyList(pfDao, null, VERSION_100);
158         assertEquals(1, gotPolicyList.size());
159         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
160
161         gotPolicyList = new AuthorativeToscaProvider().getPolicyList(pfDao, "Nonexistant", VERSION_100);
162         assertEquals(0, gotPolicyList.size());
163     }
164
165     @Test
166     public void testPoliciesGetFiltered() throws Exception {
167         assertThatThrownBy(() -> {
168             new AuthorativeToscaProvider().getFilteredPolicies(null, null);
169         }).hasMessage(DAO_IS_NULL);
170
171         assertThatThrownBy(() -> {
172             new AuthorativeToscaProvider().getFilteredPolicies(null, ToscaPolicyFilter.builder().build());
173         }).hasMessage(DAO_IS_NULL);
174
175         assertThatThrownBy(() -> {
176             new AuthorativeToscaProvider().getFilteredPolicies(pfDao, null);
177         }).hasMessage("filter is marked @NonNull but is null");
178
179         assertThatThrownBy(() -> {
180             new AuthorativeToscaProvider().getFilteredPolicyList(null, null);
181         }).hasMessage(DAO_IS_NULL);
182
183         assertThatThrownBy(() -> {
184             new AuthorativeToscaProvider().getFilteredPolicyList(null, ToscaPolicyFilter.builder().build());
185         }).hasMessage(DAO_IS_NULL);
186
187         assertThatThrownBy(() -> {
188             new AuthorativeToscaProvider().getFilteredPolicyList(pfDao, null);
189         }).hasMessage("filter is marked @NonNull but is null");
190
191         createPolicyTypes();
192
193         ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
194                 ResourceUtils.getResourceAsString(VCPE_JSON),
195                 ToscaServiceTemplate.class);
196
197         assertNotNull(toscaServiceTemplate);
198         ToscaServiceTemplate createdServiceTemplate =
199                 new AuthorativeToscaProvider().createPolicies(pfDao, toscaServiceTemplate);
200
201         PfConceptKey policyKey = new PfConceptKey(POLICY_AND_VERSION);
202
203         ToscaPolicy beforePolicy =
204                 toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
205         ToscaPolicy createdPolicy =
206                 createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
207         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
208         assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
209
210         ToscaServiceTemplate gotServiceTemplate =
211                 new AuthorativeToscaProvider().getFilteredPolicies(pfDao, ToscaPolicyFilter.builder().build());
212
213         ToscaPolicy gotPolicy =
214                 gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
215         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
216         assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
217
218         gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicies(pfDao,
219                 ToscaPolicyFilter.builder().name(policyKey.getName()).build());
220
221         gotPolicy = gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
222         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
223         assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
224
225         gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicies(pfDao,
226                 ToscaPolicyFilter.builder().name(policyKey.getName()).version(VERSION_100).build());
227
228         gotPolicy = gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
229         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
230         assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
231
232         List<ToscaPolicy> gotPolicyList =
233                 new AuthorativeToscaProvider().getPolicyList(pfDao, POLICY1, VERSION_100);
234         assertEquals(1, gotPolicyList.size());
235         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
236
237         gotPolicyList =
238                 new AuthorativeToscaProvider().getFilteredPolicyList(pfDao, ToscaPolicyFilter.builder().build());
239         assertEquals(1, gotPolicyList.size());
240         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
241
242         gotPolicyList = new AuthorativeToscaProvider().getFilteredPolicyList(pfDao,
243                 ToscaPolicyFilter.builder().name(policyKey.getName()).build());
244         assertEquals(1, gotPolicyList.size());
245         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
246
247         gotPolicyList = new AuthorativeToscaProvider().getFilteredPolicyList(pfDao,
248                 ToscaPolicyFilter.builder().name(policyKey.getName()).version(VERSION_100).build());
249         assertEquals(1, gotPolicyList.size());
250         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicyList.get(0)));
251     }
252
253     @Test
254     public void testPolicyCreate() throws Exception {
255         assertThatThrownBy(() -> {
256             new AuthorativeToscaProvider().createPolicies(null, null);
257         }).hasMessage(DAO_IS_NULL);
258
259         assertThatThrownBy(() -> {
260             new AuthorativeToscaProvider().createPolicies(null, new ToscaServiceTemplate());
261         }).hasMessage(DAO_IS_NULL);
262
263         assertThatThrownBy(() -> {
264             new AuthorativeToscaProvider().createPolicies(pfDao, null);
265         }).hasMessage("serviceTemplate is marked @NonNull but is null");
266
267         createPolicyTypes();
268
269         ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
270                 ResourceUtils.getResourceAsString(VCPE_JSON),
271                 ToscaServiceTemplate.class);
272
273         assertNotNull(toscaServiceTemplate);
274         ToscaServiceTemplate createdServiceTemplate =
275                 new AuthorativeToscaProvider().createPolicies(pfDao, toscaServiceTemplate);
276
277         PfConceptKey policyKey = new PfConceptKey(POLICY_AND_VERSION);
278
279         ToscaPolicy beforePolicy =
280                 toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
281         ToscaPolicy createdPolicy =
282                 createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
283         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
284         assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
285     }
286
287     @Test
288     public void testPolicyUpdate() throws Exception {
289         assertThatThrownBy(() -> {
290             new AuthorativeToscaProvider().createPolicies(null, null);
291         }).hasMessage(DAO_IS_NULL);
292
293         assertThatThrownBy(() -> {
294             new AuthorativeToscaProvider().updatePolicies(null, null);
295         }).hasMessage(DAO_IS_NULL);
296
297         assertThatThrownBy(() -> {
298             new AuthorativeToscaProvider().updatePolicies(null, new ToscaServiceTemplate());
299         }).hasMessage(DAO_IS_NULL);
300
301         assertThatThrownBy(() -> {
302             new AuthorativeToscaProvider().updatePolicies(pfDao, null);
303         }).hasMessage("serviceTemplate is marked @NonNull but is null");
304
305         createPolicyTypes();
306
307         ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
308                 ResourceUtils.getResourceAsString(VCPE_JSON),
309                 ToscaServiceTemplate.class);
310
311         assertNotNull(toscaServiceTemplate);
312         ToscaServiceTemplate createdServiceTemplate =
313                 new AuthorativeToscaProvider().createPolicies(pfDao, toscaServiceTemplate);
314
315         PfConceptKey policyKey = new PfConceptKey(POLICY_AND_VERSION);
316
317         ToscaPolicy beforePolicy =
318                 toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
319         ToscaPolicy createdPolicy =
320                 createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
321         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
322         assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
323
324         ToscaServiceTemplate updatedServiceTemplate =
325                 new AuthorativeToscaProvider().updatePolicies(pfDao, toscaServiceTemplate);
326
327         ToscaPolicy updatedPolicy =
328                 updatedServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
329         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, updatedPolicy));
330         assertTrue(beforePolicy.getType().equals(updatedPolicy.getType()));
331     }
332
333     @Test
334     public void testPoliciesDelete() throws Exception {
335         assertThatThrownBy(() -> {
336             new AuthorativeToscaProvider().deletePolicy(null, null, null);
337         }).hasMessage(DAO_IS_NULL);
338
339         assertThatThrownBy(() -> {
340             new AuthorativeToscaProvider().deletePolicy(null, null, VERSION);
341         }).hasMessage(DAO_IS_NULL);
342
343         assertThatThrownBy(() -> {
344             new AuthorativeToscaProvider().deletePolicy(null, "name", null);
345         }).hasMessage(DAO_IS_NULL);
346
347         assertThatThrownBy(() -> {
348             new AuthorativeToscaProvider().deletePolicy(null, "name", VERSION);
349         }).hasMessage(DAO_IS_NULL);
350
351         assertThatThrownBy(() -> {
352             new AuthorativeToscaProvider().deletePolicy(pfDao, null, null);
353         }).hasMessage("name is marked @NonNull but is null");
354
355         assertThatThrownBy(() -> {
356             new AuthorativeToscaProvider().deletePolicy(pfDao, null, VERSION);
357         }).hasMessage("name is marked @NonNull but is null");
358
359         assertThatThrownBy(() -> {
360             new AuthorativeToscaProvider().deletePolicy(pfDao, "name", null);
361         }).hasMessage("version is marked @NonNull but is null");
362
363         createPolicyTypes();
364
365         ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
366                 ResourceUtils.getResourceAsString(VCPE_JSON),
367                 ToscaServiceTemplate.class);
368
369         assertNotNull(toscaServiceTemplate);
370         ToscaServiceTemplate createdServiceTemplate =
371                 new AuthorativeToscaProvider().createPolicies(pfDao, toscaServiceTemplate);
372
373         PfConceptKey policyKey = new PfConceptKey(POLICY_AND_VERSION);
374
375         ToscaPolicy beforePolicy =
376                 toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
377         ToscaPolicy createdPolicy =
378                 createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
379         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
380         assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
381
382         ToscaServiceTemplate deletedServiceTemplate =
383                 new AuthorativeToscaProvider().deletePolicy(pfDao, policyKey.getName(), policyKey.getVersion());
384
385         ToscaPolicy deletedPolicy =
386                 deletedServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
387         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
388         assertTrue(beforePolicy.getType().equals(deletedPolicy.getType()));
389
390         ToscaServiceTemplate gotServiceTemplate =
391                 new AuthorativeToscaProvider().getPolicies(pfDao, policyKey.getName(), policyKey.getVersion());
392
393         assertTrue(gotServiceTemplate.getToscaTopologyTemplate().getPolicies().isEmpty());
394     }
395
396     @Test
397     public void testAssertPoliciesExist() {
398         ToscaServiceTemplate testServiceTemplate = new ToscaServiceTemplate();
399
400         assertThatThrownBy(() -> {
401             new AuthorativeToscaProvider().deletePolicy(pfDao, "name", null);
402         }).hasMessage("version is marked @NonNull but is null");
403
404         assertThatThrownBy(() -> {
405             new AuthorativeToscaProvider().createPolicies(pfDao, testServiceTemplate);
406         }).hasMessage("topology template not specified on service template");
407
408         testServiceTemplate.setToscaTopologyTemplate(new ToscaTopologyTemplate());
409         assertThatThrownBy(() -> {
410             new AuthorativeToscaProvider().createPolicies(pfDao, testServiceTemplate);
411         }).hasMessage("no policies specified on topology template of service template");
412
413         testServiceTemplate.getToscaTopologyTemplate().setPolicies(new ArrayList<>());
414         assertThatThrownBy(() -> {
415             new AuthorativeToscaProvider().createPolicies(pfDao, testServiceTemplate);
416         }).hasMessage("An incoming list of concepts must have at least one entry");
417     }
418
419     @Test
420     public void testEntityMaps() throws CoderException, PfModelException {
421         Object yamlObject = new Yaml().load(
422                 ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"));
423         String yamlAsJsonString = new StandardCoder().encode(yamlObject);
424
425         ToscaServiceTemplate toscaServiceTemplatePolicyType =
426                 standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class);
427
428         assertNotNull(toscaServiceTemplatePolicyType);
429         new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplatePolicyType);
430
431         assertEquals(3, toscaServiceTemplatePolicyType.getDataTypesAsMap().size());
432         assertEquals(2, toscaServiceTemplatePolicyType.getPolicyTypesAsMap().size());
433
434         ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(
435                 ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"),
436                 ToscaServiceTemplate.class);
437
438         assertNotNull(toscaServiceTemplate);
439         ToscaServiceTemplate createdServiceTemplate =
440                 new AuthorativeToscaProvider().createPolicies(pfDao, toscaServiceTemplate);
441
442         PfConceptKey policyKey = new PfConceptKey("onap.restart.tca:1.0.0");
443
444         ToscaPolicy beforePolicy =
445                 toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
446         ToscaPolicy createdPolicy =
447                 createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
448         assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
449         assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
450
451         assertEquals(1, toscaServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size());
452         assertEquals(1, createdServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size());
453
454         Map<String, ToscaPolicy> policyMapItem = createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0);
455         createdServiceTemplate.getToscaTopologyTemplate().getPolicies().add(policyMapItem);
456
457         assertThatThrownBy(() -> {
458             createdServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap();
459         }).hasMessageContaining("list of map of entities contains more than one entity with key");
460     }
461
462     private void createPolicyTypes() throws CoderException, PfModelException {
463         Object yamlObject = new Yaml().load(
464                 ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"));
465         String yamlAsJsonString = new StandardCoder().encode(yamlObject);
466
467         ToscaServiceTemplate toscaServiceTemplatePolicyType =
468                 standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class);
469
470         assertNotNull(toscaServiceTemplatePolicyType);
471         new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplatePolicyType);
472     }
473 }