Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add output parameters to complex workflows
Change-Id: Icdcda4c635aa53e759e23e82e7b998da16b63045 Partial-Bug: #1783120
- Loading branch information
lukasz
committed
Aug 2, 2018
1 parent
c7d7791
commit d15de20
Showing
12 changed files
with
297 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#maven.buildNumber.plugin properties file | ||
#Wed Aug 01 17:04:01 CEST 2018 | ||
buildNumber=1643 | ||
#Thu Aug 02 17:35:22 CEST 2018 | ||
buildNumber=1648 |
57 changes: 57 additions & 0 deletions
57
...trail-tests/src/test/groovy/net/juniper/contrail/vro/tests/dsl/AutomaticOutputSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package net.juniper.contrail.vro.tests.dsl | ||
|
||
import spock.lang.Specification | ||
|
||
class AutomaticOutputSpec extends Specification { | ||
|
||
def "Script Item is connected to all nodes previously connected to EndItem"() { | ||
given: | ||
def attributeNames = [] | ||
def parameterNames = [] | ||
def choices = 2 | ||
def inputItems = 2 | ||
when: "Complex workflow is created" | ||
def workflow = SomeWorkflowKt.someComplexWorkflowWithInputChoiceAutomaticOutput(choices, inputItems, attributeNames, parameterNames) | ||
then: "All connections previously targeting EndItem now target scriptItem" | ||
def scriptItem = workflow.workflowItems.find { it.type == "task" } | ||
def outConnections = workflow.workflowItems.collect { it.outName } | ||
def switchItems = workflow.workflowItems.findAll { it.type == "switch" } | ||
def allConditions = switchItems.collect { it.conditions }.flatten() | ||
def allLabels = allConditions.collect { it.label } | ||
def scriptConnections = (outConnections + allLabels).findAll { it == scriptItem.name } | ||
scriptConnections.size() == choices*2 + inputItems | ||
} | ||
|
||
|
||
def "Script Item has all relevant Bindings"() { | ||
given: | ||
def attributeNames = ["attribute1", "attribute2", "attribute3", "attribute4"] | ||
def parameterNames = ["parameter1", "parameter2", "parameter3", "parameter4"] | ||
def choices = 0 | ||
def inputItems = 1 | ||
when: "Complex workflow is created" | ||
def workflow = SomeWorkflowKt.someComplexWorkflowWithInputChoiceAutomaticOutput(choices, inputItems, attributeNames, parameterNames) | ||
then: "ScriptItem has correct bindings" | ||
def scriptItem = workflow.workflowItems.find { it.type == "task" } | ||
|
||
def inBindings = scriptItem.inBinding.binds | ||
def inBindNamesWithAttributeNames = [ | ||
inBindings.collect { it.name }, | ||
inBindings.collect { it.exportName }, | ||
attributeNames | ||
].transpose() | ||
def inBindBooleans = inBindNamesWithAttributeNames.collect { it[0] == it[1] && it[1] == it[2] } | ||
|
||
def outBindings = scriptItem.outBinding.binds | ||
def outBindNameWithParameterNames = [ | ||
outBindings.collect { it.name }, | ||
outBindings.collect { it.exportName }, | ||
attributeNames, | ||
parameterNames | ||
].transpose() | ||
def outBindBooleans = outBindNameWithParameterNames.collect { it[0] == it[2] && it[1] == it[3] } | ||
|
||
inBindBooleans.every { it } && inBindBooleans.size() == attributeNames.size() | ||
outBindBooleans.every { it } && outBindBooleans.size() == attributeNames.size() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.