Sha256: ff9061980781611bbf008db9437d28dc5d855f82ebf70abfb6ba6daf305a0137
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true module Dynflow module Testing class DummyExecutor attr_reader :world, :events_to_process def initialize(world) @world = world @events_to_process = [] end def event(execution_plan_id, step_id, event, future = Concurrent::Promises.resolvable_future) @events_to_process << [execution_plan_id, step_id, event, future] end def delayed_event(director_event) @events_to_process << [director_event.execution_plan_id, director_event.step_id, director_event.event, director_event.result] end def plan_events(delayed_events) delayed_events.each do |event| world.plan_event(event.execution_plan_id, event.step_id, event.event, event.time) end end def execute(action, event = nil) action.execute event plan_events(action.delayed_events.dup) action.delayed_events.clear end # returns true if some event was processed. def progress events = @events_to_process.dup clear events.each do |execution_plan_id, step_id, event, future| future.fulfill true if event && world.action.state != :suspended return false end execute(world.action, event) end end def clear @events_to_process.clear end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dynflow-1.9.0 | lib/dynflow/testing/dummy_executor.rb |
dynflow-1.8.3 | lib/dynflow/testing/dummy_executor.rb |