diff --git a/config/initializers/dor_config.rb b/config/initializers/dor_config.rb index 0b5779526..1a986577c 100644 --- a/config/initializers/dor_config.rb +++ b/config/initializers/dor_config.rb @@ -52,9 +52,6 @@ exception_recipients Settings.hydrus.exception_recipients # list of email addresses, comma separated, that will be notified when an exception occurs - leave blank for no emails host Settings.hydrus.host # server host, used in emails start_assembly_wf Settings.hydrus.start_assembly_wf # determines if assembly workflow is started when publishing - - # complete list of all workflow objects defined in this environment - workflow_object_druids Settings.hydrus.workflow_object_druids end purl do diff --git a/config/settings/development.yml b/config/settings/development.yml index b11f17374..f1d650cdb 100644 --- a/config/settings/development.yml +++ b/config/settings/development.yml @@ -3,9 +3,6 @@ hydrus: exception_error_page: false host: localhost:3000 start_assembly_wf: false - workflow_object_druids: - - 'druid:oo000oo0099' # hydrusAssemblyWF - - 'druid:oo000oo0098' # versioningWF fedora: url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora diff --git a/config/settings/test.yml b/config/settings/test.yml index 7981d5ccd..c6a80dca2 100644 --- a/config/settings/test.yml +++ b/config/settings/test.yml @@ -3,9 +3,6 @@ hydrus: exception_error_page: false host: localhost:3000 start_assembly_wf: false - workflow_object_druids: - - 'druid:oo000oo0099' # hydrusAssemblyWF - - 'druid:oo000oo0098' # versioningWF fedora: url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora diff --git a/lib/hydrus.rb b/lib/hydrus.rb index 07a689dd2..84f9bf0e1 100644 --- a/lib/hydrus.rb +++ b/lib/hydrus.rb @@ -42,15 +42,12 @@ def self.all_fixture_foxml Hash[pids.zip(xmls)] end - # Takes a PID for a Hydrus fixtures, and an optional hash with the :is_wf - # key. Reads the corresponding file from the fixture directory and returns + # @param [String] pid a PID for a Hydrus fixture + # Reads the corresponding file from the fixture directory and returns # the content. Used when restoring fixture objects in a Hydrus rake task # and during testing. - def self.fixture_foxml(pid, opts = {}) - p = pid.sub(/:/, '_') - w = opts[:is_wf] ? 'workflow_xml/' : '' - e = opts[:is_wf] ? '' : '.foxml' - f = File.join('spec/fixtures', w, p + e + '.xml') + def self.fixture_foxml(pid) + f = File.join('spec/fixtures', "#{pid.sub(/:/, '_')}.foxml.xml") IO.read(f) end diff --git a/lib/tasks/fixtures.rake b/lib/tasks/fixtures.rake index a5e16a145..0dbed73eb 100644 --- a/lib/tasks/fixtures.rake +++ b/lib/tasks/fixtures.rake @@ -25,9 +25,6 @@ namespace :hydrus do fixture_loader.reload(pid) } - # index the workflow objects - Rake::Task['hydrus:reindex_workflow_objects'].invoke - unless ['test', 'development'].include?(Rails.env) puts "****NOTE: For security reasons, you might want to change passwords for default users after this task using \"RAILS_ENV=#{ENV['RAILS_ENV']}rake hydrus:update_passwords['newpassword']\"*****" end @@ -48,18 +45,6 @@ namespace :hydrus do end end - # call with rake hydrus:reindex_workflow_objects - desc 'reindex all workflow objects for the given environment' - task reindex_workflow_objects: :environment do - require File.expand_path('config/environment') - pids = Dor::Config.hydrus.workflow_object_druids - pids.each do |pid| - ENV['pid'] = pid - Rake::Task['hydrus:reindex'].reenable - Rake::Task['hydrus:reindex'].invoke - end - end - # call with rake hydrus:delete_objects pid=druid:oo000oo0003 desc 'delete a given hydrus collection object and all associated items and APOs' task delete_objects: :environment do @@ -104,9 +89,7 @@ namespace :hydrus do task :refreshfix do ts = [ 'hydrus:loadfix', - 'hydrus:refresh_workflows', - 'hydrus:refresh_upload_files', - 'hydrus:reindex_workflow_objects', + 'hydrus:refresh_upload_files' ] ts.each do |t| Rake::Task[t].reenable @@ -149,37 +132,6 @@ namespace :hydrus do end end - # This task restores the workflows datastream to initial conditions for - # our fixture objects. - # - hydrusAssemblyWF: content is replaces (see spec/fixtures/workflow_xml). - # - versioningWF: content is removed - # An after() block in spec/integration/item_edit_spec.rb duplications - # some of this behavior. - desc 'refresh workflow datastreams' - task :refresh_workflows do - require File.expand_path('config/environment') - repo = 'dor' - hwf = 'hydrusAssemblyWF' - vwf = 'versioningWF' - # Read files in workflow fixtures directory. - Dir.glob('spec/fixtures/workflow_xml/druid_*.xml').each do |f| - # Read XML from file and get druid from file name. - xml = File.read(f) - druid = File.basename(f, '.xml').gsub(/_/, ':') - # Push content up to the WF service. - resp = [druid, hwf] - begin - resp << Dor::WorkflowService.delete_workflow(repo, druid, hwf) - rescue Faraday::ResourceNotFound - logger.info "Delete workflow for #{druid} returned 404" - end - resp << Dor::WorkflowService.create_workflow(repo, druid, hwf, xml) - resp << vwf - resp << Dor::WorkflowService.delete_workflow(repo, druid, vwf) - puts resp.inspect - end - end - desc 'delete all existing objects in solr without nuking objects in fedora' task solr_nuke: :environment do require File.expand_path('config/environment') diff --git a/spec/features/item_versioning_spec.rb b/spec/features/item_versioning_spec.rb index 76f9532d2..3e99de108 100644 --- a/spec/features/item_versioning_spec.rb +++ b/spec/features/item_versioning_spec.rb @@ -25,12 +25,11 @@ # # The rake task :refresh_workflows duplicates some of this behavior. after do - p = @hi.pid - wf = Dor::Config.hydrus.app_workflow - wf_xml = Hydrus.fixture_foxml(p, is_wf: true) - Dor::Config.workflow.client.delete_workflow('dor', p, 'versioningWF') - Dor::Config.workflow.client.delete_workflow('dor', p, wf) - Dor::Config.workflow.client.create_workflow('dor', p, wf, wf_xml) + workflow_name = Dor::Config.hydrus.app_workflow + workflow_client = Dor::Workflow::Client.new(url: Settings.workflow.url) + workflow_client.delete_workflow('dor', @hi.pid, 'versioningWF') + workflow_client.delete_workflow('dor', @hi.pid, workflow_name) + workflow_client.create_workflow_by_name(@hi.pid, workflow_name) end it 'initial unpublished version of an item offers discard button' do diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0000.xml b/spec/fixtures/workflow_xml/druid_oo000oo0000.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0000.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0001.xml b/spec/fixtures/workflow_xml/druid_oo000oo0001.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0001.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0002.xml b/spec/fixtures/workflow_xml/druid_oo000oo0002.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0002.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0003.xml b/spec/fixtures/workflow_xml/druid_oo000oo0003.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0003.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0004.xml b/spec/fixtures/workflow_xml/druid_oo000oo0004.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0004.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0005.xml b/spec/fixtures/workflow_xml/druid_oo000oo0005.xml deleted file mode 100644 index 84f6671eb..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0005.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0006.xml b/spec/fixtures/workflow_xml/druid_oo000oo0006.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0006.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0007.xml b/spec/fixtures/workflow_xml/druid_oo000oo0007.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0007.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0008.xml b/spec/fixtures/workflow_xml/druid_oo000oo0008.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0008.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0009.xml b/spec/fixtures/workflow_xml/druid_oo000oo0009.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0009.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0010.xml b/spec/fixtures/workflow_xml/druid_oo000oo0010.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0010.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0011.xml b/spec/fixtures/workflow_xml/druid_oo000oo0011.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0011.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0012.xml b/spec/fixtures/workflow_xml/druid_oo000oo0012.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0012.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spec/fixtures/workflow_xml/druid_oo000oo0013.xml b/spec/fixtures/workflow_xml/druid_oo000oo0013.xml deleted file mode 100644 index 4f0e0dc54..000000000 --- a/spec/fixtures/workflow_xml/druid_oo000oo0013.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -