Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Forge.TreeWalker.UnitTests/Forge.TreeWalker.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<None Include="test\ExampleSchemas\TestEvaluateInputTypeSchema.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="test\ExampleSchemas\OutputBindingsSchema.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="test\InvalidTestSchemas\InvalidActionTestSchema.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"Tree": {
"Root": {
"Type": "Action",
"Actions": {
"Root_CollectDiagnosticsAction": {
"Action": "CollectDiagnosticsAction",
"Input": {
"Command": "RunCollectDiagnostics.exe"
},
"OutputBindings": {
"diagStatus": "Status",
"diagStatusCode": "StatusCode",
"diagOutput": "Output"
}
}
},
"ChildSelector": [
{
"Label": "DiagnosticsSuccess",
"ShouldSelect": "C#|Vars.diagStatus == \"Success\"",
"Child": "Analyze"
},
{
"Label": "DiagnosticsFailure",
"Child": "DiagnosticsFailure"
}
]
},
"Analyze": {
"Type": "Action",
"Actions": {
"Analyze_AnalyzeAction": {
"Action": "CollectDiagnosticsAction",
"Input": {
"Command": "C#|\"Analyze --code=\" + Vars.diagStatusCode.ToString()"
},
"OutputBindings": {
"analyzeStatus": "Status",
"analysisResult": "Output"
}
}
},
"ChildSelector": [
{
"Label": "AnalysisComplete",
"ShouldSelect": "C#|Vars.analyzeStatus == \"Success\"",
"Child": "AnalysisComplete"
},
{
"Label": "AnalysisFailure",
"Child": "AnalysisFailure"
}
]
},
"AnalysisComplete": {
"Type": "Leaf",
"Actions": {
"AnalysisComplete_Summary": {
"Action": "LeafNodeSummaryAction",
"Input": {
"Status": "C#|Vars.analyzeStatus"
}
}
}
},
"AnalysisFailure": {
"Type": "Leaf"
},
"DiagnosticsFailure": {
"Type": "Leaf"
}
}
}
250 changes: 250 additions & 0 deletions Forge.TreeWalker.UnitTests/test/ForgeSchemaHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,5 +570,255 @@ public static class ForgeSchemaHelper
}
}
";

#region OutputBindings Schemas

public const string OutputBindings_BasicStatus = @"
{
""Tree"": {
""Root"": {
""Type"": ""Action"",
""Actions"": {
""Root_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""RunDiagnostics""
},
""OutputBindings"": {
""diagStatus"": ""Status"",
""diagStatusCode"": ""StatusCode""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.diagStatus == \""Success\"""",
""Child"": ""Success""
},
{
""Child"": ""Failure""
}
]
},
""Success"": {
""Type"": ""Leaf""
},
""Failure"": {
""Type"": ""Leaf""
}
}
}";

public const string OutputBindings_OutputProperty = @"
{
""Tree"": {
""Root"": {
""Type"": ""Action"",
""Actions"": {
""Root_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""RunDiagnostics""
},
""OutputBindings"": {
""diagOutput"": ""Output""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.diagOutput != null"",
""Child"": ""HasOutput""
},
{
""Child"": ""NoOutput""
}
]
},
""HasOutput"": {
""Type"": ""Leaf""
},
""NoOutput"": {
""Type"": ""Leaf""
}
}
}";

public const string OutputBindings_CrossNode = @"
{
""Tree"": {
""Root"": {
""Type"": ""Action"",
""Actions"": {
""Root_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""RunDiagnostics""
},
""OutputBindings"": {
""firstStatus"": ""Status""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.firstStatus == \""Success\"""",
""Child"": ""SecondAction""
}
]
},
""SecondAction"": {
""Type"": ""Action"",
""Actions"": {
""SecondAction_TardigradeAction"": {
""Action"": ""TardigradeAction"",
""OutputBindings"": {
""secondStatus"": ""Status""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.firstStatus == \""Success\"" && Vars.secondStatus == \""Success\"""",
""Child"": ""BothSuccess""
},
{
""Child"": ""Failure""
}
]
},
""BothSuccess"": {
""Type"": ""Leaf""
},
""Failure"": {
""Type"": ""Leaf""
}
}
}";

public const string OutputBindings_VarOverwrite = @"
{
""Tree"": {
""Root"": {
""Type"": ""Action"",
""Actions"": {
""Root_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""RunDiagnostics""
},
""OutputBindings"": {
""status"": ""Status""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.status == \""Success\"""",
""Child"": ""OverwriteAction""
}
]
},
""OverwriteAction"": {
""Type"": ""Action"",
""Actions"": {
""OverwriteAction_TardigradeAction"": {
""Action"": ""TardigradeAction"",
""OutputBindings"": {
""status"": ""Status""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.status == \""Success\"""",
""Child"": ""Done""
}
]
},
""Done"": {
""Type"": ""Leaf""
}
}
}";

public const string OutputBindings_UsedInInput = @"
{
""Tree"": {
""Root"": {
""Type"": ""Action"",
""Actions"": {
""Root_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""FirstCommand""
},
""OutputBindings"": {
""firstOutput"": ""Output""
}
}
},
""ChildSelector"": [
{
""Child"": ""UseVarInInput""
}
]
},
""UseVarInInput"": {
""Type"": ""Action"",
""Actions"": {
""UseVarInInput_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""C#|\""Process_\"" + Vars.firstOutput.ToString()""
},
""OutputBindings"": {
""secondOutput"": ""Output""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|Vars.secondOutput != null"",
""Child"": ""Done""
}
]
},
""Done"": {
""Type"": ""Leaf""
}
}
}";

public const string OutputBindings_GetVarAccessor = @"
{
""Tree"": {
""Root"": {
""Type"": ""Action"",
""Actions"": {
""Root_CollectDiagnosticsAction"": {
""Action"": ""CollectDiagnosticsAction"",
""Input"": {
""Command"": ""RunDiagnostics""
},
""OutputBindings"": {
""myStatus"": ""Status""
}
}
},
""ChildSelector"": [
{
""ShouldSelect"": ""C#|(string)Session.GetVar(\""myStatus\"") == \""Success\"""",
""Child"": ""Done""
}
]
},
""Done"": {
""Type"": ""Leaf""
}
}
}";

#endregion OutputBindings Schemas
}
}
Loading