weel 1.2.6 → 1.99.2

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.
@@ -8,13 +8,13 @@ class TestChoose < Test::Unit::TestCase
8
8
  @wf.description do
9
9
  choose do
10
10
  alternative true do
11
- activity :a_1, :call, :endpoint1
11
+ call :a_1, :endpoint1
12
12
  end
13
13
  alternative false do
14
- activity :a_2, :call, :endpoint1
14
+ call :a_2, :endpoint1
15
15
  end
16
16
  otherwise do
17
- activity :a_3, :call, :endpoint1
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
- activity :a_1, :call, :endpoint1
31
+ call :a_1, :endpoint1
32
32
  end
33
33
  otherwise do
34
- activity :a_2, :call, :endpoint1
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
- activity :a_1_1, :call, :endpoint1
49
+ call :a_1_1, :endpoint1
50
50
  end
51
51
  alternative true do
52
52
  choose do
53
53
  alternative false do
54
- activity :a_1_1_1, :call, :endpoint1
54
+ call :a_1_1_1, :endpoint1
55
55
  end
56
56
  otherwise do
57
- activity :a_1_1_2, :call, :endpoint1
57
+ call :a_1_1_2, :endpoint1
58
58
  end
59
59
  end
60
60
  end
61
61
  otherwise do
62
- activity :a_1_3, :call, :endpoint1
62
+ call :a_1_3, :endpoint1
63
63
  end
64
64
  end
65
65
  end
66
66
  otherwise do
67
- activity :a_2, :call, :endpoint1
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
- activity :a_test_1_1, :call, :endpoint1
10
- activity :a_test_1_2, :call, :endpoint1
11
- activity :a_test_1_3, :call, :endpoint1
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
- #def test_wfdescription_string
21
- # ret = @wf.description "activity :b_test_1_1, :call, :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
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
- activity :c_test_1_1, :call, :endpoint1
30
- activity :c_test_1_2, :call, :endpoint1
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!")
@@ -8,13 +8,13 @@ class TestParallel < Test::Unit::TestCase
8
8
  @wf.description do
9
9
  parallel do
10
10
  parallel_branch do
11
- activity :a_1, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
11
+ call :a_1, :endpoint1, :call => Proc.new{ sleep 0.5 }
12
12
  end
13
13
  parallel_branch do
14
- activity :a_2, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
14
+ call :a_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
15
15
  end
16
16
  parallel_branch do
17
- activity :a_3, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
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
- activity :a_1, :call, :endpoint1, :call => Proc.new{ sleep 0.2 }
35
+ call :a_1, :endpoint1, :call => Proc.new{ sleep 0.2 }
36
36
  end
37
37
  parallel_branch do
38
- activity :a_2, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
38
+ call :a_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
39
39
  end
40
40
  end
41
- activity :a_3, :call, :endpoint1
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
- activity :a_1, :call, :endpoint1
53
+ call :a_1, :endpoint1
54
54
  Thread.pass
55
55
  end
56
56
  parallel_branch do
57
- activity :a_2, :call, :endpoint1, :call => Proc.new{ sleep 8.5 }
57
+ call :a_2, :endpoint1, :call => Proc.new{ sleep 8.5 }
58
58
  end
59
59
  end
60
- activity :a_3, :call, :endpoint1
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
- activity :a_1, :call, :endpoint1, :call => Proc.new{ sleep 0.2 }
71
+ call :a_1, :endpoint1, :call => Proc.new{ sleep 0.2 }
72
72
  end
73
73
  parallel_branch do
74
- activity :a_2, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
75
- activity :a_2_2, :call, :endpoint1
74
+ call :a_2, :endpoint1, :call => Proc.new{ sleep 0.5 }
75
+ call :a_2_2, :endpoint1
76
76
  end
77
77
  end
78
- activity :a_3, :call, :endpoint1
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 activity :a_1, :call, :endpoint1 end
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 activity :a_2_1_1, :call, :endpoint1, :call => Proc.new {sleep 0.2} end
101
- parallel_branch do activity :a_2_1_2, :call, :endpoint1, :call => Proc.new {sleep 0.4} end
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
- activity :a_2_1_3, :call, :endpoint1, :call => Proc.new {sleep 0.8}
103
+ call :a_2_1_3, :endpoint1, :call => Proc.new {sleep 0.8}
104
104
  end
105
- parallel_branch do activity :a_2_2, :call, :endpoint1, :call => Proc.new {sleep 0.8} end
106
- parallel_branch do activity :a_2_3, :call, :endpoint1, :call => Proc.new {sleep 1.0} end
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
- activity :a_3, :call, :endpoint1
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)/)}
@@ -6,9 +6,9 @@ class TestSearch < Test::Unit::TestCase
6
6
 
