openwferu 0.9.16 → 0.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/examples/about_state.rb +81 -0
  2. data/examples/engine_template.rb +7 -0
  3. data/lib/openwfe/contextual.rb +2 -2
  4. data/lib/openwfe/def.rb +2 -3
  5. data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
  6. data/lib/openwfe/engine/engine.rb +202 -251
  7. data/lib/openwfe/engine/process_status.rb +359 -0
  8. data/lib/openwfe/expool/errorjournal.rb +6 -6
  9. data/lib/openwfe/expool/expressionpool.rb +161 -239
  10. data/lib/openwfe/expool/expstorage.rb +185 -55
  11. data/lib/openwfe/expool/journal.rb +1 -2
  12. data/lib/openwfe/expool/parser.rb +233 -0
  13. data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
  14. data/lib/openwfe/expool/wfidgen.rb +25 -7
  15. data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
  16. data/lib/openwfe/expressions/condition.rb +49 -12
  17. data/lib/openwfe/expressions/environment.rb +45 -15
  18. data/lib/openwfe/expressions/expressionmap.rb +39 -19
  19. data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
  20. data/lib/openwfe/expressions/fe_cron.rb +19 -18
  21. data/lib/openwfe/expressions/fe_cursor.rb +69 -28
  22. data/lib/openwfe/expressions/fe_define.rb +4 -1
  23. data/lib/openwfe/expressions/fe_do.rb +1 -3
  24. data/lib/openwfe/expressions/fe_equals.rb +131 -20
  25. data/lib/openwfe/expressions/fe_fqv.rb +27 -3
  26. data/lib/openwfe/expressions/fe_iterator.rb +14 -7
  27. data/lib/openwfe/expressions/fe_listen.rb +7 -2
  28. data/lib/openwfe/expressions/fe_misc.rb +187 -20
  29. data/lib/openwfe/expressions/fe_participant.rb +8 -7
  30. data/lib/openwfe/expressions/fe_reserve.rb +105 -33
  31. data/lib/openwfe/expressions/fe_save.rb +55 -5
  32. data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
  33. data/lib/openwfe/expressions/fe_sleep.rb +25 -15
  34. data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
  35. data/lib/openwfe/expressions/fe_wait.rb +3 -2
  36. data/lib/openwfe/expressions/fe_when.rb +7 -15
  37. data/lib/openwfe/expressions/flowexpression.rb +90 -49
  38. data/lib/openwfe/expressions/merge.rb +7 -1
  39. data/lib/openwfe/expressions/raw.rb +261 -63
  40. data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
  41. data/lib/openwfe/expressions/time.rb +36 -12
  42. data/lib/openwfe/expressions/timeout.rb +9 -7
  43. data/lib/openwfe/expressions/value.rb +126 -0
  44. data/lib/openwfe/flowexpressionid.rb +52 -22
  45. data/lib/openwfe/listeners/listeners.rb +3 -3
  46. data/lib/openwfe/listeners/socketlisteners.rb +8 -5
  47. data/lib/openwfe/logging.rb +6 -3
  48. data/lib/openwfe/omixins.rb +8 -6
  49. data/lib/openwfe/orest/xmlcodec.rb +16 -12
  50. data/lib/openwfe/participants.rb +38 -0
  51. data/lib/openwfe/participants/participant.rb +1 -1
  52. data/lib/openwfe/participants/participantmap.rb +24 -10
  53. data/lib/openwfe/participants/participants.rb +4 -3
  54. data/lib/openwfe/participants/soapparticipants.rb +1 -1
  55. data/lib/openwfe/participants/socketparticipants.rb +1 -1
  56. data/lib/openwfe/rudefinitions.rb +7 -5
  57. data/lib/openwfe/storage/yamlcustom.rb +10 -10
  58. data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
  59. data/lib/openwfe/tools/flowtracer.rb +6 -5
  60. data/lib/openwfe/util/dollar.rb +42 -85
  61. data/lib/openwfe/util/ometa.rb +1 -3
  62. data/lib/openwfe/util/workqueue.rb +1 -1
  63. data/lib/openwfe/utils.rb +33 -11
  64. data/lib/openwfe/version.rb +2 -2
  65. data/lib/openwfe/workitem.rb +76 -14
  66. data/lib/openwfe/worklist/storelocks.rb +9 -4
  67. data/lib/openwfe/worklist/storeparticipant.rb +1 -1
  68. data/test/back_0916_test.rb +101 -0
  69. data/test/bm/ft_26_load.rb +1 -1
  70. data/test/bm/ft_26b_load.rb +1 -1
  71. data/test/bm/ft_26c_load.rb +3 -2
  72. data/test/bm/ft_26d_load.rb +97 -0
  73. data/test/bm/ft_recu.rb +71 -0
  74. data/test/concurrence_test.rb +1 -1
  75. data/test/condition_test.rb +152 -0
  76. data/test/description_test.rb +12 -7
  77. data/test/eno_test.rb +1 -1
  78. data/test/expool_20031219_0916.tgz +0 -0
  79. data/test/fe_lookup_att_test.rb +1 -1
  80. data/test/fei_test.rb +16 -0
  81. data/test/file_persistence_test.rb +8 -12
  82. data/test/filep_cancel_test.rb +116 -0
  83. data/test/flowtestbase.rb +47 -25
  84. data/test/ft_0.rb +1 -1
  85. data/test/ft_10_loop.rb +29 -14
  86. data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
  87. data/test/ft_11_ppd.rb +6 -17
  88. data/test/ft_11b_ppd.rb +1 -4
  89. data/test/ft_12_blockparticipant.rb +1 -1
  90. data/test/ft_13_eno.rb +1 -1
  91. data/test/ft_15_iterator.rb +1 -1
  92. data/test/ft_15b_iterator.rb +1 -1
  93. data/test/ft_17_condition.rb +6 -6
  94. data/test/ft_18_pname.rb +1 -1
  95. data/test/ft_20_cron.rb +1 -1
  96. data/test/ft_21_cron.rb +6 -4
  97. data/test/ft_22_history.rb +1 -1
  98. data/test/ft_23_when.rb +1 -1
  99. data/test/ft_23b_when.rb +18 -6
  100. data/test/ft_23c_wait.rb +8 -6
  101. data/test/ft_25_cancel.rb +7 -5
  102. data/test/ft_27_getflowpos.rb +22 -17
  103. data/test/ft_28_fileparticipant.rb +1 -2
  104. data/test/ft_2_concurrence.rb +1 -1
  105. data/test/ft_2b_concurrence.rb +25 -20
  106. data/test/ft_30_socketlistener.rb +0 -3
  107. data/test/ft_34_cancelwfid.rb +9 -9
  108. data/test/ft_35_localdefs.rb +0 -1
  109. data/test/ft_36_subprocids.rb +6 -6
  110. data/test/ft_38_tag.rb +3 -2
  111. data/test/ft_38b_tag.rb +229 -0
  112. data/test/ft_39_reserve.rb +3 -18
  113. data/test/ft_39b_reserve.rb +34 -5
  114. data/test/ft_3b_lookup_vf.rb +83 -0
  115. data/test/ft_40_defined.rb +2 -11
  116. data/test/ft_42_environments.rb +4 -6
  117. data/test/ft_44b_restore.rb +88 -22
  118. data/test/ft_45_citerator.rb +57 -11
  119. data/test/ft_49_condition.rb +4 -2
  120. data/test/ft_4_misc.rb +24 -3
  121. data/test/ft_50_xml_attribute.rb +17 -20
  122. data/test/ft_54_listen.rb +1 -1
  123. data/test/ft_54b_listen.rb +2 -2
  124. data/test/ft_56_timeout.rb +8 -1
  125. data/test/ft_57_a.rb +10 -10
  126. data/test/ft_59_ps.rb +49 -16
  127. data/test/ft_60_ecancel.rb +52 -10
  128. data/test/ft_63_pause.rb +8 -8
  129. data/test/ft_65_stringlaunch.rb +4 -6
  130. data/test/ft_67_schedlaunch.rb +4 -4
  131. data/test/ft_69_cancelmissing.rb +4 -2
  132. data/test/ft_70_lookupvar.rb +2 -2
  133. data/test/ft_72_lookup_processes.rb +2 -2
  134. data/test/ft_73_cancel_sub.rb +8 -8
  135. data/test/ft_77_segments.rb +38 -0
  136. data/test/ft_78_eval.rb +154 -0
  137. data/test/ft_79_tticket.rb +185 -0
  138. data/test/ft_80_spname.rb +95 -0
  139. data/test/ft_81_exp.rb +64 -0
  140. data/test/ft_82_trecu.rb +48 -0
  141. data/test/ft_83_badpause.rb +62 -0
  142. data/test/ft_84_updateexp.rb +125 -0
  143. data/test/ft_9b_cursor.rb +105 -0
  144. data/test/ft_tests.rb +14 -1
  145. data/test/hash_test.rb +7 -7
  146. data/test/hparticipant_test.rb +4 -4
  147. data/test/lookup_vf_test.rb +94 -0
  148. data/test/misc_test.rb +5 -3
  149. data/test/orest_test.rb +4 -3
  150. data/test/param_test.rb +12 -16
  151. data/test/participant_test.rb +36 -0
  152. data/test/pending.rb +10 -10
  153. data/test/rake_ltest.rb +1 -10
  154. data/test/rake_qtest.rb +7 -6
  155. data/test/raw_prog_test.rb +89 -121
  156. data/test/restart_cron_test.rb +84 -36
  157. data/test/restart_paused_test.rb +100 -0
  158. data/test/restart_sleep_test.rb +1 -1
  159. data/test/restart_tests.rb +1 -0
  160. data/test/restart_when_test.rb +33 -22
  161. data/test/ruby_procdef_test.rb +19 -18
  162. data/test/sec_test.rb +74 -35
  163. data/test/storage_test.rb +44 -0
  164. data/test/test.rb +3 -0
  165. data/test/timeout_test.rb +7 -18
  166. data/test/wfid_test.rb +2 -1
  167. data/test/wi_test.rb +29 -18
  168. metadata +121 -57
  169. data/lib/openwfe/expressions/raw_xml.rb +0 -176
  170. data/lib/openwfe/expressions/simplerep.rb +0 -266
  171. data/lib/openwfe/util/kotoba.rb +0 -236
  172. data/lib/openwfe/util/lru.rb +0 -171
  173. data/lib/openwfe/util/otime.rb +0 -246
  174. data/lib/openwfe/util/safe.rb +0 -160
  175. data/lib/openwfe/util/scheduler.rb +0 -1158
  176. data/test/cron_test.rb +0 -113
  177. data/test/cronline_test.rb +0 -60
  178. data/test/dollar_test.rb +0 -90
  179. data/test/kotoba_test.rb +0 -72
  180. data/test/lru_test.rb +0 -79
  181. data/test/safely_test.rb +0 -84
  182. data/test/scheduler_1_test.rb +0 -88
  183. data/test/scheduler_test.rb +0 -363
  184. data/test/time_test.rb +0 -84
