diff options
author | mguetlein <martin.guetlein@gmail.com> | 2010-08-19 11:26:00 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2010-08-19 11:26:00 +0200 |
commit | f4c065998f6c918e67058b05ac17778cfbc57f58 (patch) | |
tree | be4a6cf71c7177bdb306344e052b456aa73b454e /reach_reports | |
parent | 0f5cc11dcecf6eda0a7230d69aa346cfb86c6a49 (diff) |
task title and creator, reach report minor fixes
Diffstat (limited to 'reach_reports')
-rw-r--r-- | reach_reports/reach_application.rb | 11 | ||||
-rw-r--r-- | reach_reports/reach_persistance.rb | 2 | ||||
-rw-r--r-- | reach_reports/reach_service.rb | 8 | ||||
-rw-r--r-- | reach_reports/reach_test.rb | 5 |
4 files changed, 17 insertions, 9 deletions
diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 596bae2..807800c 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -13,6 +13,11 @@ def extract_type(params) params.delete("type") end +get '/reach_report' do + content_type "text/uri-list" + url_for('/reach_report/QMRF', :full)+"\n"+url_for('/reach_report/QPRF', :full)+"\n" +end + get '/reach_report/:type' do content_type "text/uri-list" type = extract_type(params) @@ -57,12 +62,14 @@ end post '/reach_report/:type/:id' do type = extract_type(params) - LOGGER.info "set "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + LOGGER.info "Post to "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" rep = ReachReports.get_report(type, params[:id]) input = request.env["rack.input"].read - halt 400, "no xml data specified" unless input && input.to_s.size>0 + halt 400, "no xml data specified" unless input && input.to_s.size>0 + ReachReports::QmrfReport.from_xml(rep,input) + #f = File.new("/home/martin/info_home/.public_html/qmrf.out.xml","w") #f.puts rep.to_xml end diff --git a/reach_reports/reach_persistance.rb b/reach_reports/reach_persistance.rb index 98c41fe..0a0e32f 100644 --- a/reach_reports/reach_persistance.rb +++ b/reach_reports/reach_persistance.rb @@ -926,7 +926,7 @@ module ReachReports end def report_uri - return $sinatra.url_for("/QMRF/"+@id.to_s, :full).to_s + return $sinatra.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 d0ace96..795c81a 100644 --- a/reach_reports/reach_service.rb +++ b/reach_reports/reach_service.rb @@ -19,13 +19,13 @@ module ReachReports if params[:model_uri] report = ReachReports::QmrfReport.new :model_uri => params[:model_uri] build_qmrf_report(report) - elsif xml_data - input = xml_data.read + elsif xml_data and (input = xml_data.read).to_s.size>0 report = ReachReports::QmrfReport.new ReachReports::QmrfReport.from_xml(report,input) else - $sinatra.halt 400, "illegal parameters for qmrf-report, use either\n"+ - "* model_uri\n"+ + $sinatra.halt 400, "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/ diff --git a/reach_reports/reach_test.rb b/reach_reports/reach_test.rb index f2ad251..3f4609a 100644 --- a/reach_reports/reach_test.rb +++ b/reach_reports/reach_test.rb @@ -89,11 +89,12 @@ class ReachTest < Test::Unit::TestCase #$test_case = self - file = File.new("qmrf-report.xml") + #file = File.new("qmrf-report.xml") + file = File.new("/home/martin/win/home/test2.xml") 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",{:content_type => "application/qmrf-xml"},data).to_s.chomp + puts OpenTox::RestClientWrapper.post("http://localhost/validation/reach_report/qmrf/20",{:content_type => "application/qmrf-xml"},data).to_s.chomp #post "/reach_report/qmrf/2" #puts last_response.body |