From e65d457a2dfd6ebb5e1f5a28b74f05c16c285dc3 Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 24 Mar 2020 08:51:20 -0700 Subject: Improve metadata support Improve the metadata support for CDS and default values Issue-ID: CLAMP-786 Signed-off-by: sebdet Change-Id: I8a24e31a93ff1e288ec8f0f6d522b1b15d39a8d2 --- .../tosca/DictionaryRepositoriesTestItCase.java | 4 +- .../ToscaConverterWithDictionarySupportItCase.java | 5 ++- .../1.0.0?connectionTimeToLive=5000/.file | 4 +- .../1.0.0?connectionTimeToLive=5000/.file | 4 +- .../new-converter/tosca_apex_with_metadata.json | 45 +++++++++++++++++++--- 5 files changed, 49 insertions(+), 13 deletions(-) (limited to 'src/test') diff --git a/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java b/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java index 2faf38f0..092d35b0 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java +++ b/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java @@ -76,12 +76,12 @@ public class DictionaryRepositoriesTestItCase { dictionaryRepository.save(dictionaryTest1); List res1 = dictionaryRepository.getAllDictionaryNames(); - assertThat(res1.size()).isGreaterThan(1); + assertThat(res1.size()).isEqualTo(1); assertThat(res1).contains("testDictionary1"); dictionaryRepository.save(dictionaryTest2); List res2 = dictionaryRepository.getAllDictionaryNames(); - assertThat(res2.size()).isGreaterThan(2); + assertThat(res2.size()).isEqualTo(2); assertThat(res2).contains("testDictionary1"); assertThat(res2).contains("testDictionary2"); } 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 3ff6ffb3..ea11f800 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 @@ -41,10 +41,12 @@ import org.onap.clamp.tosca.DictionaryService; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) +@ActiveProfiles(profiles = "clamp-default,clamp-default-user,default-dictionary-elements") public class ToscaConverterWithDictionarySupportItCase { @Autowired @@ -108,7 +110,8 @@ public class ToscaConverterWithDictionarySupportItCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( - ResourceFileUtil.getResourceAsString("tosca/new-converter/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")); diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file index ae0dfbfc..49f409ae 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file @@ -85,13 +85,13 @@ data_types: description: The actor performing the operation. required: true metadata: - clamp_possible_values: Dictionary:DefaultActor + clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor operation: type: string description: The operation the actor is performing. required: true metadata: - clamp_possible_values: ClampExecution:CDS/operation + clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation target: type: onap.datatype.controlloop.Target description: The resource the operation should be performed on. diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file index 1f8723c3..af7a61ef 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file @@ -73,13 +73,13 @@ data_types: description: The actor performing the operation. required: true metadata: - clamp_possible_values: Dictionary:DefaultActor + clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor operation: type: string description: The operation the actor is performing. required: true metadata: - clamp_possible_values: ClampExecution:CDS/operation + clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operations target: type: onap.datatype.controlloop.Target description: The resource the operation should be performed on. diff --git a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json index a44b94e0..3fda1111 100644 --- a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json +++ b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json @@ -66,15 +66,20 @@ "type": "string", "description": "The actor performing the operation.", "enum": [ - "CDS", + "SDNR", "SDNC", - "SO" + "VFC", + "SO", + "APPC", + "CDS" ], "options": { "enum_titles": [ - "CDS", + "SDNR", "SDNC", - "SO" + "VFC", + "SO", + "APPC" ] } }, @@ -82,13 +87,41 @@ "type": "string", "description": "The operation the actor is performing.", "enum": [ + "BandwidthOnDemand", + "VF Module Delete", + "Reroute", + "VF Module Create", + "ModifyConfig", + "Rebuild", + "Restart", + "Migrate", + "Health-Check", "resource-assignment", "activate", "activate-restconf", "activate-cli", "assign-activate", "imperative-test-wf" - ] + ], + "options": { + "enum_titles": [ + "BandwidthOnDemand (SDNC operation)", + "VF Module Delete (SO operation)", + "Reroute (SDNC operation)", + "VF Module Create (SO operation)", + "ModifyConfig (APPC/VFC operation)", + "Rebuild (APPC operation)", + "Restart (APPC operation)", + "Migrate (APPC operation)", + "Health-Check (APPC operation)", + "resource-assignment (CDS operation)", + "activate (CDS operation)", + "activate-restconf (CDS operation)", + "activate-cli (CDS operation)", + "assign-activate (CDS operation)", + "imperative-test-wf (CDS operation)" + ] + } }, "target": { "title": "onap.datatype.controlloop.Target", @@ -294,7 +327,7 @@ "payload": { "type": "object", "description": "Name/value pairs of payload information passed by Policy to the actor", - "anyOf": [ + "enum": [ { "title": "resource-assignment", "properties": { -- cgit 1.2.3-korg