@@ -0,0 +1,100 @@
1
+ #
2
+ # Testing OpenWFE
3
+ #
4
+ # John Mettraux at openwfe.org
5
+ #
6
+ # Thu Feb 7 15:26:57 JST 2008
7
+ #
8
+
9
+ require 'test/unit'
10
+
11
+ require 'openwfe/workitem'
12
+ require 'openwfe/engine/file_persisted_engine'
13
+ require 'openwfe/def'
14
+
15
+ require 'rutest_utils'
16
+
17
+ include OpenWFE
18
+
19
+
20
+ class RestartPauseTest < Test::Unit::TestCase
21
+
22
+ #def setup
23
+ #end
24
+
25
+ #def teardown
26
+ #end
27
+
28
+ #
29
+ # sleep tests
30
+
31
+ class SleepDef < ProcessDefinition
32
+ _sleep :for => "1M"
33
+ end
34
+
35
+ def test_restart_0
36
+ dotest FilePersistedEngine, SleepDef
37
+ end
38
+ def test_restart_1
39
+ dotest CachedFilePersistedEngine, SleepDef
40
+ end
41
+
42
+ protected
43
+
44
+ def dotest (engine_class, def_class)
45
+
46
+ #require 'fileutils'
47
+ #FileUtils.remove_dir "work" if File.exist? "work"
48
+
49
+ engine = new_engine engine_class
50
+
51
+ #$OWFE_LOG.level = Logger::DEBUG
52
+
53
+ li = LaunchItem.new def_class
54
+
55
+ fei = engine.launch li
56
+
57
+ sleep 0.350
58
+
59
+ engine.pause_process fei.wfid
60
+
61
+ sleep 0.350
62
+
63
+ engine.stop
64
+
65
+ $OWFE_LOG.warn "stopped the engine"
66
+
67
+ old_engine = engine
68
+ engine = new_engine engine_class
69
+
70
+ #$OWFE_LOG.level = Logger::DEBUG
71
+
72
+ $OWFE_LOG.warn "started the new engine"
73
+
74
+ sleep 0.350
75
+
76
+ assert_equal(
77
+ true, engine.get_expression_pool.paused_instances[fei.wfid])
78
+
79
+ engine.stop
80
+
81
+ sleep 0.350
82
+ end
83
+
84
+ def new_engine (engine_class)
85
+
86
+ engine = engine_class.new()
87
+
88
+ tracer = Tracer.new
89
+ engine.application_context["__tracer"] = tracer
90
+
91
+ #engine.register_participant :nemo, NullParticipant
92
+
93
+ #engine.reschedule
94
+ engine.reload
95
+
96
+ engine
97
+ end
98
+
99
+ end
100
+
@@ -12,7 +12,7 @@ require 'test/unit'
12
12
 
