openwferu 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/{README → README.txt} +16 -13
  2. data/bin/validate-workflow.rb +46 -22
  3. data/examples/README.txt +8 -0
  4. data/examples/homeworkreview.rb +66 -0
  5. data/examples/quotereporter.rb +154 -0
  6. data/lib/{openwferu.rb → openwfe.rb} +6 -8
  7. data/lib/{ru → openwfe}/contextual.rb +11 -3
  8. data/lib/{ru → openwfe/engine}/engine.rb +50 -36
  9. data/lib/{ru/participant.rb → openwfe/engine/file_persisted_engine.rb} +21 -22
  10. data/lib/openwfe/expool/expressionpool.rb +534 -0
  11. data/lib/openwfe/expool/expstorage.rb +184 -0
  12. data/lib/openwfe/expool/journalexpstorage.rb +312 -0
  13. data/lib/openwfe/expool/yamlexpstorage.rb +127 -0
  14. data/lib/{ru → openwfe/expressions}/environment.rb +19 -14
  15. data/lib/{ru → openwfe/expressions}/expressionmap.rb +48 -21
  16. data/lib/{ru → openwfe/expressions}/fe_concurrence.rb +111 -35
  17. data/lib/openwfe/expressions/fe_cursor.rb +236 -0
  18. data/lib/{ru → openwfe/expressions}/fe_define.rb +5 -5
  19. data/lib/openwfe/expressions/fe_fqv.rb +99 -0
  20. data/lib/openwfe/expressions/fe_iterator.rb +182 -0
  21. data/lib/{ru/fe_misc.rb → openwfe/expressions/fe_losfor.rb} +14 -56
  22. data/lib/openwfe/expressions/fe_misc.rb +102 -0
  23. data/lib/{ru → openwfe/expressions}/fe_participant.rb +25 -14
  24. data/lib/{ru → openwfe/expressions}/fe_raw.rb +39 -75
  25. data/lib/{ru/fe_base.rb → openwfe/expressions/fe_sequence.rb} +40 -35
  26. data/lib/{ru → openwfe/expressions}/fe_subprocess.rb +30 -14
  27. data/lib/{ru → openwfe/expressions}/fe_time.rb +59 -31
  28. data/lib/{ru → openwfe/expressions}/fe_utils.rb +42 -26
  29. data/lib/{ru → openwfe/expressions}/fe_value.rb +20 -14
  30. data/lib/openwfe/expressions/flowexpression.rb +434 -0
  31. data/lib/openwfe/expressions/raw_prog.rb +391 -0
  32. data/lib/openwfe/expressions/raw_xml.rb +128 -0
  33. data/lib/openwfe/flowexpressionid.rb +148 -0
  34. data/lib/{ru → openwfe}/logging.rb +10 -6
  35. data/lib/{osocket.rb → openwfe/osocket.rb} +36 -35
  36. data/lib/{otime.rb → openwfe/otime.rb} +71 -21
  37. data/lib/openwfe/participants/atomparticipants.rb +144 -0
  38. data/lib/openwfe/participants/enoparticipant.rb +73 -0
  39. data/lib/openwfe/participants/participant.rb +85 -0
  40. data/lib/{ru → openwfe/participants}/participantmap.rb +40 -12
  41. data/lib/{ru → openwfe/participants}/participants.rb +41 -12
  42. data/lib/openwfe/participants/soapparticipants.rb +96 -0
  43. data/lib/{controlclient.rb → openwfe/rest/controlclient.rb} +12 -13
  44. data/lib/{definitions.rb → openwfe/rest/definitions.rb} +3 -3
  45. data/lib/{exception.rb → openwfe/rest/exception.rb} +3 -3
  46. data/lib/{restclient.rb → openwfe/rest/restclient.rb} +13 -22
  47. data/lib/{worklistclient.rb → openwfe/rest/worklistclient.rb} +33 -46
  48. data/lib/openwfe/rest/xmlcodec.rb +575 -0
  49. data/lib/{ru → openwfe}/rudefinitions.rb +32 -4
  50. data/lib/{ru → openwfe}/service.rb +20 -8
  51. data/lib/openwfe/storage/yamlfilestorage.rb +159 -0
  52. data/lib/{ru → openwfe/util}/dollar.rb +10 -8
  53. data/lib/openwfe/util/lru_cache.rb +149 -0
  54. data/lib/{ru → openwfe/util}/scheduler.rb +18 -10
  55. data/lib/{ru → openwfe/util}/schedulers.rb +7 -7
  56. data/lib/{utils.rb → openwfe/utils.rb} +93 -9
  57. data/lib/openwfe/workitem.rb +366 -0
  58. data/lib/openwfe/worklist/worklists.rb +175 -0
  59. data/test/README.txt +27 -0
  60. data/test/atomtest.rb +99 -0
  61. data/test/crontest.rb +58 -0
  62. data/test/dollartest.rb +3 -3
  63. data/test/feitest.rb +42 -14
  64. data/test/file_persistence_test.rb +93 -0
  65. data/test/flowtestbase.rb +72 -26
  66. data/test/ft_0.rb +1 -97
  67. data/test/ft_0b_sequence.rb +33 -0
  68. data/test/ft_0c_testname.rb +29 -0
  69. data/test/ft_10_loop.rb +48 -0
  70. data/test/ft_11_ppd.rb +292 -0
  71. data/test/ft_12_blockparticipant.rb +45 -0
  72. data/test/ft_13_eno.rb +51 -0
  73. data/test/ft_14_subprocess.rb +90 -0
  74. data/test/ft_14b_subprocess.rb +40 -0
  75. data/test/ft_15_iterator.rb +70 -0
  76. data/test/ft_16_fqv.rb +57 -0
  77. data/test/ft_1_unset.rb +25 -1
  78. data/test/ft_2_concurrence.rb +10 -5
  79. data/test/ft_3_equals.rb +35 -1
  80. data/test/ft_4_misc.rb +16 -1
  81. data/test/ft_5_time.rb +26 -1
  82. data/test/ft_6_lambda.rb +2 -1
  83. data/test/{ft_7_losfor.rb → ft_7_lose.rb} +41 -35
  84. data/test/ft_8_forget.rb +46 -0
  85. data/test/ft_9_cursor.rb +94 -0
  86. data/test/journal_persistence_test.rb +147 -0
  87. data/test/misctest.rb +13 -9
  88. data/test/rake_ptest.rb +18 -0
  89. data/test/rake_qtest.rb +43 -0
  90. data/test/{fulltest.rb → rake_test.rb} +2 -2
  91. data/test/raw_prog_test.rb +236 -0
  92. data/test/rest_test.rb +189 -0
  93. data/test/rutest_utils.rb +1 -1
  94. data/test/timetest.rb +42 -34
  95. metadata +125 -82
  96. data/lib/codec.rb +0 -573
  97. data/lib/flowexpressionid.rb +0 -139
  98. data/lib/ru/expressionpool.rb +0 -382
  99. data/lib/ru/expressionstorage.rb +0 -99
  100. data/lib/ru/flowexpression.rb +0 -272
  101. data/lib/ru/ruutils.rb +0 -70
  102. data/lib/test.rb +0 -222
  103. data/lib/workitem.rb +0 -249
  104. data/test/quicktest.rb +0 -21
