dor-workflow-service 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e750b0f9cadcbba9d9053a239eabe3d8b4953e3
4
- data.tar.gz: 385b1d542be6495573b853dd0f86cc820e6149aa
3
+ metadata.gz: 247315ca28af42d73ab1947353b8ae71f459d75b
4
+ data.tar.gz: 0204c4ba989f633559264556415dfbc85db0a16e
5
5
  SHA512:
6
- metadata.gz: fb5a825e36a8ae7e44f51c93b457316677feffb1c8f8633d89f74d1b5c74c817917adcc05a1ecf2cba124dc81b63b6ea5ed04d4eafc79eb9c899842ab3644346
7
- data.tar.gz: 7b1da0dd6e498352de44efb337a0bbd0e0d9095315b48def7a306611971bc70310622d7d08695cca834279f190a61598a5c73bae597d5280b3f7abd41351bbae
6
+ metadata.gz: '09781481dd5d29f0fe06a16e015587a0b8296cc3ab27b36e67f4ce5f0451eb27f477dea6a3af5621ca5bf3449e62fca5017354a4e8268c4eb9693bd41a6f68e3'
7
+ data.tar.gz: 5d08832b83c3e2996996e691664f89bbbce47e521ec36e7b4dbb2482345a3cc83395d9592d77116f9ec3b57bef85ac7ce2e2675d2a75bd4865ad18ea0d009d72
@@ -132,7 +132,7 @@ module Dor
132
132
  # @param [String] pid id of object
133
133
  # @return [Array<String>] list of active worklows. Returns an empty Array if none are found
134
134
  # @example
135
- # Dor::WorkflowService.get_workflows('dor', 'druid:sr100hp0609')
135
+ # Dor::WorkflowService.get_active_workflows('dor', 'druid:sr100hp0609')
136
136
  # => ["accessionWF", "assemblyWF", "disseminationWF"]
137
137
  def get_active_workflows(repo, pid)
138
138
  doc = Nokogiri::XML(get_workflow_xml(repo, pid, ''))
@@ -483,8 +483,8 @@ module Dor
483
483
  when String
484
484
  Faraday.new(url: url_or_connection) do |faraday|
485
485
  faraday.response :logger if opts[:debug] # logs to STDOUT
486
- faraday.adapter :net_http_persistent # use Keep-Alive connections
487
486
  faraday.use Faraday::Response::RaiseError
487
+ faraday.adapter :net_http_persistent # use Keep-Alive connections
488
488
  faraday.options.params_encoder = Faraday::FlatParamsEncoder
489
489
  if opts.key? :timeout
490
490
  faraday.options.timeout = opts[:timeout]
@@ -496,6 +496,10 @@ module Dor
496
496
  end
497
497
  end
498
498
 
499
+ def count_objects_in_step(workflow, step, type, repo)
500
+ resp = workflow_resource_method "workflow_queue?repository=#{repo}&workflow=#{workflow}&#{type}=#{step}"
501
+ extract_object_count(resp)
502
+ end
499
503
 
500
504
  protected
501
505
 
@@ -529,11 +533,6 @@ module Dor
529
533
  doc.to_xml
530
534
  end
531
535
 
532
- def count_objects_in_step(workflow, step, type, repo)
533
- resp = workflow_resource_method "workflow_queue?repository=#{repo}&workflow=#{workflow}&#{type}=#{step}"
534
- extract_object_count(resp)
535
- end
536
-
537
536
  def extract_object_count(resp)
538
537
  node = Nokogiri::XML(resp).at_xpath('/objects')
539
538
  raise Dor::WorkflowException.new('Unable to determine count from response') if node.nil?
@@ -1,7 +1,7 @@
1
1
  module Dor
2
2
  module Workflow
3
3
  module Service
4
- VERSION = '2.2.1'
4
+ VERSION = '2.3.0'
5
5
  end
6
6
  end
7
7
  end
@@ -409,7 +409,7 @@ describe Dor::WorkflowService do
409
409
  end
410
410
  end
411
411
  end
412
-
412
+
413
413
  it 'returns error messages for errored objects' do
414
414
  expect(Dor::WorkflowService.get_errored_objects_for_workstep(@workflow, @step, @repository)).to eq({'druid:ab123cd4567'=>'This is an error message'})
415
415
  end
@@ -464,6 +464,31 @@ describe Dor::WorkflowService do
464
464
  end
465
465
  end
466
466
 
467
+ describe '#count_objects_in_step' do
468
+ before(:all) do
469
+ @workflow = 'sdrIngestWF'
470
+ @step = 'start-ingest'
471
+ @type = 'waiting'
472
+ @repository = 'sdr'
473
+ end
474
+
475
+ let(:stubs) do
476
+ Faraday::Adapter::Test::Stubs.new do |stub|
477
+ stub.get("/workflow_queue?repository=#{@repository}&workflow=#{@workflow}&#{@type}=#{@step}") do |env|
478
+ [200, {}, <<-EOXML ]
479
+ <objects count="1">
480
+ <object id="druid:oo000ra0001" url="null/fedora/objects/druid:oo000ra0001"/>
481
+ </objects>
482
+ EOXML
483
+ end
484
+ end
485
+ end
486
+
487
+ it 'counts how many objects are at the type of step' do
488
+ expect(Dor::WorkflowService.count_objects_in_step(@workflow, @step, @type, @repository)).to eq(1)
489
+ end
490
+ end
491
+
467
492
  describe '#delete_workflow' do
468
493
  let(:url) { "#{@repo}/objects/#{@druid}/workflows/accessionWF" }
469
494
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-workflow-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Mene
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-13 00:00:00.000000000 Z
12
+ date: 2018-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  version: '0'
256
256
  requirements: []
257
257
  rubyforge_project:
258
- rubygems_version: 2.5.2
258
+ rubygems_version: 2.6.13
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: Provides convenience methods to work with the DOR Workflow Service