diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-09-04 20:24:35 +0000 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-09-04 20:47:03 +0000 |
commit | 594b5e1c919089c110e6aa9b9d1c00b96a9e96f9 (patch) | |
tree | aeb353f21da3ee3982e5a0d1d1842b13bb490c3c /components/resource-dict/src/test | |
parent | 9abed7f23417e24039d463f84156c1d9fef672f7 (diff) |
Controller Blueprints Microservice
Refactor controller blueprint core and resource dictionary modules to components module.
Change-Id: If5ba5e35e9c95bc19bc78fb10bd62d6551ba7aca
Issue-ID: CCSDK-514
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/resource-dict/src/test')
12 files changed, 771 insertions, 0 deletions
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java new file mode 100644 index 00000000..fde80005 --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java @@ -0,0 +1,60 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ResourceDefinitionTest {
+ private EELFLogger log = EELFManager.getInstance().getLogger(ResourceDefinitionTest.class);
+ private String basePath = "load/resource_dictionary";
+
+ @Test
+ public void testDictionaryDefinitionInputSource(){
+
+ String fileName = basePath + "/input-source.json";
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition);
+ }
+
+ @Test
+ public void testDictionaryDefinitionDefaultSource(){
+
+ String fileName = basePath + "/default-source.json";
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition);
+ }
+
+ @Test
+ public void testDictionaryDefinitionDBSource(){
+
+ String fileName = basePath + "/db-source.json";
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition);
+ }
+
+ @Test
+ public void testDictionaryDefinitionMDSALSource(){
+ String fileName = basePath + "/mdsal-source.json";
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);
+ }
+}
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentEnhancerServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentEnhancerServiceTest.java new file mode 100644 index 00000000..57c8509d --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentEnhancerServiceTest.java @@ -0,0 +1,48 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+
+import java.util.List;
+
+/**
+ * ResourceAssignmentEnhancerService.
+ *
+ * @author Brinda Santh
+ */
+public class ResourceAssignmentEnhancerServiceTest {
+
+ @Test
+ public void testEnhanceBluePrint() throws BluePrintException {
+
+ List<ResourceAssignment> resourceAssignments = JacksonReactorUtils
+ .getListFromClassPathFile("enrich/simple-enrich.json", ResourceAssignment.class).block();
+ Assert.assertNotNull("Failed to get Resource Assignment", resourceAssignments);
+ ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("load");
+ ResourceAssignmentEnhancerService resourceAssignmentEnhancerService =
+ new ResourceAssignmentEnhancerDefaultService(resourceDefinitionRepoService);
+ ServiceTemplate serviceTemplate = resourceAssignmentEnhancerService.enhanceBluePrint(resourceAssignments);
+ Assert.assertNotNull("Failed to get Enriched service Template", serviceTemplate);
+ }
+}
+
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt new file mode 100644 index 00000000..6216d5bf --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt @@ -0,0 +1,57 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
+
+import com.att.eelf.configuration.EELFLogger
+import org.junit.Assert
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import com.att.eelf.configuration.EELFManager
+/**
+ * ResourceAssignmentValidationServiceTest.
+ *
+ * @author Brinda Santh
+ */
+class ResourceAssignmentValidationServiceTest {
+ private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceTest::class.java)
+ @Test
+ fun testValidateSuccess() {
+ log.info("**************** testValidateSuccess *****************")
+ val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java)
+ val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ val result = resourceAssignmentValidator.validate(assignments!!)
+ Assert.assertTrue("Failed to Validate", result)
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testValidateDuplicate() {
+ log.info(" **************** testValidateDuplicate *****************")
+ val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java)
+ val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ resourceAssignmentValidator.validate(assignments!!)
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testValidateCyclic() {
+ log.info(" **************** testValidateCyclic *****************")
+ val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java)
+ val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ resourceAssignmentValidator.validate(assignments!!)
+ }
+}
\ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java new file mode 100644 index 00000000..1772277d --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java @@ -0,0 +1,36 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
+
+public class ResourceDefinitionRepoServiceTest {
+
+ @Test
+ public void testGetResourceDefinition() throws Exception{
+ ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("load");
+ ResourceDefinition resourceDefinition = resourceDefinitionRepoService
+ .getResourceDefinition("db-source").block();
+ Assert.assertNotNull("Failed to get Resource Definition db-source", resourceDefinition);
+
+ NodeType nodeType = resourceDefinitionRepoService.getNodeType("source-db").block();
+ Assert.assertNotNull("Failed to get Node Type source-db", resourceDefinition);
+ }
+}
\ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java new file mode 100644 index 00000000..ef305627 --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2018 IBM. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService; +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition; + +public class ResourceDefinitionValidationServiceTest { + private String basePath = "load/model_type"; + private String dictionaryPath = "load/resource_dictionary"; + private BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath); + + @Test + public void testValidateSource() throws Exception { + + String inputFileName = dictionaryPath + "/db-source.json"; + testValidate(inputFileName); + + String dbFileName = dictionaryPath + "/db-source.json"; + testValidate(dbFileName); + + String defaultFileName = dictionaryPath + "/default-source.json"; + testValidate(defaultFileName); + + String restFileName = dictionaryPath + "/mdsal-source.json"; + testValidate(restFileName); + } + + private void testValidate(String fileName) throws Exception { + + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition); + + ResourceDefinitionValidationService resourceDictionaryValidationService = + new ResourceDefinitionDefaultValidationService(bluePrintRepoFileService); + resourceDictionaryValidationService.validate(resourceDefinition); + Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition); + } +} diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java new file mode 100644 index 00000000..c7444dba --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java @@ -0,0 +1,37 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import java.util.List;
+/**
+ * BulkResourceSequencingUtils.
+ *
+ * @author Brinda Santh
+ */
+public class BulkResourceSequencingUtilsTest {
+
+ @Test
+ public void testProcess(){
+ List<ResourceAssignment> assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);
+ Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments);
+ BulkResourceSequencingUtils.process(assignments);
+ }
+}
\ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java new file mode 100644 index 00000000..13bf8195 --- /dev/null +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java @@ -0,0 +1,99 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.util.HashMap;
+import java.util.Map;
+/**
+ * ResourceDictionaryUtilsTest.
+ *
+ * @author Brinda Santh
+ */
+public class ResourceDictionaryUtilsTest {
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(ResourceDictionaryUtilsTest.class);
+
+ @Test
+ public void testPopulateSourceMapping() {
+
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName("sample-assignment");
+ ResourceDefinition resourceDefinition = new ResourceDefinition();
+ Map<String, NodeTemplate> sources = new HashMap<>();
+ resourceDefinition.setSources(sources);
+ // To Check Empty Source
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+ Assert.assertEquals("Expected Empty source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, resourceAssignment.getDictionarySource());
+
+ // To Check First Source
+ resourceAssignment.setDictionarySource(null);
+ sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate());
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+ Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource());
+
+ // To Check Assigned Source
+ resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_DB);
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
+ Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.SOURCE_DB, resourceAssignment.getDictionarySource());
+
+ }
+
+ @Test
+ public void testFindFirstSource() {
+ //To check if Empty Source
+ Map<String, NodeTemplate> sources = new HashMap<>();
+ String firstSource = ResourceDictionaryUtils.findFirstSource(sources);
+ Assert.assertNull("Source populated, which is not expected.", firstSource);
+
+ // TO check the first Source
+ sources.put(ResourceDictionaryConstants.SOURCE_INPUT, new NodeTemplate());
+ String inputFirstSource = ResourceDictionaryUtils.findFirstSource(sources);
+ Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, inputFirstSource);
+
+ // TO check the multiple Source
+ sources.put(ResourceDictionaryConstants.SOURCE_DB, new NodeTemplate());
+ String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources);
+ Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource);
+
+ }
+
+ @Test
+ public void testAssignInputs() {
+ JsonNode data = JacksonUtils.jsonNodeFromClassPathFile("data/resource-assignment-input.json");
+ Map<String, Object> context = new HashMap<>();
+ ResourceDictionaryUtils.assignInputs(data, context);
+ String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");
+ log.info("populated context {}", context);
+ Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path));
+
+ }
+
+
+}
diff --git a/components/resource-dict/src/test/resources/data/resource-assignment-input.json b/components/resource-dict/src/test/resources/data/resource-assignment-input.json new file mode 100644 index 00000000..d79c9068 --- /dev/null +++ b/components/resource-dict/src/test/resources/data/resource-assignment-input.json @@ -0,0 +1,10 @@ +{ + "intValue" : 1, + "floatValue" : 1.34, + "booleanValue" : true, + "stringValue" : "sample-String", + "timeValue" : "2018-09-29", + "arrayStringValue" : ["one", "two"], + "mapValue" : {"profile_name1":"profile_name1", + "profile_name2":"profile_name2"} +}
\ No newline at end of file diff --git a/components/resource-dict/src/test/resources/enrich/simple-enrich.json b/components/resource-dict/src/test/resources/enrich/simple-enrich.json new file mode 100644 index 00000000..641da80a --- /dev/null +++ b/components/resource-dict/src/test/resources/enrich/simple-enrich.json @@ -0,0 +1,37 @@ +[
+ {
+ "name": "rs-db-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "db-source",
+ "dictionary-source": "db",
+ "dependencies": [
+ "input-source"
+ ]
+ },
+ {
+ "name": "ra-default-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "default-source",
+ "dictionary-source": "default",
+ "dependencies": []
+ },
+ {
+ "name": "ra-input-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "input-source",
+ "dictionary-source": "input",
+ "dependencies": []
+ }
+]
diff --git a/components/resource-dict/src/test/resources/validation/cyclic.json b/components/resource-dict/src/test/resources/validation/cyclic.json new file mode 100644 index 00000000..d837dc5d --- /dev/null +++ b/components/resource-dict/src/test/resources/validation/cyclic.json @@ -0,0 +1,111 @@ +[
+ {
+ "name": "vnf-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "service-instance-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "bundle-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-id",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id"
+ ]
+ },
+ {
+ "name": "bundle-ip",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-ip",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id"
+ ]
+ },
+ {
+ "name": "bundle-mac",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id",
+ "bundle-id"
+ ]
+ },
+ {
+ "name": "managed-ip",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "managed-ip",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "loopback-ip"
+ ]
+ },
+ {
+ "name": "vnf-name",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-name",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "managed-ip1",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "managed-ip1",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "loopback-ip"
+ ]
+ },
+ {
+ "name": "loopback-ip",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "loopback-ip",
+ "dictionary-source": "db",
+ "dependencies": [
+ "bundle-mac",
+ "managed-ip1"
+ ]
+ }
+]
diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json new file mode 100644 index 00000000..330324cd --- /dev/null +++ b/components/resource-dict/src/test/resources/validation/duplicate.json @@ -0,0 +1,110 @@ +[
+ {
+ "name": "vnf-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "service-instance-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "bundle-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-id",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id"
+ ]
+ },
+ {
+ "name": "bundle-ip",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-ip",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id"
+ ]
+ },
+ {
+ "name": "bundle-mac",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id",
+ "bundle-id"
+ ]
+ },
+ {
+ "name": "bundle-mac",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "loopback-ip"
+ ]
+ },
+ {
+ "name": "vnf-name",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-name",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "managed-ip1",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "managed-ip1",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "loopback-ip"
+ ]
+ },
+ {
+ "name": "loopback-ip",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "loopback-ip",
+ "dictionary-source": "db",
+ "dependencies": [
+ "bundle-mac"
+ ]
+ }
+]
diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json new file mode 100644 index 00000000..3215d06d --- /dev/null +++ b/components/resource-dict/src/test/resources/validation/success.json @@ -0,0 +1,110 @@ +[
+ {
+ "name": "vnf-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "service-instance-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "bundle-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-id",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id"
+ ]
+ },
+ {
+ "name": "bundle-ip",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-ip",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id"
+ ]
+ },
+ {
+ "name": "bundle-mac",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "vnf-id",
+ "bundle-id"
+ ]
+ },
+ {
+ "name": "managed-ip",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "managed-ip",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "loopback-ip"
+ ]
+ },
+ {
+ "name": "vnf-name",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-name",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "managed-ip1",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "managed-ip1",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "loopback-ip"
+ ]
+ },
+ {
+ "name": "loopback-ip",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "loopback-ip",
+ "dictionary-source": "db",
+ "dependencies": [
+ "bundle-mac"
+ ]
+ }
+]
|