openwferu 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +4 -5
- data/lib/openwfe/engine/engine.rb +14 -14
- data/lib/openwfe/expool/expressionpool.rb +60 -45
- data/lib/openwfe/expool/expstorage.rb +1 -1
- data/lib/openwfe/expressions/condition.rb +47 -34
- data/lib/openwfe/expressions/environment.rb +29 -7
- data/lib/openwfe/expressions/expressionmap.rb +16 -1
- data/lib/openwfe/expressions/fe_concurrence.rb +142 -55
- data/lib/openwfe/expressions/fe_cursor.rb +146 -41
- data/lib/openwfe/expressions/fe_define.rb +52 -35
- data/lib/openwfe/expressions/fe_filter.rb +129 -0
- data/lib/openwfe/expressions/fe_filter_definition.rb +170 -0
- data/lib/openwfe/expressions/fe_iterator.rb +23 -10
- data/lib/openwfe/expressions/fe_losfor.rb +7 -6
- data/lib/openwfe/expressions/fe_participant.rb +19 -9
- data/lib/openwfe/expressions/fe_raw.rb +11 -16
- data/lib/openwfe/expressions/fe_save.rb +225 -0
- data/lib/openwfe/expressions/fe_sequence.rb +15 -10
- data/lib/openwfe/expressions/fe_subprocess.rb +0 -6
- data/lib/openwfe/expressions/fe_value.rb +7 -19
- data/lib/openwfe/expressions/filter.rb +104 -0
- data/lib/openwfe/expressions/flowexpression.rb +102 -36
- data/lib/openwfe/expressions/merge.rb +80 -0
- data/lib/openwfe/expressions/raw_prog.rb +21 -18
- data/lib/openwfe/filterdef.rb +259 -0
- data/lib/openwfe/flowexpressionid.rb +36 -3
- data/lib/openwfe/participants/participants.rb +7 -1
- data/lib/openwfe/rest/xmlcodec.rb +1 -1
- data/lib/openwfe/util/dollar.rb +4 -2
- data/lib/openwfe/util/scheduler.rb +3 -1
- data/lib/openwfe/util/sqs.rb +1 -2
- data/lib/openwfe/utils.rb +13 -0
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/workitem.rb +1 -1
- data/test/filter_test.rb +109 -0
- data/test/flowtestbase.rb +12 -1
- data/test/ft_11_ppd.rb +13 -1
- data/test/ft_11b_ppd.rb +45 -0
- data/test/ft_17_condition.rb +1 -1
- data/test/ft_2b_concurrence.rb +24 -0
- data/test/ft_2c_concurrence.rb +22 -1
- data/test/ft_3_equals.rb +26 -0
- data/test/ft_42_environments.rb +78 -0
- data/test/ft_43_pat10.rb +109 -0
- data/test/ft_44_save.rb +81 -0
- data/test/ft_44b_restore.rb +159 -0
- data/test/ft_45_citerator.rb +104 -0
- data/test/ft_46_pparams.rb +62 -0
- data/test/ft_47_filter.rb +165 -0
- data/test/ft_48_fe_filter.rb +91 -0
- data/test/ft_49_condition.rb +65 -0
- data/test/ft_50_xml_attribute.rb +89 -0
- data/test/ft_9_cursor.rb +36 -6
- data/test/ft_tests.rb +11 -1
- data/test/misc_test.rb +8 -0
- data/test/rake_qtest.rb +2 -2
- data/test/rutest_utils.rb +6 -1
- data/test/sec_test.rb +2 -2
- metadata +20 -2
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
|
11
|
+
include OpenWFE
|
12
|
+
|
13
|
+
|
14
|
+
class FlowTest46 < Test::Unit::TestCase
|
15
|
+
include FlowTestBase
|
16
|
+
|
17
|
+
#def setup
|
18
|
+
#end
|
19
|
+
|
20
|
+
#def teardown
|
21
|
+
#end
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Test 0
|
26
|
+
#
|
27
|
+
|
28
|
+
class TestPTask46a0 < ProcessDefinition
|
29
|
+
sequence do
|
30
|
+
|
31
|
+
participant :ref => :nemo, :description => "clean the desk"
|
32
|
+
|
33
|
+
_print "${f:description}"
|
34
|
+
# just checking that the description is wiped after usage
|
35
|
+
|
36
|
+
participant :ref => :nemo, :task => "force"
|
37
|
+
|
38
|
+
_print "${f:task}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#def xxxx_0
|
43
|
+
def test_0
|
44
|
+
|
45
|
+
@engine.register_participant :nemo do |workitem|
|
46
|
+
@tracer.puts workitem.params['description']
|
47
|
+
@tracer.puts workitem.params['task']
|
48
|
+
end
|
49
|
+
|
50
|
+
dotest(
|
51
|
+
TestPTask46a0,
|
52
|
+
"""
|
53
|
+
clean the desk
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
force
|
58
|
+
""".strip)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,165 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
|
11
|
+
include OpenWFE
|
12
|
+
|
13
|
+
|
14
|
+
class FlowTest47 < Test::Unit::TestCase
|
15
|
+
include FlowTestBase
|
16
|
+
|
17
|
+
#def setup
|
18
|
+
#end
|
19
|
+
|
20
|
+
#def teardown
|
21
|
+
#end
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Test 0
|
26
|
+
#
|
27
|
+
|
28
|
+
class TestFilter47a0 < ProcessDefinition
|
29
|
+
sequence do
|
30
|
+
_print "${v0}"
|
31
|
+
_print "${v1}"
|
32
|
+
filter_definition :name => "filter1" do
|
33
|
+
end
|
34
|
+
_defined :variable => :filter0
|
35
|
+
_print "${f:__result__}"
|
36
|
+
_defined :variable => :filter1
|
37
|
+
_print "${f:__result__}"
|
38
|
+
end
|
39
|
+
filter_definition :name => "filter0" do
|
40
|
+
end
|
41
|
+
set :variable => "v0", :value => "toto"
|
42
|
+
set :variable => "v1", :value => "hector"
|
43
|
+
end
|
44
|
+
|
45
|
+
#def xxxx_0
|
46
|
+
def test_0
|
47
|
+
dotest(
|
48
|
+
TestFilter47a0,
|
49
|
+
"toto\nhector\ntrue\ntrue")
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
#
|
54
|
+
# Test 1
|
55
|
+
#
|
56
|
+
|
57
|
+
class TestFilter47a1 < ProcessDefinition
|
58
|
+
sequence do
|
59
|
+
|
60
|
+
set :field => "readable", :value => "bible"
|
61
|
+
set :field => "writable", :value => "sand"
|
62
|
+
set :field => "randw", :value => "notebook"
|
63
|
+
set :field => "hidden", :value => "playboy"
|
64
|
+
|
65
|
+
toto
|
66
|
+
toto :filter => "filter0"
|
67
|
+
|
68
|
+
_print "${f:readable}"
|
69
|
+
_print "${f:writable}"
|
70
|
+
_print "${f:randw}"
|
71
|
+
_print "${f:hidden}"
|
72
|
+
end
|
73
|
+
|
74
|
+
filter_definition :name => "filter0" do
|
75
|
+
field :regex => "readable", :permissions => "r"
|
76
|
+
field :regex => "writable", :permissions => "w"
|
77
|
+
field :regex => "randw", :permissions => "rw"
|
78
|
+
field :regex => "hidden", :permissions => ""
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
#def xxxx_1
|
83
|
+
def test_1
|
84
|
+
|
85
|
+
@engine.register_participant :toto do |workitem|
|
86
|
+
|
87
|
+
@tracer << "filter.size is #{workitem.filter.fields.size}\n" \
|
88
|
+
if workitem.filter
|
89
|
+
|
90
|
+
@tracer << "r : #{workitem.attributes['readable']}\n"
|
91
|
+
@tracer << "w : #{workitem.attributes['writable']}\n"
|
92
|
+
@tracer << "rw : #{workitem.attributes['randw']}\n"
|
93
|
+
@tracer << "h : #{workitem.attributes['hidden']}\n"
|
94
|
+
@tracer << "--\n"
|
95
|
+
end
|
96
|
+
|
97
|
+
dotest(
|
98
|
+
TestFilter47a1,
|
99
|
+
"""
|
100
|
+
r : bible
|
101
|
+
w : sand
|
102
|
+
rw : notebook
|
103
|
+
h : playboy
|
104
|
+
--
|
105
|
+
filter.size is 4
|
106
|
+
r : bible
|
107
|
+
w :
|
108
|
+
rw : notebook
|
109
|
+
h :
|
110
|
+
--
|
111
|
+
bible
|
112
|
+
sand
|
113
|
+
notebook
|
114
|
+
playboy
|
115
|
+
""".strip)
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
#
|
120
|
+
# Test 2
|
121
|
+
#
|
122
|
+
|
123
|
+
class TestFilter47a2 < ProcessDefinition
|
124
|
+
sequence do
|
125
|
+
|
126
|
+
set :field => "readable", :value => "bible"
|
127
|
+
set :field => "writable", :value => "sand"
|
128
|
+
set :field => "randw", :value => "notebook"
|
129
|
+
set :field => "hidden", :value => "playboy"
|
130
|
+
|
131
|
+
alice :filter => "filter0"
|
132
|
+
pp_fields
|
133
|
+
end
|
134
|
+
|
135
|
+
filter_definition :name => "filter0" do
|
136
|
+
field :regex => "readable", :permissions => "r"
|
137
|
+
field :regex => "writable", :permissions => "w"
|
138
|
+
field :regex => "randw", :permissions => "rw"
|
139
|
+
field :regex => "hidden", :permissions => ""
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
#def xxxx_2
|
144
|
+
def test_2
|
145
|
+
|
146
|
+
@engine.register_participant :alice do |workitem|
|
147
|
+
workitem.readable = "nada"
|
148
|
+
workitem.writable = "nada"
|
149
|
+
workitem.randw = "nada"
|
150
|
+
workitem.hidden = "nada"
|
151
|
+
end
|
152
|
+
|
153
|
+
dotest(
|
154
|
+
TestFilter47a2,
|
155
|
+
"""
|
156
|
+
hidden: playboy
|
157
|
+
randw: nada
|
158
|
+
readable: bible
|
159
|
+
writable: nada
|
160
|
+
--
|
161
|
+
""".strip)
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
|
11
|
+
include OpenWFE
|
12
|
+
|
13
|
+
|
14
|
+
class FlowTest48 < Test::Unit::TestCase
|
15
|
+
include FlowTestBase
|
16
|
+
|
17
|
+
#def setup
|
18
|
+
#end
|
19
|
+
|
20
|
+
#def teardown
|
21
|
+
#end
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Test 0
|
26
|
+
#
|
27
|
+
|
28
|
+
class TestFilter48a0 < ProcessDefinition
|
29
|
+
sequence do
|
30
|
+
|
31
|
+
set :field => "readable", :value => "bible"
|
32
|
+
set :field => "writable", :value => "sand"
|
33
|
+
set :field => "randw", :value => "notebook"
|
34
|
+
set :field => "hidden", :value => "playboy"
|
35
|
+
|
36
|
+
alice
|
37
|
+
|
38
|
+
filter :name => "filter0" do
|
39
|
+
alice
|
40
|
+
end
|
41
|
+
|
42
|
+
alice
|
43
|
+
end
|
44
|
+
|
45
|
+
filter_definition :name => "filter0" do
|
46
|
+
field :regex => "readable", :permissions => "r"
|
47
|
+
field :regex => "writable", :permissions => "w"
|
48
|
+
field :regex => "randw", :permissions => "rw"
|
49
|
+
field :regex => "hidden", :permissions => ""
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
#def xxxx_0
|
54
|
+
def test_0
|
55
|
+
|
56
|
+
@engine.register_participant :alice do |workitem|
|
57
|
+
|
58
|
+
@tracer << "filter.size is #{workitem.filter.fields.size}\n" \
|
59
|
+
if workitem.filter
|
60
|
+
|
61
|
+
@tracer << "r : #{workitem.attributes['readable']}\n"
|
62
|
+
@tracer << "w : #{workitem.attributes['writable']}\n"
|
63
|
+
@tracer << "rw : #{workitem.attributes['randw']}\n"
|
64
|
+
@tracer << "h : #{workitem.attributes['hidden']}\n"
|
65
|
+
@tracer << "--\n"
|
66
|
+
end
|
67
|
+
|
68
|
+
dotest(
|
69
|
+
TestFilter48a0,
|
70
|
+
"""
|
71
|
+
r : bible
|
72
|
+
w : sand
|
73
|
+
rw : notebook
|
74
|
+
h : playboy
|
75
|
+
--
|
76
|
+
filter.size is 4
|
77
|
+
r : bible
|
78
|
+
w :
|
79
|
+
rw : notebook
|
80
|
+
h :
|
81
|
+
--
|
82
|
+
r : bible
|
83
|
+
w : sand
|
84
|
+
rw : notebook
|
85
|
+
h : playboy
|
86
|
+
--
|
87
|
+
""".strip)
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
|
11
|
+
include OpenWFE
|
12
|
+
|
13
|
+
|
14
|
+
class FlowTest49 < Test::Unit::TestCase
|
15
|
+
include FlowTestBase
|
16
|
+
|
17
|
+
#def setup
|
18
|
+
#end
|
19
|
+
|
20
|
+
#def teardown
|
21
|
+
#end
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Test 0
|
26
|
+
#
|
27
|
+
|
28
|
+
class TestCondition49a0 < ProcessDefinition
|
29
|
+
sequence do
|
30
|
+
_if :test => "false"
|
31
|
+
_print "0 ${f:__result__}"
|
32
|
+
_if :test => "true; false"
|
33
|
+
_print "1 ${f:__result__}"
|
34
|
+
_if :test => "false; true"
|
35
|
+
_print "2 ${f:__result__}"
|
36
|
+
_if :test => "print ''; true"
|
37
|
+
_print "3 ${f:__result__}"
|
38
|
+
_if :test => "begin print ''; end; true"
|
39
|
+
_print "4 ${f:__result__}"
|
40
|
+
|
41
|
+
_if :test => "true == "
|
42
|
+
_print "5 ${f:__result__}"
|
43
|
+
_if :test => " == true"
|
44
|
+
_print "6 ${f:__result__}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#def xxxx_0
|
49
|
+
def test_0
|
50
|
+
|
51
|
+
dotest(
|
52
|
+
TestCondition49a0,
|
53
|
+
"""
|
54
|
+
0
|
55
|
+
1
|
56
|
+
2 true
|
57
|
+
3 true
|
58
|
+
4 true
|
59
|
+
5
|
60
|
+
6
|
61
|
+
""".strip)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
# Pat at geobliki.com
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'flowtestbase'
|
10
|
+
require 'openwfe/def'
|
11
|
+
|
12
|
+
include OpenWFE
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest50 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def setup
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def teardown
|
22
|
+
#end
|
23
|
+
|
24
|
+
#
|
25
|
+
# A Test by Pat Cappelaere
|
26
|
+
#
|
27
|
+
|
28
|
+
PAT_XML = <<END
|
29
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
30
|
+
<sps:GetFeasibilityRequestResponse xmlns:gml="http://www.opengis.net/gml"
|
31
|
+
xmlns:sps="http://www.opengis.net/sps" xmlns="">
|
32
|
+
<sps:Feasibility status="feasible" id="106">
|
33
|
+
<DOY>106</DOY>
|
34
|
+
<UTC>2007-04-16 09:20:00</UTC>
|
35
|
+
<SZA>27.41</SZA>
|
36
|
+
<TYPE>NADIR</TYPE>
|
37
|
+
<PATH>52</PATH>
|
38
|
+
<ROW>186</ROW>
|
39
|
+
<COST>2600.85</COST>
|
40
|
+
<sps:LatestResponseTime>
|
41
|
+
<gml:TimeInstant>
|
42
|
+
<gml:timePosition>2007-04-16T09:20:00Z</gml:timePosition>
|
43
|
+
</gml:TimeInstant>
|
44
|
+
</sps:LatestResponseTime>
|
45
|
+
</sps:Feasibility>
|
46
|
+
</sps:GetFeasibilityRequestResponse>
|
47
|
+
END
|
48
|
+
|
49
|
+
class TestXmlAttribute50a0 < ProcessDefinition
|
50
|
+
sequence do
|
51
|
+
geo_0
|
52
|
+
geo_1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
#def xxxx_0
|
57
|
+
def test_0
|
58
|
+
|
59
|
+
doc0 = nil
|
60
|
+
doc1 = nil
|
61
|
+
|
62
|
+
@engine.register_participant :geo_0 do |fei, workitem|
|
63
|
+
doc0 = REXML::Document.new(PAT_XML)
|
64
|
+
workitem.attributes['xml'] = doc0
|
65
|
+
@tracer << "0\n"
|
66
|
+
end
|
67
|
+
|
68
|
+
@engine.register_participant :geo_1 do |fei, workitem|
|
69
|
+
doc1 = workitem.attributes['xml']
|
70
|
+
@tracer << "1\n"
|
71
|
+
end
|
72
|
+
|
73
|
+
dotest(TestXmlAttribute50a0, "0\n1")
|
74
|
+
|
75
|
+
assert_equal doc0.to_s, doc1.to_s
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_1
|
79
|
+
|
80
|
+
doc0 = REXML::Document.new PAT_XML
|
81
|
+
doc1 = OpenWFE::fulldup(doc0)
|
82
|
+
|
83
|
+
assert_not_equal doc0.object_id, doc1.object_id
|
84
|
+
|
85
|
+
assert_equal doc0.to_s, doc1.to_s
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|