diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-01-19 16:12:21 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-01-19 16:12:21 +0100 |
commit | 7b06ce45180a5b2c0dd0095cd1a60ec974b46aa5 (patch) | |
tree | 39d34044b9879d1bd22df1cc9005fcbe6a0afb00 /reach_reports | |
parent | bba009c7c59655392236e1cdaf873117bb59600f (diff) |
aa suport, rdf support
Diffstat (limited to 'reach_reports')
-rwxr-xr-x | reach_reports/reach_application.rb | 8 | ||||
-rwxr-xr-x | reach_reports/reach_persistance.rb | 4 | ||||
-rwxr-xr-x | reach_reports/reach_service.rb | 10 | ||||
-rwxr-xr-x | reach_reports/reach_test.rb | 18 |
4 files changed, 20 insertions, 20 deletions
diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 4187c1b..fd77078 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -20,8 +20,8 @@ get '/reach_report' do if request.env['HTTP_ACCEPT'] =~ /text\/html/ content_type "text/html" related_links = - "All validations: "+$sinatra.url_for("/",:full)+"\n"+ - "Validation reporting: "+$sinatra.url_for("/report",:full) + "All validations: "+url_for("/",:full)+"\n"+ + "Validation reporting: "+url_for("/report",:full) description = "A list of all suported REACH reporting types." OpenTox.text_to_html uri_list,related_links,description @@ -37,7 +37,7 @@ get '/reach_report/:type' do if request.env['HTTP_ACCEPT'] =~ /text\/html/ content_type "text/html" related_links = - "All REACH reporting types: "+$sinatra.url_for("/reach_report",:full) + "All REACH reporting types: "+url_for("/reach_report",:full) description = "A list of "+type+" reports." post_params = "" @@ -95,7 +95,7 @@ get '/reach_report/:type/:id' do content_type "text/html" related_links = "Open report in QMRF editor: "+rep.report_uri+"/editor"+"\n"+ - "All "+type+" reports: "+$sinatra.url_for("/reach_report/"+type,:full) + "All "+type+" reports: "+url_for("/reach_report/"+type,:full) description = "A QMRF report." OpenTox.text_to_html rep.to_yaml,related_links,description diff --git a/reach_reports/reach_persistance.rb b/reach_reports/reach_persistance.rb index a36e05f..ec45ba4 100755 --- a/reach_reports/reach_persistance.rb +++ b/reach_reports/reach_persistance.rb @@ -400,7 +400,7 @@ module ReachReports def self.get_uri( report ) raise "internal error, id not set "+to_yaml if report.id==nil - return $sinatra.url_for("/"+File.join(report.type,report.id.to_s), :full).to_s + return $url_provider.url_for("/"+File.join(report.type,report.id.to_s), :full).to_s end @@ -1006,7 +1006,7 @@ module ReachReports end def report_uri - return $sinatra.url_for("/reach_report/QMRF/"+@id.to_s, :full).to_s + return $url_provider.url_for("/reach_report/QMRF/"+@id.to_s, :full).to_s end def self.from_xml(report, xml_data) diff --git a/reach_reports/reach_service.rb b/reach_reports/reach_service.rb index 808d08a..5e11dc1 100755 --- a/reach_reports/reach_service.rb +++ b/reach_reports/reach_service.rb @@ -27,7 +27,7 @@ module ReachReports when /(?i)QMRF/ if params[:model_uri] task = OpenTox::Task.create( "Create "+type+" report", - $sinatra.url_for("/reach_report/"+type, :full) ) do |task| #, params + $url_provider.url_for("/reach_report/"+type, :full) ) do |task| #, params report = ReachReports::QmrfReport.new :model_uri => params[:model_uri] build_qmrf_report(report, task) @@ -39,17 +39,17 @@ module ReachReports ReachReports::QmrfReport.from_xml(report,input) result_uri = report.report_uri else - $sinatra.halt 400, "illegal parameters for qmrf-report creation, either\n"+ + raise OpenTox::BadRequestError.new "illegal parameters for qmrf-report creation, either\n"+ "* give 'model_uri' as param\n"+ "* provide xml file\n"+ "params given: "+params.inspect end when /(?i)QPRF/ - $sinatra.halt 400,"qprf report creation not yet implemented" + raise OpenTox::BadRequestError.new "qprf report creation not yet implemented" if params[:compound_uri] #report = ReachReports::QprfReport.new :compound_uri => params[:compound_uri] else - $sinatra.halt 400, "illegal parameters for qprf-report, use either\n"+ + raise OpenTox::BadRequestError.new "illegal parameters for qprf-report, use either\n"+ "* compound-uri\n"+ "params given: "+params.inspect end @@ -294,7 +294,7 @@ module ReachReports when /(?i)QPRF/ report = ReachReports::QprfReport.get(id) end - $sinatra.halt 404, type+" report with id '#{id}' not found." unless report + raise OpenTox::NotFoundError.new type+" report with id '#{id}' not found." unless report return report end end diff --git a/reach_reports/reach_test.rb b/reach_reports/reach_test.rb index 13625e5..4f7113b 100755 --- a/reach_reports/reach_test.rb +++ b/reach_reports/reach_test.rb @@ -11,10 +11,10 @@ LOGGER = OTLogger.new(STDOUT) LOGGER.datetime_format = "%Y-%m-%d %H:%M:%S " LOGGER.formatter = Logger::Formatter.new -#Rack::Test::DEFAULT_HOST = "localhost/validation" +#Rack::Test::DEFAULT_HOST = "local-ot/validation" module Sinatra module UrlForHelper - BASE = "http://localhost/validation" + BASE = "http://local-ot/validation" def url_for url_fragment, mode=:path_only case mode when :path_only @@ -109,19 +109,19 @@ class ReachTest < Test::Unit::TestCase # raise "File not found: "+file.path.to_s unless File.exist?(file.path) # data = File.read(file.path) # #puts "data found "+data.to_s[0..1000] -# puts OpenTox::RestClientWrapper.post("http://localhost/validation/reach_report/qmrf/20",{:content_type => "application/qmrf-xml"},data).to_s.chomp +# puts OpenTox::RestClientWrapper.post("http://local-ot/validation/reach_report/qmrf/20",{:content_type => "application/qmrf-xml"},data).to_s.chomp # post "/reach_report/qmrf/8" # puts last_response.body #model_uri = "http://ambit.uni-plovdiv.bg:8080/ambit2/model/173393" - model_uri = "http://localhost/model/1" - #http://localhost/majority/class/model/15 - #model_uri = "http://localhost/majority/class/model/15" - # model_uri = "http://localhost/majority/class/model/91" + model_uri = "http://local-ot/model/1" + #http://local-ot/majority/class/model/15 + #model_uri = "http://local-ot/majority/class/model/15" + # model_uri = "http://local-ot/majority/class/model/91" #model_uri = "http://apps.ideaconsult.net:8080/ambit2/model/2" - post '/reach_report/qmrf',:model_uri=>model_uri #http://localhost/model/1" - ##post '/reach_report/qprf',:compound_uri=>"http://localhost/compound/XYZ" + post '/reach_report/qmrf',:model_uri=>model_uri #http://local-ot/model/1" + ##post '/reach_report/qprf',:compound_uri=>"http://local-ot/compound/XYZ" uri = last_response.body puts "task: "+uri.to_s uri = Lib::TestUtil.wait_for_task(uri) |