aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/resolution-service
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-15 08:36:28 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-15 08:36:28 -0500
commitec92866fa0bc8d8cd7a6ce4d5d5fd014d8eacef1 (patch)
treea9f5e6a735f2d87524d1d08ce00efe524e4c53c2 /ms/blueprintsprocessor/modules/services/resolution-service
parentee9f70f704e978c2119a5e8f38ed98a8a1b70590 (diff)
Blueprints Processor Microservice
Refactor functon module as seperate module project. Change-Id: I392fc62e6dfb6c5f38f478c00e46460d5084f85c Issue-ID: CCSDK-688 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/resolution-service')
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/pom.xml36
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt39
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt79
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt49
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt49
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt48
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt50
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java88
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json35
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json27
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json26
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json15
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json22
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json18
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json22
15 files changed, 0 insertions, 603 deletions
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml b/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml
deleted file mode 100644
index 21464c14..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>services</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </parent>
- <artifactId>resolution-service</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Resolution Service</name>
- <description>Blueprints Processor Resolution Service</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>db-service</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt
deleted file mode 100644
index ff1a01d5..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ComponentNode
-import org.springframework.stereotype.Component
-
-@Component("component-resource-resolution")
-open class ResourceResolutionComponent : ComponentNode {
- override fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
deleted file mode 100644
index 3ee7e41f..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.BulkResourceSequencingUtils
-import org.springframework.stereotype.Service
-
-/**
- * ResourceResolutionService
- * @author Brinda Santh
- * 8/14/2018
- */
-
-@Service
-class ResourceResolutionService(private val resourceAssignmentProcessorFactory: ResourceAssignmentProcessorFactory) {
-
- fun resolveResource(resourceResolutionInput: ResourceResolutionInput): ResourceResolutionOutput {
- val resourceResolutionOutput = ResourceResolutionOutput()
- resourceResolutionOutput.actionIdentifiers = resourceResolutionInput.actionIdentifiers
- resourceResolutionOutput.commonHeader = resourceResolutionInput.commonHeader
- resourceResolutionOutput.resourceAssignments = resourceResolutionInput.resourceAssignments
-
- val context = hashMapOf<String, Any>()
-
- process(resourceResolutionOutput.resourceAssignments, context)
-
- val status = Status()
- status.code = 200
- status.message = "Success"
- resourceResolutionOutput.status = status
-
- return resourceResolutionOutput
- }
-
- fun process(resourceAssignments: MutableList<ResourceAssignment>, context: MutableMap<String, Any>): Unit {
-
- val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments)
-
- bulkSequenced.map { batchResourceAssignments ->
- batchResourceAssignments.filter { it.name != "*" && it.name != "start" }
- .map { resourceAssignment ->
- val dictionarySource = resourceAssignment.dictionarySource
- val processorInstanceName = "resource-assignment-processor-".plus(dictionarySource)
- val resourceAssignmentProcessor = resourceAssignmentProcessorFactory.getInstance(processorInstanceName)
- ?: throw BluePrintProcessorException("failed to get resource processor for instance name($processorInstanceName) " +
- "for resource assignment(${resourceAssignment.name})")
- try {
- resourceAssignmentProcessor.validate(resourceAssignment, context)
- resourceAssignmentProcessor.process(resourceAssignment, context)
- } catch (e: Exception) {
- resourceAssignmentProcessor.errorHandle(resourceAssignment, context)
- throw BluePrintProcessorException(e)
- }
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt
deleted file mode 100644
index 9580ca49..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution.processor
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
-import org.springframework.stereotype.Service
-
-/**
- * DefaultResourceAssignmentProcessor
- *
- * @author Brinda Santh
- */
-@Service("resource-assignment-processor-default")
-open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor {
- private val log = EELFManager.getInstance().getLogger(DefaultResourceAssignmentProcessor::class.java)
-
- override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Validation Resource Assignments")
- }
-
- override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Processing Resource Assignments")
- }
-
- override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("ErrorHandle Resource Assignments")
- }
-
- override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Re Trigger Resource Assignments")
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt
deleted file mode 100644
index 05f7d5cd..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution.processor
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
-import org.springframework.stereotype.Service
-
-/**
- * InputResourceAssignmentProcessor
- *
- * @author Brinda Santh
- */
-@Service("resource-assignment-processor-input")
-open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor {
- private val log = EELFManager.getInstance().getLogger(InputResourceAssignmentProcessor::class.java)
-
- override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Validation Resource Assignments")
- }
-
- override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Processing Resource Assignments")
- }
-
- override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("ErrorHandle Resource Assignments")
- }
-
- override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Re Trigger Resource Assignments")
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt
deleted file mode 100644
index 9d54cd46..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution.processor
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
-import org.springframework.stereotype.Service
-
-/**
- * MDSALResourceAssignmentProcessor
- *
- * @author Brinda Santh
- */
-@Service("resource-assignment-processor-mdsal")
-open class MDSALResourceAssignmentProcessor : ResourceAssignmentProcessor {
- private val log = EELFManager.getInstance().getLogger(MDSALResourceAssignmentProcessor::class.java)
-
- override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Validation Resource Assignments")
- }
-
- override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Processing Resource Assignments")
- }
-
- override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("ErrorHandle Resource Assignments")
- }
-
- override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Re Trigger Resource Assignments")
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt
deleted file mode 100644
index 4b11f580..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution.processor
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
-import org.springframework.stereotype.Service
-
-/**
- * SdncResourceAssignmentProcessor
- *
- * @author Brinda Santh
- */
-@Service("resource-assignment-processor-db")
-open class SdncResourceAssignmentProcessor : ResourceAssignmentProcessor {
-
- private val log = EELFManager.getInstance().getLogger(SdncResourceAssignmentProcessor::class.java)
-
- override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Validation Resource Assignments")
- }
-
- override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Processing Resource Assignments")
- }
-
- override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("ErrorHandle Resource Assignments")
- }
-
- override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
- log.info("Re Trigger Resource Assignments")
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java
deleted file mode 100644
index 0768c609..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.blueprintsprocessor.services.resolution;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory;
-import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.DefaultResourceAssignmentProcessor;
-import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.InputResourceAssignmentProcessor;
-import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.MDSALResourceAssignmentProcessor;
-import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.SdncResourceAssignmentProcessor;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.List;
-
-/**
- * ResourceResolutionServiceTest
- *
- * @author Brinda Santh DATE : 8/15/2018
- */
-@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = {ResourceResolutionService.class, ResourceAssignmentProcessorFactory.class,
- InputResourceAssignmentProcessor.class, DefaultResourceAssignmentProcessor.class,
- SdncResourceAssignmentProcessor.class, MDSALResourceAssignmentProcessor.class})
-public class ResourceResolutionServiceTest {
- private static Logger log = LoggerFactory.getLogger(ResourceResolutionServiceTest.class);
-
- @Autowired
- private ResourceResolutionService resourceResolutionService;
-
- @Test
- public void testResolveResource() throws Exception {
-
- Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService);
-
- String resourceResolutionInputContent = FileUtils.readFileToString(
- new File("src/test/resources/payload/requests/sample-resourceresolution-request.json"), Charset.defaultCharset());
-
- ResourceResolutionInput resourceResolutionInput = JacksonUtils.readValue(resourceResolutionInputContent, ResourceResolutionInput.class);
- Assert.assertNotNull("failed to populate resourceResolutionInput request ", resourceResolutionInput);
-
- String resourceAssignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/db/resource-assignments-simple.json"), Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment.class);
-
- Assert.assertTrue("failed to create ResourceAssignment from file", CollectionUtils.isNotEmpty(batchResourceAssignment));
- resourceResolutionInput.setResourceAssignments(batchResourceAssignment);
-
- ObjectNode inputContent = (ObjectNode) JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");
- Assert.assertNotNull("failed to populate input payload ", inputContent);
- resourceResolutionInput.setPayload(inputContent);
- log.info("ResourceResolutionInput : {}", JacksonUtils.getJson(resourceResolutionInput, true));
-
- ResourceResolutionOutput resourceResolutionOutput = resourceResolutionService.resolveResource(resourceResolutionInput);
- Assert.assertNotNull("failed to populate output", resourceResolutionOutput);
-
- }
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json
deleted file mode 100644
index 679b92db..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "locations": {
- "name": "locations",
- "data-type": "list",
- "entry-schema": "dt-location",
- "source": {
- "db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- },
- "candidate-dependency": {
- "db": {
- "names": [
- "profile_name"
- ]
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json
deleted file mode 100644
index 32d04b69..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "location": {
- "name": "location",
- "data-type": "dt-location",
- "source": {
- "db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json
deleted file mode 100644
index 841404f2..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "country": {
- "name": "country",
- "data-type": "string",
- "source": {
- "db": {
- "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "country": "country"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json
deleted file mode 100644
index 52e0a796..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json
deleted file mode 100644
index ddcf32ee..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "country",
- "dictionary-source": "db",
- "dependencies": ["state"]
- },
- {
- "name": "state",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "state",
- "dictionary-source": "input",
- "dependencies": []
- }
-]
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json
deleted file mode 100644
index cd6fac12..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "api-ver": "2.00",
- "originator-id": "MSO",
- "request-id": "123456",
- "service-instance-id": "ibcx0001vm001",
- "service-type": "AVPN",
- "vnf-type": "vUSP - vDBE-IPX HUB",
- "vnf-id": 123456,
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "resource-assignment-action",
- "group-name": "sample group name",
- "bundle-id": "sample bundle id",
- "bundle-mac": [
- "Sample bundle mac",
- "Sample bundle mac"
- ]
-}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json
deleted file mode 100644
index e8830a8a..00000000
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "sample-action",
- "blueprintName": "sample-blurprint",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- },
- "resourceAssignments": [
- ]
-}