weel 1.99.81 → 1.99.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -0
- data/lib/weel.rb +83 -59
- data/test/TestHandlerWrapper.rb +11 -3
- data/test/TestMixin.rb +4 -5
- data/test/TestWorkflow.rb +2 -2
- data/test/basic/tc_choose.rb +53 -53
- data/test/basic/tc_state.rb +5 -5
- data/test/basic/tc_wf_control.rb +44 -44
- data/test/complexsearch/tc_search.rb +1 -1
- data/test/test +39 -0
- data/weel.gemspec +5 -5
- metadata +8 -6
- data/README +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05367a0dcc8066aeb8180358efed5612c976b7b97e5ea8f5047a83bc482de8ff
|
4
|
+
data.tar.gz: 87a40bbb853caf454d43a8632e9d2535b4cdcfab040bf2490095dbdcbea2123f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b90f1b6a44a0ef9e47a60a8cd1da7f904691377859fd7aab2bcf19b100e1de7eea1534235944060b5101f6836c7c307e868db8828b26cbc9b5363dbb6d10012e
|
7
|
+
data.tar.gz: '077059c2ad549cf6bb0debe569c9bed27b94c5e02c248a0b8662b457c014d726b38924b593b5005abf29dee60cb7b7de164dabcdabb6893ab39c6496319b2634'
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
All code in this package is provided under the LGPL-3 license.
|
2
|
+
Please read the file COPYING.
|
3
|
+
|
4
|
+
Tested for MRI 2.6, 2.7
|
5
|
+
|
6
|
+
# Example Process (DSL)
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
class SimpleWorkflow < WEEL
|
10
|
+
handlerwrapper SimpleHandlerWrapper
|
11
|
+
|
12
|
+
endpoint :ep1 => "orf.at"
|
13
|
+
data :a => 17
|
14
|
+
|
15
|
+
control flow do
|
16
|
+
call :a1, :ep1, parameters: { :a => data.a, :b => 2 } do
|
17
|
+
data.a += 3
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
HandlerWrappers are classes that implement communication protocols. Endpoints hold the communication targets and can be reused throughout the control flow. Data elements are control flow scoped variables.
|
24
|
+
|
25
|
+
Please check out the "example" directory to see a minimal set of necessary artefacts.
|
26
|
+
|
27
|
+
# Further Reading
|
28
|
+
|
29
|
+
For an evaluation and description of all available control flow statements, see https://arxiv.org/pdf/1003.3330.pdf.
|
30
|
+
|
31
|
+
# Installation
|
32
|
+
|
33
|
+
```bash
|
34
|
+
gem install weel
|
35
|
+
```
|
data/lib/weel.rb
CHANGED
@@ -40,33 +40,43 @@ class WEEL
|
|
40
40
|
class Salvage < Exception; end
|
41
41
|
end # }}}
|
42
42
|
|
43
|
-
class ReadStructure # {{{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
class ReadStructure # {{{
|
44
|
+
def initialize(data,endpoints,additional)
|
45
|
+
@__weel_data = data.dup
|
46
|
+
@__weel_data.transform_values! do |v|
|
47
|
+
if Object.const_defined?(:XML) && XML.const_defined?(:Smart) && v.is_a?(XML::Smart::Dom)
|
48
|
+
v.root.to_doc
|
49
|
+
else
|
50
|
+
begin
|
51
|
+
Marshal.load(Marshal.dump(v))
|
52
|
+
rescue
|
53
|
+
v.to_s rescue nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
@__weel_endpoints = endpoints.dup
|
58
|
+
@__weel_endpoints.transform_values!{ |v| v.dup }
|
59
|
+
@additional = additional
|
60
|
+
end
|
61
|
+
|
62
|
+
def method_missing(m,args,&block)
|
63
|
+
if @additional.exists?(m)
|
50
64
|
begin
|
51
|
-
Marshal.load(Marshal.dump(
|
65
|
+
Marshal.load(Marshal.dump(@aditional[m]))
|
52
66
|
rescue
|
53
67
|
v.to_s rescue nil
|
54
68
|
end
|
55
69
|
end
|
56
70
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
64
|
-
def endpoints
|
65
|
-
ReadHash.new(@__weel_endpoints)
|
66
|
-
end
|
67
|
-
end # }}}
|
71
|
+
def data
|
72
|
+
ReadHash.new(@__weel_data)
|
73
|
+
end
|
74
|
+
def endpoints
|
75
|
+
ReadHash.new(@__weel_endpoints)
|
76
|
+
end
|
77
|
+
end # }}}
|
68
78
|
class ManipulateStructure # {{{
|
69
|
-
def initialize(data,endpoints,status)
|
79
|
+
def initialize(data,endpoints,status,additional)
|
70
80
|
@__weel_data = data
|
71
81
|
@__weel_data_orig = @__weel_data.transform_values{|val| Marshal.dump(val) } rescue nil
|
72
82
|
@__weel_endpoints = endpoints
|
@@ -77,6 +87,17 @@ end # }}}
|
|
77
87
|
@touched_data = []
|
78
88
|
@changed_endpoints = []
|
79
89
|
@touched_endpoints = []
|
90
|
+
@additional = additional
|
91
|
+
end
|
92
|
+
|
93
|
+
def method_missing(m,args,&block)
|
94
|
+
if @additional.exists?(m)
|
95
|
+
begin
|
96
|
+
Marshal.load(Marshal.dump(@aditional[m]))
|
97
|
+
rescue
|
98
|
+
v.to_s rescue nil
|
99
|
+
end
|
100
|
+
end
|
80
101
|
end
|
81
102
|
|
82
103
|
def changed_data
|
@@ -209,17 +230,18 @@ end # }}}
|
|
209
230
|
def self::inform_state_change(arguments,newstate); end
|
210
231
|
def self::inform_syntax_error(arguments,err,code); end
|
211
232
|
def self::inform_handlerwrapper_error(arguments,err); end
|
212
|
-
def self::inform_position_change(arguments,ipc); end
|
213
|
-
def self::modify_position_details(arguments); end
|
233
|
+
def self::inform_position_change(arguments,ipc={}); end
|
214
234
|
|
215
|
-
def initialize(arguments,
|
235
|
+
def initialize(arguments,position=nil,continue=nil); end
|
216
236
|
|
217
237
|
def prepare(readonly, endpoints, parameters, replay=false); parameters; end
|
238
|
+
def additional; {}; end
|
218
239
|
|
219
240
|
def activity_handle(passthrough, parameters); end
|
220
241
|
def activity_manipulate_handle(parameters); end
|
221
242
|
|
222
243
|
def activity_result_value; end
|
244
|
+
def activity_result_options; end
|
223
245
|
|
224
246
|
def activity_stop; end
|
225
247
|
def activity_passthrough_value; end
|
@@ -364,8 +386,8 @@ end # }}}
|
|
364
386
|
# Parallel DSL-Construct
|
365
387
|
# Defines Workflow paths that can be executed parallel.
|
366
388
|
# May contain multiple branches (parallel_branch)
|
367
|
-
def parallel(type=nil)# {{{
|
368
|
-
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
389
|
+
def parallel(type=nil,&block)# {{{
|
390
|
+
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
369
391
|
|
370
392
|
Thread.current[:branches] = []
|
371
393
|
Thread.current[:branch_finished_count] = 0
|
@@ -374,7 +396,7 @@ end # }}}
|
|
374
396
|
|
375
397
|
hw, pos = __weel_sim_start(:parallel) if __weel_sim
|
376
398
|
|
377
|
-
__weel_protect_yield(&
|
399
|
+
__weel_protect_yield(&block)
|
378
400
|
|
379
401
|
Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type.size == 1 && type[:wait] != nil && (type[:wait].is_a?(Integer) && type[:wait] > 0) ? type[:wait] : Thread.current[:branches].size)
|
380
402
|
1.upto Thread.current[:branches].size do
|
@@ -387,10 +409,10 @@ end # }}}
|
|
387
409
|
if Thread.current[:branch_search] == false
|
388
410
|
thread[:branch_search] = false
|
389
411
|
end
|
390
|
-
thread[:start_event].
|
412
|
+
thread[:start_event]&.continue # sometimes start event might not even exist yet (i.e. race condition)
|
391
413
|
end
|
392
414
|
|
393
|
-
Thread.current[:branch_event].wait
|
415
|
+
Thread.current[:branch_event].wait unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
394
416
|
|
395
417
|
__weel_sim_stop(:parallel,hw,pos) if __weel_sim
|
396
418
|
|
@@ -410,7 +432,7 @@ end # }}}
|
|
410
432
|
end # }}}
|
411
433
|
|
412
434
|
# Defines a branch of a parallel-Construct
|
413
|
-
def parallel_branch(*vars)# {{{
|
435
|
+
def parallel_branch(*vars,&block)# {{{
|
414
436
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
415
437
|
branch_parent = Thread.current
|
416
438
|
|
@@ -436,14 +458,16 @@ end # }}}
|
|
436
458
|
Thread.current[:alternative_mode] = [branch_parent[:alternative_mode].last]
|
437
459
|
end
|
438
460
|
branch_parent[:branch_event].continue
|
439
|
-
Thread.current[:start_event].wait
|
461
|
+
Thread.current[:start_event].wait unless self.__weel_state == :stopping || self.__weel_state == :stopped || self.__weel_state == :finishing
|
440
462
|
|
441
463
|
if __weel_sim
|
442
464
|
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
|
443
465
|
handlerwrapper.simulate(:parallel_branch,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos)
|
444
466
|
end
|
445
467
|
|
446
|
-
|
468
|
+
unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
469
|
+
__weel_protect_yield(*local, &block)
|
470
|
+
end
|
447
471
|
|
448
472
|
__weel_sim_stop(:parallel_branch,handlerwrapper,current_branch_sim_pos) if __weel_sim
|
449
473
|
|
@@ -454,7 +478,7 @@ end # }}}
|
|
454
478
|
branch_parent[:branch_event].continue
|
455
479
|
end
|
456
480
|
end
|
457
|
-
|
481
|
+
unless self.__weel_state == :stopping || self.__weel_state == :stopped || self.__weel_state == :finishing
|
458
482
|
if Thread.current[:branch_position]
|
459
483
|
@__weel_positions.delete Thread.current[:branch_position]
|
460
484
|
begin
|
@@ -471,14 +495,14 @@ end # }}}
|
|
471
495
|
# Choose DSL-Construct
|
472
496
|
# Defines a choice in the Workflow path.
|
473
497
|
# May contain multiple execution alternatives
|
474
|
-
def choose(mode=:inclusive) # {{{
|
498
|
+
def choose(mode=:inclusive,&block) # {{{
|
475
499
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
476
500
|
Thread.current[:alternative_executed] ||= []
|
477
501
|
Thread.current[:alternative_mode] ||= []
|
478
502
|
Thread.current[:alternative_executed] << false
|
479
503
|
Thread.current[:alternative_mode] << mode
|
480
504
|
hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
481
|
-
__weel_protect_yield(&
|
505
|
+
__weel_protect_yield(&block)
|
482
506
|
__weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
483
507
|
Thread.current[:alternative_executed].pop
|
484
508
|
Thread.current[:alternative_mode].pop
|
@@ -488,7 +512,7 @@ end # }}}
|
|
488
512
|
# Defines a possible choice of a choose-Construct
|
489
513
|
# Block is executed if condition == true or
|
490
514
|
# searchmode is active (to find the starting position)
|
491
|
-
def alternative(condition,args={})# {{{
|
515
|
+
def alternative(condition,args={},&block)# {{{
|
492
516
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
493
517
|
hw, pos = __weel_sim_start(:alternative,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => ((condition.is_a?(String) || condition.is_a?(Proc)) ? condition : nil))) if __weel_sim
|
494
518
|
Thread.current[:mutex] ||= Mutex.new
|
@@ -499,18 +523,18 @@ end # }}}
|
|
499
523
|
end
|
500
524
|
Thread.current[:alternative_executed][-1] = true if condition
|
501
525
|
end
|
502
|
-
__weel_protect_yield(&
|
526
|
+
__weel_protect_yield(&block) if __weel_is_in_search_mode || __weel_sim || condition
|
503
527
|
__weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => ((condition.is_a?(String) || condition.is_a?(Proc)) ? condition : nil))) if __weel_sim
|
504
528
|
end # }}}
|
505
|
-
def otherwise(args={}) # {{{
|
529
|
+
def otherwise(args={},&block) # {{{
|
506
530
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
507
531
|
hw, pos = __weel_sim_start(:otherwise,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
|
508
|
-
__weel_protect_yield(&
|
532
|
+
__weel_protect_yield(&block) if __weel_is_in_search_mode || __weel_sim || !Thread.current[:alternative_executed].last
|
509
533
|
__weel_sim_stop(:otherwise,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
|
510
534
|
end # }}}
|
511
535
|
|
512
536
|
# Defines a critical block (=Mutex)
|
513
|
-
def critical(id)# {{{
|
537
|
+
def critical(id,&block)# {{{
|
514
538
|
@__weel_critical ||= Mutex.new
|
515
539
|
semaphore = nil
|
516
540
|
@__weel_critical.synchronize do
|
@@ -519,19 +543,19 @@ end # }}}
|
|
519
543
|
@__weel_critical_sections[id] = semaphore if id
|
520
544
|
end
|
521
545
|
semaphore.synchronize do
|
522
|
-
__weel_protect_yield(&
|
546
|
+
__weel_protect_yield(&block)
|
523
547
|
end
|
524
548
|
end # }}}
|
525
549
|
|
526
550
|
# Defines a Cycle (loop/iteration)
|
527
|
-
def loop(condition,args={})# {{{
|
551
|
+
def loop(condition,args={},&block)# {{{
|
528
552
|
unless condition.is_a?(Array) && (condition[0].is_a?(Proc) || condition[0].is_a?(String)) && [:pre_test,:post_test].include?(condition[1]) && args.is_a?(Hash)
|
529
553
|
raise "condition must be called pre_test{} or post_test{}"
|
530
554
|
end
|
531
555
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
532
556
|
if __weel_is_in_search_mode
|
533
557
|
catch :escape do
|
534
|
-
__weel_protect_yield(&
|
558
|
+
__weel_protect_yield(&block)
|
535
559
|
end
|
536
560
|
if __weel_is_in_search_mode
|
537
561
|
return
|
@@ -545,7 +569,7 @@ end # }}}
|
|
545
569
|
cond = condition[0].is_a?(Proc) ? true : condition[0]
|
546
570
|
hw, pos = __weel_sim_start(:loop,args.merge(:testing=>condition[1],:condition=>cond))
|
547
571
|
catch :escape do
|
548
|
-
__weel_protect_yield(&
|
572
|
+
__weel_protect_yield(&block)
|
549
573
|
end
|
550
574
|
__weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
|
551
575
|
return
|
@@ -554,11 +578,11 @@ end # }}}
|
|
554
578
|
case condition[1]
|
555
579
|
when :pre_test
|
556
580
|
while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
557
|
-
__weel_protect_yield(&
|
581
|
+
__weel_protect_yield(&block)
|
558
582
|
end
|
559
583
|
when :post_test
|
560
584
|
begin
|
561
|
-
__weel_protect_yield(&
|
585
|
+
__weel_protect_yield(&block)
|
562
586
|
end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
563
587
|
end
|
564
588
|
end
|
@@ -620,7 +644,7 @@ end # }}}
|
|
620
644
|
def __weel_eval_condition(condition) #{{{
|
621
645
|
begin
|
622
646
|
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args unless condition.is_a?(Proc)
|
623
|
-
condition.is_a?(Proc) ? condition.call : handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition)
|
647
|
+
condition.is_a?(Proc) ? condition.call : handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints,handlerwrapper.additional),condition)
|
624
648
|
rescue NameError => err # don't look into it, or it will explode
|
625
649
|
# if you access $! here, BOOOM
|
626
650
|
self.__weel_state = :stopping
|
@@ -689,10 +713,10 @@ end # }}}
|
|
689
713
|
handlerwrapper.activity_manipulate_handle(parameters)
|
690
714
|
handlerwrapper.inform_activity_manipulate
|
691
715
|
if finalize.is_a?(Proc)
|
692
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
|
716
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
693
717
|
mr.instance_eval(&finalize)
|
694
718
|
elsif finalize.is_a?(String)
|
695
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
|
719
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
696
720
|
handlerwrapper.manipulate(mr,finalize)
|
697
721
|
end
|
698
722
|
handlerwrapper.inform_manipulate_change(
|
@@ -709,10 +733,10 @@ end # }}}
|
|
709
733
|
when :call
|
710
734
|
begin
|
711
735
|
again = catch Signal::Again do
|
712
|
-
rs = ReadStructure.new(@__weel_data,@__weel_endpoints)
|
736
|
+
rs = ReadStructure.new(@__weel_data,@__weel_endpoints,handlerwrapper.additional)
|
713
737
|
if prepare
|
714
738
|
if prepare.is_a?(Proc)
|
715
|
-
rs.instance_exec
|
739
|
+
rs.instance_exec(&prepare)
|
716
740
|
elsif prepare.is_a?(String)
|
717
741
|
rs.instance_eval prepare
|
718
742
|
end
|
@@ -759,18 +783,18 @@ end # }}}
|
|
759
783
|
if code.is_a?(Proc) || code.is_a?(String)
|
760
784
|
handlerwrapper.inform_activity_manipulate
|
761
785
|
if code.is_a?(Proc)
|
762
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
786
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
787
|
+
ma = catch Signal::Again do
|
788
|
+
case code.arity
|
789
|
+
when 1; mr.instance_exec(handlerwrapper.activity_result_value,&code)
|
790
|
+
when 2; mr.instance_exec(handlerwrapper.activity_result_value,&code)
|
791
|
+
else
|
768
792
|
mr.instance_exec(&code)
|
769
|
-
|
770
|
-
|
793
|
+
end
|
794
|
+
'yes' # ma sadly will have nil when i just throw
|
771
795
|
end
|
772
796
|
elsif code.is_a?(String)
|
773
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
|
797
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
774
798
|
ma = catch Signal::Again do
|
775
799
|
handlerwrapper.manipulate(mr,code,handlerwrapper.activity_result_value,handlerwrapper.activity_result_options)
|
776
800
|
'yes' # ma sadly will have nil when i just throw
|
data/test/TestHandlerWrapper.rb
CHANGED
@@ -8,16 +8,24 @@ class TestHandlerWrapper < WEEL::HandlerWrapperBase
|
|
8
8
|
$short_track << "E"
|
9
9
|
raise(err)
|
10
10
|
end
|
11
|
+
def self::inform_handlerwrapper_error(arguments,err)
|
12
|
+
$long_track += "HW ERROR: #{err}\n"
|
13
|
+
$short_track << "E"
|
14
|
+
end
|
11
15
|
|
12
|
-
def initialize(args,
|
16
|
+
def initialize(args,position=nil,continue=nil)
|
13
17
|
@__myhandler_stopped = false
|
14
18
|
@__myhandler_position = position
|
15
19
|
@__myhandler_continue = continue
|
16
|
-
@__myhandler_endpoint = endpoint
|
17
20
|
@__myhandler_returnValue = nil
|
18
21
|
@t = nil
|
19
22
|
end
|
20
23
|
|
24
|
+
def prepare(readonly, endpoints, parameters, replay=false)
|
25
|
+
@__myhandler_endpoint = readonly.endpoints[endpoints]
|
26
|
+
parameters
|
27
|
+
end
|
28
|
+
|
21
29
|
# executes a ws-call to the given endpoint with the given parameters. the call
|
22
30
|
# can be executed asynchron, see finished_call & return_value
|
23
31
|
def activity_handle(passthrough, parameters) #{{{
|
@@ -68,7 +76,7 @@ class TestHandlerWrapper < WEEL::HandlerWrapperBase
|
|
68
76
|
# information about how to continue the call. This passthrough-value is given
|
69
77
|
# to activity_handle if the workflow is configured to do so.
|
70
78
|
def activity_passthrough_value #{{{
|
71
|
-
|
79
|
+
nil
|
72
80
|
end #}}}
|
73
81
|
|
74
82
|
# Called if the execution of the actual activity_handle is not necessary anymore
|
data/test/TestMixin.rb
CHANGED
@@ -14,14 +14,14 @@ module SimTestMixin #{{{
|
|
14
14
|
def wf_assert(what,cond=true)
|
15
15
|
if cond
|
16
16
|
assert($long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
17
|
-
else
|
17
|
+
else
|
18
18
|
assert(!$long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
def wf_sassert(what,cond=true)
|
22
22
|
if cond
|
23
23
|
assert($short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
24
|
-
else
|
24
|
+
else
|
25
25
|
assert(!$short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
26
26
|
end
|
27
27
|
end
|
@@ -30,7 +30,6 @@ module SimTestMixin #{{{
|
|
30
30
|
end
|
31
31
|
end #}}}
|
32
32
|
|
33
|
-
|
34
33
|
module TestMixin #{{{
|
35
34
|
def setup
|
36
35
|
$long_track = ""
|
@@ -47,14 +46,14 @@ module TestMixin #{{{
|
|
47
46
|
def wf_assert(what,cond=true)
|
48
47
|
if cond
|
49
48
|
assert($long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
50
|
-
else
|
49
|
+
else
|
51
50
|
assert(!$long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
52
51
|
end
|
53
52
|
end
|
54
53
|
def wf_sassert(what,cond=true)
|
55
54
|
if cond
|
56
55
|
assert($short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
57
|
-
else
|
56
|
+
else
|
58
57
|
assert(!$short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
59
58
|
end
|
60
59
|
end
|
data/test/TestWorkflow.rb
CHANGED
@@ -9,12 +9,12 @@ class TestWorkflow < WEEL
|
|
9
9
|
endpoint :stop => 'stop it'
|
10
10
|
endpoint :again => 'again'
|
11
11
|
data :x => 'begin_'
|
12
|
-
|
12
|
+
|
13
13
|
control flow do
|
14
14
|
call :a1_1, :endpoint1 do |result|
|
15
15
|
data.x += "#{result}"
|
16
16
|
end
|
17
|
-
parallel :wait
|
17
|
+
parallel :wait do
|
18
18
|
parallel_branch do
|
19
19
|
call :a2_1_1, :endpoint1
|
20
20
|
end
|
data/test/basic/tc_choose.rb
CHANGED
@@ -24,59 +24,59 @@ class TestChoose < Test::Unit::TestCase
|
|
24
24
|
wf_assert("CALL a_3:",false)
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_choose_otherwise
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
27
|
+
# def test_choose_otherwise
|
28
|
+
# @wf.description do
|
29
|
+
# choose do
|
30
|
+
# alternative false do
|
31
|
+
# call :a_1, :endpoint1
|
32
|
+
# end
|
33
|
+
# otherwise do
|
34
|
+
# call :a_2, :endpoint1
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# @wf.start.join
|
39
|
+
# wf_assert("CALL a_2: passthrough=[], endpoint=[http://www.heise.de], parameters=[{}]")
|
40
|
+
# wf_assert("CALL a_1:",false)
|
41
|
+
# end
|
42
42
|
|
43
|
-
def test_choose_nested
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
43
|
+
# def test_choose_nested
|
44
|
+
# @wf.description do
|
45
|
+
# choose do
|
46
|
+
# alternative true do
|
47
|
+
# choose do
|
48
|
+
# alternative false do
|
49
|
+
# call :a_1_1, :endpoint1
|
50
|
+
# end
|
51
|
+
# alternative true do
|
52
|
+
# choose do
|
53
|
+
# alternative false do
|
54
|
+
# call :a_1_1_1, :endpoint1
|
55
|
+
# end
|
56
|
+
# otherwise do
|
57
|
+
# call :a_1_1_2, :endpoint1
|
58
|
+
# end
|
59
|
+
# end
|
60
|
+
# end
|
61
|
+
# otherwise do
|
62
|
+
# call :a_1_3, :endpoint1
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
# otherwise do
|
67
|
+
# call :a_2, :endpoint1
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
# @wf.start.join
|
72
|
+
# wf_assert("CALL a_1_1_2: passthrough=[], endpoint=[http://www.heise.de], parameters=[{}]",true)
|
73
|
+
# wf_assert("CALL a_1_1:",false)
|
74
|
+
# wf_assert("CALL a_1_1_1:",false)
|
75
|
+
# wf_assert("CALL a_1_3:",false)
|
76
|
+
# wf_assert("CALL a_2:",false)
|
77
|
+
# end
|
78
78
|
|
79
|
-
def test_choose_searchmode
|
80
|
-
|
81
|
-
end
|
79
|
+
# def test_choose_searchmode
|
80
|
+
|
81
|
+
# end
|
82
82
|
end
|
data/test/basic/tc_state.rb
CHANGED
@@ -4,11 +4,11 @@ require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
|
|
4
4
|
class TestState < Test::Unit::TestCase
|
5
5
|
include TestMixin
|
6
6
|
|
7
|
-
def test_check_state
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
7
|
+
# def test_check_state
|
8
|
+
# s = @wf.state
|
9
|
+
# assert(s.is_a?(Symbol), "state is not a symbol")
|
10
|
+
# assert(s == :ready, "state is not set to :ready, it is #{s}")
|
11
|
+
# end
|
12
12
|
|
13
13
|
def test_check_stop_state
|
14
14
|
@wf.start
|
data/test/basic/tc_wf_control.rb
CHANGED
@@ -18,51 +18,51 @@ class TestWorkflowControl < Test::Unit::TestCase
|
|
18
18
|
assert(@wf.data[:x] == "begin_Handler_Dummy_Result_end", "Ending environment not correct, see result=#{@wf.data[:x].inspect}")
|
19
19
|
end
|
20
20
|
|
21
|
-
def test_stop
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
def test_continue
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
21
|
+
# def test_stop
|
22
|
+
# @wf.description do
|
23
|
+
# call :a_test_1_1, :endpoint1
|
24
|
+
# call :a_test_1_2, :endpoint1, parameters: { :call => Proc.new{ sleep 0.5 } }
|
25
|
+
# call :a_test_1_3, :endpoint1
|
26
|
+
# end
|
27
|
+
# @wf.search WEEL::Position.new(:a_test_1_1, :at)
|
28
|
+
# wf = @wf.start
|
29
|
+
# sleep(0.2)
|
30
|
+
# @wf.stop.join
|
31
|
+
# wf.join
|
32
|
+
# wf_assert("DONE a_test_1_1")
|
33
|
+
# wf_assert("STOPPED a_test_1_2")
|
34
|
+
# wf_assert("DONE a_test_1_2",false)
|
35
|
+
# wf_assert("CALL a_test_1_2:")
|
36
|
+
# assert(@wf.state == :stopped, "Stopped workflow has wrong state, #{@wf.state} instead of :stopped")
|
37
|
+
# assert(@wf.positions.is_a?(Array), "@wf.positions has wrong type, should be an array, it is: #{@wf.positions.inspect}")
|
38
|
+
# assert(@wf.positions[0].position == :a_test_1_2, "Stop-position has wrong value: #{@wf.positions[0].position} instead of :a_test_2_1")
|
39
|
+
# assert(@wf.positions[0].detail == :at, "Stop-Position is not :at")
|
40
|
+
# end
|
41
|
+
# def test_continue
|
42
|
+
# @wf.description do
|
43
|
+
# call :a_test_1_1, :endpoint1
|
44
|
+
# call :a_test_1_2, :endpoint1, parameters: { :call => Proc.new{ sleep 0.5 } }
|
45
|
+
# call :a_test_1_3, :endpoint1
|
46
|
+
# end
|
47
|
+
# @wf.start
|
48
|
+
# sleep(0.2)
|
49
|
+
# @wf.stop.join
|
50
50
|
|
51
|
-
|
51
|
+
# @wf.search @wf.positions
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_continue_after
|
58
|
-
@wf.description do
|
59
|
-
call :c_test_1_1, :endpoint1
|
60
|
-
call :c_test_1_2, :endpoint1
|
61
|
-
call :c_test_1_3, :endpoint1
|
62
|
-
end
|
63
|
-
@wf.search [WEEL::Position.new(:c_test_1_1, :after)]
|
64
|
-
@wf.start.join
|
53
|
+
# @wf.start.join
|
54
|
+
# wf_sassert('|running|Ca_test_1_1Da_test_1_1Ca_test_1_2|stopping|Sa_test_1_2|stopped||running|Ca_test_1_2Da_test_1_2Ca_test_1_3Da_test_1_3|finished|')
|
55
|
+
# end
|
65
56
|
|
66
|
-
|
67
|
-
|
57
|
+
# def test_continue_after
|
58
|
+
# @wf.description do
|
59
|
+
# call :c_test_1_1, :endpoint1
|
60
|
+
# call :c_test_1_2, :endpoint1
|
61
|
+
# call :c_test_1_3, :endpoint1
|
62
|
+
# end
|
63
|
+
# @wf.search [WEEL::Position.new(:c_test_1_1, :after)]
|
64
|
+
# @wf.start.join
|
65
|
+
|
66
|
+
# wf_sassert('|running|Cc_test_1_2Dc_test_1_2Cc_test_1_3Dc_test_1_3|finished|')
|
67
|
+
# end
|
68
68
|
end
|
@@ -6,7 +6,7 @@ class TestAdventureSearch < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
def test_search_adventure
|
8
8
|
@wf.data[:oee] = 0.25
|
9
|
-
@wf.description = File.read(
|
9
|
+
@wf.description = File.read(__dir__ + '/dsl1')
|
10
10
|
@wf.search [WEEL::Position.new(:a2, :at), WEEL::Position.new(:a13, :at)]
|
11
11
|
@wf.start.join
|
12
12
|
|
data/test/test
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
ruby basic/tc_choose.rb
|
2
|
+
ruby basic/tc_codereplace.rb
|
3
|
+
ruby basic/tc_data.rb
|
4
|
+
ruby basic/tc_endpoint.rb
|
5
|
+
ruby basic/tc_handler.rb
|
6
|
+
ruby basic/tc_parallel.rb
|
7
|
+
ruby basic/tc_search.rb
|
8
|
+
ruby basic/tc_state.rb
|
9
|
+
ruby basic/tc_wf_control.rb
|
10
|
+
ruby complexsearch/tc_search.rb
|
11
|
+
ruby complex/tc_generalsynchonizingmerge_loopsearch.rb
|
12
|
+
ruby complex/tc_parallel_stop.rb
|
13
|
+
ruby exec/tc_again.rb
|
14
|
+
ruby exec/tc_exec.rb
|
15
|
+
ruby simulation/dl.rb
|
16
|
+
ruby simulation/tt_permutationtester.rb
|
17
|
+
ruby simulation/tt_sim_activity.rb
|
18
|
+
ruby simulation/tt_sim_choose1.rb
|
19
|
+
ruby simulation/tt_sim_choose2.rb
|
20
|
+
ruby simulation/tt_sim_loop_parallel_choose.rb
|
21
|
+
ruby simulation/tt_sim_loop_parallel.rb
|
22
|
+
ruby simulation/tt_sim_loop.rb
|
23
|
+
ruby speed/tc_speed1.rb
|
24
|
+
ruby speed/tc_speed2.rb
|
25
|
+
ruby wfp_adv_branching/tc_generalizedjoin.rb
|
26
|
+
ruby wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
27
|
+
ruby wfp_adv_branching/tc_localsynchronizingmerge.rb
|
28
|
+
ruby wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
29
|
+
ruby wfp_adv_branching/tc_multimerge.rb
|
30
|
+
ruby wfp_adv_branching/tc_structured_discriminator.rb
|
31
|
+
ruby wfp_adv_branching/tc_structured_partial_join.rb
|
32
|
+
ruby wfp_adv_branching/tc_threadmerge.rb
|
33
|
+
ruby wfp_adv_branching/tc_threadsplit.rb
|
34
|
+
ruby wfp_basic/tc_exclusivechoice_simplemerge.rb
|
35
|
+
ruby wfp_basic/tc_parallelsplit_synchronization.rb
|
36
|
+
ruby wfp_basic/tc_sequence.rb
|
37
|
+
ruby wfp_iteration/tc_structuredloop.rb
|
38
|
+
ruby wfp_state_based/tc_deferredchoice.rb
|
39
|
+
ruby wfp_state_based/tc_interleavedparallelrouting.rb
|
data/weel.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "weel"
|
3
|
-
s.version = "1.99.
|
3
|
+
s.version = "1.99.83"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.license = "LGPL-3.0"
|
6
|
-
s.summary = "
|
6
|
+
s.summary = "Workflow Execution Engine Library (WEEL)"
|
7
7
|
|
8
8
|
s.description = "see http://cpee.org"
|
9
9
|
|
10
|
-
s.required_ruby_version = '>=2.
|
10
|
+
s.required_ruby_version = '>=2.6.0'
|
11
11
|
|
12
|
-
s.files = Dir['{example/**/*,lib/weel.rb}'] + %w(COPYING Changelog FEATURES INSTALL Rakefile weel.gemspec README AUTHORS)
|
12
|
+
s.files = Dir['{example/**/*,lib/weel.rb}'] + %w(COPYING Changelog FEATURES INSTALL Rakefile weel.gemspec README.md AUTHORS)
|
13
13
|
s.require_path = 'lib'
|
14
|
-
s.extra_rdoc_files = ['README']
|
14
|
+
s.extra_rdoc_files = ['README.md']
|
15
15
|
s.test_files = Dir['{test/*,test/*/tc_*.rb}']
|
16
16
|
|
17
17
|
s.authors = ['Juergen eTM Mangler','Gerhard Stuermer']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.99.
|
4
|
+
version: 1.99.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -30,14 +30,14 @@ email: juergen.mangler@gmail.com
|
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files:
|
33
|
-
- README
|
33
|
+
- README.md
|
34
34
|
files:
|
35
35
|
- AUTHORS
|
36
36
|
- COPYING
|
37
37
|
- Changelog
|
38
38
|
- FEATURES
|
39
39
|
- INSTALL
|
40
|
-
- README
|
40
|
+
- README.md
|
41
41
|
- Rakefile
|
42
42
|
- example/SimpleHandlerWrapper.rb
|
43
43
|
- example/SimpleWorkflow.rb
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- test/exec/tc_exec.rb
|
66
66
|
- test/speed/tc_speed1.rb
|
67
67
|
- test/speed/tc_speed2.rb
|
68
|
+
- test/test
|
68
69
|
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
69
70
|
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
70
71
|
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
@@ -93,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
94
|
requirements:
|
94
95
|
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
97
|
+
version: 2.6.0
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
100
|
- - ">="
|
@@ -103,9 +104,10 @@ requirements: []
|
|
103
104
|
rubygems_version: 3.1.2
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
|
-
summary:
|
107
|
+
summary: Workflow Execution Engine Library (WEEL)
|
107
108
|
test_files:
|
108
109
|
- test/TestHandlerWrapper.rb
|
110
|
+
- test/test
|
109
111
|
- test/ContinueTest.rb
|
110
112
|
- test/TestWorkflow.rb
|
111
113
|
- test/TestMixin.rb
|
data/README
DELETED