oflow 0.6.0 → 0.8.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.
- checksums.yaml +4 -4
- data/README.md +23 -41
- data/lib/oflow.rb +2 -3
- data/lib/oflow/actor.rb +3 -0
- data/lib/oflow/actors/httpserver.rb +3 -1
- data/lib/oflow/actors/log.rb +3 -2
- data/lib/oflow/actors/persister.rb +29 -6
- data/lib/oflow/actors/timer.rb +29 -12
- data/lib/oflow/box.rb +2 -2
- data/lib/oflow/env.rb +221 -15
- data/lib/oflow/flow.rb +217 -37
- data/lib/oflow/graffle.rb +293 -0
- data/lib/oflow/haserrorhandler.rb +3 -22
- data/lib/oflow/haslog.rb +21 -15
- data/lib/oflow/inspector.rb +18 -17
- data/lib/oflow/link.rb +11 -6
- data/lib/oflow/task.rb +134 -22
- data/lib/oflow/test/actorwrap.rb +1 -1
- data/lib/oflow/version.rb +1 -1
- data/test/actors/balancer_test.rb +17 -12
- data/test/actors/httpserver_test.rb +11 -10
- data/test/actors/log_test.rb +3 -6
- data/test/actors/merger_test.rb +23 -18
- data/test/actors/persister_test.rb +6 -8
- data/test/actors/timer_test.rb +63 -35
- data/test/actorwrap_test.rb +2 -6
- data/test/all_tests.rb +3 -7
- data/test/box_test.rb +4 -10
- data/test/flow_basic_test.rb +24 -22
- data/test/flow_cfg_error_test.rb +17 -13
- data/test/flow_linked_test.rb +146 -0
- data/test/flow_log_test.rb +43 -29
- data/test/flow_rescue_test.rb +41 -27
- data/test/flow_tracker_test.rb +26 -30
- data/test/helper.rb +15 -0
- data/test/task_test.rb +3 -7
- data/test/tracker_test.rb +3 -11
- metadata +5 -7
- data/lib/oflow/haslinks.rb +0 -68
- data/lib/oflow/hasname.rb +0 -31
- data/lib/oflow/hastasks.rb +0 -214
- data/test/flow_nest_test.rb +0 -215
data/test/actorwrap_test.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
|
5
|
-
File.join(File.dirname(__FILE__), "../lib")
|
6
|
-
].each { |path| $: << path unless $:.include?(path) }
|
7
|
-
|
8
|
-
require 'test/unit'
|
4
|
+
require 'helper'
|
9
5
|
require 'oflow'
|
10
6
|
require 'oflow/test'
|
11
7
|
|
@@ -24,7 +20,7 @@ class Nonsense < ::OFlow::Actor
|
|
24
20
|
|
25
21
|
end # Nonsense
|
26
22
|
|
27
|
-
class ActorWrapTest < ::Test
|
23
|
+
class ActorWrapTest < ::MiniTest::Test
|
28
24
|
|
29
25
|
def test_actorwrap
|
30
26
|
wrap = ::OFlow::Test::ActorWrap.new('wrapper', Nonsense)
|
data/test/all_tests.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
|
5
|
-
File.join(File.dirname(__FILE__), "../lib")
|
6
|
-
].each { |path| $: << path unless $:.include?(path) }
|
4
|
+
$: << File.dirname(__FILE__)
|
7
5
|
|
8
|
-
|
9
|
-
require 'test/unit'
|
6
|
+
require 'helper'
|
10
7
|
|
11
8
|
require 'box_test'
|
12
9
|
require 'task_test'
|
@@ -14,11 +11,10 @@ require 'tracker_test'
|
|
14
11
|
require 'actorwrap_test'
|
15
12
|
|
16
13
|
require 'flow_basic_test'
|
17
|
-
require 'flow_rescue_test'
|
18
14
|
require 'flow_log_test'
|
19
15
|
require 'flow_cfg_error_test'
|
20
16
|
require 'flow_rescue_test'
|
21
|
-
require '
|
17
|
+
require 'flow_linked_test'
|
22
18
|
require 'flow_tracker_test'
|
23
19
|
|
24
20
|
# Actor tests
|
data/test/box_test.rb
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
|
5
|
-
# required. That can be set in the RUBYOPT environment variable.
|
6
|
-
# export RUBYOPT=-w
|
4
|
+
$: << File.dirname(__FILE__)
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
$: << File.join(File.dirname(__FILE__), "../lib")
|
11
|
-
|
12
|
-
require 'test/unit'
|
6
|
+
require 'helper'
|
13
7
|
require 'oflow'
|
14
8
|
|
15
9
|
class Access
|
@@ -20,7 +14,7 @@ class Access
|
|
20
14
|
end
|
21
15
|
end # Access
|
22
16
|
|
23
|
-
class BoxTest < ::Test
|
17
|
+
class BoxTest < ::MiniTest::Test
|
24
18
|
|
25
19
|
def test_box_new
|
26
20
|
data = { a: [1, 'first'], b: true }
|
@@ -121,7 +115,7 @@ class BoxTest < ::Test::Unit::TestCase
|
|
121
115
|
assert_equal(nil, b2.get('f:0'), 'get f:0')
|
122
116
|
assert_equal('new', b2.get('f:1'), 'get f:1')
|
123
117
|
|
124
|
-
|
118
|
+
assert_raises(::OFlow::FrozenError) { box.set('d:x:1', 'three') }
|
125
119
|
end
|
126
120
|
|
127
121
|
end # BoxTest
|
data/test/flow_basic_test.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
|
5
|
-
File.join(File.dirname(__FILE__), "../lib")
|
6
|
-
].each { |path| $: << path unless $:.include?(path) }
|
4
|
+
$: << File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
|
7
5
|
|
8
|
-
require '
|
6
|
+
require 'helper'
|
9
7
|
require 'oflow'
|
10
8
|
|
11
9
|
require 'collector'
|
@@ -28,12 +26,13 @@ class Stutter < ::OFlow::Actor
|
|
28
26
|
|
29
27
|
end # Stutter
|
30
28
|
|
31
|
-
class FlowBasicTest < ::Test
|
29
|
+
class FlowBasicTest < ::MiniTest::Test
|
32
30
|
|
33
31
|
def test_flow_basic
|
32
|
+
env = ::OFlow::Env.new('')
|
34
33
|
trigger = nil
|
35
34
|
collector = nil
|
36
|
-
|
35
|
+
env.flow('basic') { |f|
|
37
36
|
# collects results
|
38
37
|
f.task(:collector, Collector) { |t|
|
39
38
|
collector = t.actor
|
@@ -51,43 +50,46 @@ class FlowBasicTest < ::Test::Unit::TestCase
|
|
51
50
|
}
|
52
51
|
f.task(:ignore, ::OFlow::Actors::Ignore)
|
53
52
|
}
|
53
|
+
env.prepare()
|
54
|
+
env.start()
|
55
|
+
|
54
56
|
# see if the flow was constructed correctly
|
55
|
-
assert_equal(%|OFlow::Env {
|
57
|
+
assert_equal(%| (OFlow::Env) {
|
56
58
|
basic (OFlow::Flow) {
|
57
59
|
collector (Collector) {
|
58
60
|
}
|
59
61
|
trigger (Stutter) {
|
60
|
-
collector => collector:trigger
|
61
|
-
once => dub:twice
|
62
|
+
collector => :collector:trigger
|
63
|
+
once => :dub:twice
|
62
64
|
}
|
63
65
|
dub (Stutter) {
|
64
|
-
collector => collector:dub
|
65
|
-
twice => dub:once
|
66
|
-
once => ignore:
|
66
|
+
collector => :collector:dub
|
67
|
+
twice => :dub:once
|
68
|
+
once => :ignore:
|
67
69
|
}
|
68
70
|
ignore (OFlow::Actors::Ignore) {
|
69
71
|
}
|
70
72
|
}
|
71
|
-
}|,
|
73
|
+
}|, env.describe())
|
72
74
|
|
73
75
|
# run it and check the output
|
74
76
|
trigger.receive(:once, ::OFlow::Box.new(7))
|
75
|
-
|
76
|
-
assert_equal([['
|
77
|
-
['
|
78
|
-
['
|
77
|
+
env.flush()
|
78
|
+
assert_equal([['basic:trigger', :once, 7],
|
79
|
+
['basic:dub', :twice, 7],
|
80
|
+
['basic:dub', :once, 7, 'with_link'],
|
79
81
|
], collector.collection)
|
80
82
|
|
81
83
|
# run again and make sure all tasks use links
|
82
84
|
collector.collection = []
|
83
85
|
trigger.receive(:once, ::OFlow::Box.new(7))
|
84
|
-
|
85
|
-
assert_equal([['
|
86
|
-
['
|
87
|
-
['
|
86
|
+
env.flush()
|
87
|
+
assert_equal([['basic:trigger', :once, 7, 'with_link'],
|
88
|
+
['basic:dub', :twice, 7, 'with_link'],
|
89
|
+
['basic:dub', :once, 7, 'with_link'],
|
88
90
|
], collector.collection)
|
89
91
|
|
90
|
-
|
92
|
+
env.clear()
|
91
93
|
end
|
92
94
|
|
93
95
|
end # FlowBasicTest
|
data/test/flow_cfg_error_test.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
|
5
|
-
File.join(File.dirname(__FILE__), "../lib")
|
6
|
-
].each { |path| $: << path unless $:.include?(path) }
|
4
|
+
$: << File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
|
7
5
|
|
8
|
-
require '
|
6
|
+
require 'helper'
|
9
7
|
require 'oflow'
|
10
8
|
|
11
9
|
require 'collector'
|
@@ -49,11 +47,12 @@ class Miss < ::OFlow::Actor
|
|
49
47
|
|
50
48
|
end # Miss
|
51
49
|
|
52
|
-
class FlowCfgErrTest < ::Test
|
50
|
+
class FlowCfgErrTest < ::MiniTest::Test
|
53
51
|
|
54
52
|
def test_flow_link_unresolved
|
55
53
|
begin
|
56
|
-
::OFlow::Env.
|
54
|
+
env = ::OFlow::Env.new('')
|
55
|
+
env.flow('unresolved') { |f|
|
57
56
|
f.task(:one, Dummy) { |t|
|
58
57
|
t.link(:two, :two, nil)
|
59
58
|
}
|
@@ -61,17 +60,20 @@ class FlowCfgErrTest < ::Test::Unit::TestCase
|
|
61
60
|
t.link(:second, :two, nil)
|
62
61
|
}
|
63
62
|
}
|
63
|
+
env.prepare()
|
64
|
+
env.start()
|
64
65
|
assert(false, "expected a ValidateError")
|
65
66
|
rescue ::OFlow::ValidateError => ve
|
66
|
-
assert_equal(["
|
67
|
-
"
|
67
|
+
assert_equal(["unresolved:one: Failed to find task 'two'.",
|
68
|
+
"unresolved:three: Failed to find task 'two'."], ve.problems.map { |p| p.to_s })
|
68
69
|
end
|
69
|
-
|
70
|
+
env.clear()
|
70
71
|
end
|
71
72
|
|
72
73
|
def test_flow_link_missing
|
74
|
+
env = ::OFlow::Env.new('')
|
73
75
|
begin
|
74
|
-
|
76
|
+
env.flow('miss-me') { |f|
|
75
77
|
f.task(:sort, Miss) { |t|
|
76
78
|
t.link(:fixnum, :fix, nil)
|
77
79
|
}
|
@@ -80,12 +82,14 @@ class FlowCfgErrTest < ::Test::Unit::TestCase
|
|
80
82
|
t.link(:wrong, :sort, :complex)
|
81
83
|
}
|
82
84
|
}
|
85
|
+
env.prepare()
|
86
|
+
env.start()
|
83
87
|
assert(false, "expected a ValidateError")
|
84
88
|
rescue ::OFlow::ValidateError => ve
|
85
|
-
assert_equal(["
|
86
|
-
"
|
89
|
+
assert_equal(["miss-me:sort: Missing link for 'float'.",
|
90
|
+
"miss-me:fix: 'complex' not allowed on 'miss-me:sort'."], ve.problems.map { |p| p.to_s })
|
87
91
|
end
|
88
|
-
|
92
|
+
env.clear()
|
89
93
|
end
|
90
94
|
|
91
95
|
# TBD missing links for output spec
|
@@ -0,0 +1,146 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
$: << File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
|
5
|
+
|
6
|
+
require 'helper'
|
7
|
+
require 'oflow'
|
8
|
+
|
9
|
+
require 'collector'
|
10
|
+
|
11
|
+
class Hop < ::OFlow::Actor
|
12
|
+
|
13
|
+
def initialize(task, options)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def perform(op, box)
|
18
|
+
task.warn("#{op} #{box.contents}")
|
19
|
+
task.ship(op, box)
|
20
|
+
end
|
21
|
+
|
22
|
+
end # Hop
|
23
|
+
|
24
|
+
class FlowLinkedTest < ::MiniTest::Test
|
25
|
+
|
26
|
+
def test_flow_linked
|
27
|
+
env = ::OFlow::Env.new('')
|
28
|
+
env.log = ::OFlow::Task.new(env, :log, Collector)
|
29
|
+
trigger = nil
|
30
|
+
|
31
|
+
env.flow(:prime) { |f|
|
32
|
+
# starts off the process
|
33
|
+
trigger = f.task(:trigger, Hop) { |t|
|
34
|
+
t.link(nil, :one, nil, :linked)
|
35
|
+
}
|
36
|
+
f.task(:in, Hop) { |t|
|
37
|
+
t.link(nil, :done, nil)
|
38
|
+
}
|
39
|
+
f.task(:done, ::OFlow::Actors::Ignore)
|
40
|
+
}
|
41
|
+
env.flow(:linked) { |f|
|
42
|
+
f.task(:one, Hop) { |t|
|
43
|
+
t.link(nil, :two, nil)
|
44
|
+
}
|
45
|
+
f.task(:two, Hop) { |t|
|
46
|
+
t.link(nil, :in, :bye, :prime)
|
47
|
+
}
|
48
|
+
}
|
49
|
+
env.prepare()
|
50
|
+
env.start()
|
51
|
+
|
52
|
+
# see if the flow was constructed correctly
|
53
|
+
assert_equal(%| (OFlow::Env) {
|
54
|
+
prime (OFlow::Flow) {
|
55
|
+
trigger (Hop) {
|
56
|
+
=> linked:one:
|
57
|
+
}
|
58
|
+
in (Hop) {
|
59
|
+
=> :done:
|
60
|
+
}
|
61
|
+
done (OFlow::Actors::Ignore) {
|
62
|
+
}
|
63
|
+
}
|
64
|
+
linked (OFlow::Flow) {
|
65
|
+
one (Hop) {
|
66
|
+
=> :two:
|
67
|
+
}
|
68
|
+
two (Hop) {
|
69
|
+
=> prime:in:bye
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}|, env.describe())
|
73
|
+
|
74
|
+
# run it and check the output
|
75
|
+
trigger.receive(:go, ::OFlow::Box.new(7))
|
76
|
+
env.flush()
|
77
|
+
assert_equal([['go 7', 'prime:trigger'],
|
78
|
+
[' 7', 'linked:one'],
|
79
|
+
[' 7', 'linked:two'],
|
80
|
+
['bye 7', 'prime:in']
|
81
|
+
], env.log.actor.collection)
|
82
|
+
|
83
|
+
env.clear()
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_flow_linked_label
|
87
|
+
env = ::OFlow::Env.new('')
|
88
|
+
env.log = ::OFlow::Task.new(env, :log, Collector)
|
89
|
+
trigger = nil
|
90
|
+
|
91
|
+
env.flow(:prime) { |f|
|
92
|
+
# starts off the process
|
93
|
+
trigger = f.task(:trigger, Hop) { |t|
|
94
|
+
t.link(:go, :one, :hip, :linked)
|
95
|
+
}
|
96
|
+
f.task(:in, Hop) { |t|
|
97
|
+
t.link(:bye, :done, nil)
|
98
|
+
}
|
99
|
+
f.task(:done, ::OFlow::Actors::Ignore)
|
100
|
+
}
|
101
|
+
env.flow(:linked) { |f|
|
102
|
+
f.task(:one, Hop) { |t|
|
103
|
+
t.link(:hip, :two, :hop)
|
104
|
+
}
|
105
|
+
f.task(:two, Hop) { |t|
|
106
|
+
t.link(:hop, :in, :bye, :prime)
|
107
|
+
}
|
108
|
+
}
|
109
|
+
env.prepare()
|
110
|
+
env.start()
|
111
|
+
|
112
|
+
# see if the flow was constructed correctly
|
113
|
+
assert_equal(%| (OFlow::Env) {
|
114
|
+
prime (OFlow::Flow) {
|
115
|
+
trigger (Hop) {
|
116
|
+
go => linked:one:hip
|
117
|
+
}
|
118
|
+
in (Hop) {
|
119
|
+
bye => :done:
|
120
|
+
}
|
121
|
+
done (OFlow::Actors::Ignore) {
|
122
|
+
}
|
123
|
+
}
|
124
|
+
linked (OFlow::Flow) {
|
125
|
+
one (Hop) {
|
126
|
+
hip => :two:hop
|
127
|
+
}
|
128
|
+
two (Hop) {
|
129
|
+
hop => prime:in:bye
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}|, env.describe())
|
133
|
+
|
134
|
+
# run it and check the output
|
135
|
+
trigger.receive(:go, ::OFlow::Box.new(7))
|
136
|
+
env.flush()
|
137
|
+
assert_equal([['go 7', 'prime:trigger'],
|
138
|
+
['hip 7', 'linked:one'],
|
139
|
+
['hop 7', 'linked:two'],
|
140
|
+
['bye 7', 'prime:in']
|
141
|
+
], env.log.actor.collection)
|
142
|
+
|
143
|
+
env.clear()
|
144
|
+
end
|
145
|
+
|
146
|
+
end # FlowLinkedTest
|
data/test/flow_log_test.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
|
5
|
-
File.join(File.dirname(__FILE__), "../lib")
|
6
|
-
].each { |path| $: << path unless $:.include?(path) }
|
4
|
+
$: << File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
|
7
5
|
|
8
|
-
require '
|
6
|
+
require 'helper'
|
9
7
|
require 'oflow'
|
10
8
|
|
11
9
|
require 'collector'
|
@@ -23,89 +21,105 @@ class Noise < ::OFlow::Actor
|
|
23
21
|
|
24
22
|
end # Noise
|
25
23
|
|
26
|
-
class FlowLogTest < ::Test
|
24
|
+
class FlowLogTest < ::MiniTest::Test
|
27
25
|
|
28
26
|
# Make sure the log works and relays to a log task if it exists.
|
29
27
|
def test_flow_log_relay
|
28
|
+
env = ::OFlow::Env.new('')
|
30
29
|
trigger = nil
|
31
30
|
collector = nil
|
32
31
|
::OFlow::Env.log_level = Logger::WARN
|
33
|
-
|
32
|
+
env.flow('log_relay') { |f|
|
34
33
|
trigger = f.task('noise', Noise)
|
35
34
|
f.task(:log, Collector) { |t|
|
36
35
|
collector = t.actor
|
37
36
|
}
|
38
37
|
}
|
38
|
+
env.prepare()
|
39
|
+
env.start()
|
40
|
+
|
39
41
|
trigger.receive(:speak, ::OFlow::Box.new(7))
|
40
|
-
|
42
|
+
env.flush()
|
41
43
|
|
42
|
-
assert_equal(collector.collection.size
|
43
|
-
assert_equal(
|
44
|
-
assert_equal(collector.collection[0][1]
|
44
|
+
assert_equal(1, collector.collection.size)
|
45
|
+
assert_equal('op: speak, box: 7', collector.collection[0][0])
|
46
|
+
assert_equal('log_relay:noise', collector.collection[0][1])
|
45
47
|
|
46
|
-
|
48
|
+
env.clear()
|
47
49
|
end
|
48
50
|
|
49
51
|
# Make sure the log in the flow var is used.
|
50
52
|
def test_flow_log_var
|
53
|
+
env = ::OFlow::Env.new('')
|
51
54
|
trigger = nil
|
52
55
|
collector = nil
|
53
56
|
::OFlow::Env.log_level = Logger::WARN
|
54
|
-
|
57
|
+
env.flow('log_var') { |f|
|
55
58
|
trigger = f.task('noise', Noise)
|
56
59
|
f.log = f.task(:collector, Collector) { |t|
|
57
60
|
collector = t.actor
|
58
61
|
}
|
59
62
|
}
|
63
|
+
env.prepare()
|
64
|
+
env.start()
|
65
|
+
|
60
66
|
trigger.receive(:speak, ::OFlow::Box.new(7))
|
61
|
-
|
67
|
+
env.flush()
|
62
68
|
|
63
|
-
assert_equal(collector.collection.size
|
64
|
-
assert_equal(
|
65
|
-
assert_equal(collector.collection[0][1]
|
69
|
+
assert_equal(1, collector.collection.size)
|
70
|
+
assert_equal('op: speak, box: 7', collector.collection[0][0])
|
71
|
+
assert_equal('log_var:noise', collector.collection[0][1])
|
66
72
|
|
67
|
-
|
73
|
+
env.clear()
|
68
74
|
end
|
69
75
|
|
70
76
|
# Make sure the log in the Env var is used.
|
71
77
|
def test_flow_log_env
|
78
|
+
env = ::OFlow::Env.new('')
|
72
79
|
trigger = nil
|
73
80
|
collector = nil
|
74
81
|
::OFlow::Env.log_level = Logger::WARN
|
75
|
-
|
82
|
+
env.flow('log_env') { |f|
|
76
83
|
trigger = f.task('noise', Noise)
|
77
|
-
|
84
|
+
env.log = f.task(:collector, Collector) { |t|
|
78
85
|
collector = t.actor
|
79
86
|
}
|
80
87
|
}
|
88
|
+
env.prepare()
|
89
|
+
env.start()
|
90
|
+
|
81
91
|
trigger.receive(:speak, ::OFlow::Box.new(7))
|
82
|
-
|
92
|
+
env.flush()
|
83
93
|
|
84
|
-
assert_equal(collector.collection.size
|
85
|
-
assert_equal(
|
86
|
-
assert_equal(collector.collection[0][1]
|
94
|
+
assert_equal(1, collector.collection.size)
|
95
|
+
assert_equal('op: speak, box: 7', collector.collection[0][0])
|
96
|
+
assert_equal('log_env:noise', collector.collection[0][1])
|
87
97
|
|
88
|
-
|
98
|
+
env.clear()
|
89
99
|
end
|
90
100
|
|
91
|
-
def
|
101
|
+
def test_flow_log_debug
|
102
|
+
env = ::OFlow::Env.new('')
|
92
103
|
trigger = nil
|
93
104
|
collector = nil
|
94
105
|
::OFlow::Env.log_level = Logger::WARN
|
95
|
-
|
106
|
+
env.flow('log_info') { |f|
|
96
107
|
f.log = f.task(:collector, Collector) { |t|
|
97
108
|
collector = t.actor
|
98
109
|
}
|
99
110
|
# Set after log to avoid race condition with the creation of the collector
|
100
111
|
# and the assignment to f.log. The race is whether a log message is
|
101
112
|
# displayed on the output.
|
102
|
-
|
113
|
+
::OFlow::Env.log_level = Logger::DEBUG
|
103
114
|
trigger = f.task('noise', Noise) { |t|
|
104
115
|
t.link(nil, :collector, nil)
|
105
116
|
}
|
106
117
|
}
|
118
|
+
env.prepare()
|
119
|
+
env.start()
|
120
|
+
|
107
121
|
trigger.receive(:speak, ::OFlow::Box.new(7))
|
108
|
-
|
122
|
+
env.flush()
|
109
123
|
|
110
124
|
entries = collector.collection.map { |entry| entry[0] }
|
111
125
|
assert_equal(["Creating actor Noise with options {:state=>1}.",
|
@@ -115,7 +129,7 @@ class FlowLogTest < ::Test::Unit::TestCase
|
|
115
129
|
"shipping Box{[7]} to collector:",
|
116
130
|
7], entries)
|
117
131
|
|
118
|
-
|
132
|
+
env.clear()
|
119
133
|
::OFlow::Env.log_level = Logger::WARN
|
120
134
|
end
|
121
135
|
|