13
13
  require 'openwfe/workitem'
14
14
  require 'openwfe/engine/file_persisted_engine'
15
- require 'openwfe/expressions/raw_prog'
15
+ require 'openwfe/def'
16
16
 
17
17
  require 'rutest_utils'
18
18
 
@@ -12,4 +12,5 @@
12
12
  require 'restart_sleep_test'
13
13
  require 'restart_cron_test'
14
14
  require 'restart_when_test'
15
+ require 'restart_paused_test'
15
16
 
@@ -12,7 +12,7 @@ require 'test/unit'
12
12
 
13
13
  require 'openwfe/workitem'
14
14
  require 'openwfe/engine/file_persisted_engine'
15
- require 'openwfe/expressions/raw_prog'
15
+ require 'openwfe/def'
16
16
 
17
17
  require 'rutest_utils'
18
18
 
@@ -29,22 +29,21 @@ class RestartWhenTest < Test::Unit::TestCase
29
29
  #end
30
30
 
31
31
  class RestartWhenDefinition0 < ProcessDefinition
32
- def make
33
- concurrence do
34
- _when :test => "${v:done} == true", :frequency => "1s" do
35
- #_when :test => "${v:done} == true" do
36
- _print "when triggered"
37
- end
38
- sequence do
39
- _sleep "2s"
40
- _set :variable => "done", :value => "true"
41
- _print "done"
42
- end
32
+ concurrence do
33
+ _when :test => "${v:done} == true", :frequency => "1s" do
34
+ #_when :test => "${v:done} == true" do
35
+ _print "when triggered"
36
+ end
37
+ sequence do
38
+ _sleep "2s"
39
+ _set :variable => "done", :value => "true"
40
+ _print "done"
43
41
  end
