dor-workflow-client 6.0.0 → 7.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b02179966ff3ccea0895b6f24e697893d1f6f86ca19f11e4f7e1bf1cd431d2d2
4
- data.tar.gz: 34e3c8191e88642e1850fa346552a2f986a809289334193f6bee25273b20f81f
3
+ metadata.gz: aed52be59d8bdd07de43af3d484e04d7d0aefa98dd8a8813840401a1cd06978c
4
+ data.tar.gz: d81de9c43e0bc80eb50b02048422a399f77dc2a450db8ecf5aec165cdcc18251
5
5
  SHA512:
6
- metadata.gz: 100a4642fffa4640ad6f35cff6ec1e8e224919985c6f2852bbf840790350bdc9bd4fca81a9a343eb86eced7e69a489d0ed25fc32d0036c511fc581267efc5ce8
7
- data.tar.gz: c3d5755642cff98de6adba80ea2e67dbe61195e38885dd7c4163409d3d978e49420a9ef1f55488133d49724affc985f0ad8463560fe58c5eae0c3ecabc616ec9
6
+ metadata.gz: 672a4500292b005090dddf14ab56bdb8adfc981badaf2840e7c9439d84b996143aa047fbe1948efb9aa2c5b22c188ce02ee8929814fc9a4d072a6bd5aec4d6bd
7
+ data.tar.gz: 2ede4f3978b2f7e27fc405146b9f106bddd7b9f787c4eb26295ee09fff2c1b7be02145da55f6f9ddae93de7da36c20709116114484da59e4adcc61f55bcc2fd7
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@4.0.0
3
+ ruby-rails: sul-dlss/ruby-rails@4.1.0
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/.rubocop.yml CHANGED
@@ -281,3 +281,21 @@ RSpec/Rails/MinitestAssertions: # new in 2.17
281
281
  RSpec/Rails/TravelAround: # new in 2.19
282
282
  Enabled: true
283
283
 
284
+ Gemspec/DevelopmentDependencies: # new in 1.44
285
+ Enabled: true
286
+ Lint/MixedCaseRange: # new in 1.53
287
+ Enabled: true
288
+ Lint/RedundantRegexpQuantifiers: # new in 1.53
289
+ Enabled: true
290
+ Style/RedundantCurrentDirectoryInPath: # new in 1.53
291
+ Enabled: true
292
+ Style/RedundantRegexpArgument: # new in 1.53
293
+ Enabled: true
294
+ Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
295
+ Enabled: true
296
+ Style/YAMLFileRead: # new in 1.53
297
+ Enabled: true
298
+ RSpec/ReceiveMessages: # new in 2.23
299
+ Enabled: true
300
+ RSpec/Rails/NegationBeValid: # new in 2.23
301
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
- # on 2023-06-20 15:30:24 UTC using RuboCop version 1.52.1.
3
+ # on 2023-08-23 21:27:28 UTC using RuboCop version 1.56.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
data/Gemfile CHANGED
@@ -11,3 +11,14 @@ group :development, :test do
11
11
  gem 'byebug'
12
12
  gem 'rspec_junit_formatter' # For CircleCI
13
13
  end
14
+
15
+ group :development do
16
+ gem 'rake'
17
+ gem 'rspec', '~> 3.3'
18
+ gem 'rubocop', '~> 1.24'
19
+ gem 'rubocop-rake'
20
+ gem 'rubocop-rspec', '~> 2.1'
21
+ gem 'simplecov'
22
+ gem 'webmock'
23
+ gem 'yard'
24
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-workflow-client (6.0.0)
4
+ dor-workflow-client (7.0.0)
5
5
  activesupport (>= 3.2.1, < 8)
6
6
  deprecation (>= 0.99.0)
7
7
  faraday (~> 2.0)
@@ -12,47 +12,61 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (7.0.5)
15
+ activesupport (7.1.2)
16
+ base64
17
+ bigdecimal
16
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ connection_pool (>= 2.2.5)
20
+ drb
17
21
  i18n (>= 1.6, < 2)
18
22
  minitest (>= 5.1)
23
+ mutex_m
19
24
  tzinfo (~> 2.0)
20
- addressable (2.8.4)
25
+ addressable (2.8.6)
21
26
  public_suffix (>= 2.0.2, < 6.0)
22
27
  ast (2.4.2)