7
7
  def test_search_impact_single
8
8
  @wf.description do
9
- activity :a1_1, :call, :endpoint1
10
- activity :a1_2, :call, :endpoint1
11
- activity :a1_3, :call, :endpoint1
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
- activity :a1, :call, :endpoint1
19
+ call :a1, :endpoint1
20
20
  parallel do
21
21
  parallel_branch do
22
- activity :a2_1, :call, :endpoint1
22
+ call :a2_1, :endpoint1
23
23
  end
24
24
  parallel_branch do
25
- activity :a2_2, :call, :endpoint1
25
+ call :a2_2, :endpoint1
26
26
  end
27
27
  end
28
- activity :a3, :call, :endpoint1
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
@@ -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
- #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
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
@@ -20,9 +20,9 @@ class TestWorkflowControl < Test::Unit::TestCase
20
20
 
21
21
  def test_stop
22
22
  @wf.description do
23
- activity :a_test_1_1, :call, :endpoint1
24
- activity :a_test_1_2, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
25
- activity :a_test_1_3, :call, :endpoint1
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
- activity :a_test_1_1, :call, :endpoint1
44
- activity :a_test_1_2, :call, :endpoint1, :call => Proc.new{ sleep 0.5 }
45
- activity :a_test_1_3, :call, :endpoint1
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
- activity :c_test_1_1, :call, :endpoint1
60
- activity :c_test_1_2, :call, :endpoint1
61
- activity :c_test_1_3, :call, :endpoint1
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
- activity :a1, :call, :endpoint1 do
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
- activity :a2, :call, :endpoint1 do
21
+ call :a2, :endpoint1 do
22
22
  data.hotels << 'Rathaus'
23
23
  data.costs += 200
24
24
  end
25
25
  end
26
- activity :a3, :manipulate do
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
- activity :a4, :call, :endpoint1
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
- activity :a1, :call, :endpoint1 do
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
- activity :a2, :call, :endpoint1 do
56
+ call :a2, :endpoint1 do
57
57
  data.hotels << 'Rathaus'
58
58
  data.costs += 200
59
59
  end
60
60
  end
61
- activity :a3, :manipulate do
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
- activity :a4, :call, :endpoint1
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
- activity :a1, :call, :endpoint1 do
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
- activity :a2, :call, :endpoint1 do
92
+ call :a2, :endpoint1 do
93
93
  data.hotels << 'Rathaus'
94
94
  data.costs += 200
95
95
  end
96
96
  end
97
- activity :a3, :manipulate do
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
- activity :a4, :call, :endpoint1
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
- activity :a1, :call, :endpoint1 do
13
+ call :a1, :endpoint1 do
14
14
  data.hotels << 'Rathaus'
15
15
  data.costs += 200
16
16
  end
17
- activity :a3, :call, :stop
17
+ call :a3, :stop
18
18
  end
19
19
  parallel_branch do
20
- activity :a2, :call, :endpoint2 do
20
+ call :a2, :endpoint2 do
21
21
  data.hotels << 'Graf Stadion'
22
22
  data.costs += 200
23
23
  end
24
- activity :a4, :call, :stop
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
@@ -9,28 +9,28 @@ class TestWFPGeneralSynchronizingMerge < Test::Unit::TestCase
9
9
  @wf.description do
10
10
  parallel do
11
11
  parallel_branch do
12
- activity :a1_1, :call, :endpoint1, :call => Proc.new{sleep 0.2}
12
+ call :a1_1, :endpoint1, :call => Proc.new{sleep 0.2}
13
13
  end
14
14
  parallel_branch do
15
- activity :a1_2, :call, :endpoint1, :call => Proc.new{sleep 0.4}
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
- activity :a2_1, :call, :endpoint1
21
+ call :a2_1, :endpoint1
22
22
  end
23
- activity(:a2_decide, :call, :endpoint1, :result => false) do |e|
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
- activity :a2_2, :call, :endpoint1, :call => Proc.new{sleep 0.1}
29
+ call :a2_2, :endpoint1, :call => Proc.new{sleep 0.1}
30
30
  end
31
31
  end
32
32
  end
33
- activity :a3, :call, :endpoint1
33
+ call :a3, :endpoint1
34
34
  end
35
35
  @wf.start.join
36
36
  wf_sassert('|running|Ca2_decideMa2_decideDa2_decide')