Commit 3ce2f4ff14adf32b5d458ffd05e8252ae14a3f10

Authored by Evandro Jr
1 parent 9de1db8c

fix problema creating job

plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
@@ -102,8 +102,8 @@ class VirtuosoPlugin::DspaceHarvest @@ -102,8 +102,8 @@ class VirtuosoPlugin::DspaceHarvest
102 102
103 class Job < Struct.new(:environment_id, :dspace_uri) 103 class Job < Struct.new(:environment_id, :dspace_uri)
104 def perform 104 def perform
105 - environment = Environment.find(environment_id, dspace_uri)  
106 - harvest = VirtuosoPlugin::DspaceHarvest.new(environment, {"dspace_uri" => dspace_uri, "last_harvest" => last_harvest}) 105 + environment = Environment.find(environment_id)
  106 + harvest = VirtuosoPlugin::DspaceHarvest.new(environment, {"dspace_uri" => dspace_uri})
107 harvest.run 107 harvest.run
108 end 108 end
109 end 109 end
plugins/virtuoso/test/integration/dspace_test.rb 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 +#require File.dirname(__FILE__) + '/../test_helper.rb'
  2 +#
  3 +#class DspaceTest < ActiveSupport::TestCase
  4 +#
  5 +# def setup
  6 +# @environment = Environment.default
  7 +# end
  8 +#
  9 +# attr_reader :environment
  10 +#
  11 +# should 'list at least one record' do
  12 +# settings =
  13 +# { :virtuoso_uri=>"http://hom.virtuoso.participa.br",
  14 +# :virtuoso_username=>"dba",
  15 +# :virtuoso_password=>"dba",
  16 +# :virtuoso_readonly_username=>"dba",
  17 +# :virtuoso_readonly_password=>"dba",
  18 +# :dspace_servers=>[
  19 +# {"dspace_uri"=>"http://hom.dspace.participa.br"}
  20 +# ]
  21 +# }
  22 +# settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, settings)
  23 +# harvest = VirtuosoPlugin::DspaceHarvest.new(environment, {"dspace_uri"=>"http://hom.dspace.participa.br"})
  24 +# params = harvest.last_harvest ? {:from => harvest.last_harvest.utc} : {}
  25 +# records = harvest.dspace_client.list_records(params)
  26 +# assert_not_equal records.count, 0
  27 +# end
  28 +#end
0 \ No newline at end of file 29 \ No newline at end of file
plugins/virtuoso/test/integration/virtuoso.rb 0 → 100644
@@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
  1 +#require File.dirname(__FILE__) + '/../test_helper.rb'
  2 +#
  3 +#class DspaceTest < ActiveSupport::TestCase
  4 +#
  5 +# def setup
  6 +# @environment = Environment.default
  7 +# end
  8 +#
  9 +# attr_reader :environment
  10 +#
  11 +#
  12 +# should 'update last_harvest after harvert' do
  13 +# time = Time.now.utc
  14 +# settings =
  15 +# { :virtuoso_uri=>"http://hom.virtuoso.participa.br",
  16 +# :virtuoso_username=>"dba",
  17 +# :virtuoso_password=>"dba",
  18 +# :virtuoso_readonly_username=>"dba",
  19 +# :virtuoso_readonly_password=>"dba",
  20 +# :dspace_servers=>[
  21 +# {"dspace_uri"=>"http://hom.dspace.participa.br"}
  22 +# ]
  23 +# }
  24 +# @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, settings)
  25 +# harvest = VirtuosoPlugin::DspaceHarvest.new(environment, {"dspace_uri"=>"http://hom.dspace.participa.br" })
  26 +# harvest.run
  27 +# assert_not_equal harvest.last_harvest, nil
  28 +# Noosfero::Plugin::Settings.new(environment.reload, VirtuosoPlugin)
  29 +# assert_not_equal harvest.last_harvest, nil
  30 +# assert_not_equal harvest.last_harvest, Time.now.utc
  31 +# end
  32 +#
  33 +#end
0 \ No newline at end of file 34 \ No newline at end of file
plugins/virtuoso/views/virtuoso_plugin_admin/index.html.erb
@@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
7 <strong> 7 <strong>
8 <%= labelled_form_field _('Virtuoso URL:'), f.text_field(:virtuoso_uri, :size=> 60) %> 8 <%= labelled_form_field _('Virtuoso URL:'), f.text_field(:virtuoso_uri, :size=> 60) %>
9 <%= labelled_form_field _('Virtuoso Admin Username:'), f.text_field(:virtuoso_username, :size=> 60) %> 9 <%= labelled_form_field _('Virtuoso Admin Username:'), f.text_field(:virtuoso_username, :size=> 60) %>
10 - <%= labelled_form_field _('Virtuoso Admin Password:'), f.password_field(:virtuoso_password, :size=> 60) %> 10 + <%= labelled_form_field _('Virtuoso Admin Password:'), f.password_field(:virtuoso_password, :size=> 60, value: @settings.virtuoso_password) %>
11 <%= labelled_form_field _('Virtuoso Read-Only Username:'), f.text_field(:virtuoso_readonly_username, :size=> 60) %> 11 <%= labelled_form_field _('Virtuoso Read-Only Username:'), f.text_field(:virtuoso_readonly_username, :size=> 60) %>
12 - <%= labelled_form_field _('Virtuoso Read-Only Password:'), f.password_field(:virtuoso_readonly_password, :size=> 60) %> 12 + <%= labelled_form_field _('Virtuoso Read-Only Password:'), f.password_field(:virtuoso_readonly_password, :size=> 60, value: @settings.virtuoso_readonly_password) %>
13 </strong> 13 </strong>
14 <BR> 14 <BR>
15 <div class="dspace-servers-config-box" > 15 <div class="dspace-servers-config-box" >