ruote 2.1.6 → 2.1.7
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/CHANGELOG.txt +14 -0
- data/CREDITS.txt +4 -3
- data/Rakefile +4 -3
- data/TODO.txt +9 -6
- data/lib/ruote/context.rb +29 -13
- data/lib/ruote/engine.rb +14 -0
- data/lib/ruote/exp/flowexpression.rb +7 -0
- data/lib/ruote/fei.rb +15 -7
- data/lib/ruote/id/wfid_generator.rb +3 -0
- data/lib/ruote/log/fs_history.rb +3 -3
- data/lib/ruote/log/storage_history.rb +13 -7
- data/lib/ruote/log/test_logger.rb +6 -0
- data/lib/ruote/parser.rb +12 -3
- data/lib/ruote/parser/ruby_dsl.rb +53 -0
- data/lib/ruote/part/participant_list.rb +10 -0
- data/lib/ruote/part/storage_participant.rb +74 -3
- data/lib/ruote/storage/base.rb +9 -6
- data/lib/ruote/storage/hash_storage.rb +7 -2
- data/lib/ruote/util/misc.rb +4 -0
- data/lib/ruote/version.rb +1 -1
- data/lib/ruote/workitem.rb +35 -48
- data/ruote.gemspec +12 -9
- data/test/README.rdoc +3 -3
- data/test/functional/eft_18_concurrent_iterator.rb +8 -11
- data/test/functional/eft_24_add_branches.rb +18 -6
- data/test/functional/eft_27_inc.rb +2 -1
- data/test/functional/eft_6_concurrence.rb +9 -4
- data/test/functional/ft_20_storage_participant.rb +63 -29
- data/test/functional/ft_24_block_participants.rb +6 -0
- data/test/functional/ft_30_smtp_participant.rb +2 -2
- data/test/functional/ft_32_fs_history.rb +15 -10
- data/test/functional/ft_36_storage_history.rb +3 -3
- data/test/functional/ft_3_participant_registration.rb +8 -0
- data/test/functional/storage_helper.rb +2 -0
- data/test/functional/test.rb +9 -2
- data/test/unit/storage.rb +2 -1
- data/test/unit/test.rb +18 -2
- data/test/unit/ut_0_ruby_parser.rb +7 -0
- data/test/unit/ut_16_parser.rb +1 -1
- data/test/unit/ut_1_fei.rb +60 -2
- data/test/unit/ut_3_wait_logger.rb +2 -0
- data/test/unit/ut_7_workitem.rb +29 -2
- metadata +15 -4
    
        data/test/README.rdoc
    CHANGED
    
    | @@ -3,13 +3,13 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            running all the tests
         | 
| 5 5 |  | 
| 6 | 
            -
              $  | 
| 6 | 
            +
              $ ruby test/test.rb
         | 
| 7 7 |  | 
| 8 8 | 
             
            running a specific test
         | 
| 9 9 |  | 
| 10 | 
            -
              $  | 
| 10 | 
            +
              $ ruby test/functional/ft_1_process_status.rb
         | 
| 11 11 |  | 
| 12 12 | 
             
            running a test with file persistence :
         | 
| 13 13 |  | 
| 14 | 
            -
              $  | 
| 14 | 
            +
              $ ruby test/functional/eft_2_sequence.rb -- --fs
         | 
| 15 15 |  | 
| @@ -252,7 +252,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase | |
| 252 252 |  | 
| 253 253 | 
             
                #noisy
         | 
| 254 254 |  | 
| 255 | 
            -
                assert_trace pdef,  | 
| 255 | 
            +
                assert_trace pdef, *%w[ a b c ].permutation.to_a
         | 
| 256 256 | 
             
              end
         | 
| 257 257 |  | 
| 258 258 | 
             
              def test_merge_type_isolate
         | 
| @@ -264,10 +264,10 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase | |
| 264 264 | 
             
                  bravo
         | 
| 265 265 | 
             
                end
         | 
