openwferu 0.9.15 → 0.9.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. data/README.txt +4 -2
  2. data/lib/openwfe/engine/engine.rb +143 -25
  3. data/lib/openwfe/engine/file_persisted_engine.rb +3 -3
  4. data/lib/openwfe/expool/errorjournal.rb +48 -25
  5. data/lib/openwfe/expool/expressionpool.rb +77 -106
  6. data/lib/openwfe/expool/expstorage.rb +6 -5
  7. data/lib/openwfe/expool/threadedexpstorage.rb +190 -0
  8. data/lib/openwfe/expool/yamlexpstorage.rb +5 -150
  9. data/lib/openwfe/expressions/condition.rb +6 -6
  10. data/lib/openwfe/expressions/environment.rb +7 -2
  11. data/lib/openwfe/expressions/expressionmap.rb +14 -0
  12. data/lib/openwfe/expressions/fe_command.rb +2 -1
  13. data/lib/openwfe/expressions/fe_concurrence.rb +40 -18
  14. data/lib/openwfe/expressions/fe_cron.rb +14 -11
  15. data/lib/openwfe/expressions/fe_cursor.rb +2 -3
  16. data/lib/openwfe/expressions/fe_define.rb +34 -31
  17. data/lib/openwfe/expressions/fe_equals.rb +11 -21
  18. data/lib/openwfe/expressions/fe_filter_definition.rb +0 -2
  19. data/lib/openwfe/expressions/fe_fqv.rb +1 -3
  20. data/lib/openwfe/expressions/fe_if.rb +37 -12
  21. data/lib/openwfe/expressions/fe_iterator.rb +1 -1
  22. data/lib/openwfe/expressions/fe_listen.rb +147 -28
  23. data/lib/openwfe/expressions/fe_losfor.rb +13 -1
  24. data/lib/openwfe/expressions/fe_misc.rb +70 -11
  25. data/lib/openwfe/expressions/fe_participant.rb +3 -3
  26. data/lib/openwfe/expressions/fe_reserve.rb +1 -1
  27. data/lib/openwfe/expressions/fe_save.rb +11 -12
  28. data/lib/openwfe/expressions/fe_sequence.rb +22 -29
  29. data/lib/openwfe/expressions/fe_sleep.rb +11 -7
  30. data/lib/openwfe/expressions/fe_subprocess.rb +24 -10
  31. data/lib/openwfe/expressions/fe_value.rb +35 -15
  32. data/lib/openwfe/expressions/fe_when.rb +2 -4
  33. data/lib/openwfe/expressions/flowexpression.rb +73 -37
  34. data/lib/openwfe/expressions/merge.rb +2 -4
  35. data/lib/openwfe/expressions/raw.rb +40 -31
  36. data/lib/openwfe/expressions/raw_prog.rb +18 -9
  37. data/lib/openwfe/expressions/raw_xml.rb +1 -8
  38. data/lib/openwfe/expressions/simplerep.rb +27 -5
  39. data/lib/openwfe/expressions/time.rb +45 -15
  40. data/lib/openwfe/expressions/timeout.rb +2 -1
  41. data/lib/openwfe/expressions/wtemplate.rb +2 -2
  42. data/lib/openwfe/flowexpressionid.rb +62 -16
  43. data/lib/openwfe/listeners/listener.rb +28 -37
  44. data/lib/openwfe/listeners/listeners.rb +1 -1
  45. data/lib/openwfe/listeners/socketlisteners.rb +7 -15
  46. data/lib/openwfe/logging.rb +5 -4
  47. data/lib/openwfe/{rest → orest}/controlclient.rb +3 -5
  48. data/lib/openwfe/{rest → orest}/definitions.rb +0 -2
  49. data/lib/openwfe/{rest → orest}/exception.rb +0 -0
  50. data/lib/openwfe/{rest → orest}/oldrestservlet.rb +1 -1
  51. data/lib/openwfe/{rest → orest}/osocket.rb +1 -1
  52. data/lib/openwfe/{rest → orest}/restclient.rb +0 -2
  53. data/lib/openwfe/orest/workitem.rb +206 -0
  54. data/lib/openwfe/{rest → orest}/worklistclient.rb +15 -5
  55. data/lib/openwfe/{rest → orest}/xmlcodec.rb +4 -1
  56. data/lib/openwfe/participants/enoparticipants.rb +4 -14
  57. data/lib/openwfe/participants/participantmap.rb +16 -12
  58. data/lib/openwfe/participants/participants.rb +46 -1
  59. data/lib/openwfe/participants/socketparticipants.rb +1 -6
  60. data/lib/openwfe/service.rb +15 -6
  61. data/lib/openwfe/storage/yamlcustom.rb +3 -0
  62. data/lib/openwfe/storage/yamlfilestorage.rb +3 -1
  63. data/lib/openwfe/util/dollar.rb +21 -14
  64. data/lib/openwfe/util/lru.rb +29 -10
  65. data/lib/openwfe/util/observable.rb +4 -1
  66. data/lib/openwfe/util/otime.rb +3 -0
  67. data/lib/openwfe/util/scheduler.rb +346 -114
  68. data/lib/openwfe/utils.rb +67 -13
  69. data/lib/openwfe/version.rb +1 -1
  70. data/lib/openwfe/workitem.rb +22 -165
  71. data/lib/openwfe/worklist/oldrest.rb +2 -2
  72. data/test/bm/bm_1_xml_vs_prog.rb +56 -0
  73. data/test/{ft_26_load.rb → bm/ft_26_load.rb} +0 -0
  74. data/test/{ft_26b_load.rb → bm/ft_26b_load.rb} +0 -0
  75. data/test/{ft_26c_load.rb → bm/ft_26c_load.rb} +16 -4
  76. data/test/clone_test.rb +62 -0
  77. data/test/cron_test.rb +56 -1
  78. data/test/cronline_test.rb +17 -8
  79. data/test/description_test.rb +57 -0
  80. data/test/dollar_test.rb +17 -6
  81. data/test/eno_test.rb +22 -9
  82. data/test/fe_lookup_att_test.rb +50 -0
  83. data/test/fei_test.rb +18 -9
  84. data/test/flowtestbase.rb +24 -2
  85. data/test/ft_0.rb +10 -12
  86. data/test/ft_0e_multibody.rb +34 -0
  87. data/test/ft_10_loop.rb +4 -6
  88. data/test/ft_11_ppd.rb +5 -20
  89. data/test/ft_14b_subprocess.rb +2 -2
  90. data/test/ft_15_iterator.rb +56 -4
  91. data/test/ft_15b_iterator.rb +48 -0
  92. data/test/ft_16_fqv.rb +18 -3
  93. data/test/ft_23c_wait.rb +7 -5
  94. data/test/ft_25_cancel.rb +5 -3
  95. data/test/ft_27_getflowpos.rb +14 -11
  96. data/test/ft_28_fileparticipant.rb +3 -4
  97. data/test/ft_2_concurrence.rb +8 -12
  98. data/test/ft_2b_concurrence.rb +3 -2
  99. data/test/ft_30_socketlistener.rb +5 -6
  100. data/test/ft_32c_journal.rb +2 -2
  101. data/test/ft_32d_journal.rb +5 -6
  102. data/test/ft_33_description.rb +8 -3
  103. data/test/ft_34_cancelwfid.rb +3 -3
  104. data/test/ft_38_tag.rb +7 -10
  105. data/test/ft_39_reserve.rb +4 -2
  106. data/test/ft_3_equals.rb +18 -13
  107. data/test/ft_44b_restore.rb +2 -6
  108. data/test/ft_49_condition.rb +16 -12
  109. data/test/ft_4_misc.rb +51 -12
  110. data/test/ft_50_xml_attribute.rb +1 -1
  111. data/test/ft_54_listen.rb +96 -10
  112. data/test/ft_54b_listen.rb +68 -0
  113. data/test/ft_55_ptimeout.rb +1 -2
  114. data/test/ft_58_ejournal.rb +8 -33
  115. data/test/ft_59_ps.rb +2 -3
  116. data/test/ft_59b_ps_for_pat.rb +59 -0
  117. data/test/ft_5_time.rb +45 -4
  118. data/test/ft_60_ecancel.rb +7 -7
  119. data/test/ft_61_elsub.rb +1 -1
  120. data/test/ft_64_alias.rb +1 -1
  121. data/test/ft_67_schedlaunch.rb +29 -16
  122. data/test/ft_69_cancelmissing.rb +1 -1
  123. data/test/ft_6_lambda.rb +8 -6
  124. data/test/ft_70_lookupvar.rb +2 -2
  125. data/test/ft_71_log.rb +60 -0
  126. data/test/ft_72_lookup_processes.rb +79 -0
  127. data/test/ft_73_cancel_sub.rb +144 -0
  128. data/test/ft_74_block_and_workitem_dup.rb +63 -0
  129. data/test/ft_75_ruby_attributes.rb +87 -0
  130. data/test/ft_76_merge_isolate.rb +90 -0
  131. data/test/ft_7_lose.rb +2 -1
  132. data/test/ft_tests.rb +9 -0
  133. data/test/lookup_att_test.rb +90 -0
  134. data/test/misc_test.rb +33 -50
  135. data/test/orest_test.rb +1 -1
  136. data/test/participant_test.rb +32 -8
  137. data/test/pending.rb +6 -7
  138. data/test/rake_ltest.rb +3 -0
  139. data/test/rake_qtest.rb +4 -1
  140. data/test/raw_prog_test.rb +1 -1
  141. data/test/restart_cron_test.rb +6 -6
  142. data/test/restart_sleep_test.rb +8 -8
  143. data/test/ruby_procdef_test.rb +2 -2
  144. data/test/rutest_utils.rb +9 -3
  145. data/test/scheduler_1_test.rb +88 -0
  146. data/test/scheduler_test.rb +49 -4
  147. data/test/sec_test.rb +18 -11
  148. metadata +51 -34
  149. 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