28
+ base64 (0.2.0)
29
+ bigdecimal (3.1.5)
23
30
  byebug (11.1.3)
24
31
  concurrent-ruby (1.2.2)
32
+ connection_pool (2.4.1)
25
33
  crack (0.4.5)
26
34
  rexml
27
35
  deprecation (1.1.0)
28
36
  activesupport
29
37
  diff-lcs (1.5.0)
30
38
  docile (1.4.0)
31
- faraday (2.7.6)
32
- faraday-net_http (>= 2.0, < 3.1)
33
- ruby2_keywords (>= 0.0.4)
34
- faraday-net_http (3.0.2)
39
+ drb (2.2.0)
40
+ ruby2_keywords
41
+ faraday (2.9.0)
42
+ faraday-net_http (>= 2.0, < 3.2)
43
+ faraday-net_http (3.1.0)
44
+ net-http
35
45
  faraday-retry (2.2.0)
36
46
  faraday (~> 2.0)
37
- hashdiff (1.0.1)
47
+ hashdiff (1.1.0)
38
48
  i18n (1.14.1)
39
49
  concurrent-ruby (~> 1.0)
40
- json (2.6.3)
41
- mini_portile2 (2.8.2)
42
- minitest (5.18.1)
43
- nokogiri (1.15.2)
50
+ json (2.7.1)
51
+ language_server-protocol (3.17.0.3)
52
+ mini_portile2 (2.8.5)
53
+ minitest (5.21.1)
54
+ mutex_m (0.2.0)
55
+ net-http (0.4.1)
56
+ uri
57
+ nokogiri (1.16.0)
44
58
  mini_portile2 (~> 2.8.2)
45
59
  racc (~> 1.4)
46
- parallel (1.23.0)
47
- parser (3.2.2.3)
60
+ parallel (1.24.0)
61
+ parser (3.3.0.3)
48
62
  ast (~> 2.4.1)
49
63
  racc
50
- public_suffix (5.0.1)
51
- racc (1.7.1)
64
+ public_suffix (5.0.4)
65
+ racc (1.7.3)
52
66
  rainbow (3.1.1)
53
- rake (13.0.6)
54
- regexp_parser (2.8.1)
55
- rexml (3.2.5)
67
+ rake (13.1.0)
68
+ regexp_parser (2.9.0)
69
+ rexml (3.2.6)
56
70
  rspec (3.12.0)
57
71
  rspec-core (~> 3.12.0)
58
72
  rspec-expectations (~> 3.12.0)
@@ -62,32 +76,33 @@ GEM
62
76
  rspec-expectations (3.12.3)
63
77
  diff-lcs (>= 1.2.0, < 2.0)
64
78
  rspec-support (~> 3.12.0)
65
- rspec-mocks (3.12.5)
79
+ rspec-mocks (3.12.6)
66
80
  diff-lcs (>= 1.2.0, < 2.0)
67
81
  rspec-support (~> 3.12.0)
68
- rspec-support (3.12.0)
82
+ rspec-support (3.12.1)
69
83
  rspec_junit_formatter (0.6.0)
70
84
  rspec-core (>= 2, < 4, != 2.12.0)
71
- rubocop (1.52.1)
85
+ rubocop (1.60.0)
72
86
  json (~> 2.3)
87
+ language_server-protocol (>= 3.17.0)
73
88
  parallel (~> 1.10)
74
- parser (>= 3.2.2.3)
89
+ parser (>= 3.3.0.2)
75
90
  rainbow (>= 2.2.2, < 4.0)
76
91
  regexp_parser (>= 1.8, < 3.0)
77
92
  rexml (>= 3.2.5, < 4.0)
78
- rubocop-ast (>= 1.28.0, < 2.0)
93
+ rubocop-ast (>= 1.30.0, < 2.0)
79
94
  ruby-progressbar (~> 1.7)
80
95
  unicode-display_width (>= 2.4.0, < 3.0)
81
- rubocop-ast (1.29.0)
96
+ rubocop-ast (1.30.0)
82
97
  parser (>= 3.2.1.0)
83
- rubocop-capybara (2.18.0)
98
+ rubocop-capybara (2.20.0)
99
+ rubocop (~> 1.41)
100
+ rubocop-factory_bot (2.25.1)
84
101
  rubocop (~> 1.41)
