diff options
author | 2019-08-05 12:24:33 -0400 | |
---|---|---|
committer | 2019-08-09 22:15:21 +0000 | |
commit | afcd99e9dc0d765758be1d91ab862afa54d244dd (patch) | |
tree | 39f68621f7d1a807cec0e1a66f53864c314d8587 /ms/controllerblueprints/modules/blueprint-core/src/test | |
parent | 977287b586e27e2f835a5d24950abf1f2adae8be (diff) |
Add class model for workflow and resource data type.
Change-Id: Ia42f56541bef0418dddb797c019ecda3afa6983b
Issue-ID: CCSDK-1380
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core/src/test')
-rw-r--r-- | ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt new file mode 100644 index 000000000..c24ed0327 --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt @@ -0,0 +1,116 @@ +/* + * 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.cds.controllerblueprints.core.annotations + +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.controllerblueprints.core.asBluePrintsDataTypes +import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap +import kotlin.test.Test +import kotlin.test.assertNotNull + +class BluePrintsAnnotationsTest { + + @Test + fun testBluePrintWorkflowData() { + val wfInput = TestBluePrintsWorkflowInput::class.asPropertyDefinitionMap() + //println(wfInput.asJsonString(true)) + assertNotNull(wfInput, "failed to generate wfInput property map") + + val wfOutput = TestBluePrintsWorkflowOutput::class.asPropertyDefinitionMap() + //println(wfOutput.asJsonString(true)) + assertNotNull(wfInput, "failed to generate wfOutput property map") + } + + @Test + fun testBluePrintDataType() { + val dataTypes = TestBluePrintsDataType::class.asBluePrintsDataTypes() + //println(dataTypes.asJsonString(true)) + assertNotNull(dataTypes, "failed to generate dataTypes definition") + } +} + +@BluePrintsDataType(name = "dt-test-datatype", description = "I am test", + version = "1.0.0", derivedFrom = "tosca.datatypes.root") +data class TestBluePrintsDataType( + @BluePrintsProperty(description = "this stringData") + var stringData: String, + @BluePrintsProperty(description = "this stringDataWithValue") + @PropertyDefaultValue(value = "USA") + val stringDataWithValue: String, + @BluePrintsProperty(description = "this intDataWithValue") + @PropertyDefaultValue(value = "30") + val intDataWithValue: Int, + @BluePrintsProperty(description = "this booleanDataWithValue") + @PropertyDefaultValue(value = "true") + val booleanDataWithValue: Boolean, + @BluePrintsProperty(description = "this anyData") + val anyData: Any, + @BluePrintsProperty(description = "this jsonDataWithValue") + @PropertyDefaultValue(value = """{"data" : "1234"}""") + val jsonDataWithValue: JsonNode?, + @BluePrintsProperty(description = "listData") + val listData: MutableList<String>, + @BluePrintsProperty(description = "this mapData") + val mapData: MutableMap<String, String> = hashMapOf(), + @BluePrintsProperty(description = "this complexData") + val complexData: TestBluePrintsChildDataType?, + @BluePrintsProperty(description = "this complexDataList") + val complexDataList: MutableList<TestBluePrintsChildDataType> +) + +data class TestBluePrintsChildDataType(val name: String) + + +@BluePrintsWorkflowInput +data class TestBluePrintsWorkflowInput( + @BluePrintsProperty(description = "this sample name") + @PropertyDefaultValue(value = "Brinda") + var name: String, + @BluePrintsProperty(description = "this sample name") + val place: String +) + +@BluePrintsWorkflowOutput +data class TestBluePrintsWorkflowOutput( + @BluePrintsProperty(description = "this is dslExpression") + @DSLExpression("field1") + var dslExpression: String, + + @BluePrintsProperty(description = "this is withNodeAttributeExpression") + @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data") + var withNodeAttributeExpression: String, + + @BluePrintsProperty(description = "this is withNodeAttributeExpressionSubAttribute") + @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data", + subAttributeName = ".\$field1") + var withNodeAttributeExpressionSubAttribute: String, + + @BluePrintsProperty(description = "this is withAttributeExpressionSubAttribute") + @AttributeExpression(attributeName = "response-data", subAttributeName = ".\$field1") + var withAttributeExpressionSubAttribute: String, + + @BluePrintsProperty(description = "this is withAttributeExpression") + @AttributeExpression(attributeName = "response-data") + var withAttributeExpression: String, + + @BluePrintsProperty(description = "this is withAArtifactExpression") + @ArtifactExpression(modelableEntityName = "test-node", artifactName = "content-template") + var withAArtifactExpression: String, + + @BluePrintsProperty(description = "this status") + val status: String = "success" +)
\ No newline at end of file |