@@ -95,7 +95,8 @@ ok 3
95
95
  ok 5
96
96
  v1 :
97
97
  done.""",
98
- 1.8,
98
+ #1.8,
99
+ 2.700,
99
100
  true)
100
101
  end
101
102
 
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
- assert \
31
- OpenWFE::starts_with("//a", "//")
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
- assert \
38
- OpenWFE::ends_with("c'est la fin", "fin")
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
- assert OpenWFE::ensure_for_filename("abc") == "abc"
44
- assert OpenWFE::ensure_for_filename("a/c") == "a_c"
45
- assert OpenWFE::ensure_for_filename("a\\c") == "a_c"
46
- assert OpenWFE::ensure_for_filename("a*c") == "a_c"
47
- assert OpenWFE::ensure_for_filename("a+?") == "a__"
48
- assert OpenWFE::ensure_for_filename("a b") == "a_b"
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
- assert OpenWFE::clean_path("my//file/path") == "my/file/path"
54
- assert OpenWFE::clean_path("my//file//path") == "my/file/path"
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
- def test_dup
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
- private
91
-
92
- class A
93
- attr_accessor :a, :b
94
-
95
- def equals (other)
96
- return false if not other.kind_of?(A)
97
- return (self.a == other.a and self.b == other.b)
98
- end
99
-
100
- def to_s
101
- "A : a='#{a}', b='#{b}'"
102
- end
103
- end
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/rest/worklistclient'
13
+ require 'openwfe/orest/worklistclient'
14
14
  require 'openwfe/engine/engine'
15
15
  require 'openwfe/worklist/oldrest'
16
16
  require 'openwfe/worklist/storelocks'
@@ -18,22 +18,46 @@ require 'openwfe/participants/participants'
18
18
 
19
19
  class ParticipantTest < Test::Unit::TestCase
20
20
 
21
- #def setup
22
- #end
21
+ def setup
22
+ @engine = OpenWFE::Engine.new
23
+ end
23
24
 
24
- #def teardown
25
- #end
25
+ def teardown
26
+ @engine.stop
27
+ end
26
28
 
27
29
  def test_lookup_participant
28
30
 
29
- engine = OpenWFE::Engine.new
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
- min_jobs = if @engine.is_a?(OpenWFE::CachedFilePersistedEngine)
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, min_jobs
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
@@ -11,8 +11,11 @@
11
11
  #
12
12
  # the tests that take lots of time...
13
13
  #
14
+
14
15
  require 'ft_5_time'
16
+
15
17
  require 'scheduler_test'
18
+ require 'scheduler_1_test'
16
19
  require 'cron_test'
17
20
 
18
21
  require 'restart_tests'
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/atom_test.rb'
49
+ #require 'extras/atomfeedp_test.rb'
47
50
 
@@ -364,7 +364,7 @@ end""".strip
364
364
  "process-definition",
