ruote 0.9.18
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.
- data/README.txt +24 -0
- data/bin/validate-workflow.rb +89 -0
- data/examples/about_state.rb +81 -0
- data/examples/bigflow.rb +19 -0
- data/examples/csv_weather.rb +23 -0
- data/examples/engine_template.rb +247 -0
- data/examples/flowtracing.rb +24 -0
- data/examples/homeworkreview.rb +68 -0
- data/examples/kotoba.rb +22 -0
- data/examples/mano_tracker.rb +172 -0
- data/examples/openwferu.rb +58 -0
- data/examples/quotereporter.rb +157 -0
- data/examples/scheduler_cron_usage.rb +48 -0
- data/examples/scheduler_usage.rb +56 -0
- data/lib/openwfe.rb +41 -0
- data/lib/openwfe/contextual.rb +111 -0
- data/lib/openwfe/def.rb +46 -0
- data/lib/openwfe/engine.rb +37 -0
- data/lib/openwfe/engine/engine.rb +756 -0
- data/lib/openwfe/engine/expool_methods.rb +172 -0
- data/lib/openwfe/engine/file_persisted_engine.rb +105 -0
- data/lib/openwfe/engine/participant_methods.rb +133 -0
- data/lib/openwfe/engine/status_methods.rb +353 -0
- data/lib/openwfe/engine/update_exp_methods.rb +112 -0
- data/lib/openwfe/exceptions.rb +51 -0
- data/lib/openwfe/expool/errorjournal.rb +476 -0
- data/lib/openwfe/expool/expressionpool.rb +1144 -0
- data/lib/openwfe/expool/expstorage.rb +403 -0
- data/lib/openwfe/expool/history.rb +174 -0
- data/lib/openwfe/expool/journal.rb +224 -0
- data/lib/openwfe/expool/journal_replay.rb +321 -0
- data/lib/openwfe/expool/parser.rb +242 -0
- data/lib/openwfe/expool/representation.rb +121 -0
- data/lib/openwfe/expool/threadedexpstorage.rb +188 -0
- data/lib/openwfe/expool/wfidgen.rb +388 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +224 -0
- data/lib/openwfe/expressions/condition.rb +244 -0
- data/lib/openwfe/expressions/environment.rb +246 -0
- data/lib/openwfe/expressions/expressionmap.rb +258 -0
- data/lib/openwfe/expressions/fe_cancel.rb +109 -0
- data/lib/openwfe/expressions/fe_command.rb +241 -0
- data/lib/openwfe/expressions/fe_concurrence.rb +662 -0
- data/lib/openwfe/expressions/fe_cron.rb +259 -0
- data/lib/openwfe/expressions/fe_cursor.rb +259 -0
- data/lib/openwfe/expressions/fe_define.rb +192 -0
- data/lib/openwfe/expressions/fe_do.rb +168 -0
- data/lib/openwfe/expressions/fe_equals.rb +291 -0
- data/lib/openwfe/expressions/fe_filter.rb +129 -0
- data/lib/openwfe/expressions/fe_filter_definition.rb +168 -0
- data/lib/openwfe/expressions/fe_fqv.rb +250 -0
- data/lib/openwfe/expressions/fe_if.rb +303 -0
- data/lib/openwfe/expressions/fe_iterator.rb +145 -0
- data/lib/openwfe/expressions/fe_listen.rb +371 -0
- data/lib/openwfe/expressions/fe_losfor.rb +111 -0
- data/lib/openwfe/expressions/fe_misc.rb +421 -0
- data/lib/openwfe/expressions/fe_participant.rb +269 -0
- data/lib/openwfe/expressions/fe_reserve.rb +212 -0
- data/lib/openwfe/expressions/fe_save.rb +274 -0
- data/lib/openwfe/expressions/fe_sequence.rb +117 -0
- data/lib/openwfe/expressions/fe_set.rb +139 -0
- data/lib/openwfe/expressions/fe_sleep.rb +166 -0
- data/lib/openwfe/expressions/fe_step.rb +159 -0
- data/lib/openwfe/expressions/fe_subprocess.rb +168 -0
- data/lib/openwfe/expressions/fe_timeout.rb +127 -0
- data/lib/openwfe/expressions/fe_wait.rb +78 -0
- data/lib/openwfe/expressions/fe_when.rb +142 -0
- data/lib/openwfe/expressions/filter.rb +104 -0
- data/lib/openwfe/expressions/flowexpression.rb +847 -0
- data/lib/openwfe/expressions/iterator.rb +221 -0
- data/lib/openwfe/expressions/merge.rb +84 -0
- data/lib/openwfe/expressions/raw.rb +547 -0
- data/lib/openwfe/expressions/rprocdef.rb +375 -0
- data/lib/openwfe/expressions/time.rb +333 -0
- data/lib/openwfe/expressions/timeout.rb +178 -0
- data/lib/openwfe/expressions/value.rb +126 -0
- data/lib/openwfe/filterdef.rb +259 -0
- data/lib/openwfe/flowexpressionid.rb +357 -0
- data/lib/openwfe/listeners/listener.rb +97 -0
- data/lib/openwfe/listeners/listeners.rb +139 -0
- data/lib/openwfe/listeners/socketlisteners.rb +272 -0
- data/lib/openwfe/logging.rb +122 -0
- data/lib/openwfe/omixins.rb +95 -0
- data/lib/openwfe/orest/controlclient.rb +119 -0
- data/lib/openwfe/orest/definitions.rb +113 -0
- data/lib/openwfe/orest/exception.rb +60 -0
- data/lib/openwfe/orest/oldrestservlet.rb +279 -0
- data/lib/openwfe/orest/osocket.rb +148 -0
- data/lib/openwfe/orest/restclient.rb +176 -0
- data/lib/openwfe/orest/workitem.rb +206 -0
- data/lib/openwfe/orest/worklistclient.rb +272 -0
- data/lib/openwfe/orest/xmlcodec.rb +670 -0
- data/lib/openwfe/participants.rb +38 -0
- data/lib/openwfe/participants/enoparticipants.rb +230 -0
- data/lib/openwfe/participants/participant.rb +141 -0
- data/lib/openwfe/participants/participantmap.rb +249 -0
- data/lib/openwfe/participants/participants.rb +407 -0
- data/lib/openwfe/participants/soapparticipants.rb +135 -0
- data/lib/openwfe/participants/socketparticipants.rb +202 -0
- data/lib/openwfe/participants/storeparticipants.rb +254 -0
- data/lib/openwfe/rudefinitions.rb +130 -0
- data/lib/openwfe/service.rb +103 -0
- data/lib/openwfe/storage/yamlcustom.rb +106 -0
- data/lib/openwfe/storage/yamlfilestorage.rb +245 -0
- data/lib/openwfe/tools/flowtracer.rb +81 -0
- data/lib/openwfe/util/dollar.rb +217 -0
- data/lib/openwfe/util/irb.rb +86 -0
- data/lib/openwfe/util/observable.rb +144 -0
- data/lib/openwfe/util/ometa.rb +62 -0
- data/lib/openwfe/util/workqueue.rb +124 -0
- data/lib/openwfe/util/xml.rb +418 -0
- data/lib/openwfe/utils.rb +554 -0
- data/lib/openwfe/version.rb +37 -0
- data/lib/openwfe/workitem.rb +499 -0
- data/lib/openwfe/worklist/oldrest.rb +244 -0
- data/lib/openwfe/worklist/storelocks.rb +293 -0
- data/lib/openwfe/worklist/storeparticipant.rb +44 -0
- data/lib/openwfe/worklist/worklist.rb +297 -0
- data/test/README.txt +27 -0
- data/test/back_0916_test.rb +111 -0
- data/test/bm/bm_1_xml_vs_prog.rb +56 -0
- data/test/bm/bm_2_step.rb +109 -0
- data/test/bm/ft_0f_5ms.rb +35 -0
- data/test/bm/ft_26_load.rb +210 -0
- data/test/bm/ft_26b_load.rb +86 -0
- data/test/bm/ft_26c_load.rb +97 -0
- data/test/bm/ft_26d_load.rb +97 -0
- data/test/bm/ft_recu.rb +71 -0
- data/test/clone_test.rb +122 -0
- data/test/concurrence_test.rb +77 -0
- data/test/condition_test.rb +155 -0
- data/test/console_test.rb +12 -0
- data/test/cron_ltest.rb +15 -0
- data/test/description_test.rb +87 -0
- data/test/eno_test.rb +76 -0
- data/test/expmap_test.rb +54 -0
- data/test/expool_20031219_0916.tgz +0 -0
- data/test/fe_lookup_att_test.rb +62 -0
- data/test/fei_test.rb +181 -0
- data/test/file_persisted_engine_test.rb +64 -0
- data/test/file_persistence_test.rb +134 -0
- data/test/filep_cancel_test.rb +123 -0
- data/test/filter_test.rb +109 -0
- data/test/flowtestbase.rb +351 -0
- data/test/ft_0.rb +68 -0
- data/test/ft_0b_sequence.rb +36 -0
- data/test/ft_0c_testname.rb +33 -0
- data/test/ft_0d_participant.rb +30 -0
- data/test/ft_0e_multibody.rb +34 -0
- data/test/ft_10_loop.rb +134 -0
- data/test/ft_11_ppd.rb +415 -0
- data/test/ft_11b_ppd.rb +54 -0
- data/test/ft_12_blockparticipant.rb +97 -0
- data/test/ft_13_eno.rb +52 -0
- data/test/ft_14_subprocess.rb +88 -0
- data/test/ft_14b_subprocess.rb +192 -0
- data/test/ft_14c_subprocess.rb +68 -0
- data/test/ft_15_iterator.rb +216 -0
- data/test/ft_15b_iterator.rb +74 -0
- data/test/ft_16_fqv.rb +73 -0
- data/test/ft_17_condition.rb +84 -0
- data/test/ft_18_pname.rb +56 -0
- data/test/ft_1_unset.rb +175 -0
- data/test/ft_1b_unset.rb +39 -0
- data/test/ft_20_cron.rb +53 -0
- data/test/ft_21_cron.rb +87 -0
- data/test/ft_21b_cron_pause.rb +82 -0
- data/test/ft_22_history.rb +74 -0
- data/test/ft_23_when.rb +77 -0
- data/test/ft_23b_when.rb +70 -0
- data/test/ft_23c_wait.rb +80 -0
- data/test/ft_23d_cww.rb +58 -0
- data/test/ft_24_def.rb +44 -0
- data/test/ft_25_cancel.rb +89 -0
- data/test/ft_27_getflowpos.rb +147 -0
- data/test/ft_28_fileparticipant.rb +63 -0
- data/test/ft_29_httprb.rb +106 -0
- data/test/ft_2_concurrence.rb +135 -0
- data/test/ft_2b_concurrence.rb +188 -0
- data/test/ft_2c_concurrence.rb +64 -0
- data/test/ft_30_socketlistener.rb +203 -0
- data/test/ft_31_flowname.rb +40 -0
- data/test/ft_32_journal.rb +91 -0
- data/test/ft_32c_journal.rb +102 -0
- data/test/ft_32d_journal.rb +84 -0
- data/test/ft_33_description.rb +107 -0
- data/test/ft_34_cancelwfid.rb +80 -0
- data/test/ft_35_localdefs.rb +75 -0
- data/test/ft_36_subprocids.rb +97 -0
- data/test/ft_37_pnames.rb +70 -0
- data/test/ft_38_tag.rb +127 -0
- data/test/ft_38b_tag.rb +161 -0
- data/test/ft_38c_tag.rb +100 -0
- data/test/ft_39_reserve.rb +63 -0
- data/test/ft_39b_reserve.rb +84 -0
- data/test/ft_3_equals.rb +170 -0
- data/test/ft_3b_lookup_vf.rb +83 -0
- data/test/ft_40_defined.rb +61 -0
- data/test/ft_41_case.rb +110 -0
- data/test/ft_42_environments.rb +75 -0
- data/test/ft_43_pat10.rb +85 -0
- data/test/ft_44_save.rb +70 -0
- data/test/ft_44b_restore.rb +212 -0
- data/test/ft_45_citerator.rb +214 -0
- data/test/ft_46_pparams.rb +62 -0
- data/test/ft_47_filter.rb +160 -0
- data/test/ft_48_fe_filter.rb +88 -0
- data/test/ft_49_condition.rb +126 -0
- data/test/ft_4_misc.rb +237 -0
- data/test/ft_50_xml_attribute.rb +155 -0
- data/test/ft_51_stack.rb +55 -0
- data/test/ft_52_obs_participant.rb +123 -0
- data/test/ft_53_null_noop_participant.rb +62 -0
- data/test/ft_54_listen.rb +288 -0
- data/test/ft_54b_listen.rb +66 -0
- data/test/ft_54c_listen.rb +99 -0
- data/test/ft_55_ptimeout.rb +59 -0
- data/test/ft_56_timeout.rb +59 -0
- data/test/ft_57_a.rb +145 -0
- data/test/ft_58_ejournal.rb +151 -0
- data/test/ft_59_ps.rb +150 -0
- data/test/ft_59b_ps_for_pat.rb +58 -0
- data/test/ft_5_time.rb +118 -0
- data/test/ft_60_ecancel.rb +161 -0
- data/test/ft_61_elsub.rb +51 -0
- data/test/ft_62_procparticipant.rb +71 -0
- data/test/ft_63_pause.rb +124 -0
- data/test/ft_64_alias.rb +102 -0
- data/test/ft_64_clone.rb +69 -0
- data/test/ft_65_stringlaunch.rb +59 -0
- data/test/ft_66_subforget.rb +70 -0
- data/test/ft_67_schedlaunch.rb +116 -0
- data/test/ft_68_ifparticipant.rb +70 -0
- data/test/ft_69_cancelmissing.rb +51 -0
- data/test/ft_6_lambda.rb +64 -0
- data/test/ft_70_lookupvar.rb +55 -0
- data/test/ft_71_log.rb +60 -0
- data/test/ft_72_lookup_processes.rb +76 -0
- data/test/ft_73_cancel_sub.rb +139 -0
- data/test/ft_74_block_and_workitem_dup.rb +63 -0
- data/test/ft_75_ruby_attributes.rb +87 -0
- data/test/ft_76_merge_isolate.rb +88 -0
- data/test/ft_77_segments.rb +35 -0
- data/test/ft_78_eval.rb +150 -0
- data/test/ft_79_tticket.rb +187 -0
- data/test/ft_79b_tticket.rb +172 -0
- data/test/ft_79c_outcome.rb +56 -0
- data/test/ft_7_lose.rb +104 -0
- data/test/ft_7b_lose.rb +78 -0
- data/test/ft_80_spname.rb +91 -0
- data/test/ft_81_exp.rb +60 -0
- data/test/ft_82_trecu.rb +46 -0
- data/test/ft_83_badpause.rb +58 -0
- data/test/ft_84_updateexp.rb +198 -0
- data/test/ft_85_dolhash.rb +43 -0
- data/test/ft_86_dollar_fv.rb +68 -0
- data/test/ft_87_define.rb +74 -0
- data/test/ft_8_forget.rb +44 -0
- data/test/ft_9_cursor.rb +145 -0
- data/test/ft_9b_cursor.rb +105 -0
- data/test/ft_tests.rb +124 -0
- data/test/hash_test.rb +75 -0
- data/test/hparticipant_test.rb +164 -0
- data/test/lookup_att_test.rb +90 -0
- data/test/lookup_vf_test.rb +94 -0
- data/test/misc_test.rb +90 -0
- data/test/nut_0_irb.rb +20 -0
- data/test/obs_test.rb +142 -0
- data/test/orest_test.rb +251 -0
- data/test/param_test.rb +290 -0
- data/test/participant_test.rb +101 -0
- data/test/pending.rb +23 -0
- data/test/ps_representation.rb +133 -0
- data/test/rake_ltest.rb +38 -0
- data/test/rake_qtest.rb +68 -0
- data/test/raw_prog_test.rb +412 -0
- data/test/restart_cron_test.rb +136 -0
- data/test/restart_paused_test.rb +98 -0
- data/test/restart_sleep_test.rb +140 -0
- data/test/restart_tests.rb +18 -0
- data/test/restart_when_test.rb +112 -0
- data/test/ruby_procdef_test.rb +132 -0
- data/test/rutest_utils.rb +63 -0
- data/test/sec_test.rb +205 -0
- data/test/slock_test.rb +80 -0
- data/test/storage_test.rb +44 -0
- data/test/test.rb +3 -0
- data/test/timeout_test.rb +105 -0
- data/test/util_xml_test.rb +112 -0
- data/test/wfid_test.rb +175 -0
- data/test/wi_test.rb +75 -0
- metadata +433 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
|
8
|
+
#
|
|
9
|
+
# . Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
# list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# . Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# . Neither the name of the "OpenWFE" nor the names of its contributors may be
|
|
17
|
+
# used to endorse or promote products derived from this software without
|
|
18
|
+
# specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
30
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
#++
|
|
32
|
+
#
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# "made in Japan"
|
|
36
|
+
#
|
|
37
|
+
# John Mettraux at openwfe.org
|
|
38
|
+
#
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# this "openwfe/worklist/storeparticipant" has been deprecated for
|
|
42
|
+
#
|
|
43
|
+
require 'openwfe/participants/storeparticipants'
|
|
44
|
+
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
|
8
|
+
#
|
|
9
|
+
# . Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
# list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# . Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# . Neither the name of the "OpenWFE" nor the names of its contributors may be
|
|
17
|
+
# used to endorse or promote products derived from this software without
|
|
18
|
+
# specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
30
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
#++
|
|
32
|
+
#
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# "made in Japan"
|
|
36
|
+
#
|
|
37
|
+
# John Mettraux at openwfe.org
|
|
38
|
+
#
|
|
39
|
+
|
|
40
|
+
require 'openwfe/engine/engine'
|
|
41
|
+
require 'openwfe/participants/participant'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
module OpenWFE
|
|
45
|
+
|
|
46
|
+
#
|
|
47
|
+
# An OpenWFEja-style worklist.
|
|
48
|
+
#
|
|
49
|
+
class Worklist
|
|
50
|
+
include LocalParticipant
|
|
51
|
+
|
|
52
|
+
attr_reader :stores
|
|
53
|
+
|
|
54
|
+
#
|
|
55
|
+
# Builds a new worklist.
|
|
56
|
+
#
|
|
57
|
+
# Parameters are :
|
|
58
|
+
#
|
|
59
|
+
# - :auth_system : something with an authenticate(user, pass) and an
|
|
60
|
+
# optional authorised?(user, store, action) methods.
|
|
61
|
+
# - :launchables : an array of URLs : launchables, in this basic
|
|
62
|
+
# implementation, all users share the same list
|
|
63
|
+
#
|
|
64
|
+
def initialize (application_context, params)
|
|
65
|
+
|
|
66
|
+
@application_context = application_context
|
|
67
|
+
|
|
68
|
+
as = params[:auth_system]
|
|
69
|
+
|
|
70
|
+
@auth_system = if as == nil
|
|
71
|
+
DefaultAuthSystem.new
|
|
72
|
+
elsif as.kind_of?(Hash)
|
|
73
|
+
DefaultAuthSystem.new(as)
|
|
74
|
+
else
|
|
75
|
+
as
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
@stores = []
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def consume (workitem)
|
|
82
|
+
|
|
83
|
+
pname = workitem.participant_name
|
|
84
|
+
|
|
85
|
+
each_store do |regex, store_name, store|
|
|
86
|
+
|
|
87
|
+
next unless pname.match regex
|
|
88
|
+
|
|
89
|
+
store.consume workitem
|
|
90
|
+
break
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
#
|
|
95
|
+
# A simple call to the authentify method of the @auth_system
|
|
96
|
+
# passed a initialization time.
|
|
97
|
+
#
|
|
98
|
+
def authenticate (user, pass)
|
|
99
|
+
@auth_system.authenticate(user, pass)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
#
|
|
103
|
+
# Returns a string like "rwd" or "rw" or even "".
|
|
104
|
+
#
|
|
105
|
+
# Read / Write / Delegate
|
|
106
|
+
#
|
|
107
|
+
def get_permissions (user, store_name)
|
|
108
|
+
s = ""
|
|
109
|
+
[ :read, :write, :delegate ].each do |action|
|
|
110
|
+
s << action.to_s[0, 1] \
|
|
111
|
+
if @auth_system.authorized?(user, store_name, action)
|
|
112
|
+
end
|
|
113
|
+
s
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
#
|
|
117
|
+
# For now, just a shortcut for
|
|
118
|
+
#
|
|
119
|
+
# @stores << [ regex, store_name, store]
|
|
120
|
+
#
|
|
121
|
+
def add_store (regex, store_name, store)
|
|
122
|
+
|
|
123
|
+
@stores << [ regex, store_name, store]
|
|
124
|
+
|
|
125
|
+
store.application_context = @application_context \
|
|
126
|
+
if store.respond_to?(:application_context=)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
#
|
|
130
|
+
# Well, this implementation just returns workitems
|
|
131
|
+
#
|
|
132
|
+
def get_headers (user, store_name, limit)
|
|
133
|
+
|
|
134
|
+
authorized?(user, store_name, :read)
|
|
135
|
+
|
|
136
|
+
l = []
|
|
137
|
+
|
|
138
|
+
get_store(store_name).each do |workitem, locked|
|
|
139
|
+
break if limit and l.size >= limit
|
|
140
|
+
l << [ workitem, locked ]
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
l
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def get (user, store_name, fei)
|
|
147
|
+
authorized?(user, store_name, :read)
|
|
148
|
+
get_store(store_name).get(fei)
|
|
149
|
+
end
|
|
150
|
+
def get_and_lock (user, store_name, fei)
|
|
151
|
+
authorized?(user, store_name, :write)
|
|
152
|
+
get_store(store_name).get_and_lock(user, fei)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def release (user, store_name, wi_or_fei)
|
|
156
|
+
|
|
157
|
+
authorized?(user, store_name, :write)
|
|
158
|
+
|
|
159
|
+
fei = wi_or_fei
|
|
160
|
+
fei = fei.fei if fei.respond_to?(:fei)
|
|
161
|
+
|
|
162
|
+
get_store(store_name).release(user, fei)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def save (user, store_name, workitem)
|
|
166
|
+
authorized?(user, store_name, :write)
|
|
167
|
+
get_store(store_name).save(user, workitem)
|
|
168
|
+
end
|
|
169
|
+
def forward (user, store_name, workitem)
|
|
170
|
+
authorized?(user, store_name, :write)
|
|
171
|
+
get_store(store_name).forward(user, workitem)
|
|
172
|
+
end
|
|
173
|
+
def list_workitems (user, store_name, workflow_instance_id=nil)
|
|
174
|
+
authorized?(user, store_name, :read)
|
|
175
|
+
get_store(store_name).list_workitems(workflow_instance_id)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def delegate (user, from_store_name, to_store_name)
|
|
179
|
+
authorized?(user, from_store_name, :write)
|
|
180
|
+
authorized?(user, to_store_name, :write)
|
|
181
|
+
# TODO : continue me
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
#
|
|
185
|
+
# Iterates over each of the stores in this worklist.
|
|
186
|
+
#
|
|
187
|
+
def each_store (&block) # :yields: regex, store_name, store
|
|
188
|
+
|
|
189
|
+
return unless block
|
|
190
|
+
|
|
191
|
+
@stores.each do |v|
|
|
192
|
+
regex, store_name, store = v
|
|
193
|
+
block.call regex, store_name, store
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
#
|
|
198
|
+
# Returns the first store whose regex matches the given
|
|
199
|
+
# store_name.
|
|
200
|
+
#
|
|
201
|
+
def lookup_store (store_name)
|
|
202
|
+
each_store do |regex, name, store|
|
|
203
|
+
return store if regex.match store_name
|
|
204
|
+
end
|
|
205
|
+
nil
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
#
|
|
209
|
+
# Returns the store instance with the given name.
|
|
210
|
+
#
|
|
211
|
+
def get_store (store_name)
|
|
212
|
+
each_store do |regex, s_name, store|
|
|
213
|
+
return store if s_name == store_name
|
|
214
|
+
end
|
|
215
|
+
nil
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
#
|
|
219
|
+
# Not really the job of a worklist, but it was in OpenWFEja, so
|
|
220
|
+
# here it is...
|
|
221
|
+
#
|
|
222
|
+
def launch_flow (engine_name, launch_item)
|
|
223
|
+
|
|
224
|
+
e = lookup_engine engine_name
|
|
225
|
+
|
|
226
|
+
raise "couldn't find engine named '#{engine_name}'" unless e
|
|
227
|
+
|
|
228
|
+
if e.is_a? OpenWFE::Engine
|
|
229
|
+
|
|
230
|
+
e.launch launch_item
|
|
231
|
+
|
|
232
|
+
elsif e.is_a? OpenWFE::Participant
|
|
233
|
+
|
|
234
|
+
e.consume launch_item
|
|
235
|
+
|
|
236
|
+
else
|
|
237
|
+
raise \
|
|
238
|
+
"cannot launch a flow via something of "+
|
|
239
|
+
"class #{e.class.name}"
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
protected
|
|
244
|
+
|
|
245
|
+
#
|
|
246
|
+
# This method is called when a launch_flow request is coming,
|
|
247
|
+
# it will lookup in the participant map to find the way (the
|
|
248
|
+
# Participant implementation) to deliver the launch_item to the
|
|
249
|
+
# engine.
|
|
250
|
+
#
|
|
251
|
+
# If there is no engine with that name, the default (local) engine
|
|
252
|
+
# is returned (and will thus be used to launch the flow).
|
|
253
|
+
#
|
|
254
|
+
def lookup_engine (engine_name)
|
|
255
|
+
e = get_participant_map.lookup_participant engine_name
|
|
256
|
+
return e if e
|
|
257
|
+
get_engine
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def authorized? (user, store_name, action)
|
|
261
|
+
|
|
262
|
+
return true unless @auth_system.respond_to?(:authorized?)
|
|
263
|
+
|
|
264
|
+
unless @auth_system.authorized?(user, store_name, action)
|
|
265
|
+
raise \
|
|
266
|
+
"'#{user}' is not authorized " +
|
|
267
|
+
"to '#{action}' on store '#{store_name}'"
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
true
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
class DefaultAuthSystem
|
|
275
|
+
|
|
276
|
+
def initialize (hash=nil)
|
|
277
|
+
@hash = hash
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def authenticate (user, pass)
|
|
281
|
+
return true unless @hash
|
|
282
|
+
pass == @hash[user]
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def authorized? (user, store_name, action)
|
|
286
|
+
return true unless @hash
|
|
287
|
+
@hash[user] != nil
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
#--
|
|
292
|
+
# persistence...
|
|
293
|
+
# is handled by the StoreParticipant implementations themselves
|
|
294
|
+
#++
|
|
295
|
+
|
|
296
|
+
end
|
|
297
|
+
|
data/test/README.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
= OpenWFEru - about the unit tests
|
|
2
|
+
|
|
3
|
+
There are three tests triggerable by Rake :
|
|
4
|
+
|
|
5
|
+
rake test
|
|
6
|
+
rake qtest
|
|
7
|
+
rake ptest
|
|
8
|
+
|
|
9
|
+
These 3 tests correspond to the following unit test files *
|
|
10
|
+
|
|
11
|
+
test/rake_test.rb
|
|
12
|
+
test/rake_qtest.rb
|
|
13
|
+
test/rake_ptest.rb
|
|
14
|
+
|
|
15
|
+
== test/rake_test.rb
|
|
16
|
+
|
|
17
|
+
Triggers 'quicktests' and time based tests. Running "rake test" takes 10 seconds more than "rake qtest". These are the 10 seconds necessary to test some time and scheduling aspects of OpenWFEru.
|
|
18
|
+
|
|
19
|
+
== test/rake_qtest.rb
|
|
20
|
+
|
|
21
|
+
Runs only 'quick' tests.
|
|
22
|
+
|
|
23
|
+
== test/rake_ptest.rb
|
|
24
|
+
|
|
25
|
+
Runs the quicktest but with persistence on. Persistence stores its work file under the work/ directory.
|
|
26
|
+
This set of tests takes care of wiping fresh the work/ directory before beginning the tests.
|
|
27
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
#
|
|
3
|
+
# Testing OpenWFE
|
|
4
|
+
#
|
|
5
|
+
# John Mettraux at openwfe.org
|
|
6
|
+
#
|
|
7
|
+
# Tue Feb 19 10:58:43 JST 2008
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
require 'rubygems'
|
|
11
|
+
|
|
12
|
+
require 'test/unit'
|
|
13
|
+
require 'fileutils'
|
|
14
|
+
require 'openwfe/def'
|
|
15
|
+
require 'openwfe/engine/file_persisted_engine'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Back0916Test < Test::Unit::TestCase
|
|
19
|
+
|
|
20
|
+
WORK = 'work_back'
|
|
21
|
+
|
|
22
|
+
def setup
|
|
23
|
+
|
|
24
|
+
FileUtils.rm_rf WORK
|
|
25
|
+
FileUtils.mkdir WORK
|
|
26
|
+
|
|
27
|
+
`cd work_back && tar xzvf ../test/expool_20031219_0916.tgz`
|
|
28
|
+
|
|
29
|
+
ac = { :work_directory => WORK }
|
|
30
|
+
|
|
31
|
+
@engine = OpenWFE::FilePersistedEngine.new ac
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def teardown
|
|
35
|
+
|
|
36
|
+
$OWFE_LOG.level = Logger::INFO
|
|
37
|
+
FileUtils.rm_rf WORK
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_0
|
|
41
|
+
|
|
42
|
+
$OWFE_LOG.level = Logger::DEBUG
|
|
43
|
+
|
|
44
|
+
trace = []
|
|
45
|
+
|
|
46
|
+
@engine.register_participant :alpha do
|
|
47
|
+
trace << :alpha
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
@engine.reload
|
|
51
|
+
|
|
52
|
+
ps = @engine.process_status "20080212-moshijuzuke" # an XML process
|
|
53
|
+
#p ps.expressions.collect { |e| e.fei.to_s }
|
|
54
|
+
exp = ps.expressions.first
|
|
55
|
+
wi = exp.applied_workitem
|
|
56
|
+
wi.message = "back from obsolesence"
|
|
57
|
+
|
|
58
|
+
@engine.reply wi
|
|
59
|
+
|
|
60
|
+
sleep 0.350
|
|
61
|
+
|
|
62
|
+
assert_equal [ :alpha ], trace
|
|
63
|
+
|
|
64
|
+
ps = @engine.process_status "20080212-moshijuzuke"
|
|
65
|
+
#puts ps.size
|
|
66
|
+
#puts ps.collect { |e| e.fei.to_s }.join("\n")
|
|
67
|
+
|
|
68
|
+
assert_nil ps
|
|
69
|
+
|
|
70
|
+
@engine.stop
|
|
71
|
+
|
|
72
|
+
sleep 0.300
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def test_1
|
|
76
|
+
|
|
77
|
+
$OWFE_LOG.level = Logger::DEBUG
|
|
78
|
+
|
|
79
|
+
trace = []
|
|
80
|
+
|
|
81
|
+
#@engine.register_participant :employee do
|
|
82
|
+
# trace << :assistant
|
|
83
|
+
#end
|
|
84
|
+
#@engine.register_participant :employee do
|
|
85
|
+
# trace << :employee
|
|
86
|
+
#end
|
|
87
|
+
[ :user_bob, :user_alice ].each do |p|
|
|
88
|
+
@engine.register_participant p do
|
|
89
|
+
trace << p
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
@engine.reload
|
|
94
|
+
|
|
95
|
+
ps = @engine.process_status "20080213-depejetzube" # an ruby procdef
|
|
96
|
+
exp = ps.expressions.first
|
|
97
|
+
wi = exp.applied_workitem
|
|
98
|
+
|
|
99
|
+
@engine.reply wi
|
|
100
|
+
|
|
101
|
+
sleep 0.400
|
|
102
|
+
|
|
103
|
+
assert_equal [ :user_bob, :user_bob ], trace
|
|
104
|
+
|
|
105
|
+
assert_nil @engine.process_status("20080213-depejetzube")
|
|
106
|
+
|
|
107
|
+
@engine.stop
|
|
108
|
+
|
|
109
|
+
sleep 0.300
|
|
110
|
+
end
|
|
111
|
+
end
|