weel 1.2.6 → 1.99.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/weel.rb +196 -152
- data/test/TestHandlerWrapper.rb +7 -0
- data/test/TestWorkflow.rb +6 -6
- data/test/basic/tc_choose.rb +10 -10
- data/test/basic/tc_codereplace.rb +12 -12
- data/test/basic/tc_parallel.rb +20 -20
- data/test/basic/tc_search.rb +7 -7
- data/test/basic/tc_state.rb +6 -5
- data/test/basic/tc_wf_control.rb +9 -9
- data/test/complex/tc_generalsynchonizingmerge_loopsearch.rb +12 -12
- data/test/complex/tc_parallel_stop.rb +4 -4
- data/test/exec/tc_exec.rb +25 -0
- data/test/simulation_v0.0.1.tgz +0 -0
- data/test/wfp_adv_branching/tc_generalsynchronizingmerge.rb +6 -6
- data/test/wfp_adv_branching/tc_localsynchronizingmerge.rb +5 -5
- data/test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb +6 -6
- data/test/wfp_adv_branching/tc_structured_discriminator.rb +3 -3
- data/test/wfp_adv_branching/tc_structured_partial_join.rb +6 -6
- data/test/wfp_basic/tc_exclusivechoice_simplemerge.rb +2 -2
- data/test/wfp_basic/tc_parallelsplit_synchronization.rb +3 -3
- data/test/wfp_basic/tc_sequence.rb +3 -3
- data/test/wfp_iteration/tc_structuredloop.rb +11 -11
- data/test/wfp_state_based/tc_deferredchoice.rb +4 -4
- data/test/wfp_state_based/tc_interleavedparallelrouting.rb +3 -3
- data/weel.gemspec +1 -1
- metadata +49 -45
data/test/basic/tc_choose.rb
CHANGED
@@ -8,13 +8,13 @@ class TestChoose < Test::Unit::TestCase
|
|
8
8
|
@wf.description do
|
9
9
|
choose do
|
10
10
|
alternative true do
|
11
|
-
|
11
|
+
call :a_1, :endpoint1
|
12
12
|
end
|
13
13
|
alternative false do
|
14
|
-
|
14
|
+
call :a_2, :endpoint1
|
15
15
|
end
|
16
16
|
otherwise do
|
17
|
-
|
17
|
+
call :a_3, :endpoint1
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -28,10 +28,10 @@ class TestChoose < Test::Unit::TestCase
|
|
28
28
|
@wf.description do
|
29
29
|
choose do
|
30
30
|
alternative false do
|
31
|
-
|
31
|
+
call :a_1, :endpoint1
|
32
32
|
end
|
33
33
|
otherwise do
|
34
|
-
|
34
|
+
call :a_2, :endpoint1
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -46,25 +46,25 @@ class TestChoose < Test::Unit::TestCase
|
|
46
46
|
alternative true do
|
47
47
|
choose do
|
48
48
|
alternative false do
|
49
|
-
|
49
|
+
call :a_1_1, :endpoint1
|
50
50
|
end
|
51
51
|
alternative true do
|
52
52
|
choose do
|
53
53
|
alternative false do
|
54
|
-
|
54
|
+
call :a_1_1_1, :endpoint1
|
55
55
|
end
|
56
56
|
otherwise do
|
57
|
-
|
57
|
+
call :a_1_1_2, :endpoint1
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
otherwise do
|
62
|
-
|
62
|
+
call :a_1_3, :endpoint1
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
otherwise do
|
67
|
-
|
67
|
+
call :a_2, :endpoint1
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -6,9 +6,9 @@ class TestCodeReplace < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
def test_replace
|
8
8
|
@wf.description do
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
call :a_test_1_1, :endpoint1
|
10
|
+
call :a_test_1_2, :endpoint1
|
11
|
+
call :a_test_1_3, :endpoint1
|
12
12
|
end
|
13
13
|
@wf.search WEEL::Position.new(:a_test_1_1, :at)
|
14
14
|
@wf.start.join
|
@@ -17,17 +17,17 @@ class TestCodeReplace < Test::Unit::TestCase
|
|
17
17
|
wf_assert("CALL a_test_1_3:")
|
18
18
|
wf_sassert("|running|Ca_test_1_1Da_test_1_1Ca_test_1_2Da_test_1_2Ca_test_1_3Da_test_1_3|finished|")
|
19
19
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
def test_wfdescription_string
|
21
|
+
ret = @wf.description = "call :b_test_1_1, :endpoint1"
|
22
|
+
@wf.search WEEL::Position.new(:b_test_1_1, :at)
|
23
|
+
@wf.start.join
|
24
|
+
wf_assert("DONE b_test_1_1")
|
25
|
+
wf_sassert("|running|Cb_test_1_1Db_test_1_1|finished|")
|
26
|
+
end
|
27
27
|
def test_wfdescription_block
|
28
28
|
ret = @wf.description do
|
29
|
-
|
30
|
-
|
29
|
+
call :c_test_1_1, :endpoint1
|
30
|
+
call :c_test_1_2, :endpoint1
|
31
31
|
end
|
32
32
|
|
33
33
|
assert(ret.class == Proc, "wf_description should be nil => not available. codeblock was given!")
|
data/test/basic/tc_parallel.rb
CHANGED
@@ -8,13 +8,13 @@ class TestParallel < Test::Unit::TestCase
|
|
8
8
|
@wf.description do
|
9
9
|
parallel do
|
10
10
|
parallel_branch do
|
11
|
-
|
11
|
+
call :a_1, :endpoint1, :call => Proc.new{ sleep 0.5 }
|
12
12
|
end
|
13
13
|
parallel_branch do
|
14
|
-
|
14
|
+
call :a_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
|
15
15
|
end
|
16
16
|
parallel_branch do
|
17
|
-
|
17
|
+
call :a_3, :endpoint1, :call => Proc.new{ sleep 0.5 }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -32,13 +32,13 @@ class TestParallel < Test::Unit::TestCase
|
|
32
32
|
@wf.description do
|
33
33
|
parallel :wait do
|
34
34
|
parallel_branch do
|
35
|
-
|
35
|
+
call :a_1, :endpoint1, :call => Proc.new{ sleep 0.2 }
|
36
36
|
end
|
37
37
|
parallel_branch do
|
38
|
-
|
38
|
+
call :a_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
call :a_3, :endpoint1
|
42
42
|
end
|
43
43
|
@wf.start.join
|
44
44
|
wf_assert('CALL a_1')
|
@@ -50,14 +50,14 @@ class TestParallel < Test::Unit::TestCase
|
|
50
50
|
@wf.description do
|
51
51
|
parallel :wait => 1 do
|
52
52
|
parallel_branch do
|
53
|
-
|
53
|
+
call :a_1, :endpoint1
|
54
54
|
Thread.pass
|
55
55
|
end
|
56
56
|
parallel_branch do
|
57
|
-
|
57
|
+
call :a_2, :endpoint1, :call => Proc.new{ sleep 8.5 }
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
call :a_3, :endpoint1
|
61
61
|
end
|
62
62
|
@wf.start.join
|
63
63
|
wf_assert('CALL a_1')
|
@@ -68,14 +68,14 @@ class TestParallel < Test::Unit::TestCase
|
|
68
68
|
@wf.description do
|
69
69
|
parallel :wait => 1 do
|
70
70
|
parallel_branch do
|
71
|
-
|
71
|
+
call :a_1, :endpoint1, :call => Proc.new{ sleep 0.2 }
|
72
72
|
end
|
73
73
|
parallel_branch do
|
74
|
-
|
75
|
-
|
74
|
+
call :a_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
|
75
|
+
call :a_2_2, :endpoint1
|
76
76
|
end
|
77
77
|
end
|
78
|
-
|
78
|
+
call :a_3, :endpoint1
|
79
79
|
end
|
80
80
|
@wf.start.join
|
81
81
|
wf_assert('CALL a_1')
|
@@ -92,22 +92,22 @@ class TestParallel < Test::Unit::TestCase
|
|
92
92
|
# |- => :a_3
|
93
93
|
@wf.description do
|
94
94
|
parallel :wait do
|
95
|
-
parallel_branch do
|
95
|
+
parallel_branch do call :a_1, :endpoint1 end
|
96
96
|
parallel_branch do
|
97
97
|
parallel :wait do
|
98
98
|
parallel_branch do
|
99
99
|
parallel :wait do
|
100
|
-
parallel_branch do
|
101
|
-
parallel_branch do
|
100
|
+
parallel_branch do call :a_2_1_1, :endpoint1, :call => Proc.new {sleep 0.2} end
|
101
|
+
parallel_branch do call :a_2_1_2, :endpoint1, :call => Proc.new {sleep 0.4} end
|
102
102
|
end
|
103
|
-
|
103
|
+
call :a_2_1_3, :endpoint1, :call => Proc.new {sleep 0.8}
|
104
104
|
end
|
105
|
-
parallel_branch do
|
106
|
-
parallel_branch do
|
105
|
+
parallel_branch do call :a_2_2, :endpoint1, :call => Proc.new {sleep 0.8} end
|
106
|
+
parallel_branch do call :a_2_3, :endpoint1, :call => Proc.new {sleep 1.0} end
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
110
|
-
|
110
|
+
call :a_3, :endpoint1
|
111
111
|
end
|
112
112
|
@wf.start.join
|
113
113
|
nump = $long_track.split("\n").delete_if{|e| !(e =~ /^(DONE)/)}
|
data/test/basic/tc_search.rb
CHANGED
@@ -6,9 +6,9 @@ class TestSearch < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
def test_search_impact_single
|
8
8
|
@wf.description do
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
call :a1_1, :endpoint1
|
10
|
+
call :a1_2, :endpoint1
|
11
|
+
call :a1_3, :endpoint1
|
12
12
|
end
|
13
13
|
@wf.search WEEL::Position.new(:a1_2, :at)
|
14
14
|
@wf.start.join
|
@@ -16,16 +16,16 @@ class TestSearch < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
def test_search_impact_dual
|
18
18
|
@wf.description do
|
19
|
-
|
19
|
+
call :a1, :endpoint1
|
20
20
|
parallel do
|
21
21
|
parallel_branch do
|
22
|
-
|
22
|
+
call :a2_1, :endpoint1
|
23
23
|
end
|
24
24
|
parallel_branch do
|
25
|
-
|
25
|
+
call :a2_2, :endpoint1
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
call :a3, :endpoint1
|
29
29
|
end
|
30
30
|
@wf.search [WEEL::Position.new(:a2_1, :at), WEEL::Position.new(:a2_2, :at)]
|
31
31
|
@wf.start.join
|
data/test/basic/tc_state.rb
CHANGED
@@ -4,11 +4,12 @@ require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
|
|
4
4
|
class TestState < Test::Unit::TestCase
|
5
5
|
include TestMixin
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
def test_check_stop_state
|
13
14
|
@wf.start
|
14
15
|
@wf.stop.join
|
data/test/basic/tc_wf_control.rb
CHANGED
@@ -20,9 +20,9 @@ class TestWorkflowControl < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
def test_stop
|
22
22
|
@wf.description do
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
call :a_test_1_1, :endpoint1
|
24
|
+
call :a_test_1_2, :endpoint1, { :call => Proc.new{ sleep 0.5 } }
|
25
|
+
call :a_test_1_3, :endpoint1
|
26
26
|
end
|
27
27
|
@wf.search WEEL::Position.new(:a_test_1_1, :at)
|
28
28
|
wf = @wf.start
|
@@ -40,9 +40,9 @@ class TestWorkflowControl < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
def test_continue
|
42
42
|
@wf.description do
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
call :a_test_1_1, :endpoint1
|
44
|
+
call :a_test_1_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
|
45
|
+
call :a_test_1_3, :endpoint1
|
46
46
|
end
|
47
47
|
@wf.start
|
48
48
|
sleep(0.2)
|
@@ -56,9 +56,9 @@ class TestWorkflowControl < Test::Unit::TestCase
|
|
56
56
|
|
57
57
|
def test_continue_after
|
58
58
|
@wf.description do
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
call :c_test_1_1, :endpoint1
|
60
|
+
call :c_test_1_2, :endpoint1
|
61
|
+
call :c_test_1_3, :endpoint1
|
62
62
|
end
|
63
63
|
@wf.search [WEEL::Position.new(:c_test_1_1, :after)]
|
64
64
|
@wf.start.join
|
@@ -10,7 +10,7 @@ class TestGeneralsynchonizingmergeLoopsearch < Test::Unit::TestCase
|
|
10
10
|
@wf.data[:costs] = 0
|
11
11
|
@wf.data[:persons] = 3
|
12
12
|
@wf.description do
|
13
|
-
|
13
|
+
call :a1, :endpoint1 do
|
14
14
|
data.airline = 'Aeroflot'
|
15
15
|
data.costs += 101
|
16
16
|
status.update 1, 'Hotel'
|
@@ -18,19 +18,19 @@ class TestGeneralsynchonizingmergeLoopsearch < Test::Unit::TestCase
|
|
18
18
|
parallel do
|
19
19
|
loop pre_test{data.persons > 0} do
|
20
20
|
parallel_branch data.persons do |p|
|
21
|
-
|
21
|
+
call :a2, :endpoint1 do
|
22
22
|
data.hotels << 'Rathaus'
|
23
23
|
data.costs += 200
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
manipulate :a3 do
|
27
27
|
data.persons -= 1
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
choose do
|
32
32
|
alternative data.costs > 400 do
|
33
|
-
|
33
|
+
call :a4, :endpoint1
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -45,7 +45,7 @@ class TestGeneralsynchonizingmergeLoopsearch < Test::Unit::TestCase
|
|
45
45
|
@wf.data[:costs] = 802
|
46
46
|
@wf.data[:persons] = 2
|
47
47
|
@wf.description do
|
48
|
-
|
48
|
+
call :a1, :endpoint1 do
|
49
49
|
data.airline = 'Aeroflot'
|
50
50
|
data.costs += 101
|
51
51
|
status.update 1, 'Hotel'
|
@@ -53,19 +53,19 @@ class TestGeneralsynchonizingmergeLoopsearch < Test::Unit::TestCase
|
|
53
53
|
parallel do
|
54
54
|
loop pre_test{data.persons > 0} do
|
55
55
|
parallel_branch data.persons do |p|
|
56
|
-
|
56
|
+
call :a2, :endpoint1 do
|
57
57
|
data.hotels << 'Rathaus'
|
58
58
|
data.costs += 200
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
manipulate :a3 do
|
62
62
|
data.persons -= 1
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
choose do
|
67
67
|
alternative data.costs > 700 do
|
68
|
-
|
68
|
+
call :a4, :endpoint1
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -81,7 +81,7 @@ class TestGeneralsynchonizingmergeLoopsearch < Test::Unit::TestCase
|
|
81
81
|
@wf.data[:costs] = 802
|
82
82
|
@wf.data[:persons] = 2
|
83
83
|
@wf.description do
|
84
|
-
|
84
|
+
call :a1, :endpoint1 do
|
85
85
|
data.airline = 'Aeroflot'
|
86
86
|
data.costs += 101
|
87
87
|
status.update 1, 'Hotel'
|
@@ -89,19 +89,19 @@ class TestGeneralsynchonizingmergeLoopsearch < Test::Unit::TestCase
|
|
89
89
|
parallel do
|
90
90
|
loop pre_test{data.persons > 0} do
|
91
91
|
parallel_branch data.persons do |p|
|
92
|
-
|
92
|
+
call :a2, :endpoint1 do
|
93
93
|
data.hotels << 'Rathaus'
|
94
94
|
data.costs += 200
|
95
95
|
end
|
96
96
|
end
|
97
|
-
|
97
|
+
manipulate :a3 do
|
98
98
|
data.persons -= 1
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
choose do
|
103
103
|
alternative data.costs > 700 do
|
104
|
-
|
104
|
+
call :a4, :endpoint1
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -10,18 +10,18 @@ class TestParallelStop < Test::Unit::TestCase
|
|
10
10
|
@wf.description do
|
11
11
|
parallel do
|
12
12
|
parallel_branch do
|
13
|
-
|
13
|
+
call :a1, :endpoint1 do
|
14
14
|
data.hotels << 'Rathaus'
|
15
15
|
data.costs += 200
|
16
16
|
end
|
17
|
-
|
17
|
+
call :a3, :stop
|
18
18
|
end
|
19
19
|
parallel_branch do
|
20
|
-
|
20
|
+
call :a2, :endpoint2 do
|
21
21
|
data.hotels << 'Graf Stadion'
|
22
22
|
data.costs += 200
|
23
23
|
end
|
24
|
-
|
24
|
+
call :a4, :stop
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
|
3
|
+
|
4
|
+
class TestChoose < Test::Unit::TestCase
|
5
|
+
include TestMixin
|
6
|
+
|
7
|
+
def test_exec
|
8
|
+
@wf.data[:a] = 0
|
9
|
+
@wf.data[:b] = 0
|
10
|
+
@wf.description do
|
11
|
+
manipulate :a_1, <<-end
|
12
|
+
data.a = 1
|
13
|
+
end
|
14
|
+
call :a_2, :endpoint1, <<-end
|
15
|
+
data.b = 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
@wf.start.join
|
19
|
+
wf_assert("MANIPULATE a_1")
|
20
|
+
wf_assert("CALL a_2")
|
21
|
+
assert(@wf.data[:a] == 1)
|
22
|
+
assert(@wf.data[:b] == 1)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
Binary file
|
@@ -9,28 +9,28 @@ class TestWFPGeneralSynchronizingMerge < Test::Unit::TestCase
|
|
9
9
|
@wf.description do
|
10
10
|
parallel do
|
11
11
|
parallel_branch do
|
12
|
-
|
12
|
+
call :a1_1, :endpoint1, :call => Proc.new{sleep 0.2}
|
13
13
|
end
|
14
14
|
parallel_branch do
|
15
|
-
|
15
|
+
call :a1_2, :endpoint1, :call => Proc.new{sleep 0.4}
|
16
16
|
end
|
17
17
|
choose do
|
18
18
|
alternative(true) do
|
19
19
|
loop post_test{data.break} do
|
20
20
|
parallel_branch do
|
21
|
-
|
21
|
+
call :a2_1, :endpoint1
|
22
22
|
end
|
23
|
-
|
23
|
+
call(:a2_decide, :endpoint1, :result => false) do |e|
|
24
24
|
data.break = e
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
otherwise do
|
29
|
-
|
29
|
+
call :a2_2, :endpoint1, :call => Proc.new{sleep 0.1}
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
call :a3, :endpoint1
|
34
34
|
end
|
35
35
|
@wf.start.join
|
36
36
|
wf_sassert('|running|Ca2_decideMa2_decideDa2_decide')
|