Module: Cadence::Testing::CadenceOverride

Defined in:
lib/cadence/testing/cadence_override.rb

Instance Method Summary collapse

Instance Method Details

#complete_activity(async_token, result = nil) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/cadence/testing/cadence_override.rb', line 34

def complete_activity(async_token, result = nil)
  return super if Cadence::Testing.disabled?

  details = Activity::AsyncToken.decode(async_token)
  execution = executions[[details.workflow_id, details.run_id]]

  execution.complete_activity(async_token, result)
end

#fail_activity(async_token, error) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/cadence/testing/cadence_override.rb', line 43

def fail_activity(async_token, error)
  return super if Cadence::Testing.disabled?

  details = Activity::AsyncToken.decode(async_token)
  execution = executions[[details.workflow_id, details.run_id]]

  execution.fail_activity(async_token, error)
end

#fetch_workflow_execution_info(_domain, workflow_id, run_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cadence/testing/cadence_override.rb', line 18

def fetch_workflow_execution_info(_domain, workflow_id, run_id)
  return super if Cadence::Testing.disabled?

  execution = executions[[workflow_id, run_id]]

  Workflow::ExecutionInfo.new(
    workflow: nil,
    workflow_id: workflow_id,
    run_id: run_id,
    start_time: nil,
    close_time: nil,
    status: execution.status,
    history_length: nil,
  ).freeze
end

#start_workflow(workflow, *input, **args) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/cadence/testing/cadence_override.rb', line 10

def start_workflow(workflow, *input, **args)
  return super if Cadence::Testing.disabled?

  if Cadence::Testing.local?
    start_locally(workflow, *input, **args)
  end
end