85
- rubocop-factory_bot (2.23.1)
86
- rubocop (~> 1.33)
87
102
  rubocop-rake (0.6.0)
88
103
  rubocop (~> 1.0)
89
- rubocop-rspec (2.22.0)
90
- rubocop (~> 1.33)
104
+ rubocop-rspec (2.26.1)
105
+ rubocop (~> 1.40)
91
106
  rubocop-capybara (~> 2.17)
92
107
  rubocop-factory_bot (~> 2.22)
93
108
  ruby-progressbar (1.13.0)
@@ -100,13 +115,14 @@ GEM
100
115
  simplecov_json_formatter (0.1.4)
101
116
  tzinfo (2.0.6)
102
117
  concurrent-ruby (~> 1.0)
103
- unicode-display_width (2.4.2)
104
- webmock (3.18.1)
118
+ unicode-display_width (2.5.0)
119
+ uri (0.13.0)
120
+ webmock (3.19.1)
105
121
  addressable (>= 2.8.0)
106
122
  crack (>= 0.3.2)
107
123
  hashdiff (>= 0.4.0, < 2.0.0)
108
124
  yard (0.9.34)
109
- zeitwerk (2.6.8)
125
+ zeitwerk (2.6.12)
110
126
 
111
127
  PLATFORMS
112
128
  ruby
@@ -25,13 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency 'nokogiri', '~> 1.6'
26
26
  gem.add_dependency 'zeitwerk', '~> 2.1'
27
27
 
28
- gem.add_development_dependency 'rake'
29
- gem.add_development_dependency 'rspec', '~> 3.3'
30
- gem.add_development_dependency 'rubocop', '~> 1.24'
31
- gem.add_development_dependency 'rubocop-rake'
32
- gem.add_development_dependency 'rubocop-rspec', '~> 2.1'
33
- gem.add_development_dependency 'simplecov'
34
- gem.add_development_dependency 'webmock'
35
- gem.add_development_dependency 'yard'
36
28
  gem.metadata['rubygems_mfa_required'] = 'true'
37
29
  end
@@ -20,30 +20,6 @@ module Dor
20
20
  doc.xpath('/lanes/lane').map { |n| n['id'] }
21
21
  end
22
22
 
23
- # Gets all of the workflow steps that have a status of 'queued' that have a last-updated timestamp older than the number of hours passed in
24
- # This will enable re-queueing of jobs that have been lost by the job manager
25
- # @param [Hash] opts optional values for query
26
- # @option opts [Integer] :hours_ago steps older than this value will be returned by the query. If not passed in, the service defaults to 0 hours,
27
- # meaning you will get all queued workflows
28
- # @option opts [Integer] :limit sets the maximum number of workflow steps that can be returned. Defaults to no limit
29
- # @return [Array[Hash]] each Hash represents a workflow step. It will have the following keys:
30
- # :workflow, :step, :druid, :lane_id
31
- def stale_queued_workflows(opts)
32
- uri_string = build_queued_uri(opts)
33
- parse_queued_workflows_response requestor.request(uri_string)
34
- end
35
-
36
- # Returns a count of workflow steps that have a status of 'queued' that have a last-updated timestamp older than the number of hours passed in
37
- # @param [Hash] opts optional values for query
38
- # @option opts [Integer] :hours_ago steps older than this value will be returned by the query. If not passed in, the service defaults to 0 hours,
39
- # meaning you will get all queued workflows
40
- # @return [Integer] number of stale, queued steps if the :count_only option was set to true
41
- def count_stale_queued_workflows(opts)
42
- uri_string = "#{build_queued_uri(opts)}&count-only=true"
43
- doc = Nokogiri::XML(requestor.request(uri_string))
44
- doc.at_xpath('/objects/@count').value.to_i
45
- end
46
-
47
23
  # Returns a list of druids from the workflow service that meet the criteria
48
24
  # of the passed in completed and waiting params
49
25
  #
@@ -104,65 +80,10 @@ module Dor
104
80
  Nokogiri::XML(resp).xpath('//object[@id]').map { |n| n[:id] }
105
81
  end
106
82
 
