diff options
29 files changed, 402 insertions, 425 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn deleted file mode 100644 index 89ae342f..00000000 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" - xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" - xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" - xmlns:camunda="http://camunda.org/schema/1.0/bpmn" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" - targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2"> - <bpmn:process id="ActivateProcess" isExecutable="true"> - <bpmn:startEvent id="StartEvent_1"> - <bpmn:outgoing>SequenceFlow_0l0dq58</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1pr0kil"> - <bpmn:incoming>SequenceFlow_1ay0k6p</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0l0dq58" sourceRef="StartEvent_1" targetRef="activate_device_task"/> - <bpmn:sequenceFlow id="SequenceFlow_1ay0k6p" sourceRef="activate_device_task" targetRef="EndEvent_1pr0kil"/> - <bpmn:serviceTask id="activate_device_task" name="Activate Device" - camunda:delegateExpression="${componentDelegateService}"> - <bpmn:extensionElements> - <camunda:inputOutput> - <camunda:inputParameter name="selector"><![CDATA[resource-assignment -]]></camunda:inputParameter> - </camunda:inputOutput> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0l0dq58</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ay0k6p</bpmn:outgoing> - </bpmn:serviceTask> - </bpmn:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateProcess"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="175" y="143" width="36" height="36"/> - <bpmndi:BPMNLabel> - <dc:Bounds x="148" y="179" width="90" height="20"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1pr0kil_di" bpmnElement="EndEvent_1pr0kil"> - <dc:Bounds x="575" y="114" width="36" height="36"/> - <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="154" width="0" height="12"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0l0dq58_di" bpmnElement="SequenceFlow_0l0dq58"> - <di:waypoint xsi:type="dc:Point" x="211" y="161"/> - <di:waypoint xsi:type="dc:Point" x="273" y="161"/> - <di:waypoint xsi:type="dc:Point" x="273" y="149"/> - <di:waypoint xsi:type="dc:Point" x="334" y="149"/> - <bpmndi:BPMNLabel> - <dc:Bounds x="288" y="149" width="0" height="12"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ay0k6p_di" bpmnElement="SequenceFlow_1ay0k6p"> - <di:waypoint xsi:type="dc:Point" x="434" y="149"/> - <di:waypoint xsi:type="dc:Point" x="505" y="149"/> - <di:waypoint xsi:type="dc:Point" x="505" y="132"/> - <di:waypoint xsi:type="dc:Point" x="575" y="132"/> - <bpmndi:BPMNLabel> - <dc:Bounds x="520" y="134.5" width="0" height="12"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0e8ek4f_di" bpmnElement="activate_device_task"> - <dc:Bounds x="334" y="109" width="100" height="80"/> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta index 9066e484..8f1df9f2 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta @@ -1,8 +1,6 @@ TOSCA-Meta-File-Version: 1.0.0 CSAR-Version: 1.0 -Created-By: Brinda Santh M +Created-By: Brinda Santh <brindasanth@in.ibm.com> Entry-Definitions: Definitions/activation-blueprint.json Template-Tags: Brinda Santh, activation-blueprint -Name: Plans/ActivateProcess.bpmn -Content-Type: application/vnd.oasis.bpmn diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml index 7c5aecb7..1f8251bd 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml @@ -36,16 +36,14 @@ <dependency> <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> <artifactId>db-resources</artifactId> - <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> <artifactId>blueprint-validation</artifactId> - <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> - <artifactId>core</artifactId> + <artifactId>processor-core</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml index 9d5dc51c..e1c07ddb 100755 --- a/ms/blueprintsprocessor/modules/commons/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/pom.xml @@ -3,6 +3,7 @@ ~ Copyright © 2017-2018 AT&T Intellectual Property. ~ ~ Modifications Copyright © 2019 Bell Canada. + ~ Modifications Copyright © 2019 IBM. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. @@ -16,7 +17,8 @@ ~ 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"> +<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> @@ -30,9 +32,9 @@ <description>Blueprints Processor Commons</description> <modules> + <module>processor-core</module> <module>db-lib</module> <module>rest-lib</module> - <module>core</module> <module>dmaap-lib</module> </modules> <dependencies> @@ -42,6 +44,11 @@ </dependency> <!-- Test Dependencies --> <dependency> + <groupId>io.mockk</groupId> + <artifactId>mockk</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito2</artifactId> <scope>test</scope> @@ -57,6 +64,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>io.projectreactor</groupId> <artifactId>reactor-test</artifactId> <scope>test</scope> diff --git a/ms/blueprintsprocessor/modules/commons/core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml index 42710b51..aadff9c9 100644 --- a/ms/blueprintsprocessor/modules/commons/core/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml @@ -24,7 +24,7 @@ <version>0.4.1-SNAPSHOT</version> </parent> - <artifactId>core</artifactId> + <artifactId>processor-core</artifactId> <packaging>jar</packaging> <name>Blueprints Processor Core</name> <description>Blueprints Processor Core</description> diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt index 07e494a1..07e494a1 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt index 10b8ceb5..10b8ceb5 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt index 41bbd1df..41bbd1df 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt index 66643ee0..9c6e5075 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt @@ -1,68 +1,68 @@ -/*
- * 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.core.factory
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.springframework.context.ApplicationContext
-import org.springframework.context.ApplicationContextAware
-
-/**
- * ComponentNode
- *
- * @author Brinda Santh
- */
-interface ComponentNode {
-
- @Throws(BluePrintProcessorException::class)
- fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-
- @Throws(BluePrintProcessorException::class)
- fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-
- @Throws(BluePrintProcessorException::class)
- fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-
- @Throws(BluePrintProcessorException::class)
- fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-}
-
-/**
- * ComponentNodeFactory
- *
- * @author Brinda Santh
- */
-open class ComponentNodeFactory : ApplicationContextAware {
- private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java)
-
- var componentNodes: MutableMap<String, ComponentNode> = hashMapOf()
-
- fun getInstance(instanceName: String): ComponentNode? {
- log.trace("looking for Component Nodes : {}", instanceName)
- return componentNodes.get(instanceName)
- }
-
- fun injectInstance(instanceName: String, componentNode: ComponentNode) {
- this.componentNodes[instanceName] = componentNode
- }
-
- override fun setApplicationContext(context: ApplicationContext) {
- componentNodes = context.getBeansOfType(ComponentNode::class.java)
- log.info("Injected Component Nodes : {}", componentNodes)
- }
+/* + * 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.core.factory + +import com.att.eelf.configuration.EELFManager +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.springframework.context.ApplicationContext +import org.springframework.context.ApplicationContextAware + +/** + * ComponentNode + * + * @author Brinda Santh + */ +interface ComponentNode { + + @Throws(BluePrintProcessorException::class) + fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) + + @Throws(BluePrintProcessorException::class) + fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) + + @Throws(BluePrintProcessorException::class) + fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) + + @Throws(BluePrintProcessorException::class) + fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) +} + +/** + * ComponentNodeFactory + * + * @author Brinda Santh + */ +open class ComponentNodeFactory : ApplicationContextAware { + private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java) + + var componentNodes: MutableMap<String, ComponentNode> = hashMapOf() + + fun getInstance(instanceName: String): ComponentNode? { + log.trace("looking for Component Nodes : {}", instanceName) + return componentNodes.get(instanceName) + } + + fun injectInstance(instanceName: String, componentNode: ComponentNode) { + this.componentNodes[instanceName] = componentNode + } + + override fun setApplicationContext(context: ApplicationContext) { + componentNodes = context.getBeansOfType(ComponentNode::class.java) + log.info("Injected Component Nodes : {}", componentNodes) + } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt index 31dca33b..31dca33b 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/resources/application.properties b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/resources/application.properties index 2ce87147..c10e96ee 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/resources/application.properties +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/resources/application.properties @@ -1,16 +1,16 @@ -#
-# 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.
-#
-
+# +# 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. +# + diff --git a/ms/blueprintsprocessor/modules/commons/core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt index 66de11fd..66de11fd 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml index 009493a6..625297bf 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml @@ -35,7 +35,7 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> - <artifactId>core</artifactId> + <artifactId>processor-core</artifactId> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml index d7c0cc4f..273abd51 100644 --- a/ms/blueprintsprocessor/modules/inbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ Modifications Copyright © 2019 IBM. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. @@ -64,6 +65,7 @@ <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-test-junit</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.jetbrains.kotlinx</groupId> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index df68b952..f5e3b3d0 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -44,7 +44,7 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> - <artifactId>core</artifactId> + <artifactId>processor-core</artifactId> </dependency> <dependency> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> @@ -67,26 +67,5 @@ <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-provider</artifactId> </dependency> - - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito2</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test-junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml index 469899d0..4388eeb9 100755 --- a/ms/blueprintsprocessor/modules/services/pom.xml +++ b/ms/blueprintsprocessor/modules/services/pom.xml @@ -3,6 +3,7 @@ ~ Copyright © 2017-2018 AT&T Intellectual Property. ~ ~ Modifications Copyright © 2019 Bell Canada. + ~ Modifications Copyright © 2019 IBM. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. @@ -33,4 +34,38 @@ <module>execution-service</module> <module>workflow-service</module> </modules> + + <dependencies> + <!-- Test Dependencies --> + <dependency> + <groupId>io.mockk</groupId> + <artifactId>mockk</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-mockito2</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test-junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml index 4f929064..634d2233 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml @@ -40,27 +40,6 @@ <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-provider</artifactId> </dependency> - - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito2</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test-junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> </dependencies> diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml index 045ce711..210943ae 100755 --- a/ms/blueprintsprocessor/parent/pom.xml +++ b/ms/blueprintsprocessor/parent/pom.xml @@ -264,10 +264,10 @@ </dependency> - <!-- Application Module Dependencies --> + <!-- Blueprint Processor Application Module Dependencies --> <dependency> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> - <artifactId>application</artifactId> + <artifactId>processor-core</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -282,7 +282,7 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> - <artifactId>core</artifactId> + <artifactId>dmaap-lib</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -305,6 +305,11 @@ <artifactId>selfservice-api</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>application</artifactId> + <version>${project.version}</version> + </dependency> <!-- Functions --> <dependency> @@ -328,7 +333,7 @@ <version>${project.version}</version> </dependency> - <!-- Application Component Dependency --> + <!-- Controller Blueprints Application Dependency --> <dependency> <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> <artifactId>resource-dict</artifactId> @@ -346,6 +351,11 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> + <artifactId>db-resources</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> <artifactId>blueprint-validation</artifactId> <version>${project.version}</version> </dependency> @@ -357,6 +367,7 @@ <version>${h2database.version}</version> <scope>test</scope> </dependency> + <!-- Test Dependency --> <dependency> <groupId>io.mockk</groupId> diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml index a5e6f1e5..daa9f0a6 100644 --- a/ms/cds-sdc-listener/application/pom.xml +++ b/ms/cds-sdc-listener/application/pom.xml @@ -17,7 +17,8 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>application</artifactId> + <groupId>org.onap.ccsdk.apps</groupId> + <artifactId>cds-sdc-listener-application</artifactId> <name>CDS-SDC Listener Application </name> <dependencies> diff --git a/ms/cds-sdc-listener/distribution/pom.xml b/ms/cds-sdc-listener/distribution/pom.xml index 9ff555fc..f2280783 100644 --- a/ms/cds-sdc-listener/distribution/pom.xml +++ b/ms/cds-sdc-listener/distribution/pom.xml @@ -15,7 +15,8 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>distribution</artifactId> + <groupId>org.onap.ccsdk.apps</groupId> + <artifactId>cds-sdc-listener-distribution</artifactId> <name>CDS-SDC Listener Distribution</name> <properties> @@ -71,10 +72,10 @@ <build> <cleanup>try</cleanup> <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> - <imagetags> - <imageTag>${project.version}</imageTag> - <imageTag>${project.version}-STAGING-${maven.build.timestamp}</imageTag> - </imagetags> + <tags> + <tag>${project.version}</tag> + <tag>${project.version}-STAGING-${maven.build.timestamp}</tag> + </tags> </build> </image> </images> diff --git a/ms/cds-sdc-listener/pom.xml b/ms/cds-sdc-listener/pom.xml index 3998f5f2..0c393db7 100644 --- a/ms/cds-sdc-listener/pom.xml +++ b/ms/cds-sdc-listener/pom.xml @@ -22,7 +22,9 @@ <modules> <module>application</module> + <!-- Module is not currently working <module>distribution</module> + --> </modules> </project>
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java deleted file mode 100644 index 8b7a9577..00000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java +++ /dev/null @@ -1,85 +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.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
-import org.onap.ccsdk.apps.controllerblueprints.service.handler.ResourceDictionaryHandler;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Deprecated
-@RestController
-@RequestMapping(value = "/api/v1/dictionary")
-public class ResourceDictionaryRest {
-
-
- private ResourceDictionaryHandler resourceDictionaryHandler;
-
- /**
- * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database
- *
- * @param resourceDictionaryHandler Data Dictionary Handler
- */
- public ResourceDictionaryRest(ResourceDictionaryHandler resourceDictionaryHandler) {
- this.resourceDictionaryHandler = resourceDictionaryHandler;
- }
-
- @PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary) throws BluePrintException {
- return resourceDictionaryHandler.saveResourceDictionary(dataDictionary);
- }
-
- @DeleteMapping(path = "/{name}")
- public void deleteResourceDictionaryByName(@PathVariable(value = "name") String name) {
- resourceDictionaryHandler.deleteResourceDictionary(name);
- }
-
- @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
- return resourceDictionaryHandler.getResourceDictionaryByName(name);
- }
-
- @PostMapping(path = "/by-names", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names) {
- return resourceDictionaryHandler.searchResourceDictionaryByNames(names);
- }
-
- @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) {
- return resourceDictionaryHandler.searchResourceDictionaryByTags(tags);
-
- }
-
- @GetMapping(path = "/source-mapping", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResourceSourceMapping getResourceSourceMapping() {
- return resourceDictionaryHandler.getResourceSourceMapping();
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelController.kt index 0fca07b0..60c07ad2 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelController.kt @@ -1,5 +1,6 @@ /* * Copyright © 2019 Bell Canada Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,14 +28,14 @@ import org.springframework.web.bind.annotation.* import reactor.core.publisher.Mono /** - * BlueprintModelRest Purpose: Handle controllerBlueprint API request + * BlueprintModelController Purpose: Handle controllerBlueprint API request * * @author Vinal Patel * @version 1.0 */ @RestController @RequestMapping("/api/v1/blueprint-model") -open class BlueprintModelRest(private val bluePrintModelHandler: BluePrintModelHandler) { +open class BlueprintModelController(private val bluePrintModelHandler: BluePrintModelHandler) { @PostMapping("", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE]) @ResponseBody diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt new file mode 100644 index 00000000..38397faa --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt @@ -0,0 +1,68 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.service.controller + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary +import org.onap.ccsdk.apps.controllerblueprints.service.handler.ResourceDictionaryHandler +import org.springframework.http.MediaType +import org.springframework.web.bind.annotation.* + +@RestController +@RequestMapping(value = ["/api/v1/dictionary"]) +open class ResourceDictionaryController(private val resourceDictionaryHandler: ResourceDictionaryHandler) { + + @GetMapping(path = ["/{name}"], produces = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + @Throws(BluePrintException::class) + fun getResourceDictionaryByName(@PathVariable(value = "name") name: String): ResourceDictionary { + return resourceDictionaryHandler.getResourceDictionaryByName(name) + } + + @PostMapping(path = [""], produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + @Throws(BluePrintException::class) + fun saveResourceDictionary(@RequestBody dataDictionary: ResourceDictionary): ResourceDictionary { + return resourceDictionaryHandler.saveResourceDictionary(dataDictionary) + } + + @DeleteMapping(path = ["/{name}"]) + fun deleteResourceDictionaryByName(@PathVariable(value = "name") name: String) { + resourceDictionaryHandler.deleteResourceDictionary(name) + } + + @PostMapping(path = ["/by-names"], produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + fun searchResourceDictionaryByNames(@RequestBody names: List<String>): List<ResourceDictionary> { + return resourceDictionaryHandler.searchResourceDictionaryByNames(names) + } + + @GetMapping(path = ["/search/{tags}"], produces = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + fun searchResourceDictionaryByTags(@PathVariable(value = "tags") tags: String): List<ResourceDictionary> { + return resourceDictionaryHandler.searchResourceDictionaryByTags(tags) + + } + + @GetMapping(path = ["/source-mapping"], produces = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + fun getResourceSourceMapping(): ResourceSourceMapping { + return resourceDictionaryHandler.getResourceSourceMapping() + } + +} diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java index 42c6365a..a94df6ae 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java @@ -28,7 +28,6 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants; import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType; import org.onap.ccsdk.apps.controllerblueprints.service.handler.ModelTypeHandler; -import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestTest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.annotation.Commit; @@ -45,7 +44,7 @@ import java.util.List; @ContextConfiguration(classes = {TestApplication.class}) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ModelTypeServiceTest { - private static EELFLogger log = EELFManager.getInstance().getLogger(ModelTypeRestTest.class); + private static EELFLogger log = EELFManager.getInstance().getLogger(ModelTypeServiceTest.class); @Autowired private ModelTypeHandler modelTypeHandler; diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java deleted file mode 100644 index 64c87e06..00000000 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java +++ /dev/null @@ -1,122 +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.controllerblueprints.service.rs;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.junit.Assert;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
-import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.controller.ModelTypeController;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
-import org.springframework.test.annotation.Commit;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.util.List;
-
-@RunWith(SpringRunner.class)
-@DataJpaTest
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ModelTypeRestTest {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ModelTypeRestTest.class);
- @Autowired
- ModelTypeController modelTypeController;
-
- String modelName = "test-datatype";
-
- @Test
- @Commit
- public void test01SaveModelType() throws Exception {
- log.info("**************** test01SaveModelType ********************");
-
- String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");
- ModelType modelType = new ModelType();
- modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
- modelType.setDescription("Definition for Sample Datatype ");
- modelType.setDefinition(JacksonUtils.Companion.jsonNode(content));
- modelType.setModelName(modelName);
- modelType.setVersion("1.0.0");
- modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- modelType.setUpdatedBy("xxxxxx@xxx.com");
- modelType = modelTypeController.saveModelType(modelType);
- log.info("Saved Mode {}", modelType.toString());
- Assert.assertNotNull("Failed to get Saved ModelType", modelType);
- Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.getModelName());
-
- ModelType dbModelType = modelTypeController.getModelTypeByName(modelType.getModelName());
- Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType.getModelName() + ")",
- dbModelType);
-
- // Model Update
- modelType.setUpdatedBy("bs2796@xxx.com");
- modelType = modelTypeController.saveModelType(modelType);
- Assert.assertNotNull("Failed to get Saved ModelType", modelType);
- Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.getUpdatedBy());
-
- }
-
- @Test
- public void test02SearchModelTypes() throws Exception {
- log.info("*********************** test02SearchModelTypes ***************************");
-
- String tags = "test-datatype";
-
- List<ModelType> dbModelTypes = modelTypeController.searchModelTypes(tags);
- Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes);
- Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size() > 0);
-
- }
-
- @Test
- public void test03GetModelType() throws Exception {
- log.info("************************* test03GetModelType *********************************");
- ModelType dbModelType = modelTypeController.getModelTypeByName(modelName);
- Assert.assertNotNull("Failed to get response for api call getModelByName " + modelName, dbModelType);
- Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType.getModelName());
-
- List<ModelType> dbDatatypeModelTypes =
- modelTypeController.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes);
- Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.size() > 0);
- }
-
- @Test
- @Commit
- public void test04DeleteModelType() throws Exception {
- log.info(
- "************************ test03DeleteModelType ***********************");
- ModelType dbResourceMapping = modelTypeController.getModelTypeByName(modelName);
- Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping);
- Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping.getModelName());
-
- modelTypeController.deleteModelTypeByName(dbResourceMapping.getModelName());
- }
-
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelControllerTest.kt index f82aace4..d504c293 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelControllerTest.kt @@ -1,5 +1,6 @@ /* * Copyright © 2019 Bell Canada Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +49,7 @@ import java.nio.file.Files import java.nio.file.Paths /** - * BlueprintModelRestTest Purpose: Integration test at API level + * BlueprintModelControllerTest Purpose: Integration test at API level * * @author Vinal Patel * @version 1.0 @@ -60,7 +61,7 @@ import java.nio.file.Paths @ComponentScan(basePackages = ["org.onap.ccsdk.apps.controllerblueprints"]) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @EnableAutoConfiguration -class BlueprintModelRestTest { +class BlueprintModelControllerTest { companion object { diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt new file mode 100644 index 00000000..6fd0d1f0 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt @@ -0,0 +1,120 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.service.controller + +import com.att.eelf.configuration.EELFManager +import org.junit.Assert +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.onap.ccsdk.apps.controllerblueprints.TestApplication +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest +import org.springframework.test.annotation.Commit +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.junit4.SpringRunner + +@RunWith(SpringRunner::class) +@DataJpaTest +@ContextConfiguration(classes = [TestApplication::class]) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class ModelTypeControllerTest { + + private val log = EELFManager.getInstance().getLogger(ModelTypeControllerTest::class.java)!! + + @Autowired + internal var modelTypeController: ModelTypeController? = null + + private var modelName = "test-datatype" + + @Test + @Commit + @Throws(Exception::class) + fun test01SaveModelType() { + log.info("**************** test01SaveModelType ********************") + + val content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json") + var modelType = ModelType() + modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE + modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + modelType.description = "Definition for Sample Datatype " + modelType.definition = JacksonUtils.jsonNode(content) + modelType.modelName = modelName + modelType.version = "1.0.0" + modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," + + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) + modelType.updatedBy = "xxxxxx@xxx.com" + modelType = modelTypeController!!.saveModelType(modelType) + log.info("Saved Mode {}", modelType.toString()) + Assert.assertNotNull("Failed to get Saved ModelType", modelType) + Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.modelName) + + val dbModelType = modelTypeController!!.getModelTypeByName(modelType.modelName) + Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")", + dbModelType) + + // Model Update + modelType.updatedBy = "bs2796@xxx.com" + modelType = modelTypeController!!.saveModelType(modelType) + Assert.assertNotNull("Failed to get Saved ModelType", modelType) + Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.updatedBy) + + } + + @Test + @Throws(Exception::class) + fun test02SearchModelTypes() { + log.info("*********************** test02SearchModelTypes ***************************") + + val tags = "test-datatype" + + val dbModelTypes = modelTypeController!!.searchModelTypes(tags) + Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes) + Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.isNotEmpty()) + + } + + @Test + @Throws(Exception::class) + fun test03GetModelType() { + log.info("************************* test03GetModelType *********************************") + val dbModelType = modelTypeController!!.getModelTypeByName(modelName) + Assert.assertNotNull("Failed to get response for api call getModelByName $modelName", dbModelType) + Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType!!.modelName) + + val dbDatatypeModelTypes = modelTypeController!!.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) + Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes) + Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.isNotEmpty()) + } + + @Test + @Commit + @Throws(Exception::class) + fun test04DeleteModelType() { + log.info( + "************************ test03DeleteModelType ***********************") + val dbResourceMapping = modelTypeController!!.getModelTypeByName(modelName) + Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping) + Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping!!.modelName) + + modelTypeController!!.deleteModelTypeByName(dbResourceMapping.modelName) + } +} diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt new file mode 100644 index 00000000..96c14261 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt @@ -0,0 +1,43 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.service.controller + +import org.junit.Test +import org.junit.runner.RunWith +import org.onap.ccsdk.apps.controllerblueprints.TestApplication +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.context.annotation.ComponentScan +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.junit4.SpringRunner +import kotlin.test.assertNotNull + +@RunWith(SpringRunner::class) +@ContextConfiguration(classes = [TestApplication::class]) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ComponentScan(basePackages = ["org.onap.ccsdk.apps.controllerblueprints"]) +class ResourceDictionaryControllerTest { + + @Autowired + lateinit var resourceDictionaryController: ResourceDictionaryController + + @Test + fun testResourceDictionaryControllerPresence() { + assertNotNull(resourceDictionaryController, "failed to initialise ResourceDictionaryController") + } + +}
\ No newline at end of file |