@@ -91,7 +91,6 @@ func TestSimpleWorkflow(t *testing.T) {
9191 nextNodeId := prevNode .GetNext ()[0 ]
9292 currentNode , _ = wflow .Find (nextNodeId )
9393 u .AssertEquals (t , prevNode .(* workflow.SimpleNode ).OutputTo , currentNode .GetId ())
94- u .AssertEquals (t , prevNode .(* workflow.SimpleNode ).BranchId , 0 )
9594 u .AssertTrue (t , prevNode .(* workflow.SimpleNode ).Func == f .Name )
9695 }
9796 prevNode = currentNode
@@ -135,15 +134,8 @@ func TestChoiceWorkflow(t *testing.T) {
135134 u .AssertTrue (t , foundS )
136135 u .AssertEquals (t , simple .(* workflow.SimpleNode ).OutputTo , wflow .End .GetId ())
137136 }
138- u .AssertEqualsMsg (t , 0 , n .GetBranchId (), "wrong branchId for choice node" )
139137 case * workflow.SimpleNode :
140138 u .AssertTrue (t , n .(* workflow.SimpleNode ).Func == f .Name )
141- for i , alternative := range choice .Alternatives {
142- // the branch of the simple nodes should be 1,2 or 3 because branch of choice is 0
143- if alternative == n .GetId () {
144- u .AssertEqualsMsg (t , i + 1 , n .GetBranchId (), "wrong branchId for simple node" )
145- }
146- }
147139 }
148140 }
149141}
@@ -185,7 +177,6 @@ func TestChoiceWorkflow_BuiltWithNextBranch(t *testing.T) {
185177 for _ , n := range wflow .Nodes {
186178 switch node := n .(type ) {
187179 case * workflow.ChoiceNode :
188- u .AssertEquals (t , node .GetBranchId (), 0 )
189180 u .AssertEquals (t , len (choice .Conditions ), len (choice .Alternatives ))
190181 for _ , s := range choice .Alternatives {
191182 simple , foundS := wflow .Find (s )
@@ -196,13 +187,6 @@ func TestChoiceWorkflow_BuiltWithNextBranch(t *testing.T) {
196187 }
197188 case * workflow.SimpleNode :
198189 u .AssertTrue (t , node .Func == f .Name )
199- for i , alternative := range choice .Alternatives {
200- // the branch of the simple nodes should be 1,2 or 3 because branch of choice is 0
201- if alternative == n .GetId () {
202- u .AssertEqualsMsg (t , i + 1 , n .GetBranchId (), "wrong branchId for simple node" )
203- }
204- }
205- u .AssertTrue (t , node .GetBranchId () > 0 )
206190 }
207191 }
208192}
@@ -238,20 +222,16 @@ func TestBroadcastWorkflow(t *testing.T) {
238222 fanOut := n .(* workflow.FanOutNode )
239223 u .AssertEquals (t , len (fanOut .OutputTo ), fanOut .FanOutDegree )
240224 u .AssertEquals (t , width , fanOut .FanOutDegree )
241- for i , s := range fanOut .OutputTo {
242- simple , found := wflow .Find (s )
225+ for _ , s := range fanOut .OutputTo {
226+ _ , found := wflow .Find (s )
243227 u .AssertTrue (t , found )
244- u .AssertEquals (t , simple .GetBranchId (), i + 1 )
245228 }
246- u .AssertEquals (t , n .GetBranchId (), 0 )
247229 case * workflow.FanInNode :
248230 fanIn := n .(* workflow.FanInNode )
249231 u .AssertEquals (t , width , fanIn .FanInDegree )
250232 u .AssertEquals (t , wflow .End .GetId (), fanIn .OutputTo )
251- u .AssertEquals (t , n .GetBranchId (), 4 )
252233 case * workflow.SimpleNode :
253234 u .AssertTrue (t , n .(* workflow.SimpleNode ).Func == f .Name )
254- u .AssertTrue (t , n .GetBranchId () > 0 && n .GetBranchId () < 4 )
255235 default :
256236 continue
257237 }
@@ -285,23 +265,19 @@ func TestScatterWorkflow(t *testing.T) {
285265 fanOut := node
286266 u .AssertEquals (t , len (fanOut .OutputTo ), fanOut .FanOutDegree )
287267 u .AssertEquals (t , width , fanOut .FanOutDegree )
288- for j , s := range fanOut .OutputTo {
289- simple , foundSimple := wflow .Find (s )
268+ for _ , s := range fanOut .OutputTo {
269+ _ , foundSimple := wflow .Find (s )
290270 u .AssertTrue (t , foundSimple )
291- u .AssertEquals (t , simple .GetBranchId (), j + 1 )
292271 }
293- u .AssertEquals (t , node .GetBranchId (), 0 )
294272 case * workflow.FanInNode :
295273 fanIn := node
296274 u .AssertEquals (t , width , fanIn .FanInDegree )
297275 u .AssertEquals (t , wflow .End .GetId (), fanIn .OutputTo )
298- u .AssertEquals (t , fanIn .GetBranchId (), fanIn .FanInDegree + 1 )
299276 case * workflow.SimpleNode :
300277 u .AssertTrue (t , n .(* workflow.SimpleNode ).Func == f .Name )
301278 outputTo , _ := wflow .Find (node .OutputTo )
302279 _ , chainedToFanIn := outputTo .(* workflow.FanInNode )
303280 u .AssertTrue (t , chainedToFanIn )
304- u .AssertTrue (t , n .GetBranchId () > 0 && n .GetBranchId () < 4 )
305281 simpleNodeChainedToFanIn ++
306282 default :
307283 continue
@@ -325,7 +301,6 @@ func TestCreateBroadcastMultiFunctionWorkflow(t *testing.T) {
325301 )
326302 u .AssertNil (t , errWorkflow )
327303 startNext , startNextFound := wflow .Find (wflow .Start .Next )
328- fanOutDegree := startNext .(* workflow.FanOutNode ).FanOutDegree
329304
330305 u .AssertNonNil (t , wflow .Start )
331306 u .AssertNonNil (t , wflow .End )
@@ -346,26 +321,17 @@ func TestCreateBroadcastMultiFunctionWorkflow(t *testing.T) {
346321 u .AssertEquals (t , len (fanOut .OutputTo ), fanOut .FanOutDegree )
347322 // test that there are simple nodes chained to fan out
348323 for _ , s := range fanOut .OutputTo {
349- simple , foundSimple := wflow .Find (s )
324+ _ , foundSimple := wflow .Find (s )
350325 u .AssertTrue (t , foundSimple )
351- for i , branch := range fanOut .OutputTo {
352- // the branch of the simple nodes should be 1,2 or 3 because branch of choice is 0
353- if branch == simple .GetId () {
354- u .AssertEqualsMsg (t , i + 1 , simple .GetBranchId (), "wrong branchId for simple node" )
355- }
356- }
357326 }
358- u .AssertEqualsMsg (t , 0 , fanOut .GetBranchId (), "wrong branchId for fanOut" )
359327 case * workflow.FanInNode :
360328 fanIn := node
361329 u .AssertEquals (t , wflow .Width , fanIn .FanInDegree )
362330 u .AssertEquals (t , wflow .End .GetId (), fanIn .OutputTo )
363- u .AssertEquals (t , fanIn .GetBranchId (), fanIn .FanInDegree + 1 )
364331 default :
365332 continue
366333 case * workflow.SimpleNode :
367334 u .AssertTrue (t , node .Func == f .Name )
368- u .AssertTrue (t , node .GetBranchId () > 0 && node .GetBranchId () < fanOutDegree + 1 )
369335 outputTo , _ := wflow .Find (node .OutputTo )
370336 if _ , ok := outputTo .(* workflow.FanInNode ); ok {
371337 simpleNodeChainedToFanIn ++
@@ -417,7 +383,6 @@ func TestWorkflowBuilder(t *testing.T) {
417383 fanOut := node
418384 u .AssertEquals (t , len (fanOut .OutputTo ), fanOut .FanOutDegree )
419385 u .AssertEquals (t , width , fanOut .FanOutDegree )
420- u .AssertEqualsMsg (t , 2 , fanOut .GetBranchId (), "fan out has wrong branchId" )
421386 for _ , s := range fanOut .OutputTo {
422387 _ , found := wflow .Find (s )
423388 u .AssertTrue (t , found )
@@ -426,19 +391,11 @@ func TestWorkflowBuilder(t *testing.T) {
426391 fanIn := node
427392 u .AssertEquals (t , width , fanIn .FanInDegree )
428393 u .AssertEquals (t , wflow .End .GetId (), fanIn .OutputTo )
429- u .AssertEqualsMsg (t , 6 , fanIn .GetBranchId (), "wrong branchId for fan in" )
430394 case * workflow.SimpleNode :
431395 u .AssertTrue (t , node .Func == f .Name )
432396 nextNode , _ := wflow .Find (node .GetNext ()[0 ])
433397 if _ , ok := nextNode .(* workflow.FanInNode ); ok {
434398 simpleNodeChainedToFanIn ++
435- u .AssertTrueMsg (t , node .GetBranchId () > 2 && node .GetBranchId () < 6 , "wrong branch for simple node connected to fanIn input" ) // the parallel branches of fan out node
436- } else if _ , ok2 := nextNode .(* workflow.ChoiceNode ); ok2 {
437- u .AssertEqualsMsg (t , 0 , node .GetBranchId (), "wrong branch for simpleNode connected to choice node input" ) // the first simple node
438- } else if _ , ok3 := nextNode .(* workflow.EndNode ); ok3 {
439- u .AssertEqualsMsg (t , 1 , node .GetBranchId (), "wrong branch for simpleNode connected to choice alternative 1" ) // the first branch of choice node
440- } else {
441- u .AssertTrueMsg (t , node .GetBranchId () > 2 && node .GetBranchId () < 6 , "wrong branch for simple node inside parallel section" ) // the parallel branches of fan out node
442399 }
443400 case * workflow.ChoiceNode :
444401 choice := node
@@ -453,7 +410,6 @@ func TestWorkflowBuilder(t *testing.T) {
453410 u .AssertTrue (t , foundAlt0 )
454411 u .AssertTrue (t , foundAlt1 )
455412 u .AssertEquals (t , firstAlternative .OutputTo , wflow .End .GetId ())
456- u .AssertEquals (t , choice .GetBranchId (), 0 )
457413 // checking fan out - simples - fan in
458414 for i := range secondAlternative .OutputTo {
459415 secondAltOutput , _ := wflow .Find (secondAlternative .OutputTo [i ])
0 commit comments