107
- # Get a list of druids that have errored out in a particular workflow and step
108
- #
109
- # @param [String] workflow name
110
- # @param [String] step name
111
- #
112
- # @return [Hash] hash of results, with key has a druid, and value as the error message
113
- # @example
114
- # client.errored_objects_for_workstep('accessionWF','content-metadata')
115
- # => {"druid:qd556jq0580"=>"druid:qd556jq0580 - Item error; caused by
116
- # blah blah. See logger for details>"}
117
- def errored_objects_for_workstep(workflow, step)
118
- resp = requestor.request "workflow_queue?workflow=#{workflow}&error=#{step}"
119
- Nokogiri::XML(resp).xpath('//object').to_h do |node|
120
- [node['id'], node['errorMessage']]
121
- end
122
- end
123
-
124
- # Used by preservation robots stats reporter
125
- #
126
- # @param [String] workflow name
127
- # @param [String] step name
128
- # @param [String] type
129
- #
130
- # @return [Hash] hash of results, with key has a druid, and value as the error message
131
- def count_objects_in_step(workflow, step, type)
132
- resp = requestor.request "workflow_queue?workflow=#{workflow}&#{type}=#{step}"
133
- extract_object_count(resp)
134
- end
135
-
136
- # Returns the number of objects that have a status of 'error' in a particular workflow and step
137
- #
138
- # @param [String] workflow name
139
- # @param [String] step name
140
- #
141
- # @return [Integer] Number of objects with this repository:workflow:step that have a status of 'error'
142
- def count_errored_for_workstep(workflow, step)
143
- count_objects_in_step(workflow, step, 'error')
144
- end
145
-
146
- # Returns the number of objects that have a status of 'queued' in a particular workflow and step
147
- #
148
- # @param [String] workflow name
149
- # @param [String] step name
150
- #
151
- # @return [Integer] Number of objects with this repository:workflow:step that have a status of 'queued'
152
- def count_queued_for_workstep(workflow, step)
153
- count_objects_in_step(workflow, step, 'queued')
154
- end
155
-
156
83
  private
157
84
 
158
85
  attr_reader :requestor
159
86
 
160
- def build_queued_uri(opts = {})
161
- query_hash = opts.slice(:hours_ago, :limit).transform_keys { |key| key.to_s.tr('_', '-') }
162
- query_string = URI.encode_www_form(query_hash)
163
- "workflow_queue/all_queued?#{query_string}"
164
- end
165
-
166
87
  # Converts workflow-step into workflow:step
167
88
  # @param [String] default_workflow
168
89
  # @param [String] step if contains colon :, then the value for workflow and/or workflow/repository. For example: 'jp2-create', 'assemblyWF:jp2-create' or 'dor:assemblyWF:jp2-create'
@@ -174,24 +95,6 @@ module Dor
174
95
  current.unshift(default_workflow) if current.length < 2
175
96
  current.join(':')
176
97
  end
177
-
178
- def parse_queued_workflows_response(xml)
179
- Nokogiri::XML(xml).xpath('/workflows/workflow').collect do |wf_node|
180
- {
181
- workflow: wf_node['name'],
182
- step: wf_node['process'],
183
- druid: wf_node['druid'],
184
- lane_id: wf_node['laneId']
185
- }
186
- end
187
- end
188
-
189
- def extract_object_count(resp)
190
- node = Nokogiri::XML(resp).at_xpath('/objects')
191
- raise Dor::WorkflowException, 'Unable to determine count from response' if node.nil?
192
-
193
- node['count'].to_i
194
- end
195
98
  end
196
99
  end
197
100
  end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '6.0.0'
6
+ VERSION = '7.0.0'
7
7
  end
8
8
  end
9
9
  end
@@ -98,19 +98,11 @@ module Dor
98
98
  Workflow::Response::Update.new(json: response)
99
99
  end
100
100
 
101
- #
102
- # Retrieves the raw XML for all the workflows for the the given object
103
- # @param [String] druid The id of the object
104
- # @return [String] XML of the workflow
105
- def all_workflows_xml(druid)
106
- requestor.request "objects/#{druid}/workflows"
107
- end
108
-
109
101
  # Retrieves all workflows for the given object
110
102
  # @param [String] pid The id of the object
111
103
  # @return [Workflow::Response::Workflows]
112
104
  def all_workflows(pid:)
113
- xml = all_workflows_xml(pid)
105
+ xml = requestor.request "objects/#{pid}/workflows"
114
106
  Workflow::Response::Workflows.new(xml: xml)
115
107
  end
116
108
 