| 266 266 |  | 
| 267 | 
            -
                 | 
| 267 | 
            +
                mf = nil
         | 
| 268 268 |  | 
| 269 269 | 
             
                @engine.register_participant :bravo do |workitem|
         | 
| 270 | 
            -
                   | 
| 270 | 
            +
                  mf = workitem.fields
         | 
| 271 271 | 
             
                  nil
         | 
| 272 272 | 
             
                end
         | 
| 273 273 |  | 
| @@ -275,12 +275,9 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase | |
| 275 275 |  | 
| 276 276 | 
             
                assert_trace(
         | 
| 277 277 | 
             
                  pdef, %w{ . . . })
         | 
| 278 | 
            -
             | 
| 279 | 
            -
             | 
| 280 | 
            -
             | 
| 281 | 
            -
                   "2" => { "f" => "c" },
         | 
| 282 | 
            -
                   "params" => { "ref" => "bravo" }},
         | 
| 283 | 
            -
                  merged_fields)
         | 
| 278 | 
            +
             | 
| 279 | 
            +
                mf = ('0'..'2').to_a.map { |k| mf[k]['f'] }.sort
         | 
| 280 | 
            +
                assert_equal %w[ a b c ], mf
         | 
| 284 281 | 
             
              end
         | 
| 285 282 |  | 
| 286 283 | 
             
              def test_cancel
         | 
| @@ -298,13 +295,13 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase | |
| 298 295 |  | 
| 299 296 | 
             
                a_count = 0
         | 
| 300 297 | 
             
                @engine.register_participant(:alpha) { |wi| a_count += 1 }
         | 
