diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-13 18:44:46 -0400 |
---|---|---|
committer | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-08-16 14:28:24 +0000 |
commit | ddec406f5d7dc8207c5e079ebad9d1f2b6b702a3 (patch) | |
tree | 678d6a3d3c8778a110ab1e2a77c7a4d8a7b3b3a1 /ms/controllerblueprints/modules/blueprint-core/src/test/kotlin | |
parent | d898a9d76e47b390fe3c171d2c8d356782955f12 (diff) |
Add blueprints graph models.
Change-Id: I6743642c9f96002a963479eba56451eed2d9fe8f
Issue-ID: CCSDK-1617
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core/src/test/kotlin')
-rw-r--r-- | ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt new file mode 100644 index 000000000..86cb473ae --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt @@ -0,0 +1,37 @@ +/* + * 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 + +import org.junit.Test +import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel +import kotlin.test.assertNotNull + +class GraphExtensionFunctionsTest { + + @Test + fun testGraph() { + val graph = "[p>q/SUCCESS, m>q/SUCCESS, k, p>m/FAILURE, o>p/SUCCESS]".toGraph() + assertNotNull(graph, "failed to create graph") + assertNotNull(graph.toAdjacencyList(), "failed to adjacency list from graph") + + val neighbors = graph.nodes["p"]!!.neighbors() + assertNotNull(neighbors, "failed to neighbors from graph for 'p' node") + + val nodePath = graph.nodes["p"]!!.neighbors(EdgeLabel.SUCCESS) + assertNotNull(nodePath, "failed to nodePath from graph for 'p' node 'SUCCESS' label") + } +} |