@@ -21,15 +21,6 @@ module Dor
21
21
  JSON.parse(body)
22
22
  end
23
23
 
24
- # Retrieves a list of workflow template name
25
- #
26
- # @return [Array<String>] the list of templates
27
- #
28
- def all
29
- body = requestor.request 'workflow_templates'
30
- JSON.parse(body)
31
- end
32
-
33
24
  private
34
25
 
35
26
  attr_reader :requestor
@@ -40,15 +40,13 @@ module Dor
40
40
  @requestor = Requestor.new(connection: connection || ConnectionFactory.build_connection(url, timeout: timeout, logger: logger))
41
41
  end
42
42
 
43
- delegate :create_workflow_by_name, :workflow_status, :all_workflows_xml, :workflows,
43
+ delegate :create_workflow_by_name, :workflow_status, :workflows,
44
44
  :workflow, :process, :delete_workflow, :delete_all_workflows, :update_status, :update_error_status,
45
45
  to: :workflow_routes
46
46
 
47
47
  delegate :lifecycle, :active_lifecycle, :milestones, to: :lifecycle_routes
48
48
 
49
- delegate :lane_ids, :stale_queued_workflows, :count_stale_queued_workflows,
50
- :objects_for_workstep, :errored_objects_for_workstep, :count_objects_in_step,
51
- :count_errored_for_workstep, :count_queued_for_workstep,
49
+ delegate :lane_ids, :objects_for_workstep,
52
50
  to: :queues
53
51
 
54
52
  delegate :close_version, to: :version_routes
@@ -73,10 +71,6 @@ module Dor
73
71
  templates.retrieve(name)
74
72
  end
75
73
 
76
- def workflow_templates
77
- templates.all
78
- end
79
-
80
74
  def templates
81
75
  WorkflowTemplate.new(requestor: requestor)
82
76
  end
@@ -161,9 +161,7 @@ RSpec.describe Dor::Workflow::Client::WorkflowRoutes do
161
161
  XML
162
162
  end
163
163
 
164
- before do
165
- allow(routes).to receive(:all_workflows_xml) { xml }
166
- end
164
+ let(:mock_requestor) { instance_double(Dor::Workflow::Client::Requestor, request: xml) }
167
165
 
168
166
  it 'returns the workflows' do
169
167
  expect(routes.all_workflows(pid: 'druid:mw971zk1113')).to be_kind_of Dor::Workflow::Response::Workflows
@@ -18,15 +18,4 @@ RSpec.describe Dor::Workflow::Client::WorkflowTemplate do
18
18
  expect(mock_requestor).to have_received(:request).with('workflow_templates/accessionWF')
19
19
  end
20
20
  end
21
-
22
- describe '#all' do
23
- subject(:workflow_templates) { routes.all }
24
-
25
- let(:data) { '["assemblyWF","registrationWF"]' }
26
-
27
- it 'returns a list of templates' do
28
- expect(workflow_templates).to eq %w[assemblyWF registrationWF]
29
- expect(mock_requestor).to have_received(:request).with('workflow_templates')
30
- end
31
- end
32
21
  end
@@ -123,21 +123,6 @@ RSpec.describe Dor::Workflow::Client do
123
123
  end
124
124
  end
125
125
 
126
- describe '#workflow_templates' do
127
- subject(:workflow_templates) { client.workflow_templates }
128
-
129
- let(:workflow_template_client) { instance_double Dor::Workflow::Client::WorkflowTemplate, all: 'data' }
130
-
131
- before do
132
- allow(Dor::Workflow::Client::WorkflowTemplate).to receive(:new).and_return(workflow_template_client)
133
- end
134
-
135
- it 'delegates to the client' do
136
- expect(workflow_templates).to eq 'data'
137
- expect(workflow_template_client).to have_received(:all)
138
- end
139
- end
140
-
141
126
  describe '#templates' do
142
127
  subject(:templates) { client.templates }
143
128
 
@@ -225,31 +210,6 @@ RSpec.describe Dor::Workflow::Client do
225
210
  end
226
211
  end
227
212
 