@@ -0,0 +1,292 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Tue Jan 2 13:14:37 JST 2007
8
+ #
9
+
10
+ require 'flowtestbase'
11
+ require 'openwfe/expressions/raw_prog'
12
+
13
+ include OpenWFE
14
+
15
+
16
+ class FlowTest11 < FlowTestBase
17
+
18
+ #def setup
19
+ #end
20
+
21
+ #def teardown
22
+ #end
23
+
24
+ #
25
+ # Test 0
26
+ #
27
+
28
+ class TestDefinition0 < ProcessDefinition
29
+ def make
30
+ process_definition :name => "test0", :revision => "0" do
31
+ sequence do
32
+ _print do "a" end
33
+ _print { "b" }
34
+ _print "c"
35
+ #
36
+ # all these notations for nesting a string
37
+ # are allowed
38
+ #
39
+ # of course, the latter one is the nicest
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def test_ppd_0
46
+ #def xxxx_ppd_0
47
+ dotest(
48
+ TestDefinition0,
49
+ """a
50
+ b
51
+ c""")
52
+ end
53
+
54
+
55
+ #
56
+ # Test 1
57
+ #
58
+
59
+ class TestDefinition1 < ProcessDefinition
60
+ def make
61
+ process_definition :name => "test1", :revision => "0" do
62
+ sequence do
63
+ set :variable => "toto", :value => "nada"
64
+ _print "toto:${toto}"
65
+ set :field => "ftoto" do
66
+ "_${toto}__${r:'123'.reverse}"
67
+ end
68
+ _print { "ftoto:${f:ftoto}" }
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ def test_ppd_1
75
+ #def xxxx_ppd_1
76
+ dotest(
77
+ TestDefinition1,
78
+ """toto:nada
79
+ ftoto:_nada__321""")
80
+ end
81
+
82
+
83
+ #
84
+ # Test 2
85
+ #
86
+
87
+ class TestDefinition2 < ProcessDefinition
88
+ def make
89
+ process_definition :name => "test2", :revision => "0" do
90
+ sequence do
91
+ set :variable => "toto", :value => "nada"
92
+ _if do
93
+ equals :variable_value => "toto", :other_value => "nada"
94
+ _print "toto:${toto}"
95
+ _print "not ok"
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+
102
+ def test_ppd_2
103
+ #def xxxx_ppd_2
104
+ dotest(
105
+ TestDefinition2,
106
+ "toto:nada")
107
+ end
108
+
109
+
110
+ #
111
+ # Test 3
112
+ #
113
+
114
+ class TestDefinition3 < ProcessDefinition
115
+ def make
116
+ process_definition :name => "test3", :revision => "0" do
117
+ sequence do
118
+ subprocess :ref => "sub0", :var0 => "a"
119
+ sub0 :var0 => "b"
120
+ end
121
+ process_definition :name => "sub0" do
122
+ _print "var0 is '${var0}'"
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ def test_ppd_3
129
+ #def xxxx_ppd_3
130
+
131
+ #puts
132
+ #puts TestDefinition3.do_make(ExpressionMap.new(nil, nil)).to_code_s
133
+ #puts
134
+ #puts TestDefinition3.do_make(ExpressionMap.new(nil, nil)).to_s
135
+
136
+ dotest(
137
+ TestDefinition3,
138
+ """var0 is 'a'
139
+ var0 is 'b'""")
140
+ end
141
+
142
+
143
+ #
144
+ # Test 4
145
+ #
146
+
147
+ class TestDefinition4 < ProcessDefinition
148
+ def make
149
+ process_definition :name => "test4", :revision => "0" do
150
+ sequence do
151
+ sequence do
152
+ _print "a"
153
+ end
154
+ sequence do
155
+ _print "b"
156
+ end
157
+ end
158
+ end
159
+ end
160
+ end
161
+
162
+ CODE4 = """
163
+ process_definition :name => 'test4', :revision => '0' do
164
+ sequence do
165
+ sequence do
166
+ _print do
167
+ 'a'
168
+ end
169
+ end
170
+ sequence do
171
+ _print do
172
+ 'b'
173
+ end
174
+ end
175
+ end
176
+ end
177
+ """.strip
178
+
179
+ def test_ppd_4
180
+ #def xxxx_ppd_4
181
+
182
+ s = TestDefinition4.do_make(
183
+ ExpressionMap.new(nil, nil)).to_code_s
184
+
185
+ #puts
186
+ #puts s
187
+ #puts
188
+ #puts TestDefinition4.do_make(ExpressionMap.new(nil, nil)).to_s
189
+
190
+ dotest(
191
+ TestDefinition4,
192
+ """a
193
+ b""")
194
+
195
+ assert \
196
+ s == CODE4,
197
+ "nested sequences test failed (4)"
198
+ end
199
+
200
+
201
+ #
202
+ # Test 5
203
+ #
204
+
205
+ class TestDefinition5 < ProcessDefinition
206
+ def make
207
+ process_definition :name => "test5", :revision => "0" do
208
+ sequence do
209
+ sequence do
210
+ _print { "a" }
211
+ end
212
+ sequence do
213
+ _print { "b" }
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
219
+
220
+ CODE5 = """
221
+ process_definition :name => 'test5', :revision => '0' do
222
+ sequence do
223
+ sequence do
224
+ _print do
225
+ 'a'
226
+ end
227
+ end
228
+ sequence do
229
+ _print do
230
+ 'b'
231
+ end
232
+ end
233
+ end
234
+ end
235
+ """.strip
236
+
237
+ def test_ppd_5
238
+ #def xxxx_ppd_5
239
+
240
+ s = TestDefinition5.do_make(
241
+ ExpressionMap.new(nil, nil)).to_code_s
242
+
243
+ #puts
244
+ #puts s
245
+ #puts
246
+ #puts TestDefinition5.do_make(ExpressionMap.new(nil, nil)).to_s
247
+
248
+ dotest(
249
+ TestDefinition5,
250
+ """a
251
+ b""")
252
+
253
+ assert \
254
+ s == CODE5,
255
+ "nested sequences test failed (5)"
256
+ end
257
+
258
+
259
+ #
260
+ # Test 6
261
+ #
262
+
263
+ class TestDefinition6 < ProcessDefinition
264
+
265
+ def initialize (expressions, count)
266
+ super(expressions)
267
+ @count = count
268
+ end
269
+
270
+ def make
271
+ process_definition :name => "test6", :revision => "0" do
272
+ sequence do
273
+ @count.times do |i|
274
+ _print i
275
+ end
276
+ end
277
+ end
278
+ end
279
+ end
280
+
281
+ def test_ppd_6
282
+ #def xxxx_ppd_6
283
+
284
+ dotest(
285
+ TestDefinition6.new(@engine, 3),
286
+ """0
287
+ 1
288
+ 2""")
289
+ end
290
+
291
+ end
292
+
@@ -0,0 +1,45 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Tue Jan 2 13:14:37 JST 2007
8
+ #
9
+
10
+ require 'flowtestbase'
11
+ require 'openwfe/expressions/raw_prog'
12
+
13
+
14
+ class FlowTest12 < FlowTestBase
15
+
16
+ #def setup
17
+ #end
18
+
19
+ #def teardown
20
+ #end
21
+
22
+ #
23
+ # Test 0
24
+ #
25
+
26
+ class BpDef0 < OpenWFE::ProcessDefinition
27
+ def make
28
+ process_definition :name => "test0", :revision => "0" do
29
+ sequence do
30
+ participant :ref => "block-participant"
31
+ _print "done."
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ def test_block_participant
38
+ dotest(
39
+ BpDef0,
40
+ """the block participant received a workitem
41
+ done.""")
42
+ end
43
+
44
+ end
45
+
@@ -0,0 +1,51 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Tue Jan 2 13:14:37 JST 2007
8
+ #
9
+
10
+ require 'openwfe/expressions/raw_prog'
11
+ require 'openwfe/participants/participants'
12
+ require 'openwfe/participants/enoparticipant'
13
+ require 'flowtestbase'
14
+
15
+
16
+ class FlowTest13 < FlowTestBase
17
+
18
+ #def setup
19
+ #end
20
+
21
+ #def teardown
22
+ #end
23
+
24
+ #
25
+ # Test 0
26
+ #
27
+
28
+ class TestDefinition0 < OpenWFE::ProcessDefinition
29
+ def make
30
+ process_definition :name => "test0", :revision => "0" do
31
+ sequence do
32
+ set :field => 'email_target' do
33
+ "whatever56x56@gmail.com"
34
+ end
35
+ set :field => 'customer_name' do
36
+ "Monsieur Toto"
37
+ end
38
+ participant :ref => 'eno'
39
+ print "ok"
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def test_ppd_0
46
+ dotest(
47
+ TestDefinition0,
48
+ "ok")
49
+ end
50
+ end
51
+
@@ -0,0 +1,90 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Mon Oct 9 22:19:44 JST 2006
8
+ #
9
+
10
+ require 'flowtestbase'
11
+
12
+
13
+ class FlowTest14 < FlowTestBase
14
+
15
+ #def setup
16
+ #end
17
+
18
+ #def teardown
19
+ #end
20
+
21
+ def test_subprocess_ref_0
22
+ dotest(\
23
+ '''<process-definition name="subtest0" revision="0">
24
+
25
+ <subprocess ref="sub0" />
26
+
27
+ <process-definition name="sub0">
28
+ <print>ok</print>
29
+ </process-definition>
30
+
31
+ </process-definition>''', 'ok')
32
+ end
33
+
34
+ def test_subprocess_ref_1
35
+ dotest(\
36
+ '''<process-definition name="subtest0" revision="0">
37
+
38
+ <sequence>
39
+ <subprocess ref="sub0" />
40
+ <subprocess ref="sub0" />
41
+ </sequence>
42
+
43
+ <process-definition name="sub0">
44
+ <print>ok</print>
45
+ </process-definition>
46
+
47
+ </process-definition>''', '''ok
48
+ ok''')
49
+ end
50
+
51
+ def test_subprocess_ref_2
52
+ dotest(\
53
+ '''<process-definition name="subtest0" revision="0">
54
+
55
+ <sequence>
56
+ <sub0 />
57
+ <print>after</print>
58
+ </sequence>
59
+
60
+ <process-definition name="sub0">
61
+ <print>ok</print>
62
+ </process-definition>
63
+
64
+ </process-definition>''', '''ok
65
+ after''')
66
+ end
67
+
68
+ def test_subprocess_ref_3
69
+ dotest(\
70
+ '''<process-definition name="subtest0" revision="0">
71
+
72
+ <sequence>
73
+ <set variable="v" value="out" />
74
+ <sub0 />
75
+ <print>after : ${v}</print>
76
+ </sequence>
77
+
78
+ <process-definition name="sub0">
79
+ <sequence>
80
+ <set variable="v" value="in" />
81
+ <print>ok : ${v}</print>
82
+ </sequence>
83
+ </process-definition>
84
+
85
+ </process-definition>''', '''ok : in
86
+ after : out''')
87
+ end
88
+
89
+ end
90
+