diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-01-28 12:41:49 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-01-28 12:41:49 +0100 |
commit | 4466015d27af0a5424953eb7f1502994d73027cf (patch) | |
tree | 15284419dfa5fe384fe74bdeda03c45650a68b53 | |
parent | 9750da9cb7dc14309be38f98bc0b50c8bff9eb72 (diff) |
whitelist validation-non-resource-uris, minor fixes
-rwxr-xr-x | application.rb | 3 | ||||
-rwxr-xr-x | lib/ot_predictions.rb | 2 | ||||
-rwxr-xr-x | report/report_application.rb | 2 | ||||
-rwxr-xr-x | test/test_examples_util.rb | 8 | ||||
-rwxr-xr-x | validation/validation_service.rb | 1 | ||||
-rwxr-xr-x | validation/validation_test.rb | 6 |
6 files changed, 16 insertions, 6 deletions
diff --git a/application.rb b/application.rb index cf9621d..319a95d 100755 --- a/application.rb +++ b/application.rb @@ -13,6 +13,9 @@ end require "example.rb" +# this allows GET access to all validation URIS that do NOT end with /<number> or /<number>/ +OpenTox::Authorization.whitelist( /\/[0-9]+(\/?)$/, "GET", true ) + get '/examples/?' do LOGGER.info "list examples" diff --git a/lib/ot_predictions.rb b/lib/ot_predictions.rb index c593f55..e28f35b 100755 --- a/lib/ot_predictions.rb +++ b/lib/ot_predictions.rb @@ -41,7 +41,7 @@ module Lib raise "prediction_feature not found in test_dataset, specify a test_target_dataset\n"+ "prediction_feature: '"+prediction_feature.to_s+"'\n"+ "test_dataset: '"+test_target_dataset_uri.to_s+"'\n"+ - "available features are: "+test_target_dataset.features.inspect if test_target_dataset.features.index(prediction_feature)==nil + "available features are: "+test_target_dataset.features.inspect if test_target_dataset.features.keys.index(prediction_feature)==nil else test_target_dataset = OpenTox::Dataset.find test_target_dataset_uri,subjectid raise "test target datset not found: '"+test_target_dataset_uri.to_s+"'" unless test_target_dataset diff --git a/report/report_application.rb b/report/report_application.rb index 9fcf871..8403b4c 100755 --- a/report/report_application.rb +++ b/report/report_application.rb @@ -92,7 +92,7 @@ get '/report/:type/:id' do end end -OpenTox::Authorization.whitelist( Regexp.new("/report/.*/[0-9]+/.*"),"GET") +#OpenTox::Authorization.whitelist( Regexp.new("/report/.*/[0-9]+/.*"),"GET") get '/report/:type/:id/:resource' do perform do |rs| diff --git a/test/test_examples_util.rb b/test/test_examples_util.rb index 02d5921..c465d94 100755 --- a/test/test_examples_util.rb +++ b/test/test_examples_util.rb @@ -66,12 +66,15 @@ module ValidationExamples end def self.validation_get(uri, accept_header='application/rdf+xml') + params = {} + params[:subjectid] = SUBJECTID if SUBJECTID if $test_case #puts "getting "+uri+","+accept_header - $test_case.get uri,nil,'HTTP_ACCEPT' => accept_header + $test_case.get uri,params,'HTTP_ACCEPT' => accept_header return wait($test_case.last_response.body) else - return OpenTox::RestClientWrapper.get(File.join(CONFIG[:services]["opentox-validation"],uri),{:accept => accept_header}) + params[:accept] = accept_header + return OpenTox::RestClientWrapper.get(File.join(CONFIG[:services]["opentox-validation"],uri),params) end end @@ -291,6 +294,7 @@ module ValidationExamples def report begin @report_uri = Util.validation_post '/report/'+report_type,{:validation_uris => @validation_uri} + Util.validation_get "/report/"+report_uri.split("/")[-2]+"/"+report_uri.split("/")[-1] rescue => ex puts "could not create report: "+ex.message raise ex diff --git a/validation/validation_service.rb b/validation/validation_service.rb index fa638cf..2208116 100755 --- a/validation/validation_service.rb +++ b/validation/validation_service.rb @@ -156,6 +156,7 @@ module Validation #prediction_dataset_uri = model.predict_dataset(self.test_dataset_uri, OpenTox::SubTask.create(task, 0, 50)) prediction_dataset_uri = model.run( {:dataset_uri => self.test_dataset_uri, :subjectid => self.subjectid}, + "text/uri-list", OpenTox::SubTask.create(task, 0, 50)) end # self.attributes = { :prediction_dataset_uri => prediction_dataset_uri, diff --git a/validation/validation_test.rb b/validation/validation_test.rb index 603b270..c368747 100755 --- a/validation/validation_test.rb +++ b/validation/validation_test.rb @@ -140,7 +140,7 @@ class ValidationTest < Test::Unit::TestCase #puts OpenTox::Authorization.list_policy_uris(SUBJECTID).inspect - run_test("14a",nil,nil,false) #,{:dataset_uri=>"http://local-ot/dataset/45", :prediction_feature => "http://local-ot/dataset/45/feature/Hamster%20Carcinogenicity"}) + run_test("15a",nil,nil,false) #,{:dataset_uri=>"http://local-ot/dataset/45", :prediction_feature => "http://local-ot/dataset/45/feature/Hamster%20Carcinogenicity"}) #get "/12123123123123123" #get "/chain" @@ -176,7 +176,7 @@ class ValidationTest < Test::Unit::TestCase #do_test_examples_ortona ensure - OpenTox::Authorization.logout(SUBJECTID) if AA_SERVER + #OpenTox::Authorization.logout(SUBJECTID) if AA_SERVER end end @@ -206,10 +206,12 @@ class ValidationTest < Test::Unit::TestCase ex.check_requirements ex.validate LOGGER.debug "validation done '"+ex.validation_uri.to_s+"'" + puts ex.validation_uri+"?subjectid="+CGI.escape(SUBJECTID) if SUBJECTID and !delete end ex.report_uri = report_uri unless ex.report_uri ex.report + puts ex.report_uri+"?subjectid="+CGI.escape(SUBJECTID) if SUBJECTID and !delete end ##ex.verify_yaml ##ex.compare_yaml_vs_rdf |