openwferu 0.9.1 → 0.9.2

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.
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,40 @@
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 FlowTest14b < FlowTestBase
14
+
15
+ #def setup
16
+ #end
17
+
18
+ #def teardown
19
+ #end
20
+
21
+ def test_subprocess_ref_0
22
+ #def xxxx_subprocess_ref_0
23
+ dotest(\
24
+ '''<process-definition name="subtest0" revision="0">
25
+
26
+ <sequence>
27
+ <subprocess ref="sub0" a="A" b="B" c="C" />
28
+ <sub0 a="A" b="B" c="C" />
29
+ </sequence>
30
+
31
+ <process-definition name="sub0">
32
+ <print>${a}${b}${c}</print>
33
+ </process-definition>
34
+
35
+ </process-definition>''', '''ABC
36
+ ABC''')
37
+ end
38
+
39
+ end
40
+
@@ -0,0 +1,70 @@
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 FlowTest15 < 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
+ iterator :on_value => "x, y, z", :to_variable => "v0" do
32
+ _print "${f:__ip__} -- ${v0}"
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ def test_ppd_0
39
+ dotest(
40
+ TestDefinition0,
41
+ """0 -- x
42
+ 1 -- y
43
+ 2 -- z""")
44
+ end
45
+
46
+ #
47
+ # Test 1
48
+ #
49
+
50
+ class TestDefinition1 < OpenWFE::ProcessDefinition
51
+ def make
52
+ process_definition :name => "test1", :revision => "0" do
53
+ iterator :on_value => "x, y, z", :to_field => "f0" do
54
+ _print "${f:__ip__} -- ${f:f0}"
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ def test_ppd_1
61
+ #def xxxx_ppd_1
62
+ dotest(
63
+ TestDefinition1,
64
+ """0 -- x
65
+ 1 -- y
66
+ 2 -- z""")
67
+ end
68
+
69
+ end
70
+
@@ -0,0 +1,57 @@
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 FlowTest16 < FlowTestBase
14
+
15
+ #def setup
16
+ #end
17
+
18
+ #def teardown
19
+ #end
20
+
21
+ def test_fqv_0
22
+ dotest(\
23
+ '''<process-definition name="n" revision="0">
24
+ <sequence>
25
+ <set variable="x"><q>y</q></set>
26
+ <print>x is "${x}"</print>
27
+ </sequence>
28
+ </process-definition>''',
29
+ 'x is "y"')
30
+ end
31
+
32
+ def test_fqv_1
33
+ dotest(\
34
+ '''<process-definition name="n" revision="0">
35
+ <sequence>
36
+ <set variable="x0"><q>y0</q></set>
37
+ <set variable="x1"><v>x0</v></set>
38
+ <print>x1 is "${x1}"</print>
39
+ </sequence>
40
+ </process-definition>''',
41
+ 'x1 is "y0"')
42
+ end
43
+
44
+ def test_fqv_2
45
+ dotest(\
46
+ '''<process-definition name="n" revision="0">
47
+ <sequence>
48
+ <set field="x0"><q>y0</q></set>
49
+ <set variable="x1"><f>x0</f></set>
50
+ <print>x1 is "${x1}"</print>
51
+ </sequence>
52
+ </process-definition>''',
53
+ 'x1 is "y0"')
54
+ end
55
+
56
+ end
57
+
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -148,5 +148,29 @@ unset')
148
148
  </process-definition>''', 'false')
149
149
  end
150
150
 
151
+ def test_set_with_nested_string_0
152
+ dotest(\
153
+ '''<process-definition name="set_a1f" revision="0">
154
+ <sequence>
155
+ <set variable="x">
156
+ ${r:"1234".reverse}
157
+ </set>
158
+ <print>${x}</print>
159
+ </sequence>
160
+ </process-definition>''', '4321')
161
+ end
162
+
163
+ def test_set_with_nested_string_1
164
+ dotest(\
165
+ '''<process-definition name="set_a1f" revision="0">
166
+ <sequence>
167
+ <set field="x">
168
+ ${r:"1234".reverse}
169
+ </set>
170
+ <print>${f:x}</print>
171
+ </sequence>
172
+ </process-definition>''', '4321')
173
+ end
174
+
151
175
  end
152
176
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -18,6 +18,7 @@ class FlowTest2 < FlowTestBase
18
18
  #def teardown
19
19
  #end
20
20
 
21
+ #def xxxx_con_0
21
22
  def test_con_0
22
23
  dotest(\
23
24
  '''<process-definition name="con" revision="0">
@@ -25,11 +26,12 @@ class FlowTest2 < FlowTestBase
25
26
  <print>a</print>
26
27
  <print>b</print>
27
28
  </concurrence>