44
42
  end
45
43
  end
46
44
 
47
45
  def test_restart_0
46
+
48
47
  dotest FilePersistedEngine
49
48
  end
50
49
 
@@ -56,24 +55,27 @@ class RestartWhenTest < Test::Unit::TestCase
56
55
 
57
56
  def dotest (engine_class)
58
57
 
59
- engine = new_engine(engine_class)
58
+ engine = new_engine engine_class
60
59
 
61
- li = LaunchItem.new(RestartWhenDefinition0)
60
+ li = LaunchItem.new RestartWhenDefinition0
62
61
 
63
- engine.launch(li)
62
+ engine.launch li
64
63
 
65
- sleep(1)
64
+ sleep 1
66
65
 
67
- engine.stop()
66
+ engine.stop
68
67
 
69
- $OWFE_LOG.warn "stopped the engine"
68
+ $OWFE_LOG.warn " === stopped the engine"
69
+ #display_pool :one
70
70
 
71
71
  old_engine = engine
72
- engine = new_engine(engine_class)
72
+ engine = new_engine engine_class
73
73
 
74
- $OWFE_LOG.warn "started the new engine"
74
+ $OWFE_LOG.warn " === started the new engine"
75
+ #display_pool :two
75
76
 
76
- sleep(3)
77
+ sleep 3
78
+ #display_pool :three
77
79
 
78
80
  s_old = old_engine.application_context["__tracer"].to_s
79
81
  s_now = engine.application_context["__tracer"].to_s
@@ -88,9 +90,18 @@ class RestartWhenTest < Test::Unit::TestCase
88
90
  engine.stop
89
91
  end
90
92
 
93
+ #def display_pool (msg)
94
+ # puts
95
+ # puts ".... #{msg}"
96
+ # puts `ls -R work`
97
+ # puts
98
+ #end
99
+
91
100
  def new_engine (engine_class)
92
101
 
