Class: Dynflow::Testing::DummyWorld
- Inherits:
-
Object
- Object
- Dynflow::Testing::DummyWorld
- Extended by:
- Mimic
- Defined in:
- lib/dynflow/testing/dummy_world.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#clock ⇒ Object
readonly
Returns the value of attribute clock.
-
#coordinator ⇒ Object
readonly
Returns the value of attribute coordinator.
-
#delayed_executor ⇒ Object
readonly
Returns the value of attribute delayed_executor.
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
-
#middleware ⇒ Object
readonly
Returns the value of attribute middleware.
Instance Method Summary collapse
- #action_logger ⇒ Object
- #event(execution_plan_id, step_id, event, future = Concurrent::Promises.resolvable_future) ⇒ Object
-
#initialize(_config = nil) ⇒ DummyWorld
constructor
A new instance of DummyWorld.
- #logger ⇒ Object
- #persistence ⇒ Object
- #plan_event(execution_plan_id, step_id, event, time, accepted = Concurrent::Promises.resolvable_future) ⇒ Object
- #silence_logger! ⇒ Object
- #subscribed_actions(klass) ⇒ Object
Methods included from Mimic
Constructor Details
#initialize(_config = nil) ⇒ DummyWorld
Returns a new instance of DummyWorld.
11 12 13 14 15 16 17 |
# File 'lib/dynflow/testing/dummy_world.rb', line 11 def initialize(_config = nil) @logger_adapter = Testing.logger_adapter @clock = ManagedClock.new @executor = DummyExecutor.new(self) @middleware = Middleware::World.new @coordinator = DummyCoordinator.new end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
9 10 11 |
# File 'lib/dynflow/testing/dummy_world.rb', line 9 def action @action end |
#clock ⇒ Object (readonly)
Returns the value of attribute clock.
8 9 10 |
# File 'lib/dynflow/testing/dummy_world.rb', line 8 def clock @clock end |
#coordinator ⇒ Object (readonly)
Returns the value of attribute coordinator.
8 9 10 |
# File 'lib/dynflow/testing/dummy_world.rb', line 8 def coordinator @coordinator end |
#delayed_executor ⇒ Object (readonly)
Returns the value of attribute delayed_executor.
8 9 10 |
# File 'lib/dynflow/testing/dummy_world.rb', line 8 def delayed_executor @delayed_executor end |
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
8 9 10 |
# File 'lib/dynflow/testing/dummy_world.rb', line 8 def executor @executor end |
#middleware ⇒ Object (readonly)
Returns the value of attribute middleware.
8 9 10 |
# File 'lib/dynflow/testing/dummy_world.rb', line 8 def middleware @middleware end |
Instance Method Details
#action_logger ⇒ Object
19 20 21 |
# File 'lib/dynflow/testing/dummy_world.rb', line 19 def action_logger @logger_adapter.action_logger end |
#event(execution_plan_id, step_id, event, future = Concurrent::Promises.resolvable_future) ⇒ Object
35 36 37 |
# File 'lib/dynflow/testing/dummy_world.rb', line 35 def event(execution_plan_id, step_id, event, future = Concurrent::Promises.resolvable_future) executor.event execution_plan_id, step_id, event, future end |
#logger ⇒ Object
23 24 25 |
# File 'lib/dynflow/testing/dummy_world.rb', line 23 def logger @logger_adapter.dynflow_logger end |
#persistence ⇒ Object
47 48 49 |
# File 'lib/dynflow/testing/dummy_world.rb', line 47 def persistence nil end |
#plan_event(execution_plan_id, step_id, event, time, accepted = Concurrent::Promises.resolvable_future) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/dynflow/testing/dummy_world.rb', line 39 def plan_event(execution_plan_id, step_id, event, time, accepted = Concurrent::Promises.resolvable_future) if time.nil? || time < Time.now event(execution_plan_id, step_id, event, accepted) else clock.ping(executor, time, Director::Event[SecureRandom.uuid, execution_plan_id, step_id, event, accepted], :delayed_event) end end |
#silence_logger! ⇒ Object
27 28 29 |
# File 'lib/dynflow/testing/dummy_world.rb', line 27 def silence_logger! action_logger.level = 4 end |
#subscribed_actions(klass) ⇒ Object
31 32 33 |
# File 'lib/dynflow/testing/dummy_world.rb', line 31 def subscribed_actions(klass) [] end |