summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin
diff options
context:
space:
mode:
authorBrinda Santh <bs2796@att.com>2019-12-11 18:32:24 -0500
committerBrinda Santh <bs2796@att.com>2019-12-11 18:32:24 -0500
commitd4fadc988246eb172ce8333bb3a06443591c5f19 (patch)
tree19701b12c7f3008acb6a62772458ea4b47e043d8 /ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin
parenta30e1864fadad70c797ca1248a3c1272300a6e2b (diff)
Metadata for name, version, tags and type
Mandate Tosca.meta template name, version, type and tags. Auto copy metadata from Tosca.meta to ServiceTemplate definitions. Optimize Blueprint context and runtime creation from file path. Removed attached CBA zip file in test repository dirs Issue-ID: CCSDK-1992 Signed-off-by: Brinda Santh <bs2796@att.com> Change-Id: I5d9d7a4599234a38d431328dbd9b74bd831e0115
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin')
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt17
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt47
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt26
4 files changed, 62 insertions, 30 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
index 597194c29..38f6ea2ec 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
import com.fasterxml.jackson.databind.ObjectMapper
+import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
@@ -58,16 +59,20 @@ class BluePrintContextTest {
@Test
fun testBluePrintContextCreation() {
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
- assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+ runBlocking {
+ val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
+ assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+ }
}
@Test
fun testChainedProperty() {
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
- val nodeType = bluePrintContext.nodeTypeChained("component-resource-resolution")
- assertNotNull(nodeType, "Failed to get chained node type")
- log.trace("Properties {}", JacksonUtils.getJson(nodeType, true))
+ runBlocking {
+ val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
+ val nodeType = bluePrintContext.nodeTypeChained("component-resource-resolution")
+ assertNotNull(nodeType, "Failed to get chained node type")
+ log.trace("Properties {}", JacksonUtils.getJson(nodeType, true))
+ }
}
@Test
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index dea46224d..b079d42aa 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -70,9 +70,9 @@ class BluePrintRuntimeServiceTest {
)
val assignmentParams = "{\n" +
- " \"ipAddress\": \"127.0.0.1\",\n" +
- " \"hostName\": \"vnf-host\"\n" +
- " }"
+ " \"ipAddress\": \"127.0.0.1\",\n" +
+ " \"hostName\": \"vnf-host\"\n" +
+ " }"
bluePrintRuntimeService.setNodeTemplateAttributeValue(
"resource-assignment", "assignment-params",
@@ -84,8 +84,16 @@ class BluePrintRuntimeServiceTest {
"netconf"
)
assertNotNull(capProperties, "Failed to populate capability property values")
- assertEquals(capProperties["target-ip-address"], "127.0.0.1".asJsonPrimitive(), "Failed to populate parameter target-ip-address")
- assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number")
+ assertEquals(
+ capProperties["target-ip-address"],
+ "127.0.0.1".asJsonPrimitive(),
+ "Failed to populate parameter target-ip-address"
+ )
+ assertEquals(
+ capProperties["port-number"],
+ JacksonUtils.jsonNodeFromObject(830),
+ "Failed to populate parameter port-number"
+ )
}
@Test
@@ -108,8 +116,16 @@ class BluePrintRuntimeServiceTest {
)
assertNotNull(inContext, "Failed to populate interface input property values")
- assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
- assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
+ assertEquals(
+ inContext["action-name"],
+ JacksonUtils.jsonNodeFromObject("sample-action"),
+ "Failed to populate parameter action-name"
+ )
+ assertEquals(
+ inContext["request-id"],
+ JacksonUtils.jsonNodeFromObject("12345"),
+ "Failed to populate parameter action-name"
+ )
}
@Test
@@ -118,7 +134,11 @@ class BluePrintRuntimeServiceTest {
val bluePrintRuntimeService = getBluePrintRuntimeService()
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance())
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment",
+ "assignment-params",
+ NullNode.getInstance()
+ )
bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs(
"resource-assignment",
@@ -135,7 +155,11 @@ class BluePrintRuntimeServiceTest {
"resource-assignment",
"ResourceResolutionComponent", "process", "resource-assignment-params"
)
- assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params")
+ assertEquals(
+ NullNode.getInstance(),
+ outputParams,
+ "Failed to get operation property resource-assignment-params"
+ )
}
@Test
@@ -154,7 +178,8 @@ class BluePrintRuntimeServiceTest {
val keys = listOf("context1", "context2")
- val jsonValueNode = bluePrintRuntimeService.getJsonForNodeTemplateAttributeProperties("resource-assignment-ra-component", keys)
+ val jsonValueNode =
+ bluePrintRuntimeService.getJsonForNodeTemplateAttributeProperties("resource-assignment-ra-component", keys)
assertNotNull(jsonValueNode, "Failed to get Json for Node Template Context Properties")
log.info("JSON Prepared Value Context {}", jsonValueNode)
}
@@ -189,7 +214,7 @@ class BluePrintRuntimeServiceTest {
private fun getBluePrintRuntimeService(): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
val blueprintBasePath = normalizedPathName(TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG)
- val blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
+ val blueprintRuntime = BluePrintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath)
val checkProcessId = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID)
val checkBasePath = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
index e525bfc27..0e93ccf6b 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
@@ -34,7 +34,7 @@ class BluePrintTemplateServiceTest {
@BeforeTest
fun setup() {
val blueprintBasePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
- blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
+ blueprintRuntime = BluePrintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath)
}
@Test
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
index 302daf67e..6ccfe1e95 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
@@ -48,20 +48,22 @@ class BluePrintMetadataUtilsTest {
@Test
fun testKotlinBluePrintContext() {
- val path = normalizedPathName("src/test/resources/compile")
- val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(path)
- assertNotNull(blueprintContext, "failed to get blueprint context")
- assertNotNull(blueprintContext.serviceTemplate, "failed to get blueprint context service template")
- assertNotNull(blueprintContext.serviceTemplate, "failed to get blueprint context service template")
- assertNotNull(blueprintContext.otherDefinitions, "failed to get blueprint contextother definitions")
+ runBlocking {
+ val path = normalizedPathName("src/test/resources/compile")
+ val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(path)
+ assertNotNull(blueprintContext, "failed to get blueprint context")
+ assertNotNull(blueprintContext.serviceTemplate, "failed to get blueprint context service template")
+ assertNotNull(blueprintContext.serviceTemplate, "failed to get blueprint context service template")
+ assertNotNull(blueprintContext.otherDefinitions, "failed to get blueprint contextother definitions")
- var cachePresent = BluePrintCompileCache.hasClassLoader(path)
- assertTrue(cachePresent, "failed to generate cache key ($path)")
+ var cachePresent = BluePrintCompileCache.hasClassLoader(path)
+ assertTrue(cachePresent, "failed to generate cache key ($path)")
- /** Cleaning Cache */
- BluePrintCompileCache.cleanClassLoader(path)
- cachePresent = BluePrintCompileCache.hasClassLoader(path)
- assertTrue(!cachePresent, "failed to remove cache key ($path)")
+ /** Cleaning Cache */
+ BluePrintCompileCache.cleanClassLoader(path)
+ cachePresent = BluePrintCompileCache.hasClassLoader(path)
+ assertTrue(!cachePresent, "failed to remove cache key ($path)")
+ }
}
@Test