weel 1.0.3 → 1.1.0
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.
- data/lib/weel.rb +121 -13
- data/test/SimHandlerWrapper.rb +163 -0
- data/test/TestHandlerWrapper.rb +0 -32
- data/test/TestMixin.rb +64 -0
- data/test/TestWorkflow.rb +1 -0
- data/weel.gemspec +2 -2
- metadata +46 -42
data/lib/weel.rb
CHANGED
@@ -7,6 +7,29 @@ class String # {{{
|
|
7
7
|
end
|
8
8
|
end # }}}
|
9
9
|
|
10
|
+
# OMG!111! deep cloning for ReadHashes
|
11
|
+
class Object #{{{
|
12
|
+
def deep_clone
|
13
|
+
return @deep_cloning_obj if @deep_cloning
|
14
|
+
@deep_cloning_obj = clone
|
15
|
+
@deep_cloning_obj.instance_variables.each do |var|
|
16
|
+
val = @deep_cloning_obj.instance_variable_get(var)
|
17
|
+
begin
|
18
|
+
@deep_cloning = true
|
19
|
+
val = val.deep_clone
|
20
|
+
rescue TypeError
|
21
|
+
next
|
22
|
+
ensure
|
23
|
+
@deep_cloning = false
|
24
|
+
end
|
25
|
+
@deep_cloning_obj.instance_variable_set(var, val)
|
26
|
+
end
|
27
|
+
deep_cloning_obj = @deep_cloning_obj
|
28
|
+
@deep_cloning_obj = nil
|
29
|
+
deep_cloning_obj
|
30
|
+
end
|
31
|
+
end #}}}
|
32
|
+
|
10
33
|
class WEEL
|
11
34
|
def initialize(*args)# {{{
|
12
35
|
@wfsource = nil
|
@@ -118,7 +141,7 @@ class WEEL
|
|
118
141
|
temp = nil
|
119
142
|
if args.empty? && @__weel_values.has_key?(name)
|
120
143
|
@__weel_values[name]
|
121
|
-
#TODO dont let user change stuff
|
144
|
+
#TODO dont let user change stuff e.g. if return value is an array (deep clone and/or deep freeze it?)
|
122
145
|
else
|
123
146
|
nil
|
124
147
|
end
|
@@ -150,6 +173,12 @@ class WEEL
|
|
150
173
|
def vote_sync_before; true; end
|
151
174
|
def vote_sync_after; true; end
|
152
175
|
|
176
|
+
# type => activity, loop, parallel, choice
|
177
|
+
# nesting => none, start, end
|
178
|
+
# eid => id's also for control structures
|
179
|
+
# parameters => stuff given to the control structure
|
180
|
+
def simulate(type,nesting,eid,parent,parameters={}); end
|
181
|
+
|
153
182
|
def callback(result); end
|
154
183
|
end # }}}
|
155
184
|
|
@@ -230,6 +259,7 @@ class WEEL
|
|
230
259
|
@__weel_handlerwrapper_args = []
|
231
260
|
@__weel_state = :ready
|
232
261
|
@__weel_status = Status.new(0,"undefined")
|
262
|
+
@__weel_sim = -1
|
233
263
|
end
|
234
264
|
attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_handlerwrapper, :__weel_handlerwrapper_args
|
235
265
|
attr_reader :__weel_state, :__weel_status
|
@@ -251,6 +281,11 @@ class WEEL
|
|
251
281
|
Thread.current[:continue] = Continue.new
|
252
282
|
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args, @__weel_endpoints[endpoint], position, Thread.current[:continue]
|
253
283
|
|
284
|
+
if __weel_sim
|
285
|
+
handlerwrapper.simulate(:activity,:none,position,Thread.current[:branch_sim_pos],:parameters=>parameters, :endpoint => endpoint, :type => type)
|
286
|
+
return
|
287
|
+
end
|
288
|
+
|
254
289
|
ipc = {}
|
255
290
|
if searchmode == :after
|
256
291
|
wp = WEEL::Position.new(position, :after, nil)
|
@@ -382,6 +417,9 @@ class WEEL
|
|
382
417
|
Thread.current[:branch_finished_count] = 0
|
383
418
|
Thread.current[:branch_event] = Continue.new
|
384
419
|
Thread.current[:mutex] = Mutex.new
|
420
|
+
|
421
|
+
hw, pos = __weel_sim_start(:parallel) if __weel_sim
|
422
|
+
|
385
423
|
yield
|
386
424
|
|
387
425
|
Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type.size == 1 && type[:wait] != nil && (type[:wait].is_a?(Integer)) ? type[:wait] : Thread.current[:branches].size)
|
@@ -398,7 +436,8 @@ class WEEL
|
|
398
436
|
end
|
399
437
|
|
400
438
|
Thread.current[:branch_event].wait
|
401
|
-
|
439
|
+
|
440
|
+
__weel_sim_stop(:parallel,hw,pos) if __weel_sim
|
402
441
|
|
403
442
|
unless self.__weel_state == :stopping || self.__weel_state == :stopped
|
404
443
|
# first set all to no_longer_neccessary
|
@@ -419,19 +458,41 @@ class WEEL
|
|
419
458
|
def parallel_branch(*vars)# {{{
|
420
459
|
return if self.__weel_state == :stopping || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
421
460
|
branch_parent = Thread.current
|
461
|
+
|
462
|
+
if __weel_sim
|
463
|
+
# catch the potential execution in loops inside a parallel
|
464
|
+
current_branch_sim_pos = branch_parent[:branch_sim_pos]
|
465
|
+
end
|
466
|
+
|
422
467
|
Thread.current[:branches] << Thread.new(*vars) do |*local|
|
423
468
|
branch_parent[:mutex].synchronize do
|
424
469
|
Thread.current.abort_on_exception = true
|
425
470
|
Thread.current[:branch_status] = false
|
426
471
|
Thread.current[:branch_parent] = branch_parent
|
472
|
+
|
473
|
+
if __weel_sim
|
474
|
+
Thread.current[:branch_sim_pos] = @__weel_sim += 1
|
475
|
+
end
|
476
|
+
|
477
|
+
# parallel_branch could be possibly around an alternative. Thus thread has to inherit the alternative_executed
|
478
|
+
# after branching, update it in the parent (TODO)
|
427
479
|
if branch_parent[:alternative_executed] && branch_parent[:alternative_executed].length > 0
|
428
480
|
Thread.current[:alternative_executed] = [branch_parent[:alternative_executed].last]
|
481
|
+
Thread.current[:alternative_mode] = [branch_parent[:alternative_mode].last]
|
429
482
|
end
|
430
483
|
end
|
431
484
|
|
432
485
|
Thread.stop
|
486
|
+
|
487
|
+
if __weel_sim
|
488
|
+
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
|
489
|
+
handlerwrapper.simulate(:parallel_branch,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos)
|
490
|
+
end
|
491
|
+
|
433
492
|
yield(*local)
|
434
493
|
|
494
|
+
__weel_sim_stop(:parallel_branch,handlerwrapper,current_branch_sim_pos) if __weel_sim
|
495
|
+
|
435
496
|
branch_parent[:mutex].synchronize do
|
436
497
|
Thread.current[:branch_status] = true
|
437
498
|
branch_parent[:branch_finished_count] += 1
|
@@ -458,12 +519,17 @@ class WEEL
|
|
458
519
|
# Choose DSL-Construct
|
459
520
|
# Defines a choice in the Workflow path.
|
460
521
|
# May contain multiple execution alternatives
|
461
|
-
def choose # {{{
|
522
|
+
def choose(mode=:inclusive) # {{{
|
462
523
|
return if self.__weel_state == :stopping || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
463
524
|
Thread.current[:alternative_executed] ||= []
|
525
|
+
Thread.current[:alternative_mode] ||= []
|
464
526
|
Thread.current[:alternative_executed] << false
|
527
|
+
Thread.current[:alternative_mode] << mode
|
528
|
+
hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
465
529
|
yield
|
530
|
+
__weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
466
531
|
Thread.current[:alternative_executed].pop
|
532
|
+
Thread.current[:alternative_mode].pop
|
467
533
|
nil
|
468
534
|
end # }}}
|
469
535
|
|
@@ -472,12 +538,20 @@ class WEEL
|
|
472
538
|
# searchmode is active (to find the starting position)
|
473
539
|
def alternative(condition)# {{{
|
474
540
|
return if self.__weel_state == :stopping || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
475
|
-
|
476
|
-
Thread.current[:
|
541
|
+
hw, pos = __weel_sim_start(:alternative,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
542
|
+
Thread.current[:mutex] ||= Mutex.new
|
543
|
+
Thread.current[:mutex].synchronize do
|
544
|
+
return if Thread.current[:alternative_mode] == :exclusive && Thread.current[:alternative_executed][-1] = true
|
545
|
+
Thread.current[:alternative_executed][-1] = true if condition
|
546
|
+
end
|
547
|
+
yield if __weel_is_in_search_mode || __weel_sim || condition
|
548
|
+
__weel_sim_stop(:alternative,hw,pos,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
477
549
|
end # }}}
|
478
550
|
def otherwise # {{{
|
479
551
|
return if self.__weel_state == :stopping || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
480
|
-
|
552
|
+
hw, pos = __weel_sim_start(:otherwise,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
553
|
+
yield if __weel_is_in_search_mode || __weel_sim || !Thread.current[:alternative_executed].last
|
554
|
+
__weel_sim_stop(:otherwise,hw,pos,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
481
555
|
end # }}}
|
482
556
|
|
483
557
|
# Defines a critical block (=Mutex)
|
@@ -495,7 +569,7 @@ class WEEL
|
|
495
569
|
end # }}}
|
496
570
|
|
497
571
|
# Defines a Cycle (loop/iteration)
|
498
|
-
def loop(condition)# {{{
|
572
|
+
def loop(condition)# {{{
|
499
573
|
unless condition.is_a?(Array) && condition[0].is_a?(Proc) && [:pre_test,:post_test].include?(condition[1])
|
500
574
|
raise "condition must be called pre_test{} or post_test{}"
|
501
575
|
end
|
@@ -504,6 +578,12 @@ class WEEL
|
|
504
578
|
yield
|
505
579
|
return if __weel_is_in_search_mode
|
506
580
|
end
|
581
|
+
if __weel_sim
|
582
|
+
hw, pos = __weel_sim_start(:loop,:testing=>condition[1])
|
583
|
+
yield
|
584
|
+
__weel_sim_stop(:loop,hw,pos,:testing=>condition[1])
|
585
|
+
return
|
586
|
+
end
|
507
587
|
case condition[1]
|
508
588
|
when :pre_test
|
509
589
|
yield while condition[0].call && self.__weel_state != :stopping && self.__weel_state != :stopped
|
@@ -594,6 +674,23 @@ class WEEL
|
|
594
674
|
branch[:branch_search] = true
|
595
675
|
end
|
596
676
|
end # }}}
|
677
|
+
|
678
|
+
def __weel_sim
|
679
|
+
@__weel_state == :simulating
|
680
|
+
end
|
681
|
+
|
682
|
+
def __weel_sim_start(what,options={})
|
683
|
+
current_branch_sim_pos = Thread.current[:branch_sim_pos]
|
684
|
+
Thread.current[:branch_sim_pos] = @__weel_sim += 1
|
685
|
+
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
|
686
|
+
handlerwrapper.simulate(what,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
|
687
|
+
[handlerwrapper, current_branch_sim_pos]
|
688
|
+
end
|
689
|
+
|
690
|
+
def __weel_sim_stop(what,handlerwrapper,current_branch_sim_pos,options={})
|
691
|
+
handlerwrapper.simulate(what,:end,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
|
692
|
+
Thread.current[:branch_sim_pos] = current_branch_sim_pos
|
693
|
+
end
|
597
694
|
|
598
695
|
public
|
599
696
|
def __weel_finalize
|
@@ -616,7 +713,7 @@ class WEEL
|
|
616
713
|
handlerwrapper.inform_state_change @__weel_state
|
617
714
|
end # }}}
|
618
715
|
|
619
|
-
end # }}}
|
716
|
+
end # }}}
|
620
717
|
|
621
718
|
public
|
622
719
|
def positions # {{{
|
@@ -648,7 +745,7 @@ public
|
|
648
745
|
nil
|
649
746
|
end # }}}
|
650
747
|
|
651
|
-
# Get the state of execution (ready|running|stopping|stopped|finished)
|
748
|
+
# Get the state of execution (ready|running|stopping|stopped|finished|simulating)
|
652
749
|
def state # {{{
|
653
750
|
@dslr.__weel_state
|
654
751
|
end # }}}
|
@@ -700,9 +797,9 @@ public
|
|
700
797
|
else
|
701
798
|
@wfsource = code unless bgiven
|
702
799
|
(class << self; self; end).class_eval do
|
703
|
-
define_method :__weel_control_flow do
|
800
|
+
define_method :__weel_control_flow do |state,final_state=:finished|
|
704
801
|
@dslr.__weel_positions.clear
|
705
|
-
@dslr.__weel_state =
|
802
|
+
@dslr.__weel_state = state
|
706
803
|
begin
|
707
804
|
if bgiven
|
708
805
|
@dslr.instance_eval(&blk)
|
@@ -721,7 +818,10 @@ public
|
|
721
818
|
@dslr.__weel_positions.clear
|
722
819
|
handlerwrapper = @dslr.__weel_handlerwrapper.new @dslr.__weel_handlerwrapper_args
|
723
820
|
handlerwrapper.inform_position_change(ipc)
|
724
|
-
end
|
821
|
+
end
|
822
|
+
if @dslr.__weel_state == :simulating
|
823
|
+
@dslr.__weel_state = final_state
|
824
|
+
end
|
725
825
|
if @dslr.__weel_state == :stopping
|
726
826
|
@dslr.__weel_finalize
|
727
827
|
end
|
@@ -742,7 +842,15 @@ public
|
|
742
842
|
def start # {{{
|
743
843
|
return nil if @dslr.__weel_state != :ready && @dslr.__weel_state != :stopped
|
744
844
|
@dslr.__weel_main = Thread.new do
|
745
|
-
__weel_control_flow
|
845
|
+
__weel_control_flow(:running)
|
846
|
+
end
|
847
|
+
end # }}}
|
848
|
+
|
849
|
+
def sim # {{{
|
850
|
+
stat = @dslr.__weel_state
|
851
|
+
return nil if stat != :ready && stat != :stopped
|
852
|
+
@dslr.__weel_main = Thread.new do
|
853
|
+
__weel_control_flow :simulating, stat
|
746
854
|
end
|
747
855
|
end # }}}
|
748
856
|
|
@@ -0,0 +1,163 @@
|
|
1
|
+
# Apache License, Version 2.0
|
2
|
+
#
|
3
|
+
# Copyright (c) 2013 Juergen Mangler
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
######
|
18
|
+
# ADVENTURE Simulation Trace Generator Handler Wrapper
|
19
|
+
######
|
20
|
+
|
21
|
+
module TraceBasics #{{{
|
22
|
+
def <<(item)
|
23
|
+
@elements << item
|
24
|
+
item.parent = self
|
25
|
+
end
|
26
|
+
def each
|
27
|
+
@elements.each do |ele|
|
28
|
+
yield ele
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end #}}}
|
32
|
+
|
33
|
+
class Trace #{{{
|
34
|
+
include TraceBasics
|
35
|
+
attr_accessor :elements
|
36
|
+
def initialize
|
37
|
+
@elements = []
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_container(tid)
|
41
|
+
recursive_get_container(self,tid) || self
|
42
|
+
end
|
43
|
+
def recursive_get_container(container,tid)
|
44
|
+
return container if container.respond_to?(:tid) and container.tid == tid
|
45
|
+
container.each do |ele|
|
46
|
+
if ele.kind_of?(TraceContainer)
|
47
|
+
ret = recursive_get_container(ele,tid)
|
48
|
+
return ret unless ret.nil?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
|
54
|
+
private :recursive_get_container
|
55
|
+
end #}}}
|
56
|
+
|
57
|
+
class TraceBase #{{{
|
58
|
+
attr_accessor :tid, :parent
|
59
|
+
def initialize(tid)
|
60
|
+
@tid = tid
|
61
|
+
@parent = nil
|
62
|
+
end
|
63
|
+
end #}}}
|
64
|
+
|
65
|
+
class TraceContainer < TraceBase #{{{
|
66
|
+
include TraceBasics
|
67
|
+
attr_accessor :elements
|
68
|
+
def initialize(tid)
|
69
|
+
super tid
|
70
|
+
@elements = []
|
71
|
+
@open = true
|
72
|
+
end
|
73
|
+
def open?; @open; end
|
74
|
+
def close!; @open = false; end
|
75
|
+
end #}}}
|
76
|
+
|
77
|
+
class TraceElement < TraceBase #{{{
|
78
|
+
attr_accessor :item
|
79
|
+
def initialize(tid, item)
|
80
|
+
super tid
|
81
|
+
@item = item
|
82
|
+
end
|
83
|
+
end #}}}
|
84
|
+
|
85
|
+
class TraceParallel < TraceContainer; end
|
86
|
+
class TraceParallelBranch < TraceContainer #{{{
|
87
|
+
def initialize(tid,group_by)
|
88
|
+
super tid
|
89
|
+
@group_by = group_by
|
90
|
+
end
|
91
|
+
attr_reader :group_by
|
92
|
+
end #}}}
|
93
|
+
class TraceLoop < TraceContainer; end
|
94
|
+
class TraceChoose < TraceContainer
|
95
|
+
attr_reader :mode
|
96
|
+
def initialize(tid,mode)
|
97
|
+
super tid
|
98
|
+
@mode = mode
|
99
|
+
end
|
100
|
+
end
|
101
|
+
class TraceAlternative < TraceContainer; end
|
102
|
+
class TraceOtherwise < TraceContainer; end
|
103
|
+
|
104
|
+
class PlainTrace
|
105
|
+
def initialize
|
106
|
+
@container
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
$trace = Trace.new
|
111
|
+
|
112
|
+
class SimHandlerWrapper < WEEL::HandlerWrapperBase
|
113
|
+
def initialize(args,endpoint=nil,position=nil,continue=nil)
|
114
|
+
@__myhandler_stopped = false
|
115
|
+
@__myhandler_position = position
|
116
|
+
@__myhandler_continue = continue
|
117
|
+
@__myhandler_endpoint = endpoint
|
118
|
+
@__myhandler_returnValue = nil
|
119
|
+
end
|
120
|
+
|
121
|
+
def simulate(type,nesting,tid,parent,parameters={})
|
122
|
+
pp "#{type} - #{nesting} - #{tid} - #{parent} - #{parameters.inspect}"
|
123
|
+
|
124
|
+
case type
|
125
|
+
when :activity
|
126
|
+
$trace.get_container(parent) << TraceElement.new(tid,parameters[:endpoint])
|
127
|
+
when :parallel
|
128
|
+
simulate_add_to_container($trace,nesting,parent,tid) { TraceParallel.new(tid) }
|
129
|
+
when :loop
|
130
|
+
simulate_add_to_container($trace,nesting,parent,tid) { TraceLoop.new(tid) }
|
131
|
+
when :parallel_branch
|
132
|
+
if nesting == :start
|
133
|
+
clast = $trace.get_container(parent)
|
134
|
+
until clast.kind_of?(TraceParallel)
|
135
|
+
clast = clast.parent
|
136
|
+
end
|
137
|
+
clast << TraceParallelBranch.new(tid,parent)
|
138
|
+
else
|
139
|
+
clast = $trace.get_container(tid)
|
140
|
+
clast.close! if clast.open?
|
141
|
+
end
|
142
|
+
when :choose
|
143
|
+
simulate_add_to_container($trace,nesting,parent,tid) { TraceChoose.new(tid,parameters[:mode]) }
|
144
|
+
when :alternative
|
145
|
+
simulate_add_to_container($trace,nesting,parent,tid) { TraceAlternative.new(tid) }
|
146
|
+
when :otherwise
|
147
|
+
simulate_add_to_container($trace,nesting,parent,tid) { TraceOtherwise.new(tid) }
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
def simulate_add_to_container(trace,nesting,parent,tid) #{{{
|
154
|
+
if nesting == :start
|
155
|
+
clast = trace.get_container(parent)
|
156
|
+
clast << yield
|
157
|
+
else
|
158
|
+
clast = trace.get_container(tid)
|
159
|
+
clast.close! if clast.open?
|
160
|
+
end
|
161
|
+
end #}}}
|
162
|
+
|
163
|
+
end
|
data/test/TestHandlerWrapper.rb
CHANGED
@@ -86,35 +86,3 @@ class TestHandlerWrapper < WEEL::HandlerWrapperBase
|
|
86
86
|
$short_track << "|#{newstate}|"
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
90
|
-
module TestMixin #{{{
|
91
|
-
def setup
|
92
|
-
$long_track = ""
|
93
|
-
$short_track = ""
|
94
|
-
@wf = TestWorkflow.new
|
95
|
-
end
|
96
|
-
|
97
|
-
def teardown
|
98
|
-
@wf.stop.join
|
99
|
-
$long_track = ""
|
100
|
-
$short_track = ""
|
101
|
-
end
|
102
|
-
|
103
|
-
def wf_assert(what,cond=true)
|
104
|
-
if cond
|
105
|
-
assert($long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
106
|
-
else
|
107
|
-
assert(!$long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
def wf_sassert(what,cond=true)
|
111
|
-
if cond
|
112
|
-
assert($short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
113
|
-
else
|
114
|
-
assert(!$short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
115
|
-
end
|
116
|
-
end
|
117
|
-
def wf_rsassert(pat='')
|
118
|
-
assert($short_track =~ /#{pat}/,"Somehow executed different #{$short_track} should be '#{pat}'")
|
119
|
-
end
|
120
|
-
end #}}}
|
data/test/TestMixin.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
module SimTestMixin #{{{
|
2
|
+
def setup
|
3
|
+
$long_track = ""
|
4
|
+
$short_track = ""
|
5
|
+
@wf = nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
@wf.stop.join
|
10
|
+
$long_track = ""
|
11
|
+
$short_track = ""
|
12
|
+
end
|
13
|
+
|
14
|
+
def wf_assert(what,cond=true)
|
15
|
+
if cond
|
16
|
+
assert($long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
17
|
+
else
|
18
|
+
assert(!$long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
def wf_sassert(what,cond=true)
|
22
|
+
if cond
|
23
|
+
assert($short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
24
|
+
else
|
25
|
+
assert(!$short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
def wf_rsassert(pat='')
|
29
|
+
assert($short_track =~ /#{pat}/,"Somehow executed different #{$short_track} should be '#{pat}'")
|
30
|
+
end
|
31
|
+
end #}}}
|
32
|
+
|
33
|
+
|
34
|
+
module TestMixin #{{{
|
35
|
+
def setup
|
36
|
+
$long_track = ""
|
37
|
+
$short_track = ""
|
38
|
+
@wf = TestWorkflow.new
|
39
|
+
end
|
40
|
+
|
41
|
+
def teardown
|
42
|
+
@wf.stop.join
|
43
|
+
$long_track = ""
|
44
|
+
$short_track = ""
|
45
|
+
end
|
46
|
+
|
47
|
+
def wf_assert(what,cond=true)
|
48
|
+
if cond
|
49
|
+
assert($long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
50
|
+
else
|
51
|
+
assert(!$long_track.include?(what),"Missing \"#{what}\":\n#{$long_track}")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
def wf_sassert(what,cond=true)
|
55
|
+
if cond
|
56
|
+
assert($short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
57
|
+
else
|
58
|
+
assert(!$short_track.include?(what),"#{$short_track}\nNot Present \"#{what}\":\n#{$long_track}")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
def wf_rsassert(pat='')
|
62
|
+
assert($short_track =~ /#{pat}/,"Somehow executed different #{$short_track} should be '#{pat}'")
|
63
|
+
end
|
64
|
+
end #}}}
|
data/test/TestWorkflow.rb
CHANGED
data/weel.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "weel"
|
3
|
-
s.version = "1.0
|
3
|
+
s.version = "1.1.0"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.summary = "preliminary release of the Workflow Execution Engine Library (WEEL)"
|
6
6
|
|
@@ -14,7 +14,7 @@ WEE Library is freely distributable according to the terms of the GNU Lesser Gen
|
|
14
14
|
This program is distributed without any warranty. See the file 'COPYING' for details.
|
15
15
|
EOF
|
16
16
|
|
17
|
-
s.files = Dir['{example/**/*,lib
|
17
|
+
s.files = Dir['{example/**/*,lib/weel.rb}'] + %w(COPYING FEATURES INSTALL Rakefile weel.gemspec README AUTHORS)
|
18
18
|
s.require_path = 'lib'
|
19
19
|
s.extra_rdoc_files = ['README']
|
20
20
|
s.test_files = Dir['{test/*,test/*/tc_*.rb}']
|
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: ! 'For WEE Library specific information see http://cpee.org/.
|
16
16
|
|
@@ -31,8 +31,8 @@ extensions: []
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- README
|
33
33
|
files:
|
34
|
-
- example/runme.rb
|
35
34
|
- example/SimpleHandlerWrapper.rb
|
35
|
+
- example/runme.rb
|
36
36
|
- example/SimpleWorkflow.rb
|
37
37
|
- lib/weel.rb
|
38
38
|
- COPYING
|
@@ -42,35 +42,37 @@ files:
|
|
42
42
|
- weel.gemspec
|
43
43
|
- README
|
44
44
|
- AUTHORS
|
45
|
-
- test/
|
45
|
+
- test/SimHandlerWrapper.rb
|
46
46
|
- test/TestHandlerWrapper.rb
|
47
|
+
- test/ContinueTest.rb
|
48
|
+
- test/TestMixin.rb
|
47
49
|
- test/TestWorkflow.rb
|
48
|
-
- test/
|
49
|
-
- test/
|
50
|
-
- test/
|
51
|
-
- test/
|
52
|
-
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
50
|
+
- test/wfp_state_based/tc_interleavedparallelrouting.rb
|
51
|
+
- test/wfp_state_based/tc_deferredchoice.rb
|
52
|
+
- test/wfp_iteration/tc_structuredloop.rb
|
53
|
+
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
53
54
|
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
54
|
-
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
55
55
|
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
56
|
-
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
57
56
|
- test/wfp_adv_branching/tc_threadmerge.rb
|
57
|
+
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
58
|
+
- test/wfp_adv_branching/tc_threadsplit.rb
|
59
|
+
- test/wfp_adv_branching/tc_multimerge.rb
|
58
60
|
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
59
61
|
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
60
|
-
- test/wfp_adv_branching/tc_multimerge.rb
|
61
|
-
- test/wfp_adv_branching/tc_threadsplit.rb
|
62
|
-
- test/basic/tc_wf_control.rb
|
63
|
-
- test/basic/tc_endpoint.rb
|
64
62
|
- test/basic/tc_codereplace.rb
|
65
|
-
- test/basic/tc_search.rb
|
66
|
-
- test/basic/tc_state.rb
|
67
|
-
- test/basic/tc_choose.rb
|
68
63
|
- test/basic/tc_data.rb
|
69
|
-
- test/basic/tc_parallel.rb
|
70
64
|
- test/basic/tc_handler.rb
|
71
|
-
- test/
|
72
|
-
- test/
|
73
|
-
- test/
|
65
|
+
- test/basic/tc_parallel.rb
|
66
|
+
- test/basic/tc_search.rb
|
67
|
+
- test/basic/tc_endpoint.rb
|
68
|
+
- test/basic/tc_wf_control.rb
|
69
|
+
- test/basic/tc_choose.rb
|
70
|
+
- test/basic/tc_state.rb
|
71
|
+
- test/complex/tc_parallel_stop.rb
|
72
|
+
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
73
|
+
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
74
|
+
- test/wfp_basic/tc_sequence.rb
|
75
|
+
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
74
76
|
homepage: http://cpee.org
|
75
77
|
licenses: []
|
76
78
|
post_install_message:
|
@@ -91,37 +93,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
version: '0'
|
92
94
|
requirements: []
|
93
95
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.8.
|
96
|
+
rubygems_version: 1.8.11
|
95
97
|
signing_key:
|
96
98
|
specification_version: 3
|
97
99
|
summary: preliminary release of the Workflow Execution Engine Library (WEEL)
|
98
100
|
test_files:
|
99
|
-
- test/
|
101
|
+
- test/SimHandlerWrapper.rb
|
100
102
|
- test/TestHandlerWrapper.rb
|
103
|
+
- test/ContinueTest.rb
|
104
|
+
- test/TestMixin.rb
|
101
105
|
- test/TestWorkflow.rb
|
102
|
-
- test/
|
103
|
-
- test/
|
104
|
-
- test/
|
105
|
-
- test/
|
106
|
-
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
106
|
+
- test/wfp_state_based/tc_interleavedparallelrouting.rb
|
107
|
+
- test/wfp_state_based/tc_deferredchoice.rb
|
108
|
+
- test/wfp_iteration/tc_structuredloop.rb
|
109
|
+
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
107
110
|
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
108
|
-
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
109
111
|
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
110
|
-
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
111
112
|
- test/wfp_adv_branching/tc_threadmerge.rb
|
113
|
+
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
114
|
+
- test/wfp_adv_branching/tc_threadsplit.rb
|
115
|
+
- test/wfp_adv_branching/tc_multimerge.rb
|
112
116
|
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
113
117
|
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
114
|
-
- test/wfp_adv_branching/tc_multimerge.rb
|
115
|
-
- test/wfp_adv_branching/tc_threadsplit.rb
|
116
|
-
- test/basic/tc_wf_control.rb
|
117
|
-
- test/basic/tc_endpoint.rb
|
118
118
|
- test/basic/tc_codereplace.rb
|
119
|
-
- test/basic/tc_search.rb
|
120
|
-
- test/basic/tc_state.rb
|
121
|
-
- test/basic/tc_choose.rb
|
122
119
|
- test/basic/tc_data.rb
|
123
|
-
- test/basic/tc_parallel.rb
|
124
120
|
- test/basic/tc_handler.rb
|
125
|
-
- test/
|
126
|
-
- test/
|
127
|
-
- test/
|
121
|
+
- test/basic/tc_parallel.rb
|
122
|
+
- test/basic/tc_search.rb
|
123
|
+
- test/basic/tc_endpoint.rb
|
124
|
+
- test/basic/tc_wf_control.rb
|
125
|
+
- test/basic/tc_choose.rb
|
126
|
+
- test/basic/tc_state.rb
|
127
|
+
- test/complex/tc_parallel_stop.rb
|
128
|
+
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
129
|
+
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
130
|
+
- test/wfp_basic/tc_sequence.rb
|
131
|
+
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|