X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Fclamp%2Fclds%2Ftosca%2Fupdate%2FToscaConverterWithDictionarySupportItCase.java;h=3ff6ffb339ae52d1ef76ff9c486763c86dcfe876;hb=afac3121bfacc4d81903b1d8492613b0b77d3298;hp=b4f8b12458deb2315f84e545542abaf957165b40;hpb=3c327c1fe313cb31dcc914dcaee7f38255240099;p=clamp.git diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java index b4f8b124..3ff6ffb3 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights * reserved. - * ================================================================================ + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -29,10 +29,12 @@ import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.Application; +import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataExecutor; import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport; import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.ResourceFileUtil; +import org.onap.clamp.loop.service.Service; import org.onap.clamp.tosca.Dictionary; import org.onap.clamp.tosca.DictionaryElement; import org.onap.clamp.tosca.DictionaryService; @@ -51,6 +53,9 @@ public class ToscaConverterWithDictionarySupportItCase { @Autowired private ToscaMetadataParserWithDictionarySupport toscaMetadataParserWithDictionarySupport; + @Autowired + private ToscaMetadataExecutor toscaMetadataExecutor; + /** * This Test validates Tosca yaml with metadata tag that contains policy_model_type and acronym * parameters which defines the Tosca Policy name and its short name. @@ -103,16 +108,38 @@ public class ToscaConverterWithDictionarySupportItCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( - ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"), + ResourceFileUtil.getResourceAsString("tosca/new-converter/tosca_metadata_clamp_possible_values.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType( - "onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport); + "onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport, null); JSONAssert.assertEquals( ResourceFileUtil .getResourceAsString("tosca/new-converter/tca-with-metadata.json"), JsonUtils.GSON.toJson(jsonSchema), true); } + + @Test + @Transactional + public final void testMetadataClampPossibleValueWithExecutor() throws IOException, UnknownComponentException { + Service service = new Service(ResourceFileUtil.getResourceAsString("tosca/service-details.json"), + ResourceFileUtil.getResourceAsString("tosca/resource-details.json")); + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( + ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + + ".policies.controlloop.operational.common.Apex/versions/1.0" + + ".0?connectionTimeToLive=5000/.file"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + + JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType( + "onap.policies.controlloop.operational.common.Apex", toscaMetadataParserWithDictionarySupport, service); + + JSONAssert.assertEquals( + ResourceFileUtil + .getResourceAsString("tosca/new-converter/tosca_apex_with_metadata.json"), + JsonUtils.GSON.toJson(jsonSchema), true); + } }