Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #323 from sul-dlss/workflow_create_version
Browse files Browse the repository at this point in the history
Switched to passing version when creating workflows.
  • Loading branch information
jcoyne committed May 21, 2019
2 parents 00770d3 + 82c3a01 commit f9f791f
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem 'dor-services', '~> 6.1', require: false
gem 'dor-services-client', '~> 1.1'
gem 'rubydora', '~> 2.1'
gem 'bagit', '~> 0.4'
gem 'dor-workflow-client', '~> 3.1'
gem 'dor-workflow-client', '~> 3.2'
gem 'net-http-persistent', '~> 2.9' # https://github.com/sul-dlss/dor-workflow-service/issues/44
gem 'blacklight', '~> 6.19'
gem 'cancancan', '~> 1.17'
Expand Down
6 changes: 2 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,11 @@ GEM
faraday (~> 0.15)
moab-versioning (~> 4.0)
nokogiri (~> 1.8)
dor-workflow-client (3.1.0)
dor-workflow-client (3.2.0)
activesupport (>= 3.2.1, < 6)
confstruct (>= 0.2.7, < 2)
deprecation (~> 0)
faraday (~> 0.9, >= 0.9.2)
faraday_middleware
net-http-persistent (>= 2.9.4, < 4.a)
nokogiri (~> 1.6)
dor-workflow-service (2.12.0)
activesupport (>= 3.2.1, < 6)
Expand Down Expand Up @@ -581,7 +579,7 @@ DEPENDENCIES
dlss-capistrano
dor-services (~> 6.1)
dor-services-client (~> 1.1)
dor-workflow-client (~> 3.1)
dor-workflow-client (~> 3.2)
dynamic_form
equivalent-xml
factory_bot_rails
Expand Down
2 changes: 1 addition & 1 deletion app/models/hydrus/admin_policy_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def self.create(user)
args = [user, 'adminPolicy', dconf.ur_apo_druid]
response = Hydrus::GenericObject.register_dor_object(*args)
apo = Hydrus::AdminPolicyObject.find(response[:pid])
workflow_client.create_workflow_by_name(response[:pid], Dor::Config.hydrus.app_workflow)
workflow_client.create_workflow_by_name(response[:pid], Dor::Config.hydrus.app_workflow, version: apo.current_version)

apo.remove_relationship :has_model, 'info:fedora/afmodel:Dor_AdminPolicyObject'
apo.assert_content_model
Expand Down
4 changes: 3 additions & 1 deletion app/models/hydrus/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ def self.create(user)
# Create the object, with the correct model.
apo = Hydrus::AdminPolicyObject.create(user)
response = Hydrus::GenericObject.register_dor_object(user, 'collection', apo.pid)
workflow_client.create_workflow_by_name(response[:pid], Dor::Config.hydrus.app_workflow)

coll = Hydrus::Collection.find(response[:pid])
# Create workflow
workflow_client.create_workflow_by_name(coll.pid, Dor::Config.hydrus.app_workflow, version: coll.current_version)

coll.remove_relationship :has_model, 'info:fedora/afmodel:Dor_Collection'
coll.assert_content_model
# Set the item_type, and add some Hydrus-specific info to identityMetadata.
Expand Down
4 changes: 2 additions & 2 deletions app/models/hydrus/processable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def start_common_assembly
# automated tests.
def start_assembly_wf
return unless should_start_assembly_wf
workflow_client.create_workflow_by_name(pid, 'assemblyWF')
workflow_client.create_workflow_by_name(pid, 'assemblyWF', version: current_version)
end

# Kicks off hydrusAssemblyWF
def start_hydrus_wf
workflow_client.create_workflow_by_name(pid, Dor::Config.hydrus.app_workflow)
workflow_client.create_workflow_by_name(pid, Dor::Config.hydrus.app_workflow, version: current_version)
end

# Returns value of Dor::Config.hydrus.start_assembly_wf.
Expand Down
2 changes: 1 addition & 1 deletion app/services/item_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def validate!
# @return [Hydrus::Item]
def build_item(item_type)
registration_response = Hydrus::GenericObject.register_dor_object(user, 'item', collection.apo_pid)
workflow_client.create_workflow_by_name(registration_response[:pid], Dor::Config.hydrus.app_workflow)

Hydrus::Item.find(registration_response[:pid]).tap do |item|
workflow_client.create_workflow_by_name(item.pid, Dor::Config.hydrus.app_workflow, version: item.current_version)
item.remove_relationship :has_model, 'info:fedora/afmodel:Dor_Item'
item.assert_content_model
# Set the item_type, and add some Hydrus-specific info to identityMetadata.
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ services:
ports:
- 3003:3000
environment:
SOLR_URL: http://solr:8983/solr/hydrus-test
SETTINGS__SOLRIZER_URL: http://solr:8983/solr/hydrus-test
# SOLR_URL: http://solr:8983/solr/hydrus-test
SETTINGS__solr__url: http://solr:8983/solr/hydrus-test
SETTINGS__FEDORA_URL: http://fedoraAdmin:fedoraAdmin@fcrepo:8080/fedora
SETTINGS__SURI__URL: http://suri:3000
SETTINGS__WORKFLOW_URL: http://workflow:3000
Expand Down
2 changes: 1 addition & 1 deletion spec/features/models/item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
'hydrusAssemblyWF', 'approve', 'completed')
expect(mock_wf_client).to have_received(:update_workflow_status).with('dor', hi.pid,
'hydrusAssemblyWF', 'start-assembly', 'completed')
expect(mock_wf_client).to have_received(:create_workflow_by_name).with(hi.pid, 'assemblyWF')
expect(mock_wf_client).to have_received(:create_workflow_by_name).with(hi.pid, 'assemblyWF', version: '1')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/hydrus/processable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
end

it 'can exercise start_hydrus_wf() stubbed' do
expect(mock_wf_client).to receive(:create_workflow_by_name).with(@go.pid, 'hydrusAssemblyWF')
expect(mock_wf_client).to receive(:create_workflow_by_name).with(@go.pid, 'hydrusAssemblyWF', version: '1')
@go.start_hydrus_wf()
end

Expand Down
3 changes: 2 additions & 1 deletion spec/services/item_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
expect(item.requires_terms_acceptance(user, collection)).to eq(true)
expect(item.accepted_terms_of_deposit).to eq('false')
expect(item.terms_of_deposit_accepted?).to eq(false)
expect(workflow_client).to have_received(:create_workflow_by_name).with(String, 'hydrusAssemblyWF')
expect(workflow_client).to have_received(:create_workflow_by_name).with(String, 'hydrusAssemblyWF',
version: '1')
end
end

Expand Down

0 comments on commit f9f791f

Please sign in to comment.