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

Commit

Permalink
Use dor-workflow-client rather than dor-workflow-service
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 11, 2019
1 parent e47e60f commit 8c5fcfd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dor-services.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |s|

# Stanford dependencies
s.add_dependency 'dor-rights-auth', '~> 1.0', '>= 1.2.0'
s.add_dependency 'dor-workflow-service', '~> 2.11'
s.add_dependency 'dor-workflow-client', '3.0.0.rc1'
s.add_dependency 'druid-tools', '>= 0.4.1'
s.add_dependency 'moab-versioning', '~> 4.0'
s.add_dependency 'stanford-mods', '>= 2.3.1'
Expand Down
2 changes: 1 addition & 1 deletion lib/dor-services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,5 @@ module Workflow
eager_load!

require 'dor/utils/hydrus_shims'
require 'dor-workflow-service'
require 'dor/workflow/client'
end
3 changes: 1 addition & 2 deletions lib/dor/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def make_solr_connection(add_opts = {})
},
workflow: {
client: Confstruct.deferred do |c|
Dor::WorkflowService.configure c.url, logger: c.client_logger, timeout: c.timeout, dor_services_url: config.dor_services.url
Dor::WorkflowService
@wfs ||= Dor::Workflow::Client.new(url: c.url, logger: c.client_logger, timeout: c.timeout)
end,
client_logger: Confstruct.deferred do |c|
if c.logfile && c.shift_age
Expand Down
2 changes: 1 addition & 1 deletion lib/dor/datastreams/workflow_definition_ds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def repo
ng_xml.at_xpath('/workflow-def/@repository').to_s
end

# Creates the xml used by Dor::WorkflowService#create_workflow
# Creates the xml used by Dor::Workflow::Client#create_workflow
# @return [String] An object's initial workflow as defined by the <workflow-def> in content
def initial_workflow
doc = Nokogiri::XML('<workflow/>')
Expand Down
16 changes: 11 additions & 5 deletions spec/dor_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
described_class.new(YAML.load(File.read(File.expand_path('../config/config_defaults.yml', __dir__))))
end

it 'configures the Dor::WorkflowService when Dor::Config.configure is called' do
config.configure do
workflow.url 'http://mynewurl.edu/workflow'
end
describe '.workflow.client' do
context 'when Dor::Config.configure is called' do
subject { config.workflow.client.requestor.send(:base_url) }

expect(config.workflow.client.base_url.to_s).to eq('http://mynewurl.edu/workflow')
before do
config.configure do
workflow.url 'http://mynewurl.edu/workflow'
end
end

it { is_expected.to eq URI('http://mynewurl.edu/workflow') }
end
end

it 'adds deprecation warnings for old solrizer configurations' do
Expand Down
4 changes: 2 additions & 2 deletions spec/indexers/processable_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</versionMetadata>
'

allow(Dor::Config.workflow.client).to receive(:query_lifecycle).and_return(xml)
allow(Dor::Config.workflow.client.lifecycle_routes).to receive(:query_lifecycle).and_return(xml)
allow_any_instance_of(Dor::Workflow::Document).to receive(:to_solr).and_return(nil)
versionMD = Dor::VersionMetadataDS.from_xml(dsxml)
allow(obj).to receive(:versionMetadata).and_return(versionMD)
Expand All @@ -106,7 +106,7 @@
end

it 'skips the versioning related steps if a new version has not been opened' do
allow(Dor::Config.workflow.client).to receive(:query_lifecycle).and_return(Nokogiri::XML('<?xml version="1.0" encoding="UTF-8"?>
allow(Dor::Config.workflow.client.lifecycle_routes).to receive(:query_lifecycle).and_return(Nokogiri::XML('<?xml version="1.0" encoding="UTF-8"?>
<lifecycle objectId="druid:gv054hp4128">
<milestone date="2012-11-06T16:30:03-0800">submitted</milestone>
<milestone date="2012-11-06T16:35:00-0800">described</milestone>
Expand Down
4 changes: 3 additions & 1 deletion spec/services/status_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

before do
expect(item).to receive(:versionMetadata).and_return(versionMD)
expect(Dor::Config.workflow.client).to receive(:query_lifecycle).and_return(xml)
# TODO: this stub is too knowledgable about the inner workings of the workflow client
# instead it should just stub :milestones which returns an array of hashes
expect(Dor::Config.workflow.client.lifecycle_routes).to receive(:query_lifecycle).and_return(xml)
end

context 'for gv054hp4128' do
Expand Down

0 comments on commit 8c5fcfd

Please sign in to comment.