28
- </process-definition>''', [ '''a,
29
+ </process-definition>''', [ '''a
29
30
  b''', '''b
30
- a''' ], 0.1 )
31
+ a''' ])
31
32
  end
32
33
 
34
+ #def xxxx_con_1
33
35
  def test_con_1
34
36
  dotest(\
35
37
  '''<process-definition name="con" revision="1">
@@ -37,9 +39,12 @@ a''' ], 0.1 )
37
39
  count="1"
38
40
  >
39
41
  <print>a</print>
40
- <print>b</print>
42
+ <sequence>
43
+ <sleep for="10s" />
44
+ <print>b</print>
45
+ </sequence>
41
46
  </concurrence>
42
- </process-definition>''', [ "a", "b" ], 0.1 )
47
+ </process-definition>''', "a", 0.1, false )
43
48
  end
44
49
 
45
50
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -80,5 +80,39 @@ class FlowTest3 < FlowTestBase
80
80
  </process-definition>''', "ok")
81
81
  end
82
82
 
83
+ def test_equals_0
84
+ dotest(\
85
+ '<process-definition name="'+test_name+'''" revision="0">
86
+ <sequence>
87
+ <set field="a" value="true" />
88
+ <print>${f:a}</print>
89
+ <if>
90
+ <equals field-value="a" other-value="true" />
91
+ <print>true</print>
92
+ <print>bad test_equals_0</print>
93
+ </if>
94
+ </sequence>
95
+ </process-definition>''',
96
+ """true
97
+ true""")
98
+ end
99
+
100
+ def test_equals_1
101
+ dotest(\
102
+ '<process-definition name="'+test_name+'''" revision="0">
103
+ <sequence>
104
+ <set variable="a" value="true" />
105
+ <print>${a}</print>
106
+ <if>
107
+ <equals variable-value="a" other-value="true" />
108
+ <print>true</print>
109
+ <print>bad test_equals_1</print>
110
+ </if>
111
+ </sequence>
112
+ </process-definition>''',
113
+ """true
114
+ true""")
115
+ end
116
+
83
117
  end
84
118
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -124,5 +124,20 @@ class FlowTest4 < FlowTestBase
124
124
  </process-definition>''', "WWW")
125
125
  end
126
126
 
127
+ def test_dru_4
128
+ dotest(\
129
+ '''<process-definition name="dru_4" revision="0">
130
+ <sequence>
131
+ <set variable="v">
132
+ <reval>@fei.workflow_definition_name</reval>
133
+ </set>
134
+ <print>${v}</print>
135
+
136
+ <print>${r:@fei.workflow_definition_name}</print>
137
+ </sequence>
138
+ </process-definition>''', """dru_4
139
+ dru_4""")
140
+ end
141
+
127
142
  end
128
143
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -19,6 +19,7 @@ class FlowTest5 < FlowTestBase
19
19
  #end
20
20
 
21
21
  def test_sleep_0
22
+ #def xxxx_sleep_0
22
23
  dotest(\
23
24
  '''<process-definition name="sleep_0" revision="0">
24
25
  <sequence>
@@ -29,6 +30,7 @@ class FlowTest5 < FlowTestBase
29
30
  end
30
31
 
31
32
  def test_sleep_1
33
+ #def xxxx_sleep_1
32
34
  dotest(\
33
35
  '''<process-definition name="sleep_1" revision="0">
34
36
  <concurrence>
@@ -43,6 +45,7 @@ alpha""", 3)
43
45
  end
44
46
 
45
47
  def test_sleep_2
48
+ #def xxxx_sleep_2
46
49
  dotest(\
47
50
  '''<process-definition name="sleep_2" revision="0">
48
51
  <sequence>
@@ -52,5 +55,27 @@ alpha""", 3)
52
55
  </process-definition>''', """alpha""", 5)
53
56
  end
54
57
 
58
+ def test_sleep_3
59
+ #def xxxx_sleep_3
60
+ dotest(\
61
+ '''<process-definition name="sleep_3" revision="0">
62
+ <sequence>
63
+ <sleep for="900" />
64
+ <print>alpha</print>
65
+ </sequence>
66
+ </process-definition>''', "alpha", 1.5)
67
+ end
68
+
69
+ def test_sleep_4
70
+ #def xxxx_sleep_4
71
+ dotest(\
72
+ '''<process-definition name="sleep_4" revision="0">
73
+ <sequence>
74
+ <sleep for="1100" />
75
+ <print>alpha</print>
76
+ </sequence>
77
+ </process-definition>''', "", 1, true)
78
+ end
79
+
55
80
  end
56
81
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -20,6 +20,7 @@ class FlowTest6 < FlowTestBase
20
20
  #end
21
21
 
22
22
  def test_lambda_0
23
+ #def xxxx_lambda_0
23
24
  dotest(\
24
25
  '''<process-definition name="lambda_0" revision="0">
25
26
  <sequence>
@@ -1,6 +1,6 @@
1
1
 
2
2
  #
3
- # Testing OpenWFEru
3
+ # Testing OpenWFE
4
4
  #
5
5
  # John Mettraux at openwfe.org
6
6
  #
@@ -18,15 +18,8 @@ class FlowTest7 < FlowTestBase
18
18
  #def teardown
19
19
  #end
20
20
 
21
- def test_test_name
22
- dotest(\
23
- """<process-definition name='#{test_name}' revision='0'>
24
- <print>#{test_name}</print>
25
- </process-definition>""", "test_test_name")
26
- end
27
-
28
- #def test_lose_0
29
- def xxxx_lose_0
21
+ def test_lose_0
22
+ #def xxxx_lose_0
30
23
  dotest(\
31
24
  '<process-definition name="'+test_name+'''" revision="0">
32
25
  <sequence>
@@ -39,7 +32,7 @@ class FlowTest7 < FlowTestBase
39
32
  </sequence>
40
33
  </lose>
41
34
  <sequence>
42
- <print>ok</print>
35
+ <print>ok 0</print>
43
36
  </sequence>
44
37
  </concurrence>
45
38
 
@@ -48,7 +41,7 @@ class FlowTest7 < FlowTestBase
48
41
  <concurrence count="1">
49
42
  <lose>
50
43
  <sequence>
51
- <print>ok too</print>
44
+ <print>ok 1</print>
52
45
  <set variable="v0" value="true" />
53
46
  </sequence>
54
47
  </lose>
@@ -56,14 +49,14 @@ class FlowTest7 < FlowTestBase
56
49
  <sleep for="252" />
57
50
  <!-- 250 or less is bad : the default scheduler precision
58
51
  is 1/4 of second -->
59
- <print>ok</print>
52
+ <print>ok 2</print>
60
53
  </sequence>
61
54
  </concurrence>
62
55
 
63
56
  <print>v0 : ${v0}</print>
64
57
  <if>
65
- <equals field-value="v0" other-value="true" />
66
- <print>ok</print>
58
+ <equals variable-value="v0" other-value="true" />
59
+ <print>ok 3</print>
67
60
  </if>
68
61
 
69
62
  <print>- - -</print>
@@ -71,52 +64,65 @@ class FlowTest7 < FlowTestBase
71
64
  <concurrence count="1">
72
65
  <lose>
73
66
  <sequence>
74
- <sleep for="252" />
75
- <print>ok too</print>
67
+ <!--<sleep for="252" />-->
68
+ <sleep for="350" />
69
+ <!-- more than the 250 ms precision -->
70
+ <print>ok 4</print>
76
71
  <set variable="v1" value="true" />
77
72
  </sequence>
78
73
  </lose>
79
74
  <sequence>
80
- <print>ok</print>
75
+ <print>ok 5</print>
81
76
  </sequence>
82
77
  </concurrence>
83
78
 
84
79
  <print>v1 : ${v1}</print>
85
80
  <if>
86
81
  <equals field-value="v1" other-value="true" />
87
- <print>ok</print>
82
+ <print>ok 6</print>
88
83
  </if>
89
84
 
90
85
  <print>done.</print>
91
86
 
92
87
  </sequence>
93
- </process-definition>''', """ok
88
+ </process-definition>''',
89
+ """ok 0
94
90
  - - -
95
- ok too
96
- ok
91
+ ok 1
92
+ ok 2
97
93
  v0 : true
98
- ok
94
+ ok 3
99
95
  - - -
100
- ok
96
+ ok 5
101
97
  v1 :
102
- done.""", 9)
98
+ done.""",
99
+ 3,
100
+ true)
103
101
  end
104
102
 
105
103
  def test_lose_1
106
104
  #def xxxx_lose_1
107
105
  dotest(\
108
106
  '<process-definition name="'+test_name+'''" revision="0">
109
- <concurrence
110
- count="1"
111
- >
112
- <lose>
113
- <print>a</print>
114
- </lose>
115
- <print>b</print>
116
- </concurrence>
107
+ <sequence>
108
+ <concurrence
109
+ count="1"
110
+ >
111
+ <lose>
112
+ <sequence>
113
+ <sleep for="500" />
114
+ <print>a</print>
115
+ </sequence>
116
+ </lose>
117
+ <print>b</print>
118
+ </concurrence>
119
+ <print>c</print>
120
+ </sequence>
117
121
  </process-definition>''',
118
- [ "a", "b" ],
119
- 0.1 )
122
+ """b
123
+ c""",
124
+ 0.1,
125
+ true)
120
126
  end
121
127
 
122
128
  end