93
- engine = engine_class.new()
102
+ engine = engine_class.new
103
+
104
+ #$OWFE_LOG.level = Logger::DEBUG
94
105
 
95
106
  tracer = Tracer.new
96
107
  engine.application_context["__tracer"] = tracer
@@ -50,21 +50,19 @@ class RubyProcDefTest < Test::Unit::TestCase
50
50
  fei1 = @engine.launch Test0
51
51
  sleep 0.200
52
52
 
53
- stack0 = @engine.get_process_stack fei0.wfid
54
- #puts stack0
55
- stack1 = @engine.get_process_stack fei1.wfid
56
- #puts stack1
53
+ stack0 = @engine.process_stack fei0.wfid
54
+ stack1 = @engine.process_stack fei1.wfid
57
55
 
58
- assert_equal stack0.size, 3
59
- assert_equal stack1.size, 3
56
+ assert_equal 3, stack0.size
57
+ assert_equal 3, stack1.size
60
58
 
61
- assert_equal count_files(fei0.wfid), 4
62
- assert_equal count_files(fei1.wfid), 4
59
+ assert_equal 4, count_files(fei0.wfid)
60
+ assert_equal 4, count_files(fei1.wfid)
63
61
 
64
62
  @engine.cancel_process(fei0.wfid)
65
63
  @engine.cancel_process(fei1.wfid)
66
64
 
67
- sleep 0.100
65
+ sleep 0.350
68
66
  end
69
67
 
70
68
 
@@ -79,27 +77,30 @@ end
79
77
  def test_1
80
78
 
81
79
  fei0 = launch TEST1
82
- sleep 0.200
80
+ sleep 0.100
83
81
  fei1 = launch TEST1
84
82
  sleep 0.200
85
83
 
86
- assert_equal ProcessDefinition.extract_class(TEST1), Test1
84
+ #assert_equal ProcessDefinition.extract_class(TEST1), Test1
85
+ assert_equal(
86
+ OpenWFE::ProcessDefinition::Test1,
87
+ ProcessDefinition.extract_class(TEST1))
87
88
 
88
- stack0 = @engine.get_process_stack fei0.wfid
89
+ stack0 = @engine.process_stack fei0.wfid
89
90
  #puts stack0
90
- stack1 = @engine.get_process_stack fei1.wfid
91
+ stack1 = @engine.process_stack fei1.wfid
91
92
  #puts stack1
92
93
 
93
- assert_equal stack0.size, 3
94
- assert_equal stack1.size, 3
94
+ assert_equal 3, stack0.size
95
+ assert_equal 3, stack1.size
95
96
 
96
- assert_equal count_files(fei0.wfid), 4
97
- assert_equal count_files(fei1.wfid), 4
97
+ assert_equal 4, count_files(fei0.wfid)
98
+ assert_equal 4, count_files(fei1.wfid)
98
99
 
99
100
  @engine.cancel_process(fei0.wfid)
100
101
  @engine.cancel_process(fei1.wfid)
101
102
 
102
- sleep 0.100
103
+ sleep 0.350
103
104
  end
104
105
 
105
106
  protected
@@ -47,28 +47,6 @@ class SecTest < Test::Unit::TestCase
47
47
  "Insecure operation - initialize",
48
48
  "logs/openwferu.log").size > 0)
49
49
 
50
- def1 =
51
- '''<process-definition name="" revision="0">
52
- <sequence>
53
- <reval>
54
- class Object
55
- def my_name
56
- "toto"
57
- end
58
- end
59
- "stringobject".my_name
60
- </reval>
61
- </sequence>
62
- </process-definition>'''
63
-
64
- dotest engine, def1
65
-
66
- assert_equal(
67
- 1,
68
- OpenWFE::grep(
69
- "undefined method `my_name' for \"stringobject\":String",
70
- "logs/openwferu.log").size)
71
-
72
50
  def2 =
