From d280b356afc2595ab9d5492bb5ae55b9553b218f Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Tue, 4 Sep 2018 22:00:49 -0400 Subject: SDNC Blueprints Processor Assignment Execute Node Creating SDNC Blueprints Processor Resource Assignment Execute Node Change-Id: I2669007373b25d29de28e896dab88775ed38302e Issue-ID: CCSDK-506 Signed-off-by: Singal, Kapil (ks220y) --- .../assignment/service/ConfigAssignmentNode.java | 231 +++++++++++++++++++ .../service/ConfigAssignmentNodeTest.java | 246 +++++++++++++++++++++ 2 files changed, 477 insertions(+) create mode 100644 blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNode.java create mode 100644 blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNodeTest.java diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNode.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNode.java new file mode 100644 index 000000000..8ed0b71fc --- /dev/null +++ b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNode.java @@ -0,0 +1,231 @@ +/* + * 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.config.assignment.service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.onap.ccsdk.config.assignment.ConfigAssignmentConstants; +import org.onap.ccsdk.config.assignment.data.ResourceAssignmentData; +import org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService; +import org.onap.ccsdk.config.generator.service.ConfigGeneratorService; +import org.onap.ccsdk.config.model.ConfigModelConstant; +import org.onap.ccsdk.config.model.service.ComponentNode; +import org.onap.ccsdk.config.model.service.ComponentNodeService; +import org.onap.ccsdk.config.model.service.ConfigModelService; +import org.onap.ccsdk.config.model.utils.TransformationUtils; +import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class ConfigAssignmentNode implements ComponentNode { + private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentNode.class); + + private ComponentNodeService componentNodeService; + private ConfigResourceService configResourceService; + private ConfigModelService configModelService; + private ConfigRestAdaptorService configRestAdaptorService; + private ConfigGeneratorService configGeneratorService; + + public ConfigAssignmentNode(ConfigResourceService configResourceService, + ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService, + ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) { + logger.info("{} Constrctor Initiated", "ConfigAssignmentNode"); + this.componentNodeService = componentNodeService; + this.configResourceService = configResourceService; + this.configModelService = configModelService; + this.configRestAdaptorService = configRestAdaptorService; + this.configGeneratorService = configGeneratorService; + } + + @Override + public Boolean preCondition(Map inParams, SvcLogicContext ctx, Map componentContext) + throws SvcLogicException { + return Boolean.TRUE; + } + + @Override + public void preProcess(Map inParams, SvcLogicContext ctx, Map componentContext) + throws SvcLogicException { + // Auto-generated method stub + } + + /** + * This method is used to resolve the resources defined in the template. Generic Resource API DG + * calls this execute node. + * + * @param inParams This is the input parameter to process this node + * + *
+    request-id                  (string):           Tracking Id 
+    resource-type               (string):           Resource Type ( ex : vnf-type) 
+    resource-id                 (string):           Resource Id 
+    service-template-name       (string):           Blueprint Name 
+    service-template-version    (string):           Blueprint Version 
+    action-name                 (string): 
+    template-names              (List of string):   Template Names / Artifact Node Names to resolve. ["template1", "template2"] 
+    input-data                  (string):           Input Data in JSON String, for the substitution in the Template. 
+    prifix                      (string):           Return Value selector
+     *        
+ * + * @param ctx This is the service logger context, Output will be stored ( + * .resource-assignment-params. : Output Data in JSON String. + * .status .error-message ) + * @throws SvcLogicException On processing error. + */ + + @Override + public void process(Map inParams, SvcLogicContext ctx) throws SvcLogicException { + + final String responsePrefix = StringUtils.isNotBlank(inParams.get(ConfigModelConstant.PROPERTY_SELECTOR)) + ? (inParams.get(ConfigModelConstant.PROPERTY_SELECTOR) + ".") + : ""; + try { + + ResourceAssignmentData resourceAssignmentData = populateResourceData(inParams); + resourceAssignmentData.setSvcLogicContext(ctx); + Map componentContext = new HashMap<>(); + resourceAssignmentData.setContext(componentContext); + resourceAssignmentData.setReloadModel(true); + + ConfigAssignmentProcessService configAssignmentProcessService = + new ConfigAssignmentProcessService(configResourceService, configRestAdaptorService, + configModelService, componentNodeService, configGeneratorService); + configAssignmentProcessService.resolveResources(resourceAssignmentData); + + if (MapUtils.isNotEmpty(resourceAssignmentData.getTemplatesMashedContents())) { + resourceAssignmentData.getTemplatesMashedContents().forEach((templateName, previewContent) -> { + logger.debug("For Template name : ({}),\n Preview Content is : ({})", templateName, previewContent); + ctx.setAttribute( + responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_MASHED_DATA + "." + templateName, + previewContent); + }); + } + ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS, + ConfigAssignmentConstants.OUTPUT_STATUS_SUCCESS); + } catch (Exception e) { + ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS, + ConfigAssignmentConstants.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); + throw new SvcLogicException(e.getMessage(), e); + } + } + + @Override + public void process(Map inParams, SvcLogicContext ctx, Map componentContext) + throws SvcLogicException { + + final String responsePrefix = StringUtils.isNotBlank(inParams.get(ConfigModelConstant.PROPERTY_SELECTOR)) + ? (inParams.get(ConfigModelConstant.PROPERTY_SELECTOR) + ".") + : ""; + try { + + ResourceAssignmentData resourceAssignmentData = populateResourceData(inParams); + resourceAssignmentData.setSvcLogicContext(ctx); + resourceAssignmentData.setContext(componentContext); + resourceAssignmentData.setReloadModel(false); + + ConfigAssignmentProcessService configAssignmentProcessService = + new ConfigAssignmentProcessService(configResourceService, configRestAdaptorService, + configModelService, componentNodeService, configGeneratorService); + configAssignmentProcessService.resolveResources(resourceAssignmentData); + ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS, + ConfigAssignmentConstants.OUTPUT_STATUS_SUCCESS); + + } catch (Exception e) { + ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS, + ConfigAssignmentConstants.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); + throw new SvcLogicException(e.getMessage(), e); + } + } + + @Override + public void postProcess(Map inParams, SvcLogicContext ctx, Map componentContext) + throws SvcLogicException { + // Do Nothing + } + + private ResourceAssignmentData populateResourceData(Map inParams) throws SvcLogicException { + validateInputParams(inParams); + + String requestId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID); + String resourceId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID); + String resourceType = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE); + String serviceTemplateName = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME); + String serviceTemplateVersion = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION); + String actionName = inParams.get(ConfigModelConstant.PROPERTY_ACTION_NAME); + String inputData = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA); + + String templateNamesStr = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES); + List templateNames = TransformationUtils.getListfromJson(templateNamesStr, String.class); + + ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData(); + resourceAssignmentData.setRequestId(requestId); + resourceAssignmentData.setResourceId(resourceId); + resourceAssignmentData.setResourceType(resourceType); + resourceAssignmentData.setServiceTemplateName(serviceTemplateName); + resourceAssignmentData.setServiceTemplateVersion(serviceTemplateVersion); + resourceAssignmentData.setActionName(actionName); + resourceAssignmentData.setInputData(inputData); + resourceAssignmentData.setTemplateNames(templateNames); + + return resourceAssignmentData; + } + + private void validateInputParams(Map inParams) throws SvcLogicException { + if (inParams == null) { + throw new SvcLogicException("Input parameters missing"); + } + + String requestId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID); + if (StringUtils.isBlank(requestId)) { + throw new SvcLogicException("Request id parameters missing"); + } + String resourceId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID); + if (StringUtils.isBlank(resourceId)) { + throw new SvcLogicException("Resource id parameter is missing"); + } + String resourceType = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE); + if (StringUtils.isBlank(resourceType)) { + throw new SvcLogicException("Resource type parameter is missing"); + } + String recipeName = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_ACTION_NAME); + if (StringUtils.isBlank(recipeName)) { + throw new SvcLogicException("Action name is parameter is missing"); + } + String templateNames = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES); + if (StringUtils.isBlank(templateNames)) { + throw new SvcLogicException("Template names parameter missing"); + } + String serviceTemplateName = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME); + if (StringUtils.isBlank(serviceTemplateName)) { + throw new SvcLogicException("Service Template name parameter missing"); + } + String serviceTemplateVersion = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION); + if (StringUtils.isBlank(serviceTemplateVersion)) { + throw new SvcLogicException("Service Template version parameter missing"); + } + + } + +} diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNodeTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNodeTest.java new file mode 100644 index 000000000..9ad94dcd0 --- /dev/null +++ b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentNodeTest.java @@ -0,0 +1,246 @@ +/* + * 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.config.assignment.service; + +import java.io.File; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Map; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.sling.testing.mock.osgi.MockOsgi; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.ccsdk.config.assignment.ConfigAssignmentConstants; +import org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService; +import org.onap.ccsdk.config.generator.service.ConfigGeneratorService; +import org.onap.ccsdk.config.generator.service.ConfigGeneratorServiceImpl; +import org.onap.ccsdk.config.model.ConfigModelConstant; +import org.onap.ccsdk.config.model.service.ComponentNodeDelegate; +import org.onap.ccsdk.config.model.service.ComponentNodeService; +import org.onap.ccsdk.config.model.service.ComponentNodeServiceImpl; +import org.onap.ccsdk.config.model.service.ConfigModelService; +import org.onap.ccsdk.config.model.service.ConfigModelServiceImpl; +import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.osgi.framework.BundleContext; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +@RunWith(MockitoJUnitRunner.class) +public class ConfigAssignmentNodeTest { + + private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentNodeTest.class); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Mock + private ConfigResourceService configResourceService; + + @Mock + private ConfigRestAdaptorService configRestAdaptorService; + + private ConfigModelService configModelService; + + private ComponentNodeService componentNodeService; + + private ConfigGeneratorService configGeneratorService; + + BundleContext bundleContext = MockOsgi.newBundleContext(); + + @SuppressWarnings("unchecked") + @Before + public void before() throws Exception { + MockitoAnnotations.initMocks(this); + /* + * ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(componentNodeService, + * configResourceService, configModelService, configRestAdaptorService, configGeneratorService); + * bundleContext.registerService(ConfigAssignmentNode.class, configAssignmentNode, null); + */ + } + + @Test + public void testResourceAssignment() throws Exception { + ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService); + + ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "resource_assignment"); + + ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService, + "assignments/empty-dictionary.json"); + + ConfigResourceAssignmentTestUtils.injectConfigResourceSaveMock(configResourceService); + + componentNodeService = + new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService); + configModelService = new ConfigModelServiceImpl(configRestAdaptorService); + configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService); + + ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(configResourceService, + configRestAdaptorService, configModelService, componentNodeService, configGeneratorService); + + String inputContent = FileUtils.readFileToString( + new File("src/test/resources/service_templates/input/input.json"), Charset.defaultCharset()); + + Map inParams = new HashMap<>(); + inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, "1234"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, "resourceid-1234"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE, "vnf-type"); + inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "vpe-201802-baseconfig"); + inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "1.0.0"); + inParams.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA, inputContent); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES, "[\"base-config-template\"]"); + + // Populate the SvcContext ( Simulation) + SvcLogicContext svcLogicContext = new SvcLogicContext(); + Map context = new HashMap<>(); + context.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action"); + context = configModelService.prepareContext(context, inputContent, "vpe-201802-baseconfig", "1.0.0"); + context.forEach((key, value) -> svcLogicContext.setAttribute(key, value)); + + Map componentContext = new HashMap<>(); + configAssignmentNode.process(inParams, svcLogicContext, componentContext); + Assert.assertNotNull("Failed to get response status", svcLogicContext.getAttribute("test.status")); + + } + + @Test + public void testSimplePreview() throws Exception { + ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService); + + ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "resource_assignment"); + + ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService, + "assignments/empty-dictionary.json"); + + ConfigResourceAssignmentTestUtils.injectConfigResourceSaveMock(configResourceService); + + componentNodeService = + new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService); + configModelService = new ConfigModelServiceImpl(configRestAdaptorService); + configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService); + + ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(configResourceService, + configRestAdaptorService, configModelService, componentNodeService, configGeneratorService); + + String inputContent = FileUtils.readFileToString( + new File("src/test/resources/service_templates/input/input.json"), Charset.defaultCharset()); + + Map inParams = new HashMap<>(); + inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, "1234"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, "resourceid-1234"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE, "vnf-type"); + inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "vpe-201802-baseconfig"); + inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "1.0.0"); + inParams.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA, inputContent); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES, "[\"base-config-template\"]"); + SvcLogicContext ctx = new SvcLogicContext(); + configAssignmentNode.process(inParams, ctx); + Assert.assertNotNull("Failed to get response mashed Content", + ctx.getAttribute("test.mashed-data.base-config-template")); + } + + @Test + public void testComplexPreview() throws Exception { + ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService); + + ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "vpe-201802-baseconfig"); + + ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService, + "service_templates/vpe-201802-baseconfig/dict.json"); + + ConfigResourceAssignmentTestUtils.injectConfigResourceSaveMock(configResourceService); + + componentNodeService = + new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService); + configModelService = new ConfigModelServiceImpl(configRestAdaptorService); + configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService); + + ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(configResourceService, + configRestAdaptorService, configModelService, componentNodeService, configGeneratorService); + + String inputContent = FileUtils.readFileToString( + new File("src/test/resources/service_templates/vpe-201802-baseconfig/input-complex.json"), + Charset.defaultCharset()); + + Map inParams = new HashMap<>(); + inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "complex-test"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, "request-1234"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, "resourceid-1234"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE, "vnf-type"); + inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "vpe-201802-baseconfig"); + inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "1.0.0"); + inParams.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action"); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA, inputContent); + inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES, "[\"base-config-template\"]"); + SvcLogicContext ctx = new SvcLogicContext(); + configAssignmentNode.process(inParams, ctx); + Assert.assertNotNull("Failed to get response mashed Content", + ctx.getAttribute("complex-test.mashed-data.base-config-template")); + + } + + @Test + public void inputValidator() { + SvcLogicContext ctx = new SvcLogicContext(); + try { + + logger.info(" ******************************* inputValidator ***************************"); + String serviceTemplateContent = FileUtils.readFileToString( + new File("src/test/resources/service_templates/resource_assignment.json"), + Charset.defaultCharset()); + + String inputcontent = FileUtils.readFileToString( + new File("src/test/resources/service_templates/input/inputValidateTest.json"), + Charset.defaultCharset()); + + Map context = new HashMap<>(); + configModelService.prepareContext(context, inputcontent, serviceTemplateContent); + + // TransformationUtils.printMap(context); + + context.forEach((name, value) -> { + if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) { + ctx.setAttribute(name, value); + } + }); + + ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService); + Map inParams = new HashMap<>(); + inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment"); + componentNodeDelegate.process(inParams, ctx); + Assert.fail(); + } catch (Exception e) { + logger.error("Failed in inputValidator" + e.getMessage()); + logger.info("** ctx.getAttribute Check for **" + ctx.getAttribute("resource-assignment.error-message")); + } + + } + +} -- cgit 1.2.3-korg