228
- describe '#all_workflows_xml' do
229
- subject(:all_workflows_xml) { client.all_workflows_xml('druid:123') }
230
-
231
- let(:workflow) { 'etdSubmitWF' }
232
- let(:xml) do
233
- <<~XML
234
- <workflows>
235
- <workflow id="etdSubmitWF"><process name="registrar-approval" status="completed" /></workflow>
236
- <workflow id="etdSubmitWF"><process name="registrar-approval" status="completed" /></workflow>
237
- </workflows>
238
- XML
239
- end
240
- let(:stubs) do
241
- Faraday::Adapter::Test::Stubs.new do |stub|
242
- stub.get('objects/druid:123/workflows') do |_env|
243
- [200, {}, xml]
244
- end
245
- end
246
- end
247
-
248
- it 'returns the xml for a given druid' do
249
- expect(all_workflows_xml).to eq(xml)
250
- end
251
- end
252
-
253
213
  describe '#workflows' do
254
214
  let(:xml) { '<workflow id="accessionWF"><process name="publish" status="completed" /></workflow>' }
255
215
  let(:stubs) do
@@ -428,84 +388,6 @@ RSpec.describe Dor::Workflow::Client do
428
388
  end
429
389
  end
430
390
 
431
- context 'when errored workflow steps' do
432
- before do
433
- @workflow = 'accessionWF'
434
- @step = 'publish'
435
- end
436
-
437
- let(:stubs) do
438
- Faraday::Adapter::Test::Stubs.new do |stub|
439
- stub.get("/workflow_queue?error=#{@step}&workflow=#{@workflow}") do |_env|
440
- [200, {}, <<-EOXML]
441
- <objects count="1">
442
- <object id="druid:ab123cd4567" errorMessage="This is an error message"/>
443
- </objects>
444
- EOXML
445
- end
446
- end
447
- end
448
-
449
- describe 'errored_objects_for_workstep' do
450
- it 'returns error messages for errored objects' do
451
- expect(client.errored_objects_for_workstep(@workflow, @step)).to eq('druid:ab123cd4567' => 'This is an error message')
452
- end
453
- end
454
-
455
- describe 'count_errored_for_workstep' do
456
- it 'counts how many steps are errored out' do
457
- expect(client.count_errored_for_workstep(@workflow, @step)).to eq(1)
458
- end
459
- end
460
- end
461
-
462
- describe '#count_queued_for_workstep' do
463
- before do
464
- @workflow = 'accessionWF'
465
- @step = 'publish'
466
- end
467
-
468
- let(:stubs) do
469
- Faraday::Adapter::Test::Stubs.new do |stub|
470
- stub.get("/workflow_queue?queued=#{@step}&workflow=#{@workflow}") do |_env|
471
- [200, {}, <<-EOXML]
472
- <objects count="1">
473
- <object id="druid:ab123cd4567"/>
474
- </objects>
475
- EOXML
476
- end
477
- end
478
- end
479
-
480
- it 'counts how many steps are errored out' do
481
- expect(client.count_queued_for_workstep(@workflow, @step)).to eq(1)
482
- end
483
- end
484
-
485
- describe '#count_objects_in_step' do
486
- before do
487
- @workflow = 'sdrIngestWF'
488
- @step = 'start-ingest'
489
- @type = 'waiting'
490
- end
491
-
492
- let(:stubs) do
493
- Faraday::Adapter::Test::Stubs.new do |stub|
494
- stub.get("/workflow_queue?workflow=#{@workflow}&#{@type}=#{@step}") do |_env|
495
- [200, {}, <<-EOXML]
496
- <objects count="1">
497
- <object id="druid:oo000ra0001" url="null/fedora/objects/druid:oo000ra0001"/>
498
- </objects>
499
- EOXML
500
- end
501
- end
502
- end
503
-
504
- it 'counts how many objects are at the type of step' do
505
- expect(client.count_objects_in_step(@workflow, @step, @type)).to eq(1)
506
- end
507
- end
508
-
509
391
  describe '#delete_workflow' do
510
392
  let(:stubs) do
511
393
  Faraday::Adapter::Test::Stubs.new do |stub|
@@ -524,44 +406,6 @@ RSpec.describe Dor::Workflow::Client do
524
406
  end
525
407
  end
526
408
 
