From 2e94232cddeb3de3aab4b9eda07ca830845ad259 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 15 Nov 2018 08:36:28 -0500 Subject: Blueprints Processor Microservice Refactor functon module as seperate module project. Change-Id: I392fc62e6dfb6c5f38f478c00e46460d5084f85c Issue-ID: CCSDK-688 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../modules/commons/core/pom.xml | 42 +++++------ ms/blueprintsprocessor/modules/commons/pom.xml | 12 +-- ms/blueprintsprocessor/modules/inbounds/pom.xml | 9 +-- ms/blueprintsprocessor/modules/pom.xml | 62 +++++---------- .../modules/services/execution-service/pom.xml | 32 +++++++- ms/blueprintsprocessor/modules/services/pom.xml | 8 -- .../modules/services/resolution-service/pom.xml | 36 --------- .../resolution/ResourceResolutionComponent.kt | 39 ---------- .../resolution/ResourceResolutionService.kt | 79 ------------------- .../DefaultResourceAssignmentProcessor.kt | 49 ------------ .../processor/InputResourceAssignmentProcessor.kt | 49 ------------ .../processor/MDSALResourceAssignmentProcessor.kt | 48 ------------ .../processor/SdncResourceAssignmentProcessor.kt | 50 ------------ .../resolution/ResourceResolutionServiceTest.java | 88 ---------------------- .../src/test/resources/mapping/db/db-array.json | 35 --------- .../src/test/resources/mapping/db/db-complex.json | 27 ------- .../src/test/resources/mapping/db/db-simple.json | 26 ------- .../src/test/resources/mapping/db/dt-location.json | 15 ---- .../mapping/db/resource-assignments-simple.json | 22 ------ .../src/test/resources/payload/inputs/input.json | 18 ----- .../sample-resourceresolution-request.json | 22 ------ .../modules/services/workflow-service/pom.xml | 21 ++++++ .../src/test/resources/logback.xml | 35 +++++++++ 23 files changed, 132 insertions(+), 692 deletions(-) delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/pom.xml delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json delete mode 100644 ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json create mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml (limited to 'ms/blueprintsprocessor/modules') diff --git a/ms/blueprintsprocessor/modules/commons/core/pom.xml b/ms/blueprintsprocessor/modules/commons/core/pom.xml index 094f42b7a..626a27a37 100644 --- a/ms/blueprintsprocessor/modules/commons/core/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/core/pom.xml @@ -17,27 +17,27 @@ ~ limitations under the License. --> - 4.0.0 - - org.onap.ccsdk.apps.blueprintsprocessor - commons - 0.4.0-SNAPSHOT - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.ccsdk.apps.blueprintsprocessor + commons + 0.4.0-SNAPSHOT + - core - jar - Blueprints Processor Core - Blueprints Processor Core + core + jar + Blueprints Processor Core + Blueprints Processor Core - - - org.onap.ccsdk.apps.blueprintsprocessor - db-lib - - - org.onap.ccsdk.apps.blueprintsprocessor - rest-lib - - + + + org.onap.ccsdk.apps.blueprintsprocessor + db-lib + + + org.onap.ccsdk.apps.blueprintsprocessor + rest-lib + + diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml index c080f817c..7bfec58c9 100644 --- a/ms/blueprintsprocessor/modules/commons/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/pom.xml @@ -35,16 +35,8 @@ - com.fasterxml.jackson.module - jackson-module-kotlin - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - - - org.jetbrains.kotlin - kotlin-reflect + org.onap.ccsdk.apps.controllerblueprints + resource-dict org.jetbrains.kotlin diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml index f03e5557b..e26af0f0f 100644 --- a/ms/blueprintsprocessor/modules/inbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -33,16 +33,13 @@ selfservice-api - - - org.onap.ccsdk.apps.blueprintsprocessor - execution-service + workflow-service - org.onap.ccsdk.apps.blueprintsprocessor - resolution-service + org.onap.ccsdk.apps.blueprintsprocessor.functions + resource-resolution org.springframework.boot diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml index 93f312b8f..0230cd7e5 100644 --- a/ms/blueprintsprocessor/modules/pom.xml +++ b/ms/blueprintsprocessor/modules/pom.xml @@ -17,56 +17,32 @@ ~ limitations under the License. --> - 4.0.0 - - org.onap.ccsdk.apps.blueprintsprocessor - parent - 0.4.0-SNAPSHOT - ../parent - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.ccsdk.apps.blueprintsprocessor + parent + 0.4.0-SNAPSHOT + ../parent + - modules - pom - Blueprints Processor Modules POM - Blueprints Processor Modules - - - commons - outbounds - services - inbounds - - - - - org.powermock - powermock-api-mockito2 - test - - - org.springframework.boot - spring-boot-starter-test - test - - - org.jetbrains.kotlin - kotlin-test-junit - test - - - io.projectreactor - reactor-test - test - - + modules + pom + Blueprints Processor Modules POM + Blueprints Processor Modules + + commons + outbounds + services + inbounds + org.jetbrains.kotlin kotlin-maven-plugin - ${kotlin.version} + ${kotlin.maven.version} compile diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index 158496df1..4f0e6c0b2 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -31,7 +31,37 @@ org.onap.ccsdk.apps.blueprintsprocessor - db-service + core + + + org.onap.ccsdk.apps.controllerblueprints + resource-dict + + + + org.onap.ccsdk.sli.core + sli-provider + + + + org.powermock + powermock-api-mockito2 + test + + + org.springframework.boot + spring-boot-starter-test + test + + + org.jetbrains.kotlin + kotlin-test-junit + test + + + io.projectreactor + reactor-test + test diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml index d175f129f..d2f2e0cb4 100644 --- a/ms/blueprintsprocessor/modules/services/pom.xml +++ b/ms/blueprintsprocessor/modules/services/pom.xml @@ -30,14 +30,6 @@ execution-service - resolution-service workflow-service - - - - org.onap.ccsdk.apps.blueprintsprocessor - core - - 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 21464c14e..000000000 --- a/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 4.0.0 - - org.onap.ccsdk.apps.blueprintsprocessor - services - 0.4.0-SNAPSHOT - - resolution-service - jar - Blueprints Processor Resolution Service - Blueprints Processor Resolution Service - - - - org.onap.ccsdk.apps.blueprintsprocessor - db-service - - - 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 ff1a01d58..000000000 --- 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, componentContext: MutableMap) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun process(context: MutableMap, componentContext: MutableMap) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun errorHandle(context: MutableMap, componentContext: MutableMap) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun reTrigger(context: MutableMap, componentContext: MutableMap) { - 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 3ee7e41ff..000000000 --- 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() - - process(resourceResolutionOutput.resourceAssignments, context) - - val status = Status() - status.code = 200 - status.message = "Success" - resourceResolutionOutput.status = status - - return resourceResolutionOutput - } - - fun process(resourceAssignments: MutableList, context: MutableMap): 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 9580ca49a..000000000 --- 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) { - log.info("Validation Resource Assignments") - } - - override fun process(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("Processing Resource Assignments") - } - - override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("ErrorHandle Resource Assignments") - } - - override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap) { - 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 05f7d5cdd..000000000 --- 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) { - log.info("Validation Resource Assignments") - } - - override fun process(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("Processing Resource Assignments") - } - - override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("ErrorHandle Resource Assignments") - } - - override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap) { - 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 9d54cd46a..000000000 --- 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) { - log.info("Validation Resource Assignments") - } - - override fun process(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("Processing Resource Assignments") - } - - override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("ErrorHandle Resource Assignments") - } - - override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap) { - 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 4b11f580e..000000000 --- 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) { - log.info("Validation Resource Assignments") - } - - override fun process(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("Processing Resource Assignments") - } - - override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap) { - log.info("ErrorHandle Resource Assignments") - } - - override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap) { - 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 0768c6099..000000000 --- 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 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 679b92db4..000000000 --- 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 32d04b690..000000000 --- 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 841404f22..000000000 --- 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 52e0a7967..000000000 --- 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 ddcf32eed..000000000 --- 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 cd6fac128..000000000 --- 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 e8830a8a2..000000000 --- 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": [ - ] -} diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml index 5809c06d5..5caeac135 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml @@ -38,6 +38,27 @@ org.onap.ccsdk.sli.core sli-provider + + + org.powermock + powermock-api-mockito2 + test + + + org.springframework.boot + spring-boot-starter-test + test + + + org.jetbrains.kotlin + kotlin-test-junit + test + + + io.projectreactor + reactor-test + test + diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml new file mode 100644 index 000000000..a816a06c5 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml @@ -0,0 +1,35 @@ + + + + + + + %d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n + + + + + + + + + + + + + -- cgit 1.2.3-korg