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 #320 from sul-dlss/without_workflows
Browse files Browse the repository at this point in the history
Remove the workflow fixtures.
  • Loading branch information
justinlittman committed May 21, 2019
2 parents 35f3c14 + 3ed0b9b commit 61644b8
Show file tree
Hide file tree
Showing 20 changed files with 10 additions and 169 deletions.
3 changes: 0 additions & 3 deletions config/initializers/dor_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/settings/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/settings/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions lib/hydrus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
50 changes: 1 addition & 49 deletions lib/tasks/fixtures.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
11 changes: 5 additions & 6 deletions spec/features/item_versioning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0000.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0001.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0002.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0003.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0004.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0005.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0006.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0007.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0008.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0009.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0010.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0011.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0012.xml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/fixtures/workflow_xml/druid_oo000oo0013.xml

This file was deleted.

0 comments on commit 61644b8

Please sign in to comment.