weel 1.99.77 → 1.99.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +35 -0
- data/example/SimpleHandlerWrapper.rb +15 -6
- data/example/SimpleWorkflow.rb +5 -5
- data/example/runme.rb +3 -3
- data/lib/weel.rb +163 -143
- 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 +9 -7
- 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
|
+
```
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# This file is part of WEEL.
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# WEEL is free software: you can redistribute it and/or modify it under the terms
|
4
4
|
# of the GNU General Public License as published by the Free Software Foundation,
|
5
5
|
# either version 3 of the License, or (at your option) any later version.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# WEEL is distributed in the hope that it will be useful, but WITHOUT ANY
|
8
8
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
9
9
|
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# You should have received a copy of the GNU General Public License along with
|
12
12
|
# WEEL (file COPYING in the main directory). If not, see
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
@@ -15,14 +15,23 @@
|
|
15
15
|
require "pp"
|
16
16
|
|
17
17
|
class SimpleHandlerWrapper < WEEL::HandlerWrapperBase
|
18
|
-
def
|
18
|
+
def self::inform_state_change(arguments,newstate); puts "#{newstate}: #{arguments}"; end
|
19
|
+
def self::inform_syntax_error(arguments,err,code); puts "Syntax error: #{err}"; end
|
20
|
+
def self::inform_handlerwrapper_error(arguments,err); puts "Handlerwrapper error: #{err}"; end
|
21
|
+
|
22
|
+
def initialize(args,position=nil,continue=nil)
|
19
23
|
@__myhandler_stopped = false
|
20
24
|
@__myhandler_position = position
|
21
25
|
@__myhandler_continue = continue
|
22
|
-
@__myhandler_endpoint =
|
26
|
+
@__myhandler_endpoint = nil
|
23
27
|
@__myhandler_returnValue = nil
|
24
28
|
end
|
25
29
|
|
30
|
+
def prepare(readonly, endpoints, parameters, replay=false)
|
31
|
+
@__myhandler_endpoints = endpoints
|
32
|
+
parameters
|
33
|
+
end
|
34
|
+
|
26
35
|
# executes a ws-call to the given endpoint with the given parameters. the call
|
27
36
|
# can be executed asynchron, see finished_call & return_value
|
28
37
|
def activity_handle(passthrough, parameters)
|
@@ -35,7 +44,7 @@ class SimpleHandlerWrapper < WEEL::HandlerWrapperBase
|
|
35
44
|
@__myhandler_returnValue = 'Handler_Dummy_Result'
|
36
45
|
@__myhandler_continue.continue
|
37
46
|
end
|
38
|
-
|
47
|
+
|
39
48
|
# returns the result of the last handled call
|
40
49
|
def activity_result_value
|
41
50
|
@__myhandler_returnValue
|
data/example/SimpleWorkflow.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# This file is part of WEEL.
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# WEEL is free software: you can redistribute it and/or modify it under the terms
|
4
4
|
# of the GNU General Public License as published by the Free Software Foundation,
|
5
5
|
# either version 3 of the License, or (at your option) any later version.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# WEEL is distributed in the hope that it will be useful, but WITHOUT ANY
|
8
8
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
9
9
|
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# You should have received a copy of the GNU General Public License along with
|
12
12
|
# WEEL (file COPYING in the main directory). If not, see
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
@@ -17,12 +17,12 @@ require ::File.dirname(__FILE__) + '/SimpleHandlerWrapper'
|
|
17
17
|
|
18
18
|
class SimpleWorkflow < WEEL
|
19
19
|
handlerwrapper SimpleHandlerWrapper
|
20
|
-
|
20
|
+
|
21
21
|
endpoint :ep1 => "orf.at"
|
22
22
|
data :a => 17
|
23
23
|
|
24
24
|
control flow do
|
25
|
-
|
25
|
+
call :a1, :ep1, parameters: { :a => data.a, :b => 2 } do
|
26
26
|
data.a += 3
|
27
27
|
end
|
28
28
|
end
|
data/example/runme.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# This file is part of WEEL.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# WEEL is free software: you can redistribute it and/or modify it under the terms
|
5
5
|
# of the GNU General Public License as published by the Free Software Foundation,
|
6
6
|
# either version 3 of the License, or (at your option) any later version.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# WEEL is distributed in the hope that it will be useful, but WITHOUT ANY
|
9
9
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
10
10
|
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# You should have received a copy of the GNU General Public License along with
|
13
13
|
# WEEL (file COPYING in the main directory). If not, see
|
14
14
|
# <http://www.gnu.org/licenses/>.
|
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
|
-
def prepare(readonly, endpoints, parameters); parameters; end
|
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
|
@@ -243,7 +265,7 @@ end # }}}
|
|
243
265
|
def callback(result=nil,options={}); end
|
244
266
|
|
245
267
|
def test_condition(mr,code); mr.instance_eval(code); end
|
246
|
-
def manipulate(mr,code,result=nil); mr.instance_eval(code); end
|
268
|
+
def manipulate(mr,code,result=nil,options=nil); mr.instance_eval(code); end
|
247
269
|
end # }}}
|
248
270
|
|
249
271
|
class Position # {{{
|
@@ -288,7 +310,7 @@ end # }}}
|
|
288
310
|
end
|
289
311
|
end #}}}
|
290
312
|
|
291
|
-
def self::search(weel_search)# {{{
|
313
|
+
def self::search(*weel_search)# {{{
|
292
314
|
define_method :initialize_search do
|
293
315
|
self.search weel_search
|
294
316
|
end
|
@@ -338,9 +360,10 @@ end # }}}
|
|
338
360
|
@__weel_handlerwrapper_args = []
|
339
361
|
@__weel_state = :ready
|
340
362
|
@__weel_status = Status.new(0,"undefined")
|
363
|
+
@__weel_replay = false
|
341
364
|
@__weel_sim = -1
|
342
365
|
end #}}}
|
343
|
-
attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_handlerwrapper, :__weel_handlerwrapper_args
|
366
|
+
attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_handlerwrapper, :__weel_handlerwrapper_args, :__weel_replay
|
344
367
|
attr_reader :__weel_state, :__weel_status
|
345
368
|
|
346
369
|
# DSL-Constructs for atomic calls to external services (calls) and pure context manipulations (manipulate).
|
@@ -363,8 +386,8 @@ end # }}}
|
|
363
386
|
# Parallel DSL-Construct
|
364
387
|
# Defines Workflow paths that can be executed parallel.
|
365
388
|
# May contain multiple branches (parallel_branch)
|
366
|
-
def parallel(type=nil)# {{{
|
367
|
-
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
|
368
391
|
|
369
392
|
Thread.current[:branches] = []
|
370
393
|
Thread.current[:branch_finished_count] = 0
|
@@ -373,7 +396,7 @@ end # }}}
|
|
373
396
|
|
374
397
|
hw, pos = __weel_sim_start(:parallel) if __weel_sim
|
375
398
|
|
376
|
-
__weel_protect_yield(&
|
399
|
+
__weel_protect_yield(&block)
|
377
400
|
|
378
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)
|
379
402
|
1.upto Thread.current[:branches].size do
|
@@ -386,10 +409,10 @@ end # }}}
|
|
386
409
|
if Thread.current[:branch_search] == false
|
387
410
|
thread[:branch_search] = false
|
388
411
|
end
|
389
|
-
thread[:start_event].
|
412
|
+
thread[:start_event]&.continue # sometimes start event might not even exist yet (i.e. race condition)
|
390
413
|
end
|
391
414
|
|
392
|
-
Thread.current[:branch_event].wait
|
415
|
+
Thread.current[:branch_event].wait unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
393
416
|
|
394
417
|
__weel_sim_stop(:parallel,hw,pos) if __weel_sim
|
395
418
|
|
@@ -409,7 +432,7 @@ end # }}}
|
|
409
432
|
end # }}}
|
410
433
|
|
411
434
|
# Defines a branch of a parallel-Construct
|
412
|
-
def parallel_branch(*vars)# {{{
|
435
|
+
def parallel_branch(*vars,&block)# {{{
|
413
436
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
414
437
|
branch_parent = Thread.current
|
415
438
|
|
@@ -435,14 +458,16 @@ end # }}}
|
|
435
458
|
Thread.current[:alternative_mode] = [branch_parent[:alternative_mode].last]
|
436
459
|
end
|
437
460
|
branch_parent[:branch_event].continue
|
438
|
-
Thread.current[:start_event].wait
|
461
|
+
Thread.current[:start_event].wait unless self.__weel_state == :stopping || self.__weel_state == :stopped || self.__weel_state == :finishing
|
439
462
|
|
440
463
|
if __weel_sim
|
441
464
|
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
|
442
465
|
handlerwrapper.simulate(:parallel_branch,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos)
|
443
466
|
end
|
444
467
|
|
445
|
-
|
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
|
446
471
|
|
447
472
|
__weel_sim_stop(:parallel_branch,handlerwrapper,current_branch_sim_pos) if __weel_sim
|
448
473
|
|
@@ -453,7 +478,7 @@ end # }}}
|
|
453
478
|
branch_parent[:branch_event].continue
|
454
479
|
end
|
455
480
|
end
|
456
|
-
|
481
|
+
unless self.__weel_state == :stopping || self.__weel_state == :stopped || self.__weel_state == :finishing
|
457
482
|
if Thread.current[:branch_position]
|
458
483
|
@__weel_positions.delete Thread.current[:branch_position]
|
459
484
|
begin
|
@@ -470,14 +495,14 @@ end # }}}
|
|
470
495
|
# Choose DSL-Construct
|
471
496
|
# Defines a choice in the Workflow path.
|
472
497
|
# May contain multiple execution alternatives
|
473
|
-
def choose(mode=:inclusive) # {{{
|
498
|
+
def choose(mode=:inclusive,&block) # {{{
|
474
499
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
475
500
|
Thread.current[:alternative_executed] ||= []
|
476
501
|
Thread.current[:alternative_mode] ||= []
|
477
502
|
Thread.current[:alternative_executed] << false
|
478
503
|
Thread.current[:alternative_mode] << mode
|
479
504
|
hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
480
|
-
__weel_protect_yield(&
|
505
|
+
__weel_protect_yield(&block)
|
481
506
|
__weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
482
507
|
Thread.current[:alternative_executed].pop
|
483
508
|
Thread.current[:alternative_mode].pop
|
@@ -487,7 +512,7 @@ end # }}}
|
|
487
512
|
# Defines a possible choice of a choose-Construct
|
488
513
|
# Block is executed if condition == true or
|
489
514
|
# searchmode is active (to find the starting position)
|
490
|
-
def alternative(condition,args={})# {{{
|
515
|
+
def alternative(condition,args={},&block)# {{{
|
491
516
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
492
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
|
493
518
|
Thread.current[:mutex] ||= Mutex.new
|
@@ -498,18 +523,18 @@ end # }}}
|
|
498
523
|
end
|
499
524
|
Thread.current[:alternative_executed][-1] = true if condition
|
500
525
|
end
|
501
|
-
__weel_protect_yield(&
|
526
|
+
__weel_protect_yield(&block) if __weel_is_in_search_mode || __weel_sim || condition
|
502
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
|
503
528
|
end # }}}
|
504
|
-
def otherwise(args={}) # {{{
|
529
|
+
def otherwise(args={},&block) # {{{
|
505
530
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
506
531
|
hw, pos = __weel_sim_start(:otherwise,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
|
507
|
-
__weel_protect_yield(&
|
532
|
+
__weel_protect_yield(&block) if __weel_is_in_search_mode || __weel_sim || !Thread.current[:alternative_executed].last
|
508
533
|
__weel_sim_stop(:otherwise,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
|
509
534
|
end # }}}
|
510
535
|
|
511
536
|
# Defines a critical block (=Mutex)
|
512
|
-
def critical(id)# {{{
|
537
|
+
def critical(id,&block)# {{{
|
513
538
|
@__weel_critical ||= Mutex.new
|
514
539
|
semaphore = nil
|
515
540
|
@__weel_critical.synchronize do
|
@@ -518,19 +543,19 @@ end # }}}
|
|
518
543
|
@__weel_critical_sections[id] = semaphore if id
|
519
544
|
end
|
520
545
|
semaphore.synchronize do
|
521
|
-
__weel_protect_yield(&
|
546
|
+
__weel_protect_yield(&block)
|
522
547
|
end
|
523
548
|
end # }}}
|
524
549
|
|
525
550
|
# Defines a Cycle (loop/iteration)
|
526
|
-
def loop(condition,args={})# {{{
|
551
|
+
def loop(condition,args={},&block)# {{{
|
527
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)
|
528
553
|
raise "condition must be called pre_test{} or post_test{}"
|
529
554
|
end
|
530
555
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
531
556
|
if __weel_is_in_search_mode
|
532
557
|
catch :escape do
|
533
|
-
__weel_protect_yield(&
|
558
|
+
__weel_protect_yield(&block)
|
534
559
|
end
|
535
560
|
if __weel_is_in_search_mode
|
536
561
|
return
|
@@ -544,7 +569,7 @@ end # }}}
|
|
544
569
|
cond = condition[0].is_a?(Proc) ? true : condition[0]
|
545
570
|
hw, pos = __weel_sim_start(:loop,args.merge(:testing=>condition[1],:condition=>cond))
|
546
571
|
catch :escape do
|
547
|
-
__weel_protect_yield(&
|
572
|
+
__weel_protect_yield(&block)
|
548
573
|
end
|
549
574
|
__weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
|
550
575
|
return
|
@@ -553,11 +578,11 @@ end # }}}
|
|
553
578
|
case condition[1]
|
554
579
|
when :pre_test
|
555
580
|
while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
556
|
-
__weel_protect_yield(&
|
581
|
+
__weel_protect_yield(&block)
|
557
582
|
end
|
558
583
|
when :post_test
|
559
584
|
begin
|
560
|
-
__weel_protect_yield(&
|
585
|
+
__weel_protect_yield(&block)
|
561
586
|
end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
562
587
|
end
|
563
588
|
end
|
@@ -619,7 +644,7 @@ end # }}}
|
|
619
644
|
def __weel_eval_condition(condition) #{{{
|
620
645
|
begin
|
621
646
|
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args unless condition.is_a?(Proc)
|
622
|
-
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)
|
623
648
|
rescue NameError => err # don't look into it, or it will explode
|
624
649
|
# if you access $! here, BOOOM
|
625
650
|
self.__weel_state = :stopping
|
@@ -688,10 +713,10 @@ end # }}}
|
|
688
713
|
handlerwrapper.activity_manipulate_handle(parameters)
|
689
714
|
handlerwrapper.inform_activity_manipulate
|
690
715
|
if finalize.is_a?(Proc)
|
691
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
|
716
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
692
717
|
mr.instance_eval(&finalize)
|
693
718
|
elsif finalize.is_a?(String)
|
694
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
|
719
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
695
720
|
handlerwrapper.manipulate(mr,finalize)
|
696
721
|
end
|
697
722
|
handlerwrapper.inform_manipulate_change(
|
@@ -706,104 +731,93 @@ end # }}}
|
|
706
731
|
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :after => [wp]
|
707
732
|
end
|
708
733
|
when :call
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
if
|
714
|
-
|
715
|
-
|
716
|
-
|
734
|
+
begin
|
735
|
+
again = catch Signal::Again do
|
736
|
+
rs = ReadStructure.new(@__weel_data,@__weel_endpoints,handlerwrapper.additional)
|
737
|
+
if prepare
|
738
|
+
if prepare.is_a?(Proc)
|
739
|
+
rs.instance_exec(&prepare)
|
740
|
+
elsif prepare.is_a?(String)
|
741
|
+
rs.instance_eval prepare
|
717
742
|
end
|
718
743
|
end
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
744
|
+
params = handlerwrapper.prepare(rs,endpoint,parameters,@__weel_replay)
|
745
|
+
raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
|
746
|
+
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
747
|
+
|
748
|
+
if @__weel_search_positions[position]
|
749
|
+
passthrough = @__weel_search_positions[position].passthrough
|
750
|
+
@__weel_search_positions[position].passthrough = nil
|
751
|
+
else
|
752
|
+
passthrough = nil
|
726
753
|
end
|
727
|
-
|
728
|
-
raise("invalid parameters")
|
729
|
-
end
|
730
|
-
rs = ReadStructure.new(@__weel_data,@__weel_endpoints)
|
731
|
-
if prepare
|
732
|
-
if prepare.is_a?(Proc)
|
733
|
-
rs.instance_exec &prepare
|
734
|
-
elsif prepare.is_a?(String)
|
735
|
-
rs.instance_eval prepare
|
736
|
-
end
|
737
|
-
end
|
738
|
-
params = handlerwrapper.prepare(rs,endpoint,params)
|
739
|
-
raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
|
740
|
-
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
741
|
-
|
742
|
-
if @__weel_search_positions[position]
|
743
|
-
passthrough = @__weel_search_positions[position].passthrough
|
744
|
-
@__weel_search_positions[position].passthrough = nil
|
745
|
-
else
|
746
|
-
passthrough = nil
|
747
|
-
end
|
748
|
-
|
749
|
-
handlerwrapper.activity_handle passthrough, params
|
750
|
-
wp.passthrough = handlerwrapper.activity_passthrough_value
|
751
|
-
unless wp.passthrough.nil?
|
752
|
-
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :wait => [wp]
|
753
|
-
end
|
754
|
-
begin
|
755
|
-
# with loop if catching Signal::Again
|
756
|
-
# handshake call and wait until it finished
|
757
|
-
waitingresult = nil
|
758
|
-
waitingresult = Thread.current[:continue].wait unless Thread.current[:nolongernecessary] || self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
759
|
-
raise waitingresult[1] if !waitingresult.nil? && waitingresult.is_a?(Array) && waitingresult.length == 2 && waitingresult[0] == WEEL::Signal::Error
|
760
|
-
|
761
|
-
if Thread.current[:nolongernecessary]
|
762
|
-
handlerwrapper.activity_no_longer_necessary
|
763
|
-
raise Signal::NoLongerNecessary
|
764
|
-
end
|
765
|
-
if self.__weel_state == :stopping || self.__weel_state == :finishing
|
766
|
-
handlerwrapper.activity_stop
|
754
|
+
handlerwrapper.activity_handle passthrough, params
|
767
755
|
wp.passthrough = handlerwrapper.activity_passthrough_value
|
768
|
-
|
769
|
-
|
756
|
+
unless wp.passthrough.nil?
|
757
|
+
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :wait => [wp]
|
758
|
+
end
|
759
|
+
begin
|
760
|
+
# with loop if catching Signal::Again
|
761
|
+
# handshake call and wait until it finished
|
762
|
+
waitingresult = nil
|
763
|
+
waitingresult = Thread.current[:continue].wait unless Thread.current[:nolongernecessary] || self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
764
|
+
raise waitingresult[1] if !waitingresult.nil? && waitingresult.is_a?(Array) && waitingresult.length == 2 && waitingresult[0] == WEEL::Signal::Error
|
765
|
+
|
766
|
+
if Thread.current[:nolongernecessary]
|
767
|
+
handlerwrapper.activity_no_longer_necessary
|
768
|
+
raise Signal::NoLongerNecessary
|
769
|
+
end
|
770
|
+
if self.__weel_state == :stopping || self.__weel_state == :finishing
|
771
|
+
handlerwrapper.activity_stop
|
772
|
+
wp.passthrough = handlerwrapper.activity_passthrough_value
|
773
|
+
raise Signal::Proceed
|
774
|
+
end
|
770
775
|
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
776
|
+
code = if waitingresult == WEEL::Signal::Again
|
777
|
+
update
|
778
|
+
elsif waitingresult == WEEL::Signal::Salvage
|
779
|
+
salvage || raise('HTTP Error. The service return status was not between 200 and 300.')
|
780
|
+
else
|
781
|
+
finalize
|
782
|
+
end
|
783
|
+
if code.is_a?(Proc) || code.is_a?(String)
|
784
|
+
handlerwrapper.inform_activity_manipulate
|
785
|
+
if code.is_a?(Proc)
|
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
|
792
|
+
mr.instance_exec(&code)
|
793
|
+
end
|
794
|
+
'yes' # ma sadly will have nil when i just throw
|
795
|
+
end
|
796
|
+
elsif code.is_a?(String)
|
797
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,handlerwrapper.additional)
|
798
|
+
ma = catch Signal::Again do
|
799
|
+
handlerwrapper.manipulate(mr,code,handlerwrapper.activity_result_value,handlerwrapper.activity_result_options)
|
800
|
+
'yes' # ma sadly will have nil when i just throw
|
801
|
+
end
|
802
|
+
end
|
803
|
+
handlerwrapper.inform_manipulate_change(
|
804
|
+
(mr.changed_status ? @__weel_status : nil),
|
805
|
+
(mr.changed_data.any? ? mr.changed_data.uniq : nil),
|
806
|
+
(mr.changed_endpoints.any? ? mr.changed_endpoints.uniq : nil),
|
807
|
+
@__weel_data,
|
808
|
+
@__weel_endpoints
|
809
|
+
)
|
810
|
+
throw(Signal::Again, Signal::Again) if ma.nil?
|
787
811
|
end
|
788
|
-
|
789
|
-
|
790
|
-
handlerwrapper.
|
812
|
+
end while waitingresult == Signal::Again
|
813
|
+
if handlerwrapper.activity_passthrough_value.nil?
|
814
|
+
handlerwrapper.inform_activity_done
|
815
|
+
wp.passthrough = nil
|
816
|
+
wp.detail = :after
|
817
|
+
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :after => [wp]
|
791
818
|
end
|
792
|
-
handlerwrapper.inform_manipulate_change(
|
793
|
-
(mr.changed_status ? @__weel_status : nil),
|
794
|
-
(mr.changed_data.any? ? mr.changed_data.uniq : nil),
|
795
|
-
(mr.changed_endpoints.any? ? mr.changed_endpoints.uniq : nil),
|
796
|
-
@__weel_data,
|
797
|
-
@__weel_endpoints
|
798
|
-
)
|
799
819
|
end
|
800
|
-
end while
|
801
|
-
if handlerwrapper.activity_passthrough_value.nil?
|
802
|
-
handlerwrapper.inform_activity_done
|
803
|
-
wp.passthrough = nil
|
804
|
-
wp.detail = :after
|
805
|
-
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :after => [wp]
|
806
|
-
end
|
820
|
+
end while again == Signal::Again
|
807
821
|
end
|
808
822
|
raise Signal::Proceed
|
809
823
|
rescue Signal::SkipManipulate, Signal::Proceed
|
@@ -824,7 +838,7 @@ end # }}}
|
|
824
838
|
handlerwrapper.inform_activity_failed se
|
825
839
|
self.__weel_state = :stopping
|
826
840
|
rescue => err
|
827
|
-
|
841
|
+
@__weel_handlerwrapper::inform_handlerwrapper_error @__weel_handlerwrapper_args, err
|
828
842
|
self.__weel_state = :stopping
|
829
843
|
ensure
|
830
844
|
Thread.current[:continue].clear if Thread.current[:continue] && Thread.current[:continue].is_a?(Continue)
|
@@ -925,6 +939,7 @@ end # }}}
|
|
925
939
|
if newState == :stopping || newState == :finishing
|
926
940
|
@__weel_status.nudge!
|
927
941
|
__weel_recursive_continue(@__weel_main)
|
942
|
+
__weel_replay = false
|
928
943
|
end
|
929
944
|
|
930
945
|
@__weel_handlerwrapper::inform_state_change @__weel_handlerwrapper_args, @__weel_state
|
@@ -1077,6 +1092,11 @@ public
|
|
1077
1092
|
end
|
1078
1093
|
end # }}}
|
1079
1094
|
|
1095
|
+
def replay
|
1096
|
+
@dslr.__weel_replay = true
|
1097
|
+
start
|
1098
|
+
end
|
1099
|
+
|
1080
1100
|
def sim # {{{
|
1081
1101
|
stat = @dslr.__weel_state
|
1082
1102
|
return nil unless stat == :ready || stat == :stopped
|
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:
|
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,19 +94,20 @@ 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
|
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
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