summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons/ssh-lib
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/ssh-lib')
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt7
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSLTest.kt24
2 files changed, 23 insertions, 8 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt
index e63f2eb49..ee7a7dead 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt
@@ -24,10 +24,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.RelationshipTemplateBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.ServiceTemplateBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.TopologyTemplateBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.relationshipType
/** Relationships Types DSL for Message Producer */
+fun ServiceTemplateBuilder.relationshipTypeConnectsToSshClient() {
+ val relationshipType = BluePrintTypes.relationshipTypeConnectsToSshClient()
+ if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf()
+ this.relationshipTypes!![relationshipType.id!!] = relationshipType
+}
+
fun BluePrintTypes.relationshipTypeConnectsToSshClient(): RelationshipType {
return relationshipType(
id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_SSH_CLIENT,
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSLTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSLTest.kt
index bc4355357..85891b1b5 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSLTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSLTest.kt
@@ -17,7 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.ssh
import org.junit.Test
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.relationshipTypeConnectsTo
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
import kotlin.test.assertEquals
@@ -38,19 +38,27 @@ class SshPropertiesDSLTest {
}
}
}
- relationshipTypes(
- arrayListOf(
- BluePrintTypes.relationshipTypeConnectsToSshClient(),
- BluePrintTypes.relationshipTypeConnectsTo()
- )
- )
+ relationshipTypeConnectsToSshClient()
+ relationshipTypeConnectsTo()
}
+ // println(serviceTemplate.asJsonString(true))
assertNotNull(serviceTemplate, "failed to create service template")
val relationshipTemplates = serviceTemplate.topologyTemplate?.relationshipTemplates
assertNotNull(relationshipTemplates, "failed to get relationship templates")
assertEquals(1, relationshipTemplates.size, "relationshipTemplates doesn't match")
assertNotNull(relationshipTemplates["sample-basic-auth"], "failed to get sample-basic-auth")
- // println(serviceTemplate.asJsonString(true))
+
+ val relationshipTypes = serviceTemplate.relationshipTypes
+ assertNotNull(relationshipTypes, "failed to get relationship types")
+ assertEquals(2, relationshipTypes.size, "relationshipTypes doesn't match")
+ assertNotNull(
+ relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO],
+ "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO}"
+ )
+ assertNotNull(
+ relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_SSH_CLIENT],
+ "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_SSH_CLIENT}"
+ )
}
}