openwferu 0.9.2 → 0.9.3
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/examples/mano_tracker.rb +165 -0
- data/examples/scheduler_cron_usage.rb +46 -0
- data/examples/scheduler_usage.rb +54 -0
- data/lib/openwfe/contextual.rb +7 -1
- data/lib/openwfe/engine/engine.rb +58 -15
- data/lib/openwfe/expool/expressionpool.rb +116 -14
- data/lib/openwfe/expool/expstorage.rb +12 -12
- data/lib/openwfe/expool/journalexpstorage.rb +1 -1
- data/lib/openwfe/expool/yamlexpstorage.rb +58 -22
- data/lib/openwfe/expressions/environment.rb +32 -2
- data/lib/openwfe/expressions/expressionmap.rb +17 -0
- data/lib/openwfe/expressions/fe_condition.rb +122 -0
- data/lib/openwfe/expressions/fe_cursor.rb +14 -5
- data/lib/openwfe/expressions/fe_participant.rb +55 -4
- data/lib/openwfe/expressions/fe_raw.rb +43 -12
- data/lib/openwfe/expressions/fe_subprocess.rb +10 -0
- data/lib/openwfe/expressions/fe_time.rb +117 -22
- data/lib/openwfe/expressions/fe_value.rb +27 -8
- data/lib/openwfe/expressions/flowexpression.rb +13 -6
- data/lib/openwfe/expressions/raw_prog.rb +13 -11
- data/lib/openwfe/expressions/timeout.rb +94 -0
- data/lib/openwfe/flowexpressionid.rb +17 -19
- data/lib/openwfe/logging.rb +35 -16
- data/lib/openwfe/participants/atomparticipants.rb +31 -7
- data/lib/openwfe/participants/enoparticipant.rb +43 -3
- data/lib/openwfe/participants/participant.rb +21 -1
- data/lib/openwfe/participants/participantmap.rb +4 -2
- data/lib/openwfe/participants/participants.rb +12 -17
- data/lib/openwfe/participants/soapparticipants.rb +15 -3
- data/lib/openwfe/rudefinitions.rb +3 -0
- data/lib/openwfe/service.rb +8 -0
- data/lib/openwfe/storage/yamlfilestorage.rb +85 -47
- data/lib/openwfe/{otime.rb → util/otime.rb} +0 -0
- data/lib/openwfe/util/scheduler.rb +415 -231
- data/lib/openwfe/util/schedulers.rb +11 -3
- data/lib/openwfe/util/stoppable.rb +69 -0
- data/lib/openwfe/utils.rb +14 -25
- data/lib/openwfe/workitem.rb +12 -6
- data/lib/openwfe/worklist/storeparticipant.rb +145 -0
- data/test/{atomtest.rb → atom_test.rb} +0 -0
- data/test/{crontest.rb → cron_test.rb} +7 -6
- data/test/cronline_test.rb +51 -0
- data/test/{dollartest.rb → dollar_test.rb} +0 -0
- data/test/{feitest.rb → fei_test.rb} +0 -0
- data/test/file_persistence_test.rb +15 -9
- data/test/flowtestbase.rb +11 -5
- data/test/ft_0.rb +8 -0
- data/test/ft_10_loop.rb +72 -10
- data/test/ft_11_ppd.rb +49 -0
- data/test/ft_17_condition.rb +83 -0
- data/test/ft_18_pname.rb +59 -0
- data/test/hparticipant_test.rb +96 -0
- data/test/{misctest.rb → misc_test.rb} +1 -1
- data/test/rake_qtest.rb +10 -4
- data/test/rake_test.rb +12 -1
- data/test/raw_prog_test.rb +1 -1
- data/test/restart_cron_test.rb +78 -0
- data/test/restart_test.rb +79 -0
- data/test/scheduler_test.rb +92 -0
- data/test/{timetest.rb → time_test.rb} +3 -38
- data/test/timeout_test.rb +73 -0
- metadata +26 -11
- data/lib/openwfe/worklist/worklists.rb +0 -175
data/test/rake_qtest.rb
CHANGED
@@ -11,12 +11,13 @@
|
|
11
11
|
File.delete('engine.log') \
|
12
12
|
if File.exist? 'engine.log'
|
13
13
|
|
14
|
-
require '
|
15
|
-
require '
|
16
|
-
require '
|
17
|
-
require '
|
14
|
+
require 'fei_test'
|
15
|
+
require 'dollar_test'
|
16
|
+
require 'misc_test'
|
17
|
+
require 'time_test'
|
18
18
|
require 'raw_prog_test'
|
19
19
|
require 'file_persistence_test'
|
20
|
+
require 'cronline_test'
|
20
21
|
|
21
22
|
#require 'journal_persistence_test'
|
22
23
|
#
|
@@ -40,4 +41,9 @@ require 'ft_14_subprocess'
|
|
40
41
|
require 'ft_14b_subprocess'
|
41
42
|
require 'ft_15_iterator'
|
42
43
|
require 'ft_16_fqv'
|
44
|
+
require 'ft_17_condition'
|
45
|
+
require 'ft_18_pname'
|
46
|
+
|
47
|
+
require 'hparticipant_test'
|
48
|
+
require 'timeout_test'
|
43
49
|
|
data/test/rake_test.rb
CHANGED
@@ -8,7 +8,18 @@
|
|
8
8
|
|
9
9
|
#require 'test/unit'
|
10
10
|
|
11
|
+
#
|
12
|
+
# the tests that take lots of time...
|
13
|
+
#
|
11
14
|
require 'ft_5_time'
|
12
|
-
require '
|
15
|
+
require 'scheduler_test'
|
16
|
+
require 'cron_test'
|
17
|
+
|
18
|
+
require 'restart_test'
|
19
|
+
require 'restart_cron_test'
|
20
|
+
|
21
|
+
#
|
22
|
+
# the quick tests
|
23
|
+
#
|
13
24
|
require 'rake_qtest'
|
14
25
|
|
data/test/raw_prog_test.rb
CHANGED
@@ -175,7 +175,7 @@ class RawProgTest < Test::Unit::TestCase
|
|
175
175
|
CODE_DEF3 = """
|
176
176
|
process_definition :name => 'test3', :revision => '0' do
|
177
177
|
_if do
|
178
|
-
equals :
|
178
|
+
equals :field_value => 'nada', :other_value => 'surf'
|
179
179
|
participant :ref => 'b'
|
180
180
|
end
|
181
181
|
end""".strip
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#
|
2
|
+
# Testing OpenWFE
|
3
|
+
#
|
4
|
+
# John Mettraux at openwfe.org
|
5
|
+
#
|
6
|
+
# Sun Oct 29 15:41:44 JST 2006
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
|
11
|
+
require 'openwfe/workitem'
|
12
|
+
require 'openwfe/engine/file_persisted_engine'
|
13
|
+
require 'openwfe/expressions/raw_prog'
|
14
|
+
|
15
|
+
require 'rutest_utils'
|
16
|
+
|
17
|
+
include OpenWFE
|
18
|
+
|
19
|
+
|
20
|
+
class RestartTest < Test::Unit::TestCase
|
21
|
+
|
22
|
+
#def setup
|
23
|
+
# @engine = $WORKFLOW_ENGINE_CLASS.new()
|
24
|
+
#end
|
25
|
+
|
26
|
+
#def teardown
|
27
|
+
#end
|
28
|
+
|
29
|
+
class RestartDefinition0 < ProcessDefinition
|
30
|
+
def make
|
31
|
+
process_definition :name => "rs0", :revision => "0" do
|
32
|
+
cron :tab => "* * * * *", :name => "//cron" do
|
33
|
+
participant :cron_event
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_restart_0
|
40
|
+
|
41
|
+
engine = FilePersistedEngine.new
|
42
|
+
|
43
|
+
count = 0
|
44
|
+
|
45
|
+
participant = lambda do
|
46
|
+
#puts "______________________ :cron_event"
|
47
|
+
count = count + 1
|
48
|
+
end
|
49
|
+
|
50
|
+
engine.register_participant(:cron_event, &participant)
|
51
|
+
|
52
|
+
engine.launch(RestartDefinition0)
|
53
|
+
|
54
|
+
sleep(60)
|
55
|
+
|
56
|
+
engine.stop()
|
57
|
+
|
58
|
+
#puts "___restarting to new engine"
|
59
|
+
|
60
|
+
old_engine = engine
|
61
|
+
engine = FilePersistedEngine.new
|
62
|
+
|
63
|
+
engine.register_participant(:cron_event, &participant)
|
64
|
+
|
65
|
+
sleep(60)
|
66
|
+
|
67
|
+
engine.stop()
|
68
|
+
|
69
|
+
#puts "_count : #{count}"
|
70
|
+
|
71
|
+
assert \
|
72
|
+
count == 2,
|
73
|
+
"the cron expression should have counted to 2, "+
|
74
|
+
"but it counted to #{count}"
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#
|
2
|
+
# Testing OpenWFE
|
3
|
+
#
|
4
|
+
# John Mettraux at openwfe.org
|
5
|
+
#
|
6
|
+
# Sun Oct 29 15:41:44 JST 2006
|
7
|
+
#
|
8
|
+
# somewhere between Philippina and the Japan
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
require 'openwfe/workitem'
|
14
|
+
require 'openwfe/engine/file_persisted_engine'
|
15
|
+
require 'openwfe/expressions/raw_prog'
|
16
|
+
|
17
|
+
require 'rutest_utils'
|
18
|
+
|
19
|
+
include OpenWFE
|
20
|
+
|
21
|
+
|
22
|
+
class RestartTest < Test::Unit::TestCase
|
23
|
+
|
24
|
+
#def setup
|
25
|
+
# @engine = $WORKFLOW_ENGINE_CLASS.new()
|
26
|
+
#end
|
27
|
+
|
28
|
+
#def teardown
|
29
|
+
#end
|
30
|
+
|
31
|
+
class RestartDefinition0 < ProcessDefinition
|
32
|
+
def make
|
33
|
+
process_definition :name => "rs0", :revision => "0" do
|
34
|
+
sequence do
|
35
|
+
_sleep :for => "10s"
|
36
|
+
_print "after"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_restart_0
|
43
|
+
engine = new_engine
|
44
|
+
|
45
|
+
li = LaunchItem.new(RestartDefinition0)
|
46
|
+
|
47
|
+
engine.launch(li)
|
48
|
+
|
49
|
+
sleep(1)
|
50
|
+
|
51
|
+
engine.stop()
|
52
|
+
|
53
|
+
$OWFE_LOG.warn "stopped the engine"
|
54
|
+
|
55
|
+
old_engine = engine
|
56
|
+
engine = new_engine
|
57
|
+
|
58
|
+
$OWFE_LOG.warn "started the new engine"
|
59
|
+
|
60
|
+
sleep(11)
|
61
|
+
#sleep(21)
|
62
|
+
|
63
|
+
s_old = old_engine.application_context["__tracer"].to_s
|
64
|
+
s_now = engine.application_context["__tracer"].to_s
|
65
|
+
|
66
|
+
assert (s_old == "" and s_now == "after")
|
67
|
+
end
|
68
|
+
|
69
|
+
protected
|
70
|
+
|
71
|
+
def new_engine
|
72
|
+
engine = FilePersistedEngine.new()
|
73
|
+
tracer = Tracer.new
|
74
|
+
engine.application_context["__tracer"] = tracer
|
75
|
+
return engine
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
@@ -0,0 +1,92 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Sun Oct 29 16:18:25 JST 2006
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
#require 'openwfe/otime'
|
12
|
+
require 'openwfe/util/scheduler'
|
13
|
+
|
14
|
+
#
|
15
|
+
# testing otime and the scheduler
|
16
|
+
#
|
17
|
+
|
18
|
+
class SchedulerTest < Test::Unit::TestCase
|
19
|
+
|
20
|
+
#def setup
|
21
|
+
#end
|
22
|
+
|
23
|
+
#def teardown
|
24
|
+
#end
|
25
|
+
|
26
|
+
def test_scheduler_0
|
27
|
+
|
28
|
+
$var = nil
|
29
|
+
|
30
|
+
scheduler = OpenWFE::Scheduler.new()
|
31
|
+
scheduler.start
|
32
|
+
|
33
|
+
sid = scheduler.schedule_in('2s', TestSchedulable.new, nil)
|
34
|
+
|
35
|
+
assert \
|
36
|
+
sid,
|
37
|
+
"scheduler_0 did not return a job id"
|
38
|
+
|
39
|
+
assert \
|
40
|
+
(not $var),
|
41
|
+
"scheduler_0 is blocking but should not"
|
42
|
+
|
43
|
+
sleep(2.5)
|
44
|
+
scheduler.do_stop
|
45
|
+
|
46
|
+
#puts ">#{$var}<"
|
47
|
+
|
48
|
+
assert \
|
49
|
+
($var == "ok"),
|
50
|
+
"scheduler_0 didn't work"
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_scheduler_1
|
54
|
+
|
55
|
+
$var = nil
|
56
|
+
|
57
|
+
scheduler = OpenWFE::Scheduler.new()
|
58
|
+
scheduler.start
|
59
|
+
|
60
|
+
sid = scheduler.schedule_in('1s') do
|
61
|
+
$var = "ok..1"
|
62
|
+
end
|
63
|
+
|
64
|
+
assert \
|
65
|
+
sid,
|
66
|
+
"scheduler_1 did not return a job id"
|
67
|
+
|
68
|
+
assert \
|
69
|
+
(not $var),
|
70
|
+
"scheduler_1 is blocking but should not"
|
71
|
+
|
72
|
+
sleep(2)
|
73
|
+
scheduler.do_stop
|
74
|
+
|
75
|
+
#puts ">#{$var}<"
|
76
|
+
|
77
|
+
assert \
|
78
|
+
($var == "ok..1"),
|
79
|
+
"scheduler_1 didn't work"
|
80
|
+
end
|
81
|
+
|
82
|
+
protected
|
83
|
+
|
84
|
+
class TestSchedulable
|
85
|
+
include OpenWFE::Schedulable
|
86
|
+
|
87
|
+
def trigger (params)
|
88
|
+
$var = "ok"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -8,8 +8,8 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'test/unit'
|
11
|
-
|
12
|
-
require 'openwfe/util/
|
11
|
+
|
12
|
+
require 'openwfe/util/otime'
|
13
13
|
|
14
14
|
#
|
15
15
|
# testing otime and the scheduler
|
@@ -24,7 +24,7 @@ class TimeTest < Test::Unit::TestCase
|
|
24
24
|
#end
|
25
25
|
|
26
26
|
#def test_to_iso_date
|
27
|
-
def
|
27
|
+
def XXXX_to_iso_date
|
28
28
|
#
|
29
29
|
# well... this test is not timezone friendly...
|
30
30
|
# commented out thus...
|
@@ -72,43 +72,8 @@ class TimeTest < Test::Unit::TestCase
|
|
72
72
|
pts("1h10s", 3610.0)
|
73
73
|
end
|
74
74
|
|
75
|
-
def test_scheduler_0
|
76
|
-
|
77
|
-
$var = nil
|
78
|
-
|
79
|
-
scheduler = OpenWFE::Scheduler.new()
|
80
|
-
scheduler.start
|
81
|
-
|
82
|
-
sid = scheduler.schedule_in('2s', TestSchedulable.new, nil)
|
83
|
-
|
84
|
-
assert \
|
85
|
-
sid,
|
86
|
-
"scheduler did not return a job id"
|
87
|
-
|
88
|
-
assert \
|
89
|
-
(not $var),
|
90
|
-
"scheduler_0 is blocking but should not"
|
91
|
-
|
92
|
-
sleep(2.5)
|
93
|
-
scheduler.stop
|
94
|
-
|
95
|
-
#puts ">#{$var}<"
|
96
|
-
|
97
|
-
assert \
|
98
|
-
($var == "ok"),
|
99
|
-
"scheduler_0 didn't work"
|
100
|
-
end
|
101
|
-
|
102
75
|
protected
|
103
76
|
|
104
|
-
class TestSchedulable
|
105
|
-
include OpenWFE::Schedulable
|
106
|
-
|
107
|
-
def trigger (params)
|
108
|
-
$var = "ok"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
77
|
def pts (time_string, seconds)
|
113
78
|
|
114
79
|
assert \
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Testing OpenWFE
|
3
|
+
#
|
4
|
+
# John Mettraux at openwfe.org
|
5
|
+
#
|
6
|
+
# Sun Oct 29 15:41:44 JST 2006
|
7
|
+
#
|
8
|
+
# somewhere between Philippina and the Japan
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
#require 'openwfe/workitem'
|
14
|
+
require 'openwfe/engine/engine'
|
15
|
+
require 'openwfe/expressions/raw_prog'
|
16
|
+
require 'openwfe/worklist/storeparticipant'
|
17
|
+
|
18
|
+
require 'rutest_utils'
|
19
|
+
|
20
|
+
include OpenWFE
|
21
|
+
|
22
|
+
|
23
|
+
class TimeoutTest < Test::Unit::TestCase
|
24
|
+
|
25
|
+
#def setup
|
26
|
+
# @engine = $WORKFLOW_ENGINE_CLASS.new()
|
27
|
+
#end
|
28
|
+
|
29
|
+
#def teardown
|
30
|
+
#end
|
31
|
+
|
32
|
+
class TimeoutDefinition0 < ProcessDefinition
|
33
|
+
def make
|
34
|
+
process_definition :name => "to0", :revision => "0" do
|
35
|
+
sequence do
|
36
|
+
participant :ref => "albert", :timeout => "500"
|
37
|
+
_print "over"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_timeout_0
|
44
|
+
|
45
|
+
albert = HashParticipant.new
|
46
|
+
|
47
|
+
engine = Engine.new
|
48
|
+
|
49
|
+
engine.application_context["__tracer"] = Tracer.new
|
50
|
+
|
51
|
+
engine.register_participant(:albert, albert)
|
52
|
+
|
53
|
+
li = LaunchItem.new(TimeoutDefinition0)
|
54
|
+
|
55
|
+
engine.launch(li)
|
56
|
+
|
57
|
+
sleep(2)
|
58
|
+
|
59
|
+
s = engine.application_context["__tracer"].to_s
|
60
|
+
|
61
|
+
#puts "trace is >#{s}<"
|
62
|
+
#puts "albert.size is #{albert.size}"
|
63
|
+
|
64
|
+
assert \
|
65
|
+
albert.size == 0,
|
66
|
+
"workitem was not removed from workitem store"
|
67
|
+
assert \
|
68
|
+
s == "over",
|
69
|
+
"flow did not reacher 'over'"
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|