diff options
author | 2019-07-18 13:32:51 +0000 | |
---|---|---|
committer | 2019-07-18 13:32:51 +0000 | |
commit | fba3105fb6108c36c77d5918bffb9ff29ae13249 (patch) | |
tree | 24fe45ea383fdee5459785f522af0070becf8f39 /ms/controllerblueprints/modules/blueprint-core/src/test | |
parent | 8b1c78fe6bf20e9544be192dc4a25ef1e61b854f (diff) | |
parent | 54b50882876119f4954bcfba2a466f34b5f79512 (diff) |
Merge "Fix missing constrains definitions."
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/dsl/BluePrintDSLTest.kt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt index 020edc78e..c0641be69 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import org.junit.Test import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType import kotlin.test.assertNotNull @@ -153,6 +154,41 @@ class BluePrintDSLTest { } @Test + fun testNodeTypePropertyConstrains() { + val nodeType = nodeType("data-node", "1.0.0", "tosca.Nodes.root", "") { + property("ip-address", "string", true, "") { + defaultValue("127.0.0.1") + constrain { + validValues(arrayListOf("""127.0.0.1""".asJsonPrimitive())) + length(10) + maxLength(20) + minLength(10) + } + + } + property("disk-space", "string", true, "") { + defaultValue(10) + constrain { + validValues("""["200KB", "400KB"]""") + equal("200KB") + inRange("""["100KB", "500KB" ]""") + maxLength("10MB") + minLength("10KB") + } + constrain { + validValues("""[ 200, 400]""") + greaterOrEqual("10KB") + greaterThan("20KB") + lessOrEqual("200KB") + lessThan("190KB") + } + } + } + assertNotNull(nodeType, "failed to get nodeType") + // println(nodeType.asJsonString(true)) + } + + @Test fun testServiceTemplateWorkflow() { val serviceTemplate = serviceTemplate("sample-bp", "1.0.0", "brindasanth@onap.com", "sample, blueprints") { |