527
- describe '.stale_queued_workflows' do
528
- let(:stubs) do
529
- Faraday::Adapter::Test::Stubs.new do |stub|
530
- stub.get('workflow_queue/all_queued?hours-ago=24&limit=100') do |_env|
531
- [200, {}, <<-XML]
532
- <workflows>
533
- <workflow laneId="lane1" note="annotation" lifecycle="in-process" errorText="stacktrace" errorMessage="NullPointerException" elapsed="1.173" repository="dor" attempts="0" datetime="2008-11-15T13:30:00-0800" status="waiting" process="content-metadata" name="accessionWF" druid="dr:123"/>
534
- <workflow laneId="lane2" note="annotation" lifecycle="in-process" errorText="stacktrace" errorMessage="NullPointerException" elapsed="1.173" repository="dor" attempts="0" datetime="2008-11-15T13:30:00-0800" status="waiting" process="jp2-create" name="assemblyWF" druid="dr:456"/>
535
- </workflows>
536
- XML
537
- end
538
- end
539
- end
540
-
541
- it 'returns an Array of Hashes containing each workflow step' do
542
- ah = client.stale_queued_workflows hours_ago: 24, limit: 100
543
- expected = [
544
- { workflow: 'accessionWF', step: 'content-metadata', druid: 'dr:123', lane_id: 'lane1' },
545
- { workflow: 'assemblyWF', step: 'jp2-create', druid: 'dr:456', lane_id: 'lane2' }
546
- ]
547
- expect(ah).to eql(expected)
548
- end
549
- end
550
-
551
- describe '.count_stale_queued_workflows' do
552
- let(:stubs) do
553
- Faraday::Adapter::Test::Stubs.new do |stub|
554
- stub.get('workflow_queue/all_queued?hours-ago=48&count-only=true') do |_env|
555
- [200, {}, '<objects count="10"/>']
556
- end
557
- end
558
- end
559
-
560
- it 'returns the number of queued workflow steps' do
561
- expect(client.count_stale_queued_workflows(hours_ago: 48)).to eq(10)
562
- end
563
- end
564
-
565
409
  describe '.lane_ids' do
566
410
  let(:stubs) do
567
411
  Faraday::Adapter::Test::Stubs.new do |stub|
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-workflow-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Mene
8
8
  - Darren Hardy
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-06-20 00:00:00.000000000 Z
12
+ date: 2024-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -101,118 +101,6 @@ dependencies:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '2.1'
104
- - !ruby/object:Gem::Dependency
105
- name: rake
106
- requirement: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- type: :development
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- - !ruby/object:Gem::Dependency
119
- name: rspec
120
- requirement: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '3.3'
125
- type: :development
126
- prerelease: false
127
- version_requirements: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.3'
132
- - !ruby/object:Gem::Dependency
133
- name: rubocop
134
- requirement: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '1.24'
139
- type: :development
140
- prerelease: false
141
- version_requirements: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '1.24'
146
- - !ruby/object:Gem::Dependency
147
- name: rubocop-rake
148
- requirement: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- type: :development
154
- prerelease: false
155
- version_requirements: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- - !ruby/object:Gem::Dependency
161
- name: rubocop-rspec
162
- requirement: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '2.1'
167
- type: :development
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '2.1'
174
- - !ruby/object:Gem::Dependency
175
- name: simplecov
176
- requirement: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
- type: :development
182
- prerelease: false
183
- version_requirements: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- - !ruby/object:Gem::Dependency
189
- name: webmock
190
- requirement: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
- type: :development
196
- prerelease: false
197
- version_requirements: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- - !ruby/object:Gem::Dependency
203
- name: yard
204
- requirement: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- type: :development
210
- prerelease: false
211
- version_requirements: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
104
  description: Enables Ruby manipulation of the DOR Workflow Service via its REST API
217
105
  email:
218
106
  - wmene@stanford.edu
@@ -265,7 +153,7 @@ homepage: https://consul.stanford.edu/display/DOR/DOR+services#DORservices-initi
265
153
  licenses: []
266
154
  metadata:
267
155
  rubygems_mfa_required: 'true'
268
- post_install_message:
156
+ post_install_message:
269
157
  rdoc_options: []
270
158
  require_paths:
271
159
  - lib
@@ -280,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
168
  - !ruby/object:Gem::Version
281
169
  version: '0'
282
170
  requirements: []
283
- rubygems_version: 3.4.10
284
- signing_key:
171
+ rubygems_version: 3.3.7
172
+ signing_key:
285
173
  specification_version: 4
286
174
  summary: Provides convenience methods to work with the DOR Workflow Service
287
175
  test_files: []