From 905d8bf666e0667774bebccfabce65e3497e9c32 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 30 Aug 2018 14:17:06 +0000 Subject: Controller Blueprints Microservice Add Resource Seuencing validation and Optimise resource assignment validation logics Change-Id: I6f31ca5dbeb6f6aa89959b7d96fbfad25468b3a4 Issue-ID: CCSDK-416 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../validator/ServiceTemplateValidationTest.java | 19 +++++++++++++++++-- .../src/test/resources/enhance/enhance-template.json | 5 +---- .../src/test/resources/enhance/enhanced-template.json | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'ms/controllerblueprints/modules/service/src/test') diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java index 0ef544525..e41e90a2d 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java @@ -20,6 +20,8 @@ package org.onap.ccsdk.apps.controllerblueprints.service.validator; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.junit.Test; +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate; +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,9 +42,22 @@ public class ServiceTemplateValidationTest { @Test public void validateServiceTemplate() throws Exception { - String file = "load/blueprints/baseconfiguration/Definitions/activation-blueprint.json"; + validateServiceTemplate("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json"); + validateServiceTemplate("load/blueprints/vrr-test/Definitions/vrr-test.json"); + } + + //@Test + public void validateEnhancedServiceTemplate() throws Exception { + ServiceTemplate serviceTemplate = JacksonUtils + .readValueFromClassPathFile("enhance/enhanced-template.json", ServiceTemplate.class); + ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator(); + Boolean valid = serviceTemplateValidator.validateServiceTemplate(serviceTemplate); + Assert.assertTrue("Failed to validate blueprints", valid); + } + + private void validateServiceTemplate(String fileName) throws Exception { String serviceTemplateContent = - FileUtils.readFileToString(new File(file), Charset.defaultCharset()); + FileUtils.readFileToString(new File(fileName), Charset.defaultCharset()); ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator(); serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent); Assert.assertNotNull("Failed to validate blueprints", serviceTemplateValidator); diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json index a4ba930e5..fedf1da21 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json @@ -232,10 +232,7 @@ "dictionary-name": "wan-aggregate-ipv4-addresses", "dictionary-source": "mdsal", "dependencies": [ - "service-instance-id", - "oam-network-role", - "oam-v4-ip-type ", - "oam-vm-type" + "service-instance-id" ], "version": 0 }, diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json index e00330961..0633c64d0 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -738,7 +738,7 @@ "input-param" : false, "dictionary-name" : "wan-aggregate-ipv4-addresses", "dictionary-source" : "mdsal", - "dependencies" : [ "service-instance-id", "oam-network-role", "oam-v4-ip-type ", "oam-vm-type" ], + "dependencies" : [ "service-instance-id" ], "version" : 0 }, { "name" : "hostname", -- cgit 1.2.3-korg