Commit d1d5c0544c873b8ed33d919b32fb970bf0eae747

Authored by Evandro Jr
2 parents 220a47c8 f8020b09

Merge branch 'virtuoso_integration' of gitlab.com:participa/noosfero into virtuoso_integration

plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
... ... @@ -35,14 +35,18 @@ class VirtuosoPlugin::DspaceHarvest
35 35 def run
36 36 harvest_time = Time.now.utc
37 37 params = settings.last_harvest ? {:from => settings.last_harvest.utc} : {}
38   - puts "starting harvest #{params}"
  38 + puts "starting harvest #{params} #{settings.dspace_uri} #{settings.virtuoso_uri}"
39 39 begin
40 40 records = dspace_client.list_records(params)
41 41 records.each do |record|
42 42 triplify(record)
43 43 end
44   - rescue Exception => ex
  44 + rescue OAI::Exception => ex
45 45 puts ex.to_s
  46 + if ex.code != 'noRecordsMatch'
  47 + puts "unexpected error"
  48 + raise ex
  49 + end
46 50 end
47 51 settings.last_harvest = harvest_time
48 52 settings.save!
... ...
plugins/virtuoso/test/functional/virtuoso_plugin_admin_controller_test.rb
... ... @@ -35,4 +35,11 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase
35 35 assert harvest.find_job.present?
36 36 end
37 37  
  38 + should 'force harvest from start' do
  39 + get :force_harvest, :from_start => true
  40 + harvest = VirtuosoPlugin::DspaceHarvest.new(environment)
  41 + assert harvest.find_job.present?
  42 + assert_equal nil, harvest.settings.last_harvest
  43 + end
  44 +
38 45 end
... ...