diff --git a/Gemfile b/Gemfile index 742337243..04074fb91 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'assembly-utils' gem 'dir_validator' # gem 'dor-fetcher' # not supported anymore; only used by devel/get_dor_and_sdr_versions.rb script, which is not regularly used gem 'dor-services', '< 6' -gem 'dor-services-client', '~> 0.6' +gem 'dor-services-client' gem 'druid-tools' gem 'harvestdor' gem 'modsulator' diff --git a/Gemfile.lock b/Gemfile.lock index 0ab5b4ba6..d5c601ddf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -140,10 +140,11 @@ GEM stanford-mods-normalizer (~> 0.1) systemu (~> 2.6) uuidtools (~> 2.1.4) - dor-services-client (0.10.0) + dor-services-client (1.7.0) activesupport (>= 4.2, < 6) deprecation faraday (~> 0.15) + moab-versioning (~> 4.0) nokogiri (~> 1.8) dor-workflow-service (2.12.0) activesupport (>= 3.2.1, < 6) @@ -378,7 +379,7 @@ DEPENDENCIES dir_validator dlss-capistrano (~> 3.1) dor-services (< 6) - dor-services-client (~> 0.6) + dor-services-client druid-tools equivalent-xml harvestdor @@ -399,4 +400,4 @@ DEPENDENCIES yard BUNDLED WITH - 1.16.6 + 1.17.2 diff --git a/lib/pre_assembly/digital_object.rb b/lib/pre_assembly/digital_object.rb index 1073937a1..678c45d9a 100644 --- a/lib/pre_assembly/digital_object.rb +++ b/lib/pre_assembly/digital_object.rb @@ -498,9 +498,9 @@ def initialize_assembly_workflow with_retries(max_tries: Dor::Config.dor.num_attempts, rescue: Exception, handler: PreAssembly.retry_handler('INITIALIZE_ASSEMBLY_WORKFLOW', method(:log))) do begin - api_client.initialize_workflow(object: @druid.druid, wf_name: workflow_name) + api_client.object(@druid.druid).workflow.create(wf_name: workflow_name) rescue StandardError => error - raise PreAssembly::UnknownError, "POST to assemblyWF endpoint at #{Dor::Config.dor_services_url} returned #{error}" + raise PreAssembly::UnknownError, "Call to #{Dor::Config.dor_services.url} returned #{error}" end end end diff --git a/spec/digital_object_spec.rb b/spec/digital_object_spec.rb index bbbe9b882..2b308089e 100644 --- a/spec/digital_object_spec.rb +++ b/spec/digital_object_spec.rb @@ -800,13 +800,13 @@ def add_object_files(extension='tif') describe '#initialize_assembly_workflow' do before do allow(@dobj).to receive(:api_client).and_return(client) - allow(Dor::Config).to receive(:dor_services_url).and_return(service_url) + allow(@dobj).to receive(:druid).and_return(@dru) @dobj.init_assembly_wf = true @dobj.druid = @druid end let(:client) { double } - let(:service_url) { 'http://example.edu/dor/services/endpoint' } + let(:service_url) { Dor::Config.dor_services.url } context 'when @init_assembly_wf is false' do before do @@ -819,26 +819,14 @@ def add_object_files(extension='tif') end end - context 'when api client is successful' do + context 'when @init_assembly_wf is true' do before do - allow(client).to receive(:initialize_workflow) + allow(client).to receive_message_chain(:object, :workflow, :create) end it 'starts the assembly workflow' do - expect { @dobj.initialize_assembly_workflow }.not_to raise_error - expect(client).to have_received(:initialize_workflow).once - end - end - - context 'when the api client raises' do - before do - allow(client).to receive(:initialize_workflow).and_raise(Dor::Services::Client::UnexpectedResponse) - end - - it 'raises an exception' do - expect { @dobj.initialize_assembly_workflow }.to raise_error( - /POST to assemblyWF endpoint at #{service_url} returned Dor::Services::Client::UnexpectedResponse/ - ) + expect(@dobj).to receive(:api_client) + @dobj.initialize_assembly_workflow end end end