365
365
  {"name"=>"TestDefinitionSeven", "revision"=>"0"},
366
366
  [
367
- ["participant", {"ref"=>"toto"}, []]
367
+ ["participant", {"ref"=>:toto}, []]
368
368
  ]
369
369
  ]
370
370
 
@@ -27,13 +27,14 @@ class RestartCronTest < Test::Unit::TestCase
27
27
  #end
28
28
 
29
29
  class RestartDefinition0 < ProcessDefinition
30
- def make
31
- process_definition :name => "rs0", :revision => "0" do
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
- end
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)
@@ -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(engine_class)
89
+ engine = new_engine engine_class
90
90
 
91
91
  #$OWFE_LOG.level = Logger::DEBUG
92
92
 
93
- li = LaunchItem.new(def_class)
93
+ li = LaunchItem.new def_class
94
94
 
95
- engine.launch(li)
95
+ engine.launch li
96
96
 
97
- sleep(1)
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(engine_class)
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(11)
111
- #sleep(21)
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
@@ -79,9 +79,9 @@ end
79
79
  def test_1
80
80
 
81
81
  fei0 = launch TEST1
82
- sleep 0.100
82
+ sleep 0.200
83
83
  fei1 = launch TEST1
84
- sleep 0.100
84
+ sleep 0.200
85
85
 
86
86
  assert_equal ProcessDefinition.extract_class(TEST1), Test1
87
87
 
data/test/rutest_utils.rb CHANGED
@@ -34,17 +34,23 @@ class Tracer
34
34
  end
35
35
  end
36
36
 
37
- def new_fei ()
38
- fei = OpenWFE::FlowExpressionId.new()
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