| 301 | 
            -
                @engine.register_participant(:bravo, Ruote::NullParticipant | 
| 298 | 
            +
                @engine.register_participant(:bravo, Ruote::NullParticipant)
         | 
| 302 299 |  | 
| 303 300 | 
             
                #noisy
         | 
| 304 301 |  | 
| 305 302 | 
             
                wfid = @engine.launch(pdef)
         | 
| 306 303 |  | 
| 307 | 
            -
                wait_for(2 +  | 
| 304 | 
            +
                wait_for(2 + n * 5)
         | 
| 308 305 | 
             
                #p "=" * 80
         | 
| 309 306 |  | 
| 310 307 | 
             
                assert_equal n, a_count
         | 
| @@ -25,7 +25,10 @@ class EftAddBranchesTest < Test::Unit::TestCase | |
| 25 25 |  | 
| 26 26 | 
             
                #noisy
         | 
| 27 27 |  | 
| 28 | 
            -
                 | 
| 28 | 
            +
                wfid = @engine.launch(pdef)
         | 
| 29 | 
            +
                wait_for(wfid)
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                assert_equal %w[ a b c d ], @tracer.to_a.sort
         | 
| 29 32 | 
             
              end
         | 
| 30 33 |  | 
| 31 34 | 
             
              def test_add_branches_times
         | 
| @@ -41,7 +44,10 @@ class EftAddBranchesTest < Test::Unit::TestCase | |
| 41 44 |  | 
| 42 45 | 
             
                #noisy
         | 
| 43 46 |  | 
| 44 | 
            -
                 | 
| 47 | 
            +
                wfid = @engine.launch(pdef)
         | 
| 48 | 
            +
                wait_for(wfid)
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                assert_equal %w[ 1 2 3 4 5 ], @tracer.to_a.sort
         | 
| 45 51 | 
             
              end
         | 
| 46 52 |  | 
| 47 53 | 
             
              def test_add_branches_times_and_whatever
         | 
| @@ -57,7 +63,10 @@ class EftAddBranchesTest < Test::Unit::TestCase | |
| 57 63 |  | 
| 58 64 | 
             
                #noisy
         | 
| 59 65 |  | 
| 60 | 
            -
                 | 
| 66 | 
            +
                wfid = @engine.launch(pdef)
         | 
| 67 | 
            +
                wait_for(wfid)
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                assert_equal %w[ 1 2 3 a b ], @tracer.to_a.sort
         | 
| 61 70 | 
             
              end
         | 
| 62 71 |  | 
| 63 72 | 
             
              def test_add_branches_with_tag
         | 
| @@ -78,9 +87,12 @@ class EftAddBranchesTest < Test::Unit::TestCase | |
| 78 87 |  | 
| 79 88 | 
             
                #noisy
         | 
| 80 89 |  | 
| 81 | 
            -
                 | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 90 | 
            +
                wfid = @engine.launch(pdef)
         | 
| 91 | 
            +
                wait_for(wfid)
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                assert_equal(
         | 
| 94 | 
            +
                  %w[ <:a <:b <:c <:c >:0 >:0 >:0 >:0 >:1 >:1 >:1 >:1 ],
         | 
| 95 | 
            +
                  @tracer.to_a.sort)
         | 
| 84 96 | 
             
              end
         | 
| 85 97 | 
             
            end
         | 
| 86 98 |  | 
| @@ -113,7 +113,8 @@ class EftIncTest < Test::Unit::TestCase | |
| 113 113 |  | 
| 114 114 | 
             
              def test_inc_array_head
         | 
| 115 115 |  | 
| 116 | 
            -
                 | 
| 116 | 
            +
                #@engine.context['ruby_eval_allowed'] = true
         | 
| 117 | 
            +
                @engine.configure('ruby_eval_allowed', true)
         | 
| 117 118 |  | 
| 118 119 | 
             
                pdef = Ruote.process_definition do
         | 
| 119 120 | 
             
                  sequence do
         | 
| @@ -63,9 +63,14 @@ class EftConcurrenceTest < Test::Unit::TestCase | |
| 63 63 |  | 
| 64 64 | 
             
                assert_trace(pdef, %w[ alpha ] * 3)
         | 
| 65 65 |  | 
| 66 | 
            -
                assert_equal(
         | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 66 | 
            +
                #assert_equal(
         | 
| 67 | 
            +
                #  {'1'=>{"seen"=>"indeed"}, '0'=>{}, "params"=>{"ref"=>"bravo"}},
         | 
| 68 | 
            +
                #  fields)
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                params = fields.delete('params')
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                assert_equal({ 'ref' => 'bravo' }, params)
         | 
| 73 | 
            +
                assert_match /seen/, fields.inspect
         | 
| 69 74 | 
             
              end
         | 
| 70 75 |  | 
| 71 76 | 
             
              def test_over_unless
         | 
| @@ -115,7 +120,7 @@ class EftConcurrenceTest < Test::Unit::TestCase | |
| 115 120 |  | 
| 116 121 | 
             
                #noisy
         | 
| 117 122 |  | 
| 118 | 
            -
                assert_trace pdef, %w[ a b done.]
         | 
| 123 | 
            +
                assert_trace pdef, %w[ a b done. ], %w[ b a done. ]
         | 
| 119 124 | 
             
              end
         | 
| 120 125 |  | 
| 121 126 | 
             
              # helper
         | 
| @@ -112,58 +112,85 @@ class FtStorageParticipantTest < Test::Unit::TestCase | |
| 112 112 | 
             
                end
         | 
| 113 113 | 
             
              end
         | 
| 114 114 |  | 
| 115 | 
            -
              def  | 
| 115 | 
            +
              def prepare_al_bravo
         | 
| 116 116 |  | 
| 117 117 | 
             
                @engine.register_participant :alpha, Ruote::StorageParticipant
         | 
| 118 118 | 
             
                @engine.register_participant :bravo, Ruote::StorageParticipant
         | 
| 119 119 |  | 
| 120 | 
            -
                wfid = @engine.launch(CON_AL_BRAVO)
         | 
| 120 | 
            +
                @wfid = @engine.launch(CON_AL_BRAVO)
         | 
| 121 121 |  | 
| 122 122 | 
             
                wait_for(:bravo)
         | 
| 123 123 |  | 
| 124 | 
            -
                part = Ruote::StorageParticipant.new
         | 
| 125 | 
            -
                part.context = @engine.context
         | 
| 126 | 
            -
             | 
| 127 | 
            -
                assert_equal 2, part.size
         | 
| 128 | 
            -
                #part.by_participant('alpha').each { |wi| p wi }
         | 
| 129 | 
            -
                assert_equal 1, part.by_participant('alpha').size
         | 
| 130 | 
            -
                assert_equal 1, part.by_participant('bravo').size
         | 
| 124 | 
            +
                @part = Ruote::StorageParticipant.new
         | 
| 125 | 
            +
                @part.context = @engine.context
         | 
| 131 126 | 
             
              end
         | 
| 132 127 |  | 
| 133 | 
            -
              def  | 
| 128 | 
            +
              def test_by_participant
         | 
| 134 129 |  | 
| 135 | 
            -
                 | 
| 136 | 
            -
                @engine.register_participant :bravo, Ruote::StorageParticipant
         | 
| 130 | 
            +
                prepare_al_bravo
         | 
| 137 131 |  | 
| 138 | 
            -
                 | 
| 132 | 
            +
                assert_equal 2, @part.size
         | 
| 133 | 
            +
                #@part.by_participant('alpha').each { |wi| p wi }
         | 
| 134 | 
            +
                assert_equal 1, @part.by_participant('alpha').size
         | 
| 135 | 
            +
                assert_equal 1, @part.by_participant('bravo').size
         | 
| 136 | 
            +
              end
         | 
| 139 137 |  | 
| 140 | 
            -
             | 
| 138 | 
            +
              def test_by_field
         | 
| 141 139 |  | 
| 142 | 
            -
                 | 
| 143 | 
            -
                part.context = @engine.context
         | 
| 140 | 
            +
                prepare_al_bravo
         | 
| 144 141 |  | 
| 145 | 
            -
                assert_equal 2, part.size
         | 
| 146 | 
            -
                assert_equal 2, part.by_field('place').size
         | 
| 147 | 
            -
                assert_equal 2, part.by_field('character').size
         | 
| 148 | 
            -
                assert_equal 1, part.by_field('adversary').size
         | 
| 142 | 
            +
                assert_equal 2, @part.size
         | 
| 143 | 
            +
                assert_equal 2, @part.by_field('place').size
         | 
| 144 | 
            +
                assert_equal 2, @part.by_field('character').size
         | 
| 145 | 
            +
                assert_equal 1, @part.by_field('adversary').size
         | 
| 149 146 | 
             
              end
         | 
| 150 147 |  | 
| 151 148 | 
             
              def test_by_field_and_value
         | 
| 152 149 |  | 
| 153 | 
            -
                 | 
| 154 | 
            -
                @engine.register_participant :bravo, Ruote::StorageParticipant
         | 
| 150 | 
            +
                prepare_al_bravo
         | 
| 155 151 |  | 
| 156 | 
            -
                 | 
| 152 | 
            +
                assert_equal 2, @part.size
         | 
| 153 | 
            +
                assert_equal 0, @part.by_field('place', 'nara').size
         | 
| 154 | 
            +
                assert_equal 2, @part.by_field('place', 'heiankyou').size
         | 
| 155 | 
            +
                assert_equal 1, @part.by_field('character', 'minamoto no hirosama').size
         | 
| 156 | 
            +
              end
         | 
| 157 157 |  | 
| 158 | 
            +
              def test_query
         | 
| 159 | 
            +
             | 
| 160 | 
            +
                prepare_al_bravo
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                wfid2 = @engine.launch(CON_AL_BRAVO, 'adversary' => 'B')
         | 
| 158 163 | 
             
                wait_for(:bravo)
         | 
| 159 164 |  | 
| 160 | 
            -
                part  | 
| 161 | 
            -
             | 
| 165 | 
            +
                #@part.query({}).each { |wi| puts '-' * 80; p wi }
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                assert_equal 4, @part.size
         | 
| 168 | 
            +
                assert_equal 4, @part.query({}).size
         | 
| 169 | 
            +
                assert_equal Ruote::Workitem, @part.query({}).first.class
         | 
| 170 | 
            +
                assert_equal 2, @part.query(:wfid => @wfid).size
         | 
| 171 | 
            +
                assert_equal 0, @part.query('place' => 'nara').size
         | 
| 172 | 
            +
                assert_equal 4, @part.query('place' => 'heiankyou').size
         | 
| 173 | 
            +
                assert_equal 2, @part.query(:wfid => @wfid, :place => 'heiankyou').size
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                assert_equal(
         | 
| 176 | 
            +
                  1,
         | 
| 177 | 
            +
                  @part.query(:place => 'heiankyou', :adversary => 'B').size)
         | 
| 178 | 
            +
             | 
| 179 | 
            +
                assert_equal 2, @part.query('place' => 'heiankyou', :limit => 2).size
         | 
| 180 | 
            +
                assert_equal 4, @part.query('place' => 'heiankyou', :limit => 20).size
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                page0 =
         | 
| 183 | 
            +
                  @part.query('place' => 'heiankyou', :limit => 2).collect { |wi|
         | 
| 184 | 
            +
                    "#{wi.fei.wfid}-#{wi.participant_name}" }
         | 
| 185 | 
            +
                page1 =
         | 
| 186 | 
            +
                  @part.query('place' => 'heiankyou', :offset => 2, :limit => 2).collect { |wi|
         | 
| 187 | 
            +
                    "#{wi.fei.wfid}-#{wi.participant_name}" }
         | 
| 162 188 |  | 
| 163 | 
            -
                 | 
| 164 | 
            -
                assert_equal  | 
| 165 | 
            -
             | 
| 166 | 
            -
                assert_equal | 
| 189 | 
            +
                #p page0, page1
         | 
| 190 | 
            +
                assert_equal 4, (page0 + page1).sort.uniq.size
         | 
| 191 | 
            +
             | 
| 192 | 
            +
                assert_equal(
         | 
| 193 | 
            +
                  2, @part.query('place' => 'heiankyou', :participant => 'alpha').size)
         | 
| 167 194 | 
             
              end
         | 
| 168 195 |  | 
| 169 196 | 
             
              def test_initialize_engine_then_opts
         | 
| @@ -255,5 +282,12 @@ class FtStorageParticipantTest < Test::Unit::TestCase | |
| 255 282 |  | 
| 256 283 | 
             
                assert_equal 'heian', alpha.first.fields['jidai']
         | 
| 257 284 | 
             
              end
         | 
| 285 | 
            +
             | 
| 286 | 
            +
              def test_registration
         | 
| 287 | 
            +
             | 
| 288 | 
            +
                pa = @engine.register_participant 'alpha', Ruote::StorageParticipant
         | 
| 289 | 
            +
             | 
| 290 | 
            +
                assert_equal Ruote::StorageParticipant, pa.class
         | 
| 291 | 
            +
              end
         | 
| 258 292 | 
             
            end
         | 
| 259 293 |  | 
| @@ -47,6 +47,9 @@ class FtBlockParticipantTest < Test::Unit::TestCase | |
| 47 47 |  | 
| 48 48 | 
             
              def test_block_result
         | 
| 49 49 |  | 
| 50 | 
            +
                return if Ruote::WIN
         | 
| 51 | 
            +
                  # defective 'json' lib on windows render this test useless
         | 
| 52 | 
            +
             | 
| 50 53 | 
             
                @engine.register_participant :alpha do |workitem|
         | 
| 51 54 | 
             
                  'seen'
         | 
| 52 55 | 
             
                end
         | 
| @@ -58,6 +61,9 @@ class FtBlockParticipantTest < Test::Unit::TestCase | |
| 58 61 |  | 
| 59 62 | 
             
              def test_non_jsonfiable_result
         | 
| 60 63 |  | 
| 64 | 
            +
                return if Ruote::WIN
         | 
| 65 | 
            +
                  # defective 'json' lib on windows render this test useless
         | 
| 66 | 
            +
             | 
| 61 67 | 
             
                t = Time.now
         | 
| 62 68 |  | 
| 63 69 | 
             
                @engine.register_participant :alpha do |workitem|
         | 
| @@ -35,8 +35,8 @@ class NftSmtpParticipantTest < Test::Unit::TestCase | |
| 35 35 | 
             
                  end
         | 
| 36 36 | 
             
                end
         | 
| 37 37 |  | 
| 38 | 
            -
                trapfile = '/tmp/ruote_mailtrap.txt'
         | 
| 39 | 
            -
                FileUtils. | 
| 38 | 
            +
                trapfile = Ruote::WIN ? 'ruote_mailtrap.txt' : '/tmp/ruote_mailtrap.txt'
         | 
| 39 | 
            +
                FileUtils.rm_f(trapfile)
         | 
| 40 40 |  | 
| 41 41 | 
             
                Thread.new do
         | 
| 42 42 | 
             
                  Trap.new('127.0.0.1', 2525, true, trapfile)
         | 
| @@ -5,6 +5,8 @@ | |
| 5 5 | 
             
            # Sun Oct  4 00:14:27 JST 2009
         | 
| 6 6 | 
             
            #
         | 
| 7 7 |  | 
| 8 | 
            +
            require File.join(File.dirname(__FILE__), 'base')
         | 
| 9 | 
            +
             | 
| 8 10 | 
             
            begin
         | 
| 9 11 | 
             
              require 'yajl'
         | 
| 10 12 | 
             
            rescue LoadError
         | 
| @@ -12,8 +14,6 @@ rescue LoadError | |
| 12 14 | 
             
            end
         | 
| 13 15 | 
             
            Rufus::Json.detect_backend rescue nil
         | 
| 14 16 |  | 
| 15 | 
            -
            require File.join(File.dirname(__FILE__), 'base')
         | 
| 16 | 
            -
             | 
| 17 17 | 
             
            require 'ruote/log/fs_history'
         | 
| 18 18 | 
             
            require 'ruote/part/no_op_participant'
         | 
| 19 19 |  | 
| @@ -57,6 +57,7 @@ class FtFsHistoryTest < Test::Unit::TestCase | |
| 57 57 |  | 
| 58 58 | 
             
              ensure
         | 
| 59 59 |  | 
| 60 | 
            +
                @engine.context.history.shutdown
         | 
| 60 61 | 
             
                Dir['work/log/*'].each { |fn| FileUtils.rm(fn) }
         | 
| 61 62 | 
             
              end
         | 
| 62 63 |  | 
| @@ -90,6 +91,7 @@ class FtFsHistoryTest < Test::Unit::TestCase | |
| 90 91 |  | 
| 91 92 | 
             
              ensure
         | 
| 92 93 |  | 
| 94 | 
            +
                @engine.context.history.shutdown
         | 
| 93 95 | 
             
                Dir['work/log2/*'].each { |fn| FileUtils.rm(fn) }
         | 
| 94 96 | 
             
              end
         | 
| 95 97 |  | 
| @@ -115,6 +117,7 @@ class FtFsHistoryTest < Test::Unit::TestCase | |
| 115 117 |  | 
| 116 118 | 
             
              ensure
         | 
| 117 119 |  | 
| 120 | 
            +
                @engine.context.history.shutdown
         | 
| 118 121 | 
             
                Dir['work/log/*'].each { |fn| FileUtils.rm(fn) }
         | 
| 119 122 | 
             
              end
         | 
| 120 123 |  | 
| @@ -145,6 +148,7 @@ class FtFsHistoryTest < Test::Unit::TestCase | |
| 145 148 |  | 
| 146 149 | 
             
              ensure
         | 
| 147 150 |  | 
| 151 | 
            +
                @engine.context.history.shutdown
         | 
| 148 152 | 
             
                Dir['work/log/*'].each { |fn| FileUtils.rm(fn) }
         | 
| 149 153 | 
             
              end
         | 
| 150 154 |  | 
| @@ -157,18 +161,18 @@ class FtFsHistoryTest < Test::Unit::TestCase | |
| 157 161 |  | 
| 158 162 | 
             
                File.open(File.join('work', 'log', 'history_2009-10-08.json'), 'w') do |f|
         | 
| 159 163 | 
             
                  f.puts(%{
         | 
| 160 | 
            -
            ["2009-10-08 | 
| 161 | 
            -
            ["2009-10-08 | 
| 162 | 
            -
            ["2009-10-08 | 
| 164 | 
            +
            ["!2009-10-08!12:33:27.835469",{"wfid":"20091224-beretsureto","tree":["define",{},[["alpha",{},[]],["echo",{"done.":null},[]]]],"workitem":{"fields":{},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0"}},"variables":{},"type":"msgs","_id":"17619-2151883888-1261658007.83374","action":"launch","_rev":0,"put_at":"2009/12/24 12:33:27.833769 UTC"}]
         | 
| 165 | 
            +
            ["!2009-10-08!12:33:27.836787",{"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"tree":["participant",{"ref":"alpha"},[]],"parent_id":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0"},"variables":null,"workitem":{"fields":{"params":{"ref":"alpha"}},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha"},"type":"msgs","_id":"17619-2157823640-1261658007.83534","action":"apply","_rev":0,"put_at":"2009/12/24 12:33:27.835369 UTC"}]
         | 
| 166 | 
            +
            ["!2009-10-08!12:33:27.837098",{"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha","workitem":{"fields":{"params":{"ref":"alpha"}},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha"},"for_engine_worker?":false,"type":"msgs","_id":"17619-2157823640-1261658007.83666","action":"dispatch","_rev":0,"put_at":"2009/12/24 12:33:27.836690 UTC"}]
         | 
| 163 167 | 
             
                  }.strip)
         | 
| 164 168 | 
             
                end
         | 
| 165 169 |  | 
| 166 170 | 
             
                File.open(File.join('work', 'log', 'history_2009-10-31.json'), 'w') do |f|
         | 
| 167 171 | 
             
                  f.puts(%{
         | 
| 168 | 
            -
            ["2009-10-31 | 
| 169 | 
            -
            ["2009-10-31 | 
| 170 | 
            -
            ["2009-10-31 | 
| 171 | 
            -
            ["2009-10-31 | 
| 172 | 
            +
            ["!2009-10-31!12:33:27.835469",{"wfid":"20091224-beretsureto","tree":["define",{},[["alpha",{},[]],["echo",{"done.":null},[]]]],"workitem":{"fields":{},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0"}},"variables":{},"type":"msgs","_id":"17619-2151883888-1261658007.83374","action":"launch","_rev":0,"put_at":"2009/12/24 12:33:27.833769 UTC"}]
         | 
| 173 | 
            +
            ["!2009-10-31!12:33:27.836787",{"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"tree":["participant",{"ref":"alpha"},[]],"parent_id":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0"},"variables":null,"workitem":{"fields":{"params":{"ref":"alpha"}},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha"},"type":"msgs","_id":"17619-2157823640-1261658007.83534","action":"apply","_rev":0,"put_at":"2009/12/24 12:33:27.835369 UTC"}]
         | 
| 174 | 
            +
            ["!2009-10-31!12:33:27.837098",{"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha","workitem":{"fields":{"params":{"ref":"alpha"}},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha"},"for_engine_worker?":false,"type":"msgs","_id":"17619-2157823640-1261658007.83666","action":"dispatch","_rev":0,"put_at":"2009/12/24 12:33:27.836690 UTC"}]
         | 
| 175 | 
            +
            ["!2009-10-31!12:33:27.837961",{"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"workitem":{"fields":{},"fei":{"engine_id":"engine","wfid":"20091224-beretsureto","expid":"0_0"},"participant_name":"alpha"},"participant_name":"alpha","type":"msgs","_id":"17619-2159486252-1261658007.83719","action":"receive","_rev":0,"put_at":"2009/12/24 12:33:27.837235 UTC"}]
         | 
| 172 176 | 
             
                  }.strip)
         | 
| 173 177 | 
             
                end
         | 
| 174 178 |  | 
| @@ -176,11 +180,12 @@ class FtFsHistoryTest < Test::Unit::TestCase | |
| 176 180 | 
             
                assert_equal 4, @engine.context.history.by_date('2009-10-31').size
         | 
| 177 181 |  | 
| 178 182 | 
             
                assert_equal(
         | 
| 179 | 
            -
                  [ Time.parse(Time.now.strftime('% | 
| 183 | 
            +
                  [ Time.parse(Time.now.strftime('%Y-%m-%d')), Time.parse('2009-10-08') ],
         | 
| 180 184 | 
             
                  @engine.context.history.range)
         | 
| 181 185 |  | 
| 182 186 | 
             
              ensure
         | 
| 183 187 |  | 
| 188 | 
            +
                @engine.context.history.shutdown
         | 
| 184 189 | 
             
                Dir['work/log/*'].each { |fn| FileUtils.rm(fn) }
         | 
| 185 190 | 
             
              end
         | 
| 186 191 | 
             
            end
         | 
| @@ -57,12 +57,12 @@ class FtStorageHistoryTest < Test::Unit::TestCase | |
| 57 57 |  | 
| 58 58 | 
             
                6.times do |i|
         | 
| 59 59 | 
             
                  @engine.storage.put(
         | 
| 60 | 
            -
                    '_id' => "2010-01-06!11414#{i}!0!!20100106-bichisosupo",
         | 
| 60 | 
            +
                    '_id' => "!2010-01-06!11414#{i}!0!!20100106-bichisosupo",
         | 
| 61 61 | 
             
                    'type' => 'history')
         | 
| 62 62 | 
             
                end
         | 
| 63 63 | 
             
                7.times do |i|
         | 
| 64 64 | 
             
                  @engine.storage.put(
         | 
| 65 | 
            -
                    '_id' => "2010-01-07!11414#{i}!0!!20100107-bichitehoni",
         | 
| 65 | 
            +
                    '_id' => "!2010-01-07!11414#{i}!0!!20100107-bichitehoni",
         | 
| 66 66 | 
             
                    'type' => 'history')
         | 
| 67 67 | 
             
                end
         | 
| 68 68 |  | 
| @@ -78,7 +78,7 @@ class FtStorageHistoryTest < Test::Unit::TestCase | |
| 78 78 | 
             
                7.times do |i|
         | 
| 79 79 | 
             
                  i = i + 1
         | 
| 80 80 | 
             
                  @engine.storage.put(
         | 
| 81 | 
            -
                    '_id' => "2010-01-0#{i}!114147!0!!2010010#{i}-bichisosupo",
         | 
| 81 | 
            +
                    '_id' => "!2010-01-0#{i}!114147!0!!2010010#{i}-bichisosupo",
         | 
| 82 82 | 
             
                    'type' => 'history')
         | 
| 83 83 | 
             
                end
         | 
| 84 84 |  | 
| @@ -103,5 +103,13 @@ class FtParticipantRegistrationTest < Test::Unit::TestCase | |
| 103 103 |  | 
| 104 104 | 
             
                assert_equal true, alpha.down
         | 
| 105 105 | 
             
              end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
              def test_participant_list_of_names
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                pa = @engine.register_participant :alpha do |workitem|
         | 
| 110 | 
            +
                end
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                assert_equal ['^alpha$'], @engine.context.plist.names
         | 
| 113 | 
            +
              end
         | 
| 106 114 | 
             
            end
         | 
| 107 115 |  |