- Clone the
issue-pdf-composition
branch ofnewspaper_works
- Make sure your current working directory is the root of the
newspaper_works
GEM. - Set up the gem and test app:
bundle install
bundle exec rake engine_cart:generate
From the root of your newspaper_works
GEM, run:
fcrepo_wrapper --config config/fcrepo_wrapper_test.yml clean
solr_wrapper --config config/solr_wrapper_test.yml clean
fcrepo_wrapper --config config/fcrepo_wrapper_test.yml
solr_wrapper --config config/solr_wrapper_test.yml
cd .internal_test_app
Add the following to your .internal_test_app/Gemfile
:
gem 'sidekiq'
Then run bundle install
to ensure that sidekiq is installed for your app.
...by editing config/application.rb
. Then run sidekiq:
bundle exec sidekiq --environment test
Step 3: Open rails console test
in .internal_test_app, ingest an NDNP issue from newspaper_works_fixtures
as follows:
require 'newspaper_works_fixtures'
ndnp_path = File.join(NewspaperWorksFixtures.file_fixtures, 'ndnp')
Hyrax.config.whitelisted_ingest_dirs.push(ndnp_path)
issue_path = File.join(ndnp_path, 'batch_local/sn85058233/17082901001/1935080201/1935080201.xml')
issue_data = NewspaperWorks::Ingest::NDNP::IssueIngest.new(issue_path)
# We need data with no pre-made PDF derivative, because we want job to create
# this for us so we can test retry because we are waiting on page PDF to be
# made. To do this, modify the NDNP batch data inline to remove
# the pre-made PDF from the data.
issue_data.each do |page|
# modify page.files, so that PageIngester, via IssueIngester won't see them:
page.files.reject! { |path| path.end_with?('pdf') }
end
ingester = NewspaperWorks::Ingest::NDNP::IssueIngester.new(issue_data)
ingester.ingest
Watch sidekiq console, looking for indication that the following job is started:
ComposeIssuePDFJob
_It is likely that the ComposeIssuePDFJob
will fail on first attempt, and retry. You should also see CharacterizeJob
and CreateDerivativesJob
fire from Hyrax, for each page. Until those two jobs are done for each of the two pages of the issue being ingested, ComposeIssuePDFJob
will fail (slated for retry) due to exception.`
Verify that ComposeIssuePDFJob
started more than once in sidekiq log.
issue = ingester.target
issue.reload!
NewspaperWorks::Data::WorkDerivatives.of(issue).exist?('pdf') # => true