openwferu 0.9.15 → 0.9.16
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +4 -2
- data/lib/openwfe/engine/engine.rb +143 -25
- data/lib/openwfe/engine/file_persisted_engine.rb +3 -3
- data/lib/openwfe/expool/errorjournal.rb +48 -25
- data/lib/openwfe/expool/expressionpool.rb +77 -106
- data/lib/openwfe/expool/expstorage.rb +6 -5
- data/lib/openwfe/expool/threadedexpstorage.rb +190 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +5 -150
- data/lib/openwfe/expressions/condition.rb +6 -6
- data/lib/openwfe/expressions/environment.rb +7 -2
- data/lib/openwfe/expressions/expressionmap.rb +14 -0
- data/lib/openwfe/expressions/fe_command.rb +2 -1
- data/lib/openwfe/expressions/fe_concurrence.rb +40 -18
- data/lib/openwfe/expressions/fe_cron.rb +14 -11
- data/lib/openwfe/expressions/fe_cursor.rb +2 -3
- data/lib/openwfe/expressions/fe_define.rb +34 -31
- data/lib/openwfe/expressions/fe_equals.rb +11 -21
- data/lib/openwfe/expressions/fe_filter_definition.rb +0 -2
- data/lib/openwfe/expressions/fe_fqv.rb +1 -3
- data/lib/openwfe/expressions/fe_if.rb +37 -12
- data/lib/openwfe/expressions/fe_iterator.rb +1 -1
- data/lib/openwfe/expressions/fe_listen.rb +147 -28
- data/lib/openwfe/expressions/fe_losfor.rb +13 -1
- data/lib/openwfe/expressions/fe_misc.rb +70 -11
- data/lib/openwfe/expressions/fe_participant.rb +3 -3
- data/lib/openwfe/expressions/fe_reserve.rb +1 -1
- data/lib/openwfe/expressions/fe_save.rb +11 -12
- data/lib/openwfe/expressions/fe_sequence.rb +22 -29
- data/lib/openwfe/expressions/fe_sleep.rb +11 -7
- data/lib/openwfe/expressions/fe_subprocess.rb +24 -10
- data/lib/openwfe/expressions/fe_value.rb +35 -15
- data/lib/openwfe/expressions/fe_when.rb +2 -4
- data/lib/openwfe/expressions/flowexpression.rb +73 -37
- data/lib/openwfe/expressions/merge.rb +2 -4
- data/lib/openwfe/expressions/raw.rb +40 -31
- data/lib/openwfe/expressions/raw_prog.rb +18 -9
- data/lib/openwfe/expressions/raw_xml.rb +1 -8
- data/lib/openwfe/expressions/simplerep.rb +27 -5
- data/lib/openwfe/expressions/time.rb +45 -15
- data/lib/openwfe/expressions/timeout.rb +2 -1
- data/lib/openwfe/expressions/wtemplate.rb +2 -2
- data/lib/openwfe/flowexpressionid.rb +62 -16
- data/lib/openwfe/listeners/listener.rb +28 -37
- data/lib/openwfe/listeners/listeners.rb +1 -1
- data/lib/openwfe/listeners/socketlisteners.rb +7 -15
- data/lib/openwfe/logging.rb +5 -4
- data/lib/openwfe/{rest → orest}/controlclient.rb +3 -5
- data/lib/openwfe/{rest → orest}/definitions.rb +0 -2
- data/lib/openwfe/{rest → orest}/exception.rb +0 -0
- data/lib/openwfe/{rest → orest}/oldrestservlet.rb +1 -1
- data/lib/openwfe/{rest → orest}/osocket.rb +1 -1
- data/lib/openwfe/{rest → orest}/restclient.rb +0 -2
- data/lib/openwfe/orest/workitem.rb +206 -0
- data/lib/openwfe/{rest → orest}/worklistclient.rb +15 -5
- data/lib/openwfe/{rest → orest}/xmlcodec.rb +4 -1
- data/lib/openwfe/participants/enoparticipants.rb +4 -14
- data/lib/openwfe/participants/participantmap.rb +16 -12
- data/lib/openwfe/participants/participants.rb +46 -1
- data/lib/openwfe/participants/socketparticipants.rb +1 -6
- data/lib/openwfe/service.rb +15 -6
- data/lib/openwfe/storage/yamlcustom.rb +3 -0
- data/lib/openwfe/storage/yamlfilestorage.rb +3 -1
- data/lib/openwfe/util/dollar.rb +21 -14
- data/lib/openwfe/util/lru.rb +29 -10
- data/lib/openwfe/util/observable.rb +4 -1
- data/lib/openwfe/util/otime.rb +3 -0
- data/lib/openwfe/util/scheduler.rb +346 -114
- data/lib/openwfe/utils.rb +67 -13
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/workitem.rb +22 -165
- data/lib/openwfe/worklist/oldrest.rb +2 -2
- data/test/bm/bm_1_xml_vs_prog.rb +56 -0
- data/test/{ft_26_load.rb → bm/ft_26_load.rb} +0 -0
- data/test/{ft_26b_load.rb → bm/ft_26b_load.rb} +0 -0
- data/test/{ft_26c_load.rb → bm/ft_26c_load.rb} +16 -4
- data/test/clone_test.rb +62 -0
- data/test/cron_test.rb +56 -1
- data/test/cronline_test.rb +17 -8
- data/test/description_test.rb +57 -0
- data/test/dollar_test.rb +17 -6
- data/test/eno_test.rb +22 -9
- data/test/fe_lookup_att_test.rb +50 -0
- data/test/fei_test.rb +18 -9
- data/test/flowtestbase.rb +24 -2
- data/test/ft_0.rb +10 -12
- data/test/ft_0e_multibody.rb +34 -0
- data/test/ft_10_loop.rb +4 -6
- data/test/ft_11_ppd.rb +5 -20
- data/test/ft_14b_subprocess.rb +2 -2
- data/test/ft_15_iterator.rb +56 -4
- data/test/ft_15b_iterator.rb +48 -0
- data/test/ft_16_fqv.rb +18 -3
- data/test/ft_23c_wait.rb +7 -5
- data/test/ft_25_cancel.rb +5 -3
- data/test/ft_27_getflowpos.rb +14 -11
- data/test/ft_28_fileparticipant.rb +3 -4
- data/test/ft_2_concurrence.rb +8 -12
- data/test/ft_2b_concurrence.rb +3 -2
- data/test/ft_30_socketlistener.rb +5 -6
- data/test/ft_32c_journal.rb +2 -2
- data/test/ft_32d_journal.rb +5 -6
- data/test/ft_33_description.rb +8 -3
- data/test/ft_34_cancelwfid.rb +3 -3
- data/test/ft_38_tag.rb +7 -10
- data/test/ft_39_reserve.rb +4 -2
- data/test/ft_3_equals.rb +18 -13
- data/test/ft_44b_restore.rb +2 -6
- data/test/ft_49_condition.rb +16 -12
- data/test/ft_4_misc.rb +51 -12
- data/test/ft_50_xml_attribute.rb +1 -1
- data/test/ft_54_listen.rb +96 -10
- data/test/ft_54b_listen.rb +68 -0
- data/test/ft_55_ptimeout.rb +1 -2
- data/test/ft_58_ejournal.rb +8 -33
- data/test/ft_59_ps.rb +2 -3
- data/test/ft_59b_ps_for_pat.rb +59 -0
- data/test/ft_5_time.rb +45 -4
- data/test/ft_60_ecancel.rb +7 -7
- data/test/ft_61_elsub.rb +1 -1
- data/test/ft_64_alias.rb +1 -1
- data/test/ft_67_schedlaunch.rb +29 -16
- data/test/ft_69_cancelmissing.rb +1 -1
- data/test/ft_6_lambda.rb +8 -6
- data/test/ft_70_lookupvar.rb +2 -2
- data/test/ft_71_log.rb +60 -0
- data/test/ft_72_lookup_processes.rb +79 -0
- data/test/ft_73_cancel_sub.rb +144 -0
- data/test/ft_74_block_and_workitem_dup.rb +63 -0
- data/test/ft_75_ruby_attributes.rb +87 -0
- data/test/ft_76_merge_isolate.rb +90 -0
- data/test/ft_7_lose.rb +2 -1
- data/test/ft_tests.rb +9 -0
- data/test/lookup_att_test.rb +90 -0
- data/test/misc_test.rb +33 -50
- data/test/orest_test.rb +1 -1
- data/test/participant_test.rb +32 -8
- data/test/pending.rb +6 -7
- data/test/rake_ltest.rb +3 -0
- data/test/rake_qtest.rb +4 -1
- data/test/raw_prog_test.rb +1 -1
- data/test/restart_cron_test.rb +6 -6
- data/test/restart_sleep_test.rb +8 -8
- data/test/ruby_procdef_test.rb +2 -2
- data/test/rutest_utils.rb +9 -3
- data/test/scheduler_1_test.rb +88 -0
- data/test/scheduler_test.rb +49 -4
- data/test/sec_test.rb +18 -11
- metadata +51 -34
- data/test/cron_test_2.rb +0 -50
@@ -0,0 +1,87 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Thu Nov 1 15:21:34 JST 2007
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'openwfe/def'
|
11
|
+
|
12
|
+
require 'flowtestbase'
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest75 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def teardown
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def setup
|
22
|
+
#end
|
23
|
+
|
24
|
+
#
|
25
|
+
# TEST 0
|
26
|
+
|
27
|
+
class Test0 < OpenWFE::ProcessDefinition
|
28
|
+
sequence do
|
29
|
+
set :field => "f0", :value => [ 'my', 'array' ]
|
30
|
+
set :field => :f1, :value => [ 'my', 'array' ]
|
31
|
+
_print "${f:f0.0}"
|
32
|
+
_print "${f:f1.1}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_0
|
37
|
+
|
38
|
+
dotest Test0, "my\narray"
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# TEST 1
|
43
|
+
|
44
|
+
class Test1 < OpenWFE::ProcessDefinition
|
45
|
+
sequence do
|
46
|
+
set :field => "f0", :value => true
|
47
|
+
_print "${r:workitem.f0.class.name}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_1
|
52
|
+
|
53
|
+
dotest Test1, "TrueClass"
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# TEST 2
|
58
|
+
|
59
|
+
class Test2 < OpenWFE::ProcessDefinition
|
60
|
+
sequence do
|
61
|
+
set :variable => "v0", :value => "alpha"
|
62
|
+
set :variable => :v0, :value => "bravo"
|
63
|
+
_print "${v0}"
|
64
|
+
set :field => "f0", :value => "alpha"
|
65
|
+
set :field => :f0, :value => "bravo"
|
66
|
+
_print "${f:f0}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_2
|
71
|
+
|
72
|
+
dotest Test2, "bravo\nbravo"
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# TEST 3
|
77
|
+
|
78
|
+
#class Test3 < OpenWFE::ProcessDefinition
|
79
|
+
# sequence do
|
80
|
+
# end
|
81
|
+
#end
|
82
|
+
#def test_3
|
83
|
+
# dotest Test3, "6"
|
84
|
+
#end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
#require 'openwfe/worklist/storeparticipant'
|
11
|
+
|
12
|
+
include OpenWFE
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest76 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def setup
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def teardown
|
22
|
+
#end
|
23
|
+
|
24
|
+
|
25
|
+
#
|
26
|
+
# Test 0
|
27
|
+
#
|
28
|
+
|
29
|
+
class Test0 < ProcessDefinition
|
30
|
+
sequence do
|
31
|
+
concurrence :merge_type => :isolate do
|
32
|
+
set :field => "y", :value => "y0"
|
33
|
+
set :field => "y", :value => "y1"
|
34
|
+
set :field => "y", :value => "y2"
|
35
|
+
end
|
36
|
+
catcher
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_0
|
41
|
+
do_the_test Test0
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# Test 1
|
46
|
+
#
|
47
|
+
|
48
|
+
class Test1 < ProcessDefinition
|
49
|
+
sequence do
|
50
|
+
concurrent_iterator(
|
51
|
+
:on_value => "0, 1, 2",
|
52
|
+
:to_field => "f",
|
53
|
+
:merge_type => :isolate
|
54
|
+
) do
|
55
|
+
set :field => "y", :value => "y${f:f}"
|
56
|
+
end
|
57
|
+
catcher
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_1
|
62
|
+
do_the_test Test1
|
63
|
+
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
def do_the_test (definition)
|
68
|
+
|
69
|
+
#log_level_to_debug
|
70
|
+
|
71
|
+
workitem = nil
|
72
|
+
|
73
|
+
engine.register_participant :catcher do |wi|
|
74
|
+
workitem = wi
|
75
|
+
end
|
76
|
+
|
77
|
+
dotest definition, ""
|
78
|
+
|
79
|
+
#puts
|
80
|
+
#puts workitem.to_s
|
81
|
+
|
82
|
+
3.times do |i|
|
83
|
+
assert_equal "y#{i}", workitem.lookup_attribute("#{i}.y")
|
84
|
+
end
|
85
|
+
#
|
86
|
+
# 3 lines replaced by 3 lines :)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
data/test/ft_7_lose.rb
CHANGED
data/test/ft_tests.rb
CHANGED
@@ -12,6 +12,7 @@ require 'ft_0'
|
|
12
12
|
require 'ft_0b_sequence'
|
13
13
|
require 'ft_0c_testname'
|
14
14
|
require 'ft_0d_participant'
|
15
|
+
require 'ft_0e_multibody'
|
15
16
|
require 'ft_1_unset'
|
16
17
|
require 'ft_1b_unset'
|
17
18
|
require 'ft_2_concurrence'
|
@@ -32,6 +33,7 @@ require 'ft_12_blockparticipant'
|
|
32
33
|
require 'ft_14_subprocess'
|
33
34
|
require 'ft_14b_subprocess'
|
34
35
|
require 'ft_15_iterator'
|
36
|
+
require 'ft_15b_iterator'
|
35
37
|
require 'ft_16_fqv'
|
36
38
|
require 'ft_17_condition'
|
37
39
|
require 'ft_18_pname'
|
@@ -69,6 +71,7 @@ require 'ft_50_xml_attribute'
|
|
69
71
|
require 'ft_52_obs_participant'
|
70
72
|
require 'ft_53_null_noop_participant'
|
71
73
|
require 'ft_54_listen'
|
74
|
+
require 'ft_54b_listen'
|
72
75
|
require 'ft_55_ptimeout'
|
73
76
|
require 'ft_56_timeout'
|
74
77
|
require 'ft_57_a'
|
@@ -90,4 +93,10 @@ require 'ft_66_subforget'
|
|
90
93
|
require 'ft_68_ifparticipant'
|
91
94
|
require 'ft_69_cancelmissing'
|
92
95
|
require 'ft_70_lookupvar'
|
96
|
+
require 'ft_71_log'
|
97
|
+
require 'ft_72_lookup_processes'
|
98
|
+
require 'ft_73_cancel_sub'
|
99
|
+
require 'ft_74_block_and_workitem_dup'
|
100
|
+
require 'ft_75_ruby_attributes'
|
101
|
+
require 'ft_76_merge_isolate'
|
93
102
|
|
@@ -0,0 +1,90 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'test/unit'
|
9
|
+
require 'openwfe/utils'
|
10
|
+
|
11
|
+
|
12
|
+
class LookupAttTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
#def setup
|
15
|
+
#end
|
16
|
+
|
17
|
+
#def teardown
|
18
|
+
#end
|
19
|
+
|
20
|
+
def test_0
|
21
|
+
|
22
|
+
l0 = [
|
23
|
+
{"name"=>"companyA","DunsNr" => "JGE4753"},
|
24
|
+
{"name"=>"companyB","DunsNr" => "ZUTE8555"},
|
25
|
+
{"name"=>"companyC","DunsNr" => "GTI6775"},
|
26
|
+
{"name"=>"companyD","DunsNr" => "XUE6755"}
|
27
|
+
]
|
28
|
+
h0 = { "supplierList" => l0 }
|
29
|
+
|
30
|
+
do_lookup_test(
|
31
|
+
h0, "supplierList", l0)
|
32
|
+
do_lookup_test(
|
33
|
+
h0, "supplierList.1", {"name"=>"companyB","DunsNr" => "ZUTE8555"})
|
34
|
+
do_lookup_test(
|
35
|
+
h0, "supplierList.1.DunsNr", "ZUTE8555")
|
36
|
+
|
37
|
+
do_has_attribute_test(
|
38
|
+
h0, "supplierList.1.DunsNr", true)
|
39
|
+
do_has_attribute_test(
|
40
|
+
h0, "supplierList.1.Whatever", false)
|
41
|
+
do_has_attribute_test(
|
42
|
+
h0, "supplierList.whatever", false)
|
43
|
+
do_has_attribute_test(
|
44
|
+
h0, "whatever", false)
|
45
|
+
|
46
|
+
h1 = { "supplierList" => l0.to_s }
|
47
|
+
do_lookup_test(
|
48
|
+
h1, "supplierList.1.DunsNr", nil)
|
49
|
+
|
50
|
+
do_has_attribute_test(
|
51
|
+
nil, "whatever", false)
|
52
|
+
do_has_attribute_test(
|
53
|
+
{}, "whatever", false)
|
54
|
+
do_has_attribute_test(
|
55
|
+
[], "whatever", false)
|
56
|
+
do_has_attribute_test(
|
57
|
+
"string", "whatever", false)
|
58
|
+
|
59
|
+
do_has_attribute_test(
|
60
|
+
[ nil, nil ], "1.name", false)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_1
|
64
|
+
|
65
|
+
h = { "0" => [ "a", "A" ], "1" => { "b" => "B"} }
|
66
|
+
|
67
|
+
do_lookup_test(h, "0", [ "a", "A" ])
|
68
|
+
do_lookup_test(h, "1.b", "B")
|
69
|
+
do_has_attribute_test(h, "0", true)
|
70
|
+
do_has_attribute_test(h, "1.b", true)
|
71
|
+
end
|
72
|
+
|
73
|
+
protected
|
74
|
+
|
75
|
+
def do_lookup_test (container, expression, expected_value)
|
76
|
+
|
77
|
+
assert_equal(
|
78
|
+
expected_value,
|
79
|
+
OpenWFE::lookup_attribute(container, expression))
|
80
|
+
end
|
81
|
+
|
82
|
+
def do_has_attribute_test (container, expression, expected_boolean)
|
83
|
+
|
84
|
+
assert_equal(
|
85
|
+
expected_boolean,
|
86
|
+
OpenWFE::has_attribute?(container, expression))
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
data/test/misc_test.rb
CHANGED
@@ -8,7 +8,6 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'test/unit'
|
11
|
-
require 'rexml/document'
|
12
11
|
|
13
12
|
require 'openwfe/utils'
|
14
13
|
require 'openwfe/expressions/fe_define'
|
@@ -27,58 +26,39 @@ class MiscTest < Test::Unit::TestCase
|
|
27
26
|
#end
|
28
27
|
|
29
28
|
def test_starts_with
|
30
|
-
|
31
|
-
|
32
|
-
assert
|
33
|
-
(not OpenWFE::starts_with("/a", "//"))
|
29
|
+
|
30
|
+
assert OpenWFE::starts_with("//a", "//")
|
31
|
+
assert (not OpenWFE::starts_with("/a", "//"))
|
34
32
|
end
|
35
33
|
|
36
34
|
def test_ends_with
|
37
|
-
|
38
|
-
|
35
|
+
|
36
|
+
assert OpenWFE::ends_with("c'est la fin", "fin")
|
39
37
|
end
|
40
38
|
|
41
39
|
def test_ensure_for_filename
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
assert_equal OpenWFE::ensure_for_filename("abc"), "abc"
|
42
|
+
assert_equal OpenWFE::ensure_for_filename("a/c"), "a_c"
|
43
|
+
assert_equal OpenWFE::ensure_for_filename("a\\c"), "a_c"
|
44
|
+
assert_equal OpenWFE::ensure_for_filename("a*c"), "a_c"
|
45
|
+
assert_equal OpenWFE::ensure_for_filename("a+?"), "a__"
|
46
|
+
assert_equal OpenWFE::ensure_for_filename("a b"), "a_b"
|
49
47
|
end
|
50
48
|
|
51
49
|
def test_clean_path
|
52
50
|
|
53
|
-
|
54
|
-
|
51
|
+
assert_equal OpenWFE::clean_path("my//file/path"), "my/file/path"
|
52
|
+
assert_equal OpenWFE::clean_path("my//file//path"), "my/file/path"
|
55
53
|
end
|
56
54
|
|
57
55
|
def test_stu
|
58
|
-
assert_equal "a_b_c", OpenWFE::stu("a b c")
|
59
|
-
end
|
60
56
|
|
61
|
-
|
62
|
-
a0 = A.new
|
63
|
-
a0.a = 1
|
64
|
-
a0.b = 2
|
65
|
-
a1 = OpenWFE::fulldup(a0)
|
66
|
-
|
67
|
-
#puts a0
|
68
|
-
#puts a1
|
69
|
-
|
70
|
-
assert \
|
71
|
-
a0.equals(a1),
|
72
|
-
"dup() utility not working"
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_dup_1
|
76
|
-
d = REXML::Document.new("<document/>")
|
77
|
-
d1 = OpenWFE::fulldup(d)
|
78
|
-
assert d.object_id != d1.object_id
|
57
|
+
assert_equal "a_b_c", OpenWFE::stu("a b c")
|
79
58
|
end
|
80
59
|
|
81
60
|
def test_grep_0
|
61
|
+
|
82
62
|
assert OpenWFE::grep("sputnik", "Rakefile").empty?
|
83
63
|
assert_equal OpenWFE::grep("Mettraux", "Rakefile").size, 5
|
84
64
|
|
@@ -87,19 +67,22 @@ class MiscTest < Test::Unit::TestCase
|
|
87
67
|
end
|
88
68
|
end
|
89
69
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
70
|
+
def test_expmap_get_classes
|
71
|
+
|
72
|
+
em = OpenWFE::ExpressionMap.new
|
73
|
+
|
74
|
+
assert_equal \
|
75
|
+
em.get_expression_classes(OpenWFE::Schedulable),
|
76
|
+
[
|
77
|
+
OpenWFE::ParticipantExpression,
|
78
|
+
OpenWFE::SleepExpression,
|
79
|
+
OpenWFE::CronExpression,
|
80
|
+
OpenWFE::WhenExpression,
|
81
|
+
OpenWFE::WaitExpression,
|
82
|
+
OpenWFE::ReserveExpression,
|
83
|
+
OpenWFE::ListenExpression,
|
84
|
+
OpenWFE::TimeoutExpression,
|
85
|
+
OpenWFE::Environment
|
86
|
+
]
|
87
|
+
end
|
105
88
|
end
|
data/test/orest_test.rb
CHANGED
@@ -10,7 +10,7 @@ require 'fileutils'
|
|
10
10
|
require 'webrick'
|
11
11
|
|
12
12
|
require 'rutest_utils'
|
13
|
-
require 'openwfe/
|
13
|
+
require 'openwfe/orest/worklistclient'
|
14
14
|
require 'openwfe/engine/engine'
|
15
15
|
require 'openwfe/worklist/oldrest'
|
16
16
|
require 'openwfe/worklist/storelocks'
|
data/test/participant_test.rb
CHANGED
@@ -18,22 +18,46 @@ require 'openwfe/participants/participants'
|
|
18
18
|
|
19
19
|
class ParticipantTest < Test::Unit::TestCase
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
def setup
|
22
|
+
@engine = OpenWFE::Engine.new
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
def teardown
|
26
|
+
@engine.stop
|
27
|
+
end
|
26
28
|
|
27
29
|
def test_lookup_participant
|
28
30
|
|
29
|
-
engine
|
30
|
-
engine.register_participant :toto, NullParticipant
|
31
|
+
@engine.register_participant :toto, NullParticipant
|
31
32
|
|
32
|
-
p = engine.get_participant "toto"
|
33
|
+
p = @engine.get_participant "toto"
|
33
34
|
assert_kind_of NullParticipant, p
|
34
35
|
|
35
|
-
p = engine.get_participant :toto
|
36
|
+
p = @engine.get_participant :toto
|
36
37
|
assert_kind_of NullParticipant, p
|
38
|
+
|
39
|
+
assert_equal 1, @engine.get_participant_map.size
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_unregister_participant
|
43
|
+
|
44
|
+
assert ( ! @engine.unregister_participant(:nada))
|
45
|
+
|
46
|
+
@engine.register_participant :toto, NullParticipant
|
47
|
+
|
48
|
+
assert_equal 1, @engine.get_participant_map.size
|
49
|
+
|
50
|
+
assert @engine.unregister_participant(:toto)
|
51
|
+
|
52
|
+
assert_equal 0, @engine.get_participant_map.size
|
53
|
+
|
54
|
+
@engine.register_participant "user_.*", NullParticipant
|
55
|
+
|
56
|
+
assert_equal 1, @engine.get_participant_map.size
|
57
|
+
|
58
|
+
assert @engine.unregister_participant("user_.*")
|
59
|
+
|
60
|
+
assert_equal 0, @engine.get_participant_map.size
|
37
61
|
end
|
38
62
|
|
39
63
|
end
|
data/test/pending.rb
CHANGED
@@ -3,22 +3,21 @@
|
|
3
3
|
# a method for checking the number of pending jobs left in the engine
|
4
4
|
#
|
5
5
|
|
6
|
-
require 'openwfe/engine/file_persisted_engine'
|
7
|
-
|
8
|
-
|
9
6
|
module PendingJobsMixin
|
10
7
|
|
11
8
|
def assert_no_jobs_left
|
12
9
|
|
13
|
-
|
10
|
+
cname = @engine.class.name
|
11
|
+
|
12
|
+
min_jobs = if cname == 'OpenWFE::CachedFilePersistedEngine'
|
13
|
+
1
|
14
|
+
elsif cname == 'OpenWFE::Extras::CachedDbPersistedEngine'
|
14
15
|
1
|
15
|
-
#elsif @engine.is_a?(OpenWFE::FilePersistedEngine)
|
16
|
-
# 0
|
17
16
|
else
|
18
17
|
0
|
19
18
|
end
|
20
19
|
|
21
|
-
assert_equal @engine.get_scheduler.pending_job_count
|
20
|
+
assert_equal min_jobs, @engine.get_scheduler.pending_job_count
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
data/test/rake_ltest.rb
CHANGED
data/test/rake_qtest.rb
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
require 'fei_test'
|
10
10
|
require 'wfid_test'
|
11
11
|
require 'wi_test'
|
12
|
+
require 'lookup_att_test'
|
12
13
|
require 'filter_test'
|
13
14
|
require 'dollar_test'
|
14
15
|
require 'misc_test'
|
@@ -23,12 +24,14 @@ require 'kotoba_test'
|
|
23
24
|
require 'expmap_test'
|
24
25
|
require 'obs_test'
|
25
26
|
require 'clone_test'
|
27
|
+
require 'fe_lookup_att_test'
|
26
28
|
|
27
29
|
require 'sec_test'
|
28
30
|
require 'param_test'
|
29
31
|
|
30
32
|
require 'file_persisted_engine_test'
|
31
33
|
require 'ruby_procdef_test'
|
34
|
+
require 'description_test'
|
32
35
|
|
33
36
|
require 'ft_tests'
|
34
37
|
#
|
@@ -43,5 +46,5 @@ require 'timeout_test'
|
|
43
46
|
require 'slock_test'
|
44
47
|
require 'orest_test.rb'
|
45
48
|
|
46
|
-
#require 'extras/
|
49
|
+
#require 'extras/atomfeedp_test.rb'
|
47
50
|
|
data/test/raw_prog_test.rb
CHANGED
data/test/restart_cron_test.rb
CHANGED
@@ -27,13 +27,14 @@ class RestartCronTest < Test::Unit::TestCase
|
|
27
27
|
#end
|
28
28
|
|
29
29
|
class RestartDefinition0 < ProcessDefinition
|
30
|
-
def make
|
31
|
-
|
30
|
+
#def make
|
31
|
+
# process_definition :name => "rs0", :revision => "0" do
|
32
32
|
cron :tab => "* * * * *", :name => "//cron" do
|
33
|
-
participant :cron_event_restart
|
33
|
+
#participant :cron_event_restart
|
34
|
+
cron_event_restart
|
34
35
|
end
|
35
|
-
|
36
|
-
end
|
36
|
+
# end
|
37
|
+
#end
|
37
38
|
end
|
38
39
|
|
39
40
|
def test_restart_0
|
@@ -46,7 +47,6 @@ class RestartCronTest < Test::Unit::TestCase
|
|
46
47
|
#puts "______________________ :cron_event_restart"
|
47
48
|
count = count + 1
|
48
49
|
end
|
49
|
-
|
50
50
|
engine.register_participant(:cron_event_restart, &participant)
|
51
51
|
|
52
52
|
engine.launch(RestartDefinition0)
|
data/test/restart_sleep_test.rb
CHANGED
@@ -86,29 +86,29 @@ class RestartSleepTest < Test::Unit::TestCase
|
|
86
86
|
#require 'fileutils'
|
87
87
|
#FileUtils.remove_dir "work" if File.exist? "work"
|
88
88
|
|
89
|
-
engine = new_engine
|
89
|
+
engine = new_engine engine_class
|
90
90
|
|
91
91
|
#$OWFE_LOG.level = Logger::DEBUG
|
92
92
|
|
93
|
-
li = LaunchItem.new
|
93
|
+
li = LaunchItem.new def_class
|
94
94
|
|
95
|
-
engine.launch
|
95
|
+
engine.launch li
|
96
96
|
|
97
|
-
sleep
|
97
|
+
sleep 1
|
98
98
|
|
99
|
-
engine.stop
|
99
|
+
engine.stop
|
100
100
|
|
101
101
|
$OWFE_LOG.warn "stopped the engine"
|
102
102
|
|
103
103
|
old_engine = engine
|
104
|
-
engine = new_engine
|
104
|
+
engine = new_engine engine_class
|
105
105
|
|
106
106
|
#$OWFE_LOG.level = Logger::DEBUG
|
107
107
|
|
108
108
|
$OWFE_LOG.warn "started the new engine"
|
109
109
|
|
110
|
-
sleep
|
111
|
-
#sleep
|
110
|
+
sleep 11
|
111
|
+
#sleep 21
|
112
112
|
|
113
113
|
s_old = old_engine.application_context["__tracer"].to_s
|
114
114
|
s_now = engine.application_context["__tracer"].to_s
|
data/test/ruby_procdef_test.rb
CHANGED
data/test/rutest_utils.rb
CHANGED
@@ -34,17 +34,23 @@ class Tracer
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
#
|
38
|
+
# Returns a new FlowExpressionId, for testing purposes
|
39
|
+
#
|
40
|
+
def new_fei
|
41
|
+
|
42
|
+
fei = OpenWFE::FlowExpressionId.new
|
43
|
+
|
39
44
|
fei.owfe_version = OpenWFE::OPENWFERU_VERSION
|
40
45
|
fei.engine_id = 'this'
|
41
|
-
fei.initial_engine_id = 'that'
|
46
|
+
#fei.initial_engine_id = 'that'
|
42
47
|
fei.workflow_definition_url = 'http://test/test.xml'
|
43
48
|
fei.workflow_definition_name = 'test'
|
44
49
|
fei.workflow_definition_revision = '1.0'
|
45
50
|
fei.workflow_instance_id = '123456'
|
46
51
|
fei.expression_name = 'do-test'
|
47
52
|
fei.expression_id = '0.0'
|
53
|
+
|
48
54
|
fei
|
49
55
|
end
|
50
56
|
|