73
51
  '''<process-definition name="" revision="0">
74
52
  <sequence>
@@ -103,6 +81,50 @@ class SecTest < Test::Unit::TestCase
103
81
  engine.stop
104
82
  end
105
83
 
84
+ def test_sec_0b
85
+
86
+ engine = OpenWFE::Engine.new
87
+
88
+ engine.ac[:ruby_eval_allowed] = true
89
+
90
+ def1 =
91
+ '''<process-definition name="" revision="0">
92
+ <sequence>
93
+ <reval>
94
+ class Object
95
+ def my_name
96
+ "toto"
97
+ end
98
+ end
99
+ "stringobject".my_name
100
+ </reval>
101
+ </sequence>
102
+ </process-definition>'''
103
+
104
+ dotest engine, def1
105
+
106
+ assert_equal(
107
+ 1,
108
+ OpenWFE::grep(
109
+ "undefined method `my_name' for \"stringobject\":String",
110
+ "logs/openwferu.log").size)
111
+ #assert_equal(
112
+ # 1,
113
+ # OpenWFE::grep(
114
+ # "Insecure: can't set constant",
115
+ # "logs/openwferu.log").size)
116
+ #
117
+ # level 4 is too much (can't modify hashes)...
118
+ end
119
+
120
+ XMLDEF =
121
+ '''<process-definition name="" revision="0">
122
+ <sequence>
123
+ <set field="f" value="${ruby:5*7}" />
124
+ <toto/>
125
+ </sequence>
126
+ </process-definition>'''
127
+
106
128
  def test_sec_1
107
129
 
108
130
  value = nil
@@ -119,31 +141,48 @@ class SecTest < Test::Unit::TestCase
119
141
  value = "#{workitem.attributes.size}_#{workitem.f}"
120
142
  end
121
143
 
122
- def0 =
123
- '''<process-definition name="" revision="0">
124
- <sequence>
125
- <set field="f" value="${ruby:5*7}" />
126
- <toto/>
127
- </sequence>
128
- </process-definition>'''
129
-
130
- engine.launch(OpenWFE::LaunchItem.new(def0))
144
+ engine.launch XMLDEF
131
145
 
132
- sleep 0.200
146
+ sleep 0.350
133
147
 
134
148
  assert_equal "3_", value
135
149
 
150
+ engine.stop
151
+ end
152
+
153
+ def test_sec_1b
154
+
155
+ value = nil
156
+
157
+ engine = OpenWFE::Engine.new
158
+
159
+ engine.register_participant(:toto) do |workitem|
160
+
161
+ workitem.attributes.delete("___map_type")
162
+ #
163
+ # if the xmlencoder was used in previous, this field
164
+ # might be set, removing it.
165
+
166
+ value = "#{workitem.attributes.size}_#{workitem.f}"
167
+ end
168
+
136
169
  engine.ac[:ruby_eval_allowed] = true
137
170
 
138
- engine.launch(OpenWFE::LaunchItem.new(def0))
171
+ engine.launch XMLDEF
139
172
 
140
- sleep 0.200
173
+ sleep 0.350
141
174
 
142
175
  assert_equal "3_35", value
143
176
 
144
177
  engine.stop
145
178
  end
146
179
 
180
+ def test_sec_2
181
+
182
+ assert_equal 35, Rufus::eval_safely("5*7", 4)
183
+ assert_equal 35, Rufus::eval_safely("5*7", 4, binding())
184
+ end
185
+
147
186
  protected
148
187
 
149
188
  def dotest (engine, def_or_li)
@@ -156,7 +195,7 @@ class SecTest < Test::Unit::TestCase
156
195
 
157
196
  engine.launch(li)
158
197
 
159
- sleep 0.250
198
+ sleep 0.350
160
199
  end
161
200
 
162
201
  end
@@ -0,0 +1,44 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Mon Dec 10 18:02:59 JST 2007
8
+ #
9
+
10
+ require 'test/unit'
11
+
12
+ require 'openwfe/expool/expstorage'
13
+
14
+
15
+ class Vehicle
16
+ end
17
+ class Car < Vehicle
18
+ end
19
+ class Animal
20
+ end
21
+
22
+ class StorageTest < Test::Unit::TestCase
23
+
24
+ #def setup
25
+ #end
26
+
27
+ #def teardown
28
+ #end
29
+
30
+ def test_class_accepted
31
+
32
+ esb = Object.new
33
+ class << esb
34
+ include OpenWFE::ExpressionStorageBase
35
+ end
36
+
37
+ assert (esb.class_accepted?(Vehicle.new, nil, nil))
38
+ assert (esb.class_accepted?(Vehicle.new, [ Vehicle ], nil))
39
+ assert (not esb.class_accepted?(Vehicle.new, nil, [ Vehicle ]))
40
+
41
+ assert (esb.class_accepted?(Car.new, [ Vehicle ], nil))
42
+ assert (not esb.class_accepted?(Car.new, nil, [ Vehicle ]))
43
+ end
44
+ end